diff options
author | Greg Clayton <gclayton@apple.com> | 2010-10-31 03:01:06 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2010-10-31 03:01:06 +0000 |
commit | cfd1aced7ea66eda9b23c227cdd76a2289150a13 (patch) | |
tree | 24d18ab977aac38caf781ac1f53b7bdb42a3c4d0 /lldb/source/API/SBFileSpec.cpp | |
parent | a5df61a341ab35738a2788f222bd9799a060e2ea (diff) | |
download | llvm-cfd1aced7ea66eda9b23c227cdd76a2289150a13.zip llvm-cfd1aced7ea66eda9b23c227cdd76a2289150a13.tar.gz llvm-cfd1aced7ea66eda9b23c227cdd76a2289150a13.tar.bz2 |
Cleaned up the API logging a lot more to reduce redundant information and
keep the file size a bit smaller.
Exposed SBValue::GetExpressionPath() so SBValue users can get an expression
path for their values.
llvm-svn: 117851
Diffstat (limited to 'lldb/source/API/SBFileSpec.cpp')
-rw-r--r-- | lldb/source/API/SBFileSpec.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/lldb/source/API/SBFileSpec.cpp b/lldb/source/API/SBFileSpec.cpp index 9aa3f8a..fc22340 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) => SBFileSpec(%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,7 +51,7 @@ SBFileSpec::SBFileSpec (const char *path, bool resolve) : Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFileSpec::SBFileSpec (path='%s', resolve=%i) => SBFileSpec(%p)", path, + log->Printf ("SBFileSpec::SBFileSpec (path=\"%s\", resolve=%i) => SBFileSpec(%p)", path, resolve, m_opaque_ap.get()); } @@ -114,7 +114,12 @@ SBFileSpec::GetFilename() const Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFileSpec(%p)::GetFilename () => \"%s\"", m_opaque_ap.get(), s ? s : ""); + { + if (s) + log->Printf ("SBFileSpec(%p)::GetFilename () => \"%s\"", m_opaque_ap.get(), s); + else + log->Printf ("SBFileSpec(%p)::GetFilename () => NULL", m_opaque_ap.get()); + } return s; } @@ -127,7 +132,12 @@ SBFileSpec::GetDirectory() const 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 : ""); + { + if (s) + log->Printf ("SBFileSpec(%p)::GetDirectory () => \"%s\"", m_opaque_ap.get(), s); + else + log->Printf ("SBFileSpec(%p)::GetDirectory () => NULL", m_opaque_ap.get()); + } return s; } @@ -136,22 +146,17 @@ SBFileSpec::GetPath (char *dst_path, size_t dst_len) const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - uint32_t result; + uint32_t result = 0; if (m_opaque_ap.get()) - { result = m_opaque_ap->GetPath (dst_path, dst_len); - if (log) - 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(%p)::GetPath (dst_path, dst_len) => NULL (0)", m_opaque_ap.get()); + log->Printf ("SBFileSpec(%p)::GetPath (dst_path=\"%.*s\", dst_len=%zu) => %u", + m_opaque_ap.get(), result, dst_path, dst_len, result); - if (dst_path && dst_len) + if (result == 0 && dst_path && dst_len > 0) *dst_path = '\0'; - return 0; + return result; } @@ -195,14 +200,9 @@ SBFileSpec::GetDescription (SBStream &description) const { 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); + char path[PATH_MAX]; + if (m_opaque_ap->GetPath(path, sizeof(path))) + description.Printf ("%s", path); } else description.Printf ("No value"); |