summaryrefslogtreecommitdiffstats
path: root/lldb/source/API/SBValue.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-06-23 01:19:29 +0000
committerGreg Clayton <gclayton@apple.com>2010-06-23 01:19:29 +0000
commit6611103cfe7a8c08554816fc08abef2e2960e799 (patch)
treeb940bb129b59af3cf6923f8d69f095d2d9fc8dca /lldb/source/API/SBValue.cpp
parentef5a4383ad679e58743c540c25d6a1bab0c77423 (diff)
downloadbcm5719-llvm-6611103cfe7a8c08554816fc08abef2e2960e799.tar.gz
bcm5719-llvm-6611103cfe7a8c08554816fc08abef2e2960e799.zip
Very large changes that were needed in order to allow multiple connections
to the debugger from GUI windows. Previously there was one global debugger instance that could be accessed that had its own command interpreter and current state (current target/process/thread/frame). When a GUI debugger was attached, if it opened more than one window that each had a console window, there were issues where the last one to setup the global debugger object won and got control of the debugger. To avoid this we now create instances of the lldb_private::Debugger that each has its own state: - target list for targets the debugger instance owns - current process/thread/frame - its own command interpreter - its own input, output and error file handles to avoid conflicts - its own input reader stack So now clients should call: SBDebugger::Initialize(); // (static function) SBDebugger debugger (SBDebugger::Create()); // Use which ever file handles you wish debugger.SetErrorFileHandle (stderr, false); debugger.SetOutputFileHandle (stdout, false); debugger.SetInputFileHandle (stdin, true); // main loop SBDebugger::Terminate(); // (static function) SBDebugger::Initialize() and SBDebugger::Terminate() are ref counted to ensure nothing gets destroyed too early when multiple clients might be attached. Cleaned up the command interpreter and the CommandObject and all subclasses to take more appropriate arguments. llvm-svn: 106615
Diffstat (limited to 'lldb/source/API/SBValue.cpp')
-rw-r--r--lldb/source/API/SBValue.cpp142
1 files changed, 71 insertions, 71 deletions
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index ab622c7e7e8..e381246174b 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -33,12 +33,12 @@ using namespace lldb;
using namespace lldb_private;
SBValue::SBValue () :
- m_lldb_object_sp ()
+ m_opaque_sp ()
{
}
SBValue::SBValue (const lldb::ValueObjectSP &value_sp) :
- m_lldb_object_sp (value_sp)
+ m_opaque_sp (value_sp)
{
}
@@ -49,7 +49,7 @@ SBValue::~SBValue()
bool
SBValue::IsValid () const
{
- return (m_lldb_object_sp.get() != NULL);
+ return (m_opaque_sp.get() != NULL);
}
void
@@ -72,25 +72,25 @@ SBValue::Print (FILE *out_file, SBFrame *frame, bool print_type, bool print_valu
lldb_private::StreamFile out_stream (out_file);
- out_stream.Printf ("%s ", m_lldb_object_sp->GetName().AsCString (NULL));
- if (! m_lldb_object_sp->IsInScope (lldb_frame))
+ out_stream.Printf ("%s ", m_opaque_sp->GetName().AsCString (NULL));
+ if (! m_opaque_sp->IsInScope (lldb_frame))
out_stream.Printf ("[out-of-scope] ");
if (print_type)
{
- out_stream.Printf ("(%s) ", m_lldb_object_sp->GetTypeName().AsCString ("<unknown-type>"));
+ out_stream.Printf ("(%s) ", m_opaque_sp->GetTypeName().AsCString ("<unknown-type>"));
}
if (print_value)
{
ExecutionContextScope *exe_scope = frame->get();
- const char *val_cstr = m_lldb_object_sp->GetValueAsCString(exe_scope);
- const char *err_cstr = m_lldb_object_sp->GetError().AsCString();
+ const char *val_cstr = m_opaque_sp->GetValueAsCString(exe_scope);
+ const char *err_cstr = m_opaque_sp->GetError().AsCString();
if (!err_cstr)
{
- const char *sum_cstr = m_lldb_object_sp->GetSummaryAsCString(exe_scope);
+ const char *sum_cstr = m_opaque_sp->GetSummaryAsCString(exe_scope);
const bool is_aggregate =
- ClangASTContext::IsAggregateType (m_lldb_object_sp->GetOpaqueClangQualType());
+ ClangASTContext::IsAggregateType (m_opaque_sp->GetOpaqueClangQualType());
if (val_cstr)
out_stream.Printf ("= %s ", val_cstr);
@@ -100,13 +100,13 @@ SBValue::Print (FILE *out_file, SBFrame *frame, bool print_type, bool print_valu
if (is_aggregate)
{
out_stream.PutChar ('{');
- const uint32_t num_children = m_lldb_object_sp->GetNumChildren();
+ const uint32_t num_children = m_opaque_sp->GetNumChildren();
if (num_children)
{
out_stream.IndentMore();
for (uint32_t idx = 0; idx < num_children; ++idx)
{
- lldb::ValueObjectSP child_sp (m_lldb_object_sp->GetChildAtIndex (idx, true));
+ lldb::ValueObjectSP child_sp (m_opaque_sp->GetChildAtIndex (idx, true));
if (child_sp.get())
{
out_stream.EOL();
@@ -131,7 +131,7 @@ const char *
SBValue::GetName()
{
if (IsValid())
- return m_lldb_object_sp->GetName().AsCString();
+ return m_opaque_sp->GetName().AsCString();
else
return NULL;
}
@@ -140,7 +140,7 @@ const char *
SBValue::GetTypeName ()
{
if (IsValid())
- return m_lldb_object_sp->GetTypeName().AsCString();
+ return m_opaque_sp->GetTypeName().AsCString();
else
return NULL;
}
@@ -151,7 +151,7 @@ SBValue::GetByteSize ()
size_t result = 0;
if (IsValid())
- result = m_lldb_object_sp->GetByteSize();
+ result = m_opaque_sp->GetByteSize();
return result;
}
@@ -162,7 +162,7 @@ SBValue::IsInScope (const SBFrame &frame)
bool result = false;
if (IsValid())
- result = m_lldb_object_sp->IsInScope (frame.get());
+ result = m_opaque_sp->IsInScope (frame.get());
return result;
}
@@ -171,8 +171,8 @@ const char *
SBValue::GetValue (const SBFrame &frame)
{
const char *value_string = NULL;
- if ( m_lldb_object_sp)
- value_string = m_lldb_object_sp->GetValueAsCString(frame.get());
+ if ( m_opaque_sp)
+ value_string = m_opaque_sp->GetValueAsCString(frame.get());
return value_string;
}
@@ -180,7 +180,7 @@ bool
SBValue::GetValueDidChange ()
{
if (IsValid())
- return m_lldb_object_sp->GetValueDidChange();
+ return m_opaque_sp->GetValueDidChange();
return false;
}
@@ -188,8 +188,8 @@ const char *
SBValue::GetSummary (const SBFrame &frame)
{
const char *value_string = NULL;
- if ( m_lldb_object_sp)
- value_string = m_lldb_object_sp->GetSummaryAsCString(frame.get());
+ if ( m_opaque_sp)
+ value_string = m_opaque_sp->GetSummaryAsCString(frame.get());
return value_string;
}
@@ -198,7 +198,7 @@ SBValue::GetLocation (const SBFrame &frame)
{
const char *value_string = NULL;
if (IsValid())
- value_string = m_lldb_object_sp->GetLocationAsCString(frame.get());
+ value_string = m_opaque_sp->GetLocationAsCString(frame.get());
return value_string;
}
@@ -207,7 +207,7 @@ SBValue::SetValueFromCString (const SBFrame &frame, const char *value_str)
{
bool success = false;
if (IsValid())
- success = m_lldb_object_sp->SetValueFromCString (frame.get(), value_str);
+ success = m_opaque_sp->SetValueFromCString (frame.get(), value_str);
return success;
}
@@ -218,7 +218,7 @@ SBValue::GetChildAtIndex (uint32_t idx)
if (IsValid())
{
- child_sp = m_lldb_object_sp->GetChildAtIndex (idx, true);
+ child_sp = m_opaque_sp->GetChildAtIndex (idx, true);
}
SBValue sb_value (child_sp);
@@ -229,7 +229,7 @@ uint32_t
SBValue::GetIndexOfChildWithName (const char *name)
{
if (IsValid())
- return m_lldb_object_sp->GetIndexOfChildWithName (ConstString(name));
+ return m_opaque_sp->GetIndexOfChildWithName (ConstString(name));
return UINT32_MAX;
}
@@ -241,7 +241,7 @@ SBValue::GetChildMemberWithName (const char *name)
if (IsValid())
{
- child_sp = m_lldb_object_sp->GetChildMemberWithName (str_name, true);
+ child_sp = m_opaque_sp->GetChildMemberWithName (str_name, true);
}
SBValue sb_value (child_sp);
@@ -256,7 +256,7 @@ SBValue::GetNumChildren ()
if (IsValid())
{
- num_children = m_lldb_object_sp->GetNumChildren();
+ num_children = m_opaque_sp->GetNumChildren();
}
return num_children;
@@ -269,7 +269,7 @@ SBValue::ValueIsStale ()
if (IsValid())
{
- result = m_lldb_object_sp->GetValueIsValid();
+ result = m_opaque_sp->GetValueIsValid();
}
return result;
@@ -281,7 +281,7 @@ SBValue::Dereference ()
{
if (IsValid())
{
- if (m_lldb_object_sp->IsPointerType())
+ if (m_opaque_sp->IsPointerType())
{
return GetChildAtIndex(0);
}
@@ -296,53 +296,53 @@ SBValue::TypeIsPtrType ()
if (IsValid())
{
- is_ptr_type = m_lldb_object_sp->IsPointerType();
+ is_ptr_type = m_opaque_sp->IsPointerType();
}
return is_ptr_type;
}
-lldb_private::ExecutionContext
-SBValue::GetCurrentExecutionContext ()
-{
- lldb_private::Process *process = NULL;
- lldb_private::Thread *thread = NULL;
- lldb_private::StackFrame *frame = NULL;
-
- SBTarget sb_target = SBDebugger::GetCurrentTarget();
- if (sb_target.IsValid())
- {
- SBProcess sb_process = sb_target.GetProcess();
- if (sb_process.IsValid())
- {
- process = sb_process.get();
- SBThread sb_thread = sb_process.GetCurrentThread();
- if (sb_thread.IsValid())
- {
- thread = sb_thread.GetLLDBObjectPtr();
- frame = thread->GetStackFrameAtIndex(0).get();
- lldb_private::ExecutionContext exe_context (process, thread, frame);
- return exe_context;
- }
- else
- {
- lldb_private::ExecutionContext exe_context (process, NULL, NULL);
- return exe_context;
- }
- }
- }
-
- lldb_private::ExecutionContext exe_context (NULL, NULL, NULL);
- return exe_context;
-}
-
-
+//lldb_private::ExecutionContext
+//SBValue::GetCurrentExecutionContext ()
+//{
+// lldb_private::Process *process = NULL;
+// lldb_private::Thread *thread = NULL;
+// lldb_private::StackFrame *frame = NULL;
+//
+// SBTarget sb_target = SBDebugger::GetCurrentTarget();
+// if (sb_target.IsValid())
+// {
+// SBProcess sb_process = sb_target.GetProcess();
+// if (sb_process.IsValid())
+// {
+// process = sb_process.get();
+// SBThread sb_thread = sb_process.GetCurrentThread();
+// if (sb_thread.IsValid())
+// {
+// thread = sb_thread.GetLLDBObjectPtr();
+// frame = thread->GetStackFrameAtIndex(0).get();
+// lldb_private::ExecutionContext exe_context (process, thread, frame);
+// return exe_context;
+// }
+// else
+// {
+// lldb_private::ExecutionContext exe_context (process, NULL, NULL);
+// return exe_context;
+// }
+// }
+// }
+//
+// lldb_private::ExecutionContext exe_context (NULL, NULL, NULL);
+// return exe_context;
+//}
+//
+//
void *
SBValue::GetOpaqueType()
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetOpaqueClangQualType();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetOpaqueClangQualType();
return NULL;
}
@@ -350,23 +350,23 @@ SBValue::GetOpaqueType()
lldb_private::ValueObject *
SBValue::get() const
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
lldb_private::ValueObject *
SBValue::operator->() const
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
lldb::ValueObjectSP &
SBValue::operator*()
{
- return m_lldb_object_sp;
+ return m_opaque_sp;
}
const lldb::ValueObjectSP &
SBValue::operator*() const
{
- return m_lldb_object_sp;
+ return m_opaque_sp;
}
OpenPOWER on IntegriCloud