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/SBQueueItem.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/SBQueueItem.cpp')
-rw-r--r-- | lldb/source/API/SBQueueItem.cpp | 41 |
1 files changed, 1 insertions, 40 deletions
diff --git a/lldb/source/API/SBQueueItem.cpp b/lldb/source/API/SBQueueItem.cpp index 5a41867c8d4..f0aa959c641 100644 --- a/lldb/source/API/SBQueueItem.cpp +++ b/lldb/source/API/SBQueueItem.cpp @@ -16,7 +16,6 @@ #include "lldb/Target/Process.h" #include "lldb/Target/QueueItem.h" #include "lldb/Target/Thread.h" -#include "lldb/Utility/Log.h" using namespace lldb; using namespace lldb_private; @@ -42,22 +41,12 @@ SBQueueItem::~SBQueueItem() { m_queue_item_sp.reset(); } bool SBQueueItem::IsValid() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBQueueItem, IsValid); - bool is_valid = m_queue_item_sp.get() != NULL; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); - if (log) - log->Printf("SBQueueItem(%p)::IsValid() == %s", - static_cast<void *>(m_queue_item_sp.get()), - is_valid ? "true" : "false"); - return is_valid; + return m_queue_item_sp.get() != NULL; } void SBQueueItem::Clear() { LLDB_RECORD_METHOD_NO_ARGS(void, SBQueueItem, Clear); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); - if (log) - log->Printf("SBQueueItem(%p)::Clear()", - static_cast<void *>(m_queue_item_sp.get())); m_queue_item_sp.reset(); } @@ -72,14 +61,9 @@ lldb::QueueItemKind SBQueueItem::GetKind() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::QueueItemKind, SBQueueItem, GetKind); QueueItemKind result = eQueueItemKindUnknown; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); if (m_queue_item_sp) { result = m_queue_item_sp->GetKind(); } - if (log) - log->Printf("SBQueueItem(%p)::GetKind() == %d", - static_cast<void *>(m_queue_item_sp.get()), - static_cast<int>(result)); return result; } @@ -95,20 +79,9 @@ SBAddress SBQueueItem::GetAddress() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBAddress, SBQueueItem, GetAddress); SBAddress result; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); if (m_queue_item_sp) { result.SetAddress(&m_queue_item_sp->GetAddress()); } - if (log) { - StreamString sstr; - const Address *addr = result.get(); - if (addr) - addr->Dump(&sstr, NULL, Address::DumpStyleModuleWithFileAddress, - Address::DumpStyleInvalid, 4); - log->Printf("SBQueueItem(%p)::GetAddress() == SBAddress(%p): %s", - static_cast<void *>(m_queue_item_sp.get()), - static_cast<void *>(result.get()), sstr.GetData()); - } return LLDB_RECORD_RESULT(result); } @@ -125,7 +98,6 @@ SBThread SBQueueItem::GetExtendedBacktraceThread(const char *type) { (const char *), type); SBThread result; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); if (m_queue_item_sp) { ProcessSP process_sp = m_queue_item_sp->GetProcessSP(); Process::StopLocker stop_locker; @@ -138,17 +110,6 @@ SBThread SBQueueItem::GetExtendedBacktraceThread(const char *type) { // retains the object process_sp->GetExtendedThreadList().AddThread(thread_sp); result.SetThread(thread_sp); - if (log) { - const char *queue_name = thread_sp->GetQueueName(); - if (queue_name == NULL) - queue_name = ""; - log->Printf( - "SBQueueItem(%p)::GetExtendedBacktraceThread() = new extended " - "Thread created (%p) with queue_id 0x%" PRIx64 " queue name '%s'", - static_cast<void *>(m_queue_item_sp.get()), - static_cast<void *>(thread_sp.get()), - static_cast<uint64_t>(thread_sp->GetQueueID()), queue_name); - } } } } |