diff options
| author | Jim Ingham <jingham@apple.com> | 2010-11-05 19:25:48 +0000 |
|---|---|---|
| committer | Jim Ingham <jingham@apple.com> | 2010-11-05 19:25:48 +0000 |
| commit | 399f1cafa64b9dc15be5b8b48bfd12d5449e5b6e (patch) | |
| tree | 1d757ec2b7949c08bcc1260ad9392327c422040a /lldb/source/Target | |
| parent | 2bab7570f5a4930f25f748bdc7d5187c6f4cb383 (diff) | |
| download | bcm5719-llvm-399f1cafa64b9dc15be5b8b48bfd12d5449e5b6e.tar.gz bcm5719-llvm-399f1cafa64b9dc15be5b8b48bfd12d5449e5b6e.zip | |
Added the equivalent of gdb's "unwind-on-signal" to the expression command, and a parameter to control it in ClangUserExpression, and on down to ClangFunction.
llvm-svn: 118290
Diffstat (limited to 'lldb/source/Target')
| -rw-r--r-- | lldb/source/Target/Process.cpp | 8 | ||||
| -rw-r--r-- | lldb/source/Target/Thread.cpp | 47 |
2 files changed, 45 insertions, 10 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index fa7ac71c89e..d544a4f61ba 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -505,13 +505,13 @@ Process::LoadImage (const FileSpec &image_spec, Error &error) { ExecutionContext exe_ctx; frame_sp->CalculateExecutionContext (exe_ctx); - + bool unwind_on_error = true; StreamString expr; char path[PATH_MAX]; image_spec.GetPath(path, sizeof(path)); expr.Printf("dlopen (\"%s\", 2)", path); const char *prefix = "extern \"C\" void* dlopen (const char *path, int mode);\n"; - lldb::ValueObjectSP result_valobj_sp (ClangUserExpression::Evaluate (exe_ctx, expr.GetData(), prefix)); + lldb::ValueObjectSP result_valobj_sp (ClangUserExpression::Evaluate (exe_ctx, unwind_on_error, expr.GetData(), prefix)); if (result_valobj_sp->GetError().Success()) { Scalar scalar; @@ -571,11 +571,11 @@ Process::UnloadImage (uint32_t image_token) { ExecutionContext exe_ctx; frame_sp->CalculateExecutionContext (exe_ctx); - + bool unwind_on_error = true; StreamString expr; expr.Printf("dlclose ((void *)0x%llx)", image_addr); const char *prefix = "extern \"C\" int dlclose(void* handle);\n"; - lldb::ValueObjectSP result_valobj_sp (ClangUserExpression::Evaluate (exe_ctx, expr.GetData(), prefix)); + lldb::ValueObjectSP result_valobj_sp (ClangUserExpression::Evaluate (exe_ctx, unwind_on_error, expr.GetData(), prefix)); if (result_valobj_sp->GetError().Success()) { Scalar scalar; diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index 9bd7e76b8e0..231dc033210 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -490,14 +490,49 @@ Thread::QueueThreadPlan (ThreadPlanSP &thread_plan_sp, bool abort_other_plans) } void -Thread::DiscardThreadPlans(bool force) +Thread::DiscardThreadPlansUpToPlan (lldb::ThreadPlanSP &up_to_plan_sp) { - // FIXME: It is not always safe to just discard plans. Some, like the step over - // breakpoint trap can't be discarded in general (though you can if you plan to - // force a return from a function, for instance. - // For now I'm just not clearing immediate plans, but I need a way for plans to - // say they really need to be kept on, and then a way to override that. Humm... + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + if (log) + { + log->Printf("Discarding thread plans for thread tid = 0x%4.4x, up to %p", GetID(), up_to_plan_sp.get()); + } + int stack_size = m_plan_stack.size(); + + // If the input plan is NULL, discard all plans. Otherwise make sure this plan is in the + // stack, and if so discard up to and including it. + + if (up_to_plan_sp.get() == NULL) + { + for (int i = stack_size - 1; i > 0; i--) + DiscardPlan(); + } + else + { + bool found_it = false; + for (int i = stack_size - 1; i > 0; i--) + { + if (m_plan_stack[i] == up_to_plan_sp) + found_it = true; + } + if (found_it) + { + bool last_one = false; + for (int i = stack_size - 1; i > 0 && !last_one ; i--) + { + if (GetCurrentPlan() == up_to_plan_sp.get()) + last_one = true; + DiscardPlan(); + } + } + } + return; +} + +void +Thread::DiscardThreadPlans(bool force) +{ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); if (log) { |

