<rdar://problem/11852100>

The "stop-line-count-after" and "stop-line-count-before" settings are broken. This fixes them.

llvm-svn: 160071
This commit is contained in:
Greg Clayton 2012-07-11 20:33:48 +00:00
parent 1fa2acaed4
commit 53eb7ad2f7
8 changed files with 61 additions and 81 deletions

View File

@ -167,9 +167,7 @@ public:
bool
GetStatus (Stream &strm,
bool show_frame_info,
bool show_source,
uint32_t source_lines_before,
uint32_t source_lines_after);
bool show_source);
protected:
friend class StackFrameList;

View File

@ -76,9 +76,7 @@ public:
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);
uint32_t num_frames_with_source);
protected:

View File

@ -762,9 +762,7 @@ public:
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);
uint32_t num_frames_with_source);
// We need a way to verify that even though we have a thread in a shared
// pointer that the object itself is still valid. Currently this won't be

View File

@ -282,14 +282,7 @@ protected:
bool show_frame_info = true;
bool show_source = !already_shown;
Debugger &debugger = m_interpreter.GetDebugger();
const uint32_t source_lines_before = debugger.GetStopSourceLineCount(true);
const uint32_t source_lines_after = debugger.GetStopSourceLineCount(false);
if (frame->GetStatus (result.GetOutputStream(),
show_frame_info,
show_source,
source_lines_before,
source_lines_after))
if (frame->GetStatus (result.GetOutputStream(), show_frame_info, show_source))
{
result.SetStatus (eReturnStatusSuccessFinishResult);
return result.Succeeded();

View File

@ -2630,7 +2630,7 @@ DebuggerInstanceSettings::UpdateInstanceSettingsVariable (const ConstString &var
if (new_value != UINT32_MAX)
m_stop_source_before_count = new_value;
else
err.SetErrorStringWithFormat("invalid unsigned string value '%s' for the '%s' setting", value, StopSourceContextAfterName ().GetCString());
err.SetErrorStringWithFormat("invalid unsigned string value '%s' for the '%s' setting", value, StopSourceContextBeforeName ().GetCString());
}
else if (var_name == StopSourceContextAfterName ())
{
@ -2638,7 +2638,7 @@ DebuggerInstanceSettings::UpdateInstanceSettingsVariable (const ConstString &var
if (new_value != UINT32_MAX)
m_stop_source_after_count = new_value;
else
err.SetErrorStringWithFormat("invalid unsigned string value '%s' for the '%s' setting", value, StopSourceContextBeforeName ().GetCString());
err.SetErrorStringWithFormat("invalid unsigned string value '%s' for the '%s' setting", value, StopSourceContextAfterName ().GetCString());
}
else if (var_name == StopDisassemblyCountName ())
{
@ -2703,13 +2703,13 @@ DebuggerInstanceSettings::GetInstanceSettingsValue (const SettingEntry &entry,
else if (var_name == StopSourceContextAfterName ())
{
StreamString strm;
strm.Printf ("%u", m_stop_source_before_count);
strm.Printf ("%u", m_stop_source_after_count);
value.AppendString (strm.GetData());
}
else if (var_name == StopSourceContextBeforeName ())
{
StreamString strm;
strm.Printf ("%u", m_stop_source_after_count);
strm.Printf ("%u", m_stop_source_before_count);
value.AppendString (strm.GetData());
}
else if (var_name == StopDisassemblyCountName ())

View File

@ -1296,10 +1296,9 @@ StackFrame::HasCachedData () const
bool
StackFrame::GetStatus (Stream& strm,
bool show_frame_info,
bool show_source,
uint32_t source_lines_before,
uint32_t source_lines_after)
bool show_source)
{
if (show_frame_info)
{
strm.Indent();
@ -1312,56 +1311,62 @@ StackFrame::GetStatus (Stream& strm,
bool have_source = false;
DebuggerInstanceSettings::StopDisassemblyType disasm_display = DebuggerInstanceSettings::eStopDisassemblyTypeNever;
Target *target = exe_ctx.GetTargetPtr();
if (target && (source_lines_before || source_lines_after))
if (target)
{
GetSymbolContext(eSymbolContextCompUnit | eSymbolContextLineEntry);
Debugger &debugger = target->GetDebugger();
const uint32_t source_lines_before = debugger.GetStopSourceLineCount(true);
const uint32_t source_lines_after = debugger.GetStopSourceLineCount(false);
disasm_display = debugger.GetStopDisassemblyDisplay ();
if (m_sc.comp_unit && m_sc.line_entry.IsValid())
if (source_lines_before > 0 || source_lines_after > 0)
{
if (target->GetSourceManager().DisplaySourceLinesWithLineNumbers (m_sc.line_entry.file,
m_sc.line_entry.line,
source_lines_before,
source_lines_after,
"->",
&strm))
GetSymbolContext(eSymbolContextCompUnit | eSymbolContextLineEntry);
if (m_sc.comp_unit && m_sc.line_entry.IsValid())
{
have_source = true;
if (target->GetSourceManager().DisplaySourceLinesWithLineNumbers (m_sc.line_entry.file,
m_sc.line_entry.line,
source_lines_before,
source_lines_after,
"->",
&strm))
{
have_source = true;
}
}
}
disasm_display = target->GetDebugger().GetStopDisassemblyDisplay ();
}
switch (disasm_display)
{
case DebuggerInstanceSettings::eStopDisassemblyTypeNever:
break;
case DebuggerInstanceSettings::eStopDisassemblyTypeNoSource:
if (have_source)
switch (disasm_display)
{
case DebuggerInstanceSettings::eStopDisassemblyTypeNever:
break;
// Fall through to next case
case DebuggerInstanceSettings::eStopDisassemblyTypeAlways:
if (target)
{
const uint32_t disasm_lines = target->GetDebugger().GetDisassemblyLineCount();
if (disasm_lines > 0)
case DebuggerInstanceSettings::eStopDisassemblyTypeNoSource:
if (have_source)
break;
// Fall through to next case
case DebuggerInstanceSettings::eStopDisassemblyTypeAlways:
if (target)
{
const ArchSpec &target_arch = target->GetArchitecture();
AddressRange pc_range;
pc_range.GetBaseAddress() = GetFrameCodeAddress();
pc_range.SetByteSize(disasm_lines * target_arch.GetMaximumOpcodeByteSize());
Disassembler::Disassemble (target->GetDebugger(),
target_arch,
NULL,
exe_ctx,
pc_range,
disasm_lines,
0,
Disassembler::eOptionMarkPCAddress,
strm);
const uint32_t disasm_lines = debugger.GetDisassemblyLineCount();
if (disasm_lines > 0)
{
const ArchSpec &target_arch = target->GetArchitecture();
AddressRange pc_range;
pc_range.GetBaseAddress() = GetFrameCodeAddress();
pc_range.SetByteSize(disasm_lines * target_arch.GetMaximumOpcodeByteSize());
Disassembler::Disassemble (target->GetDebugger(),
target_arch,
NULL,
exe_ctx,
pc_range,
disasm_lines,
0,
Disassembler::eOptionMarkPCAddress,
strm);
}
}
break;
}
break;
}
}
return true;

View File

@ -587,9 +587,7 @@ StackFrameList::GetStatus (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)
uint32_t num_frames_with_source)
{
size_t num_frames_displayed = 0;
@ -614,9 +612,7 @@ StackFrameList::GetStatus (Stream& strm,
if (!frame_sp->GetStatus (strm,
show_frame_info,
num_frames_with_source > first_frame - frame_idx,
source_lines_before,
source_lines_after))
num_frames_with_source > (first_frame - frame_idx)))
break;
++num_frames_displayed;
}

View File

@ -1321,16 +1321,12 @@ Thread::GetStatus (Stream &strm, uint32_t start_frame, uint32_t num_frames, uint
strm.IndentMore();
const bool show_frame_info = true;
const uint32_t source_lines_before = 3;
const uint32_t source_lines_after = 3;
strm.IndentMore ();
num_frames_shown = GetStackFrameList ()->GetStatus (strm,
start_frame,
num_frames,
show_frame_info,
num_frames_with_source,
source_lines_before,
source_lines_after);
num_frames_with_source);
strm.IndentLess();
strm.IndentLess();
}
@ -1342,17 +1338,13 @@ 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)
uint32_t num_frames_with_source)
{
return GetStackFrameList()->GetStatus (strm,
first_frame,
num_frames,
show_frame_info,
num_frames_with_source,
source_lines_before,
source_lines_after);
num_frames_with_source);
}
bool