diff options
author | Greg Clayton <gclayton@apple.com> | 2013-11-04 19:35:17 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2013-11-04 19:35:17 +0000 |
commit | 62afb9f663be1f80d80e3b25ba5fe69245bd28b9 (patch) | |
tree | e6fa5fdcf76c3390c4a8986098eb2be5d82616b9 /lldb/source/Target/Process.cpp | |
parent | cfcfee0be4fef4061834a0eabbf33b63074efec3 (diff) | |
download | bcm5719-llvm-62afb9f663be1f80d80e3b25ba5fe69245bd28b9.tar.gz bcm5719-llvm-62afb9f663be1f80d80e3b25ba5fe69245bd28b9.zip |
Added a "--debug" option to the "expression" command.
Cleaned up ClangUserExpression::Evaluate() to have only one variant that takes a "const EvaluateExpressionOptions& options" instead of taking many arguments.
The "--debug" option is designed to allow you to debug your expression by stopping at the first instruction (it enables --ignore-breakpoints=true and --unwind-on-error=false) and allowing you to step through your JIT code. It needs to be more integrated with the thread plan, so I am checking this in so Jim Ingham can make it happen.
llvm-svn: 194009
Diffstat (limited to 'lldb/source/Target/Process.cpp')
-rw-r--r-- | lldb/source/Target/Process.cpp | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 738ed5f9fee..fcab7aff4a9 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -1814,35 +1814,36 @@ Process::LoadImage (const FileSpec &image_spec, Error &error) { ExecutionContext exe_ctx; frame_sp->CalculateExecutionContext (exe_ctx); - const bool unwind_on_error = true; - const bool ignore_breakpoints = true; + EvaluateExpressionOptions expr_options; + expr_options.SetUnwindOnError(true); + expr_options.SetIgnoreBreakpoints(true); + expr_options.SetExecutionPolicy(eExecutionPolicyAlways); StreamString expr; expr.Printf("dlopen (\"%s\", 2)", path); const char *prefix = "extern \"C\" void* dlopen (const char *path, int mode);\n"; lldb::ValueObjectSP result_valobj_sp; + Error expr_error; ClangUserExpression::Evaluate (exe_ctx, - eExecutionPolicyAlways, - lldb::eLanguageTypeUnknown, - ClangUserExpression::eResultTypeAny, - unwind_on_error, - ignore_breakpoints, + expr_options, expr.GetData(), prefix, result_valobj_sp, - true, - ClangUserExpression::kDefaultTimeout); - error = result_valobj_sp->GetError(); - if (error.Success()) + expr_error); + if (expr_error.Success()) { - Scalar scalar; - if (result_valobj_sp->ResolveValue (scalar)) + error = result_valobj_sp->GetError(); + if (error.Success()) { - addr_t image_ptr = scalar.ULongLong(LLDB_INVALID_ADDRESS); - if (image_ptr != 0 && image_ptr != LLDB_INVALID_ADDRESS) + Scalar scalar; + if (result_valobj_sp->ResolveValue (scalar)) { - uint32_t image_token = m_image_tokens.size(); - m_image_tokens.push_back (image_ptr); - return image_token; + addr_t image_ptr = scalar.ULongLong(LLDB_INVALID_ADDRESS); + if (image_ptr != 0 && image_ptr != LLDB_INVALID_ADDRESS) + { + uint32_t image_token = m_image_tokens.size(); + m_image_tokens.push_back (image_ptr); + return image_token; + } } } } @@ -1891,23 +1892,21 @@ Process::UnloadImage (uint32_t image_token) { ExecutionContext exe_ctx; frame_sp->CalculateExecutionContext (exe_ctx); - const bool unwind_on_error = true; - const bool ignore_breakpoints = true; + EvaluateExpressionOptions expr_options; + expr_options.SetUnwindOnError(true); + expr_options.SetIgnoreBreakpoints(true); + expr_options.SetExecutionPolicy(eExecutionPolicyAlways); StreamString expr; expr.Printf("dlclose ((void *)0x%" PRIx64 ")", image_addr); const char *prefix = "extern \"C\" int dlclose(void* handle);\n"; lldb::ValueObjectSP result_valobj_sp; + Error expr_error; ClangUserExpression::Evaluate (exe_ctx, - eExecutionPolicyAlways, - lldb::eLanguageTypeUnknown, - ClangUserExpression::eResultTypeAny, - unwind_on_error, - ignore_breakpoints, + expr_options, expr.GetData(), prefix, result_valobj_sp, - true, - ClangUserExpression::kDefaultTimeout); + expr_error); if (result_valobj_sp->GetError().Success()) { Scalar scalar; |