[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
This commit is contained in:
@@ -25,7 +25,6 @@
|
||||
#include "lldb/Symbol/TypeSystem.h"
|
||||
#include "lldb/Symbol/VariableList.h"
|
||||
#include "lldb/Target/Target.h"
|
||||
#include "lldb/Utility/Log.h"
|
||||
#include "lldb/Utility/StreamString.h"
|
||||
|
||||
using namespace lldb;
|
||||
@@ -94,18 +93,11 @@ void SBModule::Clear() {
|
||||
SBFileSpec SBModule::GetFileSpec() const {
|
||||
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBFileSpec, SBModule, GetFileSpec);
|
||||
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
|
||||
|
||||
SBFileSpec file_spec;
|
||||
ModuleSP module_sp(GetSP());
|
||||
if (module_sp)
|
||||
file_spec.SetFileSpec(module_sp->GetFileSpec());
|
||||
|
||||
if (log)
|
||||
log->Printf("SBModule(%p)::GetFileSpec () => SBFileSpec(%p)",
|
||||
static_cast<void *>(module_sp.get()),
|
||||
static_cast<const void *>(file_spec.get()));
|
||||
|
||||
return LLDB_RECORD_RESULT(file_spec);
|
||||
}
|
||||
|
||||
@@ -113,18 +105,12 @@ lldb::SBFileSpec SBModule::GetPlatformFileSpec() const {
|
||||
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBFileSpec, SBModule,
|
||||
GetPlatformFileSpec);
|
||||
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
|
||||
|
||||
SBFileSpec file_spec;
|
||||
ModuleSP module_sp(GetSP());
|
||||
if (module_sp)
|
||||
file_spec.SetFileSpec(module_sp->GetPlatformFileSpec());
|
||||
|
||||
if (log)
|
||||
log->Printf("SBModule(%p)::GetPlatformFileSpec () => SBFileSpec(%p)",
|
||||
static_cast<void *>(module_sp.get()),
|
||||
static_cast<const void *>(file_spec.get()));
|
||||
|
||||
return LLDB_RECORD_RESULT(file_spec);
|
||||
}
|
||||
|
||||
@@ -133,7 +119,6 @@ bool SBModule::SetPlatformFileSpec(const lldb::SBFileSpec &platform_file) {
|
||||
(const lldb::SBFileSpec &), platform_file);
|
||||
|
||||
bool result = false;
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
|
||||
|
||||
ModuleSP module_sp(GetSP());
|
||||
if (module_sp) {
|
||||
@@ -141,11 +126,6 @@ bool SBModule::SetPlatformFileSpec(const lldb::SBFileSpec &platform_file) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("SBModule(%p)::SetPlatformFileSpec (SBFileSpec(%p (%s)) => %i",
|
||||
static_cast<void *>(module_sp.get()),
|
||||
static_cast<const void *>(platform_file.get()),
|
||||
platform_file->GetPath().c_str(), result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -175,30 +155,17 @@ bool SBModule::SetRemoteInstallFileSpec(lldb::SBFileSpec &file) {
|
||||
const uint8_t *SBModule::GetUUIDBytes() const {
|
||||
LLDB_RECORD_METHOD_CONST_NO_ARGS(const uint8_t *, SBModule, GetUUIDBytes);
|
||||
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
|
||||
|
||||
const uint8_t *uuid_bytes = NULL;
|
||||
ModuleSP module_sp(GetSP());
|
||||
if (module_sp)
|
||||
uuid_bytes = module_sp->GetUUID().GetBytes().data();
|
||||
|
||||
if (log) {
|
||||
if (uuid_bytes) {
|
||||
StreamString s;
|
||||
module_sp->GetUUID().Dump(&s);
|
||||
log->Printf("SBModule(%p)::GetUUIDBytes () => %s",
|
||||
static_cast<void *>(module_sp.get()), s.GetData());
|
||||
} else
|
||||
log->Printf("SBModule(%p)::GetUUIDBytes () => NULL",
|
||||
static_cast<void *>(module_sp.get()));
|
||||
}
|
||||
return uuid_bytes;
|
||||
}
|
||||
|
||||
const char *SBModule::GetUUIDString() const {
|
||||
LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBModule, GetUUIDString);
|
||||
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
|
||||
|
||||
const char *uuid_cstr = NULL;
|
||||
ModuleSP module_sp(GetSP());
|
||||
@@ -211,15 +178,9 @@ const char *SBModule::GetUUIDString() const {
|
||||
}
|
||||
|
||||
if (uuid_cstr && uuid_cstr[0]) {
|
||||
if (log)
|
||||
log->Printf("SBModule(%p)::GetUUIDString () => %s",
|
||||
static_cast<void *>(module_sp.get()), uuid_cstr);
|
||||
return uuid_cstr;
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("SBModule(%p)::GetUUIDString () => NULL",
|
||||
static_cast<void *>(module_sp.get()));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user