Implement support for inspecting variables with LLDB/GDB

fixes #12407
This commit is contained in:
Gunnar Beutner 2016-08-12 11:00:19 +02:00
parent 06b5f06494
commit 76ed38fbfe
1 changed files with 34 additions and 0 deletions

View File

@ -48,6 +48,40 @@ REGISTER_CLICOMMAND("console", ConsoleCommand);
INITIALIZE_ONCE(&ConsoleCommand::StaticInitialize); INITIALIZE_ONCE(&ConsoleCommand::StaticInitialize);
extern "C" void dbg_spawn_console(void)
{
ScriptFrame frame;
ConsoleCommand::RunScriptConsole(frame);
}
extern "C" void dbg_inspect_value(const Value& value)
{
ConfigWriter::EmitValue(std::cout, 1, Serialize(value, 0));
std::cout << std::endl;
}
extern "C" void dbg_inspect_object(Object *obj)
{
Object::Ptr objr = obj;
dbg_inspect_value(objr);
}
extern "C" void dbg_eval(const char *text)
{
Expression *expr;
try {
ScriptFrame frame;
expr = ConfigCompiler::CompileText("<dbg>", text);
Value result = Serialize(expr->Evaluate(frame), 0);
dbg_inspect_value(result);
} catch (const std::exception& ex) {
std::cout << "Error: " << DiagnosticInformation(ex) << "\n";
}
delete expr;
}
void ConsoleCommand::BreakpointHandler(ScriptFrame& frame, ScriptError *ex, const DebugInfo& di) void ConsoleCommand::BreakpointHandler(ScriptFrame& frame, ScriptError *ex, const DebugInfo& di)
{ {
static boost::mutex mutex; static boost::mutex mutex;