Mark the selected frame of the selected thread in backtraces.

<rdar://problem/15252474>

llvm-svn: 192989
This commit is contained in:
Jim Ingham 2013-10-18 17:38:31 +00:00
parent fbc057ea73
commit 8ec10efc5d
5 changed files with 46 additions and 11 deletions

View File

@ -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;

View File

@ -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:

View File

@ -1275,7 +1275,7 @@ StackFrame::CalculateExecutionContext (ExecutionContext &exe_ctx)
}
void
StackFrame::DumpUsingSettingsFormat (Stream *strm)
StackFrame::DumpUsingSettingsFormat (Stream *strm, const char *frame_marker)
{
if (strm == NULL)
return;
@ -1283,6 +1283,10 @@ StackFrame::DumpUsingSettingsFormat (Stream *strm)
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)

View File

@ -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;
}

View File

@ -1960,13 +1960,21 @@ Thread::GetStatus (Stream &strm, uint32_t start_frame, uint32_t num_frames, uint
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;