[lldb] Rename formatv verbose log call, misc log cleanups [NFC] (#186951)
lldb had three preprocessor defines for logging, LLDB_LOG - formatv style argument LLDB_LOGF - printf style argument LLDB_LOGV - formatv style argument, only when verbose enabled If you weren't looking at Log.h and the definition of these three, and wanted to log something with formatv, it was easy to use LLDB_LOGV by accident. We just had a situation where an important log statement wasn't logging and it turned out to be this. This is fragile if you aren't looking at the header directly, so I'd like to make this more explicit. My proposal: LLDB_LOG - formatv style argument LLDB_LOG_VERBOSE - formatv style argument, only when verbose enabled LLDB_LOGF - printf style argument LLDB_LOGF_VERBOSE - printf style argument, only when verbose enabled The new fouth one is to remove several places where we do `if (log && log->GetVerbose()) LLDB_LOGF (...)` in the sources today, and make both styles consistent. This PR implements that change, mechanically changing all LLDB_LOGV's to LLDB_LOG_VERBOSE. It also updates many of the `if (log && log->GetVerbose()) LLDB_LOGF`'s. Some uses of this conditional expression do extra calculations in addition to logging, and so those were left as-is so we're not doing throwaway work when running without verbose logging. There were many instances throughout lldb where callers are still doing `if (log) LLDB_LOG*(...)`, a remnant of when all calls were to the `Log` object's `Printf()` method, and you had to check if your local Log* pointer was non-nullptr before calling the method. I removed those, again keeping ones where work for logging is done in the block of code. The code changes are all mechanical and uninteresting, but the question of whether this naming change is widely agreed on is maybe worth discussing.
This commit is contained in:
parent
fb39a5d6af
commit
fb36a54ef6
@ -373,6 +373,13 @@ Log *GetLLDBErrorLog();
|
||||
log_private->Format(__FILE__, __func__, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define LLDB_LOG_VERBOSE(log, ...) \
|
||||
do { \
|
||||
::lldb_private::Log *log_private = (log); \
|
||||
if (log_private && log_private->GetVerbose()) \
|
||||
log_private->Format(__FILE__, __func__, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define LLDB_LOGF(log, ...) \
|
||||
do { \
|
||||
::lldb_private::Log *log_private = (log); \
|
||||
@ -380,11 +387,11 @@ Log *GetLLDBErrorLog();
|
||||
log_private->Formatf(__FILE__, __func__, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define LLDB_LOGV(log, ...) \
|
||||
#define LLDB_LOGF_VERBOSE(log, ...) \
|
||||
do { \
|
||||
::lldb_private::Log *log_private = (log); \
|
||||
if (log_private && log_private->GetVerbose()) \
|
||||
log_private->Format(__FILE__, __func__, __VA_ARGS__); \
|
||||
log_private->Formatf(__FILE__, __func__, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
// Write message to log, if error is set. In the log message refer to the error
|
||||
|
||||
@ -44,12 +44,14 @@ WatchpointAlgorithms::AtomizeWatchpointRequest(
|
||||
}
|
||||
|
||||
Log *log = GetLog(LLDBLog::Watchpoints);
|
||||
LLDB_LOGV(log, "AtomizeWatchpointRequest user request addr {0:x} size {1}",
|
||||
addr, size);
|
||||
LLDB_LOG_VERBOSE(log,
|
||||
"AtomizeWatchpointRequest user request addr {0:x} size {1}",
|
||||
addr, size);
|
||||
std::vector<WatchpointResourceSP> resources;
|
||||
for (Region &ent : entries) {
|
||||
LLDB_LOGV(log, "AtomizeWatchpointRequest creating resource {0:x} size {1}",
|
||||
ent.addr, ent.size);
|
||||
LLDB_LOG_VERBOSE(
|
||||
log, "AtomizeWatchpointRequest creating resource {0:x} size {1}",
|
||||
ent.addr, ent.size);
|
||||
WatchpointResourceSP wp_res_sp =
|
||||
std::make_shared<WatchpointResource>(ent.addr, ent.size, read, write);
|
||||
resources.push_back(wp_res_sp);
|
||||
@ -78,11 +80,11 @@ WatchpointAlgorithms::PowerOf2Watchpoints(addr_t user_addr, size_t user_size,
|
||||
uint32_t address_byte_size) {
|
||||
|
||||
Log *log = GetLog(LLDBLog::Watchpoints);
|
||||
LLDB_LOGV(log,
|
||||
"AtomizeWatchpointRequest user request addr {0:x} size {1} "
|
||||
"min_byte_size {2}, max_byte_size {3}, address_byte_size {4}",
|
||||
user_addr, user_size, min_byte_size, max_byte_size,
|
||||
address_byte_size);
|
||||
LLDB_LOG_VERBOSE(
|
||||
log,
|
||||
"AtomizeWatchpointRequest user request addr {0:x} size {1} "
|
||||
"min_byte_size {2}, max_byte_size {3}, address_byte_size {4}",
|
||||
user_addr, user_size, min_byte_size, max_byte_size, address_byte_size);
|
||||
|
||||
// Can't watch zero bytes.
|
||||
if (user_size == 0)
|
||||
|
||||
@ -1047,13 +1047,10 @@ protected:
|
||||
const char *to = command.GetArgumentAtIndex(i + 1);
|
||||
|
||||
if (from[0] && to[0]) {
|
||||
Log *log = GetLog(LLDBLog::Host);
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"target modules search path adding ImageSearchPath "
|
||||
"pair: '%s' -> '%s'",
|
||||
from, to);
|
||||
}
|
||||
LLDB_LOGF(GetLog(LLDBLog::Host),
|
||||
"target modules search path adding ImageSearchPath "
|
||||
"pair: '%s' -> '%s'",
|
||||
from, to);
|
||||
bool last_pair = ((argc - i) == 2);
|
||||
target.GetImageSearchPathList().Append(
|
||||
from, to, last_pair); // Notify if this is the last pair
|
||||
|
||||
@ -142,14 +142,13 @@ Module::Module(const ModuleSpec &module_spec)
|
||||
}
|
||||
|
||||
Log *log(GetLog(LLDBLog::Object | LLDBLog::Modules));
|
||||
if (log != nullptr)
|
||||
LLDB_LOGF(log, "%p Module::Module((%s) '%s%s%s%s')",
|
||||
static_cast<void *>(this),
|
||||
module_spec.GetArchitecture().GetArchitectureName(),
|
||||
module_spec.GetFileSpec().GetPath().c_str(),
|
||||
module_spec.GetObjectName().IsEmpty() ? "" : "(",
|
||||
module_spec.GetObjectName().AsCString(""),
|
||||
module_spec.GetObjectName().IsEmpty() ? "" : ")");
|
||||
LLDB_LOGF(log, "%p Module::Module((%s) '%s%s%s%s')",
|
||||
static_cast<void *>(this),
|
||||
module_spec.GetArchitecture().GetArchitectureName(),
|
||||
module_spec.GetFileSpec().GetPath().c_str(),
|
||||
module_spec.GetObjectName().IsEmpty() ? "" : "(",
|
||||
module_spec.GetObjectName().AsCString(""),
|
||||
module_spec.GetObjectName().IsEmpty() ? "" : ")");
|
||||
|
||||
auto extractor_sp = module_spec.GetExtractor();
|
||||
lldb::offset_t file_size = 0;
|
||||
@ -174,9 +173,7 @@ Module::Module(const ModuleSpec &module_spec)
|
||||
ModuleSpec matching_module_spec;
|
||||
if (!modules_specs.FindMatchingModuleSpec(module_spec,
|
||||
matching_module_spec)) {
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "Found local object file but the specs didn't match");
|
||||
}
|
||||
LLDB_LOGF(log, "Found local object file but the specs didn't match");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -252,11 +249,10 @@ Module::Module(const FileSpec &file_spec, const ArchSpec &arch,
|
||||
}
|
||||
|
||||
Log *log(GetLog(LLDBLog::Object | LLDBLog::Modules));
|
||||
if (log != nullptr)
|
||||
LLDB_LOGF(log, "%p Module::Module((%s) '%s%s%s%s')",
|
||||
static_cast<void *>(this), m_arch.GetArchitectureName(),
|
||||
m_file.GetPath().c_str(), m_object_name.IsEmpty() ? "" : "(",
|
||||
m_object_name.AsCString(""), m_object_name.IsEmpty() ? "" : ")");
|
||||
LLDB_LOGF(log, "%p Module::Module((%s) '%s%s%s%s')",
|
||||
static_cast<void *>(this), m_arch.GetArchitectureName(),
|
||||
m_file.GetPath().c_str(), m_object_name.IsEmpty() ? "" : "(",
|
||||
m_object_name.AsCString(""), m_object_name.IsEmpty() ? "" : ")");
|
||||
}
|
||||
|
||||
Module::Module()
|
||||
@ -282,11 +278,10 @@ Module::~Module() {
|
||||
modules.erase(pos);
|
||||
}
|
||||
Log *log(GetLog(LLDBLog::Object | LLDBLog::Modules));
|
||||
if (log != nullptr)
|
||||
LLDB_LOGF(log, "%p Module::~Module((%s) '%s%s%s%s')",
|
||||
static_cast<void *>(this), m_arch.GetArchitectureName(),
|
||||
m_file.GetPath().c_str(), m_object_name.IsEmpty() ? "" : "(",
|
||||
m_object_name.AsCString(""), m_object_name.IsEmpty() ? "" : ")");
|
||||
LLDB_LOGF(log, "%p Module::~Module((%s) '%s%s%s%s')",
|
||||
static_cast<void *>(this), m_arch.GetArchitectureName(),
|
||||
m_file.GetPath().c_str(), m_object_name.IsEmpty() ? "" : "(",
|
||||
m_object_name.AsCString(""), m_object_name.IsEmpty() ? "" : ")");
|
||||
// Release any auto pointers before we start tearing down our member
|
||||
// variables since the object file and symbol files might need to make
|
||||
// function calls back into this module object. The ordering is important
|
||||
|
||||
@ -1088,11 +1088,10 @@ ModuleList::GetSharedModule(const ModuleSpec &module_spec, ModuleSP &module_sp,
|
||||
old_modules->push_back(module_sp);
|
||||
|
||||
Log *log = GetLog(LLDBLog::Modules);
|
||||
if (log != nullptr)
|
||||
LLDB_LOGF(
|
||||
log, "%p '%s' module changed: removing from global module list",
|
||||
static_cast<void *>(module_sp.get()),
|
||||
module_sp->GetFileSpec().GetFilename().GetCString());
|
||||
LLDB_LOGF(log,
|
||||
"%p '%s' module changed: removing from global module list",
|
||||
static_cast<void *>(module_sp.get()),
|
||||
module_sp->GetFileSpec().GetFilename().GetCString());
|
||||
|
||||
shared_module_list.Remove(module_sp);
|
||||
module_sp.reset();
|
||||
|
||||
@ -658,12 +658,10 @@ ImplSP FormatManager::GetCached(FormattersMatchData &match_data) {
|
||||
LLDB_LOGF(log, "\n\n" FORMAT_LOG("Looking into cache for type %s"),
|
||||
match_data.GetTypeForCache().AsCString("<invalid>"));
|
||||
if (m_format_cache.Get(match_data.GetTypeForCache(), retval_sp)) {
|
||||
if (log) {
|
||||
LLDB_LOGF(log, FORMAT_LOG("Cache search success. Returning."));
|
||||
LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
|
||||
m_format_cache.GetCacheHits(),
|
||||
m_format_cache.GetCacheMisses());
|
||||
}
|
||||
LLDB_LOGF(log, FORMAT_LOG("Cache search success. Returning."));
|
||||
LLDB_LOG_VERBOSE(log, "Cache hits: {0} - Cache Misses: {1}",
|
||||
m_format_cache.GetCacheHits(),
|
||||
m_format_cache.GetCacheMisses());
|
||||
return retval_sp;
|
||||
}
|
||||
LLDB_LOGF(log, FORMAT_LOG("Cache search failed. Going normal route"));
|
||||
@ -676,8 +674,9 @@ ImplSP FormatManager::GetCached(FormattersMatchData &match_data) {
|
||||
match_data.GetTypeForCache().AsCString("<invalid>"));
|
||||
m_format_cache.Set(match_data.GetTypeForCache(), retval_sp);
|
||||
}
|
||||
LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
|
||||
m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
|
||||
LLDB_LOG_VERBOSE(log, "Cache hits: {0} - Cache Misses: {1}",
|
||||
m_format_cache.GetCacheHits(),
|
||||
m_format_cache.GetCacheMisses());
|
||||
return retval_sp;
|
||||
}
|
||||
|
||||
|
||||
@ -222,9 +222,10 @@ llvm::Error Interpret(ControlStack &control, DataStack &data, Signatures sig) {
|
||||
if (control.empty() || !pc)
|
||||
return pc.takeError();
|
||||
|
||||
LLDB_LOGV(GetLog(LLDBLog::DataFormatters),
|
||||
"[eval {0}] opcode={1}, control={2}, data={3}", toString(sig),
|
||||
toString(opcode), control.size(), toString(data));
|
||||
LLDB_LOG_VERBOSE(GetLog(LLDBLog::DataFormatters),
|
||||
"[eval {0}] opcode={1}, control={2}, data={3}",
|
||||
toString(sig), toString(opcode), control.size(),
|
||||
toString(data));
|
||||
|
||||
// Various shorthands to improve the readability of error handling.
|
||||
#define TYPE_CHECK(...) \
|
||||
|
||||
@ -387,18 +387,16 @@ lldb::ExpressionResults FunctionCaller::ExecuteFunction(
|
||||
return_value = exe_ctx.GetProcessRef().RunThreadPlan(
|
||||
exe_ctx, call_plan_sp, real_options, diagnostic_manager);
|
||||
|
||||
if (log) {
|
||||
if (return_value != lldb::eExpressionCompleted) {
|
||||
LLDB_LOGF(log,
|
||||
"== [FunctionCaller::ExecuteFunction] Execution of \"%s\" "
|
||||
"completed abnormally: %s ==",
|
||||
m_name.c_str(), toString(return_value).c_str());
|
||||
} else {
|
||||
LLDB_LOGF(log,
|
||||
"== [FunctionCaller::ExecuteFunction] Execution of \"%s\" "
|
||||
"completed normally ==",
|
||||
m_name.c_str());
|
||||
}
|
||||
if (return_value != lldb::eExpressionCompleted) {
|
||||
LLDB_LOGF(log,
|
||||
"== [FunctionCaller::ExecuteFunction] Execution of \"%s\" "
|
||||
"completed abnormally: %s ==",
|
||||
m_name.c_str(), toString(return_value).c_str());
|
||||
} else {
|
||||
LLDB_LOGF(log,
|
||||
"== [FunctionCaller::ExecuteFunction] Execution of \"%s\" "
|
||||
"completed normally ==",
|
||||
m_name.c_str());
|
||||
}
|
||||
|
||||
if (exe_ctx.GetProcessPtr())
|
||||
|
||||
@ -356,13 +356,10 @@ public:
|
||||
|
||||
lldb_private::Log *log(GetLog(LLDBLog::Expressions));
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "Made an allocation for argument %s",
|
||||
PrintValue(value).c_str());
|
||||
LLDB_LOGF(log, " Data region : %llx", (unsigned long long)address);
|
||||
LLDB_LOGF(log, " Ref region : %llx",
|
||||
(unsigned long long)data_address);
|
||||
}
|
||||
LLDB_LOGF(log, "Made an allocation for argument %s",
|
||||
PrintValue(value).c_str());
|
||||
LLDB_LOGF(log, " Data region : %llx", (unsigned long long)address);
|
||||
LLDB_LOGF(log, " Ref region : %llx", (unsigned long long)data_address);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -889,12 +886,10 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
||||
|
||||
frame.AssignValue(inst, result, module);
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "Interpreted a %s", inst->getOpcodeName());
|
||||
LLDB_LOGF(log, " L : %s", frame.SummarizeValue(lhs).c_str());
|
||||
LLDB_LOGF(log, " R : %s", frame.SummarizeValue(rhs).c_str());
|
||||
LLDB_LOGF(log, " = : %s", frame.SummarizeValue(inst).c_str());
|
||||
}
|
||||
LLDB_LOGF(log, "Interpreted a %s", inst->getOpcodeName());
|
||||
LLDB_LOGF(log, " L : %s", frame.SummarizeValue(lhs).c_str());
|
||||
LLDB_LOGF(log, " R : %s", frame.SummarizeValue(rhs).c_str());
|
||||
LLDB_LOGF(log, " = : %s", frame.SummarizeValue(inst).c_str());
|
||||
} break;
|
||||
case Instruction::Alloca: {
|
||||
const AllocaInst *alloca_inst = cast<AllocaInst>(inst);
|
||||
@ -949,11 +944,9 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
||||
|
||||
frame.m_values[alloca_inst] = P;
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "Interpreted an AllocaInst");
|
||||
LLDB_LOGF(log, " R : 0x%" PRIx64, R);
|
||||
LLDB_LOGF(log, " P : 0x%" PRIx64, P);
|
||||
}
|
||||
LLDB_LOGF(log, "Interpreted an AllocaInst");
|
||||
LLDB_LOGF(log, " R : 0x%" PRIx64, R);
|
||||
LLDB_LOGF(log, " P : 0x%" PRIx64, P);
|
||||
} break;
|
||||
case Instruction::BitCast:
|
||||
case Instruction::ZExt: {
|
||||
@ -992,9 +985,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
||||
} break;
|
||||
case Instruction::UncondBr:
|
||||
frame.Jump(cast<UncondBrInst>(inst)->getSuccessor());
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "Interpreted an UncondBrInst");
|
||||
}
|
||||
LLDB_LOGF(log, "Interpreted an UncondBrInst");
|
||||
continue;
|
||||
case Instruction::CondBr: {
|
||||
const CondBrInst *br_inst = cast<CondBrInst>(inst);
|
||||
@ -1014,10 +1005,8 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
||||
else
|
||||
frame.Jump(br_inst->getSuccessor(1));
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "Interpreted a CondBrInst");
|
||||
LLDB_LOGF(log, " cond : %s", frame.SummarizeValue(condition).c_str());
|
||||
}
|
||||
LLDB_LOGF(log, "Interpreted a CondBrInst");
|
||||
LLDB_LOGF(log, " cond : %s", frame.SummarizeValue(condition).c_str());
|
||||
}
|
||||
continue;
|
||||
case Instruction::PHI: {
|
||||
@ -1040,11 +1029,9 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
||||
}
|
||||
frame.AssignValue(inst, result, module);
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "Interpreted a %s", inst->getOpcodeName());
|
||||
LLDB_LOGF(log, " Incoming value : %s",
|
||||
frame.SummarizeValue(value).c_str());
|
||||
}
|
||||
LLDB_LOGF(log, "Interpreted a %s", inst->getOpcodeName());
|
||||
LLDB_LOGF(log, " Incoming value : %s",
|
||||
frame.SummarizeValue(value).c_str());
|
||||
} break;
|
||||
case Instruction::GetElementPtr: {
|
||||
const GetElementPtrInst *gep_inst = cast<GetElementPtrInst>(inst);
|
||||
@ -1099,12 +1086,10 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
||||
|
||||
frame.AssignValue(inst, Poffset, module);
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "Interpreted a GetElementPtrInst");
|
||||
LLDB_LOGF(log, " P : %s",
|
||||
frame.SummarizeValue(pointer_operand).c_str());
|
||||
LLDB_LOGF(log, " Poffset : %s", frame.SummarizeValue(inst).c_str());
|
||||
}
|
||||
LLDB_LOGF(log, "Interpreted a GetElementPtrInst");
|
||||
LLDB_LOGF(log, " P : %s",
|
||||
frame.SummarizeValue(pointer_operand).c_str());
|
||||
LLDB_LOGF(log, " Poffset : %s", frame.SummarizeValue(inst).c_str());
|
||||
} break;
|
||||
case Instruction::FCmp:
|
||||
case Instruction::ICmp: {
|
||||
@ -1199,12 +1184,10 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
||||
|
||||
frame.AssignValue(inst, result, module);
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "Interpreted an ICmpInst");
|
||||
LLDB_LOGF(log, " L : %s", frame.SummarizeValue(lhs).c_str());
|
||||
LLDB_LOGF(log, " R : %s", frame.SummarizeValue(rhs).c_str());
|
||||
LLDB_LOGF(log, " = : %s", frame.SummarizeValue(inst).c_str());
|
||||
}
|
||||
LLDB_LOGF(log, "Interpreted an ICmpInst");
|
||||
LLDB_LOGF(log, " L : %s", frame.SummarizeValue(lhs).c_str());
|
||||
LLDB_LOGF(log, " R : %s", frame.SummarizeValue(rhs).c_str());
|
||||
LLDB_LOGF(log, " = : %s", frame.SummarizeValue(inst).c_str());
|
||||
} break;
|
||||
case Instruction::IntToPtr: {
|
||||
const IntToPtrInst *int_to_ptr_inst = cast<IntToPtrInst>(inst);
|
||||
@ -1221,11 +1204,9 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
||||
|
||||
frame.AssignValue(inst, I, module);
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "Interpreted an IntToPtr");
|
||||
LLDB_LOGF(log, " Src : %s", frame.SummarizeValue(src_operand).c_str());
|
||||
LLDB_LOGF(log, " = : %s", frame.SummarizeValue(inst).c_str());
|
||||
}
|
||||
LLDB_LOGF(log, "Interpreted an IntToPtr");
|
||||
LLDB_LOGF(log, " Src : %s", frame.SummarizeValue(src_operand).c_str());
|
||||
LLDB_LOGF(log, " = : %s", frame.SummarizeValue(inst).c_str());
|
||||
} break;
|
||||
case Instruction::PtrToInt: {
|
||||
const PtrToIntInst *ptr_to_int_inst = cast<PtrToIntInst>(inst);
|
||||
@ -1242,11 +1223,9 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
||||
|
||||
frame.AssignValue(inst, I, module);
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "Interpreted a PtrToInt");
|
||||
LLDB_LOGF(log, " Src : %s", frame.SummarizeValue(src_operand).c_str());
|
||||
LLDB_LOGF(log, " = : %s", frame.SummarizeValue(inst).c_str());
|
||||
}
|
||||
LLDB_LOGF(log, "Interpreted a PtrToInt");
|
||||
LLDB_LOGF(log, " Src : %s", frame.SummarizeValue(src_operand).c_str());
|
||||
LLDB_LOGF(log, " = : %s", frame.SummarizeValue(inst).c_str());
|
||||
} break;
|
||||
case Instruction::Trunc: {
|
||||
const TruncInst *trunc_inst = cast<TruncInst>(inst);
|
||||
@ -1263,11 +1242,9 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
||||
|
||||
frame.AssignValue(inst, I, module);
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "Interpreted a Trunc");
|
||||
LLDB_LOGF(log, " Src : %s", frame.SummarizeValue(src_operand).c_str());
|
||||
LLDB_LOGF(log, " = : %s", frame.SummarizeValue(inst).c_str());
|
||||
}
|
||||
LLDB_LOGF(log, "Interpreted a Trunc");
|
||||
LLDB_LOGF(log, " Src : %s", frame.SummarizeValue(src_operand).c_str());
|
||||
LLDB_LOGF(log, " = : %s", frame.SummarizeValue(inst).c_str());
|
||||
} break;
|
||||
case Instruction::FPToUI:
|
||||
case Instruction::FPToSI: {
|
||||
@ -1305,11 +1282,9 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
||||
lldb_private::Scalar R(result);
|
||||
|
||||
frame.AssignValue(inst, R, module);
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "Interpreted a %s", inst->getOpcodeName());
|
||||
LLDB_LOGF(log, " Src : %s", frame.SummarizeValue(src_operand).c_str());
|
||||
LLDB_LOGF(log, " = : %s", frame.SummarizeValue(inst).c_str());
|
||||
}
|
||||
LLDB_LOGF(log, "Interpreted a %s", inst->getOpcodeName());
|
||||
LLDB_LOGF(log, " Src : %s", frame.SummarizeValue(src_operand).c_str());
|
||||
LLDB_LOGF(log, " = : %s", frame.SummarizeValue(inst).c_str());
|
||||
} break;
|
||||
case Instruction::UIToFP:
|
||||
case Instruction::SIToFP:
|
||||
@ -1335,11 +1310,9 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
||||
R = S.Double();
|
||||
|
||||
frame.AssignValue(inst, R, module);
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "Interpreted a %s", inst->getOpcodeName());
|
||||
LLDB_LOGF(log, " Src : %s", frame.SummarizeValue(src_operand).c_str());
|
||||
LLDB_LOGF(log, " = : %s", frame.SummarizeValue(inst).c_str());
|
||||
}
|
||||
LLDB_LOGF(log, "Interpreted a %s", inst->getOpcodeName());
|
||||
LLDB_LOGF(log, " Src : %s", frame.SummarizeValue(src_operand).c_str());
|
||||
LLDB_LOGF(log, " = : %s", frame.SummarizeValue(inst).c_str());
|
||||
} break;
|
||||
case Instruction::Load: {
|
||||
const LoadInst *load_inst = cast<LoadInst>(inst);
|
||||
@ -1399,12 +1372,10 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "Interpreted a LoadInst");
|
||||
LLDB_LOGF(log, " P : 0x%" PRIx64, P);
|
||||
LLDB_LOGF(log, " R : 0x%" PRIx64, R);
|
||||
LLDB_LOGF(log, " D : 0x%" PRIx64, D);
|
||||
}
|
||||
LLDB_LOGF(log, "Interpreted a LoadInst");
|
||||
LLDB_LOGF(log, " P : 0x%" PRIx64, P);
|
||||
LLDB_LOGF(log, " R : 0x%" PRIx64, R);
|
||||
LLDB_LOGF(log, " D : 0x%" PRIx64, D);
|
||||
} break;
|
||||
case Instruction::Ret: {
|
||||
return true;
|
||||
@ -1468,12 +1439,10 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "Interpreted a StoreInst");
|
||||
LLDB_LOGF(log, " D : 0x%" PRIx64, D);
|
||||
LLDB_LOGF(log, " P : 0x%" PRIx64, P);
|
||||
LLDB_LOGF(log, " R : 0x%" PRIx64, R);
|
||||
}
|
||||
LLDB_LOGF(log, "Interpreted a StoreInst");
|
||||
LLDB_LOGF(log, " D : 0x%" PRIx64, D);
|
||||
LLDB_LOGF(log, " P : 0x%" PRIx64, P);
|
||||
LLDB_LOGF(log, " R : 0x%" PRIx64, R);
|
||||
} break;
|
||||
case Instruction::Call: {
|
||||
const CallInst *call_inst = cast<CallInst>(inst);
|
||||
|
||||
@ -164,14 +164,12 @@ public:
|
||||
|
||||
const lldb::addr_t load_addr = process_address + m_offset;
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"EntityPersistentVariable::Materialize [address = 0x%" PRIx64
|
||||
", m_name = %s, m_flags = 0x%hx]",
|
||||
(uint64_t)load_addr,
|
||||
m_persistent_variable_sp->GetName().AsCString(),
|
||||
m_persistent_variable_sp->m_flags);
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"EntityPersistentVariable::Materialize [address = 0x%" PRIx64
|
||||
", m_name = %s, m_flags = 0x%hx]",
|
||||
(uint64_t)load_addr,
|
||||
m_persistent_variable_sp->GetName().AsCString(),
|
||||
m_persistent_variable_sp->m_flags);
|
||||
|
||||
if (m_persistent_variable_sp->m_flags &
|
||||
ExpressionVariable::EVNeedsAllocation) {
|
||||
@ -216,14 +214,12 @@ public:
|
||||
|
||||
const lldb::addr_t load_addr = process_address + m_offset;
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"EntityPersistentVariable::Dematerialize [address = 0x%" PRIx64
|
||||
", m_name = %s, m_flags = 0x%hx]",
|
||||
(uint64_t)process_address + m_offset,
|
||||
m_persistent_variable_sp->GetName().AsCString(),
|
||||
m_persistent_variable_sp->m_flags);
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"EntityPersistentVariable::Dematerialize [address = 0x%" PRIx64
|
||||
", m_name = %s, m_flags = 0x%hx]",
|
||||
(uint64_t)process_address + m_offset,
|
||||
m_persistent_variable_sp->GetName().AsCString(),
|
||||
m_persistent_variable_sp->m_flags);
|
||||
|
||||
if (m_delegate) {
|
||||
m_delegate->DidDematerialize(m_persistent_variable_sp);
|
||||
@ -449,12 +445,10 @@ public:
|
||||
Log *log = GetLog(LLDBLog::Expressions);
|
||||
|
||||
const lldb::addr_t load_addr = process_address + m_offset;
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"EntityVariable::Materialize [address = 0x%" PRIx64
|
||||
", m_variable_sp = %s]",
|
||||
(uint64_t)load_addr, GetName().GetCString());
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"EntityVariable::Materialize [address = 0x%" PRIx64
|
||||
", m_variable_sp = %s]",
|
||||
(uint64_t)load_addr, GetName().GetCString());
|
||||
|
||||
ExecutionContextScope *scope = frame_sp.get();
|
||||
|
||||
@ -612,12 +606,10 @@ public:
|
||||
Log *log = GetLog(LLDBLog::Expressions);
|
||||
|
||||
const lldb::addr_t load_addr = process_address + m_offset;
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"EntityVariable::Dematerialize [address = 0x%" PRIx64
|
||||
", m_variable_sp = %s]",
|
||||
(uint64_t)load_addr, GetName().AsCString());
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"EntityVariable::Dematerialize [address = 0x%" PRIx64
|
||||
", m_variable_sp = %s]",
|
||||
(uint64_t)load_addr, GetName().AsCString());
|
||||
|
||||
if (m_temporary_allocation != LLDB_INVALID_ADDRESS) {
|
||||
ExecutionContextScope *scope = frame_sp.get();
|
||||
@ -1234,12 +1226,10 @@ public:
|
||||
|
||||
const lldb::addr_t load_addr = process_address + m_offset;
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"EntitySymbol::Materialize [address = 0x%" PRIx64
|
||||
", m_symbol = %s]",
|
||||
(uint64_t)load_addr, m_symbol.GetName().AsCString());
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"EntitySymbol::Materialize [address = 0x%" PRIx64
|
||||
", m_symbol = %s]",
|
||||
(uint64_t)load_addr, m_symbol.GetName().AsCString());
|
||||
|
||||
const Address sym_address = m_symbol.GetAddress();
|
||||
|
||||
@ -1283,12 +1273,10 @@ public:
|
||||
|
||||
const lldb::addr_t load_addr = process_address + m_offset;
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"EntitySymbol::Dematerialize [address = 0x%" PRIx64
|
||||
", m_symbol = %s]",
|
||||
(uint64_t)load_addr, m_symbol.GetName().AsCString());
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"EntitySymbol::Dematerialize [address = 0x%" PRIx64
|
||||
", m_symbol = %s]",
|
||||
(uint64_t)load_addr, m_symbol.GetName().AsCString());
|
||||
|
||||
// no work needs to be done
|
||||
}
|
||||
@ -1353,12 +1341,10 @@ public:
|
||||
|
||||
const lldb::addr_t load_addr = process_address + m_offset;
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"EntityRegister::Materialize [address = 0x%" PRIx64
|
||||
", m_register_info = %s]",
|
||||
(uint64_t)load_addr, m_register_info.name);
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"EntityRegister::Materialize [address = 0x%" PRIx64
|
||||
", m_register_info = %s]",
|
||||
(uint64_t)load_addr, m_register_info.name);
|
||||
|
||||
RegisterValue reg_value;
|
||||
|
||||
@ -1413,12 +1399,10 @@ public:
|
||||
|
||||
const lldb::addr_t load_addr = process_address + m_offset;
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"EntityRegister::Dematerialize [address = 0x%" PRIx64
|
||||
", m_register_info = %s]",
|
||||
(uint64_t)load_addr, m_register_info.name);
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"EntityRegister::Dematerialize [address = 0x%" PRIx64
|
||||
", m_register_info = %s]",
|
||||
(uint64_t)load_addr, m_register_info.name);
|
||||
|
||||
Status extract_error;
|
||||
|
||||
|
||||
@ -329,16 +329,13 @@ Status Socket::Read(void *buf, size_t &num_bytes) {
|
||||
} else
|
||||
num_bytes = bytes_received;
|
||||
|
||||
Log *log = GetLog(LLDBLog::Communication);
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"%p Socket::Read() (socket = %" PRIu64
|
||||
", src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64
|
||||
" (error = %s)",
|
||||
static_cast<void *>(this), static_cast<uint64_t>(m_socket), buf,
|
||||
static_cast<uint64_t>(num_bytes),
|
||||
static_cast<int64_t>(bytes_received), error.AsCString());
|
||||
}
|
||||
LLDB_LOGF(GetLog(LLDBLog::Communication),
|
||||
"%p Socket::Read() (socket = %" PRIu64
|
||||
", src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64
|
||||
" (error = %s)",
|
||||
static_cast<void *>(this), static_cast<uint64_t>(m_socket), buf,
|
||||
static_cast<uint64_t>(num_bytes),
|
||||
static_cast<int64_t>(bytes_received), error.AsCString());
|
||||
|
||||
return error;
|
||||
}
|
||||
@ -357,16 +354,13 @@ Status Socket::Write(const void *buf, size_t &num_bytes) {
|
||||
} else
|
||||
num_bytes = bytes_sent;
|
||||
|
||||
Log *log = GetLog(LLDBLog::Communication);
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"%p Socket::Write() (socket = %" PRIu64
|
||||
", src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64
|
||||
" (error = %s)",
|
||||
static_cast<void *>(this), static_cast<uint64_t>(m_socket), buf,
|
||||
static_cast<uint64_t>(src_len), static_cast<int64_t>(bytes_sent),
|
||||
error.AsCString());
|
||||
}
|
||||
LLDB_LOGF(GetLog(LLDBLog::Communication),
|
||||
"%p Socket::Write() (socket = %" PRIu64
|
||||
", src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64
|
||||
" (error = %s)",
|
||||
static_cast<void *>(this), static_cast<uint64_t>(m_socket), buf,
|
||||
static_cast<uint64_t>(src_len), static_cast<int64_t>(bytes_sent),
|
||||
error.AsCString());
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -831,13 +831,10 @@ static DataExtractorSP map_shared_cache_binary_segments(void *image) {
|
||||
"map_shared_cache_binary_segments() mapping segments of "
|
||||
"dyld_image_t %p into lldb address space",
|
||||
image);
|
||||
bool log_verbosely = log && log->GetVerbose();
|
||||
for (const segment &seg : segments) {
|
||||
if (log_verbosely)
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"image %p %s vmaddr 0x%llx vmsize 0x%zx mapped to lldb vm addr %p",
|
||||
image, seg.name.c_str(), seg.vmaddr, seg.vmsize, seg.data);
|
||||
LLDB_LOGF_VERBOSE(
|
||||
log, "image %p %s vmaddr 0x%llx vmsize 0x%zx mapped to lldb vm addr %p",
|
||||
image, seg.name.c_str(), seg.vmaddr, seg.vmsize, seg.data);
|
||||
}
|
||||
|
||||
// Calculate the virtual address range in lldb's
|
||||
@ -915,9 +912,8 @@ bool SharedCacheInfo::CreateSharedCacheImageList(UUID sc_uuid,
|
||||
// ensure lifetime.
|
||||
ConstString installname(dyld_image_get_installname(image));
|
||||
Log *log = GetLog(LLDBLog::Modules);
|
||||
if (log && log->GetVerbose())
|
||||
LLDB_LOGF(log, "sc file %s image %p", installname.GetCString(),
|
||||
(void *)image);
|
||||
LLDB_LOGF_VERBOSE(log, "sc file %s image %p", installname.GetCString(),
|
||||
(void *)image);
|
||||
|
||||
m_dyld_image_retain_4HWTrace(image);
|
||||
m_file_infos[sc_uuid].push_back(SharedCacheImageInfo(
|
||||
|
||||
@ -210,7 +210,7 @@ ConnectionStatus ConnectionFileDescriptor::Disconnect(Status *error_ptr) {
|
||||
"{0}: Couldn't get the lock, sent 'q' to {1}, error = '{2}'.",
|
||||
this, m_pipe.GetWriteFileDescriptor(), err);
|
||||
consumeError(std::move(err));
|
||||
} else if (log) {
|
||||
} else {
|
||||
LLDB_LOGF(log,
|
||||
"%p ConnectionFileDescriptor::Disconnect(): Couldn't get the "
|
||||
"lock, but no command pipe is available.",
|
||||
@ -271,13 +271,11 @@ size_t ConnectionFileDescriptor::Read(void *dst, size_t dst_len,
|
||||
size_t bytes_read = dst_len;
|
||||
error = m_io_sp->Read(dst, bytes_read);
|
||||
|
||||
if (log) {
|
||||
LLDB_LOG(log,
|
||||
"{0} ConnectionFileDescriptor::Read() fd = {1}"
|
||||
", dst = {2}, dst_len = {3}) => {4}, error = {5}",
|
||||
this, m_io_sp->GetWaitableHandle(), dst, dst_len, bytes_read,
|
||||
error.AsCString());
|
||||
}
|
||||
LLDB_LOG(log,
|
||||
"{0} ConnectionFileDescriptor::Read() fd = {1}"
|
||||
", dst = {2}, dst_len = {3}) => {4}, error = {5}",
|
||||
this, m_io_sp->GetWaitableHandle(), dst, dst_len, bytes_read,
|
||||
error.AsCString());
|
||||
|
||||
if (bytes_read == 0) {
|
||||
error.Clear(); // End-of-file. Do not automatically close; pass along for
|
||||
@ -373,13 +371,11 @@ size_t ConnectionFileDescriptor::Write(const void *src, size_t src_len,
|
||||
size_t bytes_sent = src_len;
|
||||
error = m_io_sp->Write(src, bytes_sent);
|
||||
|
||||
if (log) {
|
||||
LLDB_LOG(log,
|
||||
"{0} ConnectionFileDescriptor::Write(fd = {1}"
|
||||
", src = {2}, src_len = {3}) => {4} (error = {5})",
|
||||
this, m_io_sp->GetWaitableHandle(), src, src_len, bytes_sent,
|
||||
error.AsCString());
|
||||
}
|
||||
LLDB_LOG(log,
|
||||
"{0} ConnectionFileDescriptor::Write(fd = {1}"
|
||||
", src = {2}, src_len = {3}) => {4} (error = {5})",
|
||||
this, m_io_sp->GetWaitableHandle(), src, src_len, bytes_sent,
|
||||
error.AsCString());
|
||||
|
||||
if (error_ptr)
|
||||
*error_ptr = error.Clone();
|
||||
|
||||
@ -690,14 +690,12 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::ReadMemoryModule(
|
||||
// something has gone wrong and we should discard it.
|
||||
if (m_uuid.IsValid()) {
|
||||
if (m_uuid != memory_module_sp->GetUUID()) {
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"KextImageInfo::ReadMemoryModule the kernel said to find "
|
||||
"uuid %s at 0x%" PRIx64
|
||||
" but instead we found uuid %s, throwing it away",
|
||||
m_uuid.GetAsString().c_str(), m_load_address,
|
||||
memory_module_sp->GetUUID().GetAsString().c_str());
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"KextImageInfo::ReadMemoryModule the kernel said to find "
|
||||
"uuid %s at 0x%" PRIx64
|
||||
" but instead we found uuid %s, throwing it away",
|
||||
m_uuid.GetAsString().c_str(), m_load_address,
|
||||
memory_module_sp->GetUUID().GetAsString().c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -710,12 +708,9 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::ReadMemoryModule(
|
||||
m_memory_module_sp = memory_module_sp;
|
||||
m_kernel_image = this_is_kernel;
|
||||
if (this_is_kernel) {
|
||||
if (log) {
|
||||
// This is unusual and probably not intended
|
||||
LLDB_LOGF(log,
|
||||
"KextImageInfo::ReadMemoryModule read the kernel binary out "
|
||||
"of memory");
|
||||
}
|
||||
// This is unusual and probably not intended
|
||||
LLDB_LOGF(log, "KextImageInfo::ReadMemoryModule read the kernel binary out "
|
||||
"of memory");
|
||||
if (memory_module_sp->GetArchitecture().IsValid()) {
|
||||
process->GetTarget().SetArchitecture(memory_module_sp->GetArchitecture());
|
||||
}
|
||||
@ -1362,20 +1357,18 @@ bool DynamicLoaderDarwinKernel::ParseKextSummaries(
|
||||
}
|
||||
}
|
||||
|
||||
if (log) {
|
||||
if (load_kexts) {
|
||||
LLDB_LOGF(log,
|
||||
"DynamicLoaderDarwinKernel::ParseKextSummaries: %d kexts "
|
||||
"added, %d kexts removed",
|
||||
number_of_new_kexts_being_added,
|
||||
number_of_old_kexts_being_removed);
|
||||
} else {
|
||||
LLDB_LOGF(log,
|
||||
"DynamicLoaderDarwinKernel::ParseKextSummaries kext loading is "
|
||||
"disabled, else would have %d kexts added, %d kexts removed",
|
||||
number_of_new_kexts_being_added,
|
||||
number_of_old_kexts_being_removed);
|
||||
}
|
||||
if (load_kexts) {
|
||||
LLDB_LOGF(log,
|
||||
"DynamicLoaderDarwinKernel::ParseKextSummaries: %d kexts "
|
||||
"added, %d kexts removed",
|
||||
number_of_new_kexts_being_added,
|
||||
number_of_old_kexts_being_removed);
|
||||
} else {
|
||||
LLDB_LOGF(log,
|
||||
"DynamicLoaderDarwinKernel::ParseKextSummaries kext loading is "
|
||||
"disabled, else would have %d kexts added, %d kexts removed",
|
||||
number_of_new_kexts_being_added,
|
||||
number_of_old_kexts_being_removed);
|
||||
}
|
||||
|
||||
// Build up a list of <kext-name, uuid> for any kexts that fail to load
|
||||
|
||||
@ -364,13 +364,11 @@ void DynamicLoaderHexagonDYLD::RefreshModules() {
|
||||
new_modules.Append(module_sp);
|
||||
}
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "Target is loading '%s'", I->path.c_str());
|
||||
if (!module_sp.get())
|
||||
LLDB_LOGF(log, "LLDB failed to load '%s'", I->path.c_str());
|
||||
else
|
||||
LLDB_LOGF(log, "LLDB successfully loaded '%s'", I->path.c_str());
|
||||
}
|
||||
LLDB_LOGF(log, "Target is loading '%s'", I->path.c_str());
|
||||
if (!module_sp.get())
|
||||
LLDB_LOGF(log, "LLDB failed to load '%s'", I->path.c_str());
|
||||
else
|
||||
LLDB_LOGF(log, "LLDB successfully loaded '%s'", I->path.c_str());
|
||||
}
|
||||
m_process->GetTarget().ModulesDidLoad(new_modules);
|
||||
}
|
||||
|
||||
@ -655,7 +655,7 @@ std::optional<lldb_private::Address> DynamicLoaderDarwin::GetStartAddress() {
|
||||
Log *log = GetLog(LLDBLog::DynamicLoader);
|
||||
|
||||
auto log_err = [log](llvm::StringLiteral err_msg) -> std::nullopt_t {
|
||||
LLDB_LOGV(log, "{}", err_msg);
|
||||
LLDB_LOG_VERBOSE(log, "{}", err_msg);
|
||||
return std::nullopt;
|
||||
};
|
||||
|
||||
@ -846,17 +846,14 @@ bool DynamicLoaderDarwin::AlwaysRelyOnEHUnwindInfo(SymbolContext &sym_ctx) {
|
||||
// Dump a Segment to the file handle provided.
|
||||
void DynamicLoaderDarwin::Segment::PutToLog(Log *log,
|
||||
lldb::addr_t slide) const {
|
||||
if (log) {
|
||||
if (slide == 0)
|
||||
LLDB_LOGF(log, "\t\t%16s [0x%16.16" PRIx64 " - 0x%16.16" PRIx64 ")",
|
||||
name.AsCString(""), vmaddr + slide, vmaddr + slide + vmsize);
|
||||
else
|
||||
LLDB_LOGF(log,
|
||||
"\t\t%16s [0x%16.16" PRIx64 " - 0x%16.16" PRIx64
|
||||
") slide = 0x%" PRIx64,
|
||||
name.AsCString(""), vmaddr + slide, vmaddr + slide + vmsize,
|
||||
slide);
|
||||
}
|
||||
if (slide == 0)
|
||||
LLDB_LOGF(log, "\t\t%16s [0x%16.16" PRIx64 " - 0x%16.16" PRIx64 ")",
|
||||
name.AsCString(""), vmaddr + slide, vmaddr + slide + vmsize);
|
||||
else
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"\t\t%16s [0x%16.16" PRIx64 " - 0x%16.16" PRIx64 ") slide = 0x%" PRIx64,
|
||||
name.AsCString(""), vmaddr + slide, vmaddr + slide + vmsize, slide);
|
||||
}
|
||||
|
||||
lldb_private::ArchSpec DynamicLoaderDarwin::ImageInfo::GetArchitecture() const {
|
||||
|
||||
@ -193,8 +193,9 @@ TagDecl *ClangASTSource::FindCompleteType(const TagDecl *decl) {
|
||||
if (!namespace_map)
|
||||
return nullptr;
|
||||
|
||||
LLDB_LOGV(log, " CTD Inspecting namespace map{0:x} ({1} entries)",
|
||||
namespace_map.get(), namespace_map->size());
|
||||
LLDB_LOG_VERBOSE(log,
|
||||
" CTD Inspecting namespace map{0:x} ({1} entries)",
|
||||
namespace_map.get(), namespace_map->size());
|
||||
|
||||
for (const ClangASTImporter::NamespaceMapItem &item : *namespace_map) {
|
||||
LLDB_LOG(log, " CTD Searching namespace {0} in module {1}",
|
||||
@ -262,15 +263,13 @@ TagDecl *ClangASTSource::FindCompleteType(const TagDecl *decl) {
|
||||
void ClangASTSource::CompleteType(TagDecl *tag_decl) {
|
||||
Log *log = GetLog(LLDBLog::Expressions);
|
||||
|
||||
if (log) {
|
||||
LLDB_LOG(log,
|
||||
" CompleteTagDecl on (ASTContext*){0} Completing "
|
||||
"(TagDecl*){1:x} named {2}",
|
||||
m_clang_ast_context->getDisplayName(), tag_decl,
|
||||
tag_decl->getName());
|
||||
LLDB_LOG(log,
|
||||
" CompleteTagDecl on (ASTContext*){0} Completing "
|
||||
"(TagDecl*){1:x} named {2}",
|
||||
m_clang_ast_context->getDisplayName(), tag_decl,
|
||||
tag_decl->getName());
|
||||
|
||||
LLDB_LOG(log, " CTD Before:\n{0}", ClangUtil::DumpDecl(tag_decl));
|
||||
}
|
||||
LLDB_LOG(log, " CTD Before:\n{0}", ClangUtil::DumpDecl(tag_decl));
|
||||
|
||||
auto iter = m_active_lexical_decls.find(tag_decl);
|
||||
if (iter != m_active_lexical_decls.end())
|
||||
@ -541,9 +540,9 @@ void ClangASTSource::FindExternalVisibleDecls(NameSearchContext &context) {
|
||||
}
|
||||
|
||||
if (!context.m_namespace_map->empty()) {
|
||||
if (log && log->GetVerbose())
|
||||
LLDB_LOG(log, " CAS::FEVD Registering namespace map {0:x} ({1} entries)",
|
||||
context.m_namespace_map.get(), context.m_namespace_map->size());
|
||||
LLDB_LOG_VERBOSE(
|
||||
log, " CAS::FEVD Registering namespace map {0:x} ({1} entries)",
|
||||
context.m_namespace_map.get(), context.m_namespace_map->size());
|
||||
|
||||
NamespaceDecl *clang_namespace_decl = AddNamespace(context);
|
||||
|
||||
@ -1329,8 +1328,9 @@ void ClangASTSource::LookupInNamespace(NameSearchContext &context) {
|
||||
ClangASTImporter::NamespaceMapSP namespace_map =
|
||||
m_ast_importer_sp->GetNamespaceMap(namespace_context);
|
||||
|
||||
LLDB_LOGV(log, " CAS::FEVD Inspecting namespace map {0:x} ({1} entries)",
|
||||
namespace_map.get(), namespace_map->size());
|
||||
LLDB_LOG_VERBOSE(log,
|
||||
" CAS::FEVD Inspecting namespace map {0:x} ({1} entries)",
|
||||
namespace_map.get(), namespace_map->size());
|
||||
|
||||
if (!namespace_map)
|
||||
return;
|
||||
|
||||
@ -705,8 +705,9 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
|
||||
if (!namespace_map)
|
||||
return;
|
||||
|
||||
LLDB_LOGV(log, " CEDM::FEVD Inspecting (NamespaceMap*){0:x} ({1} entries)",
|
||||
namespace_map.get(), namespace_map->size());
|
||||
LLDB_LOG_VERBOSE(
|
||||
log, " CEDM::FEVD Inspecting (NamespaceMap*){0:x} ({1} entries)",
|
||||
namespace_map.get(), namespace_map->size());
|
||||
|
||||
for (ClangASTImporter::NamespaceMapItem &n : *namespace_map) {
|
||||
LLDB_LOG(log, " CEDM::FEVD Searching namespace {0} in module {1}",
|
||||
|
||||
@ -776,18 +776,15 @@ ClangExpressionParser::ClangExpressionParser(
|
||||
if (auto *target_info = TargetInfo::CreateTargetInfo(
|
||||
m_compiler->getDiagnostics(),
|
||||
m_compiler->getInvocation().getTargetOpts())) {
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "Target datalayout string: '%s'",
|
||||
target_info->getDataLayoutString());
|
||||
LLDB_LOGF(log, "Target ABI: '%s'", target_info->getABI().str().c_str());
|
||||
LLDB_LOGF(log, "Target vector alignment: %d",
|
||||
target_info->getMaxVectorAlign());
|
||||
}
|
||||
LLDB_LOGF(log, "Target datalayout string: '%s'",
|
||||
target_info->getDataLayoutString());
|
||||
LLDB_LOGF(log, "Target ABI: '%s'", target_info->getABI().str().c_str());
|
||||
LLDB_LOGF(log, "Target vector alignment: %d",
|
||||
target_info->getMaxVectorAlign());
|
||||
m_compiler->setTarget(target_info);
|
||||
} else {
|
||||
if (log)
|
||||
LLDB_LOGF(log, "Failed to create TargetInfo for '%s'",
|
||||
m_compiler->getTargetOpts().Triple.c_str());
|
||||
LLDB_LOGF(log, "Failed to create TargetInfo for '%s'",
|
||||
m_compiler->getTargetOpts().Triple.c_str());
|
||||
|
||||
lldbassert(false && "Failed to create TargetInfo.");
|
||||
}
|
||||
|
||||
@ -506,8 +506,8 @@ CppModuleConfiguration GetModuleConfig(lldb::LanguageType language,
|
||||
files.GetSize());
|
||||
if (log && log->GetVerbose()) {
|
||||
for (auto &f : files)
|
||||
LLDB_LOGV(log, "[C++ module config] Analyzing support file: {0}",
|
||||
f.GetPath());
|
||||
LLDB_LOG_VERBOSE(log, "[C++ module config] Analyzing support file: {0}",
|
||||
f.GetPath());
|
||||
}
|
||||
|
||||
// Try to create a configuration from the files. If there is no valid
|
||||
|
||||
@ -130,14 +130,12 @@ ItaniumABIRuntime::GetTypeInfo(ValueObject &in_value,
|
||||
}
|
||||
}
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"0x%16.16" PRIx64
|
||||
": static-type = '%s' has multiple matching dynamic "
|
||||
"types, didn't find a C++ match\n",
|
||||
in_value.GetPointerValue().address,
|
||||
in_value.GetTypeName().AsCString());
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"0x%16.16" PRIx64
|
||||
": static-type = '%s' has multiple matching dynamic "
|
||||
"types, didn't find a C++ match\n",
|
||||
in_value.GetPointerValue().address,
|
||||
in_value.GetTypeName().AsCString());
|
||||
}
|
||||
if (type_info)
|
||||
SetDynamicTypeInfo(vtable_info.addr, type_info);
|
||||
|
||||
@ -747,7 +747,7 @@ void ClassDescriptorV2::iVarsStorage::fill(AppleObjCRuntimeV2 &runtime,
|
||||
return;
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
Log *log = GetLog(LLDBLog::Types);
|
||||
LLDB_LOGV(log, "class_name = {0}", descriptor.GetClassName());
|
||||
LLDB_LOG_VERBOSE(log, "class_name = {0}", descriptor.GetClassName());
|
||||
m_filled = true;
|
||||
ObjCLanguageRuntime::EncodingToTypeSP encoding_to_type_sp(
|
||||
runtime.GetEncodingToType());
|
||||
@ -762,16 +762,18 @@ void ClassDescriptorV2::iVarsStorage::fill(AppleObjCRuntimeV2 &runtime,
|
||||
uint64_t size) -> bool {
|
||||
const bool for_expression = false;
|
||||
const bool stop_loop = false;
|
||||
LLDB_LOGV(log, "name = {0}, encoding = {1}, offset_ptr = {2:x}, size = {3}",
|
||||
name, type, offset_ptr, size);
|
||||
LLDB_LOG_VERBOSE(
|
||||
log, "name = {0}, encoding = {1}, offset_ptr = {2:x}, size = {3}", name,
|
||||
type, offset_ptr, size);
|
||||
CompilerType ivar_type =
|
||||
encoding_to_type_sp->RealizeType(type, for_expression);
|
||||
if (ivar_type) {
|
||||
LLDB_LOGV(log,
|
||||
"name = {0}, encoding = {1}, offset_ptr = {2:x}, size = "
|
||||
"{3}, type_size = {4}",
|
||||
name, type, offset_ptr, size,
|
||||
expectedToOptional(ivar_type.GetByteSize(nullptr)).value_or(0));
|
||||
LLDB_LOG_VERBOSE(
|
||||
log,
|
||||
"name = {0}, encoding = {1}, offset_ptr = {2:x}, size = "
|
||||
"{3}, type_size = {4}",
|
||||
name, type, offset_ptr, size,
|
||||
expectedToOptional(ivar_type.GetByteSize(nullptr)).value_or(0));
|
||||
Scalar offset_scalar;
|
||||
Status error;
|
||||
const int offset_ptr_size = 4;
|
||||
@ -779,13 +781,13 @@ void ClassDescriptorV2::iVarsStorage::fill(AppleObjCRuntimeV2 &runtime,
|
||||
size_t read = process->ReadScalarIntegerFromMemory(
|
||||
offset_ptr, offset_ptr_size, is_signed, offset_scalar, error);
|
||||
if (error.Success() && 4 == read) {
|
||||
LLDB_LOGV(log, "offset_ptr = {0:x} --> {1}", offset_ptr,
|
||||
offset_scalar.SInt());
|
||||
LLDB_LOG_VERBOSE(log, "offset_ptr = {0:x} --> {1}", offset_ptr,
|
||||
offset_scalar.SInt());
|
||||
m_ivars.push_back(
|
||||
{ConstString(name), ivar_type, size, offset_scalar.SInt()});
|
||||
} else
|
||||
LLDB_LOGV(log, "offset_ptr = {0:x} --> read fail, read = %{1}",
|
||||
offset_ptr, read);
|
||||
LLDB_LOG_VERBOSE(log, "offset_ptr = {0:x} --> read fail, read = %{1}",
|
||||
offset_ptr, read);
|
||||
}
|
||||
return stop_loop;
|
||||
});
|
||||
|
||||
@ -36,14 +36,12 @@ public:
|
||||
Log *log(GetLog(
|
||||
LLDBLog::Expressions)); // FIXME - a more appropriate log channel?
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"AppleObjCExternalASTSource::FindExternalVisibleDeclsByName"
|
||||
" on (ASTContext*)%p Looking for %s in (%sDecl*)%p",
|
||||
static_cast<void *>(&decl_ctx->getParentASTContext()),
|
||||
name.getAsString().c_str(), decl_ctx->getDeclKindName(),
|
||||
static_cast<const void *>(decl_ctx));
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"AppleObjCExternalASTSource::FindExternalVisibleDeclsByName"
|
||||
" on (ASTContext*)%p Looking for %s in (%sDecl*)%p",
|
||||
static_cast<void *>(&decl_ctx->getParentASTContext()),
|
||||
name.getAsString().c_str(), decl_ctx->getDeclKindName(),
|
||||
static_cast<const void *>(decl_ctx));
|
||||
|
||||
do {
|
||||
const clang::ObjCInterfaceDecl *interface_decl =
|
||||
@ -89,24 +87,20 @@ public:
|
||||
Log *log(GetLog(
|
||||
LLDBLog::Expressions)); // FIXME - a more appropriate log channel?
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"AppleObjCExternalASTSource::CompleteType on "
|
||||
"(ASTContext*)%p Completing (ObjCInterfaceDecl*)%p named %s",
|
||||
static_cast<void *>(&interface_decl->getASTContext()),
|
||||
static_cast<void *>(interface_decl),
|
||||
interface_decl->getName().str().c_str());
|
||||
LLDB_LOGF(log,
|
||||
"AppleObjCExternalASTSource::CompleteType on "
|
||||
"(ASTContext*)%p Completing (ObjCInterfaceDecl*)%p named %s",
|
||||
static_cast<void *>(&interface_decl->getASTContext()),
|
||||
static_cast<void *>(interface_decl),
|
||||
interface_decl->getName().str().c_str());
|
||||
|
||||
LLDB_LOGF(log, " AOEAS::CT Before:");
|
||||
LLDB_LOG(log, " [CT] {0}", ClangUtil::DumpDecl(interface_decl));
|
||||
}
|
||||
LLDB_LOGF(log, " AOEAS::CT Before:");
|
||||
LLDB_LOG(log, " [CT] {0}", ClangUtil::DumpDecl(interface_decl));
|
||||
|
||||
m_decl_vendor.FinishDecl(interface_decl);
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(log, " [CT] After:");
|
||||
LLDB_LOG(log, " [CT] {0}", ClangUtil::DumpDecl(interface_decl));
|
||||
}
|
||||
LLDB_LOGF(log, " [CT] After:");
|
||||
LLDB_LOG(log, " [CT] {0}", ClangUtil::DumpDecl(interface_decl));
|
||||
}
|
||||
|
||||
bool layoutRecordType(
|
||||
@ -512,13 +506,10 @@ bool AppleObjCDeclVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl) {
|
||||
class_method_func, ivar_func))
|
||||
return false;
|
||||
|
||||
if (log) {
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"[AppleObjCDeclVendor::FinishDecl] Finished Objective-C interface");
|
||||
LLDB_LOGF(log,
|
||||
"[AppleObjCDeclVendor::FinishDecl] Finished Objective-C interface");
|
||||
|
||||
LLDB_LOG(log, " [AOTV::FD] {0}", ClangUtil::DumpDecl(interface_decl));
|
||||
}
|
||||
LLDB_LOG(log, " [AOTV::FD] {0}", ClangUtil::DumpDecl(interface_decl));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -380,12 +380,12 @@ void AppleObjCRuntimeV1::UpdateISAToDescriptorMapIfNeeded() {
|
||||
ClassDescriptorSP descriptor_sp(
|
||||
new ClassDescriptorV1(isa, process_sp));
|
||||
|
||||
if (log && log->GetVerbose())
|
||||
LLDB_LOGF(log,
|
||||
"AppleObjCRuntimeV1 added (ObjCISA)0x%" PRIx64
|
||||
" from _objc_debug_class_hash to "
|
||||
"isa->descriptor cache",
|
||||
isa);
|
||||
LLDB_LOGF_VERBOSE(
|
||||
log,
|
||||
"AppleObjCRuntimeV1 added (ObjCISA)0x%" PRIx64
|
||||
" from _objc_debug_class_hash to "
|
||||
"isa->descriptor cache",
|
||||
isa);
|
||||
|
||||
AddClass(isa, descriptor_sp);
|
||||
}
|
||||
@ -403,13 +403,12 @@ void AppleObjCRuntimeV1::UpdateISAToDescriptorMapIfNeeded() {
|
||||
ClassDescriptorSP descriptor_sp(
|
||||
new ClassDescriptorV1(isa, process_sp));
|
||||
|
||||
if (log && log->GetVerbose())
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"AppleObjCRuntimeV1 added (ObjCISA)0x%" PRIx64
|
||||
" from _objc_debug_class_hash to isa->descriptor "
|
||||
"cache",
|
||||
isa);
|
||||
LLDB_LOGF_VERBOSE(
|
||||
log,
|
||||
"AppleObjCRuntimeV1 added (ObjCISA)0x%" PRIx64
|
||||
" from _objc_debug_class_hash to isa->descriptor "
|
||||
"cache",
|
||||
isa);
|
||||
|
||||
AddClass(isa, descriptor_sp);
|
||||
}
|
||||
|
||||
@ -65,12 +65,10 @@ void ObjCLanguageRuntime::AddToMethodCache(lldb::addr_t class_addr,
|
||||
lldb::addr_t selector,
|
||||
lldb::addr_t impl_addr) {
|
||||
Log *log = GetLog(LLDBLog::Step);
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"Caching: class 0x%" PRIx64 " selector 0x%" PRIx64
|
||||
" implementation 0x%" PRIx64 ".",
|
||||
class_addr, selector, impl_addr);
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"Caching: class 0x%" PRIx64 " selector 0x%" PRIx64
|
||||
" implementation 0x%" PRIx64 ".",
|
||||
class_addr, selector, impl_addr);
|
||||
m_impl_cache.insert(std::pair<ClassAndSel, lldb::addr_t>(
|
||||
ClassAndSel(class_addr, selector), impl_addr));
|
||||
}
|
||||
|
||||
@ -325,10 +325,8 @@ Status MinidumpFileBuilder::AddModuleList() {
|
||||
Log *log = GetLog(LLDBLog::Object);
|
||||
llvm::handleAllErrors(
|
||||
std::move(mod_size_err), [&](const llvm::ErrorInfoBase &E) {
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "Unable to get the size of module %s: %s",
|
||||
module_name.c_str(), E.message().c_str());
|
||||
}
|
||||
LLDB_LOGF(log, "Unable to get the size of module %s: %s",
|
||||
module_name.c_str(), E.message().c_str());
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -40,21 +40,17 @@ bool PlatformDarwinDevice::UpdateSDKDirectoryInfosIfNeeded() {
|
||||
FileSystem::Instance().Resolve(sdk_sysroot_fspec);
|
||||
const SDKDirectoryInfo sdk_sysroot_directory_info(sdk_sysroot_fspec);
|
||||
m_sdk_directory_infos.push_back(sdk_sysroot_directory_info);
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"PlatformDarwinDevice::UpdateSDKDirectoryInfosIfNeeded added "
|
||||
"--sysroot SDK directory %s",
|
||||
m_sdk_sysroot.c_str());
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"PlatformDarwinDevice::UpdateSDKDirectoryInfosIfNeeded added "
|
||||
"--sysroot SDK directory %s",
|
||||
m_sdk_sysroot.c_str());
|
||||
return true;
|
||||
}
|
||||
const char *device_support_dir = GetDeviceSupportDirectory();
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"PlatformDarwinDevice::UpdateSDKDirectoryInfosIfNeeded Got "
|
||||
"DeviceSupport directory %s",
|
||||
device_support_dir);
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"PlatformDarwinDevice::UpdateSDKDirectoryInfosIfNeeded Got "
|
||||
"DeviceSupport directory %s",
|
||||
device_support_dir);
|
||||
if (device_support_dir) {
|
||||
const bool find_directories = true;
|
||||
const bool find_files = false;
|
||||
@ -75,12 +71,10 @@ bool PlatformDarwinDevice::UpdateSDKDirectoryInfosIfNeeded() {
|
||||
sdk_symbols_symlink_fspec.AppendPathComponent("Symbols");
|
||||
if (FileSystem::Instance().Exists(sdk_symbols_symlink_fspec)) {
|
||||
m_sdk_directory_infos.push_back(sdk_directory_info);
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"PlatformDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
|
||||
"added builtin SDK directory %s",
|
||||
sdk_symbols_symlink_fspec.GetPath().c_str());
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"PlatformDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
|
||||
"added builtin SDK directory %s",
|
||||
sdk_symbols_symlink_fspec.GetPath().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,12 +85,10 @@ bool PlatformDarwinDevice::UpdateSDKDirectoryInfosIfNeeded() {
|
||||
FileSpec local_sdk_cache(local_sdk_cache_str.c_str());
|
||||
FileSystem::Instance().Resolve(local_sdk_cache);
|
||||
if (FileSystem::Instance().Exists(local_sdk_cache)) {
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"PlatformDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
|
||||
"searching %s for additional SDKs",
|
||||
local_sdk_cache.GetPath().c_str());
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"PlatformDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
|
||||
"searching %s for additional SDKs",
|
||||
local_sdk_cache.GetPath().c_str());
|
||||
char path[PATH_MAX];
|
||||
if (local_sdk_cache.GetPath(path, sizeof(path))) {
|
||||
FileSystem::Instance().EnumerateDirectory(
|
||||
@ -107,13 +99,11 @@ bool PlatformDarwinDevice::UpdateSDKDirectoryInfosIfNeeded() {
|
||||
// First try for an exact match of major, minor and update
|
||||
for (uint32_t i = num_installed; i < num_sdk_infos; ++i) {
|
||||
m_sdk_directory_infos[i].user_cached = true;
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"PlatformDarwinDevice::"
|
||||
"UpdateSDKDirectoryInfosIfNeeded "
|
||||
"user SDK directory %s",
|
||||
m_sdk_directory_infos[i].directory.GetPath().c_str());
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"PlatformDarwinDevice::"
|
||||
"UpdateSDKDirectoryInfosIfNeeded "
|
||||
"user SDK directory %s",
|
||||
m_sdk_directory_infos[i].directory.GetPath().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -131,12 +121,10 @@ bool PlatformDarwinDevice::UpdateSDKDirectoryInfosIfNeeded() {
|
||||
sdk_symbols_symlink_fspec.AppendPathComponent("Symbols");
|
||||
if (FileSystem::Instance().Exists(sdk_symbols_symlink_fspec)) {
|
||||
m_sdk_directory_infos.push_back(sdk_directory_info);
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"PlatformDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
|
||||
"added env var SDK directory %s",
|
||||
sdk_symbols_symlink_fspec.GetPath().c_str());
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"PlatformDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
|
||||
"added env var SDK directory %s",
|
||||
sdk_symbols_symlink_fspec.GetPath().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -485,7 +485,7 @@ PlatformDarwinKernel::GetKernelsAndKextsInDirectoryHelper(
|
||||
|
||||
Log *log = GetLog(LLDBLog::Platform);
|
||||
|
||||
LLDB_LOGV(log, "PlatformDarwinKernel examining '{0}'", file_spec);
|
||||
LLDB_LOG_VERBOSE(log, "PlatformDarwinKernel examining '{0}'", file_spec);
|
||||
|
||||
PlatformDarwinKernel *thisp = (PlatformDarwinKernel *)baton;
|
||||
|
||||
@ -564,8 +564,8 @@ PlatformDarwinKernel::GetKernelsAndKextsInDirectoryHelper(
|
||||
// Don't recurse into dSYM/kext/bundle directories
|
||||
if (recurse && file_spec_extension != g_dsym_suffix &&
|
||||
file_spec_extension != g_kext_suffix) {
|
||||
LLDB_LOGV(log, "PlatformDarwinKernel descending into directory '{0}'",
|
||||
file_spec);
|
||||
LLDB_LOG_VERBOSE(
|
||||
log, "PlatformDarwinKernel descending into directory '{0}'", file_spec);
|
||||
return FileSystem::eEnumerateDirectoryResultEnter;
|
||||
} else {
|
||||
return FileSystem::eEnumerateDirectoryResultNext;
|
||||
|
||||
@ -111,10 +111,8 @@ Status PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file,
|
||||
local_file.SetFile(resolved_path, FileSpec::Style::native);
|
||||
FileSystem::Instance().Resolve(local_file);
|
||||
if (FileSystem::Instance().Exists(local_file)) {
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "Found a copy of %s in the DeviceSupport dir %s",
|
||||
platform_file_path, os_version_dir);
|
||||
}
|
||||
LLDB_LOGF(log, "Found a copy of %s in the DeviceSupport dir %s",
|
||||
platform_file_path, os_version_dir);
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -179,8 +177,8 @@ Status PlatformRemoteDarwinDevice::GetSharedModule(
|
||||
// directory using the OS build.
|
||||
const uint32_t connected_sdk_idx = GetConnectedSDKIndex();
|
||||
if (connected_sdk_idx < num_sdk_infos) {
|
||||
LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file,
|
||||
m_sdk_directory_infos[connected_sdk_idx].directory);
|
||||
LLDB_LOG_VERBOSE(log, "Searching for {0} in sdk path {1}", platform_file,
|
||||
m_sdk_directory_infos[connected_sdk_idx].directory);
|
||||
if (GetFileInSDK(platform_file_path, connected_sdk_idx,
|
||||
platform_module_spec.GetFileSpec())) {
|
||||
module_sp.reset();
|
||||
@ -196,8 +194,8 @@ Status PlatformRemoteDarwinDevice::GetSharedModule(
|
||||
// Try the last SDK index if it is set as most files from an SDK will tend
|
||||
// to be valid in that same SDK.
|
||||
if (m_last_module_sdk_idx < num_sdk_infos) {
|
||||
LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file,
|
||||
m_sdk_directory_infos[m_last_module_sdk_idx].directory);
|
||||
LLDB_LOG_VERBOSE(log, "Searching for {0} in sdk path {1}", platform_file,
|
||||
m_sdk_directory_infos[m_last_module_sdk_idx].directory);
|
||||
if (GetFileInSDK(platform_file_path, m_last_module_sdk_idx,
|
||||
platform_module_spec.GetFileSpec())) {
|
||||
module_sp.reset();
|
||||
@ -218,8 +216,8 @@ Status PlatformRemoteDarwinDevice::GetSharedModule(
|
||||
GetSDKIndexBySDKDirectoryInfo(current_sdk_info);
|
||||
if (current_sdk_idx < num_sdk_infos &&
|
||||
current_sdk_idx != m_last_module_sdk_idx) {
|
||||
LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file,
|
||||
m_sdk_directory_infos[current_sdk_idx].directory);
|
||||
LLDB_LOG_VERBOSE(log, "Searching for {0} in sdk path {1}", platform_file,
|
||||
m_sdk_directory_infos[current_sdk_idx].directory);
|
||||
if (GetFileInSDK(platform_file_path, current_sdk_idx,
|
||||
platform_module_spec.GetFileSpec())) {
|
||||
module_sp.reset();
|
||||
@ -238,8 +236,8 @@ Status PlatformRemoteDarwinDevice::GetSharedModule(
|
||||
// Skip the last module SDK index if we already searched it above
|
||||
continue;
|
||||
}
|
||||
LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file,
|
||||
m_sdk_directory_infos[sdk_idx].directory);
|
||||
LLDB_LOG_VERBOSE(log, "Searching for {0} in sdk path {1}", platform_file,
|
||||
m_sdk_directory_infos[sdk_idx].directory);
|
||||
if (GetFileInSDK(platform_file_path, sdk_idx,
|
||||
platform_module_spec.GetFileSpec())) {
|
||||
// printf ("sdk[%u]: '%s'\n", sdk_idx, local_file.GetPath().c_str());
|
||||
|
||||
@ -154,38 +154,38 @@ static void PtraceDisplayBytes(int &req, void *data, size_t data_size) {
|
||||
switch (req) {
|
||||
case PTRACE_POKETEXT: {
|
||||
DisplayBytes(buf, &data, 8);
|
||||
LLDB_LOGV(log, "PTRACE_POKETEXT {0}", buf.GetData());
|
||||
LLDB_LOG_VERBOSE(log, "PTRACE_POKETEXT {0}", buf.GetData());
|
||||
break;
|
||||
}
|
||||
case PTRACE_POKEDATA: {
|
||||
DisplayBytes(buf, &data, 8);
|
||||
LLDB_LOGV(log, "PTRACE_POKEDATA {0}", buf.GetData());
|
||||
LLDB_LOG_VERBOSE(log, "PTRACE_POKEDATA {0}", buf.GetData());
|
||||
break;
|
||||
}
|
||||
case PTRACE_POKEUSER: {
|
||||
DisplayBytes(buf, &data, 8);
|
||||
LLDB_LOGV(log, "PTRACE_POKEUSER {0}", buf.GetData());
|
||||
LLDB_LOG_VERBOSE(log, "PTRACE_POKEUSER {0}", buf.GetData());
|
||||
break;
|
||||
}
|
||||
case PTRACE_SETREGS: {
|
||||
DisplayBytes(buf, data, data_size);
|
||||
LLDB_LOGV(log, "PTRACE_SETREGS {0}", buf.GetData());
|
||||
LLDB_LOG_VERBOSE(log, "PTRACE_SETREGS {0}", buf.GetData());
|
||||
break;
|
||||
}
|
||||
case PTRACE_SETFPREGS: {
|
||||
DisplayBytes(buf, data, data_size);
|
||||
LLDB_LOGV(log, "PTRACE_SETFPREGS {0}", buf.GetData());
|
||||
LLDB_LOG_VERBOSE(log, "PTRACE_SETFPREGS {0}", buf.GetData());
|
||||
break;
|
||||
}
|
||||
case PTRACE_SETSIGINFO: {
|
||||
DisplayBytes(buf, data, sizeof(siginfo_t));
|
||||
LLDB_LOGV(log, "PTRACE_SETSIGINFO {0}", buf.GetData());
|
||||
LLDB_LOG_VERBOSE(log, "PTRACE_SETSIGINFO {0}", buf.GetData());
|
||||
break;
|
||||
}
|
||||
case PTRACE_SETREGSET: {
|
||||
// Extract iov_base from data, which is a pointer to the struct iovec
|
||||
DisplayBytes(buf, *(void **)data, data_size);
|
||||
LLDB_LOGV(log, "PTRACE_SETREGSET {0}", buf.GetData());
|
||||
LLDB_LOG_VERBOSE(log, "PTRACE_SETREGSET {0}", buf.GetData());
|
||||
break;
|
||||
}
|
||||
default: {}
|
||||
|
||||
@ -140,12 +140,10 @@ bool NativeThreadLinux::GetStopReason(ThreadStopInfo &stop_info,
|
||||
case eStateRunning:
|
||||
case eStateStepping:
|
||||
case eStateDetached:
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"NativeThreadLinux::%s tid %" PRIu64
|
||||
" in state %s cannot answer stop reason",
|
||||
__FUNCTION__, GetID(), StateAsCString(m_state));
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"NativeThreadLinux::%s tid %" PRIu64
|
||||
" in state %s cannot answer stop reason",
|
||||
__FUNCTION__, GetID(), StateAsCString(m_state));
|
||||
return false;
|
||||
}
|
||||
llvm_unreachable("unhandled StateType!");
|
||||
|
||||
@ -193,11 +193,12 @@ size_t CommunicationKDP::WaitForPacketWithTimeoutMicroSecondsNoLock(
|
||||
: std::chrono::microseconds(timeout_usec),
|
||||
status, &error);
|
||||
|
||||
LLDB_LOGV(log,
|
||||
"Read (buffer, sizeof(buffer), timeout_usec = 0x{0:x}, "
|
||||
"status = {1}, error = {2}) => bytes_read = {4}",
|
||||
timeout_usec, Communication::ConnectionStatusAsString(status),
|
||||
error, bytes_read);
|
||||
LLDB_LOG_VERBOSE(log,
|
||||
"Read (buffer, sizeof(buffer), timeout_usec = 0x{0:x}, "
|
||||
"status = {1}, error = {2}) => bytes_read = {4}",
|
||||
timeout_usec,
|
||||
Communication::ConnectionStatusAsString(status), error,
|
||||
bytes_read);
|
||||
|
||||
if (bytes_read > 0) {
|
||||
if (CheckForPacket(buffer, bytes_read, packet))
|
||||
|
||||
@ -495,7 +495,7 @@ bool ProcessKDP::DoUpdateThreadList(ThreadList &old_thread_list,
|
||||
ThreadList &new_thread_list) {
|
||||
// locker will keep a mutex locked until it goes out of scope
|
||||
Log *log = GetLog(KDPLog::Thread);
|
||||
LLDB_LOGV(log, "pid = {0}", GetID());
|
||||
LLDB_LOG_VERBOSE(log, "pid = {0}", GetID());
|
||||
|
||||
// Even though there is a CPU mask, it doesn't mean we can see each CPU
|
||||
// individually, there is really only one. Lets call this thread 1.
|
||||
|
||||
@ -233,9 +233,9 @@ void DebuggerThread::DebugLoop() {
|
||||
Log *log = GetLog(WindowsLog::Event);
|
||||
DEBUG_EVENT dbe = {};
|
||||
bool should_debug = true;
|
||||
LLDB_LOGV(log, "Entering WaitForDebugEvent loop");
|
||||
LLDB_LOG_VERBOSE(log, "Entering WaitForDebugEvent loop");
|
||||
while (should_debug) {
|
||||
LLDB_LOGV(log, "Calling WaitForDebugEvent");
|
||||
LLDB_LOG_VERBOSE(log, "Calling WaitForDebugEvent");
|
||||
BOOL wait_result = WaitForDebugEvent(&dbe, INFINITE);
|
||||
if (wait_result) {
|
||||
DWORD continue_status = DBG_CONTINUE;
|
||||
@ -287,9 +287,10 @@ void DebuggerThread::DebugLoop() {
|
||||
break;
|
||||
}
|
||||
|
||||
LLDB_LOGV(log, "calling ContinueDebugEvent({0}, {1}, {2}) on thread {3}.",
|
||||
dbe.dwProcessId, dbe.dwThreadId, continue_status,
|
||||
::GetCurrentThreadId());
|
||||
LLDB_LOG_VERBOSE(
|
||||
log, "calling ContinueDebugEvent({0}, {1}, {2}) on thread {3}.",
|
||||
dbe.dwProcessId, dbe.dwThreadId, continue_status,
|
||||
::GetCurrentThreadId());
|
||||
|
||||
::ContinueDebugEvent(dbe.dwProcessId, dbe.dwThreadId, continue_status);
|
||||
|
||||
|
||||
@ -470,11 +470,11 @@ Status ProcessDebugger::GetMemoryRegionInfo(lldb::addr_t vm_addr,
|
||||
info.SetMapped(MemoryRegionInfo::eNo);
|
||||
}
|
||||
|
||||
LLDB_LOGV(log,
|
||||
"Memory region info for address {0}: readable={1}, "
|
||||
"executable={2}, writable={3}",
|
||||
vm_addr, info.GetReadable(), info.GetExecutable(),
|
||||
info.GetWritable());
|
||||
LLDB_LOG_VERBOSE(log,
|
||||
"Memory region info for address {0}: readable={1}, "
|
||||
"executable={2}, writable={3}",
|
||||
vm_addr, info.GetReadable(), info.GetExecutable(),
|
||||
info.GetWritable());
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
@ -556,10 +556,11 @@ bool ProcessWindows::DoUpdateThreadList(ThreadList &old_thread_list,
|
||||
new_thread_list.AddThread(old_thread);
|
||||
++new_size;
|
||||
++continued_threads;
|
||||
LLDB_LOGV(log, "Thread {0} was running and is still running.",
|
||||
old_thread_id);
|
||||
LLDB_LOG_VERBOSE(log, "Thread {0} was running and is still running.",
|
||||
old_thread_id);
|
||||
} else {
|
||||
LLDB_LOGV(log, "Thread {0} was running and has exited.", old_thread_id);
|
||||
LLDB_LOG_VERBOSE(log, "Thread {0} was running and has exited.",
|
||||
old_thread_id);
|
||||
++exited_threads;
|
||||
}
|
||||
}
|
||||
@ -570,7 +571,8 @@ bool ProcessWindows::DoUpdateThreadList(ThreadList &old_thread_list,
|
||||
new_thread_list.AddThread(thread_info.second);
|
||||
++new_size;
|
||||
++new_threads;
|
||||
LLDB_LOGV(log, "Thread {0} is new since last update.", thread_info.first);
|
||||
LLDB_LOG_VERBOSE(log, "Thread {0} is new since last update.",
|
||||
thread_info.first);
|
||||
}
|
||||
|
||||
LLDB_LOG(log, "{0} new threads, {1} old threads, {2} exited threads.",
|
||||
|
||||
@ -306,10 +306,9 @@ void ProcessElfCore::UpdateBuildIdForNTFileEntries() {
|
||||
// Assert that either the path is not in the map or the UUID matches
|
||||
assert(m_uuids.count(entry.path) == 0 || m_uuids[entry.path] == uuid);
|
||||
m_uuids[entry.path] = uuid;
|
||||
if (log)
|
||||
LLDB_LOGF(log, "%s found UUID @ %16.16" PRIx64 ": %s \"%s\"",
|
||||
__FUNCTION__, entry.start, uuid.GetAsString().c_str(),
|
||||
entry.path.c_str());
|
||||
LLDB_LOGF(log, "%s found UUID @ %16.16" PRIx64 ": %s \"%s\"",
|
||||
__FUNCTION__, entry.start, uuid.GetAsString().c_str(),
|
||||
entry.path.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -547,10 +546,8 @@ static void ParseFreeBSDPrStatus(ThreadData &thread_data,
|
||||
int pr_version = data.GetU32(&offset);
|
||||
|
||||
Log *log = GetLog(LLDBLog::Process);
|
||||
if (log) {
|
||||
if (pr_version > 1)
|
||||
LLDB_LOGF(log, "FreeBSD PRSTATUS unexpected version %d", pr_version);
|
||||
}
|
||||
if (pr_version > 1)
|
||||
LLDB_LOGF(log, "FreeBSD PRSTATUS unexpected version %d", pr_version);
|
||||
|
||||
// Skip padding, pr_statussz, pr_gregsetsz, pr_fpregsetsz, pr_osreldate
|
||||
if (lp64)
|
||||
@ -575,10 +572,8 @@ static void ParseFreeBSDPrPsInfo(ProcessElfCore &process,
|
||||
int pr_version = data.GetU32(&offset);
|
||||
|
||||
Log *log = GetLog(LLDBLog::Process);
|
||||
if (log) {
|
||||
if (pr_version > 1)
|
||||
LLDB_LOGF(log, "FreeBSD PRPSINFO unexpected version %d", pr_version);
|
||||
}
|
||||
if (pr_version > 1)
|
||||
LLDB_LOGF(log, "FreeBSD PRPSINFO unexpected version %d", pr_version);
|
||||
|
||||
// Skip pr_psinfosz, pr_fname, pr_psargs
|
||||
offset += 108;
|
||||
|
||||
@ -245,11 +245,11 @@ GDBRemoteCommunication::WaitForPacketNoLock(StringExtractorGDBRemote &packet,
|
||||
lldb::ConnectionStatus status = eConnectionStatusNoConnection;
|
||||
size_t bytes_read = Read(buffer, sizeof(buffer), timeout, status, &error);
|
||||
|
||||
LLDB_LOGV(log,
|
||||
"Read(buffer, sizeof(buffer), timeout = {0}, "
|
||||
"status = {1}, error = {2}) => bytes_read = {3}",
|
||||
timeout, Communication::ConnectionStatusAsString(status), error,
|
||||
bytes_read);
|
||||
LLDB_LOG_VERBOSE(log,
|
||||
"Read(buffer, sizeof(buffer), timeout = {0}, "
|
||||
"status = {1}, error = {2}) => bytes_read = {3}",
|
||||
timeout, Communication::ConnectionStatusAsString(status),
|
||||
error, bytes_read);
|
||||
|
||||
if (bytes_read > 0) {
|
||||
if (CheckForPacket(buffer, bytes_read, packet) != PacketType::Invalid)
|
||||
|
||||
@ -466,13 +466,11 @@ void GDBRemoteCommunicationServerLLGS::InitializeDelegate(
|
||||
NativeProcessProtocol *process) {
|
||||
assert(process && "process cannot be NULL");
|
||||
Log *log = GetLog(LLDBLog::Process);
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"GDBRemoteCommunicationServerLLGS::%s called with "
|
||||
"NativeProcessProtocol pid %" PRIu64 ", current state: %s",
|
||||
__FUNCTION__, process->GetID(),
|
||||
StateAsCString(process->GetState()));
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"GDBRemoteCommunicationServerLLGS::%s called with "
|
||||
"NativeProcessProtocol pid %" PRIu64 ", current state: %s",
|
||||
__FUNCTION__, process->GetID(),
|
||||
StateAsCString(process->GetState()));
|
||||
}
|
||||
|
||||
GDBRemoteCommunication::PacketResult
|
||||
@ -804,14 +802,12 @@ GetJSONThreadsInfo(NativeProcessProtocol &process, bool abridged) {
|
||||
return llvm::createStringError("failed to get stop reason");
|
||||
|
||||
const int signum = tid_stop_info.signo;
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
|
||||
" tid %" PRIu64
|
||||
" got signal signo = %d, reason = %d, exc_type = %" PRIu64,
|
||||
__FUNCTION__, process.GetID(), tid, signum,
|
||||
tid_stop_info.reason, tid_stop_info.details.exception.type);
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
|
||||
" tid %" PRIu64
|
||||
" got signal signo = %d, reason = %d, exc_type = %" PRIu64,
|
||||
__FUNCTION__, process.GetID(), tid, signum, tid_stop_info.reason,
|
||||
tid_stop_info.details.exception.type);
|
||||
|
||||
json::Object thread_obj;
|
||||
|
||||
@ -1157,12 +1153,10 @@ void GDBRemoteCommunicationServerLLGS::ProcessStateChanged(
|
||||
NativeProcessProtocol *process, lldb::StateType state) {
|
||||
assert(process && "process cannot be NULL");
|
||||
Log *log = GetLog(LLDBLog::Process);
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"GDBRemoteCommunicationServerLLGS::%s called with "
|
||||
"NativeProcessProtocol pid %" PRIu64 ", state: %s",
|
||||
__FUNCTION__, process->GetID(), StateAsCString(state));
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"GDBRemoteCommunicationServerLLGS::%s called with "
|
||||
"NativeProcessProtocol pid %" PRIu64 ", state: %s",
|
||||
__FUNCTION__, process->GetID(), StateAsCString(state));
|
||||
|
||||
switch (state) {
|
||||
case StateType::eStateRunning:
|
||||
@ -1188,12 +1182,10 @@ void GDBRemoteCommunicationServerLLGS::ProcessStateChanged(
|
||||
break;
|
||||
|
||||
default:
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"GDBRemoteCommunicationServerLLGS::%s didn't handle state "
|
||||
"change for pid %" PRIu64 ", new state: %s",
|
||||
__FUNCTION__, process->GetID(), StateAsCString(state));
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"GDBRemoteCommunicationServerLLGS::%s didn't handle state "
|
||||
"change for pid %" PRIu64 ", new state: %s",
|
||||
__FUNCTION__, process->GetID(), StateAsCString(state));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -714,20 +714,17 @@ Status ProcessGDBRemote::DoLaunch(lldb_private::Module *exe_module,
|
||||
stderr_file_spec = file_action->GetFileSpec();
|
||||
}
|
||||
|
||||
if (log) {
|
||||
if (stdin_file_spec || stdout_file_spec || stderr_file_spec)
|
||||
LLDB_LOGF(log,
|
||||
"ProcessGDBRemote::%s provided with STDIO paths via "
|
||||
"launch_info: stdin=%s, stdout=%s, stderr=%s",
|
||||
__FUNCTION__,
|
||||
stdin_file_spec ? stdin_file_spec.GetPath().c_str() : "<null>",
|
||||
stdout_file_spec ? stdout_file_spec.GetPath().c_str() : "<null>",
|
||||
stderr_file_spec ? stderr_file_spec.GetPath().c_str() : "<null>");
|
||||
else
|
||||
LLDB_LOGF(log,
|
||||
"ProcessGDBRemote::%s no STDIO paths given via launch_info",
|
||||
__FUNCTION__);
|
||||
}
|
||||
if (stdin_file_spec || stdout_file_spec || stderr_file_spec)
|
||||
LLDB_LOGF(log,
|
||||
"ProcessGDBRemote::%s provided with STDIO paths via "
|
||||
"launch_info: stdin=%s, stdout=%s, stderr=%s",
|
||||
__FUNCTION__,
|
||||
stdin_file_spec ? stdin_file_spec.GetPath().c_str() : "<null>",
|
||||
stdout_file_spec ? stdout_file_spec.GetPath().c_str() : "<null>",
|
||||
stderr_file_spec ? stderr_file_spec.GetPath().c_str() : "<null>");
|
||||
else
|
||||
LLDB_LOGF(log, "ProcessGDBRemote::%s no STDIO paths given via launch_info",
|
||||
__FUNCTION__);
|
||||
|
||||
const bool disable_stdio = (launch_flags & eLaunchFlagDisableSTDIO) != 0;
|
||||
if (stdin_file_spec || disable_stdio) {
|
||||
@ -1639,7 +1636,7 @@ bool ProcessGDBRemote::DoUpdateThreadList(ThreadList &old_thread_list,
|
||||
ThreadList &new_thread_list) {
|
||||
// locker will keep a mutex locked until it goes out of scope
|
||||
Log *log = GetLog(GDBRLog::Thread);
|
||||
LLDB_LOGV(log, "pid = {0}", GetID());
|
||||
LLDB_LOG_VERBOSE(log, "pid = {0}", GetID());
|
||||
|
||||
size_t num_thread_ids = m_thread_ids.size();
|
||||
// The "m_thread_ids" thread ID list should always be updated after each stop
|
||||
@ -1658,11 +1655,11 @@ bool ProcessGDBRemote::DoUpdateThreadList(ThreadList &old_thread_list,
|
||||
old_thread_list_copy.RemoveThreadByProtocolID(tid, false));
|
||||
if (!thread_sp) {
|
||||
thread_sp = CreateThread(tid);
|
||||
LLDB_LOGV(log, "Making new thread: {0} for thread ID: {1:x}.",
|
||||
thread_sp.get(), thread_sp->GetID());
|
||||
LLDB_LOG_VERBOSE(log, "Making new thread: {0} for thread ID: {1:x}.",
|
||||
thread_sp.get(), thread_sp->GetID());
|
||||
} else {
|
||||
LLDB_LOGV(log, "Found old thread: {0} for thread ID: {1:x}.",
|
||||
thread_sp.get(), thread_sp->GetID());
|
||||
LLDB_LOG_VERBOSE(log, "Found old thread: {0} for thread ID: {1:x}.",
|
||||
thread_sp.get(), thread_sp->GetID());
|
||||
}
|
||||
|
||||
SetThreadPc(thread_sp, i);
|
||||
@ -4131,8 +4128,7 @@ Status ProcessGDBRemote::UpdateAutomaticSignalFiltering() {
|
||||
bool ProcessGDBRemote::StartNoticingNewThreads() {
|
||||
Log *log = GetLog(LLDBLog::Step);
|
||||
if (m_thread_create_bp_sp) {
|
||||
if (log && log->GetVerbose())
|
||||
LLDB_LOGF(log, "Enabled noticing new thread breakpoint.");
|
||||
LLDB_LOGF_VERBOSE(log, "Enabled noticing new thread breakpoint.");
|
||||
m_thread_create_bp_sp->SetEnabled(true);
|
||||
} else {
|
||||
PlatformSP platform_sp(GetTarget().GetPlatform());
|
||||
@ -4140,10 +4136,9 @@ bool ProcessGDBRemote::StartNoticingNewThreads() {
|
||||
m_thread_create_bp_sp =
|
||||
platform_sp->SetThreadCreationBreakpoint(GetTarget());
|
||||
if (m_thread_create_bp_sp) {
|
||||
if (log && log->GetVerbose())
|
||||
LLDB_LOGF(
|
||||
log, "Successfully created new thread notification breakpoint %i",
|
||||
m_thread_create_bp_sp->GetID());
|
||||
LLDB_LOGF_VERBOSE(
|
||||
log, "Successfully created new thread notification breakpoint %i",
|
||||
m_thread_create_bp_sp->GetID());
|
||||
m_thread_create_bp_sp->SetCallback(
|
||||
ProcessGDBRemote::NewThreadNotifyBreakpointHit, this, true);
|
||||
} else {
|
||||
@ -4156,8 +4151,7 @@ bool ProcessGDBRemote::StartNoticingNewThreads() {
|
||||
|
||||
bool ProcessGDBRemote::StopNoticingNewThreads() {
|
||||
Log *log = GetLog(LLDBLog::Step);
|
||||
if (log && log->GetVerbose())
|
||||
LLDB_LOGF(log, "Disabling new thread notification breakpoint.");
|
||||
LLDB_LOGF_VERBOSE(log, "Disabling new thread notification breakpoint.");
|
||||
|
||||
if (m_thread_create_bp_sp)
|
||||
m_thread_create_bp_sp->SetEnabled(false);
|
||||
@ -5349,9 +5343,8 @@ llvm::Expected<LoadedModuleInfoList> ProcessGDBRemote::GetLoadedModuleList() {
|
||||
// node
|
||||
});
|
||||
|
||||
if (log)
|
||||
LLDB_LOGF(log, "found %" PRId32 " modules in total",
|
||||
(int)list.m_list.size());
|
||||
LLDB_LOGF(log, "found %" PRId32 " modules in total",
|
||||
(int)list.m_list.size());
|
||||
return list;
|
||||
} else if (comm.GetQXferLibrariesReadSupported()) {
|
||||
// request the loaded library list
|
||||
@ -5409,9 +5402,8 @@ llvm::Expected<LoadedModuleInfoList> ProcessGDBRemote::GetLoadedModuleList() {
|
||||
// node
|
||||
});
|
||||
|
||||
if (log)
|
||||
LLDB_LOGF(log, "found %" PRId32 " modules in total",
|
||||
(int)list.m_list.size());
|
||||
LLDB_LOGF(log, "found %" PRId32 " modules in total",
|
||||
(int)list.m_list.size());
|
||||
return list;
|
||||
} else {
|
||||
return llvm::createStringError(llvm::inconvertibleErrorCode(),
|
||||
@ -5738,15 +5730,13 @@ ParseStructuredDataPacket(llvm::StringRef packet) {
|
||||
Log *log = GetLog(GDBRLog::Process);
|
||||
|
||||
if (!packet.consume_front(s_async_json_packet_prefix)) {
|
||||
if (log) {
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"GDBRemoteCommunicationClientBase::%s() received $J packet "
|
||||
"but was not a StructuredData packet: packet starts with "
|
||||
"%s",
|
||||
__FUNCTION__,
|
||||
packet.slice(0, strlen(s_async_json_packet_prefix)).str().c_str());
|
||||
}
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"GDBRemoteCommunicationClientBase::%s() received $J packet "
|
||||
"but was not a StructuredData packet: packet starts with "
|
||||
"%s",
|
||||
__FUNCTION__,
|
||||
packet.slice(0, strlen(s_async_json_packet_prefix)).str().c_str());
|
||||
return StructuredData::ObjectSP();
|
||||
}
|
||||
|
||||
|
||||
@ -134,16 +134,17 @@ public:
|
||||
|
||||
m_was_already_initialized = true;
|
||||
m_gil_state = gil_state;
|
||||
LLDB_LOGV(GetLog(LLDBLog::Script),
|
||||
"Ensured PyGILState. Previous state = {0}",
|
||||
m_gil_state == PyGILState_UNLOCKED ? "unlocked" : "locked");
|
||||
LLDB_LOG_VERBOSE(
|
||||
GetLog(LLDBLog::Script), "Ensured PyGILState. Previous state = {0}",
|
||||
m_gil_state == PyGILState_UNLOCKED ? "unlocked" : "locked");
|
||||
}
|
||||
|
||||
~InitializePythonRAII() {
|
||||
if (m_was_already_initialized) {
|
||||
LLDB_LOGV(GetLog(LLDBLog::Script),
|
||||
"Releasing PyGILState. Returning to state = {0}",
|
||||
m_gil_state == PyGILState_UNLOCKED ? "unlocked" : "locked");
|
||||
LLDB_LOG_VERBOSE(GetLog(LLDBLog::Script),
|
||||
"Releasing PyGILState. Returning to state = {0}",
|
||||
m_gil_state == PyGILState_UNLOCKED ? "unlocked"
|
||||
: "locked");
|
||||
PyGILState_Release(m_gil_state);
|
||||
} else {
|
||||
// We initialized the threads in this function, just unlock the GIL.
|
||||
@ -330,8 +331,9 @@ ScriptInterpreterPythonImpl::Locker::Locker(
|
||||
|
||||
bool ScriptInterpreterPythonImpl::Locker::DoAcquireLock() {
|
||||
m_GILState = PyGILState_Ensure();
|
||||
LLDB_LOGV(GetLog(LLDBLog::Script), "Ensured PyGILState. Previous state = {0}",
|
||||
m_GILState == PyGILState_UNLOCKED ? "unlocked" : "locked");
|
||||
LLDB_LOG_VERBOSE(GetLog(LLDBLog::Script),
|
||||
"Ensured PyGILState. Previous state = {0}",
|
||||
m_GILState == PyGILState_UNLOCKED ? "unlocked" : "locked");
|
||||
|
||||
// we need to save the thread state when we first start the command because
|
||||
// we might decide to interrupt it while some action is taking place outside
|
||||
@ -352,9 +354,9 @@ bool ScriptInterpreterPythonImpl::Locker::DoInitSession(uint16_t on_entry_flags,
|
||||
}
|
||||
|
||||
bool ScriptInterpreterPythonImpl::Locker::DoFreeLock() {
|
||||
LLDB_LOGV(GetLog(LLDBLog::Script),
|
||||
"Releasing PyGILState. Returning to state = {0}",
|
||||
m_GILState == PyGILState_UNLOCKED ? "unlocked" : "locked");
|
||||
LLDB_LOG_VERBOSE(GetLog(LLDBLog::Script),
|
||||
"Releasing PyGILState. Returning to state = {0}",
|
||||
m_GILState == PyGILState_UNLOCKED ? "unlocked" : "locked");
|
||||
PyGILState_Release(m_GILState);
|
||||
m_python_interpreter->DecrementLockCount();
|
||||
return true;
|
||||
|
||||
@ -1804,18 +1804,16 @@ void StructuredDataDarwinLog::EnableNow() {
|
||||
// care of the rest.
|
||||
auto &interpreter = debugger_sp->GetCommandInterpreter();
|
||||
const bool success = RunEnableCommand(interpreter);
|
||||
if (log) {
|
||||
if (success)
|
||||
LLDB_LOGF(log,
|
||||
"StructuredDataDarwinLog::%s() ran enable command "
|
||||
"successfully for (process uid %u)",
|
||||
__FUNCTION__, process_sp->GetUniqueID());
|
||||
else
|
||||
LLDB_LOGF(log,
|
||||
"StructuredDataDarwinLog::%s() error: running "
|
||||
"enable command failed (process uid %u)",
|
||||
__FUNCTION__, process_sp->GetUniqueID());
|
||||
}
|
||||
if (success)
|
||||
LLDB_LOGF(log,
|
||||
"StructuredDataDarwinLog::%s() ran enable command "
|
||||
"successfully for (process uid %u)",
|
||||
__FUNCTION__, process_sp->GetUniqueID());
|
||||
else
|
||||
LLDB_LOGF(log,
|
||||
"StructuredDataDarwinLog::%s() error: running "
|
||||
"enable command failed (process uid %u)",
|
||||
__FUNCTION__, process_sp->GetUniqueID());
|
||||
Debugger::ReportError("failed to configure DarwinLog support",
|
||||
debugger_sp->GetID());
|
||||
return;
|
||||
|
||||
@ -1013,8 +1013,8 @@ lldb_private::Type *SymbolFileCTF::ResolveTypeUID(lldb::user_id_t type_uid) {
|
||||
if (log) {
|
||||
StreamString ss;
|
||||
type_sp->Dump(&ss, true);
|
||||
LLDB_LOGV(log, "Adding type {0}: {1}", type_sp->GetID(),
|
||||
llvm::StringRef(ss.GetString()).rtrim());
|
||||
LLDB_LOG_VERBOSE(log, "Adding type {0}: {1}", type_sp->GetID(),
|
||||
llvm::StringRef(ss.GetString()).rtrim());
|
||||
}
|
||||
|
||||
m_types[type_uid] = type_sp;
|
||||
|
||||
@ -480,10 +480,8 @@ static bool LocateDSYMInVincinityOfExecutable(const ModuleSpec &module_spec,
|
||||
if (exec_fspec) {
|
||||
if (::LookForDsymNextToExecutablePath(module_spec, exec_fspec,
|
||||
dsym_fspec)) {
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "dSYM with matching UUID & arch found at %s",
|
||||
dsym_fspec.GetPath().c_str());
|
||||
}
|
||||
LLDB_LOGF(log, "dSYM with matching UUID & arch found at %s",
|
||||
dsym_fspec.GetPath().c_str());
|
||||
return true;
|
||||
} else {
|
||||
FileSpec parent_dirs = exec_fspec;
|
||||
@ -512,10 +510,8 @@ static bool LocateDSYMInVincinityOfExecutable(const ModuleSpec &module_spec,
|
||||
if (::strchr(fn, '.') != nullptr) {
|
||||
if (::LookForDsymNextToExecutablePath(module_spec, parent_dirs,
|
||||
dsym_fspec)) {
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "dSYM with matching UUID & arch found at %s",
|
||||
dsym_fspec.GetPath().c_str());
|
||||
}
|
||||
LLDB_LOGF(log, "dSYM with matching UUID & arch found at %s",
|
||||
dsym_fspec.GetPath().c_str());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,9 +194,9 @@ GetFileForModule(const ModuleSpec &module_spec,
|
||||
|
||||
Log *log = GetLog(LLDBLog::Symbols);
|
||||
auto err_message = llvm::toString(result.takeError());
|
||||
LLDB_LOGV(log,
|
||||
"Debuginfod failed to download symbol artifact {0} with error {1}",
|
||||
url_path, err_message);
|
||||
LLDB_LOG_VERBOSE(
|
||||
log, "Debuginfod failed to download symbol artifact {0} with error {1}",
|
||||
url_path, err_message);
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
@ -120,14 +120,15 @@ std::optional<FileSpec> SymbolLocatorSymStore::LocateExecutableSymbolFile(
|
||||
std::string pdb_name =
|
||||
module_spec.GetSymbolFileSpec().GetFilename().GetStringRef().str();
|
||||
if (pdb_name.empty()) {
|
||||
LLDB_LOGV(log, "Failed to resolve symbol PDB module: PDB name empty");
|
||||
LLDB_LOG_VERBOSE(log,
|
||||
"Failed to resolve symbol PDB module: PDB name empty");
|
||||
return {};
|
||||
}
|
||||
|
||||
LLDB_LOGV(log, "LocateExecutableSymbolFile {0} with UUID {1}", pdb_name,
|
||||
uuid.GetAsString());
|
||||
LLDB_LOG_VERBOSE(log, "LocateExecutableSymbolFile {0} with UUID {1}",
|
||||
pdb_name, uuid.GetAsString());
|
||||
if (uuid.GetBytes().size() != 20) {
|
||||
LLDB_LOGV(log, "Failed to resolve symbol PDB module: UUID invalid");
|
||||
LLDB_LOG_VERBOSE(log, "Failed to resolve symbol PDB module: UUID invalid");
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -138,7 +139,7 @@ std::optional<FileSpec> SymbolLocatorSymStore::LocateExecutableSymbolFile(
|
||||
llvm::sys::path::append(path, url.ref(), pdb_name, key, pdb_name);
|
||||
FileSpec spec(path);
|
||||
if (FileSystem::Instance().Exists(spec)) {
|
||||
LLDB_LOGV(log, "Found {0} in SymStore {1}", pdb_name, url.ref());
|
||||
LLDB_LOG_VERBOSE(log, "Found {0} in SymStore {1}", pdb_name, url.ref());
|
||||
return spec;
|
||||
}
|
||||
}
|
||||
|
||||
@ -318,13 +318,14 @@ lldb::addr_t AllocatedBlock::ReserveBlock(uint32_t size) {
|
||||
free_block.SetRangeBase(reserved_block.GetRangeEnd());
|
||||
free_block.SetByteSize(bytes_left);
|
||||
}
|
||||
LLDB_LOGV(log, "({0}) (size = {1} ({1:x})) => {2:x}", this, size, addr);
|
||||
LLDB_LOG_VERBOSE(log, "({0}) (size = {1} ({1:x})) => {2:x}", this, size,
|
||||
addr);
|
||||
return addr;
|
||||
}
|
||||
}
|
||||
|
||||
LLDB_LOGV(log, "({0}) (size = {1} ({1:x})) => {2:x}", this, size,
|
||||
LLDB_INVALID_ADDRESS);
|
||||
LLDB_LOG_VERBOSE(log, "({0}) (size = {1} ({1:x})) => {2:x}", this, size,
|
||||
LLDB_INVALID_ADDRESS);
|
||||
return LLDB_INVALID_ADDRESS;
|
||||
}
|
||||
|
||||
@ -338,7 +339,7 @@ bool AllocatedBlock::FreeBlock(addr_t addr) {
|
||||
success = true;
|
||||
}
|
||||
Log *log = GetLog(LLDBLog::Process);
|
||||
LLDB_LOGV(log, "({0}) (addr = {1:x}) => {2}", this, addr, success);
|
||||
LLDB_LOG_VERBOSE(log, "({0}) (addr = {1:x}) => {2}", this, addr, success);
|
||||
return success;
|
||||
}
|
||||
|
||||
@ -368,13 +369,11 @@ AllocatedMemoryCache::AllocatePage(uint32_t byte_size, uint32_t permissions,
|
||||
addr_t addr = m_process.DoAllocateMemory(page_byte_size, permissions, error);
|
||||
|
||||
Log *log = GetLog(LLDBLog::Process);
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"Process::DoAllocateMemory (byte_size = 0x%8.8" PRIx32
|
||||
", permissions = %s) => 0x%16.16" PRIx64,
|
||||
(uint32_t)page_byte_size, GetPermissionsAsCString(permissions),
|
||||
(uint64_t)addr);
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"Process::DoAllocateMemory (byte_size = 0x%8.8" PRIx32
|
||||
", permissions = %s) => 0x%16.16" PRIx64,
|
||||
(uint32_t)page_byte_size, GetPermissionsAsCString(permissions),
|
||||
(uint64_t)addr);
|
||||
|
||||
if (addr != LLDB_INVALID_ADDRESS) {
|
||||
block_sp = std::make_shared<AllocatedBlock>(addr, page_byte_size,
|
||||
|
||||
@ -957,14 +957,11 @@ Event *Process::PeekAtStateChangedEvents() {
|
||||
Event *event_ptr;
|
||||
event_ptr = GetPrimaryListener()->PeekAtNextEventForBroadcasterWithType(
|
||||
this, eBroadcastBitStateChanged);
|
||||
if (log) {
|
||||
if (event_ptr) {
|
||||
LLDB_LOGF(log, "Process::%s (event_ptr) => %s", __FUNCTION__,
|
||||
StateAsCString(ProcessEventData::GetStateFromEvent(event_ptr)));
|
||||
} else {
|
||||
LLDB_LOGF(log, "Process::%s no events found", __FUNCTION__);
|
||||
}
|
||||
}
|
||||
if (event_ptr)
|
||||
LLDB_LOGF(log, "Process::%s (event_ptr) => %s", __FUNCTION__,
|
||||
StateAsCString(ProcessEventData::GetStateFromEvent(event_ptr)));
|
||||
else
|
||||
LLDB_LOGF(log, "Process::%s no events found", __FUNCTION__);
|
||||
return event_ptr;
|
||||
}
|
||||
|
||||
@ -4078,14 +4075,11 @@ void Process::HandlePrivateEvent(EventSP &event_sp) {
|
||||
|
||||
if (should_broadcast) {
|
||||
const bool is_hijacked = IsHijackedForEvent(eBroadcastBitStateChanged);
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"Process::%s (pid = %" PRIu64
|
||||
") broadcasting new state %s (old state %s) to %s",
|
||||
__FUNCTION__, GetID(), StateAsCString(new_state),
|
||||
StateAsCString(GetState()),
|
||||
is_hijacked ? "hijacked" : "public");
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"Process::%s (pid = %" PRIu64
|
||||
") broadcasting new state %s (old state %s) to %s",
|
||||
__FUNCTION__, GetID(), StateAsCString(new_state),
|
||||
StateAsCString(GetState()), is_hijacked ? "hijacked" : "public");
|
||||
Process::ProcessEventData::SetUpdateStateOnRemoval(event_sp.get());
|
||||
if (StateIsRunningState(new_state)) {
|
||||
// Only push the input handler if we aren't fowarding events, as this
|
||||
@ -4137,14 +4131,12 @@ void Process::HandlePrivateEvent(EventSP &event_sp) {
|
||||
|
||||
BroadcastEvent(event_sp);
|
||||
} else {
|
||||
if (log) {
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"Process::%s (pid = %" PRIu64
|
||||
") suppressing state %s (old state %s): should_broadcast == false",
|
||||
__FUNCTION__, GetID(), StateAsCString(new_state),
|
||||
StateAsCString(GetState()));
|
||||
}
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"Process::%s (pid = %" PRIu64
|
||||
") suppressing state %s (old state %s): should_broadcast == false",
|
||||
__FUNCTION__, GetID(), StateAsCString(new_state),
|
||||
StateAsCString(GetState()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -4264,7 +4256,7 @@ thread_result_t Process::RunPrivateStateThread() {
|
||||
ProcessEventData::SetInterruptedInEvent(event_sp.get(), true);
|
||||
}
|
||||
interrupt_requested = false;
|
||||
} else if (log) {
|
||||
} else {
|
||||
LLDB_LOGF(log,
|
||||
"Process::%s interrupt_requested, but a non-stopped "
|
||||
"state '%s' received.",
|
||||
|
||||
@ -68,9 +68,10 @@ bool SectionLoadList::SetSectionLoadAddress(const lldb::SectionSP §ion,
|
||||
ModuleSP module_sp(section->GetModule());
|
||||
|
||||
if (module_sp) {
|
||||
LLDB_LOGV(log, "(section = {0} ({1}.{2}), load_addr = {3:x}) module = {4}",
|
||||
section.get(), module_sp->GetFileSpec(), section->GetName(),
|
||||
load_addr, module_sp.get());
|
||||
LLDB_LOG_VERBOSE(
|
||||
log, "(section = {0} ({1}.{2}), load_addr = {3:x}) module = {4}",
|
||||
section.get(), module_sp->GetFileSpec(), section->GetName(), load_addr,
|
||||
module_sp.get());
|
||||
|
||||
if (section->GetByteSize() == 0)
|
||||
return false; // No change
|
||||
@ -131,14 +132,12 @@ bool SectionLoadList::SetSectionLoadAddress(const lldb::SectionSP §ion,
|
||||
return true; // Changed
|
||||
|
||||
} else {
|
||||
if (log) {
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"SectionLoadList::%s (section = %p (%s), load_addr = 0x%16.16" PRIx64
|
||||
") error: module has been deleted",
|
||||
__FUNCTION__, static_cast<void *>(section.get()),
|
||||
section->GetName().AsCString(), load_addr);
|
||||
}
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"SectionLoadList::%s (section = %p (%s), load_addr = 0x%16.16" PRIx64
|
||||
") error: module has been deleted",
|
||||
__FUNCTION__, static_cast<void *>(section.get()),
|
||||
section->GetName().AsCString(), load_addr);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -118,11 +118,9 @@ uint32_t StackFrameList::GetCurrentInlinedDepth() {
|
||||
if (cur_pc != m_current_inlined_pc) {
|
||||
m_current_inlined_pc = LLDB_INVALID_ADDRESS;
|
||||
m_current_inlined_depth = UINT32_MAX;
|
||||
Log *log = GetLog(LLDBLog::Step);
|
||||
if (log && log->GetVerbose())
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"GetCurrentInlinedDepth: invalidating current inlined depth.\n");
|
||||
LLDB_LOGF_VERBOSE(
|
||||
GetLog(LLDBLog::Step),
|
||||
"GetCurrentInlinedDepth: invalidating current inlined depth.\n");
|
||||
}
|
||||
return m_current_inlined_depth;
|
||||
} else {
|
||||
@ -147,19 +145,16 @@ void StackFrameList::ResetCurrentInlinedDepth() {
|
||||
m_current_inlined_depth = *inline_depth;
|
||||
m_current_inlined_pc = m_thread.GetRegisterContext()->GetPC();
|
||||
|
||||
if (log && log->GetVerbose())
|
||||
LLDB_LOGF(log,
|
||||
"ResetCurrentInlinedDepth: setting inlined "
|
||||
"depth: %d 0x%" PRIx64 ".\n",
|
||||
m_current_inlined_depth, m_current_inlined_pc);
|
||||
LLDB_LOGF_VERBOSE(log,
|
||||
"ResetCurrentInlinedDepth: setting inlined "
|
||||
"depth: %d 0x%" PRIx64 ".\n",
|
||||
m_current_inlined_depth, m_current_inlined_pc);
|
||||
} else {
|
||||
std::lock_guard<std::mutex> guard(m_inlined_depth_mutex);
|
||||
m_current_inlined_pc = LLDB_INVALID_ADDRESS;
|
||||
m_current_inlined_depth = UINT32_MAX;
|
||||
if (log && log->GetVerbose())
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"ResetCurrentInlinedDepth: Invalidating current inlined depth.\n");
|
||||
LLDB_LOGF_VERBOSE(
|
||||
log, "ResetCurrentInlinedDepth: Invalidating current inlined depth.\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,31 +205,33 @@ static void FindInterveningFrames(Function &begin, Function &end,
|
||||
ExecutionContext &exe_ctx, Target &target,
|
||||
addr_t return_pc, CallSequence &path,
|
||||
ModuleList &images, Log *log) {
|
||||
LLDB_LOGV(log, "Finding frames between {0} and {1}, retn-pc={2:x}",
|
||||
begin.GetDisplayName(), end.GetDisplayName(), return_pc);
|
||||
LLDB_LOG_VERBOSE(log, "Finding frames between {0} and {1}, retn-pc={2:x}",
|
||||
begin.GetDisplayName(), end.GetDisplayName(), return_pc);
|
||||
|
||||
// Find a non-tail calling edge with the correct return PC.
|
||||
if (log)
|
||||
for (const auto &edge : begin.GetCallEdges())
|
||||
LLDB_LOGV(log, "FindInterveningFrames: found call with retn-PC = {0:x}",
|
||||
edge->GetReturnPCAddress(begin, target));
|
||||
LLDB_LOG_VERBOSE(log,
|
||||
"FindInterveningFrames: found call with retn-PC = {0:x}",
|
||||
edge->GetReturnPCAddress(begin, target));
|
||||
CallEdge *first_edge = begin.GetCallEdgeForReturnAddress(return_pc, target);
|
||||
if (!first_edge) {
|
||||
LLDB_LOGV(log, "No call edge outgoing from {0} with retn-PC == {1:x}",
|
||||
begin.GetDisplayName(), return_pc);
|
||||
LLDB_LOG_VERBOSE(log,
|
||||
"No call edge outgoing from {0} with retn-PC == {1:x}",
|
||||
begin.GetDisplayName(), return_pc);
|
||||
return;
|
||||
}
|
||||
|
||||
// The first callee may not be resolved, or there may be nothing to fill in.
|
||||
Function *first_callee = first_edge->GetCallee(images, exe_ctx);
|
||||
if (!first_callee) {
|
||||
LLDB_LOGV(log, "Could not resolve callee");
|
||||
LLDB_LOG_VERBOSE(log, "Could not resolve callee");
|
||||
return;
|
||||
}
|
||||
if (first_callee == &end) {
|
||||
LLDB_LOGV(log,
|
||||
"Not searching further, first callee is {0} (retn-PC: {1:x})",
|
||||
end.GetDisplayName(), return_pc);
|
||||
LLDB_LOG_VERBOSE(
|
||||
log, "Not searching further, first callee is {0} (retn-PC: {1:x})",
|
||||
end.GetDisplayName(), return_pc);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -329,9 +329,7 @@ protected:
|
||||
|
||||
if (!thread_sp->IsValid()) {
|
||||
// This shouldn't ever happen, but just in case, don't do more harm.
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "PerformAction got called with an invalid thread.");
|
||||
}
|
||||
LLDB_LOGF(log, "PerformAction got called with an invalid thread.");
|
||||
m_should_stop = true;
|
||||
m_should_stop_is_valid = true;
|
||||
return;
|
||||
@ -485,13 +483,11 @@ protected:
|
||||
// not all of them valid for this thread. Skip the ones that
|
||||
// aren't:
|
||||
if (!bp_loc_sp->ValidForThisThread(*thread_sp)) {
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"Breakpoint %s hit on thread 0x%llx but it was not "
|
||||
"for this thread, continuing.",
|
||||
loc_desc.GetData(),
|
||||
static_cast<unsigned long long>(thread_sp->GetID()));
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"Breakpoint %s hit on thread 0x%llx but it was not "
|
||||
"for this thread, continuing.",
|
||||
loc_desc.GetData(),
|
||||
static_cast<unsigned long long>(thread_sp->GetID()));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -1142,10 +1142,8 @@ void Thread::PushPlan(ThreadPlanSP thread_plan_sp) {
|
||||
void Thread::PopPlan() {
|
||||
Log *log = GetLog(LLDBLog::Step);
|
||||
ThreadPlanSP popped_plan_sp = GetPlans().PopPlan();
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "Popping plan: \"%s\", tid = 0x%4.4" PRIx64 ".",
|
||||
popped_plan_sp->GetName(), popped_plan_sp->GetThread().GetID());
|
||||
}
|
||||
LLDB_LOGF(log, "Popping plan: \"%s\", tid = 0x%4.4" PRIx64 ".",
|
||||
popped_plan_sp->GetName(), popped_plan_sp->GetThread().GetID());
|
||||
}
|
||||
|
||||
void Thread::DiscardPlan() {
|
||||
@ -1260,12 +1258,10 @@ void Thread::DiscardThreadPlansUpToPlan(ThreadPlan *up_to_plan_ptr) {
|
||||
|
||||
void Thread::DiscardThreadPlans(bool force) {
|
||||
Log *log = GetLog(LLDBLog::Step);
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"Discarding thread plans for thread (tid = 0x%4.4" PRIx64
|
||||
", force %d)",
|
||||
GetID(), force);
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"Discarding thread plans for thread (tid = 0x%4.4" PRIx64
|
||||
", force %d)",
|
||||
GetID(), force);
|
||||
|
||||
if (force) {
|
||||
GetPlans().DiscardAllPlans();
|
||||
|
||||
@ -476,11 +476,10 @@ void ThreadList::RefreshStateAfterStop() {
|
||||
|
||||
m_process.UpdateThreadListIfNeeded();
|
||||
|
||||
Log *log = GetLog(LLDBLog::Step);
|
||||
if (log && log->GetVerbose())
|
||||
LLDB_LOGF(log,
|
||||
"Turning off notification of new threads while single stepping "
|
||||
"a thread.");
|
||||
LLDB_LOGF_VERBOSE(
|
||||
GetLog(LLDBLog::Step),
|
||||
"Turning off notification of new threads while single stepping "
|
||||
"a thread.");
|
||||
|
||||
collection::iterator pos, end = m_threads.end();
|
||||
for (pos = m_threads.begin(); pos != end; ++pos)
|
||||
@ -692,16 +691,14 @@ bool ThreadList::WillResume(RunDirection &direction) {
|
||||
}
|
||||
|
||||
if (thread_to_run != nullptr) {
|
||||
Log *log = GetLog(LLDBLog::Step);
|
||||
if (log && log->GetVerbose())
|
||||
LLDB_LOGF(log, "Turning on notification of new threads while single "
|
||||
"stepping a thread.");
|
||||
LLDB_LOGF_VERBOSE(GetLog(LLDBLog::Step),
|
||||
"Turning on notification of new threads while single "
|
||||
"stepping a thread.");
|
||||
m_process.StartNoticingNewThreads();
|
||||
} else {
|
||||
Log *log = GetLog(LLDBLog::Step);
|
||||
if (log && log->GetVerbose())
|
||||
LLDB_LOGF(log, "Turning off notification of new threads while single "
|
||||
"stepping a thread.");
|
||||
LLDB_LOGF_VERBOSE(GetLog(LLDBLog::Step),
|
||||
"Turning off notification of new threads while single "
|
||||
"stepping a thread.");
|
||||
m_process.StopNoticingNewThreads();
|
||||
}
|
||||
|
||||
|
||||
@ -182,14 +182,12 @@ bool ThreadPlanStepInRange::ShouldStop(Event *event_ptr) {
|
||||
// Otherwise check the ShouldStopHere for step out:
|
||||
m_sub_plan_sp =
|
||||
CheckShouldStopHereAndQueueStepOut(frame_order, m_status);
|
||||
if (log) {
|
||||
if (m_sub_plan_sp)
|
||||
LLDB_LOGF(log,
|
||||
"ShouldStopHere found plan to step out of this frame.");
|
||||
else
|
||||
LLDB_LOGF(log, "ShouldStopHere no plan to step out of this frame.");
|
||||
}
|
||||
} else if (log) {
|
||||
if (m_sub_plan_sp)
|
||||
LLDB_LOGF(log,
|
||||
"ShouldStopHere found plan to step out of this frame.");
|
||||
else
|
||||
LLDB_LOGF(log, "ShouldStopHere no plan to step out of this frame.");
|
||||
} else {
|
||||
LLDB_LOGF(
|
||||
log, "Thought I stepped out, but in fact arrived at a trampoline.");
|
||||
}
|
||||
@ -223,13 +221,10 @@ bool ThreadPlanStepInRange::ShouldStop(Event *event_ptr) {
|
||||
m_sub_plan_sp = thread.QueueThreadPlanForStepThrough(
|
||||
m_stack_id, false, stop_others, m_status);
|
||||
|
||||
if (log) {
|
||||
if (m_sub_plan_sp)
|
||||
LLDB_LOGF(log, "Found a step through plan: %s",
|
||||
m_sub_plan_sp->GetName());
|
||||
else
|
||||
LLDB_LOGF(log, "No step through plan found.");
|
||||
}
|
||||
if (m_sub_plan_sp)
|
||||
LLDB_LOGF(log, "Found a step through plan: %s", m_sub_plan_sp->GetName());
|
||||
else
|
||||
LLDB_LOGF(log, "No step through plan found.");
|
||||
|
||||
// If not, give the "should_stop" callback a chance to push a plan to get
|
||||
// us out of here. But only do that if we actually have stepped in.
|
||||
|
||||
@ -116,11 +116,8 @@ bool ThreadPlanStepInstruction::IsPlanStale() {
|
||||
// done.
|
||||
return !m_step_over;
|
||||
} else {
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"ThreadPlanStepInstruction::IsPlanStale - Current frame is "
|
||||
"older than start frame, plan is stale.");
|
||||
}
|
||||
LLDB_LOGF(log, "ThreadPlanStepInstruction::IsPlanStale - Current frame is "
|
||||
"older than start frame, plan is stale.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -171,11 +168,8 @@ bool ThreadPlanStepInstruction::ShouldStop(Event *event_ptr) {
|
||||
parent_frame_sp->GetConcreteFrameIndex() ==
|
||||
cur_frame_sp->GetConcreteFrameIndex()) {
|
||||
SetPlanComplete();
|
||||
if (log) {
|
||||
LLDB_LOGF(log,
|
||||
"Frame we stepped into is inlined into the frame "
|
||||
"we were stepping from, stopping.");
|
||||
}
|
||||
LLDB_LOGF(log, "Frame we stepped into is inlined into the frame "
|
||||
"we were stepping from, stopping.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -466,8 +466,7 @@ bool ThreadPlanStepOut::MischiefManaged() {
|
||||
// we're done with this step out operation.
|
||||
|
||||
Log *log = GetLog(LLDBLog::Step);
|
||||
if (log)
|
||||
LLDB_LOGF(log, "Completed step out plan.");
|
||||
LLDB_LOGF(log, "Completed step out plan.");
|
||||
if (m_return_bp_id != LLDB_INVALID_BREAK_ID) {
|
||||
GetTarget().RemoveBreakpointByID(m_return_bp_id);
|
||||
m_return_bp_id = LLDB_INVALID_BREAK_ID;
|
||||
|
||||
@ -537,10 +537,8 @@ bool ThreadPlanStepRange::IsPlanStale() {
|
||||
FrameComparison frame_order = CompareCurrentFrameToStartFrame();
|
||||
|
||||
if (frame_order == eFrameCompareOlder) {
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "ThreadPlanStepRange::IsPlanStale returning true, we've "
|
||||
"stepped out.");
|
||||
}
|
||||
LLDB_LOGF(log, "ThreadPlanStepRange::IsPlanStale returning true, we've "
|
||||
"stepped out.");
|
||||
return true;
|
||||
} else if (frame_order == eFrameCompareEqual && InSymbol()) {
|
||||
// If we are not in a place we should step through, we've gotten stale. One
|
||||
|
||||
@ -62,10 +62,8 @@ ThreadPlanStepThrough::ThreadPlanStepThrough(Thread &thread,
|
||||
return_bp->SetBreakpointKind("step-through-backstop");
|
||||
}
|
||||
Log *log = GetLog(LLDBLog::Step);
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "Setting backstop breakpoint %d at address: 0x%" PRIx64,
|
||||
m_backstop_bkpt_id, m_backstop_addr);
|
||||
}
|
||||
LLDB_LOGF(log, "Setting backstop breakpoint %d at address: 0x%" PRIx64,
|
||||
m_backstop_bkpt_id, m_backstop_addr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,10 +103,8 @@ bool UnwindLLDB::AddFirstFrame() {
|
||||
|
||||
unwind_done:
|
||||
Log *log = GetLog(LLDBLog::Unwind);
|
||||
if (log) {
|
||||
LLDB_LOGF(log, "th%d Unwind of this thread is complete.",
|
||||
m_thread.GetIndexID());
|
||||
}
|
||||
LLDB_LOGF(log, "th%d Unwind of this thread is complete.",
|
||||
m_thread.GetIndexID());
|
||||
m_unwind_complete = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -71,12 +71,11 @@ uint32_t Listener::StartListeningForEvents(Broadcaster *broadcaster,
|
||||
broadcaster->AddListener(this->shared_from_this(), event_mask);
|
||||
|
||||
Log *log = GetLog(LLDBLog::Events);
|
||||
if (log != nullptr)
|
||||
LLDB_LOGF(log,
|
||||
"%p Listener::StartListeningForEvents (broadcaster = %p, "
|
||||
"mask = 0x%8.8x) acquired_mask = 0x%8.8x for %s",
|
||||
static_cast<void *>(this), static_cast<void *>(broadcaster),
|
||||
event_mask, acquired_mask, m_name.c_str());
|
||||
LLDB_LOGF(log,
|
||||
"%p Listener::StartListeningForEvents (broadcaster = %p, "
|
||||
"mask = 0x%8.8x) acquired_mask = 0x%8.8x for %s",
|
||||
static_cast<void *>(this), static_cast<void *>(broadcaster),
|
||||
event_mask, acquired_mask, m_name.c_str());
|
||||
|
||||
return acquired_mask;
|
||||
}
|
||||
@ -166,10 +165,9 @@ void Listener::BroadcasterManagerWillDestruct(BroadcasterManagerSP manager_sp) {
|
||||
|
||||
void Listener::AddEvent(EventSP &event_sp) {
|
||||
Log *log = GetLog(LLDBLog::Events);
|
||||
if (log != nullptr)
|
||||
LLDB_LOGF(log, "%p Listener('%s')::AddEvent (event_sp = {%p})",
|
||||
static_cast<void *>(this), m_name.c_str(),
|
||||
static_cast<void *>(event_sp.get()));
|
||||
LLDB_LOGF(log, "%p Listener('%s')::AddEvent (event_sp = {%p})",
|
||||
static_cast<void *>(this), m_name.c_str(),
|
||||
static_cast<void *>(event_sp.get()));
|
||||
|
||||
std::lock_guard<std::mutex> guard(m_events_mutex);
|
||||
m_events.push_back(event_sp);
|
||||
@ -205,14 +203,13 @@ bool Listener::FindNextEventInternal(
|
||||
if (pos != m_events.end()) {
|
||||
event_sp = *pos;
|
||||
|
||||
if (log != nullptr)
|
||||
LLDB_LOGF(log,
|
||||
"%p '%s' Listener::FindNextEventInternal(broadcaster=%p, "
|
||||
"event_type_mask=0x%8.8x, "
|
||||
"remove=%i) event %p",
|
||||
static_cast<void *>(this), GetName(),
|
||||
static_cast<void *>(broadcaster), event_type_mask, remove,
|
||||
static_cast<void *>(event_sp.get()));
|
||||
LLDB_LOGF(log,
|
||||
"%p '%s' Listener::FindNextEventInternal(broadcaster=%p, "
|
||||
"event_type_mask=0x%8.8x, "
|
||||
"remove=%i) event %p",
|
||||
static_cast<void *>(this), GetName(),
|
||||
static_cast<void *>(broadcaster), event_type_mask, remove,
|
||||
static_cast<void *>(event_sp.get()));
|
||||
|
||||
if (remove) {
|
||||
m_events.erase(pos);
|
||||
|
||||
@ -243,5 +243,5 @@ void StringList::LogDump(Log *log, const char *name) {
|
||||
if (name)
|
||||
strm.Printf("End %s.\n", name);
|
||||
|
||||
LLDB_LOGV(log, "{0}", strm.GetData());
|
||||
LLDB_LOG_VERBOSE(log, "{0}", strm.GetData());
|
||||
}
|
||||
|
||||
@ -371,7 +371,7 @@ TEST_F(LogChannelEnabledTest, LogVerboseThread) {
|
||||
|
||||
// Start logging on one thread. Concurrently, try enabling the log channel
|
||||
// (with different log options).
|
||||
std::thread log_thread([this] { LLDB_LOGV(getLog(), "Hello World"); });
|
||||
std::thread log_thread([this] { LLDB_LOG_VERBOSE(getLog(), "Hello World"); });
|
||||
EXPECT_TRUE(
|
||||
EnableChannel(getLogHandler(), LLDB_LOG_OPTION_VERBOSE, "chan", {}, err));
|
||||
log_thread.join();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user