summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2016-02-26 01:37:30 +0000
committerJim Ingham <jingham@apple.com>2016-02-26 01:37:30 +0000
commit970bb9e0ec3f45e4bb3212d6de928a13b87da402 (patch)
tree2cefddf04323c5eabd10190b3740afe1134e5310 /lldb/source
parent2c6bd903edd49bb7b8eb9ad8ad12fe56db1f9fb9 (diff)
downloadbcm5719-llvm-970bb9e0ec3f45e4bb3212d6de928a13b87da402.tar.gz
bcm5719-llvm-970bb9e0ec3f45e4bb3212d6de928a13b87da402.zip
Add the "block" keyword to "thread step-in -e", and an alias that uses it: "sif <target function>" - i.e. step-into-function
to allow you to step through a complex calling sequence into a particular function that may span multiple lines. Also some test cases for this and the --step-target feature. llvm-svn: 261953
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/Commands/CommandObjectThread.cpp35
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp10
2 files changed, 42 insertions, 3 deletions
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index 349605d1fb1..fa273d6b7d9 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -386,6 +386,11 @@ public:
case 'e':
{
+ if (strcmp(option_arg, "block") == 0)
+ {
+ m_end_line_is_block_end = 1;
+ break;
+ }
uint32_t tmp_end_line = StringConvert::ToUInt32(option_arg, UINT32_MAX, 0);
if (tmp_end_line == UINT32_MAX)
error.SetErrorStringWithFormat ("invalid end line number '%s'", option_arg);
@@ -429,6 +434,7 @@ public:
m_class_name.clear();
m_step_count = 1;
m_end_line = LLDB_INVALID_LINE_NUMBER;
+ m_end_line_is_block_end = false;
}
const OptionDefinition*
@@ -450,6 +456,7 @@ public:
std::string m_class_name;
uint32_t m_step_count;
uint32_t m_end_line;
+ bool m_end_line_is_block_end;
};
CommandObjectThreadStepWithTypeAndScope (CommandInterpreter &interpreter,
@@ -588,6 +595,30 @@ protected:
return false;
}
}
+ else if (m_options.m_end_line_is_block_end)
+ {
+ Error error;
+ Block *block = frame->GetSymbolContext(eSymbolContextBlock).block;
+ if (!block)
+ {
+ result.AppendErrorWithFormat("Could not find the current block.");
+ result.SetStatus(eReturnStatusFailed);
+ return false;
+ }
+
+ AddressRange block_range;
+ Address pc_address = frame->GetFrameCodeAddress();
+ block->GetRangeContainingAddress(pc_address, block_range);
+ if (!block_range.GetBaseAddress().IsValid())
+ {
+ result.AppendErrorWithFormat("Could not find the current block address.");
+ result.SetStatus(eReturnStatusFailed);
+ return false;
+ }
+ lldb::addr_t pc_offset_in_block = pc_address.GetFileAddress() - block_range.GetBaseAddress().GetFileAddress();
+ lldb::addr_t range_length = block_range.GetByteSize() - pc_offset_in_block;
+ range = AddressRange(pc_address, range_length);
+ }
else
{
range = sc.line_entry.range;
@@ -741,7 +772,9 @@ CommandObjectThreadStepWithTypeAndScope::CommandOptions::g_option_table[] =
{ LLDB_OPT_SET_1, false, "step-in-avoids-no-debug", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 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, nullptr, nullptr, 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, "count", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 1, eArgTypeCount, "How many times to perform the stepping operation - currently only supported for step-inst and next-inst."},
-{ LLDB_OPT_SET_1, false, "end-linenumber", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 1, eArgTypeLineNum, "The line at which to stop stepping - defaults to the next line and only supported for step-in and step-over."},
+{ LLDB_OPT_SET_1, false, "end-linenumber", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 1, eArgTypeLineNum, "The line at which to stop stepping - defaults to the next line and only supported for step-in and step-over."
+ " You can also pass the string 'block' to step to the end of the current block."
+ " This is particularly useful in conjunction with --step-target to step through a complex calling sequence."},
{ LLDB_OPT_SET_1, false, "run-mode", 'm', OptionParser::eRequiredArgument, nullptr, 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, nullptr, nullptr, 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, nullptr, nullptr, 0, eArgTypeFunctionName, "The name of the directly called function step in should stop at when stepping into."},
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index c99ff594568..20fe467800a 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -185,6 +185,9 @@ CommandInterpreter::Initialize ()
LoadCommandDictionary ();
+ // An alias arguments vector to reuse - reset it before use...
+ OptionArgVectorSP alias_arguments_vector_sp (new OptionArgVector);
+
// Set up some initial aliases.
CommandObjectSP cmd_obj_sp = GetCommandSPExact ("quit", false);
if (cmd_obj_sp)
@@ -239,6 +242,11 @@ CommandInterpreter::Initialize ()
{
AddAlias ("s", cmd_obj_sp);
AddAlias ("step", cmd_obj_sp);
+
+ alias_arguments_vector_sp.reset (new OptionArgVector);
+ ProcessAliasOptionsArgs (cmd_obj_sp, "--end-linenumber block --step-in-target %1", alias_arguments_vector_sp);
+ AddAlias ("sif", cmd_obj_sp);
+ AddOrReplaceAliasOptions("sif", alias_arguments_vector_sp);
}
cmd_obj_sp = GetCommandSPExact ("thread step-over", false);
@@ -329,8 +337,6 @@ CommandInterpreter::Initialize ()
AddAlias ("image", cmd_obj_sp);
- OptionArgVectorSP alias_arguments_vector_sp (new OptionArgVector);
-
cmd_obj_sp = GetCommandSPExact ("expression", false);
if (cmd_obj_sp)
{
OpenPOWER on IntegriCloud