[Lldb-commits] [lldb] r192989 - Mark the selected frame of the selected thread in backtraces.
Jim Ingham
jingham at apple.com
Fri Oct 18 10:38:31 PDT 2013
Author: jingham
Date: Fri Oct 18 12:38:31 2013
New Revision: 192989
URL: http://llvm.org/viewvc/llvm-project?rev=192989&view=rev
Log:
Mark the selected frame of the selected thread in backtraces.
<rdar://problem/15252474>
Modified:
lldb/trunk/include/lldb/Target/StackFrame.h
lldb/trunk/include/lldb/Target/StackFrameList.h
lldb/trunk/source/Target/StackFrame.cpp
lldb/trunk/source/Target/StackFrameList.cpp
lldb/trunk/source/Target/Thread.cpp
Modified: lldb/trunk/include/lldb/Target/StackFrame.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrame.h?rev=192989&r1=192988&r2=192989&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/StackFrame.h (original)
+++ lldb/trunk/include/lldb/Target/StackFrame.h Fri Oct 18 12:38:31 2013
@@ -121,7 +121,7 @@ public:
Disassemble ();
void
- DumpUsingSettingsFormat (Stream *strm);
+ DumpUsingSettingsFormat (Stream *strm, const char *frame_marker = NULL);
void
Dump (Stream *strm, bool show_frame_index, bool show_fullpaths);
@@ -165,7 +165,8 @@ public:
bool
GetStatus (Stream &strm,
bool show_frame_info,
- bool show_source);
+ bool show_source,
+ const char *frame_marker = NULL);
protected:
friend class StackFrameList;
Modified: lldb/trunk/include/lldb/Target/StackFrameList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrameList.h?rev=192989&r1=192988&r2=192989&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/StackFrameList.h (original)
+++ lldb/trunk/include/lldb/Target/StackFrameList.h Fri Oct 18 12:38:31 2013
@@ -88,7 +88,8 @@ public:
uint32_t first_frame,
uint32_t num_frames,
bool show_frame_info,
- uint32_t num_frames_with_source);
+ uint32_t num_frames_with_source,
+ const char *frame_marker = NULL);
protected:
Modified: lldb/trunk/source/Target/StackFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=192989&r1=192988&r2=192989&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrame.cpp (original)
+++ lldb/trunk/source/Target/StackFrame.cpp Fri Oct 18 12:38:31 2013
@@ -1275,7 +1275,7 @@ StackFrame::CalculateExecutionContext (E
}
void
-StackFrame::DumpUsingSettingsFormat (Stream *strm)
+StackFrame::DumpUsingSettingsFormat (Stream *strm, const char *frame_marker)
{
if (strm == NULL)
return;
@@ -1283,6 +1283,10 @@ StackFrame::DumpUsingSettingsFormat (Str
GetSymbolContext(eSymbolContextEverything);
ExecutionContext exe_ctx (shared_from_this());
StreamString s;
+
+ if (frame_marker)
+ s.PutCString(frame_marker);
+
const char *frame_format = NULL;
Target *target = exe_ctx.GetTargetPtr();
if (target)
@@ -1370,13 +1374,14 @@ StackFrame::HasCachedData () const
bool
StackFrame::GetStatus (Stream& strm,
bool show_frame_info,
- bool show_source)
+ bool show_source,
+ const char *frame_marker)
{
if (show_frame_info)
{
strm.Indent();
- DumpUsingSettingsFormat (&strm);
+ DumpUsingSettingsFormat (&strm, frame_marker);
}
if (show_source)
Modified: lldb/trunk/source/Target/StackFrameList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrameList.cpp?rev=192989&r1=192988&r2=192989&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrameList.cpp (original)
+++ lldb/trunk/source/Target/StackFrameList.cpp Fri Oct 18 12:38:31 2013
@@ -863,7 +863,8 @@ StackFrameList::GetStatus (Stream& strm,
uint32_t first_frame,
uint32_t num_frames,
bool show_frame_info,
- uint32_t num_frames_with_source)
+ uint32_t num_frames_with_source,
+ const char *selected_frame_marker)
{
size_t num_frames_displayed = 0;
@@ -880,15 +881,34 @@ StackFrameList::GetStatus (Stream& strm,
else
last_frame = first_frame + num_frames;
+ StackFrameSP selected_frame_sp = m_thread.GetSelectedFrame();
+ const char *unselected_marker = NULL;
+ std::string buffer;
+ if (selected_frame_marker)
+ {
+ size_t len = strlen(selected_frame_marker);
+ buffer.insert(buffer.begin(), len, ' ');
+ unselected_marker = buffer.c_str();
+ }
+ const char *marker = NULL;
+
for (frame_idx = first_frame; frame_idx < last_frame; ++frame_idx)
{
frame_sp = GetFrameAtIndex(frame_idx);
if (frame_sp.get() == NULL)
break;
+ if (selected_frame_marker != NULL)
+ {
+ if (frame_sp == selected_frame_sp)
+ marker = selected_frame_marker;
+ else
+ marker = unselected_marker;
+ }
+
if (!frame_sp->GetStatus (strm,
show_frame_info,
- num_frames_with_source > (first_frame - frame_idx)))
+ num_frames_with_source > (first_frame - frame_idx), marker))
break;
++num_frames_displayed;
}
Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=192989&r1=192988&r2=192989&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Fri Oct 18 12:38:31 2013
@@ -1960,13 +1960,21 @@ Thread::GetStatus (Stream &strm, uint32_
strm.IndentMore();
const bool show_frame_info = true;
- strm.IndentMore ();
+
+ const char *selected_frame_marker = NULL;
+ if (num_frames == 1 || (GetID() != GetProcess()->GetThreadList().GetSelectedThread()->GetID()))
+ strm.IndentMore ();
+ else
+ selected_frame_marker = "* ";
+
num_frames_shown = GetStackFrameList ()->GetStatus (strm,
start_frame,
num_frames,
show_frame_info,
- num_frames_with_source);
- strm.IndentLess();
+ num_frames_with_source,
+ selected_frame_marker);
+ if (num_frames == 1)
+ strm.IndentLess();
strm.IndentLess();
}
return num_frames_shown;
More information about the lldb-commits
mailing list