Centralized a lot of the status information for processes,
threads, and stack frame down in the lldb_private::Process,
lldb_private::Thread, lldb_private::StackFrameList and the
lldb_private::StackFrame classes. We had some command line
commands that had duplicate versions of the process status
output ("thread list" and "process status" for example).
Removed the "file" command and placed it where it should
have been: "target create". Made an alias for "file" to
"target create" so we stay compatible with GDB commands.
We can now have multple usable targets in lldb at the
same time. This is nice for comparing two runs of a program
or debugging more than one binary at the same time. The
new command is "target select <target-idx>" and also to see
a list of the current targets you can use the new "target list"
command. The flow in a debug session can be:
(lldb) target create /path/to/exe/a.out
(lldb) breakpoint set --name main
(lldb) run
... hit breakpoint
(lldb) target create /bin/ls
(lldb) run /tmp
Process 36001 exited with status = 0 (0x00000000)
(lldb) target list
Current targets:
target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
* target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) target select 0
Current targets:
* target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) bt
* thread #1: tid = 0x2d03, 0x0000000100000b9a a.out`main + 42 at main.c:16, stop reason = breakpoint 1.1
frame #0: 0x0000000100000b9a a.out`main + 42 at main.c:16
frame #1: 0x0000000100000b64 a.out`start + 52
Above we created a target for "a.out" and ran and hit a
breakpoint at "main". Then we created a new target for /bin/ls
and ran it. Then we listed the targest and selected our original
"a.out" program, so we showed two concurent debug sessions
going on at the same time.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@129695 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Target/Thread.cpp b/source/Target/Thread.cpp
index 384d03f..9f77e61 100644
--- a/source/Target/Thread.cpp
+++ b/source/Target/Thread.cpp
@@ -14,6 +14,7 @@
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Core/RegularExpression.h"
+#include "lldb/Host/Host.h"
#include "lldb/Target/DynamicLoader.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
@@ -1100,6 +1101,63 @@
return unknown_state_string;
}
+size_t
+Thread::GetStatus (Stream &strm, uint32_t start_frame, uint32_t num_frames, uint32_t num_frames_with_source)
+{
+ size_t num_frames_shown = 0;
+ strm.Indent();
+ strm.Printf("%c ", GetProcess().GetThreadList().GetSelectedThread().get() == this ? '*' : ' ');
+
+ StackFrameSP frame_sp = GetStackFrameAtIndex(start_frame);
+ SymbolContext frame_sc(frame_sp->GetSymbolContext (eSymbolContextLineEntry));
+ if (frame_sc.line_entry.line != 0 &&
+ frame_sc.line_entry.file &&
+ GetProcess().GetTarget().GetDebugger().GetUseExternalEditor())
+ {
+ Host::OpenFileInExternalEditor (frame_sc.line_entry.file, frame_sc.line_entry.line);
+ }
+
+ DumpUsingSettingsFormat (strm, start_frame);
+
+ if (num_frames > 0)
+ {
+ strm.IndentMore();
+
+ const bool show_frame_info = true;
+ const uint32_t source_lines_before = 3;
+ const uint32_t source_lines_after = 3;
+ num_frames_shown = GetStackFrameList ().GetStatus (strm,
+ start_frame,
+ num_frames,
+ show_frame_info,
+ num_frames_with_source,
+ source_lines_before,
+ source_lines_after);
+ strm.IndentLess();
+ }
+ return num_frames_shown;
+}
+
+size_t
+Thread::GetStackFrameStatus (Stream& strm,
+ uint32_t first_frame,
+ uint32_t num_frames,
+ bool show_frame_info,
+ uint32_t num_frames_with_source,
+ uint32_t source_lines_before,
+ uint32_t source_lines_after)
+{
+ return GetStackFrameList().GetStatus (strm,
+ first_frame,
+ num_frames,
+ show_frame_info,
+ num_frames_with_source,
+ source_lines_before,
+ source_lines_after);
+}
+
+
+
#pragma mark "Thread::SettingsController"
//--------------------------------------------------------------
// class Thread::SettingsController