diff options
author | Greg Clayton <gclayton@apple.com> | 2010-10-29 04:59:35 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2010-10-29 04:59:35 +0000 |
commit | 93aa84e83b28fd32f370ac99d15ffa49d0f116a9 (patch) | |
tree | 2d787806911b85581db69b2d4299b2ac56f0a141 | |
parent | 31575f758c4defb5bf7b54cbf0238e414ff4e3b3 (diff) | |
download | bcm5719-llvm-93aa84e83b28fd32f370ac99d15ffa49d0f116a9.tar.gz bcm5719-llvm-93aa84e83b28fd32f370ac99d15ffa49d0f116a9.zip |
Modified the lldb_private::TypeList to use a std::multimap for quicker lookup
by type ID (the most common type of type lookup).
Changed the API logging a bit to always show the objects in the OBJECT(POINTER)
format so it will be easy to locate all instances of an object or references
to it when looking at logs.
llvm-svn: 117641
-rw-r--r-- | lldb/include/lldb/API/SBFileSpec.h | 3 | ||||
-rw-r--r-- | lldb/include/lldb/API/SBListener.h | 9 | ||||
-rw-r--r-- | lldb/include/lldb/Symbol/TypeList.h | 11 | ||||
-rw-r--r-- | lldb/lldb.xcodeproj/project.pbxproj | 1 | ||||
-rw-r--r-- | lldb/source/API/SBBroadcaster.cpp | 20 | ||||
-rw-r--r-- | lldb/source/API/SBCommandInterpreter.cpp | 2 | ||||
-rw-r--r-- | lldb/source/API/SBDebugger.cpp | 36 | ||||
-rw-r--r-- | lldb/source/API/SBEvent.cpp | 30 | ||||
-rw-r--r-- | lldb/source/API/SBFileSpec.cpp | 45 | ||||
-rw-r--r-- | lldb/source/API/SBListener.cpp | 12 | ||||
-rw-r--r-- | lldb/source/API/SBProcess.cpp | 136 | ||||
-rw-r--r-- | lldb/source/API/SBTarget.cpp | 124 | ||||
-rw-r--r-- | lldb/source/API/SBThread.cpp | 38 | ||||
-rw-r--r-- | lldb/source/API/SBValue.cpp | 50 | ||||
-rw-r--r-- | lldb/source/API/SBValueList.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Core/ValueObject.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | 5 | ||||
-rw-r--r-- | lldb/source/Symbol/TypeList.cpp | 142 | ||||
-rw-r--r-- | lldb/source/Target/Target.cpp | 17 |
19 files changed, 239 insertions, 446 deletions
diff --git a/lldb/include/lldb/API/SBFileSpec.h b/lldb/include/lldb/API/SBFileSpec.h index e3c3da7000b..049ca902550 100644 --- a/lldb/include/lldb/API/SBFileSpec.h +++ b/lldb/include/lldb/API/SBFileSpec.h @@ -54,9 +54,6 @@ public: ResolvePath (const char *src_path, char *dst_path, size_t dst_len); bool - GetDescription (lldb::SBStream &description); - - bool GetDescription (lldb::SBStream &description) const; private: diff --git a/lldb/include/lldb/API/SBListener.h b/lldb/include/lldb/API/SBListener.h index 68d8a162da0..73fb94f3441 100644 --- a/lldb/include/lldb/API/SBListener.h +++ b/lldb/include/lldb/API/SBListener.h @@ -17,11 +17,6 @@ namespace lldb { class SBListener { public: - friend class SBBroadcaster; - friend class SBCommandInterpreter; - friend class SBDebugger; - friend class SBTarget; - SBListener (const char *name); SBListener (lldb_private::Listener &listener); @@ -91,6 +86,10 @@ public: HandleBroadcastEvent (const lldb::SBEvent &event); private: + friend class SBBroadcaster; + friend class SBCommandInterpreter; + friend class SBDebugger; + friend class SBTarget; #ifndef SWIG diff --git a/lldb/include/lldb/Symbol/TypeList.h b/lldb/include/lldb/Symbol/TypeList.h index fe486b99512..9dd8ef13930 100644 --- a/lldb/include/lldb/Symbol/TypeList.h +++ b/lldb/include/lldb/Symbol/TypeList.h @@ -13,7 +13,7 @@ #include "lldb/lldb-private.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/Type.h" -#include <vector> +#include <map> namespace lldb_private { @@ -40,8 +40,11 @@ public: TypeList FindTypes(const ConstString &name); - lldb::TypeSP - InsertUnique(lldb::TypeSP& type); + void + Insert (lldb::TypeSP& type); + + bool + InsertUnique (lldb::TypeSP& type); uint32_t GetSize() const; @@ -70,7 +73,7 @@ public: CreateClangRValueReferenceType (Type *type); private: - typedef std::vector<lldb::TypeSP> collection; + typedef std::multimap<lldb::user_id_t, lldb::TypeSP> collection; typedef collection::iterator iterator; typedef collection::const_iterator const_iterator; ClangASTContext m_ast; ///< The type abtract syntax tree. diff --git a/lldb/lldb.xcodeproj/project.pbxproj b/lldb/lldb.xcodeproj/project.pbxproj index fe8af9feceb..9ae6a2ecdda 100644 --- a/lldb/lldb.xcodeproj/project.pbxproj +++ b/lldb/lldb.xcodeproj/project.pbxproj @@ -2501,6 +2501,7 @@ isa = PBXProject; buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "lldb" */; compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( en, diff --git a/lldb/source/API/SBBroadcaster.cpp b/lldb/source/API/SBBroadcaster.cpp index 1b89600f8d9..ba6bc2f591f 100644 --- a/lldb/source/API/SBBroadcaster.cpp +++ b/lldb/source/API/SBBroadcaster.cpp @@ -26,7 +26,7 @@ SBBroadcaster::SBBroadcaster () : Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); if (log) - log->Printf ("SBBroadcastetr::SBBroadcaster () => this = %p", this); + log->Printf ("SBBroadcastetr::SBBroadcaster () => SBBroadcaster(%p)", this); } @@ -37,8 +37,8 @@ SBBroadcaster::SBBroadcaster (const char *name) : Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); if (log) - log->Printf ("SBBroadcaster::SBBroadcaster (name='%s') => this = %p (m_opaque = %p)", - name, this, m_opaque); + log->Printf ("SBBroadcaster::SBBroadcaster (name='%s') => SBBroadcaster(%p)", + name, m_opaque); } SBBroadcaster::SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns) : @@ -48,8 +48,8 @@ SBBroadcaster::SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns) Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); if (log) - log->Printf ("SBBroadcaster::SBBroadcaster (broadcaster=%p, bool owns='%s') " - " => this = %p (m_opaque = %p)", broadcaster, (owns ? "true" : "false"), this, m_opaque); + log->Printf ("SBBroadcaster::SBBroadcaster (broadcaster=%p, bool owns=%i) " + " => SBBroadcaster(%p)", broadcaster, owns, m_opaque); } SBBroadcaster::~SBBroadcaster() @@ -63,7 +63,7 @@ SBBroadcaster::BroadcastEventByType (uint32_t event_type, bool unique) Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBBroadcaster::BroadcastEventByType (%d, %s)", event_type, (unique ? "true" : "false")); + log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (event_type=0x%8.8x, unique=%i)", m_opaque, event_type, unique); if (m_opaque == NULL) return; @@ -77,6 +77,11 @@ SBBroadcaster::BroadcastEventByType (uint32_t event_type, bool unique) void SBBroadcaster::BroadcastEvent (const SBEvent &event, bool unique) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (SBEvent(%p), unique=%i)", m_opaque, event.get(), unique); + if (m_opaque == NULL) return; @@ -90,6 +95,9 @@ SBBroadcaster::BroadcastEvent (const SBEvent &event, bool unique) void SBBroadcaster::AddInitialEventsToListener (const SBListener &listener, uint32_t requested_events) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBroadcaster(%p)::AddInitialEventsToListener (SBListener(%p), event_mask=0x%8.8x)", m_opaque, listener.get(), requested_events); if (m_opaque) m_opaque->AddInitialEventsToListener (listener.get(), requested_events); } diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp index cb2dd7497a2..dff852ddc0a 100644 --- a/lldb/source/API/SBCommandInterpreter.cpp +++ b/lldb/source/API/SBCommandInterpreter.cpp @@ -93,7 +93,7 @@ SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnOb { SBStream sstr; result.GetDescription (sstr); - log->Printf ("SBCommandInterpreter::HandleCommand (...'%s'...) => SBCommandReturnObject: '%s'", + log->Printf ("SBCommandInterpreter::HandleCommand ('%s') => SBCommandReturnObject: '%s'", command_line, sstr.GetData()); } diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index 256cb1148bd..0987ff9c92c 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -57,7 +57,7 @@ SBDebugger::Clear () Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBDebugger::Clear ()"); + log->Printf ("SBDebugger(%p)::Clear ()", m_opaque_sp.get()); m_opaque_sp.reset(); } @@ -67,9 +67,6 @@ SBDebugger::Create() { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBDebugger::Create ()"); - SBDebugger debugger; debugger.reset(Debugger::CreateInstance()); @@ -77,7 +74,7 @@ SBDebugger::Create() { SBStream sstr; debugger.GetDescription (sstr); - log->Printf ("SBDebugger::Create () => SBDebugger (this.sp = %p, '%s')", debugger.m_opaque_sp.get(), sstr.GetData()); + log->Printf ("SBDebugger::Create () => SBDebugger(%p): %s", debugger.m_opaque_sp.get(), sstr.GetData()); } return debugger; @@ -121,7 +118,7 @@ SBDebugger::SetInputFileHandle (FILE *fh, bool transfer_ownership) Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBDebugger::SetInputFileHandle (this.sp=%p, fh=%p, transfer_ownership='%s')", m_opaque_sp.get(), + log->Printf ("SBDebugger(%p)::SetInputFileHandle (fh=%p, transfer_ownership='%s')", m_opaque_sp.get(), fh, (transfer_ownership ? "true" : "false")); if (m_opaque_sp) @@ -135,7 +132,7 @@ SBDebugger::SetOutputFileHandle (FILE *fh, bool transfer_ownership) if (log) - log->Printf ("SBDebugger::SetOutputFileHandle (this.sp=%p, fh=%p, transfer_ownership='%s')", m_opaque_sp.get(), + log->Printf ("SBDebugger(%p)::SetOutputFileHandle (fh=%p, transfer_ownership='%s')", m_opaque_sp.get(), fh, (transfer_ownership ? "true" : "false")); if (m_opaque_sp) @@ -149,7 +146,7 @@ SBDebugger::SetErrorFileHandle (FILE *fh, bool transfer_ownership) if (log) - log->Printf ("SBDebugger::SetErrorFileHandle (this.sp=%p, fh=%p, transfer_ownership='%s')", m_opaque_sp.get(), + log->Printf ("SBDebugger(%p)::SetErrorFileHandle (fh=%p, transfer_ownership='%s')", m_opaque_sp.get(), fh, (transfer_ownership ? "true" : "false")); if (m_opaque_sp) @@ -190,7 +187,7 @@ SBDebugger::GetCommandInterpreter () sb_interpreter.reset (&m_opaque_sp->GetCommandInterpreter()); if (log) - log->Printf ("SBDebugger::GetCommandInterpreter (this.sp=%p) => SBCommandInterpreter (this.obj=%p)", + log->Printf ("SBDebugger(%p)::GetCommandInterpreter () => SBCommandInterpreter(%p)", m_opaque_sp.get(), sb_interpreter.get()); return sb_interpreter; @@ -238,7 +235,7 @@ SBDebugger::GetListener () sb_listener.reset(&m_opaque_sp->GetListener(), false); if (log) - log->Printf ("SBDebugger::GetListener (this.sp=%p) => SBListener (this.obj=%p)", m_opaque_sp.get(), + log->Printf ("SBDebugger(%p)::GetListener () => SBListener(%p)", m_opaque_sp.get(), sb_listener.get()); return sb_listener; @@ -464,10 +461,6 @@ SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *archn { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBDebugger::CreateTargetWithFileAndArch (this.sp=%p, filename='%s', arcname='%s')", - // m_opaque_sp.get() filename, archname); - SBTarget target; if (m_opaque_sp) { @@ -510,8 +503,8 @@ SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *archn { SBStream sstr; target.GetDescription (sstr, lldb::eDescriptionLevelFull); - log->Printf ("SBDebugger::CreateTargetWithFileAndArch (this.sp=%p, filename='%s', arcname='%s') " - "=> SBTarget: this.sp=%p, '%s'", m_opaque_sp.get(), filename, archname, target.get(), + log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndArch (filename='%s', arcname='%s') " + "=> SBTarget(%p): %s", m_opaque_sp.get(), filename, archname, target.get(), sstr.GetData()); } @@ -609,9 +602,6 @@ SBDebugger::GetSelectedTarget () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBDebugger::GetSelectedTarget ()"); - SBTarget sb_target; if (m_opaque_sp) sb_target.reset(m_opaque_sp->GetTargetList().GetSelectedTarget ()); @@ -620,7 +610,7 @@ SBDebugger::GetSelectedTarget () { SBStream sstr; sb_target.GetDescription (sstr, lldb::eDescriptionLevelBrief); - log->Printf ("SBDebugger::GetSelectedTarget (this.sp=%p) => SBTarget: this.sp=%p, '%s'", m_opaque_sp.get(), + log->Printf ("SBDebugger(%p)::GetSelectedTarget () => SBTarget(%p): %s", m_opaque_sp.get(), sb_target.get(), sstr.GetData()); } @@ -633,7 +623,7 @@ SBDebugger::DispatchInput (void *baton, const void *data, size_t data_len) Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBDebugger::DispatchInput (this.sp=%p, baton=%p, data='%s', size_t=%d)", m_opaque_sp.get(), + log->Printf ("SBDebugger(%p)::DispatchInput (baton=%p, data='%s', size_t=%d)", m_opaque_sp.get(), baton, (const char *) data, (uint32_t) data_len); if (m_opaque_sp) @@ -646,7 +636,7 @@ SBDebugger::PushInputReader (SBInputReader &reader) Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBDebugger::PushInputReader (this.sp=%p, reader=%p)", m_opaque_sp.get(), &reader); + log->Printf ("SBDebugger(%p)::PushInputReader (SBInputReader(%p))", m_opaque_sp.get(), &reader); if (m_opaque_sp && reader.IsValid()) { @@ -753,7 +743,7 @@ SBDebugger::GetPrompt() const Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBDebugger::GetPrompt (this.sp=%p) => '%s'", m_opaque_sp.get(), + log->Printf ("SBDebugger(%p)::GetPrompt () => '%s'", m_opaque_sp.get(), (m_opaque_sp ? m_opaque_sp->GetPrompt() : "")); if (m_opaque_sp) diff --git a/lldb/source/API/SBEvent.cpp b/lldb/source/API/SBEvent.cpp index 527a7d2fb60..606cf955759 100644 --- a/lldb/source/API/SBEvent.cpp +++ b/lldb/source/API/SBEvent.cpp @@ -37,8 +37,11 @@ SBEvent::SBEvent (uint32_t event_type, const char *cstr, uint32_t cstr_len) : if (log) { - log->Printf ("SBEvent::SBEvent (event_type=%d, cstr='%s', cstr_len=%d) => this.sp = %p", event_type, - cstr, cstr_len, m_opaque); + log->Printf ("SBEvent::SBEvent (event_type=0x%8.8x, cstr='%s', cstr_len=%d) => SBEvent(%p)", + event_type, + cstr, + cstr_len, + m_opaque); } } @@ -49,7 +52,7 @@ SBEvent::SBEvent (EventSP &event_sp) : Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBEvent::SBEvent (event_sp=%p) => this.sp = %p", event_sp.get(), m_opaque); + log->Printf ("SBEvent::SBEvent (event_sp=%p) => SBEvent(%p)", event_sp.get(), m_opaque); } SBEvent::~SBEvent() @@ -70,16 +73,13 @@ SBEvent::GetType () const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBEvent::GetType ()"); - const Event *lldb_event = get(); uint32_t event_type = 0; if (lldb_event) event_type = lldb_event->GetType(); if (log) - log->Printf ("SBEvent::GetType (this.sp=%p) => %d", m_opaque, event_type); + log->Printf ("SBEvent(%p)::GetType () => 0x%8.8x", get(), event_type); return event_type; } @@ -111,17 +111,16 @@ SBEvent::BroadcasterMatchesRef (const SBBroadcaster &broadcaster) { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBEvent::BroadcasterMatchesRef (broacaster) broadcaster = %p", &broadcaster); - Event *lldb_event = get(); bool success = false; if (lldb_event) success = lldb_event->BroadcasterIs (broadcaster.get()); if (log) - log->Printf ("SBEvent::BroadcasterMathesRef (this.sp=%p, broadcaster.obj=%p) => %s", m_opaque, - broadcaster.get(), (success ? "true" : "false")); + log->Printf ("SBEvent(%p)::BroadcasterMathesRef (broadcaster.ptr=%p) => %s", + get(), + broadcaster.get(), + success ? "true" : "false"); return success; } @@ -182,7 +181,8 @@ SBEvent::GetCStringFromEvent (const SBEvent &event) Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("GetCStringFromEvent (event.sp=%p) => %s", event.m_opaque, + log->Printf ("SBEvent(%p)::GetCStringFromEvent () => '%s'", + event.get(), reinterpret_cast<const char *>(EventDataBytes::GetBytesFromEvent (event.get()))); return reinterpret_cast<const char *>(EventDataBytes::GetBytesFromEvent (event.get())); @@ -192,7 +192,7 @@ SBEvent::GetCStringFromEvent (const SBEvent &event) bool SBEvent::GetDescription (SBStream &description) { - if (m_opaque) + if (get()) { description.ref(); m_opaque->Dump (description.get()); @@ -206,7 +206,7 @@ SBEvent::GetDescription (SBStream &description) bool SBEvent::GetDescription (SBStream &description) const { - if (m_opaque) + if (get()) { description.ref(); m_opaque->Dump (description.get()); diff --git a/lldb/source/API/SBFileSpec.cpp b/lldb/source/API/SBFileSpec.cpp index a4fda531cdb..3fc6a3ad04e 100644 --- a/lldb/source/API/SBFileSpec.cpp +++ b/lldb/source/API/SBFileSpec.cpp @@ -34,7 +34,7 @@ SBFileSpec::SBFileSpec (const SBFileSpec &rhs) : { SBStream sstr; GetDescription (sstr); - log->Printf ("SBFileSpec::SBFileSpec (const SBFileSpec rhs.ap=%p) => this.ap = %p ('%s')", + log->Printf ("SBFileSpec::SBFileSpec (const SBFileSpec rhs.ap=%p) => SBFileSpec(%p) ('%s')", rhs.m_opaque_ap.get(), m_opaque_ap.get(), sstr.GetData()); } } @@ -51,8 +51,8 @@ SBFileSpec::SBFileSpec (const char *path, bool resolve) : Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFileSpec::SBFileSpec (path='%s', resolve='%s') => this.ap = %p", path, - (resolve ? "true" : "false"), m_opaque_ap.get()); + log->Printf ("SBFileSpec::SBFileSpec (path='%s', resolve=%i) => SBFileSpec(%p)", path, + resolve, m_opaque_ap.get()); } SBFileSpec::~SBFileSpec () @@ -81,15 +81,12 @@ SBFileSpec::Exists () const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBFileSpec::Exists (this.ap=%p)", m_opaque_ap.get()); - bool result = false; if (m_opaque_ap.get()) result = m_opaque_ap->Exists(); if (log) - log->Printf ("SBFileSpec::Exists (this.ap=%p) => %s", m_opaque_ap.get(), (result ? "true" : "false")); + log->Printf ("SBFileSpec(%p)::Exists () => %s", m_opaque_ap.get(), (result ? "true" : "false")); return result; } @@ -113,20 +110,17 @@ SBFileSpec::GetFilename() const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBFileSpec::GetFilename (this.ap=%p)", m_opaque_ap.get()); - if (m_opaque_ap.get()) { if (log) - log->Printf ("SBFileSpec::GetFilename (this.ap=%p) => %s", m_opaque_ap.get(), + log->Printf ("SBFileSpec(%p)::GetFilename () => %s", m_opaque_ap.get(), m_opaque_ap->GetFilename().AsCString()); return m_opaque_ap->GetFilename().AsCString(); } if (log) - log->Printf ("SBFileSpec::GetFilename (this.ap=%p) => NULL", m_opaque_ap.get()); + log->Printf ("SBFileSpec(%p)::GetFilename () => NULL", m_opaque_ap.get()); return NULL; } @@ -144,21 +138,18 @@ SBFileSpec::GetPath (char *dst_path, size_t dst_len) const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBFileSpec::GetPath (dst_path, dst_len)"); - uint32_t result; if (m_opaque_ap.get()) { result = m_opaque_ap->GetPath (dst_path, dst_len); if (log) - log->Printf ("SBFileSpec::GetPath (this.ap=%p, dst_path, dst_len) => dst_path='%s', dst_len='%d', " + log->Printf ("SBFileSpec(%p)::GetPath (dst_path, dst_len) => dst_path='%s', dst_len='%d', " "result='%d'", m_opaque_ap.get(), dst_path, (uint32_t) dst_len, result); return result; } if (log) - log->Printf ("SBFileSpec::GetPath (this.ap=%p, dst_path, dst_len) => NULL (0)", m_opaque_ap.get()); + log->Printf ("SBFileSpec(%p)::GetPath (dst_path, dst_len) => NULL (0)", m_opaque_ap.get()); if (dst_path && dst_len) *dst_path = '\0'; @@ -202,26 +193,6 @@ SBFileSpec::SetFileSpec (const lldb_private::FileSpec& fs) } bool -SBFileSpec::GetDescription (SBStream &description) -{ - if (m_opaque_ap.get()) - { - const char *filename = GetFilename(); - const char *dir_name = GetDirectory(); - if (!filename && !dir_name) - description.Printf ("No value"); - else if (!dir_name) - description.Printf ("%s", filename); - else - description.Printf ("%s/%s", dir_name, filename); - } - else - description.Printf ("No value"); - - return true; -} - -bool SBFileSpec::GetDescription (SBStream &description) const { if (m_opaque_ap.get()) diff --git a/lldb/source/API/SBListener.cpp b/lldb/source/API/SBListener.cpp index bc118e575bc..ebadd003070 100644 --- a/lldb/source/API/SBListener.cpp +++ b/lldb/source/API/SBListener.cpp @@ -87,12 +87,6 @@ SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - //{ - // log->Printf ("SBListener::StartListeningForEvents (const SBBroadcaster &broadcaster, uint32_t event_mask)" - // " &broadcaster = %p, event_mask = %d", &broadcaster, event_mask); - //} - uint32_t ret_value = 0; if (m_opaque_ptr && broadcaster.IsValid()) { @@ -100,7 +94,7 @@ SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t } if (log) - log->Printf ("SBListener::StartListeneingForEvents (this.obj=%p, broadcaster.obj=%p, event_mask=%d) => %d", + log->Printf ("SBListener(%p)::StartListeneingForEvents (SBBroadcaster(%p), event_mask=0x%8.8x) => %d", m_opaque_ptr, broadcaster.get(), event_mask, ret_value); return ret_value; @@ -142,7 +136,7 @@ SBListener::WaitForEvent (uint32_t num_seconds, SBEvent &event) event.reset (event_sp); Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBListener::WaitForEvent (this.obj=%p, num_seconds=%d, event.sp=%p) => 'true'", + log->Printf ("SBListener(%p)::WaitForEvent (num_seconds=%d, SBEvent(%p)) => 1", m_opaque_ptr, num_seconds, event.get()); return true; } @@ -150,7 +144,7 @@ SBListener::WaitForEvent (uint32_t num_seconds, SBEvent &event) Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBListener::WaitForEvent (this.obj=%p, num_seconds=%d, event.sp=%p) => 'false'", + log->Printf ("SBListener(%p)::WaitForEvent (num_seconds=%d, SBEvent(%p)) => 0", m_opaque_ptr, num_seconds, event.get()); event.reset (NULL); diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp index e485139d0b2..eb007fcfa77 100644 --- a/lldb/source/API/SBProcess.cpp +++ b/lldb/source/API/SBProcess.cpp @@ -56,7 +56,7 @@ SBProcess::SBProcess (const SBProcess& rhs) : Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBProcess::SBProcess (rhs.sp=%p) => this.sp = %p", rhs.m_opaque_sp.get(), m_opaque_sp.get()); + log->Printf ("SBProcess::SBProcess(%p)", rhs.m_opaque_sp.get()); } @@ -66,7 +66,7 @@ SBProcess::SBProcess (const lldb::ProcessSP &process_sp) : Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBProcess::SBProcess (process_sp=%p) => this.sp = %p", process_sp.get(), m_opaque_sp.get()); + log->Printf ("SBProcess::SBProcess(%p)", process_sp.get()); } //---------------------------------------------------------------------- @@ -101,9 +101,6 @@ SBProcess::GetNumThreads () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::GetNumThreads ()"); - uint32_t num_threads = 0; if (m_opaque_sp) { @@ -112,7 +109,7 @@ SBProcess::GetNumThreads () } if (log) - log->Printf ("SBProcess::GetNumThreads (this.sp=%p) => %d", m_opaque_sp.get(), num_threads); + log->Printf ("SBProcess(%p)::GetNumThreads () => %d", m_opaque_sp.get(), num_threads); return num_threads; } @@ -122,19 +119,13 @@ SBProcess::GetSelectedThread () const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::GetSelectedThread ()"); - SBThread sb_thread; if (m_opaque_sp) sb_thread.SetThread (m_opaque_sp->GetThreadList().GetSelectedThread()); if (log) { - SBStream sstr; - sb_thread.GetDescription (sstr); - log->Printf ("SBProcess::GetSelectedThread (this.sp=%p) => SBThread : this = %p, '%s'", m_opaque_sp.get(), - &sb_thread, sstr.GetData()); + log->Printf ("SBProcess(%p)::GetSelectedThread () => SBThread(%p)", m_opaque_sp.get(), sb_thread.GetLLDBObjectPtr()); } return sb_thread; @@ -145,16 +136,12 @@ SBProcess::GetTarget() const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::GetTarget ()"); - SBTarget sb_target; if (m_opaque_sp) sb_target = m_opaque_sp->GetTarget().GetSP(); if (log) - log->Printf ("SBProcess::GetTarget (this.sp=%p) => SBTarget (this.sp = %p)", m_opaque_sp.get(), - sb_target.get()); + log->Printf ("SBProcess(%p)::GetTarget () => SBTarget(%p)", m_opaque_sp.get(), sb_target.get()); return sb_target; } @@ -165,9 +152,6 @@ SBProcess::PutSTDIN (const char *src, size_t src_len) { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::PutSTDIN (%s, %d)", src, src_len); - size_t ret_val = 0; if (m_opaque_sp != NULL) { @@ -176,8 +160,11 @@ SBProcess::PutSTDIN (const char *src, size_t src_len) } if (log) - log->Printf ("SBProcess::PutSTDIN (this.sp=%p, src='%s', src_len=%d) => %d", m_opaque_sp.get(), src, - (uint32_t) src_len, ret_val); + log->Printf ("SBProcess(%p)::PutSTDIN (src='%s', src_len=%d) => %d", + m_opaque_sp.get(), + src, + (uint32_t) src_len, + ret_val); return ret_val; } @@ -187,9 +174,6 @@ SBProcess::GetSTDOUT (char *dst, size_t dst_len) const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::GetSTDOUT (char *dst, size_t dst_Len)"); - size_t ret_val = 0; if (m_opaque_sp != NULL) { @@ -198,8 +182,12 @@ SBProcess::GetSTDOUT (char *dst, size_t dst_len) const } if (log) - log->Printf ("SBProcess::GetSTDOUT (this.sp=%p, dst='%s', dst_len=%d) => %d", m_opaque_sp.get(), dst, - (uint32_t) dst_len, (uint32_t) ret_val); + log->Printf ("SBProcess(%p)::GetSTDOUT (dst='%.*s', dst_len=%d) => %d", + m_opaque_sp.get(), + (uint32_t) dst_len, + dst, + (uint32_t) dst_len, + (uint32_t) ret_val); return ret_val; } @@ -209,9 +197,6 @@ SBProcess::GetSTDERR (char *dst, size_t dst_len) const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::GetSTDERR (char *dst, size_t dst_len)"); - size_t ret_val = 0; if (m_opaque_sp != NULL) { @@ -220,8 +205,12 @@ SBProcess::GetSTDERR (char *dst, size_t dst_len) const } if (log) - log->Printf ("SBProcess::GetSTDERR (this.sp=%p, dst='%s', dst_len=%d) => %d", m_opaque_sp.get(), dst, - (uint32_t) dst_len, (uint32_t) ret_val); + log->Printf ("SBProcess(%p)::GetSTDERR (dst='%.*s', dst_len=%d) => %d", + m_opaque_sp.get(), + (uint32_t) dst_len, + dst, + (uint32_t) dst_len, + (uint32_t) ret_val); return ret_val; } @@ -277,16 +266,13 @@ SBProcess::SetSelectedThreadByID (uint32_t tid) { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::SetSelectedThreadByID (%d)", tid); - bool ret_val = false; if (m_opaque_sp != NULL) ret_val = m_opaque_sp->GetThreadList().SetSelectedThreadByID (tid); if (log) - log->Printf ("SBProcess::SetSelectedThreadByID (this.sp=%p, tid=%d) => '%s'", m_opaque_sp.get(), - tid, (ret_val ? "true" : "false")); + log->Printf ("SBProcess(%p)::SetSelectedThreadByID (tid=%d) => '%s'", + m_opaque_sp.get(), tid, (ret_val ? "true" : "false")); return ret_val; } @@ -296,19 +282,14 @@ SBProcess::GetThreadAtIndex (size_t index) { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::GetThreadAtIndex (%d)"); - SBThread thread; if (m_opaque_sp) thread.SetThread (m_opaque_sp->GetThreadList().GetThreadAtIndex(index)); if (log) { - SBStream sstr; - thread.GetDescription (sstr); - log->Printf ("SBProcess::GetThreadAtIndex (this.sp=%p, index=%d) => SBThread : this.sp = %p, '%s'", - m_opaque_sp.get(), (uint32_t) index, thread.GetLLDBObjectPtr(), sstr.GetData()); + log->Printf ("SBProcess(%p)::GetThreadAtIndex (index=%d) => SBThread(%p)", + m_opaque_sp.get(), (uint32_t) index, thread.GetLLDBObjectPtr()); } return thread; @@ -319,15 +300,13 @@ SBProcess::GetState () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::GetState ()"); - StateType ret_val = eStateInvalid; if (m_opaque_sp != NULL) ret_val = m_opaque_sp->GetState(); if (log) - log->Printf ("SBProcess::GetState (this.sp=%p) => '%s'", m_opaque_sp.get(), + log->Printf ("SBProcess(%p)::GetState () => '%s'", + m_opaque_sp.get(), lldb_private::StateAsCString (ret_val)); return ret_val; @@ -357,15 +336,12 @@ SBProcess::GetProcessID () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::GetProcessID ()"); - lldb::pid_t ret_val = LLDB_INVALID_PROCESS_ID; if (m_opaque_sp) ret_val = m_opaque_sp->GetID(); if (log) - log->Printf ("SBProcess::GetProcessID (this.sp=%p) => %d", m_opaque_sp.get(), ret_val); + log->Printf ("SBProcess(%p)::GetProcessID () => %d", m_opaque_sp.get(), ret_val); return ret_val; } @@ -375,15 +351,12 @@ SBProcess::GetAddressByteSize () const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::GetAddressByteSize()"); - uint32_t size = 0; if (m_opaque_sp) size = m_opaque_sp->GetAddressByteSize(); if (log) - log->Printf ("SBProcess::GetAddressByteSize (this.sp=%p) => %d", m_opaque_sp.get(), size); + log->Printf ("SBProcess(%p)::GetAddressByteSize () => %d", m_opaque_sp.get(), size); return size; } @@ -414,9 +387,6 @@ SBProcess::Continue () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::Continue ()"); - SBError sb_error; if (IsValid()) { @@ -435,8 +405,7 @@ SBProcess::Continue () { SBStream sstr; sb_error.GetDescription (sstr); - log->Printf ("SBProcess::Continue (this.sp=%p) => SBError (this.ap = %p, '%s')", m_opaque_sp.get(), - sb_error.get(), sstr.GetData()); + log->Printf ("SBProcess(%p)::Continue () => SBError (%p): %s", m_opaque_sp.get(), sb_error.get(), sstr.GetData()); } return sb_error; @@ -461,9 +430,6 @@ SBProcess::Stop () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::Stop ()"); - SBError sb_error; if (IsValid()) sb_error.SetError (m_opaque_sp->Halt()); @@ -474,7 +440,9 @@ SBProcess::Stop () { SBStream sstr; sb_error.GetDescription (sstr); - log->Printf ("SBProcess::Stop (this.sp=%p) => SBError (this.ap = %p, '%s')", m_opaque_sp.get(), sb_error.get(), + log->Printf ("SBProcess(%p)::Stop () => SBError (%p): %s", + m_opaque_sp.get(), + sb_error.get(), sstr.GetData()); } @@ -486,9 +454,6 @@ SBProcess::Kill () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::Kill ()"); - SBError sb_error; if (m_opaque_sp) sb_error.SetError (m_opaque_sp->Destroy()); @@ -499,7 +464,9 @@ SBProcess::Kill () { SBStream sstr; sb_error.GetDescription (sstr); - log->Printf ("SBProcess::Kill (this.sp=%p) => SBError (this.ap = %p,'%s')", m_opaque_sp.get(), sb_error.get(), + log->Printf ("SBProcess(%p)::Kill () => SBError (%p): %s", + m_opaque_sp.get(), + sb_error.get(), sstr.GetData()); } @@ -574,13 +541,6 @@ SBProcess::GetStateFromEvent (const SBEvent &event) { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - //{ - // SBStream sstr; - // event.GetDescription (sstr); - // log->Printf ("SBProcess::GetStateFromEvent (%s)", sstr.GetData()); - //} - StateType ret_val = Process::ProcessEventData::GetStateFromEvent (event.get()); if (log) @@ -609,13 +569,10 @@ SBProcess::GetBroadcaster () const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::GetBroadcaster ()"); - SBBroadcaster broadcaster(m_opaque_sp.get(), false); if (log) - log->Printf ("SBProcess::GetBroadcaster (this.sp=%p) => SBBroadcaster (this.obj = %p)", m_opaque_sp.get(), + log->Printf ("SBProcess(%p)::GetBroadcaster () => SBBroadcaster (%p)", m_opaque_sp.get(), broadcaster.get()); return broadcaster; @@ -632,9 +589,6 @@ SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::ReadMemory (%p, %p, %d, sb_error)", addr, dst, dst_len); - size_t bytes_read = 0; if (IsValid()) @@ -649,8 +603,18 @@ SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error } if (log) - log->Printf ("SBProcess::ReadMemory (this.sp=%p, addr=%p, dst=%p, dst_len=%d, sb_error.ap=%p) => %d", - m_opaque_sp.get(), addr, dst, (uint32_t) dst_len, sb_error.get(), (uint32_t) bytes_read); + { + SBStream sstr; + sb_error.GetDescription (sstr); + log->Printf ("SBProcess(%p)::ReadMemory (addr=%llx, dst=%p, dst_len=%d, SBError (%p): %s) => %d", + m_opaque_sp.get(), + addr, + dst, + (uint32_t) dst_len, + sb_error.get(), + sstr.GetData(), + (uint32_t) bytes_read); + } return bytes_read; } diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index 9705ebcaa12..24c78f4294b 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -60,8 +60,12 @@ SBTarget::SBTarget (const SBTarget& rhs) : Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBTarget::SBTarget (rhs.sp=%p) => this.sp = %p", - rhs.m_opaque_sp.get(), m_opaque_sp.get()); + { + 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) : @@ -73,7 +77,7 @@ SBTarget::SBTarget(const TargetSP& target_sp) : { SBStream sstr; GetDescription (sstr, lldb::eDescriptionLevelBrief); - log->Printf ("SBTarget::SBTarget (target_sp=%p) => this.sp = %p ('%s')", + log->Printf ("SBTarget::SBTarget (target_sp=%p) => SBTarget(%p): '%s'", target_sp.get(), m_opaque_sp.get(), sstr.GetData()); } } @@ -84,16 +88,13 @@ SBTarget::Assign (const SBTarget& rhs) Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBTarget::Assign (this.sp=%p, rhs.sp=%p)", m_opaque_sp.get(), rhs.m_opaque_sp.get()); + 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; } - //if (log) - // log->Printf ("SBTarget::Assign => SBTarget (this = %p, m_opaque_sp.get() = %p)", this, m_opaque_sp.get()); - return *this; } @@ -116,9 +117,6 @@ SBTarget::GetProcess () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::GetProcess ()"); - SBProcess sb_process; if (m_opaque_sp) sb_process.SetProcess (m_opaque_sp->GetProcessSP()); @@ -127,7 +125,7 @@ SBTarget::GetProcess () { SBStream sstr; sb_process.GetDescription (sstr); - log->Printf ("SBTarget::GetProcess (this.sp=%p) => SBProcess : this.sp = %p, '%s'", m_opaque_sp.get(), + log->Printf ("SBTarget(%p)::GetProcess () => SBProcess(%p): %s", m_opaque_sp.get(), sb_process.get(), sstr.GetData()); } @@ -150,9 +148,6 @@ SBTarget::CreateProcess () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::CreateProcess ()"); - SBProcess sb_process; if (m_opaque_sp) @@ -162,7 +157,7 @@ SBTarget::CreateProcess () { SBStream sstr; sb_process.GetDescription (sstr); - log->Printf ("SBTarget::CreateProcess (this.sp=%p) => SBProcess this.sp = %p, '%s'", m_opaque_sp.get(), + log->Printf ("SBTarget(%p)::CreateProcess () => SBProcess(%p): %s", m_opaque_sp.get(), sb_process.get(), sstr.GetData()); } @@ -183,9 +178,8 @@ SBTarget::LaunchProcess Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBTarget::LaunchProcess (this.sp=%p, argv=%p, envp=%p, tty='%s', launch_flags=%d, " - "stop_at_entry='%s')", - m_opaque_sp.get(), argv, envp, tty, launch_flags, (stop_at_entry ? "true" : "false")); + 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; SBProcess sb_process = Launch (argv, envp, tty, launch_flags, stop_at_entry, sb_error); @@ -194,8 +188,8 @@ SBTarget::LaunchProcess { SBStream sstr; sb_process.GetDescription (sstr); - log->Printf ("SBTarget::LaunchProcess (this.sp=%p, ...) => SBProcess : this.sp = %p, '%s'", m_opaque_sp.get(), - sb_process.get(), sstr.GetData()); + log->Printf ("SBTarget(%p)::LaunchProcess (...) => SBProcess(%p): %s", + m_opaque_sp.get(), sb_process.get(), sstr.GetData()); } return sb_process; @@ -215,11 +209,10 @@ SBTarget::Launch Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBTarget::Launch (this.sp=%p, argv=%p, envp=%p, tty='%s', launch_flags=%d, stop_at_entry=%s, " - "error.ap=%p)", - m_opaque_sp.get(), argv, envp, tty, launch_flags, (stop_at_entry ? "true" : "false"), - error.get()); - + { + 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; if (m_opaque_sp) { @@ -274,8 +267,8 @@ SBTarget::Launch { SBStream sstr; sb_process.GetDescription (sstr); - log->Printf ("SBTarget::Launch (this.sp=%p, ...) => SBProceess : this.sp = %p, '%s'", m_opaque_sp.get(), - sb_process.get(), sstr.GetData()); + log->Printf ("SBTarget(%p)::Launch (...) => SBProceess(%p): %s", + m_opaque_sp.get(), sb_process.get(), sstr.GetData()); } return sb_process; @@ -366,9 +359,6 @@ SBTarget::GetExecutable () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::GetExecutable ()"); - SBFileSpec exe_file_spec; if (m_opaque_sp) { @@ -383,11 +373,11 @@ SBTarget::GetExecutable () { SBStream sstr; exe_file_spec.GetDescription (sstr); - log->Printf ("SBTarget::GetExecutable (this.sp=%p) => SBFileSpec (this.ap = %p, '%s')", m_opaque_sp.get(), + log->Printf ("SBTarget(%p)::GetExecutable () => SBFileSpec(%p): %s", m_opaque_sp.get(), exe_file_spec.get(), sstr.GetData()); } else - log->Printf ("SBTarget::GetExecutable (this.sp=%p) => SBFileSpec (this.ap = %p, 'Unable to find valid file')", + log->Printf ("SBTarget(%p)::GetExecutable () => SBFileSpec (%p): Unable to find valid file", m_opaque_sp.get(), exe_file_spec.get()); } @@ -439,10 +429,6 @@ SBTarget::BreakpointCreateByLocation (const char *file, uint32_t line) { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::BreakpointCreateByLocation (const char *file, uint32_t line) file = '%s', line = %d", - // file, line); - SBBreakpoint sb_bp; if (file != NULL && line != 0) sb_bp = BreakpointCreateByLocation (SBFileSpec (file), line); @@ -451,8 +437,7 @@ SBTarget::BreakpointCreateByLocation (const char *file, uint32_t line) { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf("SBTarget::BreakpointCreateByLocation (this.sp=%p, file='%s', line=%d) => " - "SBBreakpoint : this.sp = %p, '%s'", m_opaque_sp.get(), file, line, sb_bp.get(), sstr.GetData()); + 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; @@ -463,10 +448,6 @@ SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, uint32_t l { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, uint32_t line) " - // "sb_file_spec (%p), line = %d)", &sb_file_spec, line); - SBBreakpoint sb_bp; if (m_opaque_sp.get() && line != 0) *sb_bp = m_opaque_sp->CreateBreakpoint (NULL, *sb_file_spec, line, true, false); @@ -475,8 +456,8 @@ SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, uint32_t l { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf ("SBTarget::BreakpointCreateByLocation (this.sp=%p, sb_file_spec.ap=%p, line=%d) => " - "SBBreakpoint : this.sp = %p, '%s'", m_opaque_sp.get(), sb_file_spec.get(), line, sb_bp.get(), + 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(), sstr.GetData()); } @@ -488,10 +469,6 @@ SBTarget::BreakpointCreateByName (const char *symbol_name, const char *module_na { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::BreakpointCreateByName (const char *symbol_name, const char *module_name) " - // "symbol_name = %s, module_name = %s)", symbol_name, module_name); - SBBreakpoint sb_bp; if (m_opaque_sp.get() && symbol_name && symbol_name[0]) { @@ -510,8 +487,8 @@ SBTarget::BreakpointCreateByName (const char *symbol_name, const char *module_na { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf ("SBTarget::BreakpointCreateByName (this.sp=%p, symbol_name='%s', module_name='%s') => " - "SBBreakpoint : this.sp = %p, '%s'", m_opaque_sp.get(), symbol_name, module_name, sb_bp.get(), + log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol_name='%s', module_name='%s') => " + "SBBreakpoint(%p): %s", m_opaque_sp.get(), symbol_name, module_name, sb_bp.get(), sstr.GetData()); } @@ -523,10 +500,6 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *mo { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name) " - // "symbol_name_regex = %s, module_name = %s)", symbol_name_regex, module_name); - SBBreakpoint sb_bp; if (m_opaque_sp.get() && symbol_name_regex && symbol_name_regex[0]) { @@ -548,8 +521,8 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *mo { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf ("SBTarget::BreakpointCreateByRegex (this.sp=%p, symbol_name_regex='%s', module_name='%s') " - "=> SBBreakpoint : this.sp = %p, '%s'", m_opaque_sp.get(), symbol_name_regex, module_name, + log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_name_regex='%s', module_name='%s') " + "=> SBBreakpoint(%p): %s", m_opaque_sp.get(), symbol_name_regex, module_name, sb_bp.get(), sstr.GetData()); } @@ -563,9 +536,6 @@ SBTarget::BreakpointCreateByAddress (addr_t address) { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::BreakpointCreateByAddress (addr_t address) address = %p", address); - SBBreakpoint sb_bp; if (m_opaque_sp.get()) *sb_bp = m_opaque_sp->CreateBreakpoint (address, false); @@ -574,8 +544,8 @@ SBTarget::BreakpointCreateByAddress (addr_t address) { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf ("SBTarget::BreakpointCreateByAddress (this.sp=%p, address=%p) => " - "SBBreakpoint : this.sp = %p, '%s')", m_opaque_sp.get(), address, sb_bp.get(), sstr.GetData()); + log->Printf ("SBTarget(%p)::BreakpointCreateByAddress (%p, address=%p) => " + "SBBreakpoint(%p): %s", m_opaque_sp.get(), address, sb_bp.get(), sstr.GetData()); } return sb_bp; @@ -586,9 +556,6 @@ SBTarget::FindBreakpointByID (break_id_t bp_id) { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::FindBreakpointByID (break_id_t bp_id) bp_id = %d", bp_id); - SBBreakpoint sb_breakpoint; if (m_opaque_sp && bp_id != LLDB_INVALID_BREAK_ID) *sb_breakpoint = m_opaque_sp->GetBreakpointByID (bp_id); @@ -597,7 +564,7 @@ SBTarget::FindBreakpointByID (break_id_t bp_id) { SBStream sstr; sb_breakpoint.GetDescription (sstr); - log->Printf ("SBTarget::FindBreakpointByID (this.sp=%p, bp_id=%d) => SBBreakpoint : this.sp = %p, '%s'", + log->Printf ("SBTarget(%p)::FindBreakpointByID (bp_id=%d) => SBBreakpoint(%p): %s", m_opaque_sp.get(), (uint32_t) bp_id, sb_breakpoint.get(), sstr.GetData()); } @@ -626,21 +593,13 @@ SBTarget::BreakpointDelete (break_id_t bp_id) { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::BreakpointDelete (break_id_t bp_id) bp_id = %d", bp_id); - bool result = false; if (m_opaque_sp) result = m_opaque_sp->RemoveBreakpointByID (bp_id); if (log) { - if (result) - log->Printf ("SBTarget::BreakpointDelete (this.sp=%p, bp_id=%d) => 'true'", m_opaque_sp.get(), - (uint32_t) bp_id); - else - log->Printf ("SBTarget::BreakpointDelete (this.sp=%p, bp_id=%d) => 'false'", m_opaque_sp.get(), - (uint32_t) bp_id); + log->Printf ("SBTarget(%p)::BreakpointDelete (bp_id=%d) => %i", m_opaque_sp.get(), (uint32_t) bp_id, result); } return result; @@ -685,15 +644,12 @@ SBTarget::GetNumModules () const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::GetNumModules ()"); - uint32_t num = 0; if (m_opaque_sp) num = m_opaque_sp->GetImages().GetSize(); if (log) - log->Printf ("SBTarget::GetNumModules (this.sp=%p) => %d", m_opaque_sp.get(), num); + log->Printf ("SBTarget(%p)::GetNumModules () => %d", m_opaque_sp.get(), num); return num; } @@ -704,7 +660,7 @@ SBTarget::Clear () Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBTarget::Clear (this.sp=%p)", m_opaque_sp.get()); + log->Printf ("SBTarget(%p)::Clear ()", m_opaque_sp.get()); m_opaque_sp.reset(); } @@ -724,9 +680,6 @@ SBTarget::GetModuleAtIndex (uint32_t idx) { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::GetModuleAtIndex (uint32_t idx) idx = %d", idx); - SBModule sb_module; if (m_opaque_sp) sb_module.SetModule(m_opaque_sp->GetImages().GetModuleAtIndex(idx)); @@ -735,7 +688,7 @@ SBTarget::GetModuleAtIndex (uint32_t idx) { SBStream sstr; sb_module.GetDescription (sstr); - log->Printf ("SBTarget::GetModuleAtIndex (this.sp=%p, idx=%d) => SBModule: this = %p, '%s'", + log->Printf ("SBTarget(%p)::GetModuleAtIndex (idx=%d) => SBModule(%p): %s", m_opaque_sp.get(), idx, sb_module.get(), sstr.GetData()); } @@ -748,13 +701,10 @@ SBTarget::GetBroadcaster () const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::GetBroadcaster ()"); - SBBroadcaster broadcaster(m_opaque_sp.get(), false); if (log) - log->Printf ("SBTarget::GetBroadcaster (this.sp=%p) => SBBroadcaster (this.obj = %p)", + log->Printf ("SBTarget(%p)::GetBroadcaster () => SBBroadcaster(%p)", m_opaque_sp.get(), broadcaster.get()); return broadcaster; diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp index ed34dc65c54..810b114045c 100644 --- a/lldb/source/API/SBThread.cpp +++ b/lldb/source/API/SBThread.cpp @@ -55,7 +55,7 @@ SBThread::SBThread (const ThreadSP& lldb_object_sp) : { SBStream sstr; GetDescription (sstr); - log->Printf ("SBThread::SBThread (lldb_object_sp=%p) => this.sp = %p (%s)", + log->Printf ("SBThread::SBThread (lldb_object_sp=%p) => SBThread(%p) :%s", lldb_object_sp.get(), m_opaque_sp.get(), sstr.GetData()); } } @@ -67,7 +67,7 @@ SBThread::SBThread (const SBThread &rhs) m_opaque_sp = rhs.m_opaque_sp; if (log) - log->Printf ("SBThread::SBThread (rhs.sp=%p) => this.sp = %p", + log->Printf ("SBThread::SBThread (rhs.sp=%p) => SBThread(%p)", rhs.m_opaque_sp.get(), m_opaque_sp.get()); } @@ -97,9 +97,6 @@ SBThread::GetStopReason() { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBThread::GetStopReason ()"); - StopReason reason = eStopReasonInvalid; if (m_opaque_sp) { @@ -109,7 +106,7 @@ SBThread::GetStopReason() } if (log) - log->Printf ("SBThread::GetStopReason (this.sp=%p) => '%s'", m_opaque_sp.get(), + log->Printf ("SBThread(%p)::GetStopReason () => '%s'", m_opaque_sp.get(), Thread::StopReasonAsCString (reason)); return reason; @@ -120,9 +117,6 @@ SBThread::GetStopDescription (char *dst, size_t dst_len) { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBThread::GetStopDescription (char *dst, size_t dst_len)"); - if (m_opaque_sp) { StopInfoSP stop_info_sp = m_opaque_sp->GetStopInfo (); @@ -132,7 +126,7 @@ SBThread::GetStopDescription (char *dst, size_t dst_len) if (stop_desc) { if (log) - log->Printf ("SBThread::GetStopDescription (this.sp=%p, 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); @@ -199,7 +193,7 @@ SBThread::GetStopDescription (char *dst, size_t dst_len) if (stop_desc && stop_desc[0]) { if (log) - log->Printf ("SBThread::GetStopDescription (this.sp=%p, dst, dst_len) => '%s'", + log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => '%s'", m_opaque_sp.get(), stop_desc); if (dst) @@ -300,7 +294,7 @@ SBThread::StepOver (lldb::RunMode stop_other_threads) Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::StepOver (this.sp=%p, stop_other_threads='%s')", m_opaque_sp.get(), + log->Printf ("SBThread(%p)::StepOver (stop_other_threads='%s')", m_opaque_sp.get(), Thread::RunModeAsCString (stop_other_threads)); if (m_opaque_sp) @@ -349,7 +343,7 @@ SBThread::StepInto (lldb::RunMode stop_other_threads) Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::StepInto (this.sp=%p, stop_other_threads='%s')", m_opaque_sp.get(), + log->Printf ("SBThread(%p)::StepInto (stop_other_threads='%s')", m_opaque_sp.get(), Thread::RunModeAsCString (stop_other_threads)); if (m_opaque_sp) @@ -424,8 +418,7 @@ SBThread::StepInstruction (bool step_over) Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::StepInstruction (this.sp=%p, step_over=%s)", m_opaque_sp.get(), - (step_over ? "true" : "false")); + log->Printf ("SBThread(%p)::StepInstruction (step_over=%i)", m_opaque_sp.get(), step_over); if (m_opaque_sp) { @@ -449,7 +442,7 @@ SBThread::RunToAddress (lldb::addr_t addr) Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::RunToAddress (this.sp=%p, addr=%p)", m_opaque_sp.get(), addr); + log->Printf ("SBThread(%p)::RunToAddress (addr=0x%llx)", m_opaque_sp.get(), addr); if (m_opaque_sp) { @@ -478,9 +471,6 @@ SBThread::GetProcess () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBThread::GetProcess ()"); - SBProcess process; if (m_opaque_sp) { @@ -504,9 +494,6 @@ SBThread::GetNumFrames () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBThread::GetNumFrames ()"); - uint32_t num_frames = 0; if (m_opaque_sp) num_frames = m_opaque_sp->GetStackFrameCount(); @@ -522,9 +509,6 @@ SBThread::GetFrameAtIndex (uint32_t idx) { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBThread::GetFrameAtIndex (uint32_t idx) idx = %d", idx); - SBFrame sb_frame; if (m_opaque_sp) sb_frame.SetFrame (m_opaque_sp->GetStackFrameAtIndex (idx)); @@ -533,7 +517,7 @@ SBThread::GetFrameAtIndex (uint32_t idx) { SBStream sstr; sb_frame.GetDescription (sstr); - log->Printf ("SBThread::GetFrameAtIndex (this.sp=%p, idx=%d) => SBFrame.sp : this = %p, '%s'", + log->Printf ("SBThread(%p)::GetFrameAtIndex (idx=%d) => SBFrame.sp : this = %p, '%s'", m_opaque_sp.get(), idx, sb_frame.get(), sstr.GetData()); } @@ -546,7 +530,7 @@ SBThread::operator = (const lldb::SBThread &rhs) Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::operator= (this.sp=%p, rhs.sp=%p)", m_opaque_sp.get(), rhs.m_opaque_sp.get()); + log->Printf ("SBThread(%p)::operator= (rhs.sp=%p)", m_opaque_sp.get(), rhs.m_opaque_sp.get()); m_opaque_sp = rhs.m_opaque_sp; return *this; diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp index ac818234389..e5476ff277c 100644 --- a/lldb/source/API/SBValue.cpp +++ b/lldb/source/API/SBValue.cpp @@ -48,8 +48,7 @@ SBValue::SBValue (const lldb::ValueObjectSP &value_sp) : { SBStream sstr; GetDescription (sstr); - log->Printf ("SBValue::SBValue (value_sp=%p) => this.sp = %p (%s)", - value_sp.get(), m_opaque_sp.get(), sstr.GetData()); + log->Printf ("SBValue::SBValue (%p) => (%s)", m_opaque_sp.get(), sstr.GetData()); } } @@ -79,23 +78,15 @@ SBValue::GetName() { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBValue::GetName ()"); + if (log) + log->Printf ("SBValue::GetName () ptr=%p => '%s'", + m_opaque_sp.get(), + m_opaque_sp ? m_opaque_sp->GetName().AsCString() : "<invalid>"); if (IsValid()) - { - if (log) - log->Printf ("SBValue::GetName (this.sp=%p) => '%s'", m_opaque_sp.get(), - m_opaque_sp->GetName().AsCString()); + return m_opaque_sp->GetName().GetCString(); - return m_opaque_sp->GetName().AsCString(); - } - else - { - if (log) - log->Printf ("SBValue::GetName (this.sp=%p) ==> NULL", m_opaque_sp.get()); - return NULL; - } + return NULL; } const char * @@ -319,18 +310,21 @@ SBValue::GetDescription (SBStream &description) { if (m_opaque_sp) { - const char *name = GetName(); - const char *type_name = GetTypeName (); - size_t byte_size = GetByteSize (); - uint32_t num_children = GetNumChildren (); - bool is_stale = ValueIsStale (); - description.Printf ("name: '%s', type: %s, size: %d", (name != NULL ? name : "<unknown name>"), - (type_name != NULL ? type_name : "<unknown type name>"), (int) byte_size); - if (num_children > 0) - description.Printf (", num_children: %d", num_children); - - if (is_stale) - description.Printf (" [value is stale]"); + // Don't call all these APIs and cause more logging! +// const char *name = GetName(); +// const char *type_name = GetTypeName (); +// size_t byte_size = GetByteSize (); +// uint32_t num_children = GetNumChildren (); +// bool is_stale = ValueIsStale (); +// description.Printf ("name: '%s', type: %s, size: %d", (name != NULL ? name : "<unknown name>"), +// (type_name != NULL ? type_name : "<unknown type name>"), (int) byte_size); +// if (num_children > 0) +// description.Printf (", num_children: %d", num_children); +// +// if (is_stale) +// description.Printf (" [value is stale]"); + + description.Printf ("name: '%s'", m_opaque_sp->GetName().GetCString()); } else description.Printf ("No value"); diff --git a/lldb/source/API/SBValueList.cpp b/lldb/source/API/SBValueList.cpp index bf59e99d89e..9f911b757e3 100644 --- a/lldb/source/API/SBValueList.cpp +++ b/lldb/source/API/SBValueList.cpp @@ -158,7 +158,7 @@ SBValueList::GetValueAtIndex (uint32_t idx) const SBStream sstr; sb_value.GetDescription (sstr); log->Printf ("SBValueList::GetValueAtIndex (this.ap=%p, idx=%d) => SBValue (this.sp = %p, '%s')", - m_opaque_ap.get(), sb_value.get(), sstr.GetData()); + m_opaque_ap.get(), idx, sb_value.get(), sstr.GetData()); } return sb_value; diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index d10bf064c08..1c11ee19dd2 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -1094,7 +1094,7 @@ ValueObject::DumpValueObject else { if (print_valobj) - s.PutCString(" {\n"); + s.PutCString(is_ref ? ": {\n" : " {\n"); s.IndentMore(); } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 8b6f4097ec4..3c996bd04fd 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -3327,12 +3327,11 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, if (type_sp.unique()) { // We are ready to put this type into the uniqued list up at the module level - TypeSP uniqued_type_sp(m_obj_file->GetModule()->GetTypeList()->InsertUnique(type_sp)); + m_obj_file->GetModule()->GetTypeList()->Insert (type_sp); if (m_debug_map_symfile) - m_debug_map_symfile->GetObjectFile()->GetModule()->GetTypeList()->InsertUnique (uniqued_type_sp); + m_debug_map_symfile->GetObjectFile()->GetModule()->GetTypeList()->Insert (type_sp); - type_sp = uniqued_type_sp; m_die_to_type[die] = type_sp.get(); } } diff --git a/lldb/source/Symbol/TypeList.cpp b/lldb/source/Symbol/TypeList.cpp index f473e7044aa..be22f592ed4 100644 --- a/lldb/source/Symbol/TypeList.cpp +++ b/lldb/source/Symbol/TypeList.cpp @@ -52,82 +52,31 @@ TypeList::~TypeList() { } -//---------------------------------------------------------------------- -// Add a base type to the type list -//---------------------------------------------------------------------- +void +TypeList::Insert (TypeSP& type_sp) +{ + // Just push each type on the back for now. We will worry about uniquing later + if (type_sp) + m_types.insert(std::make_pair(type_sp->GetID(), type_sp)); +} -//struct CampareDCTypeBaton -//{ -// CampareDCTypeBaton(const std::vector<TypeSP>& _types, const Type* _search_type) : -// types(_types), -// search_type(_search_type) -// { -// } -// const std::vector<TypeSP>& types; -// const Type* search_type; -//}; -// -//static int -//compare_dc_type (const void *key, const void *arrmem) -//{ -// const Type* search_type = ((CampareDCTypeBaton*) key)->search_type; -// uint32_t curr_index = *(uint32_t *)arrmem; -// const Type* curr_type = ((CampareDCTypeBaton*) key)->types[curr_index].get(); -// Type::CompareState state; -// return Type::Compare(*search_type, *curr_type, state); -//} -// -//struct LessThanBinaryPredicate -//{ -// LessThanBinaryPredicate(const CampareDCTypeBaton& _compare_baton) : -// compare_baton(_compare_baton) -// { -// } -// -// bool operator() (uint32_t a, uint32_t b) const -// { -// Type::CompareState state; -// return Type::Compare(*compare_baton.search_type, *compare_baton.types[b].get(), state) < 0; -// } -// const CampareDCTypeBaton& compare_baton; -//}; -TypeSP -TypeList::InsertUnique(TypeSP& type_sp) +bool +TypeList::InsertUnique (TypeSP& type_sp) { -#if 0 -// Stream s(stdout); -// s << "TypeList::InsertUnique for type "; -// type_sp->Dump(s); -// s << "Current list:\n"; -// Dump(s); - - CampareDCTypeBaton compare_baton(m_types, type_sp.get()); - uint32_t* match_index_ptr = (uint32_t*)bsearch(&compare_baton, &m_sorted_indexes[0], m_sorted_indexes.size(), sizeof(uint32_t), compare_dc_type); - if (match_index_ptr) + if (type_sp) { -// s << "returning existing type: " << (void *)m_types[*match_index_ptr].get() << "\n"; - return m_types[*match_index_ptr]; + user_id_t type_uid = type_sp->GetID(); + iterator pos, end = m_types.end(); + + for (pos = m_types.find(type_uid); pos != end && pos->second->GetID() == type_uid; ++pos) + { + if (pos->second.get() == type_sp.get()) + return false; + } } - - // Get the new index within the m_types array before we add the new type - uint32_t uniqued_type_index = m_types.size(); - // Add the new shared pointer to our type by appending it to the end of the types array - m_types.push_back(type_sp); - // Figure out what the sorted index of this new type should be - uint32_t fake_index = 0; - LessThanBinaryPredicate compare_func_obj(compare_baton); - std::vector<uint32_t>::iterator insert_pos = std::upper_bound(m_sorted_indexes.begin(), m_sorted_indexes.end(), fake_index, compare_func_obj); - // Insert the sorted index into our sorted index array - m_sorted_indexes.insert(insert_pos, uniqued_type_index); -#else - // Just push each type on the back for now. We will worry about uniquing later - m_types.push_back (type_sp); -#endif -// s << "New list:\n"; -// Dump(s); - - return type_sp; + Insert (type_sp); + return true; } //---------------------------------------------------------------------- @@ -136,26 +85,25 @@ TypeList::InsertUnique(TypeSP& type_sp) TypeSP TypeList::FindType(lldb::user_id_t uid) { - TypeSP type_sp; - iterator pos, end; - for (pos = m_types.begin(), end = m_types.end(); pos != end; ++pos) - if ((*pos)->GetID() == uid) - return *pos; - - return type_sp; + iterator pos = m_types.find(uid); + if (pos != m_types.end()) + return pos->second; + return TypeSP(); } //---------------------------------------------------------------------- // Find a type by name. //---------------------------------------------------------------------- TypeList -TypeList::FindTypes(const ConstString &name) +TypeList::FindTypes (const ConstString &name) { + // Do we ever need to make a lookup by name map? Here we are doing + // a linear search which isn't going to be fast. TypeList types(m_ast.getTargetInfo()->getTriple().getTriple().c_str()); iterator pos, end; for (pos = m_types.begin(), end = m_types.end(); pos != end; ++pos) - if ((*pos)->GetName() == name) - types.InsertUnique(*pos); + if (pos->second->GetName() == name) + types.Insert (pos->second); return types; } @@ -171,33 +119,31 @@ TypeList::GetSize() const return m_types.size(); } +// GetTypeAtIndex isn't used a lot for large type lists, currently only for +// type lists that are returned for "image dump -t TYPENAME" commands and other +// simple symbol queries that grab the first result... + TypeSP TypeList::GetTypeAtIndex(uint32_t idx) { - TypeSP type_sp; - if (idx < m_types.size()) - type_sp = m_types[idx]; - return type_sp; + iterator pos, end; + uint32_t i = idx; + for (pos = m_types.begin(), end = m_types.end(); pos != end; ++pos) + { + if (i == 0) + return pos->second; + --i; + } + return TypeSP(); } void TypeList::Dump(Stream *s, bool show_context) { -// std::vector<uint32_t>::const_iterator pos, end; -// for (pos = end = m_sorted_indexes.begin(), end = m_sorted_indexes.end(); pos != end; ++pos) -// { -// m_types[*pos]->Dump(s, show_context); -// } - - m_ast.getASTContext()->getTranslationUnitDecl()->print(llvm::fouts(), 0); - const size_t num_types = m_types.size(); - for (size_t i=0; i<num_types; ++i) + for (iterator pos = m_types.begin(), end = m_types.end(); pos != end; ++pos) { - m_types[i]->Dump(s, show_context); + pos->second->Dump(s, show_context); } -// ASTContext *ast_context = GetClangASTContext ().getASTContext(); -// if (ast_context) -// ast_context->PrintStats(); } diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index e8ed69d2834..1d315f11611 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -73,22 +73,15 @@ Target::Dump (Stream *s, lldb::DescriptionLevel description_level) s->Indent(); s->PutCString("Target\n"); s->IndentMore(); - m_images.Dump(s); - m_breakpoint_list.Dump(s); - m_internal_breakpoint_list.Dump(s); + m_images.Dump(s); + m_breakpoint_list.Dump(s); + m_internal_breakpoint_list.Dump(s); + s->IndentLess(); } else { - char path[PATH_MAX]; - int path_len = PATH_MAX; - if (GetExecutableModule()->GetFileSpec().GetPath (path, path_len)) - s->Printf ("Target: %s\n", path); - else - s->Printf ("Target: <unknown>\n"); + s->Printf ("%s", GetExecutableModule()->GetFileSpec().GetFilename().GetCString()); } -// if (m_process_sp.get()) -// m_process_sp->Dump(s); - s->IndentLess(); } void |