Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion lldb/source/Interpreter/CommandInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ void CommandInterpreter::Initialize() {
AddAlias("ni", cmd_obj_sp);
}

cmd_obj_sp = GetCommandSPExact("thread step-in");
cmd_obj_sp = GetCommandSPExact("_regexp-step");
if (cmd_obj_sp) {
AddAlias("s", cmd_obj_sp);
AddAlias("step", cmd_obj_sp);
Expand Down Expand Up @@ -946,6 +946,27 @@ void CommandInterpreter::LoadCommandDictionary() {
jump_regex_cmd_sp;
}
}

std::shared_ptr<CommandObjectRegexCommand> step_regex_cmd_sp(
new CommandObjectRegexCommand(
*this, "_regexp-step",
"Single step, optionally to a specific function.",
"\n"
"_regexp-step // Single step\n"
"_regexp-step <function-name> // Step into the named function\n",
0, false));
if (step_regex_cmd_sp) {
if (step_regex_cmd_sp->AddRegexCommand("^[[:space:]]*$",
"thread step-in") &&
step_regex_cmd_sp->AddRegexCommand("^[[:space:]]*(-.+)$",
"thread step-in %1") &&
step_regex_cmd_sp->AddRegexCommand(
"^[[:space:]]*(.+)[[:space:]]*$",
"thread step-in --end-linenumber block --step-in-target %1")) {
m_command_dict[std::string(step_regex_cmd_sp->GetCommandName())] =
step_regex_cmd_sp;
}
}
}

int CommandInterpreter::GetCommandNamesMatchingPartialString(
Expand Down
24 changes: 14 additions & 10 deletions lldb/test/API/lang/c/step-target/TestStepTarget.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,29 +83,33 @@ def test_with_end_line_deeper(self):
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr32343")
def test_with_command_and_block(self):
"""Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms."""
self.do_command_and_block()
self.do_command_and_block(True)

def do_command_and_block(self, use_regexp_step=False):
thread = self.get_to_start()

result = lldb.SBCommandReturnObject()
self.dbg.GetCommandInterpreter().HandleCommand(
'thread step-in -t "lotsOfArgs" -e block', result
)
self.assertTrue(result.Succeeded(), "thread step-in command succeeded.")
if use_regexp_step:
self.expect("s lotsOfArgs")
else:
self.expect('thread step-in -t "lotsOfArgs" -e block')

frame = thread.frames[0]
self.assertEqual(frame.name, "lotsOfArgs", "Stepped to lotsOfArgs.")

@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr32343")
def test_with_command_and_block_and_bad_name(self):
"""Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms."""
self.do_with_command_and_block_and_bad_name()
self.do_with_command_and_block_and_bad_name(True)

def do_with_command_and_block_and_bad_name(self, use_regexp_step=False):
thread = self.get_to_start()

result = lldb.SBCommandReturnObject()
self.dbg.GetCommandInterpreter().HandleCommand(
'thread step-in -t "lotsOfArgsssss" -e block', result
)
self.assertTrue(result.Succeeded(), "thread step-in command succeeded.")
if use_regexp_step:
self.expect("s lotsOfArgsssss")
else:
self.expect('thread step-in -t "lotsOfArgsssss" -e block')

frame = thread.frames[0]

Expand Down
Loading