diff options
-rw-r--r-- | lldb/include/lldb/API/SBBlock.h | 3 | ||||
-rw-r--r-- | lldb/include/lldb/API/SBFrame.h | 3 | ||||
-rw-r--r-- | lldb/include/lldb/API/SBProcess.h | 5 | ||||
-rw-r--r-- | lldb/include/lldb/API/SBTarget.h | 3 | ||||
-rw-r--r-- | lldb/include/lldb/API/SBThread.h | 8 | ||||
-rw-r--r-- | lldb/source/API/SBBlock.cpp | 6 | ||||
-rw-r--r-- | lldb/source/API/SBBreakpoint.cpp | 167 | ||||
-rw-r--r-- | lldb/source/API/SBCommandInterpreter.cpp | 50 | ||||
-rw-r--r-- | lldb/source/API/SBCommunication.cpp | 112 | ||||
-rw-r--r-- | lldb/source/API/SBDebugger.cpp | 43 | ||||
-rw-r--r-- | lldb/source/API/SBError.cpp | 47 | ||||
-rw-r--r-- | lldb/source/API/SBEvent.cpp | 4 | ||||
-rw-r--r-- | lldb/source/API/SBFileSpec.cpp | 24 | ||||
-rw-r--r-- | lldb/source/API/SBFrame.cpp | 198 | ||||
-rw-r--r-- | lldb/source/API/SBInputReader.cpp | 24 | ||||
-rw-r--r-- | lldb/source/API/SBListener.cpp | 10 | ||||
-rw-r--r-- | lldb/source/API/SBModule.cpp | 32 | ||||
-rw-r--r-- | lldb/source/API/SBProcess.cpp | 156 | ||||
-rw-r--r-- | lldb/source/API/SBSymbol.cpp | 39 | ||||
-rw-r--r-- | lldb/source/API/SBSymbolContext.cpp | 40 | ||||
-rw-r--r-- | lldb/source/API/SBTarget.cpp | 85 | ||||
-rw-r--r-- | lldb/source/API/SBThread.cpp | 97 | ||||
-rw-r--r-- | lldb/source/Target/Target.cpp | 2 |
23 files changed, 568 insertions, 590 deletions
diff --git a/lldb/include/lldb/API/SBBlock.h b/lldb/include/lldb/API/SBBlock.h index 4e84aaee900..62863cefe32 100644 --- a/lldb/include/lldb/API/SBBlock.h +++ b/lldb/include/lldb/API/SBBlock.h @@ -58,6 +58,9 @@ private: #ifndef SWIG + const lldb_private::Block * + get () const; + SBBlock (lldb_private::Block *lldb_object_ptr); void diff --git a/lldb/include/lldb/API/SBFrame.h b/lldb/include/lldb/API/SBFrame.h index f0430fe022c..12345a3cc08 100644 --- a/lldb/include/lldb/API/SBFrame.h +++ b/lldb/include/lldb/API/SBFrame.h @@ -124,9 +124,6 @@ public: protected: friend class SBValue; - lldb_private::StackFrame * - GetLLDBObjectPtr (); - private: friend class SBThread; friend class lldb_private::ScriptInterpreterPython; diff --git a/lldb/include/lldb/API/SBProcess.h b/lldb/include/lldb/API/SBProcess.h index 78c41ba00b6..ad612b92923 100644 --- a/lldb/include/lldb/API/SBProcess.h +++ b/lldb/include/lldb/API/SBProcess.h @@ -106,11 +106,8 @@ public: SBError Destroy (); - bool - WaitUntilProcessHasStopped (lldb::SBCommandReturnObject &result); - lldb::pid_t - AttachByPID (lldb::pid_t pid); // DEPRECATED: will be removed in a few builds in favor of SBError AttachByPID(pid_t) + AttachByPID (lldb::pid_t pid); // DEPRECATED // DEPRECATED: relocated to "SBProcess SBTarget::AttachToProcess (lldb::pid_t pid, SBError& error)" SBError diff --git a/lldb/include/lldb/API/SBTarget.h b/lldb/include/lldb/API/SBTarget.h index 6a2bb2bad76..e538c5174d8 100644 --- a/lldb/include/lldb/API/SBTarget.h +++ b/lldb/include/lldb/API/SBTarget.h @@ -43,9 +43,6 @@ public: //------------------------------------------------------------------ ~SBTarget(); - const lldb::SBTarget& - Assign (const lldb::SBTarget& rhs); - bool IsValid() const; diff --git a/lldb/include/lldb/API/SBThread.h b/lldb/include/lldb/API/SBThread.h index 46bdc64cdb0..86a19ae0568 100644 --- a/lldb/include/lldb/API/SBThread.h +++ b/lldb/include/lldb/API/SBThread.h @@ -89,9 +89,6 @@ public: #endif bool - GetDescription (lldb::SBStream &description); - - bool GetDescription (lldb::SBStream &description) const; protected: @@ -102,11 +99,12 @@ protected: friend class SBDebugger; friend class SBValue; - lldb_private::Thread * - GetLLDBObjectPtr (); #ifndef SWIG + lldb_private::Thread * + get (); + const lldb_private::Thread * operator->() const; diff --git a/lldb/source/API/SBBlock.cpp b/lldb/source/API/SBBlock.cpp index b57936d9fe0..6898a77496f 100644 --- a/lldb/source/API/SBBlock.cpp +++ b/lldb/source/API/SBBlock.cpp @@ -133,6 +133,12 @@ SBBlock::GetFirstChild () return sb_block; } +const lldb_private::Block * +SBBlock::get () const +{ + return m_opaque_ptr; +} + bool SBBlock::GetDescription (SBStream &description) diff --git a/lldb/source/API/SBBreakpoint.cpp b/lldb/source/API/SBBreakpoint.cpp index 4ed06b20213..5791b20edc5 100644 --- a/lldb/source/API/SBBreakpoint.cpp +++ b/lldb/source/API/SBBreakpoint.cpp @@ -72,31 +72,12 @@ SBBreakpoint::SBBreakpoint () : SBBreakpoint::SBBreakpoint (const SBBreakpoint& rhs) : m_opaque_sp (rhs.m_opaque_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - { - SBStream sstr; - GetDescription (sstr); - log->Printf ("SBBreakpoint::SBBreakpoint (const SBBreakpoint rhs.sp=%p) " - "=> this.sp = %p (%s)", - rhs.m_opaque_sp.get(), m_opaque_sp.get(), sstr.GetData()); - } } SBBreakpoint::SBBreakpoint (const lldb::BreakpointSP &bp_sp) : m_opaque_sp (bp_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - { - SBStream sstr; - GetDescription (sstr); - log->Printf("SBBreakpoint::SBBreakpoint (const lldb::BreakpointSP &bp_sp=%p) => this.sp = %p (%s)", - bp_sp.get(), m_opaque_sp.get(), sstr.GetData()); - } } SBBreakpoint::~SBBreakpoint() @@ -106,20 +87,8 @@ SBBreakpoint::~SBBreakpoint() const SBBreakpoint & SBBreakpoint::operator = (const SBBreakpoint& rhs) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - //if (log) - // log->Printf ("SBBreakpoint::operator="); - if (this != &rhs) - { m_opaque_sp = rhs.m_opaque_sp; - } - - if (log) - log->Printf ("SBBreakpoint::operator= (const SBBreakpoint &rhs.sp=%p) => this.sp = %p", - rhs.m_opaque_sp.get(), m_opaque_sp.get()); - return *this; } @@ -128,19 +97,16 @@ SBBreakpoint::GetID () const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBBreakpoint::GetID"); - if (m_opaque_sp) { - break_id_t id = m_opaque_sp->GetID(); + break_id_t break_id = m_opaque_sp->GetID(); if (log) - log->Printf ("SBBreakpoint::GetID (this.sp=%p) => %d", m_opaque_sp.get(), id); - return id; + log->Printf ("SBBreakpoint(%p)::GetID () => %u", m_opaque_sp.get(), break_id); + return break_id; } if (log) - log->Printf ("SBBreakpoint::GetID (this.sp=%p) => LLDB_INVALID_BREAK_ID", m_opaque_sp.get()); + log->Printf ("SBBreakpoint(%p)::GetID () => LLDB_INVALID_BREAK_ID", m_opaque_sp.get()); return LLDB_INVALID_BREAK_ID; } @@ -232,8 +198,7 @@ SBBreakpoint::SetEnabled (bool enable) Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBBreakpoint::SetEnabled (this.sp=%p, enable='%s')", m_opaque_sp.get(), - (enable ? "true" : "false")); + log->Printf ("SBBreakpoint(%p)::SetEnabled (enabled=%i)", m_opaque_sp.get(), enable); if (m_opaque_sp) m_opaque_sp->SetEnabled (enable); @@ -254,7 +219,7 @@ SBBreakpoint::SetIgnoreCount (uint32_t count) Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBBreakpoint::SetIgnoreCount (this.sp=%p, count='%d')", m_opaque_sp.get(), count); + log->Printf ("SBBreakpoint(%p)::SetIgnoreCount (count=%u)", m_opaque_sp.get(), count); if (m_opaque_sp) m_opaque_sp->SetIgnoreCount (count); @@ -275,55 +240,61 @@ SBBreakpoint::GetCondition () uint32_t SBBreakpoint::GetHitCount () const { + uint32_t count = 0; + if (m_opaque_sp) + count = m_opaque_sp->GetHitCount(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::GetHitCount () => %u", m_opaque_sp.get(), count); - //if (log) - // log->Printf ("SBBreakpoint::GetHitCount"); - - if (m_opaque_sp) - { - uint32_t hit_count = m_opaque_sp->GetHitCount(); - if (log) - log->Printf ("SBBreakpoint::GetHitCount (this.sp=%p) => '%d'", m_opaque_sp.get(), hit_count); - return m_opaque_sp->GetHitCount(); - } - else - { - if (log) - log->Printf ("SBBreakpoint::GetHitCount (this.sp=%p) => '0'", m_opaque_sp.get()); - return 0; - } + return count; } uint32_t SBBreakpoint::GetIgnoreCount () const { + uint32_t count = 0; if (m_opaque_sp) - return m_opaque_sp->GetIgnoreCount(); - else - return 0; + count = m_opaque_sp->GetIgnoreCount(); + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::GetIgnoreCount () => %u", m_opaque_sp.get(), count); + + return count; } void -SBBreakpoint::SetThreadID (tid_t sb_thread_id) +SBBreakpoint::SetThreadID (tid_t tid) { if (m_opaque_sp) - m_opaque_sp->SetThreadID (sb_thread_id); + m_opaque_sp->SetThreadID (tid); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::SetThreadID (tid=0x%4.4x)", m_opaque_sp.get(), tid); + } tid_t SBBreakpoint::GetThreadID () { - tid_t lldb_thread_id = LLDB_INVALID_THREAD_ID; + tid_t tid = LLDB_INVALID_THREAD_ID; if (m_opaque_sp) - lldb_thread_id = m_opaque_sp->GetThreadID(); + tid = m_opaque_sp->GetThreadID(); - return lldb_thread_id; + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::GetThreadID () => 0x%4.4x", m_opaque_sp.get(), tid); + return tid; } void SBBreakpoint::SetThreadIndex (uint32_t index) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::SetThreadIndex (%u)", m_opaque_sp.get(), index); if (m_opaque_sp) m_opaque_sp->GetOptions()->GetThreadSpec()->SetIndex (index); } @@ -331,14 +302,17 @@ SBBreakpoint::SetThreadIndex (uint32_t index) uint32_t SBBreakpoint::GetThreadIndex() const { + uint32_t thread_idx = 0; if (m_opaque_sp) { const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpec(); if (thread_spec == NULL) - return 0; - else - return thread_spec->GetIndex(); + thread_idx = thread_spec->GetIndex(); } + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::GetThreadIndex () => %u", m_opaque_sp.get(), index); + return 0; } @@ -346,6 +320,10 @@ SBBreakpoint::GetThreadIndex() const void SBBreakpoint::SetThreadName (const char *thread_name) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::SetThreadName (%s)", m_opaque_sp.get(), thread_name); + if (m_opaque_sp) m_opaque_sp->GetOptions()->GetThreadSpec()->SetName (thread_name); } @@ -353,20 +331,26 @@ SBBreakpoint::SetThreadName (const char *thread_name) const char * SBBreakpoint::GetThreadName () const { + const char *name = NULL; if (m_opaque_sp) { const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpec(); if (thread_spec == NULL) - return NULL; - else - return thread_spec->GetName(); + name = thread_spec->GetName(); } - return NULL; + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::GetThreadName () => %s", m_opaque_sp.get(), name); + + return name; } void SBBreakpoint::SetQueueName (const char *queue_name) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::SetQueueName (%s)", m_opaque_sp.get(), queue_name); if (m_opaque_sp) m_opaque_sp->GetOptions()->GetThreadSpec()->SetQueueName (queue_name); } @@ -374,33 +358,41 @@ SBBreakpoint::SetQueueName (const char *queue_name) const char * SBBreakpoint::GetQueueName () const { + const char *name = NULL; if (m_opaque_sp) { const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpec(); - if (thread_spec == NULL) - return NULL; - else - return thread_spec->GetQueueName(); + name = thread_spec->GetQueueName(); } - return NULL; + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::GetQueueName () => %s", m_opaque_sp.get(), name); + + return name; } size_t SBBreakpoint::GetNumResolvedLocations() const { + size_t num_resolved = 0; if (m_opaque_sp) - return m_opaque_sp->GetNumResolvedLocations(); - else - return 0; + num_resolved = m_opaque_sp->GetNumResolvedLocations(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::GetNumResolvedLocations () => %zu", m_opaque_sp.get(), num_resolved); + return num_resolved; } size_t SBBreakpoint::GetNumLocations() const { + size_t num_locs = 0; if (m_opaque_sp) - return m_opaque_sp->GetNumLocations(); - else - return 0; + num_locs = m_opaque_sp->GetNumLocations(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::GetNumLocations () => %zu", m_opaque_sp.get(), num_locs); + return num_locs; } bool @@ -461,18 +453,11 @@ SBBreakpoint::SetCallback (BreakpointHitCallback callback, void *baton) Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBBreakpoint::SetCallback (this.sp=%p, :", m_opaque_sp.get()); + log->Printf ("SBBreakpoint(%p)::SetCallback (callback=%p, baton=%p)", m_opaque_sp.get(), callback, baton); if (m_opaque_sp.get()) { BatonSP baton_sp(new SBBreakpointCallbackBaton (callback, baton)); - if (log) - { - // CAROLINE: FIXME!! - //StreamString sstr; - //baton_sp->GetDescription (sstr, lldb::eDescriptionLevelFull); - //log->Printf ("%s", sstr.GetData()); - } m_opaque_sp->SetCallback (SBBreakpoint::PrivateBreakpointHitCallback, baton_sp, false); } } diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp index dff852ddc0a..0c30ac93672 100644 --- a/lldb/source/API/SBCommandInterpreter.cpp +++ b/lldb/source/API/SBCommandInterpreter.cpp @@ -36,8 +36,8 @@ SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter *interpreter) : Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBCommandInterpreter::SBCommandInterpreter (interpreter = %p)" - " => this.obj = %p", interpreter, m_opaque_ptr); + log->Printf ("SBCommandInterpreter::SBCommandInterpreter (interpreter=%p)" + " => SBCommandInterpreter(%p)", interpreter, m_opaque_ptr); } SBCommandInterpreter::~SBCommandInterpreter () @@ -73,8 +73,8 @@ SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnOb Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf("SBCommandInterpreter::HandleCommand (this.obj=%p, command_line='%s', result=%p, " - "add_to_history='%s')", m_opaque_ptr, command_line, &result, (add_to_history ? "true" : "false")); + log->Printf ("SBCommandInterpreter(%p)::HandleCommand (command_line='%s', result=%p, add_to_history=%i)", + m_opaque_ptr, command_line, &result, add_to_history); result.Clear(); if (m_opaque_ptr) @@ -93,8 +93,8 @@ SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnOb { SBStream sstr; result.GetDescription (sstr); - log->Printf ("SBCommandInterpreter::HandleCommand ('%s') => SBCommandReturnObject: '%s'", - command_line, sstr.GetData()); + log->Printf ("SBCommandInterpreter(%p)::HandleCommand (\"%s\") => SBCommandReturnObject(%p): '%s'", + m_opaque_ptr, command_line, result.get(), sstr.GetData()); } return result.GetStatus(); @@ -156,27 +156,39 @@ SBCommandInterpreter::GetProcess () if (target) process.SetProcess(target->GetProcessSP()); } + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBCommandInterpreter(%p)::GetProcess () => SBProcess(%p)", + m_opaque_ptr, process.get()); + + return process; } ssize_t SBCommandInterpreter::WriteToScriptInterpreter (const char *src) { - if (m_opaque_ptr && src && src[0]) - return WriteToScriptInterpreter (src, strlen(src)); - return 0; + return WriteToScriptInterpreter (src, strlen(src)); } ssize_t SBCommandInterpreter::WriteToScriptInterpreter (const char *src, size_t src_len) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + ssize_t bytes_written = 0; if (m_opaque_ptr && src && src[0]) { ScriptInterpreter *script_interpreter = m_opaque_ptr->GetScriptInterpreter(); if (script_interpreter) - return ::write (script_interpreter->GetMasterFileDescriptor(), src, src_len); + bytes_written = ::write (script_interpreter->GetMasterFileDescriptor(), src, src_len); } - return 0; + if (log) + log->Printf ("SBCommandInterpreter(%p)::WriteToScriptInterpreter (src=\"%s\", src_len=%zu) => %zi", + m_opaque_ptr, src, src_len, bytes_written); + + return bytes_written; } @@ -212,6 +224,12 @@ SBCommandInterpreter::SourceInitFileInHomeDirectory (SBCommandReturnObject &resu result->AppendError ("SBCommandInterpreter is not valid"); result->SetStatus (eReturnStatusFailed); } + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBCommandInterpreter(%p)::SourceInitFileInHomeDirectory (&SBCommandReturnObject(%p))", + m_opaque_ptr, result.get()); + } void @@ -227,6 +245,11 @@ SBCommandInterpreter::SourceInitFileInCurrentWorkingDirectory (SBCommandReturnOb result->AppendError ("SBCommandInterpreter is not valid"); result->SetStatus (eReturnStatusFailed); } + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBCommandInterpreter(%p)::SourceInitFileInCurrentWorkingDirectory (&SBCommandReturnObject(%p))", + m_opaque_ptr, result.get()); } SBBroadcaster @@ -234,13 +257,10 @@ SBCommandInterpreter::GetBroadcaster () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBCommandInterpreter::GetBroadcaster ()"); - SBBroadcaster broadcaster (m_opaque_ptr, false); if (log) - log->Printf ("SBCommandInterpreter::GetBroadcaster (this.obj=%p) => SBBroadcaster (this.m_opaque_ptr=%p)", + log->Printf ("SBCommandInterpreter(%p)::GetBroadcaster() => SBBroadcaster(%p)", m_opaque_ptr, broadcaster.get()); return broadcaster; diff --git a/lldb/source/API/SBCommunication.cpp b/lldb/source/API/SBCommunication.cpp index 45c4a4c4f9d..e628e228b85 100644 --- a/lldb/source/API/SBCommunication.cpp +++ b/lldb/source/API/SBCommunication.cpp @@ -32,7 +32,7 @@ SBCommunication::SBCommunication(const char * broadcaster_name) : if (log) log->Printf ("SBCommunication::SBCommunication (broadcaster_name='%s') => " - "this.obj = %p", broadcaster_name, m_opaque); + "SBCommunication(%p): owned = 1", broadcaster_name, m_opaque); } SBCommunication::~SBCommunication() @@ -84,10 +84,7 @@ SBCommunication::AdoptFileDesriptor (int fd, bool owns_fd) { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBCommunication::AdoptFileDescriptor (this=%p, fd='%d', owns_fd='%s')", this, fd, - // (owns_fd ? "true" : "false")); - + ConnectionStatus status = eConnectionStatusNoConnection; if (m_opaque) { if (m_opaque->HasConnection ()) @@ -97,26 +94,16 @@ SBCommunication::AdoptFileDesriptor (int fd, bool owns_fd) } m_opaque->SetConnection (new ConnectionFileDescriptor (fd, owns_fd)); if (m_opaque->IsConnected()) - { - if (log) - log->Printf ("SBCommunication::AdoptFileDescriptor (this.obj=%p, fd=%d, ownd_fd='%s') " - "=> eConnectionStatusSuccess", m_opaque, fd, (owns_fd ? "true" : "false")); - return eConnectionStatusSuccess; - } + status = eConnectionStatusSuccess; else - { - if (log) - log->Printf ("SBCommunication::AdoptFileDescriptor (this.obj=%p, fd=%d, ownd_fd='%s') " - "=> eConnectionStatusLostConnection", m_opaque, fd, (owns_fd ? "true" : "false")); - return eConnectionStatusLostConnection; - } + status = eConnectionStatusLostConnection; } if (log) - log->Printf ("SBCommunication::AdoptFileDescriptor (this,obj=%p, fd=%d, ownd_fd='%s') " - "=> eConnectionStatusNoConnection", m_opaque, fd, (owns_fd ? "true" : "false")); + log->Printf ("SBCommunication(%p)::AdoptFileDescriptor (fd=%d, ownd_fd=%i) => %s", + m_opaque, fd, owns_fd, Communication::ConnectionStatusAsCString (status)); - return eConnectionStatusNoConnection; + return status; } @@ -125,15 +112,12 @@ SBCommunication::Disconnect () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBCommunication::Disconnect ()"); - ConnectionStatus status= eConnectionStatusNoConnection; if (m_opaque) status = m_opaque->Disconnect (); if (log) - log->Printf ("SBCommunication::Disconnect (this.obj=%p) => '%s'", m_opaque, + log->Printf ("SBCommunication(%p)::Disconnect () => %s", m_opaque, Communication::ConnectionStatusAsCString (status)); return status; @@ -142,27 +126,52 @@ SBCommunication::Disconnect () bool SBCommunication::IsConnected () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + bool result = false; if (m_opaque) - return m_opaque->IsConnected (); + result = m_opaque->IsConnected (); + + if (log) + log->Printf ("SBCommunication(%p)::IsConnected () => %i", m_opaque, result); + return false; } size_t SBCommunication::Read (void *dst, size_t dst_len, uint32_t timeout_usec, ConnectionStatus &status) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBCommunication(%p)::Read (dst=%p, dst_len=%zu, timeout_usec=%u, &status)...", + m_opaque, dst, dst_len, timeout_usec); + size_t bytes_read = 0; if (m_opaque) - return m_opaque->Read (dst, dst_len, timeout_usec, status, NULL); - status = eConnectionStatusNoConnection; - return 0; + bytes_read = m_opaque->Read (dst, dst_len, timeout_usec, status, NULL); + else + status = eConnectionStatusNoConnection; + + if (log) + log->Printf ("SBCommunication(%p)::Read (dst=%p, dst_len=%zu, timeout_usec=%u, &status=%s) => %zu", + m_opaque, dst, dst_len, timeout_usec, Communication::ConnectionStatusAsCString (status), + bytes_read); + return bytes_read; } size_t SBCommunication::Write (const void *src, size_t src_len, ConnectionStatus &status) { + size_t bytes_written = 0; if (m_opaque) - return m_opaque->Write (src, src_len, status, NULL); - status = eConnectionStatusNoConnection; + bytes_written = m_opaque->Write (src, src_len, status, NULL); + else + status = eConnectionStatusNoConnection; + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBCommunication(%p)::Write (src=%p, src_len=%zu, &status=%s) => %zu", + m_opaque, src, src_len, Communication::ConnectionStatusAsCString (status), bytes_written); + return 0; } @@ -171,16 +180,13 @@ SBCommunication::ReadThreadStart () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBCommunication::ReadThreadStart ()"); - bool success = false; if (m_opaque) success = m_opaque->StartReadThread (); log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBCommunication::ReadThreadStart (this.obj=%p) => '%s'", m_opaque, (success ? "true" : "false")); + log->Printf ("SBCommunication(%p)::ReadThreadStart () => %i", m_opaque, success); return success; } @@ -189,17 +195,16 @@ SBCommunication::ReadThreadStart () bool SBCommunication::ReadThreadStop () { - - //if (log) - // log->Printf ("SBCommunication::ReadThreadStop ()"); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBCommunication(%p)::ReadThreadStop ()...", m_opaque); bool success = false; if (m_opaque) success = m_opaque->StopReadThread (); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBCommunication::ReadThreadStop (this.obj=%p) => '%s'", m_opaque, (success ? "true" : "false")); + log->Printf ("SBCommunication(%p)::ReadThreadStop () => %i", m_opaque, success); return success; } @@ -207,9 +212,13 @@ SBCommunication::ReadThreadStop () bool SBCommunication::ReadThreadIsRunning () { + bool result = false; if (m_opaque) - return m_opaque->ReadThreadIsRunning (); - return false; + result = m_opaque->ReadThreadIsRunning (); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBCommunication(%p)::ReadThreadIsRunning () => %i", m_opaque, result); + return result; } bool @@ -221,28 +230,31 @@ SBCommunication::SetReadThreadBytesReceivedCallback { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBCommunication::SetReadThreadBytesReceivedCallback (this.obj=%p, callback=%p, baton=%p)", - m_opaque, callback, callback_baton); - + bool result = false; if (m_opaque) { m_opaque->SetReadThreadBytesReceivedCallback (callback, callback_baton); - if (log) - log->Printf ("SBCommunication::SetReaDThreadBytesReceivedCallback (this.obj=%p...) => true", m_opaque); - return true; + result = true; } if (log) - log->Printf ("SBCommunication::SetReaDThreadBytesReceivedCallback (this.obj=%p...) => false", m_opaque); + log->Printf ("SBCommunication(%p)::SetReadThreadBytesReceivedCallback (callback=%p, baton=%p) => %i", + m_opaque, callback, callback_baton, result); - return false; + return result; } SBBroadcaster SBCommunication::GetBroadcaster () { SBBroadcaster broadcaster (m_opaque, false); + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBCommunication(%p)::GetBroadcaster () => SBBroadcaster (%p)", + m_opaque, broadcaster.get()); + return broadcaster; } diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index 0987ff9c92c..a0aa1257571 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -411,19 +411,20 @@ SBDebugger::GetVersionString () const char * SBDebugger::StateAsCString (lldb::StateType state) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - log->Printf ("SBDebugger::StateAsCString (state=%d) => '%s'", state, - lldb_private::StateAsCString (state)); - return lldb_private::StateAsCString (state); } bool SBDebugger::StateIsRunningState (lldb::StateType state) { - return lldb_private::StateIsRunningState (state); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + const bool result = lldb_private::StateIsRunningState (state); + if (log) + log->Printf ("SBDebugger::StateIsRunningState (state=%s) => %i", + lldb_private::StateAsCString (state), result); + + return result; } bool @@ -431,11 +432,12 @@ SBDebugger::StateIsStoppedState (lldb::StateType state) { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + const bool result = lldb_private::StateIsStoppedState (state); if (log) - log->Printf ("SBDebugger::StateIsStoppedState (state=%d) => '%s'", state, - (lldb_private::StateIsStoppedState (state) ? "true" : "false")); + log->Printf ("SBDebugger::StateIsStoppedState (state=%s) => %i", + lldb_private::StateAsCString (state), result); - return lldb_private::StateIsStoppedState (state); + return result; } @@ -453,6 +455,14 @@ SBDebugger::CreateTargetWithFileAndTargetTriple (const char *filename, Error error (m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file_spec, arch, NULL, true, target_sp)); target.reset (target_sp); } + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndTargetTriple (filename='%s', tiple = %s) => SBTarget(%p)", + m_opaque_sp.get(), filename, target_triple, target.get()); + } + return target; } @@ -501,11 +511,8 @@ SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *archn if (log) { - SBStream sstr; - target.GetDescription (sstr, lldb::eDescriptionLevelFull); - log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndArch (filename='%s', arcname='%s') " - "=> SBTarget(%p): %s", m_opaque_sp.get(), filename, archname, target.get(), - sstr.GetData()); + log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndArch (filename='%s', arch = %s) => SBTarget(%p)", + m_opaque_sp.get(), filename, archname, target.get()); } return target; @@ -543,6 +550,12 @@ SBDebugger::CreateTarget (const char *filename) target.reset (target_sp); } } + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + log->Printf ("SBDebugger(%p)::CreateTarget (filename='%s') => SBTarget(%p)", + m_opaque_sp.get(), filename, target.get()); + } return target; } diff --git a/lldb/source/API/SBError.cpp b/lldb/source/API/SBError.cpp index 2f33e7c6bd8..229b894e799 100644 --- a/lldb/source/API/SBError.cpp +++ b/lldb/source/API/SBError.cpp @@ -35,8 +35,8 @@ SBError::SBError (const SBError &rhs) : { SBStream sstr; GetDescription (sstr); - log->Printf ("SBError::SBError (const SBError rhs.ap=%p) => this.ap = %p (%s)", - (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), m_opaque_ap.get(), sstr.GetData()); + log->Printf ("SBError::SBError (const SBError rhs.ap=%p) => SBError(%p): %s", + rhs.m_opaque_ap.get(), m_opaque_ap.get(), sstr.GetData()); } } @@ -49,7 +49,7 @@ const SBError & SBError::operator = (const SBError &rhs) { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - + void *old_error = m_opaque_ap.get(); if (rhs.IsValid()) { if (m_opaque_ap.get()) @@ -66,8 +66,8 @@ SBError::operator = (const SBError &rhs) { SBStream sstr; GetDescription (sstr); - log->Printf ("SBError::operator= (this.ap=%p, rhs.ap=%p) => this (%s)", - m_opaque_ap.get(), (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), sstr.GetData()); + log->Printf ("SBError(%p)::operator= (SBError(%p)) => SBError(%s)", + old_error, rhs.m_opaque_ap.get(), sstr.GetData()); } return *this; @@ -94,15 +94,12 @@ SBError::Fail () const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBError::Fail ()"); - bool ret_value = false; if (m_opaque_ap.get()) ret_value = m_opaque_ap->Fail(); if (log) - log->Printf ("SBError::Fail (this.ap=%p) => '%s'", m_opaque_ap.get(), (ret_value ? "true" : "false")); + log->Printf ("SBError(%p)::Fail () => %i", m_opaque_ap.get(), ret_value); return ret_value; } @@ -110,25 +107,45 @@ SBError::Fail () const bool SBError::Success () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + bool ret_value = false; if (m_opaque_ap.get()) - return m_opaque_ap->Success(); - return false; + ret_value = m_opaque_ap->Success(); + + if (log) + log->Printf ("SBError(%p)::Success () => %i", m_opaque_ap.get(), ret_value); + + return ret_value; } uint32_t SBError::GetError () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + uint32_t err = 0; if (m_opaque_ap.get()) - return m_opaque_ap->GetError(); - return true; + err = m_opaque_ap->GetError(); + + if (log) + log->Printf ("SBError(%p)::GetError () => 0x%8.8x", m_opaque_ap.get(), err); + + + return err; } ErrorType SBError::GetType () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + ErrorType err_type = eErrorTypeInvalid; if (m_opaque_ap.get()) - return m_opaque_ap->GetType(); - return eErrorTypeInvalid; + err_type = m_opaque_ap->GetType(); + + if (log) + log->Printf ("SBError(%p)::GetType () => %i", m_opaque_ap.get(), err_type); + + return err_type; } void diff --git a/lldb/source/API/SBEvent.cpp b/lldb/source/API/SBEvent.cpp index 606cf955759..d5653dfb7e0 100644 --- a/lldb/source/API/SBEvent.cpp +++ b/lldb/source/API/SBEvent.cpp @@ -117,10 +117,10 @@ SBEvent::BroadcasterMatchesRef (const SBBroadcaster &broadcaster) success = lldb_event->BroadcasterIs (broadcaster.get()); if (log) - log->Printf ("SBEvent(%p)::BroadcasterMathesRef (broadcaster.ptr=%p) => %s", + log->Printf ("SBEvent(%p)::BroadcasterMatchesRef (SBBroadcaster(%p)) => %i", get(), broadcaster.get(), - success ? "true" : "false"); + success); return success; } diff --git a/lldb/source/API/SBFileSpec.cpp b/lldb/source/API/SBFileSpec.cpp index 3fc6a3ad04e..9aa3f8ace8f 100644 --- a/lldb/source/API/SBFileSpec.cpp +++ b/lldb/source/API/SBFileSpec.cpp @@ -108,29 +108,27 @@ SBFileSpec::ResolvePath (const char *src_path, char *dst_path, size_t dst_len) const char * SBFileSpec::GetFilename() const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - + const char *s = NULL; if (m_opaque_ap.get()) - { - if (log) - log->Printf ("SBFileSpec(%p)::GetFilename () => %s", m_opaque_ap.get(), - m_opaque_ap->GetFilename().AsCString()); - - return m_opaque_ap->GetFilename().AsCString(); - } + s = m_opaque_ap->GetFilename().AsCString(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFileSpec(%p)::GetFilename () => NULL", m_opaque_ap.get()); + log->Printf ("SBFileSpec(%p)::GetFilename () => \"%s\"", m_opaque_ap.get(), s ? s : ""); - return NULL; + return s; } const char * SBFileSpec::GetDirectory() const { + const char *s = NULL; if (m_opaque_ap.get()) - return m_opaque_ap->GetDirectory().AsCString(); - return NULL; + s = m_opaque_ap->GetDirectory().AsCString(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBFileSpec(%p)::GetDirectory () => \"%s\"", m_opaque_ap.get(), s ? s : ""); + return s; } uint32_t diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp index 028c869b674..cb03d69d119 100644 --- a/lldb/source/API/SBFrame.cpp +++ b/lldb/source/API/SBFrame.cpp @@ -57,8 +57,8 @@ SBFrame::SBFrame (const lldb::StackFrameSP &lldb_object_sp) : { SBStream sstr; GetDescription (sstr); - log->Printf ("SBFrame::SBFrame (lldb_object_sp=%p) => this.sp = %p (%s)", lldb_object_sp.get(), - m_opaque_sp.get(), sstr.GetData()); + log->Printf ("SBFrame::SBFrame (sp=%p) => SBFrame(%p): %s", + lldb_object_sp.get(), m_opaque_sp.get(), sstr.GetData()); } } @@ -71,7 +71,16 @@ SBFrame::~SBFrame() void SBFrame::SetFrame (const lldb::StackFrameSP &lldb_object_sp) { + void *old_ptr = m_opaque_sp.get(); m_opaque_sp = lldb_object_sp; + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + { + log->Printf ("SBFrame(%p)::SetFrame(sp=%p) := SBFrame(%p)", + old_ptr, lldb_object_sp.get(), m_opaque_sp.get()); + } + } @@ -84,17 +93,14 @@ SBFrame::IsValid() const SBSymbolContext SBFrame::GetSymbolContext (uint32_t resolve_scope) const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - //if (log) - // log->Printf ("SBFrame::GetSymbolContext (this.sp=%p, resolve_scope=%d)", m_opaque_sp.get(), resolve_scope); SBSymbolContext sb_sym_ctx; if (m_opaque_sp) sb_sym_ctx.SetSymbolContext(&m_opaque_sp->GetSymbolContext (resolve_scope)); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFrame::GetSymbolContext (this.sp=%p, resolve_scope=%d) => SBSymbolContext (this.ap = %p)", + log->Printf ("SBFrame(%p)::GetSymbolContext (resolve_scope=0x%8.8x) => SBSymbolContext(%p)", m_opaque_sp.get(), resolve_scope, sb_sym_ctx.get()); return sb_sym_ctx; @@ -104,22 +110,23 @@ SBModule SBFrame::GetModule () const { SBModule sb_module (m_opaque_sp->GetSymbolContext (eSymbolContextModule).module_sp); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBFrame(%p)::GetModule () => SBModule(%p)", + m_opaque_sp.get(), sb_module.get()); + return sb_module; } SBCompileUnit SBFrame::GetCompileUnit () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - //if (log) - // log->Printf ("SBFrame::GetCompileUnit()"); - SBCompileUnit sb_comp_unit(m_opaque_sp->GetSymbolContext (eSymbolContextCompUnit).comp_unit); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFrame::GetCompileUnit (this.sp=%p) => SBCompileUnit (this=%p)", m_opaque_sp.get(), - sb_comp_unit.get()); + log->Printf ("SBFrame(%p)::GetModule () => SBCompileUnit(%p)", + m_opaque_sp.get(), sb_comp_unit.get()); return sb_comp_unit; } @@ -128,6 +135,12 @@ SBFunction SBFrame::GetFunction () const { SBFunction sb_function(m_opaque_sp->GetSymbolContext (eSymbolContextFunction).function); + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBFrame(%p)::GetFunction () => SBFunction(%p)", + m_opaque_sp.get(), sb_function.get()); + return sb_function; } @@ -135,6 +148,10 @@ SBSymbol SBFrame::GetSymbol () const { SBSymbol sb_symbol(m_opaque_sp->GetSymbolContext (eSymbolContextSymbol).symbol); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBFrame(%p)::GetSymbol () => SBSymbol(%p)", + m_opaque_sp.get(), sb_symbol.get()); return sb_symbol; } @@ -142,6 +159,10 @@ SBBlock SBFrame::GetBlock () const { SBBlock sb_block(m_opaque_sp->GetSymbolContext (eSymbolContextBlock).block); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBFrame(%p)::GetBlock () => SBBlock(%p)", + m_opaque_sp.get(), sb_block.get()); return sb_block; } @@ -149,6 +170,10 @@ SBBlock SBFrame::GetFrameBlock () const { SBBlock sb_block(m_opaque_sp->GetFrameBlock ()); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBFrame(%p)::GetFrameBlock () => SBBlock(%p)", + m_opaque_sp.get(), sb_block.get()); return sb_block; } @@ -156,32 +181,36 @@ SBLineEntry SBFrame::GetLineEntry () const { SBLineEntry sb_line_entry(&m_opaque_sp->GetSymbolContext (eSymbolContextLineEntry).line_entry); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBFrame(%p)::GetLineEntry () => SBLineEntry(%p)", + m_opaque_sp.get(), sb_line_entry.get()); return sb_line_entry; } uint32_t SBFrame::GetFrameID () const { - if (m_opaque_sp) - return m_opaque_sp->GetFrameIndex (); - else - return UINT32_MAX; + uint32_t frame_idx = m_opaque_sp ? m_opaque_sp->GetFrameIndex () : UINT32_MAX; + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBFrame(%p)::GetFrameID () => %u", + m_opaque_sp.get(), frame_idx); + return frame_idx; } lldb::addr_t SBFrame::GetPC () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - //if (log) - // log->Printf ("SBFrame::GetPC (this.sp=%p)", m_opaque_sp.get()); lldb::addr_t addr = LLDB_INVALID_ADDRESS; if (m_opaque_sp) addr = m_opaque_sp->GetFrameCodeAddress().GetLoadAddress (&m_opaque_sp->GetThread().GetProcess().GetTarget()); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFrame::GetPC (this.sp=%p) => %p", m_opaque_sp.get(), addr); + log->Printf ("SBFrame(%p)::GetPC () => %0xllx", m_opaque_sp.get(), addr); return addr; } @@ -189,18 +218,15 @@ SBFrame::GetPC () const bool SBFrame::SetPC (lldb::addr_t new_pc) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - //if (log) - // log->Printf ("SBFrame::SetPC (this.sp=%p, new_pc=%p)", m_opaque_sp.get(), new_pc); bool ret_val = false; if (m_opaque_sp) ret_val = m_opaque_sp->GetRegisterContext()->SetPC (new_pc); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFrame::SetPC (this.sp=%p, new_pc=%p) => '%s'", m_opaque_sp.get(), new_pc, - (ret_val ? "true" : "false")); + log->Printf ("SBFrame(%p)::SetPC (new_pc=0x%llx) => %i", + m_opaque_sp.get(), new_pc, ret_val); return ret_val; } @@ -208,27 +234,27 @@ SBFrame::SetPC (lldb::addr_t new_pc) lldb::addr_t SBFrame::GetSP () const { + addr_t addr = LLDB_INVALID_ADDRESS; if (m_opaque_sp) - return m_opaque_sp->GetRegisterContext()->GetSP(); - return LLDB_INVALID_ADDRESS; + addr = m_opaque_sp->GetRegisterContext()->GetSP(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBFrame(%p)::GetSP () => %0xllx", m_opaque_sp.get(), addr); + + return addr; } lldb::addr_t SBFrame::GetFP () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - //if (log) - // log->Printf ("SBFrame::GetFP ()"); - lldb::addr_t addr = LLDB_INVALID_ADDRESS; if (m_opaque_sp) addr = m_opaque_sp->GetRegisterContext()->GetFP(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFrame::GetFP (this.sp=%p) => %p", m_opaque_sp.get(), addr); - + log->Printf ("SBFrame(%p)::GetFP () => %0xllx", m_opaque_sp.get(), addr); return addr; } @@ -239,6 +265,9 @@ SBFrame::GetPCAddress () const SBAddress sb_addr; if (m_opaque_sp) sb_addr.SetAddress (&m_opaque_sp->GetFrameCodeAddress()); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBFrame(%p)::GetPCAddress () => SBAddress(%p)", m_opaque_sp.get(), sb_addr.get()); return sb_addr; } @@ -274,13 +303,17 @@ SBFrame::LookupVar (const char *var_name) if (!found) var_sp.reset(); } - if (var_sp) - { - SBValue sb_value (ValueObjectSP (new ValueObjectVariable (var_sp))); - return sb_value; - } SBValue sb_value; + + if (var_sp) + *sb_value = ValueObjectSP (new ValueObjectVariable (var_sp)); + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBFrame(%p)::LookupVar (name=\"%s\") => SBValue(%p)", + m_opaque_sp.get(), var_name, sb_value.get()); + return sb_value; } @@ -327,13 +360,16 @@ SBFrame::LookupVarInScope (const char *var_name, const char *scope) } } + SBValue sb_value; if (var_sp) - { - SBValue sb_value (ValueObjectSP (new ValueObjectVariable (var_sp))); - return sb_value; - } + *sb_value = ValueObjectSP (new ValueObjectVariable (var_sp)); + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBFrame(%p)::LookupVarInScope (name=\"%s\", scope=%s) => SBValue(%p)", + m_opaque_sp.get(), var_name, scope, sb_value.get()); + - SBValue sb_value; return sb_value; } @@ -376,8 +412,8 @@ SBFrame::GetThread () const { SBStream sstr; sb_thread.GetDescription (sstr); - log->Printf ("SBFrame::GetThread (this.sp=%p) => SBThread : this.sp= %p, '%s'", m_opaque_sp.get(), - sb_thread.GetLLDBObjectPtr(), sstr.GetData()); + log->Printf ("SBFrame(%p)::GetThread () => SBThread(%p): %s", m_opaque_sp.get(), + sb_thread.get(), sstr.GetData()); } return sb_thread; @@ -386,27 +422,18 @@ SBFrame::GetThread () const const char * SBFrame::Disassemble () const { + const char *disassembly = NULL; + if (m_opaque_sp) + disassembly = m_opaque_sp->Disassemble(); Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - Log *verbose_log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - if (verbose_log) - verbose_log->Printf ("SBFrame::Disassemble (this.sp=%p) => %s", m_opaque_sp.get(), m_opaque_sp->Disassemble()); - else if (log) - log->Printf ("SBFrame::Disassemble (this.sp=%p)", m_opaque_sp.get()); + if (log) + log->Printf ("SBFrame(%p)::Disassemble () => %s", m_opaque_sp.get(), disassembly); - if (m_opaque_sp) - return m_opaque_sp->Disassemble(); - return NULL; + return disassembly; } - -lldb_private::StackFrame * -SBFrame::GetLLDBObjectPtr () -{ - return m_opaque_sp.get(); -} - SBValueList SBFrame::GetVariables (bool arguments, bool locals, @@ -416,12 +443,12 @@ SBFrame::GetVariables (bool arguments, Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFrame::GetVariables (this_sp.get=%p, arguments=%s, locals=%s, statics=%s, in_scope_only=%s)", + log->Printf ("SBFrame(%p)::GetVariables (arguments=%i, locals=%i, statics=%i, in_scope_only=%i)", m_opaque_sp.get(), - (arguments ? "true" : "false"), - (locals ? "true" : "false"), - (statics ? "true" : "false"), - (in_scope_only ? "true" : "false")); + arguments, + locals, + statics, + in_scope_only); SBValueList value_list; if (m_opaque_sp) @@ -472,14 +499,8 @@ SBFrame::GetVariables (bool arguments, if (log) { - log->Printf ("SBFrame::GetVariables (this.sp=%p,...) => SBValueList (this.ap = %p)", m_opaque_sp.get(), + log->Printf ("SBFrame(%p)::GetVariables (...) => SBValueList(%p)", m_opaque_sp.get(), value_list.get()); - //uint32_t num_vars = value_list.GetSize(); - //for (uint32_t i = 0; i < num_vars; ++i) - //{ - // SBValue value = value_list.GetValueAtIndex (i); - // log->Printf (" %s : %s", value.GetName(), value.GetObjectDescription (*this)); - //} } return value_list; @@ -490,9 +511,6 @@ SBFrame::GetRegisters () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBFrame::GetRegisters ()"); - SBValueList value_list; if (m_opaque_sp) { @@ -508,16 +526,7 @@ SBFrame::GetRegisters () } if (log) - { - log->Printf ("SBFrame::Registers (this.sp=%p) => SBValueList (this.ap = %p)", m_opaque_sp.get(), - value_list.get() ); - //uint32_t num_vars = value_list.GetSize(); - //for (uint32_t i = 0; i < num_vars; ++i) - //{ - // SBValue value = value_list.GetValueAtIndex (i); - // log->Printf (" %s : %s", value.GetName(), value.GetObjectDescription (*this)); - //} - } + log->Printf ("SBFrame(%p)::Registers () => SBValueList(%p)", m_opaque_sp.get(), value_list.get()); return value_list; } @@ -542,7 +551,12 @@ SBFrame::GetDescription (SBStream &description) lldb::SBValue SBFrame::EvaluateExpression (const char *expr) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + lldb::SBValue expr_result_value; + if (log) + log->Printf ("SBFrame(%p)::EvaluateExpression (expr=\"%s\")...", m_opaque_sp.get(), expr); + if (m_opaque_sp) { ExecutionContext exe_ctx; @@ -555,5 +569,9 @@ SBFrame::EvaluateExpression (const char *expr) *expr_result_value = ClangUserExpression::Evaluate (exe_ctx, expr, prefix); } + + if (log) + log->Printf ("SBFrame(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p)", m_opaque_sp.get(), expr_result_value.get()); + return expr_result_value; } diff --git a/lldb/source/API/SBInputReader.cpp b/lldb/source/API/SBInputReader.cpp index adca15662af..616638b6717 100644 --- a/lldb/source/API/SBInputReader.cpp +++ b/lldb/source/API/SBInputReader.cpp @@ -36,7 +36,7 @@ SBInputReader::SBInputReader (const lldb::InputReaderSP &reader_sp) : Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBInputReader::SBInputReader (reader_sp=%p) => this.sp = %p", reader_sp.get(), + log->Printf ("SBInputReader::SBInputReader (reader_sp=%p) => SBInputReader(%p)", reader_sp.get(), m_opaque_sp.get()); } @@ -46,7 +46,7 @@ SBInputReader::SBInputReader (const SBInputReader &rhs) : Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf("SBInputReader::SBInputReader (rhs.sp=%p) => this.sp = %p", + log->Printf("SBInputReader::SBInputReader (rhs.sp=%p) => SBInputReader(%p)", rhs.m_opaque_sp.get(), m_opaque_sp.get()); } @@ -87,10 +87,14 @@ SBInputReader::Initialize Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf("SBInputReader::Initialize (this.sp=%p, debugger.sp=%p, callback_function=%p, callback_baton=%p, " - "granularity='%s', end_token='%s', prompt='%s', echo=%s)", m_opaque_sp.get(), debugger.get(), - callback_baton, InputReader::GranularityAsCString (granularity), end_token, prompt, - (echo ? "true" : "false")); + log->Printf("SBInputReader(%p)::Initialize (SBDebugger(%p), callback_function=%p, callback_baton=%p, " + "granularity='%s', end_token='%s', prompt='%s', echo=%i)", + m_opaque_sp.get(), + debugger.get(), + callback_function, + callback_baton, + InputReader::GranularityAsCString (granularity), end_token, prompt, + echo); SBError sb_error; m_opaque_sp.reset (new InputReader (debugger.ref())); @@ -119,7 +123,7 @@ SBInputReader::Initialize { SBStream sstr; sb_error.GetDescription (sstr); - log->Printf ("SBInputReader::Initialize (this.sp=%p, ...) => SBError (this.ap=%p, '%s')", m_opaque_sp.get(), + log->Printf ("SBInputReader(%p)::Initialize (...) => SBError(%p): %s", m_opaque_sp.get(), sb_error.get(), sstr.GetData()); } @@ -192,16 +196,12 @@ SBInputReader::IsActive () const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBInputReader::IsActive ()"); - bool ret_value = false; if (m_opaque_sp) ret_value = m_opaque_sp->IsActive(); if (log) - log->Printf ("SBInputReader::IsActive (this.sp=%p) => '%s'", m_opaque_sp.get(), - (ret_value ? "true" : "false")); + log->Printf ("SBInputReader(%p)::IsActive () => %i", m_opaque_sp.get(), ret_value); return ret_value; } diff --git a/lldb/source/API/SBListener.cpp b/lldb/source/API/SBListener.cpp index d4f9101dfb2..d291ac1cf3a 100644 --- a/lldb/source/API/SBListener.cpp +++ b/lldb/source/API/SBListener.cpp @@ -87,18 +87,18 @@ SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - uint32_t ret_value = 0; + uint32_t aquired_event_mask = 0; if (m_opaque_ptr && broadcaster.IsValid()) { - ret_value = m_opaque_ptr->StartListeningForEvents (broadcaster.get(), event_mask); + aquired_event_mask = m_opaque_ptr->StartListeningForEvents (broadcaster.get(), event_mask); } log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBListener(%p)::StartListeneingForEvents (SBBroadcaster(%p), event_mask=0x%8.8x) => %d", - m_opaque_ptr, broadcaster.get(), event_mask, ret_value); + log->Printf ("SBListener(%p)::StartListeneingForEvents (SBBroadcaster(%p), event_mask=0x%8.8x) => 0x%8.8x", + m_opaque_ptr, broadcaster.get(), event_mask, aquired_event_mask); - return ret_value; + return aquired_event_mask; } bool diff --git a/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp index f5dbcf9905a..55e691bb583 100644 --- a/lldb/source/API/SBModule.cpp +++ b/lldb/source/API/SBModule.cpp @@ -28,10 +28,6 @@ SBModule::SBModule () : SBModule::SBModule (const lldb::ModuleSP& module_sp) : m_opaque_sp (module_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - log->Printf ("SBModule::SBModule (module_sp=%p) => this.sp = %p", module_sp.get(), m_opaque_sp.get()); } SBModule::~SBModule () @@ -49,9 +45,6 @@ SBModule::GetFileSpec () const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBModule::GetFileSpec ()"); - SBFileSpec file_spec; if (m_opaque_sp) file_spec.SetFileSpec(m_opaque_sp->GetFileSpec()); @@ -60,7 +53,7 @@ SBModule::GetFileSpec () const { SBStream sstr; file_spec.GetDescription (sstr); - log->Printf ("SBModule::GetFileSpec (this.sp=%p) => SBFileSpec : this.ap = %p, 's'", m_opaque_sp.get(), + log->Printf ("SBModule(%p)::GetFileSpec () => SBFileSpec(%p): %s", m_opaque_sp.get(), file_spec.get(), sstr.GetData()); } @@ -72,23 +65,22 @@ SBModule::GetUUIDBytes () const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBModule::GetUUIDBytes ()"); - + const uint8_t *uuid_bytes = NULL; if (m_opaque_sp) + uuid_bytes = (const uint8_t *)m_opaque_sp->GetUUID().GetBytes(); + + if (log) { - if (log) + if (uuid_bytes) { - StreamString sstr; - m_opaque_sp->GetUUID().Dump (&sstr); - log->Printf ("SBModule::GetUUIDBytes (this.sp=%p) => '%s'", m_opaque_sp.get(), sstr.GetData()); + StreamString s; + m_opaque_sp->GetUUID().Dump (&s); + log->Printf ("SBModule(%p)::GetUUIDBytes () => %s", m_opaque_sp.get(), s.GetData()); } - return (const uint8_t *)m_opaque_sp->GetUUID().GetBytes(); + else + log->Printf ("SBModule(%p)::GetUUIDBytes () => NULL", m_opaque_sp.get()); } - - if (log) - log->Printf ("SBModule::GetUUIDBytes (this.sp=%p) => NULL", m_opaque_sp.get()); - return NULL; + return uuid_bytes; } diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp index 000854d9713..23152aa43d5 100644 --- a/lldb/source/API/SBProcess.cpp +++ b/lldb/source/API/SBProcess.cpp @@ -53,20 +53,12 @@ SBProcess::SBProcess () : SBProcess::SBProcess (const SBProcess& rhs) : m_opaque_sp (rhs.m_opaque_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - log->Printf ("SBProcess::SBProcess(%p)", rhs.m_opaque_sp.get()); } SBProcess::SBProcess (const lldb::ProcessSP &process_sp) : m_opaque_sp (process_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - log->Printf ("SBProcess::SBProcess(%p)", process_sp.get()); } //---------------------------------------------------------------------- @@ -125,7 +117,7 @@ SBProcess::GetSelectedThread () const if (log) { - log->Printf ("SBProcess(%p)::GetSelectedThread () => SBThread(%p)", m_opaque_sp.get(), sb_thread.GetLLDBObjectPtr()); + log->Printf ("SBProcess(%p)::GetSelectedThread () => SBThread(%p)", m_opaque_sp.get(), sb_thread.get()); } return sb_thread; @@ -289,7 +281,7 @@ SBProcess::GetThreadAtIndex (size_t index) if (log) { log->Printf ("SBProcess(%p)::GetThreadAtIndex (index=%d) => SBThread(%p)", - m_opaque_sp.get(), (uint32_t) index, thread.GetLLDBObjectPtr()); + m_opaque_sp.get(), (uint32_t) index, thread.get()); } return thread; @@ -298,12 +290,12 @@ SBProcess::GetThreadAtIndex (size_t index) StateType SBProcess::GetState () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); StateType ret_val = eStateInvalid; if (m_opaque_sp != NULL) ret_val = m_opaque_sp->GetState(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) log->Printf ("SBProcess(%p)::GetState () => '%s'", m_opaque_sp.get(), @@ -316,30 +308,38 @@ SBProcess::GetState () int SBProcess::GetExitStatus () { - if (m_opaque_sp != NULL) - return m_opaque_sp->GetExitStatus (); - else - return 0; + int exit_status = 0; + if (m_opaque_sp) + exit_status = m_opaque_sp->GetExitStatus (); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBProcess(%p)::GetExitStatus () => %i (0x%8.8x)", + m_opaque_sp.get(), exit_status, exit_status); + + return exit_status; } const char * SBProcess::GetExitDescription () { + const char *exit_desc = NULL; if (m_opaque_sp != NULL) - return m_opaque_sp->GetExitDescription (); - else - return NULL; + exit_desc = m_opaque_sp->GetExitDescription (); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBProcess(%p)::GetExitDescription () => %s", + m_opaque_sp.get(), exit_desc); + return exit_desc; } lldb::pid_t SBProcess::GetProcessID () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - lldb::pid_t ret_val = LLDB_INVALID_PROCESS_ID; if (m_opaque_sp) ret_val = m_opaque_sp->GetID(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) log->Printf ("SBProcess(%p)::GetProcessID () => %d", m_opaque_sp.get(), ret_val); @@ -349,42 +349,23 @@ SBProcess::GetProcessID () uint32_t SBProcess::GetAddressByteSize () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - uint32_t size = 0; if (m_opaque_sp) size = m_opaque_sp->GetAddressByteSize(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) log->Printf ("SBProcess(%p)::GetAddressByteSize () => %d", m_opaque_sp.get(), size); return size; } -bool -SBProcess::WaitUntilProcessHasStopped (SBCommandReturnObject &result) -{ - bool state_changed = false; - - if (IsValid()) - { - EventSP event_sp; - StateType state = m_opaque_sp->WaitForStateChangedEvents (NULL, event_sp); - - while (StateIsStoppedState (state)) - { - state = m_opaque_sp->WaitForStateChangedEvents (NULL, event_sp); - SBEvent event (event_sp); - AppendEventStateReport (event, result); - state_changed = true; - } - } - return state_changed; -} - SBError SBProcess::Continue () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBProcess(%p)::Continue ()...", m_opaque_sp.get()); SBError sb_error; if (IsValid()) @@ -393,14 +374,17 @@ SBProcess::Continue () if (error.Success()) { if (m_opaque_sp->GetTarget().GetDebugger().GetAsyncExecution () == false) + { + if (log) + log->Printf ("SBProcess(%p)::Continue () waiting for process to stop...", m_opaque_sp.get()); m_opaque_sp->WaitForProcessToStop (NULL); + } } sb_error.SetError(error); } else sb_error.SetErrorString ("SBProcess is invalid"); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { SBStream sstr; @@ -421,6 +405,14 @@ SBProcess::Destroy () else sb_error.SetErrorString ("SBProcess is invalid"); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + SBStream sstr; + sb_error.GetDescription (sstr); + log->Printf ("SBProcess(%p)::Destroy () => SBError (%p): %s", m_opaque_sp.get(), sb_error.get(), sstr.GetData()); + } + return sb_error; } @@ -475,7 +467,7 @@ SBProcess::Kill () SBError -SBProcess::AttachByName (const char *name, bool wait_for_launch) +SBProcess::AttachByName (const char *name, bool wait_for_launch) // DEPRECATED { SBError sb_error; if (m_opaque_sp) @@ -486,7 +478,7 @@ SBProcess::AttachByName (const char *name, bool wait_for_launch) } lldb::pid_t -SBProcess::AttachByPID (lldb::pid_t attach_pid) // DEPRECATED: will be removed in a few builds in favor of SBError AttachByPID(pid_t) +SBProcess::AttachByPID (lldb::pid_t attach_pid) // DEPRECATED { Attach (attach_pid); return GetProcessID(); @@ -494,7 +486,7 @@ SBProcess::AttachByPID (lldb::pid_t attach_pid) // DEPRECATED: will be removed i SBError -SBProcess::Attach (lldb::pid_t attach_pid) +SBProcess::Attach (lldb::pid_t attach_pid) // DEPRECATED { SBError sb_error; if (m_opaque_sp) @@ -517,23 +509,44 @@ SBProcess::Detach () } SBError -SBProcess::Signal (int signal) +SBProcess::Signal (int signo) { SBError sb_error; if (m_opaque_sp) - sb_error.SetError (m_opaque_sp->Signal (signal)); + sb_error.SetError (m_opaque_sp->Signal (signo)); else sb_error.SetErrorString ("SBProcess is invalid"); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + SBStream sstr; + sb_error.GetDescription (sstr); + log->Printf ("SBProcess(%p)::Signal (signo=%i) => SBError (%p): %s", + m_opaque_sp.get(), + signo, + sb_error.get(), + sstr.GetData()); + } return sb_error; } SBThread -SBProcess::GetThreadByID (tid_t sb_thread_id) +SBProcess::GetThreadByID (tid_t tid) { - SBThread thread; + SBThread sb_thread; if (m_opaque_sp) - thread.SetThread (m_opaque_sp->GetThreadList().FindThreadByID ((tid_t) sb_thread_id)); - return thread; + sb_thread.SetThread (m_opaque_sp->GetThreadList().FindThreadByID ((tid_t) tid)); + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + log->Printf ("SBProcess(%p)::GetThreadByID (tid=0x%4.4x) => SBThread (%p)", + m_opaque_sp.get(), + tid, + sb_thread.get()); + } + + return sb_thread; } StateType @@ -591,6 +604,16 @@ SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error size_t bytes_read = 0; + if (log) + { + log->Printf ("SBProcess(%p)::ReadMemory (addr=0x%llx, dst=%p, dst_len=%zu, SBError (%p))...", + m_opaque_sp.get(), + addr, + dst, + (uint32_t) dst_len, + sb_error.get()); + } + if (IsValid()) { Error error; @@ -606,7 +629,7 @@ SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error { SBStream sstr; sb_error.GetDescription (sstr); - log->Printf ("SBProcess(%p)::ReadMemory (addr=%llx, dst=%p, dst_len=%d, SBError (%p): %s) => %d", + log->Printf ("SBProcess(%p)::ReadMemory (addr=0x%llx, dst=%p, dst_len=%zu, SBError (%p): %s) => %d", m_opaque_sp.get(), addr, dst, @@ -624,6 +647,17 @@ SBProcess::WriteMemory (addr_t addr, const void *src, size_t src_len, SBError &s { size_t bytes_written = 0; + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%llx, src=%p, dst_len=%zu, SBError (%p))...", + m_opaque_sp.get(), + addr, + src, + (uint32_t) src_len, + sb_error.get()); + } + if (IsValid()) { Error error; @@ -631,6 +665,20 @@ SBProcess::WriteMemory (addr_t addr, const void *src, size_t src_len, SBError &s sb_error.SetError (error); } + if (log) + { + SBStream sstr; + sb_error.GetDescription (sstr); + log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%llx, src=%p, dst_len=%zu, SBError (%p): %s) => %d", + m_opaque_sp.get(), + addr, + src, + (uint32_t) src_len, + sb_error.get(), + sstr.GetData(), + (uint32_t) bytes_written); + } + return bytes_written; } diff --git a/lldb/source/API/SBSymbol.cpp b/lldb/source/API/SBSymbol.cpp index c8bbdc6760f..f5b09c9506a 100644 --- a/lldb/source/API/SBSymbol.cpp +++ b/lldb/source/API/SBSymbol.cpp @@ -27,16 +27,6 @@ SBSymbol::SBSymbol () : SBSymbol::SBSymbol (lldb_private::Symbol *lldb_object_ptr) : m_opaque_ptr (lldb_object_ptr) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - { - SBStream sstr; - GetDescription (sstr); - log->Printf ("SBSymbol::SBSymbol (lldb_object_ptr=%p) => this.obj = %p (%s)", lldb_object_ptr, m_opaque_ptr, - sstr.GetData()); - - } } SBSymbol::~SBSymbol () @@ -53,32 +43,27 @@ SBSymbol::IsValid () const const char * SBSymbol::GetName() const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - //if (log) - // log->Printf ("SBSymbol::GetName ()"); - + const char *name = NULL; if (m_opaque_ptr) - { - if (log) - log->Printf ("SBSymbol::GetName (this.obj=%p) => '%s'", m_opaque_ptr, - m_opaque_ptr->GetMangled().GetName().AsCString()); + name = m_opaque_ptr->GetMangled().GetName().AsCString(); - return m_opaque_ptr->GetMangled().GetName().AsCString(); - } - + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBSymbol::GetName (this.obj=%p) => NULL", m_opaque_ptr); - - return NULL; + log->Printf ("SBSymbol(%p)::GetName () => \"%s\"", m_opaque_ptr, name ? name : ""); + return name; } const char * SBSymbol::GetMangledName () const { + const char *name = NULL; if (m_opaque_ptr) - return m_opaque_ptr->GetMangled().GetMangledName().AsCString(); - return NULL; + name = m_opaque_ptr->GetMangled().GetMangledName().AsCString(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBSymbol(%p)::GetMangledName () => \"%s\"", m_opaque_ptr, name ? name : ""); + + return name; } diff --git a/lldb/source/API/SBSymbolContext.cpp b/lldb/source/API/SBSymbolContext.cpp index 8c47f3e916c..3b0b5fc0e61 100644 --- a/lldb/source/API/SBSymbolContext.cpp +++ b/lldb/source/API/SBSymbolContext.cpp @@ -25,26 +25,13 @@ SBSymbolContext::SBSymbolContext () : SBSymbolContext::SBSymbolContext (const SymbolContext *sc_ptr) : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (sc_ptr) m_opaque_ap.reset (new SymbolContext (*sc_ptr)); - - if (log) - { - SBStream sstr; - GetDescription (sstr); - log->Printf ("SBSymbolContext::SBSymcolContext (sc_ptr=%p) => this.ap = %p (%s)", - sc_ptr, m_opaque_ap.get(), sstr.GetData()); - } } SBSymbolContext::SBSymbolContext (const SBSymbolContext& rhs) : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (rhs.IsValid()) { if (m_opaque_ap.get()) @@ -52,11 +39,6 @@ SBSymbolContext::SBSymbolContext (const SBSymbolContext& rhs) : else ref() = *rhs.m_opaque_ap; } - - if (log) - log->Printf ("SBSymbolContext::SBSymcolContext (rhs.ap=%p) => this.ap = %p", - (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), m_opaque_ap.get()); - } SBSymbolContext::~SBSymbolContext () @@ -104,9 +86,6 @@ SBSymbolContext::GetModule () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBSymbolContext::GetModule ()"); - SBModule sb_module; if (m_opaque_ap.get()) sb_module.SetModule(m_opaque_ap->module_sp); @@ -115,8 +94,8 @@ SBSymbolContext::GetModule () { SBStream sstr; sb_module.GetDescription (sstr); - log->Printf ("SBSymbolContext::GetModule (this.ap=%p) => SBModule (this.sp = %p, '%s')", m_opaque_ap.get(), - sb_module.get(), sstr.GetData()); + log->Printf ("SBSymbolContext(%p)::GetModule () => SBModule(%p): %s", + m_opaque_ap.get(), sb_module.get(), sstr.GetData()); } return sb_module; @@ -133,13 +112,10 @@ SBSymbolContext::GetFunction () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBSymbolContext::GetFunction ()"); - SBFunction ret_function (m_opaque_ap.get() ? m_opaque_ap->function : NULL); if (log) - log->Printf ("SBSymbolContext::GetFunction (this.ap=%p) => SBFunction (this.obj = %p, '%s')", + log->Printf ("SBSymbolContext(%p)::GetFunction () => SBFunction(%p): %s", m_opaque_ap.get(), ret_function.get(), ret_function.GetName()); return ret_function; @@ -156,9 +132,6 @@ SBSymbolContext::GetLineEntry () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBSymbolContext::GetLineEntry ()"); - SBLineEntry sb_line_entry; if (m_opaque_ap.get()) sb_line_entry.SetLineEntry (m_opaque_ap->line_entry); @@ -167,7 +140,7 @@ SBSymbolContext::GetLineEntry () { SBStream sstr; sb_line_entry.GetDescription (sstr); - log->Printf ("SBSymbolContext::GetLineEntry (this.ap=%p) => SBLineEntry (this.ap = %p, '%s')", + log->Printf ("SBSymbolContext(%p)::GetLineEntry () => SBLineEntry(%p): %s", m_opaque_ap.get(), sb_line_entry.get(), sstr.GetData()); } @@ -180,16 +153,13 @@ SBSymbolContext::GetSymbol () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBSymbolContext::GetSymbol ()"); - SBSymbol ret_symbol (m_opaque_ap.get() ? m_opaque_ap->symbol : NULL); if (log) { SBStream sstr; ret_symbol.GetDescription (sstr); - log->Printf ("SBSymbolContext::GetSymbol (this.ap=%p) => SBSymbol (this.ap = %p, '%s')", m_opaque_ap.get(), + log->Printf ("SBSymbolContext(%p)::GetSymbol () => SBSymbol(%p): %s", m_opaque_ap.get(), ret_symbol.get(), sstr.GetData()); } diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index 8cd41ad5817..d31ad562ddb 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -57,48 +57,31 @@ SBTarget::SBTarget () SBTarget::SBTarget (const SBTarget& rhs) : m_opaque_sp (rhs.m_opaque_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - { - SBStream sstr; - GetDescription (sstr, lldb::eDescriptionLevelBrief); - log->Printf ("SBTarget::SBTarget (rhs.sp=%p) => SBTarget(%p): %s", - rhs.m_opaque_sp.get(), m_opaque_sp.get(), sstr.GetData()); - } +// Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); +// +// if (log) +// { +// SBStream sstr; +// GetDescription (sstr, lldb::eDescriptionLevelBrief); +// log->Printf ("SBTarget::SBTarget (rhs.sp=%p) => SBTarget(%p): %s", +// rhs.m_opaque_sp.get(), m_opaque_sp.get(), sstr.GetData()); +// } } SBTarget::SBTarget(const TargetSP& target_sp) : m_opaque_sp (target_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - { - SBStream sstr; - GetDescription (sstr, lldb::eDescriptionLevelBrief); - log->Printf ("SBTarget::SBTarget (target_sp=%p) => SBTarget(%p): '%s'", - target_sp.get(), m_opaque_sp.get(), sstr.GetData()); - } -} - -const SBTarget& -SBTarget::Assign (const SBTarget& rhs) -{ - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - log->Printf ("SBTarget(%p)::Assign (rhs.sp=%p)", m_opaque_sp.get(), rhs.m_opaque_sp.get()); - - if (this != &rhs) - { - m_opaque_sp = rhs.m_opaque_sp; - } - - return *this; +// Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); +// +// if (log) +// { +// SBStream sstr; +// GetDescription (sstr, lldb::eDescriptionLevelBrief); +// log->Printf ("SBTarget::SBTarget (target_sp=%p) => SBTarget(%p): %s", +// target_sp.get(), m_opaque_sp.get(), sstr.GetData()); +// } } - //---------------------------------------------------------------------- // Destructor //---------------------------------------------------------------------- @@ -178,7 +161,7 @@ SBTarget::LaunchProcess Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBTarget(%p)::LaunchProcess (argv=%p, envp=%p, tty='%s', launch_flags=%d, stop_at_entry=%i)", + log->Printf ("SBTarget(%p)::LaunchProcess (argv=%p, envp=%p, tty=\"%s\", launch_flags=%d, stop_at_entry=%i)", m_opaque_sp.get(), argv, envp, tty, launch_flags, stop_at_entry); SBError sb_error; @@ -211,7 +194,7 @@ SBTarget::Launch if (log) { - log->Printf ("SBTarget(%p)::Launch (argv=%p, envp=%p, tty='%s', launch_flags=%d, stop_at_entry=%i, &error (%p))...", + log->Printf ("SBTarget(%p)::Launch (argv=%p, envp=%p, tty=\"%s\", launch_flags=%d, stop_at_entry=%i, &error (%p))...", m_opaque_sp.get(), argv, envp, tty, launch_flags, stop_at_entry, error.get()); } SBProcess sb_process; @@ -429,20 +412,7 @@ SBTarget::reset (const lldb::TargetSP& target_sp) SBBreakpoint SBTarget::BreakpointCreateByLocation (const char *file, uint32_t line) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - SBBreakpoint sb_bp; - if (file != NULL && line != 0) - sb_bp = BreakpointCreateByLocation (SBFileSpec (file), line); - - if (log) - { - SBStream sstr; - sb_bp.GetDescription (sstr); - log->Printf("SBTarget(%p)::BreakpointCreateByLocation (file='%s', line=%d) => SBBreakpoint(%p): %s", m_opaque_sp.get(), file, line, sb_bp.get(), sstr.GetData()); - } - - return sb_bp; + return SBBreakpoint(BreakpointCreateByLocation (SBFileSpec (file), line)); } SBBreakpoint @@ -458,8 +428,13 @@ SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, uint32_t l { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf ("SBTarget(%p)::BreakpointCreateByLocation (sb_file_spec.ap=%p, line=%d) => " - "SBBreakpoint(%p): %s", m_opaque_sp.get(), sb_file_spec.get(), line, sb_bp.get(), + const char *dir = sb_file_spec.GetDirectory(); + const char *file = sb_file_spec.GetFilename(); + log->Printf ("SBTarget(%p)::BreakpointCreateByLocation ( %s%s%s:%u ) => SBBreakpoint(%p): %s", + m_opaque_sp.get(), + dir ? dir : "", dir ? "/" : "", file ? file : "", + line, + sb_bp.get(), sstr.GetData()); } @@ -489,7 +464,7 @@ SBTarget::BreakpointCreateByName (const char *symbol_name, const char *module_na { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol_name='%s', module_name='%s') => " + log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", module=\"%s\") => " "SBBreakpoint(%p): %s", m_opaque_sp.get(), symbol_name, module_name, sb_bp.get(), sstr.GetData()); } @@ -523,7 +498,7 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *mo { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_name_regex='%s', module_name='%s') " + log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_regex=\"%s\", module_name=\"%s\") " "=> SBBreakpoint(%p): %s", m_opaque_sp.get(), symbol_name_regex, module_name, sb_bp.get(), sstr.GetData()); } diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp index b28a379f1a6..782569e5306 100644 --- a/lldb/source/API/SBThread.cpp +++ b/lldb/source/API/SBThread.cpp @@ -49,27 +49,10 @@ SBThread::SBThread () : SBThread::SBThread (const ThreadSP& lldb_object_sp) : m_opaque_sp (lldb_object_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - { - SBStream sstr; - GetDescription (sstr); - log->Printf ("SBThread::SBThread (lldb_object_sp=%p) => SBThread(%p) :%s", - lldb_object_sp.get(), m_opaque_sp.get(), sstr.GetData()); - } } SBThread::SBThread (const SBThread &rhs) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - m_opaque_sp = rhs.m_opaque_sp; - - if (log) - log->Printf ("SBThread::SBThread (rhs.sp=%p) => SBThread(%p)", - rhs.m_opaque_sp.get(), m_opaque_sp.get()); - } //---------------------------------------------------------------------- @@ -106,7 +89,7 @@ SBThread::GetStopReason() } if (log) - log->Printf ("SBThread(%p)::GetStopReason () => '%s'", m_opaque_sp.get(), + log->Printf ("SBThread(%p)::GetStopReason () => %s", m_opaque_sp.get(), Thread::StopReasonAsCString (reason)); return reason; @@ -126,7 +109,7 @@ SBThread::GetStopDescription (char *dst, size_t dst_len) if (stop_desc) { if (log) - log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => '%s'", + log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => \"%s\"", m_opaque_sp.get(), stop_desc); if (dst) return ::snprintf (dst, dst_len, "%s", stop_desc); @@ -224,15 +207,12 @@ SBThread::GetThreadID () const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBThread::GetThreadID()"); - lldb::tid_t id = LLDB_INVALID_THREAD_ID; if (m_opaque_sp) id = m_opaque_sp->GetID(); if (log) - log->Printf ("SBThread::GetThreadID (this.sp=%p) => %d", m_opaque_sp.get(), (uint32_t) id); + log->Printf ("SBThread(%p)::GetThreadID () => 0x%4.4x", m_opaque_sp.get(), id); return id; } @@ -247,44 +227,29 @@ SBThread::GetIndexID () const const char * SBThread::GetName () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - //if (log) - // log->Printf ("SBThread::GetName ()"); - + const char *name = NULL; if (m_opaque_sp) - { - if (log) - log->Printf ("SBThread::GetName (this.sp=%p) => '%s'", m_opaque_sp.get(), m_opaque_sp->GetName()); - return m_opaque_sp->GetName(); - } - + name = m_opaque_sp->GetName(); + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::GetName (this.sp=%p) => NULL", m_opaque_sp.get()); + log->Printf ("SBThread(%p)::GetName () => %s", m_opaque_sp.get(), name ? name : "NULL"); - return NULL; + return name; } const char * SBThread::GetQueueName () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - //if (log) - // log->Printf ("SBThread::GetQueueName ()"); - + const char *name = NULL; if (m_opaque_sp) - { - if (log) - log->Printf ("SBThread::GetQueueName (this.sp=%p) => '%s'", m_opaque_sp.get(), - m_opaque_sp->GetQueueName()); - return m_opaque_sp->GetQueueName(); - } - + name = m_opaque_sp->GetQueueName(); + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::GetQueueName (this.sp=%p) => NULL", m_opaque_sp.get()); + log->Printf ("SBThread(%p)::GetQueueName () => %s", m_opaque_sp.get(), name ? name : "NULL"); - return NULL; + return name; } @@ -390,7 +355,7 @@ SBThread::StepOut () Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::StepOut (this.sp=%p)", m_opaque_sp.get()); + log->Printf ("SBThread(%p)::StepOut ()", m_opaque_sp.get()); if (m_opaque_sp) { @@ -482,7 +447,7 @@ SBThread::GetProcess () { SBStream sstr; process.GetDescription (sstr); - log->Printf ("SBThread::GetProcess (this.sp=%p) => SBProcess : this.sp = %p, '%s'", m_opaque_sp.get(), + log->Printf ("SBThread(%p)::GetProcess () => SBProcess(%p): %s", m_opaque_sp.get(), process.get(), sstr.GetData()); } @@ -499,7 +464,7 @@ SBThread::GetNumFrames () num_frames = m_opaque_sp->GetStackFrameCount(); if (log) - log->Printf ("SBThread::GetNumFrames (this.sp=%p) => %d", m_opaque_sp.get(), num_frames); + log->Printf ("SBThread(%p)::GetNumFrames () => %u", m_opaque_sp.get(), num_frames); return num_frames; } @@ -517,7 +482,7 @@ SBThread::GetFrameAtIndex (uint32_t idx) { SBStream sstr; sb_frame.GetDescription (sstr); - log->Printf ("SBThread(%p)::GetFrameAtIndex (idx=%d) => SBFrame.sp : this = %p, '%s'", + log->Printf ("SBThread(%p)::GetFrameAtIndex (idx=%d) => SBFrame(%p): %s", m_opaque_sp.get(), idx, sb_frame.get(), sstr.GetData()); } @@ -527,12 +492,8 @@ SBThread::GetFrameAtIndex (uint32_t idx) const lldb::SBThread & SBThread::operator = (const lldb::SBThread &rhs) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - log->Printf ("SBThread(%p)::operator= (rhs.sp=%p)", m_opaque_sp.get(), rhs.m_opaque_sp.get()); - - m_opaque_sp = rhs.m_opaque_sp; + if (this != &rhs) + m_opaque_sp = rhs.m_opaque_sp; return *this; } @@ -549,7 +510,7 @@ SBThread::operator != (const SBThread &rhs) const } lldb_private::Thread * -SBThread::GetLLDBObjectPtr () +SBThread::get () { return m_opaque_sp.get(); } @@ -579,20 +540,6 @@ SBThread::operator*() } bool -SBThread::GetDescription (SBStream &description) -{ - if (m_opaque_sp) - { - StreamString strm; - description.Printf("SBThread: tid = 0x%4.4x", m_opaque_sp->GetID()); - } - else - description.Printf ("No value"); - - return true; -} - -bool SBThread::GetDescription (SBStream &description) const { if (m_opaque_sp) diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 1d315f11611..7716e50491a 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -80,7 +80,7 @@ Target::Dump (Stream *s, lldb::DescriptionLevel description_level) } else { - s->Printf ("%s", GetExecutableModule()->GetFileSpec().GetFilename().GetCString()); + s->PutCString (GetExecutableModule()->GetFileSpec().GetFilename().GetCString()); } } |