mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 20:59:16 +00:00
HackStudio: Add evaluate expression popup to debugger
This implements a dialog that can be used to evaluate a JS expression in the HackStudio's Debugger context. It also implements simple C++ Variable <-> JS Value conversion, allowing for JS expressions to read/write variables in the debugger scope. Currently, C++ structs are mapped to JS objects by way of a JS proxy, however this leads to issues when printing, so this will be changed in a later commit.
This commit is contained in:
parent
bee16bb83a
commit
60d329a186
Notes:
sideshowbarker
2024-07-18 19:06:14 +09:00
Author: https://github.com/FalseHonesty
Commit: 60d329a186
Pull-request: https://github.com/SerenityOS/serenity/pull/6285
Reviewed-by: https://github.com/itamar8910 ✅
Reviewed-by: https://github.com/linusg
7 changed files with 378 additions and 1 deletions
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Hunter Salyer <thefalsehonesty@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Weakable.h>
|
||||
#include <LibDebug/DebugInfo.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
|
||||
namespace HackStudio {
|
||||
|
||||
class DebuggerGlobalJSObject final
|
||||
: public JS::GlobalObject
|
||||
, public Weakable<DebuggerGlobalJSObject> {
|
||||
JS_OBJECT(DebuggerGlobalJSObject, JS::GlobalObject);
|
||||
|
||||
public:
|
||||
DebuggerGlobalJSObject();
|
||||
|
||||
JS::Value get(const JS::PropertyName& name, JS::Value receiver, bool without_side_effects) const override;
|
||||
bool put(const JS::PropertyName& name, JS::Value value, JS::Value receiver) override;
|
||||
|
||||
private:
|
||||
Optional<JS::Value> debugger_to_js(const Debug::DebugInfo::VariableInfo&) const;
|
||||
Optional<u32> js_to_debugger(JS::Value value, const Debug::DebugInfo::VariableInfo&) const;
|
||||
|
||||
private:
|
||||
NonnullOwnPtrVector<Debug::DebugInfo::VariableInfo> m_variables;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue