summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Target')
-rw-r--r--lldb/source/Target/ExecutionContext.cpp4
-rw-r--r--lldb/source/Target/Process.cpp2
-rw-r--r--lldb/source/Target/RegisterContext.cpp6
-rw-r--r--lldb/source/Target/StackFrame.cpp30
-rw-r--r--lldb/source/Target/StackFrameList.cpp2
-rw-r--r--lldb/source/Target/StopInfo.cpp4
-rw-r--r--lldb/source/Target/Target.cpp21
-rw-r--r--lldb/source/Target/Thread.cpp60
8 files changed, 76 insertions, 53 deletions
diff --git a/lldb/source/Target/ExecutionContext.cpp b/lldb/source/Target/ExecutionContext.cpp
index 74ad50a2676..d0bcdac8789 100644
--- a/lldb/source/Target/ExecutionContext.cpp
+++ b/lldb/source/Target/ExecutionContext.cpp
@@ -59,7 +59,7 @@ ExecutionContext::ExecutionContext(Process* p, Thread *t, StackFrame *f) :
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_ptr)
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 9086c15e805..3a65c5235e0 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -1818,7 +1818,7 @@ Process::CalculateStackFrame ()
}
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 692fce042e8..b21890eee90 100644
--- a/lldb/source/Target/RegisterContext.cpp
+++ b/lldb/source/Target/RegisterContext.cpp
@@ -226,12 +226,12 @@ RegisterContext::CalculateStackFrame ()
}
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 c7f2c040162..2be00d659a1 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 @@ StackFrame::Disassemble ()
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 @@ StackFrame::CalculateStackFrame ()
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 c6ac2de0f0d..2dd5fb8857b 100644
--- a/lldb/source/Target/StackFrameList.cpp
+++ b/lldb/source/Target/StackFrameList.cpp
@@ -260,7 +260,7 @@ StackFrameList::Dump (Stream *s)
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 d301cc156ff..49f07926715 100644
--- a/lldb/source/Target/StopInfo.cpp
+++ b/lldb/source/Target/StopInfo.cpp
@@ -276,9 +276,9 @@ public:
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 bbc41be9f8c..f8e54aec57e 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -708,7 +708,7 @@ Target::CalculateStackFrame ()
}
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 @@ Target::SetDefaultArchitecture (ArchSpec new_arch)
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 fb4ad9a3bf2..d45f45ccfd8 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 @@ Thread::CalculateStackFrame ()
}
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 @@ Thread::SetSelectedFrameByIndex (uint32_t idx)
}
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
OpenPOWER on IntegriCloud