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.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@106615 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBBreakpointLocation.cpp b/source/API/SBBreakpointLocation.cpp
index b5e7859..f376f53 100644
--- a/source/API/SBBreakpointLocation.cpp
+++ b/source/API/SBBreakpointLocation.cpp
@@ -31,7 +31,7 @@
}
SBBreakpointLocation::SBBreakpointLocation (const lldb::BreakpointLocationSP &break_loc_sp) :
- m_break_loc_sp (break_loc_sp)
+ m_opaque_sp (break_loc_sp)
{
}
@@ -42,7 +42,7 @@
bool
SBBreakpointLocation::IsValid() const
{
- return m_break_loc_sp.get() != NULL;
+ return m_opaque_sp.get() != NULL;
}
addr_t
@@ -50,9 +50,9 @@
{
addr_t ret_addr = LLDB_INVALID_ADDRESS;
- if (m_break_loc_sp)
+ if (m_opaque_sp)
{
- ret_addr = m_break_loc_sp->GetLoadAddress();
+ ret_addr = m_opaque_sp->GetLoadAddress();
}
return ret_addr;
@@ -61,17 +61,17 @@
void
SBBreakpointLocation::SetEnabled (bool enabled)
{
- if (m_break_loc_sp)
+ if (m_opaque_sp)
{
- m_break_loc_sp->SetEnabled (enabled);
+ m_opaque_sp->SetEnabled (enabled);
}
}
bool
SBBreakpointLocation::IsEnabled ()
{
- if (m_break_loc_sp)
- return m_break_loc_sp->IsEnabled();
+ if (m_opaque_sp)
+ return m_opaque_sp->IsEnabled();
else
return false;
}
@@ -79,8 +79,8 @@
int32_t
SBBreakpointLocation::GetIgnoreCount ()
{
- if (m_break_loc_sp)
- return m_break_loc_sp->GetIgnoreCount();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetIgnoreCount();
else
return 0;
}
@@ -88,40 +88,39 @@
void
SBBreakpointLocation::SetIgnoreCount (int32_t n)
{
- if (m_break_loc_sp)
- m_break_loc_sp->SetIgnoreCount (n);
+ if (m_opaque_sp)
+ m_opaque_sp->SetIgnoreCount (n);
}
void
SBBreakpointLocation::SetThreadID (tid_t thread_id)
{
- if (m_break_loc_sp)
- m_break_loc_sp->SetThreadID (thread_id);
+ if (m_opaque_sp)
+ m_opaque_sp->SetThreadID (thread_id);
}
tid_t
SBBreakpointLocation::GetThreadID ()
{
tid_t sb_thread_id = (lldb::tid_t) LLDB_INVALID_THREAD_ID;
- if (m_break_loc_sp)
- sb_thread_id = m_break_loc_sp->GetLocationOptions()->GetThreadSpecNoCreate()->GetTID();
-
+ if (m_opaque_sp)
+ sb_thread_id = m_opaque_sp->GetLocationOptions()->GetThreadSpecNoCreate()->GetTID();
return sb_thread_id;
}
void
SBBreakpointLocation::SetThreadIndex (uint32_t index)
{
- if (m_break_loc_sp)
- m_break_loc_sp->GetLocationOptions()->GetThreadSpec()->SetIndex (index);
+ if (m_opaque_sp)
+ m_opaque_sp->GetLocationOptions()->GetThreadSpec()->SetIndex (index);
}
uint32_t
SBBreakpointLocation::GetThreadIndex() const
{
- if (m_break_loc_sp)
+ if (m_opaque_sp)
{
- const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
+ const ThreadSpec *thread_spec = m_opaque_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
if (thread_spec == NULL)
return 0;
else
@@ -134,16 +133,16 @@
void
SBBreakpointLocation::SetThreadName (const char *thread_name)
{
- if (m_break_loc_sp)
- m_break_loc_sp->GetLocationOptions()->GetThreadSpec()->SetName (thread_name);
+ if (m_opaque_sp)
+ m_opaque_sp->GetLocationOptions()->GetThreadSpec()->SetName (thread_name);
}
const char *
SBBreakpointLocation::GetThreadName () const
{
- if (m_break_loc_sp)
+ if (m_opaque_sp)
{
- const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
+ const ThreadSpec *thread_spec = m_opaque_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
if (thread_spec == NULL)
return NULL;
else
@@ -155,16 +154,16 @@
void
SBBreakpointLocation::SetQueueName (const char *queue_name)
{
- if (m_break_loc_sp)
- m_break_loc_sp->GetLocationOptions()->GetThreadSpec()->SetQueueName (queue_name);
+ if (m_opaque_sp)
+ m_opaque_sp->GetLocationOptions()->GetThreadSpec()->SetQueueName (queue_name);
}
const char *
SBBreakpointLocation::GetQueueName () const
{
- if (m_break_loc_sp)
+ if (m_opaque_sp)
{
- const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
+ const ThreadSpec *thread_spec = m_opaque_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
if (thread_spec == NULL)
return NULL;
else
@@ -176,8 +175,8 @@
bool
SBBreakpointLocation::IsResolved ()
{
- if (m_break_loc_sp)
- return m_break_loc_sp->IsResolved();
+ if (m_opaque_sp)
+ return m_opaque_sp->IsResolved();
else
return false;
}
@@ -185,11 +184,11 @@
void
SBBreakpointLocation::SetLocation (const lldb::BreakpointLocationSP &break_loc_sp)
{
- if (m_break_loc_sp)
+ if (m_opaque_sp)
{
// Uninstall the callbacks?
}
- m_break_loc_sp = break_loc_sp;
+ m_opaque_sp = break_loc_sp;
}
void
@@ -198,7 +197,7 @@
if (f == NULL)
return;
- if (m_break_loc_sp)
+ if (m_opaque_sp)
{
DescriptionLevel level;
if (strcmp (description_level, "brief") == 0)
@@ -212,7 +211,7 @@
StreamFile str (f);
- m_break_loc_sp->GetDescription (&str, level);
+ m_opaque_sp->GetDescription (&str, level);
str.EOL();
}
}
@@ -221,8 +220,8 @@
SBBreakpointLocation::GetBreakpoint ()
{
SBBreakpoint sb_bp;
- if (m_break_loc_sp)
- *sb_bp = m_break_loc_sp->GetBreakpoint ().GetSP();
+ if (m_opaque_sp)
+ *sb_bp = m_opaque_sp->GetBreakpoint ().GetSP();
return sb_bp;
}