From 6611103cfe7a8c08554816fc08abef2e2960e799 Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Wed, 23 Jun 2010 01:19:29 +0000 Subject: 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 --- lldb/source/API/SBCompileUnit.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'lldb/source/API/SBCompileUnit.cpp') diff --git a/lldb/source/API/SBCompileUnit.cpp b/lldb/source/API/SBCompileUnit.cpp index a12934a0587..dc873e36535 100644 --- a/lldb/source/API/SBCompileUnit.cpp +++ b/lldb/source/API/SBCompileUnit.cpp @@ -18,35 +18,35 @@ using namespace lldb_private; SBCompileUnit::SBCompileUnit () : - m_lldb_object_ptr (NULL) + m_opaque_ptr (NULL) { } SBCompileUnit::SBCompileUnit (lldb_private::CompileUnit *lldb_object_ptr) : - m_lldb_object_ptr (lldb_object_ptr) + m_opaque_ptr (lldb_object_ptr) { } SBCompileUnit::~SBCompileUnit () { - m_lldb_object_ptr = NULL; + m_opaque_ptr = NULL; } SBFileSpec SBCompileUnit::GetFileSpec () const { SBFileSpec file_spec; - if (m_lldb_object_ptr) - file_spec.SetFileSpec(*m_lldb_object_ptr); + if (m_opaque_ptr) + file_spec.SetFileSpec(*m_opaque_ptr); return file_spec; } uint32_t SBCompileUnit::GetNumLineEntries () const { - if (m_lldb_object_ptr) + if (m_opaque_ptr) { - LineTable *line_table = m_lldb_object_ptr->GetLineTable (); + LineTable *line_table = m_opaque_ptr->GetLineTable (); if (line_table) return line_table->GetSize(); } @@ -57,9 +57,9 @@ SBLineEntry SBCompileUnit::GetLineEntryAtIndex (uint32_t idx) const { SBLineEntry sb_line_entry; - if (m_lldb_object_ptr) + if (m_opaque_ptr) { - LineTable *line_table = m_lldb_object_ptr->GetLineTable (); + LineTable *line_table = m_opaque_ptr->GetLineTable (); if (line_table) { LineEntry line_entry; @@ -73,15 +73,15 @@ SBCompileUnit::GetLineEntryAtIndex (uint32_t idx) const uint32_t SBCompileUnit::FindLineEntryIndex (uint32_t start_idx, uint32_t line, SBFileSpec *inline_file_spec) const { - if (m_lldb_object_ptr) + if (m_opaque_ptr) { FileSpec file_spec; if (inline_file_spec && inline_file_spec->IsValid()) file_spec = inline_file_spec->ref(); else - file_spec = *m_lldb_object_ptr; + file_spec = *m_opaque_ptr; - return m_lldb_object_ptr->FindLineEntry (start_idx, + return m_opaque_ptr->FindLineEntry (start_idx, line, inline_file_spec ? inline_file_spec->get() : NULL, NULL); @@ -92,29 +92,29 @@ SBCompileUnit::FindLineEntryIndex (uint32_t start_idx, uint32_t line, SBFileSpec bool SBCompileUnit::IsValid () const { - return m_lldb_object_ptr != NULL; + return m_opaque_ptr != NULL; } bool SBCompileUnit::operator == (const SBCompileUnit &rhs) const { - return m_lldb_object_ptr == rhs.m_lldb_object_ptr; + return m_opaque_ptr == rhs.m_opaque_ptr; } bool SBCompileUnit::operator != (const SBCompileUnit &rhs) const { - return m_lldb_object_ptr != rhs.m_lldb_object_ptr; + return m_opaque_ptr != rhs.m_opaque_ptr; } const lldb_private::CompileUnit * SBCompileUnit::operator->() const { - return m_lldb_object_ptr; + return m_opaque_ptr; } const lldb_private::CompileUnit & SBCompileUnit::operator*() const { - return *m_lldb_object_ptr; + return *m_opaque_ptr; } -- cgit v1.2.3