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/SBLineEntry.cpp b/source/API/SBLineEntry.cpp
index 4835400..a35f94a 100644
--- a/source/API/SBLineEntry.cpp
+++ b/source/API/SBLineEntry.cpp
@@ -14,26 +14,26 @@
SBLineEntry::SBLineEntry () :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
}
SBLineEntry::SBLineEntry (const SBLineEntry &rhs) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (rhs.IsValid())
{
- m_lldb_object_ap.reset (new lldb_private::LineEntry (*rhs));
+ m_opaque_ap.reset (new lldb_private::LineEntry (*rhs));
}
}
SBLineEntry::SBLineEntry (const lldb_private::LineEntry *lldb_object_ptr) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (lldb_object_ptr)
- m_lldb_object_ap.reset (new lldb_private::LineEntry(*lldb_object_ptr));
+ m_opaque_ap.reset (new lldb_private::LineEntry(*lldb_object_ptr));
}
const SBLineEntry &
@@ -42,7 +42,7 @@
if (this != &rhs)
{
if (rhs.IsValid())
- m_lldb_object_ap.reset (new lldb_private::LineEntry(*rhs));
+ m_opaque_ap.reset (new lldb_private::LineEntry(*rhs));
}
return *this;
}
@@ -50,10 +50,10 @@
void
SBLineEntry::SetLineEntry (const lldb_private::LineEntry &lldb_object_ref)
{
- if (m_lldb_object_ap.get())
- (*m_lldb_object_ap.get()) = lldb_object_ref;
+ if (m_opaque_ap.get())
+ (*m_opaque_ap.get()) = lldb_object_ref;
else
- m_lldb_object_ap.reset (new lldb_private::LineEntry (lldb_object_ref));
+ m_opaque_ap.reset (new lldb_private::LineEntry (lldb_object_ref));
}
@@ -66,8 +66,8 @@
SBLineEntry::GetStartAddress () const
{
SBAddress sb_address;
- if (m_lldb_object_ap.get())
- sb_address.SetAddress(&m_lldb_object_ap->range.GetBaseAddress());
+ if (m_opaque_ap.get())
+ sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress());
return sb_address;
}
@@ -75,10 +75,10 @@
SBLineEntry::GetEndAddress () const
{
SBAddress sb_address;
- if (m_lldb_object_ap.get())
+ if (m_opaque_ap.get())
{
- sb_address.SetAddress(&m_lldb_object_ap->range.GetBaseAddress());
- sb_address.OffsetAddress(m_lldb_object_ap->range.GetByteSize());
+ sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress());
+ sb_address.OffsetAddress(m_opaque_ap->range.GetByteSize());
}
return sb_address;
}
@@ -86,7 +86,7 @@
bool
SBLineEntry::IsValid () const
{
- return m_lldb_object_ap.get() != NULL;
+ return m_opaque_ap.get() != NULL;
}
@@ -94,16 +94,16 @@
SBLineEntry::GetFileSpec () const
{
SBFileSpec sb_file_spec;
- if (m_lldb_object_ap.get() && m_lldb_object_ap->file)
- sb_file_spec.SetFileSpec(m_lldb_object_ap->file);
+ if (m_opaque_ap.get() && m_opaque_ap->file)
+ sb_file_spec.SetFileSpec(m_opaque_ap->file);
return sb_file_spec;
}
uint32_t
SBLineEntry::GetLine () const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->line;
+ if (m_opaque_ap.get())
+ return m_opaque_ap->line;
return 0;
}
@@ -111,16 +111,16 @@
uint32_t
SBLineEntry::GetColumn () const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->column;
+ if (m_opaque_ap.get())
+ return m_opaque_ap->column;
return 0;
}
bool
SBLineEntry::operator == (const SBLineEntry &rhs) const
{
- lldb_private::LineEntry *lhs_ptr = m_lldb_object_ap.get();
- lldb_private::LineEntry *rhs_ptr = rhs.m_lldb_object_ap.get();
+ lldb_private::LineEntry *lhs_ptr = m_opaque_ap.get();
+ lldb_private::LineEntry *rhs_ptr = rhs.m_opaque_ap.get();
if (lhs_ptr && rhs_ptr)
return lldb_private::LineEntry::Compare (*lhs_ptr, *rhs_ptr) == 0;
@@ -131,8 +131,8 @@
bool
SBLineEntry::operator != (const SBLineEntry &rhs) const
{
- lldb_private::LineEntry *lhs_ptr = m_lldb_object_ap.get();
- lldb_private::LineEntry *rhs_ptr = rhs.m_lldb_object_ap.get();
+ lldb_private::LineEntry *lhs_ptr = m_opaque_ap.get();
+ lldb_private::LineEntry *rhs_ptr = rhs.m_opaque_ap.get();
if (lhs_ptr && rhs_ptr)
return lldb_private::LineEntry::Compare (*lhs_ptr, *rhs_ptr) != 0;
@@ -143,13 +143,13 @@
const lldb_private::LineEntry *
SBLineEntry::operator->() const
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
const lldb_private::LineEntry &
SBLineEntry::operator*() const
{
- return *m_lldb_object_ap;
+ return *m_opaque_ap;
}