diff options
author | Jim Ingham <jingham@apple.com> | 2014-03-13 02:47:14 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2014-03-13 02:47:14 +0000 |
commit | 4b4b2478fc4a08d035a7653ae7acaa1853553b34 (patch) | |
tree | b8515657d5f9554f47877b15f8f9c06c05e5b2df /lldb/source/Commands/CommandObjectThread.cpp | |
parent | 3e89dfee00f647b9aff301d2fd1076b008666481 (diff) | |
download | bcm5719-llvm-4b4b2478fc4a08d035a7653ae7acaa1853553b34.tar.gz bcm5719-llvm-4b4b2478fc4a08d035a7653ae7acaa1853553b34.zip |
This commit reworks how the thread plan's ShouldStopHere mechanism works, so that it is useful not only
for customizing "step-in" behavior (e.g. step-in doesn't step into code with no debug info), but also
the behavior of step-in/step-out and step-over when they step out of the frame they started in.
I also added as a proof of concept of this reworking a mode for stepping where stepping out of a frame
into a frame with no debug information will continue stepping out till it arrives at a frame that does
have debug information. This is useful when you are debugging callback based code where the callbacks
are separated from the code that initiated them by some library glue you don't care about, among other
things.
llvm-svn: 203747
Diffstat (limited to 'lldb/source/Commands/CommandObjectThread.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectThread.cpp | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index 10d661882c9..b693cb37345 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -348,9 +348,26 @@ public: case 'a': { bool success; - m_avoid_no_debug = Args::StringToBoolean (option_arg, true, &success); + bool avoid_no_debug = Args::StringToBoolean (option_arg, true, &success); if (!success) error.SetErrorStringWithFormat("invalid boolean value for option '%c'", short_option); + else + { + m_step_in_avoid_no_debug = avoid_no_debug ? eLazyBoolYes : eLazyBoolNo; + } + } + break; + + case 'A': + { + bool success; + bool avoid_no_debug = Args::StringToBoolean (option_arg, true, &success); + if (!success) + error.SetErrorStringWithFormat("invalid boolean value for option '%c'", short_option); + else + { + m_step_out_avoid_no_debug = avoid_no_debug ? eLazyBoolYes : eLazyBoolNo; + } } break; @@ -386,7 +403,8 @@ public: void OptionParsingStarting () { - m_avoid_no_debug = true; + m_step_in_avoid_no_debug = eLazyBoolCalculate; + m_step_out_avoid_no_debug = eLazyBoolCalculate; m_run_mode = eOnlyDuringStepping; m_avoid_regexp.clear(); m_step_in_target.clear(); @@ -403,7 +421,8 @@ public: static OptionDefinition g_option_table[]; // Instance variables to hold the values for command options. - bool m_avoid_no_debug; + LazyBool m_step_in_avoid_no_debug; + LazyBool m_step_out_avoid_no_debug; RunMode m_run_mode; std::string m_avoid_regexp; std::string m_step_in_target; @@ -522,7 +541,9 @@ protected: frame->GetSymbolContext(eSymbolContextEverything), m_options.m_step_in_target.c_str(), stop_other_threads, - m_options.m_avoid_no_debug); + m_options.m_step_in_avoid_no_debug, + m_options.m_step_out_avoid_no_debug); + if (new_plan_sp && !m_options.m_avoid_regexp.empty()) { ThreadPlanStepInRange *step_in_range_plan = static_cast<ThreadPlanStepInRange *> (new_plan_sp.get()); @@ -541,7 +562,8 @@ protected: new_plan_sp = thread->QueueThreadPlanForStepOverRange (abort_other_plans, frame->GetSymbolContext(eSymbolContextEverything).line_entry.range, frame->GetSymbolContext(eSymbolContextEverything), - stop_other_threads); + stop_other_threads, + m_options.m_step_out_avoid_no_debug); else new_plan_sp = thread->QueueThreadPlanForStepSingleInstruction (true, abort_other_plans, @@ -564,7 +586,8 @@ protected: bool_stop_other_threads, eVoteYes, eVoteNoOpinion, - thread->GetSelectedFrameIndex()); + thread->GetSelectedFrameIndex(), + m_options.m_step_out_avoid_no_debug); } else { @@ -639,7 +662,8 @@ g_duo_running_mode[] = OptionDefinition CommandObjectThreadStepWithTypeAndScope::CommandOptions::g_option_table[] = { -{ LLDB_OPT_SET_1, false, "avoid-no-debug", 'a', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "A boolean value that sets whether step-in will step over functions with no debug information."}, +{ LLDB_OPT_SET_1, false, "step-in-avoids-no-debug", 'a', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "A boolean value that sets whether stepping into functions will step over functions with no debug information."}, +{ LLDB_OPT_SET_1, false, "step-out-avoids-no-debug", 'A', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "A boolean value, if true stepping out of functions will continue to step out till it hits a function with debug information."}, { LLDB_OPT_SET_1, false, "run-mode", 'm', OptionParser::eRequiredArgument, g_tri_running_mode, 0, eArgTypeRunMode, "Determine how to run other threads while stepping the current thread."}, { LLDB_OPT_SET_1, false, "step-over-regexp",'r', OptionParser::eRequiredArgument, NULL, 0, eArgTypeRegularExpression, "A regular expression that defines function names to not to stop at when stepping in."}, { LLDB_OPT_SET_1, false, "step-in-target", 't', OptionParser::eRequiredArgument, NULL, 0, eArgTypeFunctionName, "The name of the directly called function step in should stop at when stepping into."}, |