Skip to content

Commit 80eb422

Browse files
MrHateTeemperor
authored andcommitted
[lldb] Tab completion for frame select
Summary: Provided the tab completion for command `frame select`. Reviewers: teemperor, JDevlieghere Reviewed By: teemperor Tags: #lldb Differential Revision: https://reviews.llvm.org/D81177
1 parent 502773d commit 80eb422

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

lldb/source/Commands/CommandObjectFrame.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,22 @@ class CommandObjectFrameSelect : public CommandObjectParsed {
289289

290290
~CommandObjectFrameSelect() override = default;
291291

292+
void
293+
HandleArgumentCompletion(CompletionRequest &request,
294+
OptionElementVector &opt_element_vector) override {
295+
if (!m_exe_ctx.HasProcessScope() || request.GetCursorIndex() != 0)
296+
return;
297+
298+
lldb::ThreadSP thread_sp = m_exe_ctx.GetThreadSP();
299+
const uint32_t frame_num = thread_sp->GetStackFrameCount();
300+
for (uint32_t i = 0; i < frame_num; ++i) {
301+
lldb::StackFrameSP frame_sp = thread_sp->GetStackFrameAtIndex(i);
302+
StreamString strm;
303+
frame_sp->Dump(&strm, false, true);
304+
request.TryCompleteCurrentArg(std::to_string(i), strm.GetString());
305+
}
306+
}
307+
292308
Options *GetOptions() override { return &m_options; }
293309

294310
protected:

lldb/test/API/functionalities/completion/TestCompletion.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,13 @@ def test_completion_description_command_options(self):
415415
self.check_completion_with_desc("breakpoint set --Z", [
416416
])
417417

418+
def test_frame_select(self):
419+
self.build()
420+
self.main_source_spec = lldb.SBFileSpec("main.cpp")
421+
lldbutil.run_to_source_breakpoint(self, '// Break here', self.main_source_spec)
422+
423+
self.complete_from_to('frame select ', ['0'])
424+
418425
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489")
419426
def test_symbol_name(self):
420427
self.build()

0 commit comments

Comments
 (0)