There are now to new "settings set" variables that live in each debugger
instance:
settings set frame-format <string>
settings set thread-format <string>
This allows users to control the information that is seen when dumping
threads and frames. The default values are set such that they do what they
used to do prior to changing over the the user defined formats.
This allows users with terminals that can display color to make different
items different colors using the escape control codes. A few alias examples
that will colorize your thread and frame prompts are:
settings set frame-format 'frame #${frame.index}: \033[0;33m${frame.pc}\033[0m{ \033[1;4;36m${module.file.basename}\033[0;36m ${function.name}{${function.pc-offset}}\033[0m}{ \033[0;35mat \033[1;35m${line.file.basename}:${line.number}}\033[0m\n'
settings set thread-format 'thread #${thread.index}: \033[1;33mtid\033[0;33m = ${thread.id}\033[0m{, \033[0;33m${frame.pc}\033[0m}{ \033[1;4;36m${module.file.basename}\033[0;36m ${function.name}{${function.pc-offset}}\033[0m}{, \033[1;35mstop reason\033[0;35m = ${thread.stop-reason}\033[0m}{, \033[1;36mname = \033[0;36m${thread.name}\033[0m}{, \033[1;32mqueue = \033[0;32m${thread.queue}}\033[0m\n'
A quick web search for "colorize terminal output" should allow you to see what
you can do to make your output look like you want it.
The "settings set" commands above can of course be added to your ~/.lldbinit
file for permanent use.
Changed the pure virtual
void ExecutionContextScope::Calculate (ExecutionContext&);
To:
void ExecutionContextScope::CalculateExecutionContext (ExecutionContext&);
I did this because this is a class that anything in the execution context
heirarchy inherits from and "target->Calculate (exe_ctx)" didn't always tell
you what it was really trying to do unless you look at the parameter.
llvm-svn: 115485
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp
index 9e0f35d..6f74a73 100644
--- a/lldb/source/API/SBFrame.cpp
+++ b/lldb/source/API/SBFrame.cpp
@@ -395,7 +395,7 @@
if (m_opaque_sp)
{
description.ref();
- m_opaque_sp->Dump (description.get(), true, false);
+ m_opaque_sp->DumpUsingSettingsFormat (description.get());
}
else
description.Printf ("No value");
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index b87e56c..0ac463d 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -431,9 +431,9 @@
ExecutionContext exe_ctx;
if (process)
- process->Calculate(exe_ctx);
+ process->CalculateExecutionContext(exe_ctx);
else
- m_opaque_sp->Calculate(exe_ctx);
+ m_opaque_sp->CalculateExecutionContext(exe_ctx);
if (end_addr == LLDB_INVALID_ADDRESS || end_addr < start_addr)
range.SetByteSize( DEFAULT_DISASM_BYTE_SIZE);
@@ -484,9 +484,9 @@
process = NULL;
if (process)
- process->Calculate(exe_ctx);
+ process->CalculateExecutionContext(exe_ctx);
else
- m_opaque_sp->Calculate(exe_ctx);
+ m_opaque_sp->CalculateExecutionContext(exe_ctx);
StreamFile out_stream (out);
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index 8c74a34..216fa12 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -419,7 +419,7 @@
{
if (m_opaque_sp)
{
- m_opaque_sp->DumpInfo (description.ref(), true, true, true, LLDB_INVALID_INDEX32);
+ m_opaque_sp->DumpUsingSettingsFormat (description.ref(), LLDB_INVALID_INDEX32);
description.Printf (" %d frames, (instance name: %s)", GetNumFrames(),
m_opaque_sp->GetInstanceName().AsCString());
}
diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp
index 913577b..f21938f 100644
--- a/lldb/source/Commands/CommandObjectCommands.cpp
+++ b/lldb/source/Commands/CommandObjectCommands.cpp
@@ -70,14 +70,10 @@
// char '#'
while (pos != commands.end())
{
- bool remove_string = false;
size_t non_space = pos->find_first_not_of (k_space_characters);
- if (non_space == std::string::npos)
- remove_string = true; // Empty line
- else if ((*pos)[non_space] == '#')
- remove_string = true; // Comment line that starts with '#'
-
- if (remove_string)
+ // Check for empty line or comment line (lines whose first
+ // non-space character is a '#')
+ if (non_space == std::string::npos || (*pos)[non_space] == '#')
pos = commands.erase(pos);
else
++pos;
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index 0ff7e67..7f4f66e 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -71,7 +71,7 @@
ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext());
if (exe_ctx.frame)
{
- exe_ctx.frame->Dump (&result.GetOutputStream(), true, false);
+ exe_ctx.frame->DumpUsingSettingsFormat (&result.GetOutputStream());
result.GetOutputStream().EOL();
result.SetStatus (eReturnStatusSuccessFinishResult);
}
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index 9d42b47..f1b528d 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -80,13 +80,7 @@
}
else
{
- thread->DumpInfo (strm,
- true, // Dump the stop reason?
- true, // Dump the thread name?
- true, // Dump the queue name?
- 0); // Display context info for stack frame zero
-
- strm.EOL();
+ thread->DumpUsingSettingsFormat (strm, 0);
}
return true;
@@ -164,12 +158,7 @@
if (num_frames == 0)
return 0;
- thread->DumpInfo (strm,
- true, // Dump the stop reason?
- true, // Dump the thread name?
- true, // Dump the queue name?
- num_frames > 1 ? UINT32_MAX : first_frame); // Dump info for the first stack frame if we are showing only on frame
- strm.EOL();
+ thread->DumpUsingSettingsFormat (strm, num_frames > 1 ? UINT32_MAX : first_frame);
strm.IndentMore();
StackFrameSP frame_sp;
@@ -224,8 +213,7 @@
if (show_frame_info)
{
strm.Indent();
- frame->Dump (&strm, true, false);
- strm.EOL();
+ frame->DumpUsingSettingsFormat (&strm);
}
SymbolContext sc (frame->GetSymbolContext(eSymbolContextCompUnit | eSymbolContextLineEntry));
diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp
index df5a646..c880d84 100644
--- a/lldb/source/Core/Address.cpp
+++ b/lldb/source/Core/Address.cpp
@@ -140,7 +140,7 @@
if (success)
{
ExecutionContext exe_ctx;
- exe_scope->Calculate(exe_ctx);
+ exe_scope->CalculateExecutionContext(exe_ctx);
// If we have any sections that are loaded, try and resolve using the
// section load list
if (exe_ctx.target && !exe_ctx.target->GetSectionLoadList().IsEmpty())
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 8be3da08..8a010ae 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -622,7 +622,7 @@
SymbolContext sc (frame->GetSymbolContext(eSymbolContextEverything));
ExecutionContext exe_ctx;
- frame->Calculate(exe_ctx);
+ frame->CalculateExecutionContext(exe_ctx);
const char *end = NULL;
if (Debugger::FormatPrompt (prompt_format, &sc, &exe_ctx, &sc.line_entry.range.GetBaseAddress(), s, &end))
{
@@ -814,12 +814,9 @@
}
else if (::strncmp (var_name_begin, "target.", strlen("target.")) == 0)
{
- if (sc->target_sp || (exe_ctx && exe_ctx->process))
+ Target *target = Target::GetTargetFromContexts (exe_ctx, sc);
+ if (target)
{
- Target *target = sc->target_sp.get();
- if (target == NULL)
- target = &exe_ctx->process->GetTarget();
- assert (target);
var_name_begin += ::strlen ("target.");
if (::strncmp (var_name_begin, "arch}", strlen("arch}")) == 0)
{
@@ -838,10 +835,9 @@
case 'm':
if (::strncmp (var_name_begin, "module.", strlen("module.")) == 0)
{
- Module *module = sc->module_sp.get();
-
- if (module)
+ if (sc && sc->module_sp.get())
{
+ Module *module = sc->module_sp.get();
var_name_begin += ::strlen ("module.");
if (::strncmp (var_name_begin, "file.", strlen("file.")) == 0)
@@ -1078,47 +1074,62 @@
// If format addr is valid, then we need to print an address
if (format_addr.IsValid())
{
+ var_success = false;
+
if (calculate_format_addr_function_offset)
{
Address func_addr;
- if (sc->function)
- func_addr = sc->function->GetAddressRange().GetBaseAddress();
- else if (sc->symbol && sc->symbol->GetAddressRangePtr())
- func_addr = sc->symbol->GetAddressRangePtr()->GetBaseAddress();
- else
- var_success = false;
- if (var_success)
+ if (sc)
+ {
+ if (sc->function)
+ func_addr = sc->function->GetAddressRange().GetBaseAddress();
+ else if (sc->symbol && sc->symbol->GetAddressRangePtr())
+ func_addr = sc->symbol->GetAddressRangePtr()->GetBaseAddress();
+ }
+
+ if (func_addr.IsValid())
{
if (func_addr.GetSection() == format_addr.GetSection())
{
addr_t func_file_addr = func_addr.GetFileAddress();
addr_t addr_file_addr = format_addr.GetFileAddress();
if (addr_file_addr > func_file_addr)
- {
s.Printf(" + %llu", addr_file_addr - func_file_addr);
- }
else if (addr_file_addr < func_file_addr)
- {
s.Printf(" - %llu", func_file_addr - addr_file_addr);
- }
+ var_success = true;
}
else
- var_success = false;
+ {
+ Target *target = Target::GetTargetFromContexts (exe_ctx, sc);
+ if (target)
+ {
+ addr_t func_load_addr = func_addr.GetLoadAddress (target);
+ addr_t addr_load_addr = format_addr.GetLoadAddress (target);
+ if (addr_load_addr > func_load_addr)
+ s.Printf(" + %llu", addr_load_addr - func_load_addr);
+ else if (addr_load_addr < func_load_addr)
+ s.Printf(" - %llu", func_load_addr - addr_load_addr);
+ var_success = true;
+ }
+ }
}
}
else
{
+ Target *target = Target::GetTargetFromContexts (exe_ctx, sc);
addr_t vaddr = LLDB_INVALID_ADDRESS;
- if (exe_ctx && exe_ctx->process && !exe_ctx->process->GetTarget().GetSectionLoadList().IsEmpty())
- vaddr = format_addr.GetLoadAddress (&exe_ctx->process->GetTarget());
+ if (exe_ctx && !target->GetSectionLoadList().IsEmpty())
+ vaddr = format_addr.GetLoadAddress (target);
if (vaddr == LLDB_INVALID_ADDRESS)
vaddr = format_addr.GetFileAddress ();
if (vaddr != LLDB_INVALID_ADDRESS)
+ {
s.Printf("0x%16.16llx", vaddr);
- else
- var_success = false;
+ var_success = true;
+ }
}
}
}
@@ -1154,47 +1165,57 @@
case '0':
// 1 to 3 octal chars
{
- unsigned long octal_value = 0;
- ++p;
- int i=0;
- for (; i<3; ++i)
+ // Make a string that can hold onto the initial zero char,
+ // up to 3 octal digits, and a terminating NULL.
+ char oct_str[5] = { 0, 0, 0, 0, 0 };
+
+ int i;
+ for (i=0; (p[i] >= '0' && p[i] <= '7') && i<4; ++i)
+ oct_str[i] = p[i];
+
+ // We don't want to consume the last octal character since
+ // the main for loop will do this for us, so we advance p by
+ // one less than i (even if i is zero)
+ p += i - 1;
+ unsigned long octal_value = ::strtoul (oct_str, NULL, 8);
+ if (octal_value <= UINT8_MAX)
{
- if (*p >= '0' && *p <= '7')
- octal_value = octal_value << 3 + (((uint8_t)*p) - '0');
- else
- break;
+ char octal_char = octal_value;
+ s.Write (&octal_char, 1);
}
- if (i>0)
- s.PutChar (octal_value);
- else
- s.PutCString ("\\0");
}
break;
case 'x':
// hex number in the format
+ if (isxdigit(p[1]))
{
- ++p;
+ ++p; // Skip the 'x'
- if (isxdigit(*p))
+ // Make a string that can hold onto two hex chars plus a
+ // NULL terminator
+ char hex_str[3] = { 0,0,0 };
+ hex_str[0] = *p;
+ if (isxdigit(p[1]))
{
- char hex_str[3] = { 0,0,0 };
- hex_str[0] = *p;
- ++p;
- if (isxdigit(*p))
- hex_str[1] = *p;
- unsigned long hex_value = strtoul (hex_str, NULL, 16);
+ ++p; // Skip the first of the two hex chars
+ hex_str[1] = *p;
+ }
+
+ unsigned long hex_value = strtoul (hex_str, NULL, 16);
+ if (hex_value <= UINT8_MAX)
s.PutChar (hex_value);
- }
- else
- {
- s.PutCString ("\\x");
- }
+ }
+ else
+ {
+ s.PutChar('x');
}
break;
default:
- s << '\\' << *p;
+ // Just desensitize any other character by just printing what
+ // came after the '\'
+ s << *p;
break;
}
@@ -1247,6 +1268,8 @@
InstanceSettings (owner, (name == NULL ? InstanceSettings::InvalidName().AsCString() : name), live_instance),
m_term_width (80),
m_prompt (),
+ m_frame_format (),
+ m_thread_format (),
m_script_lang (),
m_use_external_editor (false)
{
@@ -1265,13 +1288,14 @@
{
const lldb::InstanceSettingsSP &pending_settings = m_owner.FindPendingSettings (m_instance_name);
CopyInstanceSettings (pending_settings, false);
- //m_owner.RemovePendingSettings (m_instance_name);
}
}
DebuggerInstanceSettings::DebuggerInstanceSettings (const DebuggerInstanceSettings &rhs) :
InstanceSettings (*(Debugger::GetSettingsController().get()), CreateInstanceName ().AsCString()),
m_prompt (rhs.m_prompt),
+ m_frame_format (rhs.m_frame_format),
+ m_thread_format (rhs.m_thread_format),
m_script_lang (rhs.m_script_lang),
m_use_external_editor (rhs.m_use_external_editor)
{
@@ -1291,6 +1315,8 @@
{
m_term_width = rhs.m_term_width;
m_prompt = rhs.m_prompt;
+ m_frame_format = rhs.m_frame_format;
+ m_thread_format = rhs.m_thread_format;
m_script_lang = rhs.m_script_lang;
m_use_external_editor = rhs.m_use_external_editor;
}
@@ -1338,7 +1364,15 @@
Error &err,
bool pending)
{
- if (var_name == PromptVarName())
+
+ if (var_name == TermWidthVarName())
+ {
+ if (ValidTermWidthValue (value, err))
+ {
+ m_term_width = ::strtoul (value, NULL, 0);
+ }
+ }
+ else if (var_name == PromptVarName())
{
UserSettingsController::UpdateStringVariable (op, m_prompt, value, err);
if (!pending)
@@ -1355,19 +1389,20 @@
BroadcastPromptChange (new_name, m_prompt.c_str());
}
}
+ else if (var_name == GetFrameFormatName())
+ {
+ UserSettingsController::UpdateStringVariable (op, m_frame_format, value, err);
+ }
+ else if (var_name == GetThreadFormatName())
+ {
+ UserSettingsController::UpdateStringVariable (op, m_thread_format, value, err);
+ }
else if (var_name == ScriptLangVarName())
{
bool success;
m_script_lang = Args::StringToScriptLanguage (value, eScriptLanguageDefault,
&success);
}
- else if (var_name == TermWidthVarName())
- {
- if (ValidTermWidthValue (value, err))
- {
- m_term_width = ::strtoul (value, NULL, 0);
- }
- }
else if (var_name == UseExternalEditorVarName ())
{
UserSettingsController::UpdateBooleanVariable (op, m_use_external_editor, value, err);
@@ -1382,7 +1417,7 @@
{
if (var_name == PromptVarName())
{
- value.AppendString (m_prompt.c_str());
+ value.AppendString (m_prompt.c_str(), m_prompt.size());
}
else if (var_name == ScriptLangVarName())
@@ -1395,6 +1430,14 @@
width_str.Printf ("%d", m_term_width);
value.AppendString (width_str.GetData());
}
+ else if (var_name == GetFrameFormatName ())
+ {
+ value.AppendString(m_frame_format.c_str(), m_frame_format.size());
+ }
+ else if (var_name == GetThreadFormatName ())
+ {
+ value.AppendString(m_thread_format.c_str(), m_thread_format.size());
+ }
else if (var_name == UseExternalEditorVarName())
{
if (m_use_external_editor)
@@ -1434,7 +1477,8 @@
BroadcastPromptChange (new_name, m_prompt.c_str());
}
-
+ m_frame_format = new_debugger_settings->m_frame_format;
+ m_thread_format = new_debugger_settings->m_thread_format;
m_term_width = new_debugger_settings->m_term_width;
m_script_lang = new_debugger_settings->m_script_lang;
m_use_external_editor = new_debugger_settings->m_use_external_editor;
@@ -1500,6 +1544,22 @@
}
const ConstString &
+DebuggerInstanceSettings::GetFrameFormatName ()
+{
+ static ConstString prompt_var_name ("frame-format");
+
+ return prompt_var_name;
+}
+
+const ConstString &
+DebuggerInstanceSettings::GetThreadFormatName ()
+{
+ static ConstString prompt_var_name ("thread-format");
+
+ return prompt_var_name;
+}
+
+const ConstString &
DebuggerInstanceSettings::ScriptLangVarName ()
{
static ConstString script_lang_var_name ("script-lang");
@@ -1537,15 +1597,32 @@
{ NULL, eSetVarTypeNone, NULL, NULL, 0, 0, NULL }
};
+#define MODULE_WITH_FUNC "{ ${module.file.basename}`${function.name}{${function.pc-offset}}}"
+#define FILE_AND_LINE "{ at ${line.file.basename}:${line.number}}"
+#define DEFAULT_THREAD_FORMAT "thread #${thread.index}: tid = ${thread.id}"\
+ "{, ${frame.pc}}"\
+ MODULE_WITH_FUNC\
+ "{, stop reason = ${thread.stop-reason}}"\
+ "{, name = ${thread.name}}"\
+ "{, queue = ${thread.queue}}"\
+ "\\n"
+
+#define DEFAULT_FRAME_FORMAT "frame #${frame.index}: ${frame.pc}"\
+ MODULE_WITH_FUNC\
+ FILE_AND_LINE\
+ "\\n"
SettingEntry
Debugger::SettingsController::instance_settings_table[] =
{
- //{ "var-name", var-type , "default", enum-table, init'd, hidden, "help-text"},
- { "term-width" , eSetVarTypeInt, "80" , NULL, false , false , "The maximum number of columns to use for displaying text." },
- { "script-lang" , eSetVarTypeString, "python", NULL, false, false, "The script language to be used for evaluating user-written scripts." },
- { "prompt" , eSetVarTypeString, "(lldb)", NULL, false, false, "The debugger command line prompt displayed for the user." },
- { "use-external-editor", eSetVarTypeBool, "false", NULL, false, false, "Whether to use an external editor or not." },
- { NULL, eSetVarTypeNone, NULL, NULL, 0, 0, NULL }
+// NAME Setting variable type Default Enum Init'd Hidden Help
+// ======================= ======================= ====================== ==== ====== ====== ======================
+{ "term-width", eSetVarTypeInt, "80" , NULL, false, false, "The maximum number of columns to use for displaying text." },
+{ "script-lang", eSetVarTypeString, "python", NULL, false, false, "The script language to be used for evaluating user-written scripts." },
+{ "prompt", eSetVarTypeString, "(lldb)", NULL, false, false, "The debugger command line prompt displayed for the user." },
+{ "frame-format", eSetVarTypeString, DEFAULT_FRAME_FORMAT, NULL, false, false, "The default frame format string to use when displaying thread information." },
+{ "thread-format", eSetVarTypeString, DEFAULT_THREAD_FORMAT, NULL, false, false, "The default thread format string to use when displaying thread information." },
+{ "use-external-editor", eSetVarTypeBool, "false", NULL, false, false, "Whether to use an external editor or not." },
+{ NULL, eSetVarTypeNone, NULL, NULL, false, false, NULL }
};
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.cpp
index e4acd96..a56eb36 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.cpp
@@ -66,7 +66,7 @@
return false;
ExecutionContext exe_ctx;
- exe_scope->Calculate(exe_ctx);
+ exe_scope->CalculateExecutionContext(exe_ctx);
if (!exe_ctx.process)
return false;
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCTrampolineHandler.cpp
index f086d1b..498937e 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCTrampolineHandler.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCTrampolineHandler.cpp
@@ -192,7 +192,7 @@
// making the object value a load address value and resolving it will get
// the pointer sized data pointed to by that value...
ExecutionContext exec_ctx;
- thread.Calculate (exec_ctx);
+ thread.CalculateExecutionContext (exec_ctx);
isa_value.SetValueType(Value::eValueTypeLoadAddress);
isa_value.ResolveValue(&exec_ctx, clang_ast_context->getASTContext());
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleThreadPlanStepThroughObjCTrampoline.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleThreadPlanStepThroughObjCTrampoline.cpp
index 62b75d5..aec37ec 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleThreadPlanStepThroughObjCTrampoline.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleThreadPlanStepThroughObjCTrampoline.cpp
@@ -60,7 +60,7 @@
{
StreamString errors;
ExecutionContext exc_context;
- m_thread.Calculate(exc_context);
+ m_thread.CalculateExecutionContext(exc_context);
m_func_sp.reset(m_impl_function->GetThreadPlanToCallFunction (exc_context, m_args_addr, errors, m_stop_others));
m_func_sp->SetPrivate(true);
m_thread.QueueThreadPlan (m_func_sp, false);
@@ -109,7 +109,7 @@
{
Value target_addr_value;
ExecutionContext exc_context;
- m_thread.Calculate(exc_context);
+ m_thread.CalculateExecutionContext(exc_context);
m_impl_function->FetchFunctionResults (exc_context, m_args_addr, target_addr_value);
m_impl_function->DeallocateFunctionResults(exc_context, m_args_addr);
lldb::addr_t target_addr = target_addr_value.GetScalar().ULongLong();
diff --git a/lldb/source/Target/ExecutionContext.cpp b/lldb/source/Target/ExecutionContext.cpp
index 74ad50a..d0bcdac 100644
--- a/lldb/source/Target/ExecutionContext.cpp
+++ b/lldb/source/Target/ExecutionContext.cpp
@@ -59,7 +59,7 @@
ExecutionContext::ExecutionContext (ExecutionContextScope *exe_scope_ptr)
{
if (exe_scope_ptr)
- exe_scope_ptr->Calculate (*this);
+ exe_scope_ptr->CalculateExecutionContext (*this);
else
{
target = NULL;
@@ -71,7 +71,7 @@
ExecutionContext::ExecutionContext (ExecutionContextScope &exe_scope_ref)
{
- exe_scope_ref.Calculate (*this);
+ exe_scope_ref.CalculateExecutionContext (*this);
}
void
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 9086c15..3a65c52 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -1818,7 +1818,7 @@
}
void
-Process::Calculate (ExecutionContext &exe_ctx)
+Process::CalculateExecutionContext (ExecutionContext &exe_ctx)
{
exe_ctx.target = &m_target;
exe_ctx.process = this;
diff --git a/lldb/source/Target/RegisterContext.cpp b/lldb/source/Target/RegisterContext.cpp
index 692fce0..b21890e 100644
--- a/lldb/source/Target/RegisterContext.cpp
+++ b/lldb/source/Target/RegisterContext.cpp
@@ -226,12 +226,12 @@
}
void
-RegisterContext::Calculate (ExecutionContext &exe_ctx)
+RegisterContext::CalculateExecutionContext (ExecutionContext &exe_ctx)
{
if (m_frame)
- m_frame->Calculate (exe_ctx);
+ m_frame->CalculateExecutionContext (exe_ctx);
else
- m_thread.Calculate (exe_ctx);
+ m_thread.CalculateExecutionContext (exe_ctx);
}
diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp
index c7f2c04..2be00d6 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -14,6 +14,7 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Module.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Core/Disassembler.h"
#include "lldb/Core/Value.h"
#include "lldb/Core/ValueObjectVariable.h"
@@ -248,7 +249,7 @@
if (m_disassembly.GetSize() == 0)
{
ExecutionContext exe_ctx;
- Calculate(exe_ctx);
+ CalculateExecutionContext(exe_ctx);
Target &target = m_thread.GetProcess().GetTarget();
Disassembler::Disassemble (target.GetDebugger(),
target.GetArchitecture(),
@@ -615,13 +616,36 @@
void
-StackFrame::Calculate (ExecutionContext &exe_ctx)
+StackFrame::CalculateExecutionContext (ExecutionContext &exe_ctx)
{
- m_thread.Calculate (exe_ctx);
+ m_thread.CalculateExecutionContext (exe_ctx);
exe_ctx.frame = this;
}
void
+StackFrame::DumpUsingSettingsFormat (Stream *strm)
+{
+ if (strm == NULL)
+ return;
+
+ GetSymbolContext(eSymbolContextEverything);
+ ExecutionContext exe_ctx;
+ CalculateExecutionContext(exe_ctx);
+ const char *end = NULL;
+ StreamString s;
+ const char *frame_format = m_thread.GetProcess().GetTarget().GetDebugger().GetFrameFormat();
+ if (frame_format && Debugger::FormatPrompt (frame_format, &m_sc, &exe_ctx, NULL, s, &end))
+ {
+ strm->Write(s.GetData(), s.GetSize());
+ }
+ else
+ {
+ Dump (strm, true, false);
+ strm->EOL();
+ }
+}
+
+void
StackFrame::Dump (Stream *strm, bool show_frame_index, bool show_fullpaths)
{
if (strm == NULL)
diff --git a/lldb/source/Target/StackFrameList.cpp b/lldb/source/Target/StackFrameList.cpp
index c6ac2de..2dd5fb8 100644
--- a/lldb/source/Target/StackFrameList.cpp
+++ b/lldb/source/Target/StackFrameList.cpp
@@ -260,7 +260,7 @@
if (frame)
{
frame->GetStackID().Dump (s);
- frame->Dump(s, true, false);
+ frame->DumpUsingSettingsFormat (s);
}
else
s->Printf("frame #%u", std::distance (begin, pos));
diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp
index d301cc1..49f0792 100644
--- a/lldb/source/Target/StopInfo.cpp
+++ b/lldb/source/Target/StopInfo.cpp
@@ -276,9 +276,9 @@
StreamString strm;
const char *signal_name = m_thread.GetProcess().GetUnixSignals().GetSignalAsCString (m_value);
if (signal_name)
- strm.Printf("signal = %s", signal_name);
+ strm.Printf("signal %s", signal_name);
else
- strm.Printf("signal = %lli", m_value);
+ strm.Printf("signal %lli", m_value);
m_description.swap (strm.GetString());
}
return m_description.c_str();
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index bbc41be..f8e54ae 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -708,7 +708,7 @@
}
void
-Target::Calculate (ExecutionContext &exe_ctx)
+Target::CalculateExecutionContext (ExecutionContext &exe_ctx)
{
exe_ctx.target = this;
exe_ctx.process = NULL; // Do NOT fill in process...
@@ -794,6 +794,25 @@
lldb::eVarSetOperationAssign, false, "[]");
}
+Target *
+Target::GetTargetFromContexts (const ExecutionContext *exe_ctx_ptr, const SymbolContext *sc_ptr)
+{
+ // The target can either exist in the "process" of ExecutionContext, or in
+ // the "target_sp" member of SymbolContext. This accessor helper function
+ // will get the target from one of these locations.
+
+ Target *target = NULL;
+ if (sc_ptr != NULL)
+ target = sc_ptr->target_sp.get();
+ if (target == NULL)
+ {
+ if (exe_ctx_ptr != NULL && exe_ctx_ptr->process != NULL)
+ target = &exe_ctx_ptr->process->GetTarget();
+ }
+ return target;
+}
+
+
void
Target::UpdateInstanceName ()
{
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index fb4ad9a..d45f45c 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -9,6 +9,7 @@
#include "lldb/lldb-private-log.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamString.h"
@@ -810,9 +811,9 @@
}
void
-Thread::Calculate (ExecutionContext &exe_ctx)
+Thread::CalculateExecutionContext (ExecutionContext &exe_ctx)
{
- m_process.Calculate (exe_ctx);
+ m_process.CalculateExecutionContext (exe_ctx);
exe_ctx.thread = this;
exe_ctx.frame = NULL;
}
@@ -872,52 +873,31 @@
}
void
-Thread::DumpInfo
-(
- Stream &strm,
- bool show_stop_reason,
- bool show_name,
- bool show_queue,
- uint32_t idx
-)
+Thread::DumpUsingSettingsFormat (Stream &strm, uint32_t frame_idx)
{
- strm.Printf("thread #%u: tid = 0x%4.4x", GetIndexID(), GetID());
+ ExecutionContext exe_ctx;
+ SymbolContext frame_sc;
+ CalculateExecutionContext (exe_ctx);
- if (idx != LLDB_INVALID_INDEX32)
+ if (frame_idx != LLDB_INVALID_INDEX32)
{
- StackFrameSP frame_sp(GetStackFrameAtIndex (idx));
+ StackFrameSP frame_sp(GetStackFrameAtIndex (frame_idx));
if (frame_sp)
{
- strm.PutCString(", ");
- frame_sp->Dump (&strm, false, false);
+ exe_ctx.frame = frame_sp.get();
+ frame_sc = exe_ctx.frame->GetSymbolContext(eSymbolContextEverything);
}
}
- if (show_stop_reason)
- {
- StopInfo *stop_info = GetStopInfo();
-
- if (stop_info)
- {
- const char *stop_description = stop_info->GetDescription();
- if (stop_description)
- strm.Printf (", stop reason = %s", stop_description);
- }
- }
-
- if (show_name)
- {
- const char *name = GetName();
- if (name && name[0])
- strm.Printf(", name = %s", name);
- }
-
- if (show_queue)
- {
- const char *queue = GetQueueName();
- if (queue && queue[0])
- strm.Printf(", queue = %s", queue);
- }
+ const char *thread_format = GetProcess().GetTarget().GetDebugger().GetThreadFormat();
+ assert (thread_format);
+ const char *end = NULL;
+ Debugger::FormatPrompt (thread_format,
+ exe_ctx.frame ? &frame_sc : NULL,
+ &exe_ctx,
+ NULL,
+ strm,
+ &end);
}
lldb::ThreadSP