diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-03-07 22:47:13 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-03-07 22:47:13 +0000 |
commit | 581af8b09da31fc304f0c297526427c6bca3de14 (patch) | |
tree | 184339f41afce1f3f515bd1e2f7f450b7ede191d /lldb/source/API/SBFileSpec.cpp | |
parent | d672e533d5cbd37c7a5f623565ece47167dec411 (diff) | |
download | bcm5719-llvm-581af8b09da31fc304f0c297526427c6bca3de14.tar.gz bcm5719-llvm-581af8b09da31fc304f0c297526427c6bca3de14.zip |
[SBAPI] Log from record macro
The current record macros already log the function being called. This
patch extends the macros to also log their input arguments and removes
explicit logging from the SB API.
This might degrade the amount of information in some cases (because of
smarter casts or efforts to log return values). However I think this is
outweighed by the increased coverage and consistency. Furthermore, using
the reproducer infrastructure, diagnosing bugs in the API layer should
become much easier compared to relying on log messages.
Differential revision: https://reviews.llvm.org/D59101
llvm-svn: 355649
Diffstat (limited to 'lldb/source/API/SBFileSpec.cpp')
-rw-r--r-- | lldb/source/API/SBFileSpec.cpp | 44 |
1 files changed, 2 insertions, 42 deletions
diff --git a/lldb/source/API/SBFileSpec.cpp b/lldb/source/API/SBFileSpec.cpp index 1c2c993d31c..ee28c2f8dda 100644 --- a/lldb/source/API/SBFileSpec.cpp +++ b/lldb/source/API/SBFileSpec.cpp @@ -13,7 +13,6 @@ #include "lldb/Host/FileSystem.h" #include "lldb/Host/PosixApi.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" #include "lldb/Utility/Stream.h" #include "llvm/ADT/SmallString.h" @@ -72,16 +71,7 @@ bool SBFileSpec::IsValid() const { bool SBFileSpec::Exists() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBFileSpec, Exists); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); - - bool result = FileSystem::Instance().Exists(*m_opaque_up); - - if (log) - log->Printf("SBFileSpec(%p)::Exists () => %s", - static_cast<void *>(m_opaque_up.get()), - (result ? "true" : "false")); - - return result; + return FileSystem::Instance().Exists(*m_opaque_up); } bool SBFileSpec::ResolveExecutableLocation() { @@ -105,19 +95,7 @@ int SBFileSpec::ResolvePath(const char *src_path, char *dst_path, const char *SBFileSpec::GetFilename() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBFileSpec, GetFilename); - const char *s = m_opaque_up->GetFilename().AsCString(); - - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); - if (log) { - if (s) - log->Printf("SBFileSpec(%p)::GetFilename () => \"%s\"", - static_cast<void *>(m_opaque_up.get()), s); - else - log->Printf("SBFileSpec(%p)::GetFilename () => NULL", - static_cast<void *>(m_opaque_up.get())); - } - - return s; + return m_opaque_up->GetFilename().AsCString(); } const char *SBFileSpec::GetDirectory() const { @@ -125,16 +103,6 @@ const char *SBFileSpec::GetDirectory() const { FileSpec directory{*m_opaque_up}; directory.GetFilename().Clear(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); - if (log) { - if (directory) - log->Printf("SBFileSpec(%p)::GetDirectory () => \"%s\"", - static_cast<void *>(m_opaque_up.get()), - directory.GetCString()); - else - log->Printf("SBFileSpec(%p)::GetDirectory () => NULL", - static_cast<void *>(m_opaque_up.get())); - } return directory.GetCString(); } @@ -160,16 +128,8 @@ uint32_t SBFileSpec::GetPath(char *dst_path, size_t dst_len) const { LLDB_RECORD_METHOD_CONST(uint32_t, SBFileSpec, GetPath, (char *, size_t), dst_path, dst_len); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); - uint32_t result = m_opaque_up->GetPath(dst_path, dst_len); - if (log) - log->Printf("SBFileSpec(%p)::GetPath (dst_path=\"%.*s\", dst_len=%" PRIu64 - ") => %u", - static_cast<void *>(m_opaque_up.get()), result, dst_path, - static_cast<uint64_t>(dst_len), result); - if (result == 0 && dst_path && dst_len > 0) *dst_path = '\0'; return result; |