diff options
author | Jim Ingham <jingham@apple.com> | 2010-10-14 23:45:03 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2010-10-14 23:45:03 +0000 |
commit | 36f3b369d2632e6898166c0e697f85e2ab458ece (patch) | |
tree | 62bfedb1bc23100bdf34b43673fa90dbc0f38d5e /lldb/source/Expression/ClangUserExpression.cpp | |
parent | 3f1cf0f373ab9915d4f7dff04c57017c62869386 (diff) | |
download | bcm5719-llvm-36f3b369d2632e6898166c0e697f85e2ab458ece.tar.gz bcm5719-llvm-36f3b369d2632e6898166c0e697f85e2ab458ece.zip |
Added support for breakpoint conditions. I also had to separate the "run the expression" part of ClangFunction::Execute from the "Gather the expression result" so that in the case of the Breakpoint condition I can move the condition evaluation into the normal thread plan processing.
Also added support for remembering the "last set breakpoint" so that "break modify" will act on the last set breakpoint.
llvm-svn: 116542
Diffstat (limited to 'lldb/source/Expression/ClangUserExpression.cpp')
-rw-r--r-- | lldb/source/Expression/ClangUserExpression.cpp | 87 |
1 files changed, 64 insertions, 23 deletions
diff --git a/lldb/source/Expression/ClangUserExpression.cpp b/lldb/source/Expression/ClangUserExpression.cpp index 4aabf521511..c1eeb24e273 100644 --- a/lldb/source/Expression/ClangUserExpression.cpp +++ b/lldb/source/Expression/ClangUserExpression.cpp @@ -215,27 +215,18 @@ ClangUserExpression::Parse (Stream &error_stream, ExecutionContext &exe_ctx) } bool -ClangUserExpression::Execute (Stream &error_stream, - ExecutionContext &exe_ctx, - ClangExpressionVariable *&result) +ClangUserExpression::PrepareToExecuteJITExpression (Stream &error_stream, + ExecutionContext &exe_ctx, + lldb::addr_t &struct_address, + lldb::addr_t object_ptr) { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); - if (m_dwarf_opcodes.get()) - { - // TODO execute the JITted opcodes - - error_stream.Printf("We don't currently support executing DWARF expressions"); - - return false; - } - else if (m_jit_addr != LLDB_INVALID_ADDRESS) + if (m_jit_addr != LLDB_INVALID_ADDRESS) { - lldb::addr_t struct_address; Error materialize_error; - lldb::addr_t object_ptr = NULL; if (m_needs_object_ptr && !(m_expr_decl_map->GetObjectPointer(object_ptr, &exe_ctx, materialize_error))) { @@ -274,6 +265,64 @@ ClangUserExpression::Execute (Stream &error_stream, } } } + } + return true; +} + +ThreadPlan * +ClangUserExpression::GetThreadPlanToExecuteJITExpression (Stream &error_stream, + ExecutionContext &exe_ctx) +{ + lldb::addr_t struct_address; + + lldb::addr_t object_ptr = NULL; + + PrepareToExecuteJITExpression (error_stream, exe_ctx, struct_address, object_ptr); + + return ClangFunction::GetThreadPlanToCallFunction (exe_ctx, + m_jit_addr, + struct_address, + error_stream, + true, + true, + (m_needs_object_ptr ? &object_ptr : NULL)); +} + +bool +ClangUserExpression::FinalizeJITExecution (Stream &error_stream, + ExecutionContext &exe_ctx, + ClangExpressionVariable *&result) +{ + Error expr_error; + + if (!m_expr_decl_map->Dematerialize(&exe_ctx, result, expr_error)) + { + error_stream.Printf ("Couldn't dematerialize struct : %s\n", expr_error.AsCString("unknown error")); + return false; + } + return true; +} + +bool +ClangUserExpression::Execute (Stream &error_stream, + ExecutionContext &exe_ctx, + ClangExpressionVariable *&result) +{ + if (m_dwarf_opcodes.get()) + { + // TODO execute the JITted opcodes + + error_stream.Printf("We don't currently support executing DWARF expressions"); + + return false; + } + else if (m_jit_addr != LLDB_INVALID_ADDRESS) + { + lldb::addr_t struct_address; + + lldb::addr_t object_ptr = NULL; + + PrepareToExecuteJITExpression (error_stream, exe_ctx, struct_address, object_ptr); ClangFunction::ExecutionResults execution_result = ClangFunction::ExecuteFunction (exe_ctx, @@ -312,15 +361,7 @@ ClangUserExpression::Execute (Stream &error_stream, return false; } - Error expr_error; - - if (!m_expr_decl_map->Dematerialize(&exe_ctx, result, expr_error)) - { - error_stream.Printf ("Couldn't dematerialize struct : %s\n", expr_error.AsCString("unknown error")); - return false; - } - - return true; + return FinalizeJITExecution (error_stream, exe_ctx, result); } else { |