[Logging] Replace Log::Printf with LLDB_LOG macro (NFC)
This patch replaces explicit calls to log::Printf with the new LLDB_LOGF
macro. The macro is similar to LLDB_LOG but supports printf-style format
strings, instead of formatv-style format strings.
So instead of writing:
if (log)
log->Printf("%s\n", str);
You'd write:
LLDB_LOG(log, "%s\n", str);
This change was done mechanically with the command below. I replaced the
spurious if-checks with vim, since I know how to do multi-line
replacements with it.
find . -type f -name '*.cpp' -exec \
sed -i '' -E 's/log->Printf\(/LLDB_LOGF\(log, /g' "{}" +
Differential revision: https://reviews.llvm.org/D65128
llvm-svn: 366936
This commit is contained in:
parent
2bf871be4c
commit
63e5fb76ec
190 changed files with 5362 additions and 5932 deletions
|
|
@ -142,6 +142,7 @@ public:
|
|||
std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
/// Prefer using LLDB_LOGF whenever possible.
|
||||
void Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
|
||||
|
||||
void Error(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||
|
|
@ -212,6 +213,13 @@ private:
|
|||
log_private->Format(__FILE__, __func__, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define LLDB_LOGF(log, ...) \
|
||||
do { \
|
||||
::lldb_private::Log *log_private = (log); \
|
||||
if (log_private) \
|
||||
log_private->Printf(__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define LLDB_LOGV(log, ...) \
|
||||
do { \
|
||||
::lldb_private::Log *log_private = (log); \
|
||||
|
|
|
|||
|
|
@ -680,13 +680,13 @@ lldb::SBTarget SBDebugger::CreateTarget(const char *filename,
|
|||
}
|
||||
|
||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
|
||||
if (log)
|
||||
log->Printf("SBDebugger(%p)::CreateTarget (filename=\"%s\", triple=%s, "
|
||||
"platform_name=%s, add_dependent_modules=%u, error=%s) => "
|
||||
"SBTarget(%p)",
|
||||
static_cast<void *>(m_opaque_sp.get()), filename, target_triple,
|
||||
platform_name, add_dependent_modules, sb_error.GetCString(),
|
||||
static_cast<void *>(target_sp.get()));
|
||||
LLDB_LOGF(log,
|
||||
"SBDebugger(%p)::CreateTarget (filename=\"%s\", triple=%s, "
|
||||
"platform_name=%s, add_dependent_modules=%u, error=%s) => "
|
||||
"SBTarget(%p)",
|
||||
static_cast<void *>(m_opaque_sp.get()), filename, target_triple,
|
||||
platform_name, add_dependent_modules, sb_error.GetCString(),
|
||||
static_cast<void *>(target_sp.get()));
|
||||
|
||||
return LLDB_RECORD_RESULT(sb_target);
|
||||
}
|
||||
|
|
@ -710,11 +710,11 @@ SBDebugger::CreateTargetWithFileAndTargetTriple(const char *filename,
|
|||
}
|
||||
|
||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
|
||||
if (log)
|
||||
log->Printf("SBDebugger(%p)::CreateTargetWithFileAndTargetTriple "
|
||||
"(filename=\"%s\", triple=%s) => SBTarget(%p)",
|
||||
static_cast<void *>(m_opaque_sp.get()), filename, target_triple,
|
||||
static_cast<void *>(target_sp.get()));
|
||||
LLDB_LOGF(log,
|
||||
"SBDebugger(%p)::CreateTargetWithFileAndTargetTriple "
|
||||
"(filename=\"%s\", triple=%s) => SBTarget(%p)",
|
||||
static_cast<void *>(m_opaque_sp.get()), filename, target_triple,
|
||||
static_cast<void *>(target_sp.get()));
|
||||
|
||||
return LLDB_RECORD_RESULT(sb_target);
|
||||
}
|
||||
|
|
@ -743,11 +743,11 @@ SBTarget SBDebugger::CreateTargetWithFileAndArch(const char *filename,
|
|||
}
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("SBDebugger(%p)::CreateTargetWithFileAndArch (filename=\"%s\", "
|
||||
"arch=%s) => SBTarget(%p)",
|
||||
static_cast<void *>(m_opaque_sp.get()), filename, arch_cstr,
|
||||
static_cast<void *>(target_sp.get()));
|
||||
LLDB_LOGF(log,
|
||||
"SBDebugger(%p)::CreateTargetWithFileAndArch (filename=\"%s\", "
|
||||
"arch=%s) => SBTarget(%p)",
|
||||
static_cast<void *>(m_opaque_sp.get()), filename, arch_cstr,
|
||||
static_cast<void *>(target_sp.get()));
|
||||
|
||||
return LLDB_RECORD_RESULT(sb_target);
|
||||
}
|
||||
|
|
@ -772,11 +772,10 @@ SBTarget SBDebugger::CreateTarget(const char *filename) {
|
|||
}
|
||||
}
|
||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
|
||||
if (log)
|
||||
log->Printf(
|
||||
"SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)",
|
||||
static_cast<void *>(m_opaque_sp.get()), filename,
|
||||
static_cast<void *>(target_sp.get()));
|
||||
LLDB_LOGF(log,
|
||||
"SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)",
|
||||
static_cast<void *>(m_opaque_sp.get()), filename,
|
||||
static_cast<void *>(target_sp.get()));
|
||||
return LLDB_RECORD_RESULT(sb_target);
|
||||
}
|
||||
|
||||
|
|
@ -788,11 +787,9 @@ SBTarget SBDebugger::GetDummyTarget() {
|
|||
sb_target.SetSP(m_opaque_sp->GetDummyTarget()->shared_from_this());
|
||||
}
|
||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
|
||||
if (log)
|
||||
log->Printf(
|
||||
"SBDebugger(%p)::GetDummyTarget() => SBTarget(%p)",
|
||||
static_cast<void *>(m_opaque_sp.get()),
|
||||
static_cast<void *>(sb_target.GetSP().get()));
|
||||
LLDB_LOGF(log, "SBDebugger(%p)::GetDummyTarget() => SBTarget(%p)",
|
||||
static_cast<void *>(m_opaque_sp.get()),
|
||||
static_cast<void *>(sb_target.GetSP().get()));
|
||||
return LLDB_RECORD_RESULT(sb_target);
|
||||
}
|
||||
|
||||
|
|
@ -814,10 +811,9 @@ bool SBDebugger::DeleteTarget(lldb::SBTarget &target) {
|
|||
}
|
||||
|
||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
|
||||
if (log)
|
||||
log->Printf("SBDebugger(%p)::DeleteTarget (SBTarget(%p)) => %i",
|
||||
static_cast<void *>(m_opaque_sp.get()),
|
||||
static_cast<void *>(target.m_opaque_sp.get()), result);
|
||||
LLDB_LOGF(log, "SBDebugger(%p)::DeleteTarget (SBTarget(%p)) => %i",
|
||||
static_cast<void *>(m_opaque_sp.get()),
|
||||
static_cast<void *>(target.m_opaque_sp.get()), result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -914,9 +910,9 @@ SBTarget SBDebugger::GetSelectedTarget() {
|
|||
if (log) {
|
||||
SBStream sstr;
|
||||
sb_target.GetDescription(sstr, eDescriptionLevelBrief);
|
||||
log->Printf("SBDebugger(%p)::GetSelectedTarget () => SBTarget(%p): %s",
|
||||
static_cast<void *>(m_opaque_sp.get()),
|
||||
static_cast<void *>(target_sp.get()), sstr.GetData());
|
||||
LLDB_LOGF(log, "SBDebugger(%p)::GetSelectedTarget () => SBTarget(%p): %s",
|
||||
static_cast<void *>(m_opaque_sp.get()),
|
||||
static_cast<void *>(target_sp.get()), sstr.GetData());
|
||||
}
|
||||
|
||||
return LLDB_RECORD_RESULT(sb_target);
|
||||
|
|
@ -935,9 +931,9 @@ void SBDebugger::SetSelectedTarget(SBTarget &sb_target) {
|
|||
if (log) {
|
||||
SBStream sstr;
|
||||
sb_target.GetDescription(sstr, eDescriptionLevelBrief);
|
||||
log->Printf("SBDebugger(%p)::SetSelectedTarget () => SBTarget(%p): %s",
|
||||
static_cast<void *>(m_opaque_sp.get()),
|
||||
static_cast<void *>(target_sp.get()), sstr.GetData());
|
||||
LLDB_LOGF(log, "SBDebugger(%p)::SetSelectedTarget () => SBTarget(%p): %s",
|
||||
static_cast<void *>(m_opaque_sp.get()),
|
||||
static_cast<void *>(target_sp.get()), sstr.GetData());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -951,11 +947,10 @@ SBPlatform SBDebugger::GetSelectedPlatform() {
|
|||
if (debugger_sp) {
|
||||
sb_platform.SetSP(debugger_sp->GetPlatformList().GetSelectedPlatform());
|
||||
}
|
||||
if (log)
|
||||
log->Printf("SBDebugger(%p)::GetSelectedPlatform () => SBPlatform(%p): %s",
|
||||
static_cast<void *>(m_opaque_sp.get()),
|
||||
static_cast<void *>(sb_platform.GetSP().get()),
|
||||
sb_platform.GetName());
|
||||
LLDB_LOGF(log, "SBDebugger(%p)::GetSelectedPlatform () => SBPlatform(%p): %s",
|
||||
static_cast<void *>(m_opaque_sp.get()),
|
||||
static_cast<void *>(sb_platform.GetSP().get()),
|
||||
sb_platform.GetName());
|
||||
return LLDB_RECORD_RESULT(sb_platform);
|
||||
}
|
||||
|
||||
|
|
@ -970,11 +965,10 @@ void SBDebugger::SetSelectedPlatform(SBPlatform &sb_platform) {
|
|||
debugger_sp->GetPlatformList().SetSelectedPlatform(sb_platform.GetSP());
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("SBDebugger(%p)::SetSelectedPlatform (SBPlatform(%p) %s)",
|
||||
static_cast<void *>(m_opaque_sp.get()),
|
||||
static_cast<void *>(sb_platform.GetSP().get()),
|
||||
sb_platform.GetName());
|
||||
LLDB_LOGF(log, "SBDebugger(%p)::SetSelectedPlatform (SBPlatform(%p) %s)",
|
||||
static_cast<void *>(m_opaque_sp.get()),
|
||||
static_cast<void *>(sb_platform.GetSP().get()),
|
||||
sb_platform.GetName());
|
||||
}
|
||||
|
||||
uint32_t SBDebugger::GetNumPlatforms() {
|
||||
|
|
@ -1062,7 +1056,7 @@ void SBDebugger::DispatchInput(const void *data, size_t data_len) {
|
|||
// Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
||||
//
|
||||
// if (log)
|
||||
// log->Printf ("SBDebugger(%p)::DispatchInput (data=\"%.*s\",
|
||||
// LLDB_LOGF(log, "SBDebugger(%p)::DispatchInput (data=\"%.*s\",
|
||||
// size_t=%" PRIu64 ")",
|
||||
// m_opaque_sp.get(),
|
||||
// (int) data_len,
|
||||
|
|
@ -1246,10 +1240,9 @@ const char *SBDebugger::GetPrompt() const {
|
|||
|
||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
|
||||
|
||||
if (log)
|
||||
log->Printf("SBDebugger(%p)::GetPrompt () => \"%s\"",
|
||||
static_cast<void *>(m_opaque_sp.get()),
|
||||
(m_opaque_sp ? m_opaque_sp->GetPrompt().str().c_str() : ""));
|
||||
LLDB_LOGF(log, "SBDebugger(%p)::GetPrompt () => \"%s\"",
|
||||
static_cast<void *>(m_opaque_sp.get()),
|
||||
(m_opaque_sp ? m_opaque_sp->GetPrompt().str().c_str() : ""));
|
||||
|
||||
return (m_opaque_sp ? ConstString(m_opaque_sp->GetPrompt()).GetCString()
|
||||
: nullptr);
|
||||
|
|
@ -1374,7 +1367,8 @@ bool SBDebugger::SetCurrentPlatformSDKRoot(const char *sysroot) {
|
|||
|
||||
if (platform_sp) {
|
||||
if (log && sysroot)
|
||||
log->Printf("SBDebugger::SetCurrentPlatformSDKRoot (\"%s\")", sysroot);
|
||||
LLDB_LOGF(log, "SBDebugger::SetCurrentPlatformSDKRoot (\"%s\")",
|
||||
sysroot);
|
||||
platform_sp->SetSDKRootDirectory(ConstString(sysroot));
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1120,10 +1120,10 @@ lldb::SBValue SBFrame::EvaluateExpression(const char *expr,
|
|||
}
|
||||
}
|
||||
|
||||
if (expr_log)
|
||||
expr_log->Printf("** [SBFrame::EvaluateExpression] Expression result is "
|
||||
"%s, summary %s **",
|
||||
expr_result.GetValue(), expr_result.GetSummary());
|
||||
LLDB_LOGF(expr_log,
|
||||
"** [SBFrame::EvaluateExpression] Expression result is "
|
||||
"%s, summary %s **",
|
||||
expr_result.GetValue(), expr_result.GetSummary());
|
||||
|
||||
return LLDB_RECORD_RESULT(expr_result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2355,10 +2355,10 @@ lldb::SBValue SBTarget::EvaluateExpression(const char *expr,
|
|||
expr_result.SetSP(expr_value_sp, options.GetFetchDynamicValue());
|
||||
}
|
||||
}
|
||||
if (expr_log)
|
||||
expr_log->Printf("** [SBTarget::EvaluateExpression] Expression result is "
|
||||
"%s, summary %s **",
|
||||
expr_result.GetValue(), expr_result.GetSummary());
|
||||
LLDB_LOGF(expr_log,
|
||||
"** [SBTarget::EvaluateExpression] Expression result is "
|
||||
"%s, summary %s **",
|
||||
expr_result.GetValue(), expr_result.GetSummary());
|
||||
return LLDB_RECORD_RESULT(expr_result);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -496,10 +496,10 @@ void Breakpoint::ClearAllBreakpointSites() {
|
|||
void Breakpoint::ModulesChanged(ModuleList &module_list, bool load,
|
||||
bool delete_locations) {
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
|
||||
if (log)
|
||||
log->Printf("Breakpoint::ModulesChanged: num_modules: %zu load: %i "
|
||||
"delete_locations: %i\n",
|
||||
module_list.GetSize(), load, delete_locations);
|
||||
LLDB_LOGF(log,
|
||||
"Breakpoint::ModulesChanged: num_modules: %zu load: %i "
|
||||
"delete_locations: %i\n",
|
||||
module_list.GetSize(), load, delete_locations);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(module_list.GetMutex());
|
||||
if (load) {
|
||||
|
|
@ -550,10 +550,10 @@ void Breakpoint::ModulesChanged(ModuleList &module_list, bool load,
|
|||
seen = true;
|
||||
|
||||
if (!break_loc_sp->ResolveBreakpointSite()) {
|
||||
if (log)
|
||||
log->Printf("Warning: could not set breakpoint site for "
|
||||
"breakpoint location %d of breakpoint %d.\n",
|
||||
break_loc_sp->GetID(), GetID());
|
||||
LLDB_LOGF(log,
|
||||
"Warning: could not set breakpoint site for "
|
||||
"breakpoint location %d of breakpoint %d.\n",
|
||||
break_loc_sp->GetID(), GetID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -659,9 +659,8 @@ static bool SymbolContextsMightBeEquivalent(SymbolContext &old_sc,
|
|||
void Breakpoint::ModuleReplaced(ModuleSP old_module_sp,
|
||||
ModuleSP new_module_sp) {
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
|
||||
if (log)
|
||||
log->Printf("Breakpoint::ModulesReplaced for %s\n",
|
||||
old_module_sp->GetSpecificationDescription().c_str());
|
||||
LLDB_LOGF(log, "Breakpoint::ModulesReplaced for %s\n",
|
||||
old_module_sp->GetSpecificationDescription().c_str());
|
||||
// First find all the locations that are in the old module
|
||||
|
||||
BreakpointLocationCollection old_break_locs;
|
||||
|
|
|
|||
|
|
@ -257,9 +257,8 @@ bool BreakpointLocation::ConditionSaysStop(ExecutionContext &exe_ctx,
|
|||
condition_text, llvm::StringRef(), language, Expression::eResultTypeAny,
|
||||
EvaluateExpressionOptions(), nullptr, error));
|
||||
if (error.Fail()) {
|
||||
if (log)
|
||||
log->Printf("Error getting condition expression: %s.",
|
||||
error.AsCString());
|
||||
LLDB_LOGF(log, "Error getting condition expression: %s.",
|
||||
error.AsCString());
|
||||
m_user_expression_sp.reset();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -312,8 +311,8 @@ bool BreakpointLocation::ConditionSaysStop(ExecutionContext &exe_ctx,
|
|||
ret = result_value_sp->IsLogicalTrue(error);
|
||||
if (log) {
|
||||
if (error.Success()) {
|
||||
log->Printf("Condition successfully evaluated, result is %s.\n",
|
||||
ret ? "true" : "false");
|
||||
LLDB_LOGF(log, "Condition successfully evaluated, result is %s.\n",
|
||||
ret ? "true" : "false");
|
||||
} else {
|
||||
error.SetErrorString(
|
||||
"Failed to get an integer result from the expression");
|
||||
|
|
@ -408,8 +407,8 @@ bool BreakpointLocation::ShouldStop(StoppointCallbackContext *context) {
|
|||
if (log) {
|
||||
StreamString s;
|
||||
GetDescription(&s, lldb::eDescriptionLevelVerbose);
|
||||
log->Printf("Hit breakpoint location: %s, %s.\n", s.GetData(),
|
||||
should_stop ? "stopping" : "continuing");
|
||||
LLDB_LOGF(log, "Hit breakpoint location: %s, %s.\n", s.GetData(),
|
||||
should_stop ? "stopping" : "continuing");
|
||||
}
|
||||
|
||||
return should_stop;
|
||||
|
|
|
|||
|
|
@ -294,18 +294,18 @@ void BreakpointResolver::AddLocation(SearchFilter &filter,
|
|||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
|
||||
Address line_start = sc.line_entry.range.GetBaseAddress();
|
||||
if (!line_start.IsValid()) {
|
||||
if (log)
|
||||
log->Printf("error: Unable to set breakpoint %s at file address "
|
||||
"0x%" PRIx64 "\n",
|
||||
log_ident.str().c_str(), line_start.GetFileAddress());
|
||||
LLDB_LOGF(log,
|
||||
"error: Unable to set breakpoint %s at file address "
|
||||
"0x%" PRIx64 "\n",
|
||||
log_ident.str().c_str(), line_start.GetFileAddress());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!filter.AddressPasses(line_start)) {
|
||||
if (log)
|
||||
log->Printf("Breakpoint %s at file address 0x%" PRIx64
|
||||
" didn't pass the filter.\n",
|
||||
log_ident.str().c_str(), line_start.GetFileAddress());
|
||||
LLDB_LOGF(log,
|
||||
"Breakpoint %s at file address 0x%" PRIx64
|
||||
" didn't pass the filter.\n",
|
||||
log_ident.str().c_str(), line_start.GetFileAddress());
|
||||
}
|
||||
|
||||
// If the line number is before the prologue end, move it there...
|
||||
|
|
@ -329,8 +329,8 @@ void BreakpointResolver::AddLocation(SearchFilter &filter,
|
|||
if (log && bp_loc_sp && !m_breakpoint->IsInternal()) {
|
||||
StreamString s;
|
||||
bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
|
||||
log->Printf("Added location (skipped prologue: %s): %s \n",
|
||||
skipped_prologue ? "yes" : "no", s.GetData());
|
||||
LLDB_LOGF(log, "Added location (skipped prologue: %s): %s \n",
|
||||
skipped_prologue ? "yes" : "no", s.GetData());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -149,8 +149,7 @@ BreakpointResolverAddress::SearchCallback(SearchFilter &filter,
|
|||
bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
|
||||
Log *log(
|
||||
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
|
||||
if (log)
|
||||
log->Printf("Added location: %s\n", s.GetData());
|
||||
LLDB_LOGF(log, "Added location: %s\n", s.GetData());
|
||||
}
|
||||
} else {
|
||||
BreakpointLocationSP loc_sp = m_breakpoint->GetLocationAtIndex(0);
|
||||
|
|
|
|||
|
|
@ -388,7 +388,7 @@ BreakpointResolverName::SearchCallback(SearchFilter &filter,
|
|||
if (log) {
|
||||
StreamString s;
|
||||
bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
|
||||
log->Printf("Added location: %s\n", s.GetData());
|
||||
LLDB_LOGF(log, "Added location: %s\n", s.GetData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1064,9 +1064,10 @@ protected:
|
|||
if (from[0] && to[0]) {
|
||||
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
|
||||
if (log) {
|
||||
log->Printf("target modules search path adding ImageSearchPath "
|
||||
"pair: '%s' -> '%s'",
|
||||
from, to);
|
||||
LLDB_LOGF(log,
|
||||
"target modules search path adding ImageSearchPath "
|
||||
"pair: '%s' -> '%s'",
|
||||
from, to);
|
||||
}
|
||||
bool last_pair = ((argc - i) == 2);
|
||||
target->GetImageSearchPathList().Append(
|
||||
|
|
|
|||
|
|
@ -60,15 +60,15 @@ AddressResolverFileLine::SearchCallback(SearchFilter &filter,
|
|||
if (log) {
|
||||
StreamString s;
|
||||
// new_bp_loc->GetDescription (&s, lldb::eDescriptionLevelVerbose);
|
||||
// log->Printf ("Added address: %s\n", s.GetData());
|
||||
// LLDB_LOGF(log, "Added address: %s\n", s.GetData());
|
||||
}
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"error: Unable to resolve address at file address 0x%" PRIx64
|
||||
" for %s:%d\n",
|
||||
line_start.GetFileAddress(),
|
||||
m_file_spec.GetFilename().AsCString("<Unknown>"), m_line_number);
|
||||
LLDB_LOGF(log,
|
||||
"error: Unable to resolve address at file address 0x%" PRIx64
|
||||
" for %s:%d\n",
|
||||
line_start.GetFileAddress(),
|
||||
m_file_spec.GetFilename().AsCString("<Unknown>"),
|
||||
m_line_number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -308,8 +308,7 @@ lldb::thread_result_t Communication::ReadThread(lldb::thread_arg_t p) {
|
|||
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION));
|
||||
|
||||
if (log)
|
||||
log->Printf("%p Communication::ReadThread () thread starting...", p);
|
||||
LLDB_LOGF(log, "%p Communication::ReadThread () thread starting...", p);
|
||||
|
||||
uint8_t buf[1024];
|
||||
|
||||
|
|
@ -364,7 +363,7 @@ lldb::thread_result_t Communication::ReadThread(lldb::thread_arg_t p) {
|
|||
}
|
||||
log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION);
|
||||
if (log)
|
||||
log->Printf("%p Communication::ReadThread () thread exiting...", p);
|
||||
LLDB_LOGF(log, "%p Communication::ReadThread () thread exiting...", p);
|
||||
|
||||
comm->m_read_thread_did_exit = true;
|
||||
// Let clients know that this thread is exiting
|
||||
|
|
|
|||
|
|
@ -514,24 +514,24 @@ static bool ScanBracketedRange(llvm::StringRef subpath,
|
|||
close_bracket_index = llvm::StringRef::npos;
|
||||
const size_t open_bracket_index = subpath.find('[');
|
||||
if (open_bracket_index == llvm::StringRef::npos) {
|
||||
if (log)
|
||||
log->Printf("[ScanBracketedRange] no bracketed range, skipping entirely");
|
||||
LLDB_LOGF(log,
|
||||
"[ScanBracketedRange] no bracketed range, skipping entirely");
|
||||
return false;
|
||||
}
|
||||
|
||||
close_bracket_index = subpath.find(']', open_bracket_index + 1);
|
||||
|
||||
if (close_bracket_index == llvm::StringRef::npos) {
|
||||
if (log)
|
||||
log->Printf("[ScanBracketedRange] no bracketed range, skipping entirely");
|
||||
LLDB_LOGF(log,
|
||||
"[ScanBracketedRange] no bracketed range, skipping entirely");
|
||||
return false;
|
||||
} else {
|
||||
var_name_final_if_array_range = subpath.data() + open_bracket_index;
|
||||
|
||||
if (close_bracket_index - open_bracket_index == 1) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"[ScanBracketedRange] '[]' detected.. going from 0 to end of data");
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"[ScanBracketedRange] '[]' detected.. going from 0 to end of data");
|
||||
index_lower = 0;
|
||||
} else {
|
||||
const size_t separator_index = subpath.find('-', open_bracket_index + 1);
|
||||
|
|
@ -540,22 +540,21 @@ static bool ScanBracketedRange(llvm::StringRef subpath,
|
|||
const char *index_lower_cstr = subpath.data() + open_bracket_index + 1;
|
||||
index_lower = ::strtoul(index_lower_cstr, nullptr, 0);
|
||||
index_higher = index_lower;
|
||||
if (log)
|
||||
log->Printf("[ScanBracketedRange] [%" PRId64
|
||||
"] detected, high index is same",
|
||||
index_lower);
|
||||
LLDB_LOGF(log,
|
||||
"[ScanBracketedRange] [%" PRId64
|
||||
"] detected, high index is same",
|
||||
index_lower);
|
||||
} else {
|
||||
const char *index_lower_cstr = subpath.data() + open_bracket_index + 1;
|
||||
const char *index_higher_cstr = subpath.data() + separator_index + 1;
|
||||
index_lower = ::strtoul(index_lower_cstr, nullptr, 0);
|
||||
index_higher = ::strtoul(index_higher_cstr, nullptr, 0);
|
||||
if (log)
|
||||
log->Printf("[ScanBracketedRange] [%" PRId64 "-%" PRId64 "] detected",
|
||||
index_lower, index_higher);
|
||||
LLDB_LOGF(log,
|
||||
"[ScanBracketedRange] [%" PRId64 "-%" PRId64 "] detected",
|
||||
index_lower, index_higher);
|
||||
}
|
||||
if (index_lower > index_higher && index_higher > 0) {
|
||||
if (log)
|
||||
log->Printf("[ScanBracketedRange] swapping indices");
|
||||
LLDB_LOGF(log, "[ScanBracketedRange] swapping indices");
|
||||
const int64_t temp = index_lower;
|
||||
index_lower = index_higher;
|
||||
index_higher = temp;
|
||||
|
|
@ -627,9 +626,8 @@ static ValueObjectSP ExpandIndexedExpression(ValueObject *valobj, size_t index,
|
|||
const char *ptr_deref_format = "[%d]";
|
||||
std::string ptr_deref_buffer(10, 0);
|
||||
::sprintf(&ptr_deref_buffer[0], ptr_deref_format, index);
|
||||
if (log)
|
||||
log->Printf("[ExpandIndexedExpression] name to deref: %s",
|
||||
ptr_deref_buffer.c_str());
|
||||
LLDB_LOGF(log, "[ExpandIndexedExpression] name to deref: %s",
|
||||
ptr_deref_buffer.c_str());
|
||||
ValueObject::GetValueForExpressionPathOptions options;
|
||||
ValueObject::ExpressionPathEndResultType final_value_type;
|
||||
ValueObject::ExpressionPathScanEndReason reason_to_stop;
|
||||
|
|
@ -640,15 +638,15 @@ static ValueObjectSP ExpandIndexedExpression(ValueObject *valobj, size_t index,
|
|||
ptr_deref_buffer.c_str(), &reason_to_stop, &final_value_type, options,
|
||||
&what_next);
|
||||
if (!item) {
|
||||
if (log)
|
||||
log->Printf("[ExpandIndexedExpression] ERROR: why stopping = %d,"
|
||||
" final_value_type %d",
|
||||
reason_to_stop, final_value_type);
|
||||
LLDB_LOGF(log,
|
||||
"[ExpandIndexedExpression] ERROR: why stopping = %d,"
|
||||
" final_value_type %d",
|
||||
reason_to_stop, final_value_type);
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("[ExpandIndexedExpression] ALL RIGHT: why stopping = %d,"
|
||||
" final_value_type %d",
|
||||
reason_to_stop, final_value_type);
|
||||
LLDB_LOGF(log,
|
||||
"[ExpandIndexedExpression] ALL RIGHT: why stopping = %d,"
|
||||
" final_value_type %d",
|
||||
reason_to_stop, final_value_type);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
|
@ -770,9 +768,8 @@ static bool DumpValue(Stream &s, const SymbolContext *sc,
|
|||
|
||||
const std::string &expr_path = entry.string;
|
||||
|
||||
if (log)
|
||||
log->Printf("[Debugger::FormatPrompt] symbol to expand: %s",
|
||||
expr_path.c_str());
|
||||
LLDB_LOGF(log, "[Debugger::FormatPrompt] symbol to expand: %s",
|
||||
expr_path.c_str());
|
||||
|
||||
target =
|
||||
valobj
|
||||
|
|
@ -781,16 +778,16 @@ static bool DumpValue(Stream &s, const SymbolContext *sc,
|
|||
.get();
|
||||
|
||||
if (!target) {
|
||||
if (log)
|
||||
log->Printf("[Debugger::FormatPrompt] ERROR: why stopping = %d,"
|
||||
" final_value_type %d",
|
||||
reason_to_stop, final_value_type);
|
||||
LLDB_LOGF(log,
|
||||
"[Debugger::FormatPrompt] ERROR: why stopping = %d,"
|
||||
" final_value_type %d",
|
||||
reason_to_stop, final_value_type);
|
||||
return false;
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("[Debugger::FormatPrompt] ALL RIGHT: why stopping = %d,"
|
||||
" final_value_type %d",
|
||||
reason_to_stop, final_value_type);
|
||||
LLDB_LOGF(log,
|
||||
"[Debugger::FormatPrompt] ALL RIGHT: why stopping = %d,"
|
||||
" final_value_type %d",
|
||||
reason_to_stop, final_value_type);
|
||||
target = target
|
||||
->GetQualifiedRepresentationIfAvailable(
|
||||
target->GetDynamicValueType(), true)
|
||||
|
|
@ -814,18 +811,16 @@ static bool DumpValue(Stream &s, const SymbolContext *sc,
|
|||
Status error;
|
||||
target = target->Dereference(error).get();
|
||||
if (error.Fail()) {
|
||||
if (log)
|
||||
log->Printf("[Debugger::FormatPrompt] ERROR: %s\n",
|
||||
error.AsCString("unknown"));
|
||||
LLDB_LOGF(log, "[Debugger::FormatPrompt] ERROR: %s\n",
|
||||
error.AsCString("unknown"));
|
||||
return false;
|
||||
}
|
||||
do_deref_pointer = false;
|
||||
}
|
||||
|
||||
if (!target) {
|
||||
if (log)
|
||||
log->Printf("[Debugger::FormatPrompt] could not calculate target for "
|
||||
"prompt expression");
|
||||
LLDB_LOGF(log, "[Debugger::FormatPrompt] could not calculate target for "
|
||||
"prompt expression");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -860,18 +855,16 @@ static bool DumpValue(Stream &s, const SymbolContext *sc,
|
|||
// exceptions
|
||||
{
|
||||
StreamString str_temp;
|
||||
if (log)
|
||||
log->Printf(
|
||||
"[Debugger::FormatPrompt] I am into array || pointer && !range");
|
||||
LLDB_LOGF(log,
|
||||
"[Debugger::FormatPrompt] I am into array || pointer && !range");
|
||||
|
||||
if (target->HasSpecialPrintableRepresentation(val_obj_display,
|
||||
custom_format)) {
|
||||
// try to use the special cases
|
||||
bool success = target->DumpPrintableRepresentation(
|
||||
str_temp, val_obj_display, custom_format);
|
||||
if (log)
|
||||
log->Printf("[Debugger::FormatPrompt] special cases did%s match",
|
||||
success ? "" : "n't");
|
||||
LLDB_LOGF(log, "[Debugger::FormatPrompt] special cases did%s match",
|
||||
success ? "" : "n't");
|
||||
|
||||
// should not happen
|
||||
if (success)
|
||||
|
|
@ -909,17 +902,16 @@ static bool DumpValue(Stream &s, const SymbolContext *sc,
|
|||
}
|
||||
|
||||
if (!is_array_range) {
|
||||
if (log)
|
||||
log->Printf("[Debugger::FormatPrompt] dumping ordinary printable output");
|
||||
LLDB_LOGF(log,
|
||||
"[Debugger::FormatPrompt] dumping ordinary printable output");
|
||||
return target->DumpPrintableRepresentation(s, val_obj_display,
|
||||
custom_format);
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("[Debugger::FormatPrompt] checking if I can handle as array");
|
||||
LLDB_LOGF(log,
|
||||
"[Debugger::FormatPrompt] checking if I can handle as array");
|
||||
if (!is_array && !is_pointer)
|
||||
return false;
|
||||
if (log)
|
||||
log->Printf("[Debugger::FormatPrompt] handle as array");
|
||||
LLDB_LOGF(log, "[Debugger::FormatPrompt] handle as array");
|
||||
StreamString special_directions_stream;
|
||||
llvm::StringRef special_directions;
|
||||
if (close_bracket_index != llvm::StringRef::npos &&
|
||||
|
|
@ -965,15 +957,15 @@ static bool DumpValue(Stream &s, const SymbolContext *sc,
|
|||
.get();
|
||||
|
||||
if (!item) {
|
||||
if (log)
|
||||
log->Printf("[Debugger::FormatPrompt] ERROR in getting child item at "
|
||||
"index %" PRId64,
|
||||
index);
|
||||
LLDB_LOGF(log,
|
||||
"[Debugger::FormatPrompt] ERROR in getting child item at "
|
||||
"index %" PRId64,
|
||||
index);
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"[Debugger::FormatPrompt] special_directions for child item: %s",
|
||||
special_directions.data() ? special_directions.data() : "");
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"[Debugger::FormatPrompt] special_directions for child item: %s",
|
||||
special_directions.data() ? special_directions.data() : "");
|
||||
}
|
||||
|
||||
if (special_directions.empty()) {
|
||||
|
|
|
|||
|
|
@ -226,9 +226,9 @@ static char *GetMSVCDemangledStr(const char *M) {
|
|||
|
||||
if (Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE)) {
|
||||
if (demangled_cstr && demangled_cstr[0])
|
||||
log->Printf("demangled msvc: %s -> \"%s\"", M, demangled_cstr);
|
||||
LLDB_LOGF(log, "demangled msvc: %s -> \"%s\"", M, demangled_cstr);
|
||||
else
|
||||
log->Printf("demangled msvc: %s -> error: 0x%lu", M, result);
|
||||
LLDB_LOGF(log, "demangled msvc: %s -> error: 0x%lu", M, result);
|
||||
}
|
||||
|
||||
if (result != 0) {
|
||||
|
|
@ -261,9 +261,9 @@ static char *GetItaniumDemangledStr(const char *M) {
|
|||
|
||||
if (Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE)) {
|
||||
if (demangled_cstr)
|
||||
log->Printf("demangled itanium: %s -> \"%s\"", M, demangled_cstr);
|
||||
LLDB_LOGF(log, "demangled itanium: %s -> \"%s\"", M, demangled_cstr);
|
||||
else
|
||||
log->Printf("demangled itanium: %s -> error: failed to demangle", M);
|
||||
LLDB_LOGF(log, "demangled itanium: %s -> error: failed to demangle", M);
|
||||
}
|
||||
|
||||
return demangled_cstr;
|
||||
|
|
|
|||
|
|
@ -137,14 +137,15 @@ Module::Module(const ModuleSpec &module_spec)
|
|||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT |
|
||||
LIBLLDB_LOG_MODULES));
|
||||
if (log != nullptr)
|
||||
log->Printf("%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().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().IsEmpty()
|
||||
? ""
|
||||
: module_spec.GetObjectName().AsCString(""),
|
||||
module_spec.GetObjectName().IsEmpty() ? "" : ")");
|
||||
|
||||
// First extract all module specifications from the file using the local file
|
||||
// path. If there are no specifications, then don't fill anything in
|
||||
|
|
@ -164,7 +165,7 @@ Module::Module(const ModuleSpec &module_spec)
|
|||
if (!modules_specs.FindMatchingModuleSpec(module_spec,
|
||||
matching_module_spec)) {
|
||||
if (log) {
|
||||
log->Printf("Found local object file but the specs didn't match");
|
||||
LLDB_LOGF(log, "Found local object file but the specs didn't match");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -235,11 +236,11 @@ Module::Module(const FileSpec &file_spec, const ArchSpec &arch,
|
|||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT |
|
||||
LIBLLDB_LOG_MODULES));
|
||||
if (log != nullptr)
|
||||
log->Printf("%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.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.IsEmpty() ? "" : m_object_name.AsCString(""),
|
||||
m_object_name.IsEmpty() ? "" : ")");
|
||||
}
|
||||
|
||||
Module::Module()
|
||||
|
|
@ -267,11 +268,11 @@ Module::~Module() {
|
|||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT |
|
||||
LIBLLDB_LOG_MODULES));
|
||||
if (log != nullptr)
|
||||
log->Printf("%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.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.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
|
||||
|
|
|
|||
|
|
@ -641,11 +641,11 @@ void ModuleList::LogUUIDAndPaths(Log *log, const char *prefix_cstr) {
|
|||
for (pos = begin; pos != end; ++pos) {
|
||||
Module *module = pos->get();
|
||||
const FileSpec &module_file_spec = module->GetFileSpec();
|
||||
log->Printf("%s[%u] %s (%s) \"%s\"", prefix_cstr ? prefix_cstr : "",
|
||||
(uint32_t)std::distance(begin, pos),
|
||||
module->GetUUID().GetAsString().c_str(),
|
||||
module->GetArchitecture().GetArchitectureName(),
|
||||
module_file_spec.GetPath().c_str());
|
||||
LLDB_LOGF(log, "%s[%u] %s (%s) \"%s\"", prefix_cstr ? prefix_cstr : "",
|
||||
(uint32_t)std::distance(begin, pos),
|
||||
module->GetUUID().GetAsString().c_str(),
|
||||
module->GetArchitecture().GetArchitectureName(),
|
||||
module_file_spec.GetPath().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -808,8 +808,9 @@ Status ModuleList::GetSharedModule(const ModuleSpec &module_spec,
|
|||
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES));
|
||||
if (log != nullptr)
|
||||
log->Printf("module changed: %p, removing from global module list",
|
||||
static_cast<void *>(module_sp.get()));
|
||||
LLDB_LOGF(log,
|
||||
"module changed: %p, removing from global module list",
|
||||
static_cast<void *>(module_sp.get()));
|
||||
|
||||
shared_module_list.Remove(module_sp);
|
||||
module_sp.reset();
|
||||
|
|
|
|||
|
|
@ -226,12 +226,12 @@ bool ValueObject::UpdateValueIfNeeded(bool update_format) {
|
|||
|
||||
bool ValueObject::UpdateFormatsIfNeeded() {
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
|
||||
if (log)
|
||||
log->Printf("[%s %p] checking for FormatManager revisions. ValueObject "
|
||||
"rev: %d - Global rev: %d",
|
||||
GetName().GetCString(), static_cast<void *>(this),
|
||||
m_last_format_mgr_revision,
|
||||
DataVisualization::GetCurrentRevision());
|
||||
LLDB_LOGF(log,
|
||||
"[%s %p] checking for FormatManager revisions. ValueObject "
|
||||
"rev: %d - Global rev: %d",
|
||||
GetName().GetCString(), static_cast<void *>(this),
|
||||
m_last_format_mgr_revision,
|
||||
DataVisualization::GetCurrentRevision());
|
||||
|
||||
bool any_change = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -243,8 +243,8 @@ bool ValueObjectDynamicValue::UpdateValue() {
|
|||
m_value.SetValueType(value_type);
|
||||
|
||||
if (has_changed_type && log)
|
||||
log->Printf("[%s %p] has a new dynamic type %s", GetName().GetCString(),
|
||||
static_cast<void *>(this), GetTypeName().GetCString());
|
||||
LLDB_LOGF(log, "[%s %p] has a new dynamic type %s", GetName().GetCString(),
|
||||
static_cast<void *>(this), GetTypeName().GetCString());
|
||||
|
||||
if (m_address.IsValid() && m_dynamic_type_info) {
|
||||
// The variable value is in the Scalar value inside the m_value. We can
|
||||
|
|
|
|||
|
|
@ -87,20 +87,18 @@ size_t ValueObjectSynthetic::CalculateNumChildren(uint32_t max) {
|
|||
|
||||
if (max < UINT32_MAX) {
|
||||
size_t num_children = m_synth_filter_up->CalculateNumChildren(max);
|
||||
if (log)
|
||||
log->Printf("[ValueObjectSynthetic::CalculateNumChildren] for VO of name "
|
||||
"%s and type %s, the filter returned %zu child values",
|
||||
GetName().AsCString(), GetTypeName().AsCString(),
|
||||
num_children);
|
||||
LLDB_LOGF(log,
|
||||
"[ValueObjectSynthetic::CalculateNumChildren] for VO of name "
|
||||
"%s and type %s, the filter returned %zu child values",
|
||||
GetName().AsCString(), GetTypeName().AsCString(), num_children);
|
||||
return num_children;
|
||||
} else {
|
||||
size_t num_children = (m_synthetic_children_count =
|
||||
m_synth_filter_up->CalculateNumChildren(max));
|
||||
if (log)
|
||||
log->Printf("[ValueObjectSynthetic::CalculateNumChildren] for VO of name "
|
||||
"%s and type %s, the filter returned %zu child values",
|
||||
GetName().AsCString(), GetTypeName().AsCString(),
|
||||
num_children);
|
||||
LLDB_LOGF(log,
|
||||
"[ValueObjectSynthetic::CalculateNumChildren] for VO of name "
|
||||
"%s and type %s, the filter returned %zu child values",
|
||||
GetName().AsCString(), GetTypeName().AsCString(), num_children);
|
||||
return num_children;
|
||||
}
|
||||
}
|
||||
|
|
@ -163,21 +161,21 @@ bool ValueObjectSynthetic::UpdateValue() {
|
|||
// <rdar://problem/12424824>
|
||||
ConstString new_parent_type_name = m_parent->GetTypeName();
|
||||
if (new_parent_type_name != m_parent_type_name) {
|
||||
if (log)
|
||||
log->Printf("[ValueObjectSynthetic::UpdateValue] name=%s, type changed "
|
||||
"from %s to %s, recomputing synthetic filter",
|
||||
GetName().AsCString(), m_parent_type_name.AsCString(),
|
||||
new_parent_type_name.AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"[ValueObjectSynthetic::UpdateValue] name=%s, type changed "
|
||||
"from %s to %s, recomputing synthetic filter",
|
||||
GetName().AsCString(), m_parent_type_name.AsCString(),
|
||||
new_parent_type_name.AsCString());
|
||||
m_parent_type_name = new_parent_type_name;
|
||||
CreateSynthFilter();
|
||||
}
|
||||
|
||||
// let our backend do its update
|
||||
if (!m_synth_filter_up->Update()) {
|
||||
if (log)
|
||||
log->Printf("[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
|
||||
"filter said caches are stale - clearing",
|
||||
GetName().AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
|
||||
"filter said caches are stale - clearing",
|
||||
GetName().AsCString());
|
||||
// filter said that cached values are stale
|
||||
m_children_byindex.Clear();
|
||||
m_name_toindex.Clear();
|
||||
|
|
@ -190,10 +188,10 @@ bool ValueObjectSynthetic::UpdateValue() {
|
|||
m_synthetic_children_count = UINT32_MAX;
|
||||
m_might_have_children = eLazyBoolCalculate;
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
|
||||
"filter said caches are still valid",
|
||||
GetName().AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
|
||||
"filter said caches are still valid",
|
||||
GetName().AsCString());
|
||||
}
|
||||
|
||||
m_provides_value = eLazyBoolCalculate;
|
||||
|
|
@ -201,18 +199,18 @@ bool ValueObjectSynthetic::UpdateValue() {
|
|||
lldb::ValueObjectSP synth_val(m_synth_filter_up->GetSyntheticValue());
|
||||
|
||||
if (synth_val && synth_val->CanProvideValue()) {
|
||||
if (log)
|
||||
log->Printf("[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
|
||||
"filter said it can provide a value",
|
||||
GetName().AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
|
||||
"filter said it can provide a value",
|
||||
GetName().AsCString());
|
||||
|
||||
m_provides_value = eLazyBoolYes;
|
||||
CopyValueData(synth_val.get());
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
|
||||
"filter said it will not provide a value",
|
||||
GetName().AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
|
||||
"filter said it will not provide a value",
|
||||
GetName().AsCString());
|
||||
|
||||
m_provides_value = eLazyBoolNo;
|
||||
CopyValueData(m_parent);
|
||||
|
|
@ -226,32 +224,32 @@ lldb::ValueObjectSP ValueObjectSynthetic::GetChildAtIndex(size_t idx,
|
|||
bool can_create) {
|
||||
Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS);
|
||||
|
||||
if (log)
|
||||
log->Printf("[ValueObjectSynthetic::GetChildAtIndex] name=%s, retrieving "
|
||||
"child at index %zu",
|
||||
GetName().AsCString(), idx);
|
||||
LLDB_LOGF(log,
|
||||
"[ValueObjectSynthetic::GetChildAtIndex] name=%s, retrieving "
|
||||
"child at index %zu",
|
||||
GetName().AsCString(), idx);
|
||||
|
||||
UpdateValueIfNeeded();
|
||||
|
||||
ValueObject *valobj;
|
||||
if (!m_children_byindex.GetValueForKey(idx, valobj)) {
|
||||
if (can_create && m_synth_filter_up != nullptr) {
|
||||
if (log)
|
||||
log->Printf("[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at "
|
||||
"index %zu not cached and will be created",
|
||||
GetName().AsCString(), idx);
|
||||
LLDB_LOGF(log,
|
||||
"[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at "
|
||||
"index %zu not cached and will be created",
|
||||
GetName().AsCString(), idx);
|
||||
|
||||
lldb::ValueObjectSP synth_guy = m_synth_filter_up->GetChildAtIndex(idx);
|
||||
|
||||
if (log)
|
||||
log->Printf(
|
||||
"[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at index "
|
||||
"%zu created as %p (is "
|
||||
"synthetic: %s)",
|
||||
GetName().AsCString(), idx, static_cast<void *>(synth_guy.get()),
|
||||
synth_guy.get()
|
||||
? (synth_guy->IsSyntheticChildrenGenerated() ? "yes" : "no")
|
||||
: "no");
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at index "
|
||||
"%zu created as %p (is "
|
||||
"synthetic: %s)",
|
||||
GetName().AsCString(), idx, static_cast<void *>(synth_guy.get()),
|
||||
synth_guy.get()
|
||||
? (synth_guy->IsSyntheticChildrenGenerated() ? "yes" : "no")
|
||||
: "no");
|
||||
|
||||
if (!synth_guy)
|
||||
return synth_guy;
|
||||
|
|
@ -263,20 +261,20 @@ lldb::ValueObjectSP ValueObjectSynthetic::GetChildAtIndex(size_t idx,
|
|||
GetPreferredDisplayLanguage());
|
||||
return synth_guy;
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at "
|
||||
"index %zu not cached and cannot "
|
||||
"be created (can_create = %s, synth_filter = %p)",
|
||||
GetName().AsCString(), idx, can_create ? "yes" : "no",
|
||||
static_cast<void *>(m_synth_filter_up.get()));
|
||||
LLDB_LOGF(log,
|
||||
"[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at "
|
||||
"index %zu not cached and cannot "
|
||||
"be created (can_create = %s, synth_filter = %p)",
|
||||
GetName().AsCString(), idx, can_create ? "yes" : "no",
|
||||
static_cast<void *>(m_synth_filter_up.get()));
|
||||
|
||||
return lldb::ValueObjectSP();
|
||||
}
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at "
|
||||
"index %zu cached as %p",
|
||||
GetName().AsCString(), idx, static_cast<void *>(valobj));
|
||||
LLDB_LOGF(log,
|
||||
"[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at "
|
||||
"index %zu cached as %p",
|
||||
GetName().AsCString(), idx, static_cast<void *>(valobj));
|
||||
|
||||
return valobj->GetSP();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -630,30 +630,29 @@ FormatManager::GetFormat(ValueObject &valobj,
|
|||
TypeFormatImplSP retval;
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
|
||||
if (match_data.GetTypeForCache()) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"\n\n[FormatManager::GetFormat] Looking into cache for type %s",
|
||||
match_data.GetTypeForCache().AsCString("<invalid>"));
|
||||
LLDB_LOGF(log,
|
||||
"\n\n[FormatManager::GetFormat] Looking into cache for type %s",
|
||||
match_data.GetTypeForCache().AsCString("<invalid>"));
|
||||
if (m_format_cache.GetFormat(match_data.GetTypeForCache(), retval)) {
|
||||
if (log) {
|
||||
log->Printf(
|
||||
"[FormatManager::GetFormat] Cache search success. Returning.");
|
||||
LLDB_LOGF(
|
||||
log, "[FormatManager::GetFormat] Cache search success. Returning.");
|
||||
LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
|
||||
m_format_cache.GetCacheHits(),
|
||||
m_format_cache.GetCacheMisses());
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
if (log)
|
||||
log->Printf(
|
||||
"[FormatManager::GetFormat] Cache search failed. Going normal route");
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"[FormatManager::GetFormat] Cache search failed. Going normal route");
|
||||
}
|
||||
|
||||
retval = m_categories_map.GetFormat(match_data);
|
||||
if (!retval) {
|
||||
if (log)
|
||||
log->Printf("[FormatManager::GetFormat] Search failed. Giving language a "
|
||||
"chance.");
|
||||
LLDB_LOGF(log,
|
||||
"[FormatManager::GetFormat] Search failed. Giving language a "
|
||||
"chance.");
|
||||
for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
|
||||
if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
|
||||
if (lang_category->Get(match_data, retval))
|
||||
|
|
@ -661,24 +660,22 @@ FormatManager::GetFormat(ValueObject &valobj,
|
|||
}
|
||||
}
|
||||
if (retval) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"[FormatManager::GetFormat] Language search success. Returning.");
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"[FormatManager::GetFormat] Language search success. Returning.");
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
if (!retval) {
|
||||
if (log)
|
||||
log->Printf("[FormatManager::GetFormat] Search failed. Giving hardcoded "
|
||||
"a chance.");
|
||||
LLDB_LOGF(log, "[FormatManager::GetFormat] Search failed. Giving hardcoded "
|
||||
"a chance.");
|
||||
retval = GetHardcodedFormat(match_data);
|
||||
}
|
||||
|
||||
if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable())) {
|
||||
if (log)
|
||||
log->Printf("[FormatManager::GetFormat] Caching %p for type %s",
|
||||
static_cast<void *>(retval.get()),
|
||||
match_data.GetTypeForCache().AsCString("<invalid>"));
|
||||
LLDB_LOGF(log, "[FormatManager::GetFormat] Caching %p for type %s",
|
||||
static_cast<void *>(retval.get()),
|
||||
match_data.GetTypeForCache().AsCString("<invalid>"));
|
||||
m_format_cache.SetFormat(match_data.GetTypeForCache(), retval);
|
||||
}
|
||||
LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
|
||||
|
|
@ -708,30 +705,29 @@ FormatManager::GetSummaryFormat(ValueObject &valobj,
|
|||
TypeSummaryImplSP retval;
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
|
||||
if (match_data.GetTypeForCache()) {
|
||||
if (log)
|
||||
log->Printf("\n\n[FormatManager::GetSummaryFormat] Looking into cache "
|
||||
"for type %s",
|
||||
match_data.GetTypeForCache().AsCString("<invalid>"));
|
||||
LLDB_LOGF(log,
|
||||
"\n\n[FormatManager::GetSummaryFormat] Looking into cache "
|
||||
"for type %s",
|
||||
match_data.GetTypeForCache().AsCString("<invalid>"));
|
||||
if (m_format_cache.GetSummary(match_data.GetTypeForCache(), retval)) {
|
||||
if (log) {
|
||||
log->Printf("[FormatManager::GetSummaryFormat] Cache search success. "
|
||||
"Returning.");
|
||||
LLDB_LOGF(log,
|
||||
"[FormatManager::GetSummaryFormat] Cache search success. "
|
||||
"Returning.");
|
||||
LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
|
||||
m_format_cache.GetCacheHits(),
|
||||
m_format_cache.GetCacheMisses());
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
if (log)
|
||||
log->Printf("[FormatManager::GetSummaryFormat] Cache search failed. "
|
||||
"Going normal route");
|
||||
LLDB_LOGF(log, "[FormatManager::GetSummaryFormat] Cache search failed. "
|
||||
"Going normal route");
|
||||
}
|
||||
|
||||
retval = m_categories_map.GetSummaryFormat(match_data);
|
||||
if (!retval) {
|
||||
if (log)
|
||||
log->Printf("[FormatManager::GetSummaryFormat] Search failed. Giving "
|
||||
"language a chance.");
|
||||
LLDB_LOGF(log, "[FormatManager::GetSummaryFormat] Search failed. Giving "
|
||||
"language a chance.");
|
||||
for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
|
||||
if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
|
||||
if (lang_category->Get(match_data, retval))
|
||||
|
|
@ -739,24 +735,21 @@ FormatManager::GetSummaryFormat(ValueObject &valobj,
|
|||
}
|
||||
}
|
||||
if (retval) {
|
||||
if (log)
|
||||
log->Printf("[FormatManager::GetSummaryFormat] Language search "
|
||||
"success. Returning.");
|
||||
LLDB_LOGF(log, "[FormatManager::GetSummaryFormat] Language search "
|
||||
"success. Returning.");
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
if (!retval) {
|
||||
if (log)
|
||||
log->Printf("[FormatManager::GetSummaryFormat] Search failed. Giving "
|
||||
"hardcoded a chance.");
|
||||
LLDB_LOGF(log, "[FormatManager::GetSummaryFormat] Search failed. Giving "
|
||||
"hardcoded a chance.");
|
||||
retval = GetHardcodedSummaryFormat(match_data);
|
||||
}
|
||||
|
||||
if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable())) {
|
||||
if (log)
|
||||
log->Printf("[FormatManager::GetSummaryFormat] Caching %p for type %s",
|
||||
static_cast<void *>(retval.get()),
|
||||
match_data.GetTypeForCache().AsCString("<invalid>"));
|
||||
LLDB_LOGF(log, "[FormatManager::GetSummaryFormat] Caching %p for type %s",
|
||||
static_cast<void *>(retval.get()),
|
||||
match_data.GetTypeForCache().AsCString("<invalid>"));
|
||||
m_format_cache.SetSummary(match_data.GetTypeForCache(), retval);
|
||||
}
|
||||
LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
|
||||
|
|
@ -786,30 +779,29 @@ FormatManager::GetSyntheticChildren(ValueObject &valobj,
|
|||
SyntheticChildrenSP retval;
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
|
||||
if (match_data.GetTypeForCache()) {
|
||||
if (log)
|
||||
log->Printf("\n\n[FormatManager::GetSyntheticChildren] Looking into "
|
||||
"cache for type %s",
|
||||
match_data.GetTypeForCache().AsCString("<invalid>"));
|
||||
LLDB_LOGF(log,
|
||||
"\n\n[FormatManager::GetSyntheticChildren] Looking into "
|
||||
"cache for type %s",
|
||||
match_data.GetTypeForCache().AsCString("<invalid>"));
|
||||
if (m_format_cache.GetSynthetic(match_data.GetTypeForCache(), retval)) {
|
||||
if (log) {
|
||||
log->Printf("[FormatManager::GetSyntheticChildren] Cache search "
|
||||
"success. Returning.");
|
||||
LLDB_LOGF(log, "[FormatManager::GetSyntheticChildren] Cache search "
|
||||
"success. Returning.");
|
||||
LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
|
||||
m_format_cache.GetCacheHits(),
|
||||
m_format_cache.GetCacheMisses());
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
if (log)
|
||||
log->Printf("[FormatManager::GetSyntheticChildren] Cache search failed. "
|
||||
"Going normal route");
|
||||
LLDB_LOGF(log, "[FormatManager::GetSyntheticChildren] Cache search failed. "
|
||||
"Going normal route");
|
||||
}
|
||||
|
||||
retval = m_categories_map.GetSyntheticChildren(match_data);
|
||||
if (!retval) {
|
||||
if (log)
|
||||
log->Printf("[FormatManager::GetSyntheticChildren] Search failed. Giving "
|
||||
"language a chance.");
|
||||
LLDB_LOGF(log,
|
||||
"[FormatManager::GetSyntheticChildren] Search failed. Giving "
|
||||
"language a chance.");
|
||||
for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
|
||||
if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
|
||||
if (lang_category->Get(match_data, retval))
|
||||
|
|
@ -817,25 +809,23 @@ FormatManager::GetSyntheticChildren(ValueObject &valobj,
|
|||
}
|
||||
}
|
||||
if (retval) {
|
||||
if (log)
|
||||
log->Printf("[FormatManager::GetSyntheticChildren] Language search "
|
||||
"success. Returning.");
|
||||
LLDB_LOGF(log, "[FormatManager::GetSyntheticChildren] Language search "
|
||||
"success. Returning.");
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
if (!retval) {
|
||||
if (log)
|
||||
log->Printf("[FormatManager::GetSyntheticChildren] Search failed. Giving "
|
||||
"hardcoded a chance.");
|
||||
LLDB_LOGF(log,
|
||||
"[FormatManager::GetSyntheticChildren] Search failed. Giving "
|
||||
"hardcoded a chance.");
|
||||
retval = GetHardcodedSyntheticChildren(match_data);
|
||||
}
|
||||
|
||||
if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable())) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"[FormatManager::GetSyntheticChildren] Caching %p for type %s",
|
||||
static_cast<void *>(retval.get()),
|
||||
match_data.GetTypeForCache().AsCString("<invalid>"));
|
||||
LLDB_LOGF(log,
|
||||
"[FormatManager::GetSyntheticChildren] Caching %p for type %s",
|
||||
static_cast<void *>(retval.get()),
|
||||
match_data.GetTypeForCache().AsCString("<invalid>"));
|
||||
m_format_cache.SetSynthetic(match_data.GetTypeForCache(), retval);
|
||||
}
|
||||
LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
|
||||
|
|
@ -851,13 +841,13 @@ FormatManager::GetValidator(ValueObject &valobj,
|
|||
TypeValidatorImplSP retval;
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
|
||||
if (match_data.GetTypeForCache()) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"\n\n[FormatManager::GetValidator] Looking into cache for type %s",
|
||||
match_data.GetTypeForCache().AsCString("<invalid>"));
|
||||
LLDB_LOGF(
|
||||
log, "\n\n[FormatManager::GetValidator] Looking into cache for type %s",
|
||||
match_data.GetTypeForCache().AsCString("<invalid>"));
|
||||
if (m_format_cache.GetValidator(match_data.GetTypeForCache(), retval)) {
|
||||
if (log) {
|
||||
log->Printf(
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"[FormatManager::GetValidator] Cache search success. Returning.");
|
||||
LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
|
||||
m_format_cache.GetCacheHits(),
|
||||
|
|
@ -865,16 +855,14 @@ FormatManager::GetValidator(ValueObject &valobj,
|
|||
}
|
||||
return retval;
|
||||
}
|
||||
if (log)
|
||||
log->Printf("[FormatManager::GetValidator] Cache search failed. Going "
|
||||
"normal route");
|
||||
LLDB_LOGF(log, "[FormatManager::GetValidator] Cache search failed. Going "
|
||||
"normal route");
|
||||
}
|
||||
|
||||
retval = m_categories_map.GetValidator(match_data);
|
||||
if (!retval) {
|
||||
if (log)
|
||||
log->Printf("[FormatManager::GetValidator] Search failed. Giving "
|
||||
"language a chance.");
|
||||
LLDB_LOGF(log, "[FormatManager::GetValidator] Search failed. Giving "
|
||||
"language a chance.");
|
||||
for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
|
||||
if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
|
||||
if (lang_category->Get(match_data, retval))
|
||||
|
|
@ -882,24 +870,21 @@ FormatManager::GetValidator(ValueObject &valobj,
|
|||
}
|
||||
}
|
||||
if (retval) {
|
||||
if (log)
|
||||
log->Printf("[FormatManager::GetValidator] Language search success. "
|
||||
"Returning.");
|
||||
LLDB_LOGF(log, "[FormatManager::GetValidator] Language search success. "
|
||||
"Returning.");
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
if (!retval) {
|
||||
if (log)
|
||||
log->Printf("[FormatManager::GetValidator] Search failed. Giving "
|
||||
"hardcoded a chance.");
|
||||
LLDB_LOGF(log, "[FormatManager::GetValidator] Search failed. Giving "
|
||||
"hardcoded a chance.");
|
||||
retval = GetHardcodedValidator(match_data);
|
||||
}
|
||||
|
||||
if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable())) {
|
||||
if (log)
|
||||
log->Printf("[FormatManager::GetValidator] Caching %p for type %s",
|
||||
static_cast<void *>(retval.get()),
|
||||
match_data.GetTypeForCache().AsCString("<invalid>"));
|
||||
LLDB_LOGF(log, "[FormatManager::GetValidator] Caching %p for type %s",
|
||||
static_cast<void *>(retval.get()),
|
||||
match_data.GetTypeForCache().AsCString("<invalid>"));
|
||||
m_format_cache.SetValidator(match_data.GetTypeForCache(), retval);
|
||||
}
|
||||
LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
|
||||
|
|
|
|||
|
|
@ -180,7 +180,8 @@ TypeCategoryMap::GetFormat(FormattersMatchData &match_data) {
|
|||
|
||||
if (log) {
|
||||
for (auto match : match_data.GetMatchesVector()) {
|
||||
log->Printf(
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"[CategoryMap::GetFormat] candidate match = %s %s %s %s reason = "
|
||||
"%" PRIu32,
|
||||
match.GetTypeName().GetCString(),
|
||||
|
|
@ -194,18 +195,16 @@ TypeCategoryMap::GetFormat(FormattersMatchData &match_data) {
|
|||
for (begin = m_active_categories.begin(); begin != end; begin++) {
|
||||
lldb::TypeCategoryImplSP category_sp = *begin;
|
||||
lldb::TypeFormatImplSP current_format;
|
||||
if (log)
|
||||
log->Printf("[TypeCategoryMap::GetFormat] Trying to use category %s",
|
||||
category_sp->GetName());
|
||||
LLDB_LOGF(log, "[TypeCategoryMap::GetFormat] Trying to use category %s",
|
||||
category_sp->GetName());
|
||||
if (!category_sp->Get(match_data.GetValueObject(),
|
||||
match_data.GetMatchesVector(), current_format,
|
||||
&reason_why))
|
||||
continue;
|
||||
return current_format;
|
||||
}
|
||||
if (log)
|
||||
log->Printf(
|
||||
"[TypeCategoryMap::GetFormat] nothing found - returning empty SP");
|
||||
LLDB_LOGF(log,
|
||||
"[TypeCategoryMap::GetFormat] nothing found - returning empty SP");
|
||||
return lldb::TypeFormatImplSP();
|
||||
}
|
||||
|
||||
|
|
@ -220,7 +219,8 @@ TypeCategoryMap::GetSummaryFormat(FormattersMatchData &match_data) {
|
|||
|
||||
if (log) {
|
||||
for (auto match : match_data.GetMatchesVector()) {
|
||||
log->Printf(
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"[CategoryMap::GetSummaryFormat] candidate match = %s %s %s %s "
|
||||
"reason = %" PRIu32,
|
||||
match.GetTypeName().GetCString(),
|
||||
|
|
@ -234,18 +234,17 @@ TypeCategoryMap::GetSummaryFormat(FormattersMatchData &match_data) {
|
|||
for (begin = m_active_categories.begin(); begin != end; begin++) {
|
||||
lldb::TypeCategoryImplSP category_sp = *begin;
|
||||
lldb::TypeSummaryImplSP current_format;
|
||||
if (log)
|
||||
log->Printf("[CategoryMap::GetSummaryFormat] Trying to use category %s",
|
||||
category_sp->GetName());
|
||||
LLDB_LOGF(log, "[CategoryMap::GetSummaryFormat] Trying to use category %s",
|
||||
category_sp->GetName());
|
||||
if (!category_sp->Get(match_data.GetValueObject(),
|
||||
match_data.GetMatchesVector(), current_format,
|
||||
&reason_why))
|
||||
continue;
|
||||
return current_format;
|
||||
}
|
||||
if (log)
|
||||
log->Printf(
|
||||
"[CategoryMap::GetSummaryFormat] nothing found - returning empty SP");
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"[CategoryMap::GetSummaryFormat] nothing found - returning empty SP");
|
||||
return lldb::TypeSummaryImplSP();
|
||||
}
|
||||
|
||||
|
|
@ -261,7 +260,8 @@ TypeCategoryMap::GetSyntheticChildren(FormattersMatchData &match_data) {
|
|||
|
||||
if (log) {
|
||||
for (auto match : match_data.GetMatchesVector()) {
|
||||
log->Printf(
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"[CategoryMap::GetSyntheticChildren] candidate match = %s %s %s %s "
|
||||
"reason = %" PRIu32,
|
||||
match.GetTypeName().GetCString(),
|
||||
|
|
@ -275,19 +275,18 @@ TypeCategoryMap::GetSyntheticChildren(FormattersMatchData &match_data) {
|
|||
for (begin = m_active_categories.begin(); begin != end; begin++) {
|
||||
lldb::TypeCategoryImplSP category_sp = *begin;
|
||||
lldb::SyntheticChildrenSP current_format;
|
||||
if (log)
|
||||
log->Printf(
|
||||
"[CategoryMap::GetSyntheticChildren] Trying to use category %s",
|
||||
category_sp->GetName());
|
||||
LLDB_LOGF(log,
|
||||
"[CategoryMap::GetSyntheticChildren] Trying to use category %s",
|
||||
category_sp->GetName());
|
||||
if (!category_sp->Get(match_data.GetValueObject(),
|
||||
match_data.GetMatchesVector(), current_format,
|
||||
&reason_why))
|
||||
continue;
|
||||
return current_format;
|
||||
}
|
||||
if (log)
|
||||
log->Printf("[CategoryMap::GetSyntheticChildren] nothing found - returning "
|
||||
"empty SP");
|
||||
LLDB_LOGF(log,
|
||||
"[CategoryMap::GetSyntheticChildren] nothing found - returning "
|
||||
"empty SP");
|
||||
return lldb::SyntheticChildrenSP();
|
||||
}
|
||||
|
||||
|
|
@ -302,7 +301,8 @@ TypeCategoryMap::GetValidator(FormattersMatchData &match_data) {
|
|||
|
||||
if (log) {
|
||||
for (auto match : match_data.GetMatchesVector()) {
|
||||
log->Printf(
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"[CategoryMap::GetValidator] candidate match = %s %s %s %s reason = "
|
||||
"%" PRIu32,
|
||||
match.GetTypeName().GetCString(),
|
||||
|
|
@ -316,18 +316,16 @@ TypeCategoryMap::GetValidator(FormattersMatchData &match_data) {
|
|||
for (begin = m_active_categories.begin(); begin != end; begin++) {
|
||||
lldb::TypeCategoryImplSP category_sp = *begin;
|
||||
lldb::TypeValidatorImplSP current_format;
|
||||
if (log)
|
||||
log->Printf("[CategoryMap::GetValidator] Trying to use category %s",
|
||||
category_sp->GetName());
|
||||
LLDB_LOGF(log, "[CategoryMap::GetValidator] Trying to use category %s",
|
||||
category_sp->GetName());
|
||||
if (!category_sp->Get(match_data.GetValueObject(),
|
||||
match_data.GetMatchesVector(), current_format,
|
||||
&reason_why))
|
||||
continue;
|
||||
return current_format;
|
||||
}
|
||||
if (log)
|
||||
log->Printf(
|
||||
"[CategoryMap::GetValidator] nothing found - returning empty SP");
|
||||
LLDB_LOGF(log,
|
||||
"[CategoryMap::GetValidator] nothing found - returning empty SP");
|
||||
return lldb::TypeValidatorImplSP();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1206,15 +1206,16 @@ bool DWARFExpression::Evaluate(
|
|||
|
||||
if (log && log->GetVerbose()) {
|
||||
size_t count = stack.size();
|
||||
log->Printf("Stack before operation has %" PRIu64 " values:",
|
||||
(uint64_t)count);
|
||||
LLDB_LOGF(log, "Stack before operation has %" PRIu64 " values:",
|
||||
(uint64_t)count);
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
StreamString new_value;
|
||||
new_value.Printf("[%" PRIu64 "]", (uint64_t)i);
|
||||
stack[i].Dump(&new_value);
|
||||
log->Printf(" %s", new_value.GetData());
|
||||
LLDB_LOGF(log, " %s", new_value.GetData());
|
||||
}
|
||||
log->Printf("0x%8.8" PRIx64 ": %s", op_offset, DW_OP_value_to_name(op));
|
||||
LLDB_LOGF(log, "0x%8.8" PRIx64 ": %s", op_offset,
|
||||
DW_OP_value_to_name(op));
|
||||
}
|
||||
|
||||
switch (op) {
|
||||
|
|
@ -2686,9 +2687,8 @@ bool DWARFExpression::Evaluate(
|
|||
} break;
|
||||
|
||||
default:
|
||||
if (log)
|
||||
log->Printf("Unhandled opcode %s in DWARFExpression.",
|
||||
DW_OP_value_to_name(op));
|
||||
LLDB_LOGF(log, "Unhandled opcode %s in DWARFExpression.",
|
||||
DW_OP_value_to_name(op));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -2706,13 +2706,13 @@ bool DWARFExpression::Evaluate(
|
|||
} else {
|
||||
if (log && log->GetVerbose()) {
|
||||
size_t count = stack.size();
|
||||
log->Printf("Stack after operation has %" PRIu64 " values:",
|
||||
(uint64_t)count);
|
||||
LLDB_LOGF(log, "Stack after operation has %" PRIu64 " values:",
|
||||
(uint64_t)count);
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
StreamString new_value;
|
||||
new_value.Printf("[%" PRIu64 "]", (uint64_t)i);
|
||||
stack[i].Dump(&new_value);
|
||||
log->Printf(" %s", new_value.GetData());
|
||||
LLDB_LOGF(log, " %s", new_value.GetData());
|
||||
}
|
||||
}
|
||||
result = stack.back();
|
||||
|
|
|
|||
|
|
@ -45,8 +45,7 @@ void PersistentExpressionState::RegisterExecutionUnit(
|
|||
|
||||
m_execution_units.insert(execution_unit_sp);
|
||||
|
||||
if (log)
|
||||
log->Printf("Registering JITted Functions:\n");
|
||||
LLDB_LOGF(log, "Registering JITted Functions:\n");
|
||||
|
||||
for (const IRExecutionUnit::JittedFunction &jitted_function :
|
||||
execution_unit_sp->GetJittedFunctions()) {
|
||||
|
|
@ -55,15 +54,13 @@ void PersistentExpressionState::RegisterExecutionUnit(
|
|||
jitted_function.m_remote_addr != LLDB_INVALID_ADDRESS) {
|
||||
m_symbol_map[jitted_function.m_name.GetCString()] =
|
||||
jitted_function.m_remote_addr;
|
||||
if (log)
|
||||
log->Printf(" Function: %s at 0x%" PRIx64 ".",
|
||||
jitted_function.m_name.GetCString(),
|
||||
jitted_function.m_remote_addr);
|
||||
LLDB_LOGF(log, " Function: %s at 0x%" PRIx64 ".",
|
||||
jitted_function.m_name.GetCString(),
|
||||
jitted_function.m_remote_addr);
|
||||
}
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("Registering JIIted Symbols:\n");
|
||||
LLDB_LOGF(log, "Registering JIIted Symbols:\n");
|
||||
|
||||
for (const IRExecutionUnit::JittedGlobalVariable &global_var :
|
||||
execution_unit_sp->GetJittedGlobalVariables()) {
|
||||
|
|
@ -74,9 +71,8 @@ void PersistentExpressionState::RegisterExecutionUnit(
|
|||
Mangled mangler(global_var.m_name);
|
||||
mangler.GetDemangledName(lldb::eLanguageTypeUnknown);
|
||||
m_symbol_map[global_var.m_name.GetCString()] = global_var.m_remote_addr;
|
||||
if (log)
|
||||
log->Printf(" Symbol: %s at 0x%" PRIx64 ".",
|
||||
global_var.m_name.GetCString(), global_var.m_remote_addr);
|
||||
LLDB_LOGF(log, " Symbol: %s at 0x%" PRIx64 ".",
|
||||
global_var.m_name.GetCString(), global_var.m_remote_addr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -217,9 +217,8 @@ bool FunctionCaller::InsertFunction(ExecutionContext &exe_ctx,
|
|||
return false;
|
||||
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
|
||||
if (log)
|
||||
log->Printf("Call Address: 0x%" PRIx64 " Struct Address: 0x%" PRIx64 ".\n",
|
||||
m_jit_start_addr, args_addr_ref);
|
||||
LLDB_LOGF(log, "Call Address: 0x%" PRIx64 " Struct Address: 0x%" PRIx64 ".\n",
|
||||
m_jit_start_addr, args_addr_ref);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -231,10 +230,10 @@ lldb::ThreadPlanSP FunctionCaller::GetThreadPlanToCallFunction(
|
|||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS |
|
||||
LIBLLDB_LOG_STEP));
|
||||
|
||||
if (log)
|
||||
log->Printf("-- [FunctionCaller::GetThreadPlanToCallFunction] Creating "
|
||||
"thread plan to call function \"%s\" --",
|
||||
m_name.c_str());
|
||||
LLDB_LOGF(log,
|
||||
"-- [FunctionCaller::GetThreadPlanToCallFunction] Creating "
|
||||
"thread plan to call function \"%s\" --",
|
||||
m_name.c_str());
|
||||
|
||||
// FIXME: Use the errors Stream for better error reporting.
|
||||
Thread *thread = exe_ctx.GetThreadPtr();
|
||||
|
|
@ -271,10 +270,10 @@ bool FunctionCaller::FetchFunctionResults(ExecutionContext &exe_ctx,
|
|||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS |
|
||||
LIBLLDB_LOG_STEP));
|
||||
|
||||
if (log)
|
||||
log->Printf("-- [FunctionCaller::FetchFunctionResults] Fetching function "
|
||||
"results for \"%s\"--",
|
||||
m_name.c_str());
|
||||
LLDB_LOGF(log,
|
||||
"-- [FunctionCaller::FetchFunctionResults] Fetching function "
|
||||
"results for \"%s\"--",
|
||||
m_name.c_str());
|
||||
|
||||
Process *process = exe_ctx.GetProcessPtr();
|
||||
|
||||
|
|
@ -341,10 +340,9 @@ lldb::ExpressionResults FunctionCaller::ExecuteFunction(
|
|||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS |
|
||||
LIBLLDB_LOG_STEP));
|
||||
|
||||
if (log)
|
||||
log->Printf(
|
||||
"== [FunctionCaller::ExecuteFunction] Executing function \"%s\" ==",
|
||||
m_name.c_str());
|
||||
LLDB_LOGF(log,
|
||||
"== [FunctionCaller::ExecuteFunction] Executing function \"%s\" ==",
|
||||
m_name.c_str());
|
||||
|
||||
lldb::ThreadPlanSP call_plan_sp = GetThreadPlanToCallFunction(
|
||||
exe_ctx, args_addr, real_options, diagnostic_manager);
|
||||
|
|
@ -362,13 +360,15 @@ lldb::ExpressionResults FunctionCaller::ExecuteFunction(
|
|||
|
||||
if (log) {
|
||||
if (return_value != lldb::eExpressionCompleted) {
|
||||
log->Printf("== [FunctionCaller::ExecuteFunction] Execution of \"%s\" "
|
||||
"completed abnormally ==",
|
||||
m_name.c_str());
|
||||
LLDB_LOGF(log,
|
||||
"== [FunctionCaller::ExecuteFunction] Execution of \"%s\" "
|
||||
"completed abnormally ==",
|
||||
m_name.c_str());
|
||||
} else {
|
||||
log->Printf("== [FunctionCaller::ExecuteFunction] Execution of \"%s\" "
|
||||
"completed normally ==",
|
||||
m_name.c_str());
|
||||
LLDB_LOGF(log,
|
||||
"== [FunctionCaller::ExecuteFunction] Execution of \"%s\" "
|
||||
"completed normally ==",
|
||||
m_name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -122,10 +122,10 @@ Status IRExecutionUnit::DisassembleFunction(Stream &stream,
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("Found function, has local address 0x%" PRIx64
|
||||
" and remote address 0x%" PRIx64,
|
||||
(uint64_t)func_local_addr, (uint64_t)func_remote_addr);
|
||||
LLDB_LOGF(log,
|
||||
"Found function, has local address 0x%" PRIx64
|
||||
" and remote address 0x%" PRIx64,
|
||||
(uint64_t)func_local_addr, (uint64_t)func_remote_addr);
|
||||
|
||||
std::pair<lldb::addr_t, lldb::addr_t> func_range;
|
||||
|
||||
|
|
@ -138,9 +138,8 @@ Status IRExecutionUnit::DisassembleFunction(Stream &stream,
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("Function's code range is [0x%" PRIx64 "+0x%" PRIx64 "]",
|
||||
func_range.first, func_range.second);
|
||||
LLDB_LOGF(log, "Function's code range is [0x%" PRIx64 "+0x%" PRIx64 "]",
|
||||
func_range.first, func_range.second);
|
||||
|
||||
Target *target = exe_ctx.GetTargetPtr();
|
||||
if (!target) {
|
||||
|
|
@ -188,7 +187,7 @@ Status IRExecutionUnit::DisassembleFunction(Stream &stream,
|
|||
target->GetArchitecture().GetAddressByteSize());
|
||||
|
||||
if (log) {
|
||||
log->Printf("Function data has contents:");
|
||||
LLDB_LOGF(log, "Function data has contents:");
|
||||
extractor.PutToLog(log, 0, extractor.GetByteSize(), func_remote_addr, 16,
|
||||
DataExtractor::TypeUInt8);
|
||||
}
|
||||
|
|
@ -255,7 +254,7 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr,
|
|||
|
||||
oss.flush();
|
||||
|
||||
log->Printf("Module being sent to JIT: \n%s", s.c_str());
|
||||
LLDB_LOGF(log, "Module being sent to JIT: \n%s", s.c_str());
|
||||
}
|
||||
|
||||
m_module_up->getContext().setInlineAsmDiagnosticHandler(ReportInlineAsmError,
|
||||
|
|
@ -433,20 +432,20 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr,
|
|||
}
|
||||
|
||||
if (log) {
|
||||
log->Printf("Code can be run in the target.");
|
||||
LLDB_LOGF(log, "Code can be run in the target.");
|
||||
|
||||
StreamString disassembly_stream;
|
||||
|
||||
Status err = DisassembleFunction(disassembly_stream, process_sp);
|
||||
|
||||
if (!err.Success()) {
|
||||
log->Printf("Couldn't disassemble function : %s",
|
||||
err.AsCString("unknown error"));
|
||||
LLDB_LOGF(log, "Couldn't disassemble function : %s",
|
||||
err.AsCString("unknown error"));
|
||||
} else {
|
||||
log->Printf("Function disassembly:\n%s", disassembly_stream.GetData());
|
||||
LLDB_LOGF(log, "Function disassembly:\n%s", disassembly_stream.GetData());
|
||||
}
|
||||
|
||||
log->Printf("Sections: ");
|
||||
LLDB_LOGF(log, "Sections: ");
|
||||
for (AllocationRecord &record : m_records) {
|
||||
if (record.m_process_address != LLDB_INVALID_ADDRESS) {
|
||||
record.dump(log);
|
||||
|
|
@ -599,11 +598,10 @@ uint8_t *IRExecutionUnit::MemoryManager::allocateCodeSection(
|
|||
GetSectionTypeFromSectionName(SectionName, AllocationKind::Code), Size,
|
||||
Alignment, SectionID, SectionName.str().c_str()));
|
||||
|
||||
if (log) {
|
||||
log->Printf("IRExecutionUnit::allocateCodeSection(Size=0x%" PRIx64
|
||||
", Alignment=%u, SectionID=%u) = %p",
|
||||
(uint64_t)Size, Alignment, SectionID, (void *)return_value);
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"IRExecutionUnit::allocateCodeSection(Size=0x%" PRIx64
|
||||
", Alignment=%u, SectionID=%u) = %p",
|
||||
(uint64_t)Size, Alignment, SectionID, (void *)return_value);
|
||||
|
||||
if (m_parent.m_reported_allocations) {
|
||||
Status err;
|
||||
|
|
@ -631,11 +629,10 @@ uint8_t *IRExecutionUnit::MemoryManager::allocateDataSection(
|
|||
(uintptr_t)return_value, permissions,
|
||||
GetSectionTypeFromSectionName(SectionName, AllocationKind::Data), Size,
|
||||
Alignment, SectionID, SectionName.str().c_str()));
|
||||
if (log) {
|
||||
log->Printf("IRExecutionUnit::allocateDataSection(Size=0x%" PRIx64
|
||||
", Alignment=%u, SectionID=%u) = %p",
|
||||
(uint64_t)Size, Alignment, SectionID, (void *)return_value);
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"IRExecutionUnit::allocateDataSection(Size=0x%" PRIx64
|
||||
", Alignment=%u, SectionID=%u) = %p",
|
||||
(uint64_t)Size, Alignment, SectionID, (void *)return_value);
|
||||
|
||||
if (m_parent.m_reported_allocations) {
|
||||
Status err;
|
||||
|
|
@ -1042,17 +1039,15 @@ IRExecutionUnit::MemoryManager::GetSymbolAddressAndPresence(
|
|||
lldb::addr_t ret = m_parent.FindSymbol(name_cs, missing_weak);
|
||||
|
||||
if (ret == LLDB_INVALID_ADDRESS) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"IRExecutionUnit::getSymbolAddress(Name=\"%s\") = <not found>",
|
||||
Name.c_str());
|
||||
LLDB_LOGF(log,
|
||||
"IRExecutionUnit::getSymbolAddress(Name=\"%s\") = <not found>",
|
||||
Name.c_str());
|
||||
|
||||
m_parent.ReportSymbolLookupError(name_cs);
|
||||
return 0;
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("IRExecutionUnit::getSymbolAddress(Name=\"%s\") = %" PRIx64,
|
||||
Name.c_str(), ret);
|
||||
LLDB_LOGF(log, "IRExecutionUnit::getSymbolAddress(Name=\"%s\") = %" PRIx64,
|
||||
Name.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
@ -1075,15 +1070,14 @@ IRExecutionUnit::GetRemoteAddressForLocal(lldb::addr_t local_address) {
|
|||
lldb::addr_t ret =
|
||||
record.m_process_address + (local_address - record.m_host_address);
|
||||
|
||||
if (log) {
|
||||
log->Printf(
|
||||
"IRExecutionUnit::GetRemoteAddressForLocal() found 0x%" PRIx64
|
||||
" in [0x%" PRIx64 "..0x%" PRIx64 "], and returned 0x%" PRIx64
|
||||
" from [0x%" PRIx64 "..0x%" PRIx64 "].",
|
||||
local_address, (uint64_t)record.m_host_address,
|
||||
(uint64_t)record.m_host_address + (uint64_t)record.m_size, ret,
|
||||
record.m_process_address, record.m_process_address + record.m_size);
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"IRExecutionUnit::GetRemoteAddressForLocal() found 0x%" PRIx64
|
||||
" in [0x%" PRIx64 "..0x%" PRIx64 "], and returned 0x%" PRIx64
|
||||
" from [0x%" PRIx64 "..0x%" PRIx64 "].",
|
||||
local_address, (uint64_t)record.m_host_address,
|
||||
(uint64_t)record.m_host_address + (uint64_t)record.m_size, ret,
|
||||
record.m_process_address,
|
||||
record.m_process_address + record.m_size);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1210,10 +1204,11 @@ void IRExecutionUnit::AllocationRecord::dump(Log *log) {
|
|||
if (!log)
|
||||
return;
|
||||
|
||||
log->Printf("[0x%llx+0x%llx]->0x%llx (alignment %d, section ID %d, name %s)",
|
||||
(unsigned long long)m_host_address, (unsigned long long)m_size,
|
||||
(unsigned long long)m_process_address, (unsigned)m_alignment,
|
||||
(unsigned)m_section_id, m_name.c_str());
|
||||
LLDB_LOGF(log,
|
||||
"[0x%llx+0x%llx]->0x%llx (alignment %d, section ID %d, name %s)",
|
||||
(unsigned long long)m_host_address, (unsigned long long)m_size,
|
||||
(unsigned long long)m_process_address, (unsigned)m_alignment,
|
||||
(unsigned)m_section_id, m_name.c_str());
|
||||
}
|
||||
|
||||
lldb::ByteOrder IRExecutionUnit::GetByteOrder() const {
|
||||
|
|
|
|||
|
|
@ -327,10 +327,11 @@ public:
|
|||
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
|
||||
|
||||
if (log) {
|
||||
log->Printf("Made an allocation for argument %s",
|
||||
PrintValue(value).c_str());
|
||||
log->Printf(" Data region : %llx", (unsigned long long)address);
|
||||
log->Printf(" 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;
|
||||
|
|
@ -494,8 +495,7 @@ bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function,
|
|||
++fi) {
|
||||
if (fi->begin() != fi->end()) {
|
||||
if (saw_function_with_body) {
|
||||
if (log)
|
||||
log->Printf("More than one function in the module has a body");
|
||||
LLDB_LOGF(log, "More than one function in the module has a body");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(too_many_functions_error);
|
||||
return false;
|
||||
|
|
@ -510,8 +510,7 @@ bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function,
|
|||
++ii) {
|
||||
switch (ii->getOpcode()) {
|
||||
default: {
|
||||
if (log)
|
||||
log->Printf("Unsupported instruction: %s", PrintValue(&*ii).c_str());
|
||||
LLDB_LOGF(log, "Unsupported instruction: %s", PrintValue(&*ii).c_str());
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(unsupported_opcode_error);
|
||||
return false;
|
||||
|
|
@ -532,9 +531,8 @@ bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function,
|
|||
}
|
||||
|
||||
if (!CanIgnoreCall(call_inst) && !support_function_calls) {
|
||||
if (log)
|
||||
log->Printf("Unsupported instruction: %s",
|
||||
PrintValue(&*ii).c_str());
|
||||
LLDB_LOGF(log, "Unsupported instruction: %s",
|
||||
PrintValue(&*ii).c_str());
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(unsupported_opcode_error);
|
||||
return false;
|
||||
|
|
@ -553,9 +551,8 @@ bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function,
|
|||
|
||||
switch (icmp_inst->getPredicate()) {
|
||||
default: {
|
||||
if (log)
|
||||
log->Printf("Unsupported ICmp predicate: %s",
|
||||
PrintValue(&*ii).c_str());
|
||||
LLDB_LOGF(log, "Unsupported ICmp predicate: %s",
|
||||
PrintValue(&*ii).c_str());
|
||||
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(unsupported_opcode_error);
|
||||
|
|
@ -605,9 +602,8 @@ bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function,
|
|||
default:
|
||||
break;
|
||||
case Type::VectorTyID: {
|
||||
if (log)
|
||||
log->Printf("Unsupported operand type: %s",
|
||||
PrintType(operand_type).c_str());
|
||||
LLDB_LOGF(log, "Unsupported operand type: %s",
|
||||
PrintType(operand_type).c_str());
|
||||
error.SetErrorString(unsupported_operand_error);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -618,18 +614,16 @@ bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function,
|
|||
// we can just fall back to the JIT rather than
|
||||
// choking.
|
||||
if (operand_type->getPrimitiveSizeInBits() > 64) {
|
||||
if (log)
|
||||
log->Printf("Unsupported operand type: %s",
|
||||
PrintType(operand_type).c_str());
|
||||
LLDB_LOGF(log, "Unsupported operand type: %s",
|
||||
PrintType(operand_type).c_str());
|
||||
error.SetErrorString(unsupported_operand_error);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Constant *constant = llvm::dyn_cast<Constant>(operand)) {
|
||||
if (!CanResolveConstant(constant)) {
|
||||
if (log)
|
||||
log->Printf("Unsupported constant: %s",
|
||||
PrintValue(constant).c_str());
|
||||
LLDB_LOGF(log, "Unsupported constant: %s",
|
||||
PrintValue(constant).c_str());
|
||||
error.SetErrorString(unsupported_operand_error);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -659,8 +653,8 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
|
||||
oss.flush();
|
||||
|
||||
log->Printf("Module as passed in to IRInterpreter::Interpret: \n\"%s\"",
|
||||
s.c_str());
|
||||
LLDB_LOGF(log, "Module as passed in to IRInterpreter::Interpret: \n\"%s\"",
|
||||
s.c_str());
|
||||
}
|
||||
|
||||
DataLayout data_layout(&module);
|
||||
|
|
@ -694,8 +688,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
while (frame.m_ii != frame.m_ie && (++num_insts < 4096)) {
|
||||
const Instruction *inst = &*frame.m_ii;
|
||||
|
||||
if (log)
|
||||
log->Printf("Interpreting %s", PrintValue(inst).c_str());
|
||||
LLDB_LOGF(log, "Interpreting %s", PrintValue(inst).c_str());
|
||||
|
||||
switch (inst->getOpcode()) {
|
||||
default:
|
||||
|
|
@ -717,10 +710,10 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
const BinaryOperator *bin_op = dyn_cast<BinaryOperator>(inst);
|
||||
|
||||
if (!bin_op) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"getOpcode() returns %s, but instruction is not a BinaryOperator",
|
||||
inst->getOpcodeName());
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"getOpcode() returns %s, but instruction is not a BinaryOperator",
|
||||
inst->getOpcodeName());
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(interpreter_internal_error);
|
||||
return false;
|
||||
|
|
@ -733,16 +726,14 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
lldb_private::Scalar R;
|
||||
|
||||
if (!frame.EvaluateValue(L, lhs, module)) {
|
||||
if (log)
|
||||
log->Printf("Couldn't evaluate %s", PrintValue(lhs).c_str());
|
||||
LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(lhs).c_str());
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(bad_value_error);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!frame.EvaluateValue(R, rhs, module)) {
|
||||
if (log)
|
||||
log->Printf("Couldn't evaluate %s", PrintValue(rhs).c_str());
|
||||
LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(rhs).c_str());
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(bad_value_error);
|
||||
return false;
|
||||
|
|
@ -806,28 +797,26 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
frame.AssignValue(inst, result, module);
|
||||
|
||||
if (log) {
|
||||
log->Printf("Interpreted a %s", inst->getOpcodeName());
|
||||
log->Printf(" L : %s", frame.SummarizeValue(lhs).c_str());
|
||||
log->Printf(" R : %s", frame.SummarizeValue(rhs).c_str());
|
||||
log->Printf(" = : %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 = dyn_cast<AllocaInst>(inst);
|
||||
|
||||
if (!alloca_inst) {
|
||||
if (log)
|
||||
log->Printf("getOpcode() returns Alloca, but instruction is not an "
|
||||
"AllocaInst");
|
||||
LLDB_LOGF(log, "getOpcode() returns Alloca, but instruction is not an "
|
||||
"AllocaInst");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(interpreter_internal_error);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (alloca_inst->isArrayAllocation()) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"AllocaInsts are not handled if isArrayAllocation() is true");
|
||||
LLDB_LOGF(log,
|
||||
"AllocaInsts are not handled if isArrayAllocation() is true");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(unsupported_opcode_error);
|
||||
return false;
|
||||
|
|
@ -846,8 +835,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
lldb::addr_t R = frame.Malloc(T);
|
||||
|
||||
if (R == LLDB_INVALID_ADDRESS) {
|
||||
if (log)
|
||||
log->Printf("Couldn't allocate memory for an AllocaInst");
|
||||
LLDB_LOGF(log, "Couldn't allocate memory for an AllocaInst");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(memory_allocation_error);
|
||||
return false;
|
||||
|
|
@ -856,8 +844,8 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
lldb::addr_t P = frame.Malloc(Tptr);
|
||||
|
||||
if (P == LLDB_INVALID_ADDRESS) {
|
||||
if (log)
|
||||
log->Printf("Couldn't allocate the result pointer for an AllocaInst");
|
||||
LLDB_LOGF(log,
|
||||
"Couldn't allocate the result pointer for an AllocaInst");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(memory_allocation_error);
|
||||
return false;
|
||||
|
|
@ -868,8 +856,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
execution_unit.WritePointerToMemory(P, R, write_error);
|
||||
|
||||
if (!write_error.Success()) {
|
||||
if (log)
|
||||
log->Printf("Couldn't write the result pointer for an AllocaInst");
|
||||
LLDB_LOGF(log, "Couldn't write the result pointer for an AllocaInst");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(memory_write_error);
|
||||
lldb_private::Status free_error;
|
||||
|
|
@ -881,9 +868,9 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
frame.m_values[alloca_inst] = P;
|
||||
|
||||
if (log) {
|
||||
log->Printf("Interpreted an AllocaInst");
|
||||
log->Printf(" R : 0x%" PRIx64, R);
|
||||
log->Printf(" 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:
|
||||
|
|
@ -891,10 +878,9 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
const CastInst *cast_inst = dyn_cast<CastInst>(inst);
|
||||
|
||||
if (!cast_inst) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"getOpcode() returns %s, but instruction is not a BitCastInst",
|
||||
cast_inst->getOpcodeName());
|
||||
LLDB_LOGF(
|
||||
log, "getOpcode() returns %s, but instruction is not a BitCastInst",
|
||||
cast_inst->getOpcodeName());
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(interpreter_internal_error);
|
||||
return false;
|
||||
|
|
@ -905,8 +891,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
lldb_private::Scalar S;
|
||||
|
||||
if (!frame.EvaluateValue(S, source, module)) {
|
||||
if (log)
|
||||
log->Printf("Couldn't evaluate %s", PrintValue(source).c_str());
|
||||
LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(source).c_str());
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(bad_value_error);
|
||||
return false;
|
||||
|
|
@ -918,10 +903,9 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
const CastInst *cast_inst = dyn_cast<CastInst>(inst);
|
||||
|
||||
if (!cast_inst) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"getOpcode() returns %s, but instruction is not a BitCastInst",
|
||||
cast_inst->getOpcodeName());
|
||||
LLDB_LOGF(
|
||||
log, "getOpcode() returns %s, but instruction is not a BitCastInst",
|
||||
cast_inst->getOpcodeName());
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(interpreter_internal_error);
|
||||
return false;
|
||||
|
|
@ -932,8 +916,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
lldb_private::Scalar S;
|
||||
|
||||
if (!frame.EvaluateValue(S, source, module)) {
|
||||
if (log)
|
||||
log->Printf("Couldn't evaluate %s", PrintValue(source).c_str());
|
||||
LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(source).c_str());
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(bad_value_error);
|
||||
return false;
|
||||
|
|
@ -949,9 +932,8 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
const BranchInst *br_inst = dyn_cast<BranchInst>(inst);
|
||||
|
||||
if (!br_inst) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"getOpcode() returns Br, but instruction is not a BranchInst");
|
||||
LLDB_LOGF(
|
||||
log, "getOpcode() returns Br, but instruction is not a BranchInst");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(interpreter_internal_error);
|
||||
return false;
|
||||
|
|
@ -963,8 +945,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
lldb_private::Scalar C;
|
||||
|
||||
if (!frame.EvaluateValue(C, condition, module)) {
|
||||
if (log)
|
||||
log->Printf("Couldn't evaluate %s", PrintValue(condition).c_str());
|
||||
LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(condition).c_str());
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(bad_value_error);
|
||||
return false;
|
||||
|
|
@ -976,14 +957,15 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
frame.Jump(br_inst->getSuccessor(1));
|
||||
|
||||
if (log) {
|
||||
log->Printf("Interpreted a BrInst with a condition");
|
||||
log->Printf(" cond : %s", frame.SummarizeValue(condition).c_str());
|
||||
LLDB_LOGF(log, "Interpreted a BrInst with a condition");
|
||||
LLDB_LOGF(log, " cond : %s",
|
||||
frame.SummarizeValue(condition).c_str());
|
||||
}
|
||||
} else {
|
||||
frame.Jump(br_inst->getSuccessor(0));
|
||||
|
||||
if (log) {
|
||||
log->Printf("Interpreted a BrInst with no condition");
|
||||
LLDB_LOGF(log, "Interpreted a BrInst with no condition");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -992,17 +974,16 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
const PHINode *phi_inst = dyn_cast<PHINode>(inst);
|
||||
|
||||
if (!phi_inst) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"getOpcode() returns PHI, but instruction is not a PHINode");
|
||||
LLDB_LOGF(log,
|
||||
"getOpcode() returns PHI, but instruction is not a PHINode");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(interpreter_internal_error);
|
||||
return false;
|
||||
}
|
||||
if (!frame.m_prev_bb) {
|
||||
if (log)
|
||||
log->Printf("Encountered PHI node without having jumped from another "
|
||||
"basic block");
|
||||
LLDB_LOGF(log,
|
||||
"Encountered PHI node without having jumped from another "
|
||||
"basic block");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(interpreter_internal_error);
|
||||
return false;
|
||||
|
|
@ -1011,8 +992,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
Value *value = phi_inst->getIncomingValueForBlock(frame.m_prev_bb);
|
||||
lldb_private::Scalar result;
|
||||
if (!frame.EvaluateValue(result, value, module)) {
|
||||
if (log)
|
||||
log->Printf("Couldn't evaluate %s", PrintValue(value).c_str());
|
||||
LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(value).c_str());
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(bad_value_error);
|
||||
return false;
|
||||
|
|
@ -1020,18 +1000,17 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
frame.AssignValue(inst, result, module);
|
||||
|
||||
if (log) {
|
||||
log->Printf("Interpreted a %s", inst->getOpcodeName());
|
||||
log->Printf(" 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 = dyn_cast<GetElementPtrInst>(inst);
|
||||
|
||||
if (!gep_inst) {
|
||||
if (log)
|
||||
log->Printf("getOpcode() returns GetElementPtr, but instruction is "
|
||||
"not a GetElementPtrInst");
|
||||
LLDB_LOGF(log, "getOpcode() returns GetElementPtr, but instruction is "
|
||||
"not a GetElementPtrInst");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(interpreter_internal_error);
|
||||
return false;
|
||||
|
|
@ -1043,9 +1022,8 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
lldb_private::Scalar P;
|
||||
|
||||
if (!frame.EvaluateValue(P, pointer_operand, module)) {
|
||||
if (log)
|
||||
log->Printf("Couldn't evaluate %s",
|
||||
PrintValue(pointer_operand).c_str());
|
||||
LLDB_LOGF(log, "Couldn't evaluate %s",
|
||||
PrintValue(pointer_operand).c_str());
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(bad_value_error);
|
||||
return false;
|
||||
|
|
@ -1067,17 +1045,14 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
lldb_private::Scalar I;
|
||||
|
||||
if (!frame.EvaluateValue(I, *ii, module)) {
|
||||
if (log)
|
||||
log->Printf("Couldn't evaluate %s", PrintValue(*ii).c_str());
|
||||
LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(*ii).c_str());
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(bad_value_error);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("Evaluated constant index %s as %llu",
|
||||
PrintValue(*ii).c_str(),
|
||||
I.ULongLong(LLDB_INVALID_ADDRESS));
|
||||
LLDB_LOGF(log, "Evaluated constant index %s as %llu",
|
||||
PrintValue(*ii).c_str(), I.ULongLong(LLDB_INVALID_ADDRESS));
|
||||
|
||||
constant_index = cast<ConstantInt>(ConstantInt::get(
|
||||
(*ii)->getType(), I.ULongLong(LLDB_INVALID_ADDRESS)));
|
||||
|
|
@ -1094,19 +1069,19 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
frame.AssignValue(inst, Poffset, module);
|
||||
|
||||
if (log) {
|
||||
log->Printf("Interpreted a GetElementPtrInst");
|
||||
log->Printf(" P : %s",
|
||||
frame.SummarizeValue(pointer_operand).c_str());
|
||||
log->Printf(" 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::ICmp: {
|
||||
const ICmpInst *icmp_inst = dyn_cast<ICmpInst>(inst);
|
||||
|
||||
if (!icmp_inst) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"getOpcode() returns ICmp, but instruction is not an ICmpInst");
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"getOpcode() returns ICmp, but instruction is not an ICmpInst");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(interpreter_internal_error);
|
||||
return false;
|
||||
|
|
@ -1121,16 +1096,14 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
lldb_private::Scalar R;
|
||||
|
||||
if (!frame.EvaluateValue(L, lhs, module)) {
|
||||
if (log)
|
||||
log->Printf("Couldn't evaluate %s", PrintValue(lhs).c_str());
|
||||
LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(lhs).c_str());
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(bad_value_error);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!frame.EvaluateValue(R, rhs, module)) {
|
||||
if (log)
|
||||
log->Printf("Couldn't evaluate %s", PrintValue(rhs).c_str());
|
||||
LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(rhs).c_str());
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(bad_value_error);
|
||||
return false;
|
||||
|
|
@ -1192,19 +1165,19 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
frame.AssignValue(inst, result, module);
|
||||
|
||||
if (log) {
|
||||
log->Printf("Interpreted an ICmpInst");
|
||||
log->Printf(" L : %s", frame.SummarizeValue(lhs).c_str());
|
||||
log->Printf(" R : %s", frame.SummarizeValue(rhs).c_str());
|
||||
log->Printf(" = : %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 = dyn_cast<IntToPtrInst>(inst);
|
||||
|
||||
if (!int_to_ptr_inst) {
|
||||
if (log)
|
||||
log->Printf("getOpcode() returns IntToPtr, but instruction is not an "
|
||||
"IntToPtrInst");
|
||||
LLDB_LOGF(log,
|
||||
"getOpcode() returns IntToPtr, but instruction is not an "
|
||||
"IntToPtrInst");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(interpreter_internal_error);
|
||||
return false;
|
||||
|
|
@ -1215,8 +1188,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
lldb_private::Scalar I;
|
||||
|
||||
if (!frame.EvaluateValue(I, src_operand, module)) {
|
||||
if (log)
|
||||
log->Printf("Couldn't evaluate %s", PrintValue(src_operand).c_str());
|
||||
LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(src_operand).c_str());
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(bad_value_error);
|
||||
return false;
|
||||
|
|
@ -1225,18 +1197,18 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
frame.AssignValue(inst, I, module);
|
||||
|
||||
if (log) {
|
||||
log->Printf("Interpreted an IntToPtr");
|
||||
log->Printf(" Src : %s", frame.SummarizeValue(src_operand).c_str());
|
||||
log->Printf(" = : %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 = dyn_cast<PtrToIntInst>(inst);
|
||||
|
||||
if (!ptr_to_int_inst) {
|
||||
if (log)
|
||||
log->Printf("getOpcode() returns PtrToInt, but instruction is not an "
|
||||
"PtrToIntInst");
|
||||
LLDB_LOGF(log,
|
||||
"getOpcode() returns PtrToInt, but instruction is not an "
|
||||
"PtrToIntInst");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(interpreter_internal_error);
|
||||
return false;
|
||||
|
|
@ -1247,8 +1219,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
lldb_private::Scalar I;
|
||||
|
||||
if (!frame.EvaluateValue(I, src_operand, module)) {
|
||||
if (log)
|
||||
log->Printf("Couldn't evaluate %s", PrintValue(src_operand).c_str());
|
||||
LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(src_operand).c_str());
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(bad_value_error);
|
||||
return false;
|
||||
|
|
@ -1257,18 +1228,18 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
frame.AssignValue(inst, I, module);
|
||||
|
||||
if (log) {
|
||||
log->Printf("Interpreted a PtrToInt");
|
||||
log->Printf(" Src : %s", frame.SummarizeValue(src_operand).c_str());
|
||||
log->Printf(" = : %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 = dyn_cast<TruncInst>(inst);
|
||||
|
||||
if (!trunc_inst) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"getOpcode() returns Trunc, but instruction is not a TruncInst");
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"getOpcode() returns Trunc, but instruction is not a TruncInst");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(interpreter_internal_error);
|
||||
return false;
|
||||
|
|
@ -1279,8 +1250,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
lldb_private::Scalar I;
|
||||
|
||||
if (!frame.EvaluateValue(I, src_operand, module)) {
|
||||
if (log)
|
||||
log->Printf("Couldn't evaluate %s", PrintValue(src_operand).c_str());
|
||||
LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(src_operand).c_str());
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(bad_value_error);
|
||||
return false;
|
||||
|
|
@ -1289,18 +1259,17 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
frame.AssignValue(inst, I, module);
|
||||
|
||||
if (log) {
|
||||
log->Printf("Interpreted a Trunc");
|
||||
log->Printf(" Src : %s", frame.SummarizeValue(src_operand).c_str());
|
||||
log->Printf(" = : %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::Load: {
|
||||
const LoadInst *load_inst = dyn_cast<LoadInst>(inst);
|
||||
|
||||
if (!load_inst) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"getOpcode() returns Load, but instruction is not a LoadInst");
|
||||
LLDB_LOGF(
|
||||
log, "getOpcode() returns Load, but instruction is not a LoadInst");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(interpreter_internal_error);
|
||||
return false;
|
||||
|
|
@ -1317,8 +1286,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
Type *pointer_ty = pointer_operand->getType();
|
||||
PointerType *pointer_ptr_ty = dyn_cast<PointerType>(pointer_ty);
|
||||
if (!pointer_ptr_ty) {
|
||||
if (log)
|
||||
log->Printf("getPointerOperand()->getType() is not a PointerType");
|
||||
LLDB_LOGF(log, "getPointerOperand()->getType() is not a PointerType");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(interpreter_internal_error);
|
||||
return false;
|
||||
|
|
@ -1329,16 +1297,14 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
lldb::addr_t P = frame.ResolveValue(pointer_operand, module);
|
||||
|
||||
if (D == LLDB_INVALID_ADDRESS) {
|
||||
if (log)
|
||||
log->Printf("LoadInst's value doesn't resolve to anything");
|
||||
LLDB_LOGF(log, "LoadInst's value doesn't resolve to anything");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(bad_value_error);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (P == LLDB_INVALID_ADDRESS) {
|
||||
if (log)
|
||||
log->Printf("LoadInst's pointer doesn't resolve to anything");
|
||||
LLDB_LOGF(log, "LoadInst's pointer doesn't resolve to anything");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(bad_value_error);
|
||||
return false;
|
||||
|
|
@ -1349,8 +1315,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
execution_unit.ReadPointerFromMemory(&R, P, read_error);
|
||||
|
||||
if (!read_error.Success()) {
|
||||
if (log)
|
||||
log->Printf("Couldn't read the address to be loaded for a LoadInst");
|
||||
LLDB_LOGF(log, "Couldn't read the address to be loaded for a LoadInst");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(memory_read_error);
|
||||
return false;
|
||||
|
|
@ -1363,8 +1328,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
execution_unit.ReadMemory(buffer.GetBytes(), R, buffer.GetByteSize(),
|
||||
read_error);
|
||||
if (!read_error.Success()) {
|
||||
if (log)
|
||||
log->Printf("Couldn't read from a region on behalf of a LoadInst");
|
||||
LLDB_LOGF(log, "Couldn't read from a region on behalf of a LoadInst");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(memory_read_error);
|
||||
return false;
|
||||
|
|
@ -1374,18 +1338,17 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
execution_unit.WriteMemory(D, buffer.GetBytes(), buffer.GetByteSize(),
|
||||
write_error);
|
||||
if (!write_error.Success()) {
|
||||
if (log)
|
||||
log->Printf("Couldn't write to a region on behalf of a LoadInst");
|
||||
LLDB_LOGF(log, "Couldn't write to a region on behalf of a LoadInst");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(memory_read_error);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (log) {
|
||||
log->Printf("Interpreted a LoadInst");
|
||||
log->Printf(" P : 0x%" PRIx64, P);
|
||||
log->Printf(" R : 0x%" PRIx64, R);
|
||||
log->Printf(" 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: {
|
||||
|
|
@ -1395,9 +1358,9 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
const StoreInst *store_inst = dyn_cast<StoreInst>(inst);
|
||||
|
||||
if (!store_inst) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"getOpcode() returns Store, but instruction is not a StoreInst");
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"getOpcode() returns Store, but instruction is not a StoreInst");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(interpreter_internal_error);
|
||||
return false;
|
||||
|
|
@ -1422,16 +1385,14 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
lldb::addr_t P = frame.ResolveValue(pointer_operand, module);
|
||||
|
||||
if (D == LLDB_INVALID_ADDRESS) {
|
||||
if (log)
|
||||
log->Printf("StoreInst's value doesn't resolve to anything");
|
||||
LLDB_LOGF(log, "StoreInst's value doesn't resolve to anything");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(bad_value_error);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (P == LLDB_INVALID_ADDRESS) {
|
||||
if (log)
|
||||
log->Printf("StoreInst's pointer doesn't resolve to anything");
|
||||
LLDB_LOGF(log, "StoreInst's pointer doesn't resolve to anything");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(bad_value_error);
|
||||
return false;
|
||||
|
|
@ -1442,8 +1403,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
execution_unit.ReadPointerFromMemory(&R, P, read_error);
|
||||
|
||||
if (!read_error.Success()) {
|
||||
if (log)
|
||||
log->Printf("Couldn't read the address to be loaded for a LoadInst");
|
||||
LLDB_LOGF(log, "Couldn't read the address to be loaded for a LoadInst");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(memory_read_error);
|
||||
return false;
|
||||
|
|
@ -1456,8 +1416,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
execution_unit.ReadMemory(buffer.GetBytes(), D, buffer.GetByteSize(),
|
||||
read_error);
|
||||
if (!read_error.Success()) {
|
||||
if (log)
|
||||
log->Printf("Couldn't read from a region on behalf of a StoreInst");
|
||||
LLDB_LOGF(log, "Couldn't read from a region on behalf of a StoreInst");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(memory_read_error);
|
||||
return false;
|
||||
|
|
@ -1467,28 +1426,26 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
|||
execution_unit.WriteMemory(R, buffer.GetBytes(), buffer.GetByteSize(),
|
||||
write_error);
|
||||
if (!write_error.Success()) {
|
||||
if (log)
|
||||
log->Printf("Couldn't write to a region on behalf of a StoreInst");
|
||||
LLDB_LOGF(log, "Couldn't write to a region on behalf of a StoreInst");
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(memory_write_error);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (log) {
|
||||
log->Printf("Interpreted a StoreInst");
|
||||
log->Printf(" D : 0x%" PRIx64, D);
|
||||
log->Printf(" P : 0x%" PRIx64, P);
|
||||
log->Printf(" 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 = dyn_cast<CallInst>(inst);
|
||||
|
||||
if (!call_inst) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"getOpcode() returns %s, but instruction is not a CallInst",
|
||||
inst->getOpcodeName());
|
||||
LLDB_LOGF(log,
|
||||
"getOpcode() returns %s, but instruction is not a CallInst",
|
||||
inst->getOpcodeName());
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString(interpreter_internal_error);
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -327,12 +327,12 @@ lldb::addr_t IRMemoryMap::Malloc(size_t size, uint8_t alignment,
|
|||
break;
|
||||
case eAllocationPolicyMirror:
|
||||
process_sp = m_process_wp.lock();
|
||||
if (log)
|
||||
log->Printf("IRMemoryMap::%s process_sp=0x%" PRIx64
|
||||
", process_sp->CanJIT()=%s, process_sp->IsAlive()=%s",
|
||||
__FUNCTION__, (lldb::addr_t)process_sp.get(),
|
||||
process_sp && process_sp->CanJIT() ? "true" : "false",
|
||||
process_sp && process_sp->IsAlive() ? "true" : "false");
|
||||
LLDB_LOGF(log,
|
||||
"IRMemoryMap::%s process_sp=0x%" PRIx64
|
||||
", process_sp->CanJIT()=%s, process_sp->IsAlive()=%s",
|
||||
__FUNCTION__, (lldb::addr_t)process_sp.get(),
|
||||
process_sp && process_sp->CanJIT() ? "true" : "false",
|
||||
process_sp && process_sp->IsAlive() ? "true" : "false");
|
||||
if (process_sp && process_sp->CanJIT() && process_sp->IsAlive()) {
|
||||
if (!zero_memory)
|
||||
allocation_address =
|
||||
|
|
@ -344,10 +344,10 @@ lldb::addr_t IRMemoryMap::Malloc(size_t size, uint8_t alignment,
|
|||
if (!error.Success())
|
||||
return LLDB_INVALID_ADDRESS;
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("IRMemoryMap::%s switching to eAllocationPolicyHostOnly "
|
||||
"due to failed condition (see previous expr log message)",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log,
|
||||
"IRMemoryMap::%s switching to eAllocationPolicyHostOnly "
|
||||
"due to failed condition (see previous expr log message)",
|
||||
__FUNCTION__);
|
||||
policy = eAllocationPolicyHostOnly;
|
||||
allocation_address = FindSpace(allocation_size);
|
||||
if (allocation_address == LLDB_INVALID_ADDRESS) {
|
||||
|
|
@ -417,10 +417,11 @@ lldb::addr_t IRMemoryMap::Malloc(size_t size, uint8_t alignment,
|
|||
break;
|
||||
}
|
||||
|
||||
log->Printf("IRMemoryMap::Malloc (%" PRIu64 ", 0x%" PRIx64 ", 0x%" PRIx64
|
||||
", %s) -> 0x%" PRIx64,
|
||||
(uint64_t)allocation_size, (uint64_t)alignment,
|
||||
(uint64_t)permissions, policy_string, aligned_address);
|
||||
LLDB_LOGF(log,
|
||||
"IRMemoryMap::Malloc (%" PRIu64 ", 0x%" PRIx64 ", 0x%" PRIx64
|
||||
", %s) -> 0x%" PRIx64,
|
||||
(uint64_t)allocation_size, (uint64_t)alignment,
|
||||
(uint64_t)permissions, policy_string, aligned_address);
|
||||
}
|
||||
|
||||
return aligned_address;
|
||||
|
|
@ -477,10 +478,11 @@ void IRMemoryMap::Free(lldb::addr_t process_address, Status &error) {
|
|||
|
||||
if (lldb_private::Log *log =
|
||||
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) {
|
||||
log->Printf("IRMemoryMap::Free (0x%" PRIx64 ") freed [0x%" PRIx64
|
||||
"..0x%" PRIx64 ")",
|
||||
(uint64_t)process_address, iter->second.m_process_start,
|
||||
iter->second.m_process_start + iter->second.m_size);
|
||||
LLDB_LOGF(log,
|
||||
"IRMemoryMap::Free (0x%" PRIx64 ") freed [0x%" PRIx64
|
||||
"..0x%" PRIx64 ")",
|
||||
(uint64_t)process_address, iter->second.m_process_start,
|
||||
iter->second.m_process_start + iter->second.m_size);
|
||||
}
|
||||
|
||||
m_allocations.erase(iter);
|
||||
|
|
@ -574,12 +576,13 @@ void IRMemoryMap::WriteMemory(lldb::addr_t process_address,
|
|||
|
||||
if (lldb_private::Log *log =
|
||||
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) {
|
||||
log->Printf("IRMemoryMap::WriteMemory (0x%" PRIx64 ", 0x%" PRIx64
|
||||
", 0x%" PRId64 ") went to [0x%" PRIx64 "..0x%" PRIx64 ")",
|
||||
(uint64_t)process_address, (uint64_t)bytes, (uint64_t)size,
|
||||
(uint64_t)allocation.m_process_start,
|
||||
(uint64_t)allocation.m_process_start +
|
||||
(uint64_t)allocation.m_size);
|
||||
LLDB_LOGF(log,
|
||||
"IRMemoryMap::WriteMemory (0x%" PRIx64 ", 0x%" PRIx64
|
||||
", 0x%" PRId64 ") went to [0x%" PRIx64 "..0x%" PRIx64 ")",
|
||||
(uint64_t)process_address, (uint64_t)bytes, (uint64_t)size,
|
||||
(uint64_t)allocation.m_process_start,
|
||||
(uint64_t)allocation.m_process_start +
|
||||
(uint64_t)allocation.m_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -704,12 +707,13 @@ void IRMemoryMap::ReadMemory(uint8_t *bytes, lldb::addr_t process_address,
|
|||
|
||||
if (lldb_private::Log *log =
|
||||
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) {
|
||||
log->Printf("IRMemoryMap::ReadMemory (0x%" PRIx64 ", 0x%" PRIx64
|
||||
", 0x%" PRId64 ") came from [0x%" PRIx64 "..0x%" PRIx64 ")",
|
||||
(uint64_t)process_address, (uint64_t)bytes, (uint64_t)size,
|
||||
(uint64_t)allocation.m_process_start,
|
||||
(uint64_t)allocation.m_process_start +
|
||||
(uint64_t)allocation.m_size);
|
||||
LLDB_LOGF(log,
|
||||
"IRMemoryMap::ReadMemory (0x%" PRIx64 ", 0x%" PRIx64
|
||||
", 0x%" PRId64 ") came from [0x%" PRIx64 "..0x%" PRIx64 ")",
|
||||
(uint64_t)process_address, (uint64_t)bytes, (uint64_t)size,
|
||||
(uint64_t)allocation.m_process_start,
|
||||
(uint64_t)allocation.m_process_start +
|
||||
(uint64_t)allocation.m_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -161,9 +161,9 @@ LLVMUserExpression::DoExecute(DiagnosticManager &diagnostic_manager,
|
|||
function_stack_bottom = function_stack_pointer - HostInfo::GetPageSize();
|
||||
function_stack_top = function_stack_pointer;
|
||||
|
||||
if (log)
|
||||
log->Printf(
|
||||
"-- [UserExpression::Execute] Execution of expression begins --");
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"-- [UserExpression::Execute] Execution of expression begins --");
|
||||
|
||||
if (exe_ctx.GetProcessPtr())
|
||||
exe_ctx.GetProcessPtr()->SetRunningUserExpression(true);
|
||||
|
|
@ -175,9 +175,8 @@ LLVMUserExpression::DoExecute(DiagnosticManager &diagnostic_manager,
|
|||
if (exe_ctx.GetProcessPtr())
|
||||
exe_ctx.GetProcessPtr()->SetRunningUserExpression(false);
|
||||
|
||||
if (log)
|
||||
log->Printf("-- [UserExpression::Execute] Execution of expression "
|
||||
"completed --");
|
||||
LLDB_LOGF(log, "-- [UserExpression::Execute] Execution of expression "
|
||||
"completed --");
|
||||
|
||||
if (execution_result == lldb::eExpressionInterrupted ||
|
||||
execution_result == lldb::eExpressionHitBreakpoint) {
|
||||
|
|
@ -251,9 +250,8 @@ bool LLVMUserExpression::FinalizeJITExecution(
|
|||
lldb::addr_t function_stack_top) {
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
|
||||
|
||||
if (log)
|
||||
log->Printf("-- [UserExpression::FinalizeJITExecution] Dematerializing "
|
||||
"after execution --");
|
||||
LLDB_LOGF(log, "-- [UserExpression::FinalizeJITExecution] Dematerializing "
|
||||
"after execution --");
|
||||
|
||||
if (!m_dematerializer_sp) {
|
||||
diagnostic_manager.Printf(eDiagnosticSeverityError,
|
||||
|
|
|
|||
|
|
@ -93,9 +93,8 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("Allocated %s (0x%" PRIx64 ") successfully",
|
||||
m_persistent_variable_sp->GetName().GetCString(), mem);
|
||||
LLDB_LOGF(log, "Allocated %s (0x%" PRIx64 ") successfully",
|
||||
m_persistent_variable_sp->GetName().GetCString(), mem);
|
||||
|
||||
// Put the location of the spare memory into the live data of the
|
||||
// ValueObject.
|
||||
|
|
@ -157,11 +156,12 @@ public:
|
|||
const lldb::addr_t load_addr = process_address + m_offset;
|
||||
|
||||
if (log) {
|
||||
log->Printf("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 &
|
||||
|
|
@ -208,12 +208,12 @@ public:
|
|||
const lldb::addr_t load_addr = process_address + m_offset;
|
||||
|
||||
if (log) {
|
||||
log->Printf(
|
||||
"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) {
|
||||
|
|
@ -290,11 +290,10 @@ public:
|
|||
ExpressionVariable::EVNeedsFreezeDry ||
|
||||
m_persistent_variable_sp->m_flags &
|
||||
ExpressionVariable::EVKeepInTarget) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"Dematerializing %s from 0x%" PRIx64 " (size = %llu)",
|
||||
m_persistent_variable_sp->GetName().GetCString(), (uint64_t)mem,
|
||||
(unsigned long long)m_persistent_variable_sp->GetByteSize());
|
||||
LLDB_LOGF(log, "Dematerializing %s from 0x%" PRIx64 " (size = %llu)",
|
||||
m_persistent_variable_sp->GetName().GetCString(),
|
||||
(uint64_t)mem,
|
||||
(unsigned long long)m_persistent_variable_sp->GetByteSize());
|
||||
|
||||
// Read the contents of the spare memory area
|
||||
|
||||
|
|
@ -440,9 +439,10 @@ public:
|
|||
|
||||
const lldb::addr_t load_addr = process_address + m_offset;
|
||||
if (log) {
|
||||
log->Printf("EntityVariable::Materialize [address = 0x%" PRIx64
|
||||
", m_variable_sp = %s]",
|
||||
(uint64_t)load_addr, m_variable_sp->GetName().AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"EntityVariable::Materialize [address = 0x%" PRIx64
|
||||
", m_variable_sp = %s]",
|
||||
(uint64_t)load_addr, m_variable_sp->GetName().AsCString());
|
||||
}
|
||||
|
||||
ExecutionContextScope *scope = frame_sp.get();
|
||||
|
|
@ -605,9 +605,10 @@ public:
|
|||
|
||||
const lldb::addr_t load_addr = process_address + m_offset;
|
||||
if (log) {
|
||||
log->Printf("EntityVariable::Dematerialize [address = 0x%" PRIx64
|
||||
", m_variable_sp = %s]",
|
||||
(uint64_t)load_addr, m_variable_sp->GetName().AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"EntityVariable::Dematerialize [address = 0x%" PRIx64
|
||||
", m_variable_sp = %s]",
|
||||
(uint64_t)load_addr, m_variable_sp->GetName().AsCString());
|
||||
}
|
||||
|
||||
if (m_temporary_allocation != LLDB_INVALID_ADDRESS) {
|
||||
|
|
@ -1063,9 +1064,10 @@ public:
|
|||
const lldb::addr_t load_addr = process_address + m_offset;
|
||||
|
||||
if (log) {
|
||||
log->Printf("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();
|
||||
|
|
@ -1109,9 +1111,10 @@ public:
|
|||
const lldb::addr_t load_addr = process_address + m_offset;
|
||||
|
||||
if (log) {
|
||||
log->Printf("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
|
||||
|
|
@ -1178,9 +1181,10 @@ public:
|
|||
const lldb::addr_t load_addr = process_address + m_offset;
|
||||
|
||||
if (log) {
|
||||
log->Printf("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;
|
||||
|
|
@ -1240,9 +1244,10 @@ public:
|
|||
const lldb::addr_t load_addr = process_address + m_offset;
|
||||
|
||||
if (log) {
|
||||
log->Printf("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;
|
||||
|
|
@ -1379,7 +1384,8 @@ Materializer::Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
|
|||
|
||||
if (Log *log =
|
||||
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) {
|
||||
log->Printf(
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"Materializer::Materialize (frame_sp = %p, process_address = 0x%" PRIx64
|
||||
") materialized:",
|
||||
static_cast<void *>(frame_sp.get()), process_address);
|
||||
|
|
@ -1414,9 +1420,10 @@ void Materializer::Dematerializer::Dematerialize(Status &error,
|
|||
} else {
|
||||
if (Log *log =
|
||||
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) {
|
||||
log->Printf("Materializer::Dematerialize (frame_sp = %p, process_address "
|
||||
"= 0x%" PRIx64 ") about to dematerialize:",
|
||||
static_cast<void *>(frame_sp.get()), m_process_address);
|
||||
LLDB_LOGF(log,
|
||||
"Materializer::Dematerialize (frame_sp = %p, process_address "
|
||||
"= 0x%" PRIx64 ") about to dematerialize:",
|
||||
static_cast<void *>(frame_sp.get()), m_process_address);
|
||||
for (EntityUP &entity_up : m_materializer->m_entities)
|
||||
entity_up->DumpToLog(*m_map, m_process_address, log);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,9 +165,8 @@ lldb::ExpressionResults UserExpression::Evaluate(
|
|||
|
||||
Target *target = exe_ctx.GetTargetPtr();
|
||||
if (!target) {
|
||||
if (log)
|
||||
log->Printf("== [UserExpression::Evaluate] Passed a NULL target, can't "
|
||||
"run expressions.");
|
||||
LLDB_LOGF(log, "== [UserExpression::Evaluate] Passed a NULL target, can't "
|
||||
"run expressions.");
|
||||
error.SetErrorString("expression passed a null target");
|
||||
return lldb::eExpressionSetupError;
|
||||
}
|
||||
|
|
@ -176,9 +175,9 @@ lldb::ExpressionResults UserExpression::Evaluate(
|
|||
|
||||
if (process == nullptr || process->GetState() != lldb::eStateStopped) {
|
||||
if (execution_policy == eExecutionPolicyAlways) {
|
||||
if (log)
|
||||
log->Printf("== [UserExpression::Evaluate] Expression may not run, but "
|
||||
"is not constant ==");
|
||||
LLDB_LOGF(log,
|
||||
"== [UserExpression::Evaluate] Expression may not run, but "
|
||||
"is not constant ==");
|
||||
|
||||
error.SetErrorString("expression needed to run but couldn't");
|
||||
|
||||
|
|
@ -224,14 +223,14 @@ lldb::ExpressionResults UserExpression::Evaluate(
|
|||
error));
|
||||
if (error.Fail()) {
|
||||
if (log)
|
||||
log->Printf("== [UserExpression::Evaluate] Getting expression: %s ==",
|
||||
error.AsCString());
|
||||
LLDB_LOGF(log, "== [UserExpression::Evaluate] Getting expression: %s ==",
|
||||
error.AsCString());
|
||||
return lldb::eExpressionSetupError;
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("== [UserExpression::Evaluate] Parsing expression %s ==",
|
||||
expr.str().c_str());
|
||||
LLDB_LOGF(log, "== [UserExpression::Evaluate] Parsing expression %s ==",
|
||||
expr.str().c_str());
|
||||
|
||||
const bool keep_expression_in_memory = true;
|
||||
const bool generate_debug_info = options.GetGenerateDebugInfo();
|
||||
|
|
@ -310,8 +309,9 @@ lldb::ExpressionResults UserExpression::Evaluate(
|
|||
if (execution_policy == eExecutionPolicyNever &&
|
||||
!user_expression_sp->CanInterpret()) {
|
||||
if (log)
|
||||
log->Printf("== [UserExpression::Evaluate] Expression may not run, but "
|
||||
"is not constant ==");
|
||||
LLDB_LOGF(log,
|
||||
"== [UserExpression::Evaluate] Expression may not run, but "
|
||||
"is not constant ==");
|
||||
|
||||
if (!diagnostic_manager.Diagnostics().size())
|
||||
error.SetExpressionError(lldb::eExpressionSetupError,
|
||||
|
|
@ -332,7 +332,7 @@ lldb::ExpressionResults UserExpression::Evaluate(
|
|||
diagnostic_manager.Clear();
|
||||
|
||||
if (log)
|
||||
log->Printf("== [UserExpression::Evaluate] Executing expression ==");
|
||||
LLDB_LOGF(log, "== [UserExpression::Evaluate] Executing expression ==");
|
||||
|
||||
execution_results =
|
||||
user_expression_sp->Execute(diagnostic_manager, exe_ctx, options,
|
||||
|
|
@ -340,8 +340,8 @@ lldb::ExpressionResults UserExpression::Evaluate(
|
|||
|
||||
if (execution_results != lldb::eExpressionCompleted) {
|
||||
if (log)
|
||||
log->Printf("== [UserExpression::Evaluate] Execution completed "
|
||||
"abnormally ==");
|
||||
LLDB_LOGF(log, "== [UserExpression::Evaluate] Execution completed "
|
||||
"abnormally ==");
|
||||
|
||||
if (!diagnostic_manager.Diagnostics().size())
|
||||
error.SetExpressionError(
|
||||
|
|
@ -354,13 +354,14 @@ lldb::ExpressionResults UserExpression::Evaluate(
|
|||
result_valobj_sp = expr_result->GetValueObject();
|
||||
|
||||
if (log)
|
||||
log->Printf("== [UserExpression::Evaluate] Execution completed "
|
||||
"normally with result %s ==",
|
||||
result_valobj_sp->GetValueAsCString());
|
||||
LLDB_LOGF(log,
|
||||
"== [UserExpression::Evaluate] Execution completed "
|
||||
"normally with result %s ==",
|
||||
result_valobj_sp->GetValueAsCString());
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("== [UserExpression::Evaluate] Execution completed "
|
||||
"normally with no result ==");
|
||||
LLDB_LOGF(log, "== [UserExpression::Evaluate] Execution completed "
|
||||
"normally with no result ==");
|
||||
|
||||
error.SetError(UserExpression::kNoResult, lldb::eErrorTypeGeneric);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,8 +164,7 @@ static bool CheckForMonitorCancellation() {
|
|||
static thread_result_t MonitorChildProcessThreadFunction(void *arg) {
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
|
||||
const char *function = __FUNCTION__;
|
||||
if (log)
|
||||
log->Printf("%s (arg = %p) thread starting...", function, arg);
|
||||
LLDB_LOGF(log, "%s (arg = %p) thread starting...", function, arg);
|
||||
|
||||
MonitorInfo *info = (MonitorInfo *)arg;
|
||||
|
||||
|
|
@ -193,9 +192,8 @@ static thread_result_t MonitorChildProcessThreadFunction(void *arg) {
|
|||
|
||||
while (1) {
|
||||
log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS);
|
||||
if (log)
|
||||
log->Printf("%s ::waitpid (pid = %" PRIi32 ", &status, options = %i)...",
|
||||
function, pid, options);
|
||||
LLDB_LOGF(log, "%s ::waitpid (pid = %" PRIi32 ", &status, options = %i)...",
|
||||
function, pid, options);
|
||||
|
||||
if (CheckForMonitorCancellation())
|
||||
break;
|
||||
|
|
@ -245,12 +243,12 @@ static thread_result_t MonitorChildProcessThreadFunction(void *arg) {
|
|||
#endif
|
||||
|
||||
log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS);
|
||||
if (log)
|
||||
log->Printf("%s ::waitpid (pid = %" PRIi32
|
||||
", &status, options = %i) => pid = %" PRIi32
|
||||
", status = 0x%8.8x (%s), signal = %i, exit_state = %i",
|
||||
function, pid, options, wait_pid, status, status_cstr,
|
||||
signal, exit_status);
|
||||
LLDB_LOGF(log,
|
||||
"%s ::waitpid (pid = %" PRIi32
|
||||
", &status, options = %i) => pid = %" PRIi32
|
||||
", status = 0x%8.8x (%s), signal = %i, exit_state = %i",
|
||||
function, pid, options, wait_pid, status, status_cstr, signal,
|
||||
exit_status);
|
||||
|
||||
if (exited || (signal != 0 && monitor_signals)) {
|
||||
bool callback_return = false;
|
||||
|
|
@ -259,18 +257,18 @@ static thread_result_t MonitorChildProcessThreadFunction(void *arg) {
|
|||
|
||||
// If our process exited, then this thread should exit
|
||||
if (exited && wait_pid == abs(pid)) {
|
||||
if (log)
|
||||
log->Printf("%s (arg = %p) thread exiting because pid received "
|
||||
"exit signal...",
|
||||
__FUNCTION__, arg);
|
||||
LLDB_LOGF(log,
|
||||
"%s (arg = %p) thread exiting because pid received "
|
||||
"exit signal...",
|
||||
__FUNCTION__, arg);
|
||||
break;
|
||||
}
|
||||
// If the callback returns true, it means this process should exit
|
||||
if (callback_return) {
|
||||
if (log)
|
||||
log->Printf("%s (arg = %p) thread exiting because callback "
|
||||
"returned true...",
|
||||
__FUNCTION__, arg);
|
||||
LLDB_LOGF(log,
|
||||
"%s (arg = %p) thread exiting because callback "
|
||||
"returned true...",
|
||||
__FUNCTION__, arg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -279,8 +277,7 @@ static thread_result_t MonitorChildProcessThreadFunction(void *arg) {
|
|||
}
|
||||
|
||||
log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS);
|
||||
if (log)
|
||||
log->Printf("%s (arg = %p) thread exiting...", __FUNCTION__, arg);
|
||||
LLDB_LOGF(log, "%s (arg = %p) thread exiting...", __FUNCTION__, arg);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,25 +221,24 @@ bool HostInfoBase::ComputePathRelativeToLibrary(FileSpec &file_spec,
|
|||
return false;
|
||||
|
||||
std::string raw_path = lldb_file_spec.GetPath();
|
||||
if (log)
|
||||
log->Printf("HostInfo::%s() attempting to "
|
||||
"derive the path %s relative to liblldb install path: %s",
|
||||
__FUNCTION__, dir.data(), raw_path.c_str());
|
||||
LLDB_LOGF(log,
|
||||
"HostInfo::%s() attempting to "
|
||||
"derive the path %s relative to liblldb install path: %s",
|
||||
__FUNCTION__, dir.data(), raw_path.c_str());
|
||||
|
||||
// Drop bin (windows) or lib
|
||||
llvm::StringRef parent_path = llvm::sys::path::parent_path(raw_path);
|
||||
if (parent_path.empty()) {
|
||||
if (log)
|
||||
log->Printf("HostInfo::%s() failed to find liblldb within the shared "
|
||||
"lib path",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log,
|
||||
"HostInfo::%s() failed to find liblldb within the shared "
|
||||
"lib path",
|
||||
__FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
raw_path = (parent_path + dir).str();
|
||||
if (log)
|
||||
log->Printf("HostInfo::%s() derived the path as: %s", __FUNCTION__,
|
||||
raw_path.c_str());
|
||||
LLDB_LOGF(log, "HostInfo::%s() derived the path as: %s", __FUNCTION__,
|
||||
raw_path.c_str());
|
||||
file_spec.GetDirectory().SetString(raw_path);
|
||||
return (bool)file_spec.GetDirectory();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,8 +62,7 @@ HostNativeThreadBase::ThreadCreateTrampoline(lldb::thread_arg_t arg) {
|
|||
thread_arg_t thread_arg = info->thread_arg;
|
||||
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
|
||||
if (log)
|
||||
log->Printf("thread created");
|
||||
LLDB_LOGF(log, "thread created");
|
||||
|
||||
delete info;
|
||||
return thread_fptr(thread_arg);
|
||||
|
|
|
|||
|
|
@ -331,22 +331,23 @@ void NativeProcessProtocol::SynchronouslyNotifyProcessStateChanged(
|
|||
|
||||
if (log) {
|
||||
if (!m_delegates.empty()) {
|
||||
log->Printf("NativeProcessProtocol::%s: sent state notification [%s] "
|
||||
"from process %" PRIu64,
|
||||
__FUNCTION__, lldb_private::StateAsCString(state), GetID());
|
||||
LLDB_LOGF(log,
|
||||
"NativeProcessProtocol::%s: sent state notification [%s] "
|
||||
"from process %" PRIu64,
|
||||
__FUNCTION__, lldb_private::StateAsCString(state), GetID());
|
||||
} else {
|
||||
log->Printf("NativeProcessProtocol::%s: would send state notification "
|
||||
"[%s] from process %" PRIu64 ", but no delegates",
|
||||
__FUNCTION__, lldb_private::StateAsCString(state), GetID());
|
||||
LLDB_LOGF(log,
|
||||
"NativeProcessProtocol::%s: would send state notification "
|
||||
"[%s] from process %" PRIu64 ", but no delegates",
|
||||
__FUNCTION__, lldb_private::StateAsCString(state), GetID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NativeProcessProtocol::NotifyDidExec() {
|
||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
|
||||
if (log)
|
||||
log->Printf("NativeProcessProtocol::%s - preparing to call delegates",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log, "NativeProcessProtocol::%s - preparing to call delegates",
|
||||
__FUNCTION__);
|
||||
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> guard(m_delegates_mutex);
|
||||
|
|
|
|||
|
|
@ -114,16 +114,15 @@ lldb::addr_t NativeRegisterContext::GetPC(lldb::addr_t fail_value) {
|
|||
|
||||
uint32_t reg = ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric,
|
||||
LLDB_REGNUM_GENERIC_PC);
|
||||
if (log)
|
||||
log->Printf("NativeRegisterContext::%s using reg index %" PRIu32
|
||||
" (default %" PRIu64 ")",
|
||||
__FUNCTION__, reg, fail_value);
|
||||
LLDB_LOGF(log,
|
||||
"NativeRegisterContext::%s using reg index %" PRIu32
|
||||
" (default %" PRIu64 ")",
|
||||
__FUNCTION__, reg, fail_value);
|
||||
|
||||
const uint64_t retval = ReadRegisterAsUnsigned(reg, fail_value);
|
||||
|
||||
if (log)
|
||||
log->Printf("NativeRegisterContext::%s " PRIu32 " retval %" PRIu64,
|
||||
__FUNCTION__, retval);
|
||||
LLDB_LOGF(log, "NativeRegisterContext::%s " PRIu32 " retval %" PRIu64,
|
||||
__FUNCTION__, retval);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
|
@ -192,20 +191,19 @@ NativeRegisterContext::ReadRegisterAsUnsigned(const RegisterInfo *reg_info,
|
|||
RegisterValue value;
|
||||
Status error = ReadRegister(reg_info, value);
|
||||
if (error.Success()) {
|
||||
if (log)
|
||||
log->Printf("NativeRegisterContext::%s ReadRegister() succeeded, value "
|
||||
"%" PRIu64,
|
||||
__FUNCTION__, value.GetAsUInt64());
|
||||
LLDB_LOGF(log,
|
||||
"NativeRegisterContext::%s ReadRegister() succeeded, value "
|
||||
"%" PRIu64,
|
||||
__FUNCTION__, value.GetAsUInt64());
|
||||
return value.GetAsUInt64();
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("NativeRegisterContext::%s ReadRegister() failed, error %s",
|
||||
__FUNCTION__, error.AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"NativeRegisterContext::%s ReadRegister() failed, error %s",
|
||||
__FUNCTION__, error.AsCString());
|
||||
}
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("NativeRegisterContext::%s ReadRegister() null reg_info",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log, "NativeRegisterContext::%s ReadRegister() null reg_info",
|
||||
__FUNCTION__);
|
||||
}
|
||||
return fail_value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,9 +149,8 @@ std::unique_ptr<Socket> Socket::Create(const SocketProtocol protocol,
|
|||
Status Socket::TcpConnect(llvm::StringRef host_and_port,
|
||||
bool child_processes_inherit, Socket *&socket) {
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION));
|
||||
if (log)
|
||||
log->Printf("Socket::%s (host/port = %s)", __FUNCTION__,
|
||||
host_and_port.str().c_str());
|
||||
LLDB_LOGF(log, "Socket::%s (host/port = %s)", __FUNCTION__,
|
||||
host_and_port.str().c_str());
|
||||
|
||||
Status error;
|
||||
std::unique_ptr<Socket> connect_socket(
|
||||
|
|
@ -170,8 +169,7 @@ Status Socket::TcpListen(llvm::StringRef host_and_port,
|
|||
bool child_processes_inherit, Socket *&socket,
|
||||
Predicate<uint16_t> *predicate, int backlog) {
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
|
||||
if (log)
|
||||
log->Printf("Socket::%s (%s)", __FUNCTION__, host_and_port.str().c_str());
|
||||
LLDB_LOGF(log, "Socket::%s (%s)", __FUNCTION__, host_and_port.str().c_str());
|
||||
|
||||
Status error;
|
||||
std::string host_str;
|
||||
|
|
@ -209,9 +207,8 @@ Status Socket::TcpListen(llvm::StringRef host_and_port,
|
|||
Status Socket::UdpConnect(llvm::StringRef host_and_port,
|
||||
bool child_processes_inherit, Socket *&socket) {
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
|
||||
if (log)
|
||||
log->Printf("Socket::%s (host/port = %s)", __FUNCTION__,
|
||||
host_and_port.str().c_str());
|
||||
LLDB_LOGF(log, "Socket::%s (host/port = %s)", __FUNCTION__,
|
||||
host_and_port.str().c_str());
|
||||
|
||||
return UDPSocket::Connect(host_and_port, child_processes_inherit, socket);
|
||||
}
|
||||
|
|
@ -345,12 +342,13 @@ Status Socket::Read(void *buf, size_t &num_bytes) {
|
|||
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION));
|
||||
if (log) {
|
||||
log->Printf("%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(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());
|
||||
}
|
||||
|
||||
return error;
|
||||
|
|
@ -371,12 +369,13 @@ Status Socket::Write(const void *buf, size_t &num_bytes) {
|
|||
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION));
|
||||
if (log) {
|
||||
log->Printf("%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>(num_bytes),
|
||||
static_cast<int64_t>(bytes_sent), error.AsCString());
|
||||
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>(num_bytes),
|
||||
static_cast<int64_t>(bytes_sent), error.AsCString());
|
||||
}
|
||||
|
||||
return error;
|
||||
|
|
@ -393,9 +392,8 @@ Status Socket::Close() {
|
|||
return error;
|
||||
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
|
||||
if (log)
|
||||
log->Printf("%p Socket::Close (fd = %" PRIu64 ")",
|
||||
static_cast<void *>(this), static_cast<uint64_t>(m_socket));
|
||||
LLDB_LOGF(log, "%p Socket::Close (fd = %" PRIu64 ")",
|
||||
static_cast<void *>(this), static_cast<uint64_t>(m_socket));
|
||||
|
||||
#if defined(_WIN32)
|
||||
bool success = !!closesocket(m_socket);
|
||||
|
|
|
|||
|
|
@ -140,8 +140,7 @@ Status TCPSocket::CreateSocket(int domain) {
|
|||
Status TCPSocket::Connect(llvm::StringRef name) {
|
||||
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION));
|
||||
if (log)
|
||||
log->Printf("TCPSocket::%s (host/port = %s)", __FUNCTION__, name.data());
|
||||
LLDB_LOGF(log, "TCPSocket::%s (host/port = %s)", __FUNCTION__, name.data());
|
||||
|
||||
Status error;
|
||||
std::string host_str;
|
||||
|
|
@ -177,8 +176,7 @@ Status TCPSocket::Connect(llvm::StringRef name) {
|
|||
|
||||
Status TCPSocket::Listen(llvm::StringRef name, int backlog) {
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
|
||||
if (log)
|
||||
log->Printf("TCPSocket::%s (%s)", __FUNCTION__, name.data());
|
||||
LLDB_LOGF(log, "TCPSocket::%s (%s)", __FUNCTION__, name.data());
|
||||
|
||||
Status error;
|
||||
std::string host_str;
|
||||
|
|
|
|||
|
|
@ -58,8 +58,7 @@ Status UDPSocket::Connect(llvm::StringRef name, bool child_processes_inherit,
|
|||
std::unique_ptr<UDPSocket> final_socket;
|
||||
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
|
||||
if (log)
|
||||
log->Printf("UDPSocket::%s (host/port = %s)", __FUNCTION__, name.data());
|
||||
LLDB_LOGF(log, "UDPSocket::%s (host/port = %s)", __FUNCTION__, name.data());
|
||||
|
||||
Status error;
|
||||
std::string host_str;
|
||||
|
|
|
|||
|
|
@ -88,8 +88,7 @@ llvm::StringRef HostInfoLinux::GetDistributionId() {
|
|||
llvm::call_once(g_once_flag, []() {
|
||||
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST));
|
||||
if (log)
|
||||
log->Printf("attempting to determine Linux distribution...");
|
||||
LLDB_LOGF(log, "attempting to determine Linux distribution...");
|
||||
|
||||
// check if the lsb_release command exists at one of the following paths
|
||||
const char *const exe_paths[] = {"/bin/lsb_release",
|
||||
|
|
@ -100,9 +99,8 @@ llvm::StringRef HostInfoLinux::GetDistributionId() {
|
|||
const char *const get_distribution_info_exe = exe_paths[exe_index];
|
||||
if (access(get_distribution_info_exe, F_OK)) {
|
||||
// this exe doesn't exist, move on to next exe
|
||||
if (log)
|
||||
log->Printf("executable doesn't exist: %s",
|
||||
get_distribution_info_exe);
|
||||
LLDB_LOGF(log, "executable doesn't exist: %s",
|
||||
get_distribution_info_exe);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -112,10 +110,10 @@ llvm::StringRef HostInfoLinux::GetDistributionId() {
|
|||
|
||||
FILE *file = popen(get_distribution_id_command.c_str(), "r");
|
||||
if (!file) {
|
||||
if (log)
|
||||
log->Printf("failed to run command: \"%s\", cannot retrieve "
|
||||
"platform information",
|
||||
get_distribution_id_command.c_str());
|
||||
LLDB_LOGF(log,
|
||||
"failed to run command: \"%s\", cannot retrieve "
|
||||
"platform information",
|
||||
get_distribution_id_command.c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -123,9 +121,8 @@ llvm::StringRef HostInfoLinux::GetDistributionId() {
|
|||
char distribution_id[256] = {'\0'};
|
||||
if (fgets(distribution_id, sizeof(distribution_id) - 1, file) !=
|
||||
nullptr) {
|
||||
if (log)
|
||||
log->Printf("distribution id command returned \"%s\"",
|
||||
distribution_id);
|
||||
LLDB_LOGF(log, "distribution id command returned \"%s\"",
|
||||
distribution_id);
|
||||
|
||||
const char *const distributor_id_key = "Distributor ID:\t";
|
||||
if (strstr(distribution_id, distributor_id_key)) {
|
||||
|
|
@ -140,19 +137,17 @@ llvm::StringRef HostInfoLinux::GetDistributionId() {
|
|||
[](char ch) { return tolower(isspace(ch) ? '_' : ch); });
|
||||
|
||||
g_fields->m_distribution_id = id_string;
|
||||
if (log)
|
||||
log->Printf("distribution id set to \"%s\"",
|
||||
g_fields->m_distribution_id.c_str());
|
||||
LLDB_LOGF(log, "distribution id set to \"%s\"",
|
||||
g_fields->m_distribution_id.c_str());
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("failed to find \"%s\" field in \"%s\"",
|
||||
distributor_id_key, distribution_id);
|
||||
LLDB_LOGF(log, "failed to find \"%s\" field in \"%s\"",
|
||||
distributor_id_key, distribution_id);
|
||||
}
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("failed to retrieve distribution id, \"%s\" returned no"
|
||||
" lines",
|
||||
get_distribution_id_command.c_str());
|
||||
LLDB_LOGF(log,
|
||||
"failed to retrieve distribution id, \"%s\" returned no"
|
||||
" lines",
|
||||
get_distribution_id_command.c_str());
|
||||
}
|
||||
|
||||
// clean up the file
|
||||
|
|
|
|||
|
|
@ -363,10 +363,9 @@ bool Host::OpenFileInExternalEditor(const FileSpec &file_spec,
|
|||
CFCReleaser<CFURLRef> file_URL(::CFURLCreateWithFileSystemPath(
|
||||
NULL, file_cfstr.get(), kCFURLPOSIXPathStyle, false));
|
||||
|
||||
if (log)
|
||||
log->Printf(
|
||||
"Sending source file: \"%s\" and line: %d to external editor.\n",
|
||||
file_path, line_no);
|
||||
LLDB_LOGF(log,
|
||||
"Sending source file: \"%s\" and line: %d to external editor.\n",
|
||||
file_path, line_no);
|
||||
|
||||
long error;
|
||||
BabelAESelInfo file_and_line_info = {
|
||||
|
|
@ -385,8 +384,7 @@ bool Host::OpenFileInExternalEditor(const FileSpec &file_spec,
|
|||
&(file_and_line_desc.descContent));
|
||||
|
||||
if (error != noErr) {
|
||||
if (log)
|
||||
log->Printf("Error creating AEDesc: %ld.\n", error);
|
||||
LLDB_LOGF(log, "Error creating AEDesc: %ld.\n", error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -403,8 +401,7 @@ bool Host::OpenFileInExternalEditor(const FileSpec &file_spec,
|
|||
char *external_editor = ::getenv("LLDB_EXTERNAL_EDITOR");
|
||||
|
||||
if (external_editor) {
|
||||
if (log)
|
||||
log->Printf("Looking for external editor \"%s\".\n", external_editor);
|
||||
LLDB_LOGF(log, "Looking for external editor \"%s\".\n", external_editor);
|
||||
|
||||
if (g_app_name.empty() ||
|
||||
strcmp(g_app_name.c_str(), external_editor) != 0) {
|
||||
|
|
@ -415,10 +412,9 @@ bool Host::OpenFileInExternalEditor(const FileSpec &file_spec,
|
|||
// If we found the app, then store away the name so we don't have to
|
||||
// re-look it up.
|
||||
if (error != noErr) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"Could not find External Editor application, error: %ld.\n",
|
||||
error);
|
||||
LLDB_LOGF(log,
|
||||
"Could not find External Editor application, error: %ld.\n",
|
||||
error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -434,8 +430,7 @@ bool Host::OpenFileInExternalEditor(const FileSpec &file_spec,
|
|||
AEDisposeDesc(&(file_and_line_desc.descContent));
|
||||
|
||||
if (error != noErr) {
|
||||
if (log)
|
||||
log->Printf("LSOpenURLsWithRole failed, error: %ld.\n", error);
|
||||
LLDB_LOGF(log, "LSOpenURLsWithRole failed, error: %ld.\n", error);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1434,12 +1429,12 @@ llvm::Expected<HostThread> Host::StartMonitoringChildProcess(
|
|||
DISPATCH_SOURCE_TYPE_PROC, pid, mask,
|
||||
::dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0));
|
||||
|
||||
if (log)
|
||||
log->Printf("Host::StartMonitoringChildProcess "
|
||||
"(callback, pid=%i, monitor_signals=%i) "
|
||||
"source = %p\n",
|
||||
static_cast<int>(pid), monitor_signals,
|
||||
reinterpret_cast<void *>(source));
|
||||
LLDB_LOGF(log,
|
||||
"Host::StartMonitoringChildProcess "
|
||||
"(callback, pid=%i, monitor_signals=%i) "
|
||||
"source = %p\n",
|
||||
static_cast<int>(pid), monitor_signals,
|
||||
reinterpret_cast<void *>(source));
|
||||
|
||||
if (source) {
|
||||
Host::MonitorChildProcessCallback callback_copy = callback;
|
||||
|
|
@ -1473,10 +1468,10 @@ llvm::Expected<HostThread> Host::StartMonitoringChildProcess(
|
|||
status_cstr = "???";
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("::waitpid (pid = %llu, &status, 0) => pid = %i, status "
|
||||
"= 0x%8.8x (%s), signal = %i, exit_status = %i",
|
||||
pid, wait_pid, status, status_cstr, signal, exit_status);
|
||||
LLDB_LOGF(log,
|
||||
"::waitpid (pid = %llu, &status, 0) => pid = %i, status "
|
||||
"= 0x%8.8x (%s), signal = %i, exit_status = %i",
|
||||
pid, wait_pid, status, status_cstr, signal, exit_status);
|
||||
|
||||
if (callback_copy)
|
||||
cancel = callback_copy(pid, exited, signal, exit_status);
|
||||
|
|
|
|||
|
|
@ -142,9 +142,8 @@ bool HostInfoMacOSX::ComputeSupportExeDirectory(FileSpec &file_spec) {
|
|||
FileSystem::Instance().Resolve(support_dir_spec);
|
||||
if (!FileSystem::Instance().IsDirectory(support_dir_spec)) {
|
||||
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
|
||||
if (log)
|
||||
log->Printf("HostInfoMacOSX::%s(): failed to find support directory",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log, "HostInfoMacOSX::%s(): failed to find support directory",
|
||||
__FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,9 +79,8 @@ ConnectionFileDescriptor::ConnectionFileDescriptor(bool child_processes_inherit)
|
|||
m_child_processes_inherit(child_processes_inherit) {
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION |
|
||||
LIBLLDB_LOG_OBJECT));
|
||||
if (log)
|
||||
log->Printf("%p ConnectionFileDescriptor::ConnectionFileDescriptor ()",
|
||||
static_cast<void *>(this));
|
||||
LLDB_LOGF(log, "%p ConnectionFileDescriptor::ConnectionFileDescriptor ()",
|
||||
static_cast<void *>(this));
|
||||
}
|
||||
|
||||
ConnectionFileDescriptor::ConnectionFileDescriptor(int fd, bool owns_fd)
|
||||
|
|
@ -92,10 +91,10 @@ ConnectionFileDescriptor::ConnectionFileDescriptor(int fd, bool owns_fd)
|
|||
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION |
|
||||
LIBLLDB_LOG_OBJECT));
|
||||
if (log)
|
||||
log->Printf("%p ConnectionFileDescriptor::ConnectionFileDescriptor (fd = "
|
||||
"%i, owns_fd = %i)",
|
||||
static_cast<void *>(this), fd, owns_fd);
|
||||
LLDB_LOGF(log,
|
||||
"%p ConnectionFileDescriptor::ConnectionFileDescriptor (fd = "
|
||||
"%i, owns_fd = %i)",
|
||||
static_cast<void *>(this), fd, owns_fd);
|
||||
OpenCommandPipe();
|
||||
}
|
||||
|
||||
|
|
@ -108,9 +107,8 @@ ConnectionFileDescriptor::ConnectionFileDescriptor(Socket *socket)
|
|||
ConnectionFileDescriptor::~ConnectionFileDescriptor() {
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION |
|
||||
LIBLLDB_LOG_OBJECT));
|
||||
if (log)
|
||||
log->Printf("%p ConnectionFileDescriptor::~ConnectionFileDescriptor ()",
|
||||
static_cast<void *>(this));
|
||||
LLDB_LOGF(log, "%p ConnectionFileDescriptor::~ConnectionFileDescriptor ()",
|
||||
static_cast<void *>(this));
|
||||
Disconnect(nullptr);
|
||||
CloseCommandPipe();
|
||||
}
|
||||
|
|
@ -122,24 +120,23 @@ void ConnectionFileDescriptor::OpenCommandPipe() {
|
|||
// Make the command file descriptor here:
|
||||
Status result = m_pipe.CreateNew(m_child_processes_inherit);
|
||||
if (!result.Success()) {
|
||||
if (log)
|
||||
log->Printf("%p ConnectionFileDescriptor::OpenCommandPipe () - could not "
|
||||
"make pipe: %s",
|
||||
static_cast<void *>(this), result.AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"%p ConnectionFileDescriptor::OpenCommandPipe () - could not "
|
||||
"make pipe: %s",
|
||||
static_cast<void *>(this), result.AsCString());
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("%p ConnectionFileDescriptor::OpenCommandPipe() - success "
|
||||
"readfd=%d writefd=%d",
|
||||
static_cast<void *>(this), m_pipe.GetReadFileDescriptor(),
|
||||
m_pipe.GetWriteFileDescriptor());
|
||||
LLDB_LOGF(log,
|
||||
"%p ConnectionFileDescriptor::OpenCommandPipe() - success "
|
||||
"readfd=%d writefd=%d",
|
||||
static_cast<void *>(this), m_pipe.GetReadFileDescriptor(),
|
||||
m_pipe.GetWriteFileDescriptor());
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectionFileDescriptor::CloseCommandPipe() {
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
|
||||
if (log)
|
||||
log->Printf("%p ConnectionFileDescriptor::CloseCommandPipe()",
|
||||
static_cast<void *>(this));
|
||||
LLDB_LOGF(log, "%p ConnectionFileDescriptor::CloseCommandPipe()",
|
||||
static_cast<void *>(this));
|
||||
|
||||
m_pipe.Close();
|
||||
}
|
||||
|
|
@ -153,9 +150,8 @@ ConnectionStatus ConnectionFileDescriptor::Connect(llvm::StringRef path,
|
|||
Status *error_ptr) {
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
|
||||
if (log)
|
||||
log->Printf("%p ConnectionFileDescriptor::Connect (url = '%s')",
|
||||
static_cast<void *>(this), path.str().c_str());
|
||||
LLDB_LOGF(log, "%p ConnectionFileDescriptor::Connect (url = '%s')",
|
||||
static_cast<void *>(this), path.str().c_str());
|
||||
|
||||
OpenCommandPipe();
|
||||
|
||||
|
|
@ -295,17 +291,15 @@ bool ConnectionFileDescriptor::InterruptRead() {
|
|||
|
||||
ConnectionStatus ConnectionFileDescriptor::Disconnect(Status *error_ptr) {
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
|
||||
if (log)
|
||||
log->Printf("%p ConnectionFileDescriptor::Disconnect ()",
|
||||
static_cast<void *>(this));
|
||||
LLDB_LOGF(log, "%p ConnectionFileDescriptor::Disconnect ()",
|
||||
static_cast<void *>(this));
|
||||
|
||||
ConnectionStatus status = eConnectionStatusSuccess;
|
||||
|
||||
if (!IsConnected()) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"%p ConnectionFileDescriptor::Disconnect(): Nothing to disconnect",
|
||||
static_cast<void *>(this));
|
||||
LLDB_LOGF(
|
||||
log, "%p ConnectionFileDescriptor::Disconnect(): Nothing to disconnect",
|
||||
static_cast<void *>(this));
|
||||
return eConnectionStatusSuccess;
|
||||
}
|
||||
|
||||
|
|
@ -326,15 +320,16 @@ ConnectionStatus ConnectionFileDescriptor::Disconnect(Status *error_ptr) {
|
|||
if (m_pipe.CanWrite()) {
|
||||
size_t bytes_written = 0;
|
||||
Status result = m_pipe.Write("q", 1, bytes_written);
|
||||
if (log)
|
||||
log->Printf("%p ConnectionFileDescriptor::Disconnect(): Couldn't get "
|
||||
"the lock, sent 'q' to %d, error = '%s'.",
|
||||
static_cast<void *>(this), m_pipe.GetWriteFileDescriptor(),
|
||||
result.AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"%p ConnectionFileDescriptor::Disconnect(): Couldn't get "
|
||||
"the lock, sent 'q' to %d, error = '%s'.",
|
||||
static_cast<void *>(this), m_pipe.GetWriteFileDescriptor(),
|
||||
result.AsCString());
|
||||
} else if (log) {
|
||||
log->Printf("%p ConnectionFileDescriptor::Disconnect(): Couldn't get the "
|
||||
"lock, but no command pipe is available.",
|
||||
static_cast<void *>(this));
|
||||
LLDB_LOGF(log,
|
||||
"%p ConnectionFileDescriptor::Disconnect(): Couldn't get the "
|
||||
"lock, but no command pipe is available.",
|
||||
static_cast<void *>(this));
|
||||
}
|
||||
locker.lock();
|
||||
}
|
||||
|
|
@ -362,10 +357,10 @@ size_t ConnectionFileDescriptor::Read(void *dst, size_t dst_len,
|
|||
|
||||
std::unique_lock<std::recursive_mutex> locker(m_mutex, std::defer_lock);
|
||||
if (!locker.try_lock()) {
|
||||
if (log)
|
||||
log->Printf("%p ConnectionFileDescriptor::Read () failed to get the "
|
||||
"connection lock.",
|
||||
static_cast<void *>(this));
|
||||
LLDB_LOGF(log,
|
||||
"%p ConnectionFileDescriptor::Read () failed to get the "
|
||||
"connection lock.",
|
||||
static_cast<void *>(this));
|
||||
if (error_ptr)
|
||||
error_ptr->SetErrorString("failed to get the connection lock for read.");
|
||||
|
||||
|
|
@ -387,12 +382,13 @@ size_t ConnectionFileDescriptor::Read(void *dst, size_t dst_len,
|
|||
error = m_read_sp->Read(dst, bytes_read);
|
||||
|
||||
if (log) {
|
||||
log->Printf("%p ConnectionFileDescriptor::Read() fd = %" PRIu64
|
||||
", dst = %p, dst_len = %" PRIu64 ") => %" PRIu64 ", error = %s",
|
||||
static_cast<void *>(this),
|
||||
static_cast<uint64_t>(m_read_sp->GetWaitableHandle()),
|
||||
static_cast<void *>(dst), static_cast<uint64_t>(dst_len),
|
||||
static_cast<uint64_t>(bytes_read), error.AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"%p ConnectionFileDescriptor::Read() fd = %" PRIu64
|
||||
", dst = %p, dst_len = %" PRIu64 ") => %" PRIu64 ", error = %s",
|
||||
static_cast<void *>(this),
|
||||
static_cast<uint64_t>(m_read_sp->GetWaitableHandle()),
|
||||
static_cast<void *>(dst), static_cast<uint64_t>(dst_len),
|
||||
static_cast<uint64_t>(bytes_read), error.AsCString());
|
||||
}
|
||||
|
||||
if (bytes_read == 0) {
|
||||
|
|
@ -464,11 +460,11 @@ size_t ConnectionFileDescriptor::Write(const void *src, size_t src_len,
|
|||
ConnectionStatus &status,
|
||||
Status *error_ptr) {
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
|
||||
if (log)
|
||||
log->Printf(
|
||||
"%p ConnectionFileDescriptor::Write (src = %p, src_len = %" PRIu64 ")",
|
||||
static_cast<void *>(this), static_cast<const void *>(src),
|
||||
static_cast<uint64_t>(src_len));
|
||||
LLDB_LOGF(log,
|
||||
"%p ConnectionFileDescriptor::Write (src = %p, src_len = %" PRIu64
|
||||
")",
|
||||
static_cast<void *>(this), static_cast<const void *>(src),
|
||||
static_cast<uint64_t>(src_len));
|
||||
|
||||
if (!IsConnected()) {
|
||||
if (error_ptr)
|
||||
|
|
@ -483,13 +479,13 @@ size_t ConnectionFileDescriptor::Write(const void *src, size_t src_len,
|
|||
error = m_write_sp->Write(src, bytes_sent);
|
||||
|
||||
if (log) {
|
||||
log->Printf("%p ConnectionFileDescriptor::Write(fd = %" PRIu64
|
||||
", src = %p, src_len = %" PRIu64 ") => %" PRIu64
|
||||
" (error = %s)",
|
||||
static_cast<void *>(this),
|
||||
static_cast<uint64_t>(m_write_sp->GetWaitableHandle()),
|
||||
static_cast<const void *>(src), static_cast<uint64_t>(src_len),
|
||||
static_cast<uint64_t>(bytes_sent), error.AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"%p ConnectionFileDescriptor::Write(fd = %" PRIu64
|
||||
", src = %p, src_len = %" PRIu64 ") => %" PRIu64 " (error = %s)",
|
||||
static_cast<void *>(this),
|
||||
static_cast<uint64_t>(m_write_sp->GetWaitableHandle()),
|
||||
static_cast<const void *>(src), static_cast<uint64_t>(src_len),
|
||||
static_cast<uint64_t>(bytes_sent), error.AsCString());
|
||||
}
|
||||
|
||||
if (error_ptr)
|
||||
|
|
@ -613,10 +609,10 @@ ConnectionFileDescriptor::BytesAvailable(const Timeout<std::micro> &timeout,
|
|||
(void)bytes_read;
|
||||
switch (c) {
|
||||
case 'q':
|
||||
if (log)
|
||||
log->Printf("%p ConnectionFileDescriptor::BytesAvailable() "
|
||||
"got data: %c from the command channel.",
|
||||
static_cast<void *>(this), c);
|
||||
LLDB_LOGF(log,
|
||||
"%p ConnectionFileDescriptor::BytesAvailable() "
|
||||
"got data: %c from the command channel.",
|
||||
static_cast<void *>(this), c);
|
||||
return eConnectionStatusEndOfFile;
|
||||
case 'i':
|
||||
// Interrupt the current read
|
||||
|
|
|
|||
|
|
@ -91,9 +91,8 @@ bool ConnectionGenericFile::IsConnected() const {
|
|||
lldb::ConnectionStatus ConnectionGenericFile::Connect(llvm::StringRef path,
|
||||
Status *error_ptr) {
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
|
||||
if (log)
|
||||
log->Printf("%p ConnectionGenericFile::Connect (url = '%s')",
|
||||
static_cast<void *>(this), path.str().c_str());
|
||||
LLDB_LOGF(log, "%p ConnectionGenericFile::Connect (url = '%s')",
|
||||
static_cast<void *>(this), path.str().c_str());
|
||||
|
||||
if (!path.consume_front("file://")) {
|
||||
if (error_ptr)
|
||||
|
|
@ -134,9 +133,8 @@ lldb::ConnectionStatus ConnectionGenericFile::Connect(llvm::StringRef path,
|
|||
|
||||
lldb::ConnectionStatus ConnectionGenericFile::Disconnect(Status *error_ptr) {
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
|
||||
if (log)
|
||||
log->Printf("%p ConnectionGenericFile::Disconnect ()",
|
||||
static_cast<void *>(this));
|
||||
LLDB_LOGF(log, "%p ConnectionGenericFile::Disconnect ()",
|
||||
static_cast<void *>(this));
|
||||
|
||||
if (!IsConnected())
|
||||
return eConnectionStatusSuccess;
|
||||
|
|
@ -248,10 +246,11 @@ finish:
|
|||
IncrementFilePointer(return_info.GetBytes());
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
|
||||
if (log) {
|
||||
log->Printf("%p ConnectionGenericFile::Read() handle = %p, dst = %p, "
|
||||
"dst_len = %zu) => %zu, error = %s",
|
||||
this, m_file, dst, dst_len, return_info.GetBytes(),
|
||||
return_info.GetError().AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"%p ConnectionGenericFile::Read() handle = %p, dst = %p, "
|
||||
"dst_len = %zu) => %zu, error = %s",
|
||||
this, m_file, dst, dst_len, return_info.GetBytes(),
|
||||
return_info.GetError().AsCString());
|
||||
}
|
||||
|
||||
return return_info.GetBytes();
|
||||
|
|
@ -298,10 +297,11 @@ finish:
|
|||
IncrementFilePointer(return_info.GetBytes());
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
|
||||
if (log) {
|
||||
log->Printf("%p ConnectionGenericFile::Write() handle = %p, src = %p, "
|
||||
"src_len = %zu) => %zu, error = %s",
|
||||
this, m_file, src, src_len, return_info.GetBytes(),
|
||||
return_info.GetError().AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"%p ConnectionGenericFile::Write() handle = %p, src = %p, "
|
||||
"src_len = %zu) => %zu, error = %s",
|
||||
this, m_file, src, src_len, return_info.GetBytes(),
|
||||
return_info.GetError().AsCString());
|
||||
}
|
||||
return return_info.GetBytes();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1628,8 +1628,7 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
|
|||
llvm::PrettyStackTraceFormat stack_trace("HandleCommand(command = \"%s\")",
|
||||
command_line);
|
||||
|
||||
if (log)
|
||||
log->Printf("Processing command: %s", command_line);
|
||||
LLDB_LOGF(log, "Processing command: %s", command_line);
|
||||
|
||||
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||
Timer scoped_timer(func_cat, "Handling command: %s.", command_line);
|
||||
|
|
@ -1735,13 +1734,13 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
|
|||
// "br s -n main", command_string is now "breakpoint set -n main".
|
||||
if (log) {
|
||||
llvm::StringRef command_name = cmd_obj ? cmd_obj->GetCommandName() : "<not found>";
|
||||
log->Printf("HandleCommand, cmd_obj : '%s'", command_name.str().c_str());
|
||||
log->Printf("HandleCommand, (revised) command_string: '%s'",
|
||||
command_string.c_str());
|
||||
LLDB_LOGF(log, "HandleCommand, cmd_obj : '%s'", command_name.str().c_str());
|
||||
LLDB_LOGF(log, "HandleCommand, (revised) command_string: '%s'",
|
||||
command_string.c_str());
|
||||
const bool wants_raw_input =
|
||||
(cmd_obj != nullptr) ? cmd_obj->WantsRawCommandString() : false;
|
||||
log->Printf("HandleCommand, wants_raw_input:'%s'",
|
||||
wants_raw_input ? "True" : "False");
|
||||
LLDB_LOGF(log, "HandleCommand, wants_raw_input:'%s'",
|
||||
wants_raw_input ? "True" : "False");
|
||||
}
|
||||
|
||||
// Phase 2.
|
||||
|
|
@ -1771,17 +1770,15 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
|
|||
if (pos != 0 && pos != std::string::npos)
|
||||
remainder.erase(0, pos);
|
||||
|
||||
if (log)
|
||||
log->Printf(
|
||||
"HandleCommand, command line after removing command name(s): '%s'",
|
||||
remainder.c_str());
|
||||
LLDB_LOGF(
|
||||
log, "HandleCommand, command line after removing command name(s): '%s'",
|
||||
remainder.c_str());
|
||||
|
||||
cmd_obj->Execute(remainder.c_str(), result);
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("HandleCommand, command %s",
|
||||
(result.Succeeded() ? "succeeded" : "did not succeed"));
|
||||
LLDB_LOGF(log, "HandleCommand, command %s",
|
||||
(result.Succeeded() ? "succeeded" : "did not succeed"));
|
||||
|
||||
return result.Succeeded();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1710,9 +1710,8 @@ bool ABIMacOSX_arm64::PrepareTrivialCall(
|
|||
for (size_t i = 0; i < args.size(); ++i) {
|
||||
const RegisterInfo *reg_info = reg_ctx->GetRegisterInfo(
|
||||
eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1 + i);
|
||||
if (log)
|
||||
log->Printf("About to write arg%d (0x%" PRIx64 ") into %s",
|
||||
static_cast<int>(i + 1), args[i], reg_info->name);
|
||||
LLDB_LOGF(log, "About to write arg%d (0x%" PRIx64 ") into %s",
|
||||
static_cast<int>(i + 1), args[i], reg_info->name);
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1706,9 +1706,8 @@ bool ABISysV_arm64::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
for (size_t i = 0; i < args.size(); ++i) {
|
||||
const RegisterInfo *reg_info = reg_ctx->GetRegisterInfo(
|
||||
eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1 + i);
|
||||
if (log)
|
||||
log->Printf("About to write arg%d (0x%" PRIx64 ") into %s",
|
||||
static_cast<int>(i + 1), args[i], reg_info->name);
|
||||
LLDB_LOGF(log, "About to write arg%d (0x%" PRIx64 ") into %s",
|
||||
static_cast<int>(i + 1), args[i], reg_info->name);
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -600,9 +600,8 @@ bool ABISysV_mips::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
|
||||
reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric,
|
||||
LLDB_REGNUM_GENERIC_ARG1 + i);
|
||||
if (log)
|
||||
log->Printf("About to write arg%zd (0x%" PRIx64 ") into %s", i + 1,
|
||||
args[i], reg_info->name);
|
||||
LLDB_LOGF(log, "About to write arg%zd (0x%" PRIx64 ") into %s", i + 1,
|
||||
args[i], reg_info->name);
|
||||
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
|
||||
return false;
|
||||
|
|
@ -630,9 +629,8 @@ bool ABISysV_mips::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
size_t i = 4;
|
||||
for (; ai != ae; ++ai) {
|
||||
reg_value.SetUInt32(*ai);
|
||||
if (log)
|
||||
log->Printf("About to write arg%zd (0x%" PRIx64 ") at 0x%" PRIx64 "",
|
||||
i + 1, args[i], arg_pos);
|
||||
LLDB_LOGF(log, "About to write arg%zd (0x%" PRIx64 ") at 0x%" PRIx64 "",
|
||||
i + 1, args[i], arg_pos);
|
||||
|
||||
if (reg_ctx
|
||||
->WriteRegisterValueToMemory(reg_info, arg_pos,
|
||||
|
|
@ -654,8 +652,7 @@ bool ABISysV_mips::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
const RegisterInfo *r25_info = reg_ctx->GetRegisterInfoByName("r25", 0);
|
||||
const RegisterInfo *r0_info = reg_ctx->GetRegisterInfoByName("zero", 0);
|
||||
|
||||
if (log)
|
||||
log->Printf("Writing R0: 0x%" PRIx64, (uint64_t)0);
|
||||
LLDB_LOGF(log, "Writing R0: 0x%" PRIx64, (uint64_t)0);
|
||||
|
||||
/* Write r0 with 0, in case we are stopped in syscall,
|
||||
* such setting prevents automatic decrement of the PC.
|
||||
|
|
@ -664,29 +661,25 @@ bool ABISysV_mips::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
if (!reg_ctx->WriteRegisterFromUnsigned(r0_info, (uint64_t)0))
|
||||
return false;
|
||||
|
||||
if (log)
|
||||
log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);
|
||||
LLDB_LOGF(log, "Writing SP: 0x%" PRIx64, (uint64_t)sp);
|
||||
|
||||
// Set "sp" to the requested value
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(sp_reg_info, sp))
|
||||
return false;
|
||||
|
||||
if (log)
|
||||
log->Printf("Writing RA: 0x%" PRIx64, (uint64_t)return_addr);
|
||||
LLDB_LOGF(log, "Writing RA: 0x%" PRIx64, (uint64_t)return_addr);
|
||||
|
||||
// Set "ra" to the return address
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(ra_reg_info, return_addr))
|
||||
return false;
|
||||
|
||||
if (log)
|
||||
log->Printf("Writing PC: 0x%" PRIx64, (uint64_t)func_addr);
|
||||
LLDB_LOGF(log, "Writing PC: 0x%" PRIx64, (uint64_t)func_addr);
|
||||
|
||||
// Set pc to the address of the called function.
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(pc_reg_info, func_addr))
|
||||
return false;
|
||||
|
||||
if (log)
|
||||
log->Printf("Writing r25: 0x%" PRIx64, (uint64_t)func_addr);
|
||||
LLDB_LOGF(log, "Writing r25: 0x%" PRIx64, (uint64_t)func_addr);
|
||||
|
||||
// All callers of position independent functions must place the address of
|
||||
// the called function in t9 (r25)
|
||||
|
|
|
|||
|
|
@ -589,18 +589,16 @@ bool ABISysV_mips64::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
for (size_t i = 0; i < args.size(); ++i) {
|
||||
reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric,
|
||||
LLDB_REGNUM_GENERIC_ARG1 + i);
|
||||
if (log)
|
||||
log->Printf("About to write arg%zd (0x%" PRIx64 ") into %s", i + 1,
|
||||
args[i], reg_info->name);
|
||||
LLDB_LOGF(log, "About to write arg%zd (0x%" PRIx64 ") into %s", i + 1,
|
||||
args[i], reg_info->name);
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
|
||||
return false;
|
||||
}
|
||||
|
||||
// First, align the SP
|
||||
|
||||
if (log)
|
||||
log->Printf("16-byte aligning SP: 0x%" PRIx64 " to 0x%" PRIx64,
|
||||
(uint64_t)sp, (uint64_t)(sp & ~0xfull));
|
||||
LLDB_LOGF(log, "16-byte aligning SP: 0x%" PRIx64 " to 0x%" PRIx64,
|
||||
(uint64_t)sp, (uint64_t)(sp & ~0xfull));
|
||||
|
||||
sp &= ~(0xfull); // 16-byte alignment
|
||||
|
||||
|
|
@ -614,8 +612,7 @@ bool ABISysV_mips64::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
const RegisterInfo *r25_info = reg_ctx->GetRegisterInfoByName("r25", 0);
|
||||
const RegisterInfo *r0_info = reg_ctx->GetRegisterInfoByName("zero", 0);
|
||||
|
||||
if (log)
|
||||
log->Printf("Writing R0: 0x%" PRIx64, (uint64_t)0);
|
||||
LLDB_LOGF(log, "Writing R0: 0x%" PRIx64, (uint64_t)0);
|
||||
|
||||
/* Write r0 with 0, in case we are stopped in syscall,
|
||||
* such setting prevents automatic decrement of the PC.
|
||||
|
|
@ -624,29 +621,25 @@ bool ABISysV_mips64::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
if (!reg_ctx->WriteRegisterFromUnsigned(r0_info, (uint64_t)0))
|
||||
return false;
|
||||
|
||||
if (log)
|
||||
log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);
|
||||
LLDB_LOGF(log, "Writing SP: 0x%" PRIx64, (uint64_t)sp);
|
||||
|
||||
// Set "sp" to the requested value
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(sp_reg_info, sp))
|
||||
return false;
|
||||
|
||||
if (log)
|
||||
log->Printf("Writing RA: 0x%" PRIx64, (uint64_t)return_addr);
|
||||
LLDB_LOGF(log, "Writing RA: 0x%" PRIx64, (uint64_t)return_addr);
|
||||
|
||||
// Set "ra" to the return address
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(ra_reg_info, return_addr))
|
||||
return false;
|
||||
|
||||
if (log)
|
||||
log->Printf("Writing PC: 0x%" PRIx64, (uint64_t)func_addr);
|
||||
LLDB_LOGF(log, "Writing PC: 0x%" PRIx64, (uint64_t)func_addr);
|
||||
|
||||
// Set pc to the address of the called function.
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(pc_reg_info, func_addr))
|
||||
return false;
|
||||
|
||||
if (log)
|
||||
log->Printf("Writing r25: 0x%" PRIx64, (uint64_t)func_addr);
|
||||
LLDB_LOGF(log, "Writing r25: 0x%" PRIx64, (uint64_t)func_addr);
|
||||
|
||||
// All callers of position independent functions must place the address of
|
||||
// the called function in t9 (r25)
|
||||
|
|
|
|||
|
|
@ -255,18 +255,16 @@ bool ABISysV_ppc::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
for (size_t i = 0; i < args.size(); ++i) {
|
||||
reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric,
|
||||
LLDB_REGNUM_GENERIC_ARG1 + i);
|
||||
if (log)
|
||||
log->Printf("About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s",
|
||||
static_cast<uint64_t>(i + 1), args[i], reg_info->name);
|
||||
LLDB_LOGF(log, "About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s",
|
||||
static_cast<uint64_t>(i + 1), args[i], reg_info->name);
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
|
||||
return false;
|
||||
}
|
||||
|
||||
// First, align the SP
|
||||
|
||||
if (log)
|
||||
log->Printf("16-byte aligning SP: 0x%" PRIx64 " to 0x%" PRIx64,
|
||||
(uint64_t)sp, (uint64_t)(sp & ~0xfull));
|
||||
LLDB_LOGF(log, "16-byte aligning SP: 0x%" PRIx64 " to 0x%" PRIx64,
|
||||
(uint64_t)sp, (uint64_t)(sp & ~0xfull));
|
||||
|
||||
sp &= ~(0xfull); // 16-byte alignment
|
||||
|
||||
|
|
@ -281,10 +279,10 @@ bool ABISysV_ppc::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
|
||||
RegisterValue reg_value;
|
||||
|
||||
if (log)
|
||||
log->Printf("Pushing the return address onto the stack: 0x%" PRIx64
|
||||
": 0x%" PRIx64,
|
||||
(uint64_t)sp, (uint64_t)return_addr);
|
||||
LLDB_LOGF(log,
|
||||
"Pushing the return address onto the stack: 0x%" PRIx64
|
||||
": 0x%" PRIx64,
|
||||
(uint64_t)sp, (uint64_t)return_addr);
|
||||
|
||||
// Save return address onto the stack
|
||||
if (!process_sp->WritePointerToMemory(sp, return_addr, error))
|
||||
|
|
@ -292,16 +290,14 @@ bool ABISysV_ppc::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
|
||||
// %r1 is set to the actual stack value.
|
||||
|
||||
if (log)
|
||||
log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);
|
||||
LLDB_LOGF(log, "Writing SP: 0x%" PRIx64, (uint64_t)sp);
|
||||
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(sp_reg_info, sp))
|
||||
return false;
|
||||
|
||||
// %pc is set to the address of the called function.
|
||||
|
||||
if (log)
|
||||
log->Printf("Writing IP: 0x%" PRIx64, (uint64_t)func_addr);
|
||||
LLDB_LOGF(log, "Writing IP: 0x%" PRIx64, (uint64_t)func_addr);
|
||||
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(pc_reg_info, func_addr))
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -106,18 +106,16 @@ bool ABISysV_ppc64::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
for (size_t i = 0; i < args.size(); ++i) {
|
||||
reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric,
|
||||
LLDB_REGNUM_GENERIC_ARG1 + i);
|
||||
if (log)
|
||||
log->Printf("About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s",
|
||||
static_cast<uint64_t>(i + 1), args[i], reg_info->name);
|
||||
LLDB_LOGF(log, "About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s",
|
||||
static_cast<uint64_t>(i + 1), args[i], reg_info->name);
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
|
||||
return false;
|
||||
}
|
||||
|
||||
// First, align the SP
|
||||
|
||||
if (log)
|
||||
log->Printf("16-byte aligning SP: 0x%" PRIx64 " to 0x%" PRIx64,
|
||||
(uint64_t)sp, (uint64_t)(sp & ~0xfull));
|
||||
LLDB_LOGF(log, "16-byte aligning SP: 0x%" PRIx64 " to 0x%" PRIx64,
|
||||
(uint64_t)sp, (uint64_t)(sp & ~0xfull));
|
||||
|
||||
sp &= ~(0xfull); // 16-byte alignment
|
||||
|
||||
|
|
@ -136,22 +134,20 @@ bool ABISysV_ppc64::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
const RegisterInfo *r12_reg_info = reg_ctx->GetRegisterInfoAtIndex(12);
|
||||
|
||||
// Save return address onto the stack.
|
||||
if (log)
|
||||
log->Printf("Pushing the return address onto the stack: 0x%" PRIx64
|
||||
"(+16): 0x%" PRIx64,
|
||||
(uint64_t)sp, (uint64_t)return_addr);
|
||||
LLDB_LOGF(log,
|
||||
"Pushing the return address onto the stack: 0x%" PRIx64
|
||||
"(+16): 0x%" PRIx64,
|
||||
(uint64_t)sp, (uint64_t)return_addr);
|
||||
if (!process_sp->WritePointerToMemory(sp + 16, return_addr, error))
|
||||
return false;
|
||||
|
||||
// Write the return address to link register.
|
||||
if (log)
|
||||
log->Printf("Writing LR: 0x%" PRIx64, (uint64_t)return_addr);
|
||||
LLDB_LOGF(log, "Writing LR: 0x%" PRIx64, (uint64_t)return_addr);
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(lr_reg_info, return_addr))
|
||||
return false;
|
||||
|
||||
// Write target address to %r12 register.
|
||||
if (log)
|
||||
log->Printf("Writing R12: 0x%" PRIx64, (uint64_t)func_addr);
|
||||
LLDB_LOGF(log, "Writing R12: 0x%" PRIx64, (uint64_t)func_addr);
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(r12_reg_info, func_addr))
|
||||
return false;
|
||||
|
||||
|
|
@ -165,10 +161,9 @@ bool ABISysV_ppc64::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
else
|
||||
stack_offset = 40;
|
||||
|
||||
if (log)
|
||||
log->Printf("Writing R2 (TOC) at SP(0x%" PRIx64 ")+%d: 0x%" PRIx64,
|
||||
(uint64_t)(sp + stack_offset), (int)stack_offset,
|
||||
(uint64_t)reg_value);
|
||||
LLDB_LOGF(log, "Writing R2 (TOC) at SP(0x%" PRIx64 ")+%d: 0x%" PRIx64,
|
||||
(uint64_t)(sp + stack_offset), (int)stack_offset,
|
||||
(uint64_t)reg_value);
|
||||
if (!process_sp->WritePointerToMemory(sp + stack_offset, reg_value, error))
|
||||
return false;
|
||||
|
||||
|
|
@ -176,23 +171,20 @@ bool ABISysV_ppc64::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
reg_value = reg_ctx->ReadRegisterAsUnsigned(sp_reg_info, 0);
|
||||
|
||||
// Save current SP onto the stack.
|
||||
if (log)
|
||||
log->Printf("Writing SP at SP(0x%" PRIx64 ")+0: 0x%" PRIx64, (uint64_t)sp,
|
||||
(uint64_t)reg_value);
|
||||
LLDB_LOGF(log, "Writing SP at SP(0x%" PRIx64 ")+0: 0x%" PRIx64, (uint64_t)sp,
|
||||
(uint64_t)reg_value);
|
||||
if (!process_sp->WritePointerToMemory(sp, reg_value, error))
|
||||
return false;
|
||||
|
||||
// %r1 is set to the actual stack value.
|
||||
if (log)
|
||||
log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);
|
||||
LLDB_LOGF(log, "Writing SP: 0x%" PRIx64, (uint64_t)sp);
|
||||
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(sp_reg_info, sp))
|
||||
return false;
|
||||
|
||||
// %pc is set to the address of the called function.
|
||||
|
||||
if (log)
|
||||
log->Printf("Writing IP: 0x%" PRIx64, (uint64_t)func_addr);
|
||||
LLDB_LOGF(log, "Writing IP: 0x%" PRIx64, (uint64_t)func_addr);
|
||||
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(pc_reg_info, func_addr))
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -252,16 +252,14 @@ bool ABISysV_s390x::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
if (i < 5) {
|
||||
const RegisterInfo *reg_info = reg_ctx->GetRegisterInfo(
|
||||
eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1 + i);
|
||||
if (log)
|
||||
log->Printf("About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s",
|
||||
static_cast<uint64_t>(i + 1), args[i], reg_info->name);
|
||||
LLDB_LOGF(log, "About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s",
|
||||
static_cast<uint64_t>(i + 1), args[i], reg_info->name);
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
|
||||
return false;
|
||||
} else {
|
||||
Status error;
|
||||
if (log)
|
||||
log->Printf("About to write arg%" PRIu64 " (0x%" PRIx64 ") onto stack",
|
||||
static_cast<uint64_t>(i + 1), args[i]);
|
||||
LLDB_LOGF(log, "About to write arg%" PRIu64 " (0x%" PRIx64 ") onto stack",
|
||||
static_cast<uint64_t>(i + 1), args[i]);
|
||||
if (!process_sp->WritePointerToMemory(arg_pos, args[i], error))
|
||||
return false;
|
||||
arg_pos += 8;
|
||||
|
|
@ -270,24 +268,21 @@ bool ABISysV_s390x::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
|
||||
// %r14 is set to the return address
|
||||
|
||||
if (log)
|
||||
log->Printf("Writing RA: 0x%" PRIx64, (uint64_t)return_addr);
|
||||
LLDB_LOGF(log, "Writing RA: 0x%" PRIx64, (uint64_t)return_addr);
|
||||
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(ra_reg_info, return_addr))
|
||||
return false;
|
||||
|
||||
// %r15 is set to the actual stack value.
|
||||
|
||||
if (log)
|
||||
log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);
|
||||
LLDB_LOGF(log, "Writing SP: 0x%" PRIx64, (uint64_t)sp);
|
||||
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(sp_reg_info, sp))
|
||||
return false;
|
||||
|
||||
// %pc is set to the address of the called function.
|
||||
|
||||
if (log)
|
||||
log->Printf("Writing PC: 0x%" PRIx64, (uint64_t)func_addr);
|
||||
LLDB_LOGF(log, "Writing PC: 0x%" PRIx64, (uint64_t)func_addr);
|
||||
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(pc_reg_info, func_addr))
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -270,18 +270,16 @@ bool ABISysV_x86_64::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
for (size_t i = 0; i < args.size(); ++i) {
|
||||
reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric,
|
||||
LLDB_REGNUM_GENERIC_ARG1 + i);
|
||||
if (log)
|
||||
log->Printf("About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s",
|
||||
static_cast<uint64_t>(i + 1), args[i], reg_info->name);
|
||||
LLDB_LOGF(log, "About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s",
|
||||
static_cast<uint64_t>(i + 1), args[i], reg_info->name);
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
|
||||
return false;
|
||||
}
|
||||
|
||||
// First, align the SP
|
||||
|
||||
if (log)
|
||||
log->Printf("16-byte aligning SP: 0x%" PRIx64 " to 0x%" PRIx64,
|
||||
(uint64_t)sp, (uint64_t)(sp & ~0xfull));
|
||||
LLDB_LOGF(log, "16-byte aligning SP: 0x%" PRIx64 " to 0x%" PRIx64,
|
||||
(uint64_t)sp, (uint64_t)(sp & ~0xfull));
|
||||
|
||||
sp &= ~(0xfull); // 16-byte alignment
|
||||
|
||||
|
|
@ -295,10 +293,10 @@ bool ABISysV_x86_64::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
ProcessSP process_sp(thread.GetProcess());
|
||||
|
||||
RegisterValue reg_value;
|
||||
if (log)
|
||||
log->Printf("Pushing the return address onto the stack: 0x%" PRIx64
|
||||
": 0x%" PRIx64,
|
||||
(uint64_t)sp, (uint64_t)return_addr);
|
||||
LLDB_LOGF(log,
|
||||
"Pushing the return address onto the stack: 0x%" PRIx64
|
||||
": 0x%" PRIx64,
|
||||
(uint64_t)sp, (uint64_t)return_addr);
|
||||
|
||||
// Save return address onto the stack
|
||||
if (!process_sp->WritePointerToMemory(sp, return_addr, error))
|
||||
|
|
@ -306,16 +304,14 @@ bool ABISysV_x86_64::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
|
||||
// %rsp is set to the actual stack value.
|
||||
|
||||
if (log)
|
||||
log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);
|
||||
LLDB_LOGF(log, "Writing SP: 0x%" PRIx64, (uint64_t)sp);
|
||||
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(sp_reg_info, sp))
|
||||
return false;
|
||||
|
||||
// %rip is set to the address of the called function.
|
||||
|
||||
if (log)
|
||||
log->Printf("Writing IP: 0x%" PRIx64, (uint64_t)func_addr);
|
||||
LLDB_LOGF(log, "Writing IP: 0x%" PRIx64, (uint64_t)func_addr);
|
||||
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(pc_reg_info, func_addr))
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1129,18 +1129,16 @@ bool ABIWindows_x86_64::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
for (size_t i = 0; i < args.size(); ++i) {
|
||||
reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric,
|
||||
LLDB_REGNUM_GENERIC_ARG1 + i);
|
||||
if (log)
|
||||
log->Printf("About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s",
|
||||
static_cast<uint64_t>(i + 1), args[i], reg_info->name);
|
||||
LLDB_LOGF(log, "About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s",
|
||||
static_cast<uint64_t>(i + 1), args[i], reg_info->name);
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
|
||||
return false;
|
||||
}
|
||||
|
||||
// First, align the SP
|
||||
|
||||
if (log)
|
||||
log->Printf("16-byte aligning SP: 0x%" PRIx64 " to 0x%" PRIx64,
|
||||
(uint64_t)sp, (uint64_t)(sp & ~0xfull));
|
||||
LLDB_LOGF(log, "16-byte aligning SP: 0x%" PRIx64 " to 0x%" PRIx64,
|
||||
(uint64_t)sp, (uint64_t)(sp & ~0xfull));
|
||||
|
||||
sp &= ~(0xfull); // 16-byte alignment
|
||||
|
||||
|
|
@ -1154,10 +1152,10 @@ bool ABIWindows_x86_64::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
ProcessSP process_sp(thread.GetProcess());
|
||||
|
||||
RegisterValue reg_value;
|
||||
if (log)
|
||||
log->Printf("Pushing the return address onto the stack: 0x%" PRIx64
|
||||
": 0x%" PRIx64,
|
||||
(uint64_t)sp, (uint64_t)return_addr);
|
||||
LLDB_LOGF(log,
|
||||
"Pushing the return address onto the stack: 0x%" PRIx64
|
||||
": 0x%" PRIx64,
|
||||
(uint64_t)sp, (uint64_t)return_addr);
|
||||
|
||||
// Save return address onto the stack
|
||||
if (!process_sp->WritePointerToMemory(sp, return_addr, error))
|
||||
|
|
@ -1165,16 +1163,14 @@ bool ABIWindows_x86_64::PrepareTrivialCall(Thread &thread, addr_t sp,
|
|||
|
||||
// %rsp is set to the actual stack value.
|
||||
|
||||
if (log)
|
||||
log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);
|
||||
LLDB_LOGF(log, "Writing SP: 0x%" PRIx64, (uint64_t)sp);
|
||||
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(sp_reg_info, sp))
|
||||
return false;
|
||||
|
||||
// %rip is set to the address of the called function.
|
||||
|
||||
if (log)
|
||||
log->Printf("Writing IP: 0x%" PRIx64, (uint64_t)func_addr);
|
||||
LLDB_LOGF(log, "Writing IP: 0x%" PRIx64, (uint64_t)func_addr);
|
||||
|
||||
if (!reg_ctx->WriteRegisterFromUnsigned(pc_reg_info, func_addr))
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -127,10 +127,10 @@ lldb::addr_t ArchitectureMips::GetBreakableLoadAddress(lldb::addr_t addr,
|
|||
|
||||
// Adjust the breakable address
|
||||
uint64_t breakable_addr = addr - insn->GetOpcode().GetByteSize();
|
||||
if (log)
|
||||
log->Printf("Target::%s Breakpoint at 0x%8.8" PRIx64
|
||||
" is adjusted to 0x%8.8" PRIx64 " due to delay slot\n",
|
||||
__FUNCTION__, addr, breakable_addr);
|
||||
LLDB_LOGF(log,
|
||||
"Target::%s Breakpoint at 0x%8.8" PRIx64
|
||||
" is adjusted to 0x%8.8" PRIx64 " due to delay slot\n",
|
||||
__FUNCTION__, addr, breakable_addr);
|
||||
|
||||
return breakable_addr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -430,10 +430,10 @@ DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress(lldb::addr_t addr,
|
|||
return UUID();
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress: "
|
||||
"looking for kernel binary at 0x%" PRIx64,
|
||||
addr);
|
||||
LLDB_LOGF(log,
|
||||
"DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress: "
|
||||
"looking for kernel binary at 0x%" PRIx64,
|
||||
addr);
|
||||
|
||||
llvm::MachO::mach_header header;
|
||||
|
||||
|
|
@ -455,11 +455,11 @@ DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress(lldb::addr_t addr,
|
|||
|
||||
ObjectFile *exe_objfile = memory_module_sp->GetObjectFile();
|
||||
if (exe_objfile == nullptr) {
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress "
|
||||
"found a binary at 0x%" PRIx64
|
||||
" but could not create an object file from memory",
|
||||
addr);
|
||||
LLDB_LOGF(log,
|
||||
"DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress "
|
||||
"found a binary at 0x%" PRIx64
|
||||
" but could not create an object file from memory",
|
||||
addr);
|
||||
return UUID();
|
||||
}
|
||||
|
||||
|
|
@ -478,7 +478,8 @@ DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress(lldb::addr_t addr,
|
|||
} else {
|
||||
uuid_str = "and no LC_UUID found in load commands ";
|
||||
}
|
||||
log->Printf(
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress: "
|
||||
"kernel binary image found at 0x%" PRIx64 " with arch '%s' %s",
|
||||
addr, kernel_arch.GetTriple().str().c_str(), uuid_str.c_str());
|
||||
|
|
@ -680,11 +681,12 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::ReadMemoryModule(
|
|||
if (m_uuid.IsValid()) {
|
||||
if (m_uuid != memory_module_sp->GetUUID()) {
|
||||
if (log) {
|
||||
log->Printf("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;
|
||||
}
|
||||
|
|
@ -700,8 +702,9 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::ReadMemoryModule(
|
|||
if (is_kernel) {
|
||||
if (log) {
|
||||
// This is unusual and probably not intended
|
||||
log->Printf("KextImageInfo::ReadMemoryModule read the kernel binary out "
|
||||
"of memory");
|
||||
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());
|
||||
|
|
@ -747,10 +750,10 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(
|
|||
if (m_uuid.IsValid() == false) {
|
||||
if (ReadMemoryModule(process) == false) {
|
||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||
if (log)
|
||||
log->Printf("Unable to read '%s' from memory at address 0x%" PRIx64
|
||||
" to get the segment load addresses.",
|
||||
m_name.c_str(), m_load_address);
|
||||
LLDB_LOGF(log,
|
||||
"Unable to read '%s' from memory at address 0x%" PRIx64
|
||||
" to get the segment load addresses.",
|
||||
m_name.c_str(), m_load_address);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1054,8 +1057,7 @@ bool DynamicLoaderDarwinKernel::BreakpointHit(StoppointCallbackContext *context,
|
|||
user_id_t break_id,
|
||||
user_id_t break_loc_id) {
|
||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderDarwinKernel::BreakpointHit (...)\n");
|
||||
LLDB_LOGF(log, "DynamicLoaderDarwinKernel::BreakpointHit (...)\n");
|
||||
|
||||
ReadAllKextSummaries();
|
||||
|
||||
|
|
@ -1153,9 +1155,9 @@ bool DynamicLoaderDarwinKernel::ParseKextSummaries(
|
|||
const Address &kext_summary_addr, uint32_t count) {
|
||||
KextImageInfo::collection kext_summaries;
|
||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||
if (log)
|
||||
log->Printf("Kexts-changed breakpoint hit, there are %d kexts currently.\n",
|
||||
count);
|
||||
LLDB_LOGF(log,
|
||||
"Kexts-changed breakpoint hit, there are %d kexts currently.\n",
|
||||
count);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
|
||||
|
|
@ -1248,15 +1250,17 @@ bool DynamicLoaderDarwinKernel::ParseKextSummaries(
|
|||
|
||||
if (log) {
|
||||
if (load_kexts) {
|
||||
log->Printf("DynamicLoaderDarwinKernel::ParseKextSummaries: %d kexts "
|
||||
"added, %d kexts removed",
|
||||
number_of_new_kexts_being_added,
|
||||
number_of_old_kexts_being_removed);
|
||||
LLDB_LOGF(log,
|
||||
"DynamicLoaderDarwinKernel::ParseKextSummaries: %d kexts "
|
||||
"added, %d kexts removed",
|
||||
number_of_new_kexts_being_added,
|
||||
number_of_old_kexts_being_removed);
|
||||
} else {
|
||||
log->Printf(
|
||||
"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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1430,11 +1434,12 @@ void DynamicLoaderDarwinKernel::PutToLog(Log *log) const {
|
|||
return;
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
log->Printf("gLoadedKextSummaries = 0x%16.16" PRIx64
|
||||
" { version=%u, entry_size=%u, entry_count=%u }",
|
||||
m_kext_summary_header_addr.GetFileAddress(),
|
||||
m_kext_summary_header.version, m_kext_summary_header.entry_size,
|
||||
m_kext_summary_header.entry_count);
|
||||
LLDB_LOGF(log,
|
||||
"gLoadedKextSummaries = 0x%16.16" PRIx64
|
||||
" { version=%u, entry_size=%u, entry_count=%u }",
|
||||
m_kext_summary_header_addr.GetFileAddress(),
|
||||
m_kext_summary_header.version, m_kext_summary_header.entry_size,
|
||||
m_kext_summary_header.entry_count);
|
||||
|
||||
size_t i;
|
||||
const size_t count = m_known_kexts.size();
|
||||
|
|
@ -1509,8 +1514,7 @@ DynamicLoaderDarwinKernel::GetStepThroughTrampolinePlan(Thread &thread,
|
|||
bool stop_others) {
|
||||
ThreadPlanSP thread_plan_sp;
|
||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
|
||||
if (log)
|
||||
log->Printf("Could not find symbol for step through.");
|
||||
LLDB_LOGF(log, "Could not find symbol for step through.");
|
||||
return thread_plan_sp;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -277,8 +277,7 @@ bool DynamicLoaderHexagonDYLD::SetRendezvousBreakpoint() {
|
|||
|
||||
// Do not try to set the breakpoint if we don't know where to put it
|
||||
if (break_addr == LLDB_INVALID_ADDRESS) {
|
||||
if (log)
|
||||
log->Printf("Unable to locate _rtld_debug_state breakpoint address");
|
||||
LLDB_LOGF(log, "Unable to locate _rtld_debug_state breakpoint address");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -301,7 +300,7 @@ bool DynamicLoaderHexagonDYLD::SetRendezvousBreakpoint() {
|
|||
.GetID() == m_dyld_bid);
|
||||
|
||||
if (log && dyld_break == nullptr)
|
||||
log->Printf("Failed to create _rtld_debug_state breakpoint");
|
||||
LLDB_LOGF(log, "Failed to create _rtld_debug_state breakpoint");
|
||||
|
||||
// check we have successfully set bp
|
||||
return (dyld_break != nullptr);
|
||||
|
|
@ -316,8 +315,7 @@ bool DynamicLoaderHexagonDYLD::RendezvousBreakpointHit(
|
|||
user_id_t break_loc_id) {
|
||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||
|
||||
if (log)
|
||||
log->Printf("Rendezvous breakpoint hit!");
|
||||
LLDB_LOGF(log, "Rendezvous breakpoint hit!");
|
||||
|
||||
DynamicLoaderHexagonDYLD *dyld_instance = nullptr;
|
||||
dyld_instance = static_cast<DynamicLoaderHexagonDYLD *>(baton);
|
||||
|
|
@ -333,11 +331,9 @@ bool DynamicLoaderHexagonDYLD::RendezvousBreakpointHit(
|
|||
if (structAddr != LLDB_INVALID_ADDRESS) {
|
||||
dyld_instance->m_rendezvous.SetRendezvousAddress(structAddr);
|
||||
|
||||
if (log)
|
||||
log->Printf("Found _rtld_debug structure @ 0x%08" PRIx64, structAddr);
|
||||
LLDB_LOGF(log, "Found _rtld_debug structure @ 0x%08" PRIx64, structAddr);
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("Unable to resolve the _rtld_debug structure");
|
||||
LLDB_LOGF(log, "Unable to resolve the _rtld_debug structure");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -375,11 +371,11 @@ void DynamicLoaderHexagonDYLD::RefreshModules() {
|
|||
}
|
||||
|
||||
if (log) {
|
||||
log->Printf("Target is loading '%s'", I->path.c_str());
|
||||
LLDB_LOGF(log, "Target is loading '%s'", I->path.c_str());
|
||||
if (!module_sp.get())
|
||||
log->Printf("LLDB failed to load '%s'", I->path.c_str());
|
||||
LLDB_LOGF(log, "LLDB failed to load '%s'", I->path.c_str());
|
||||
else
|
||||
log->Printf("LLDB successfully loaded '%s'", I->path.c_str());
|
||||
LLDB_LOGF(log, "LLDB successfully loaded '%s'", I->path.c_str());
|
||||
}
|
||||
}
|
||||
m_process->GetTarget().ModulesDidLoad(new_modules);
|
||||
|
|
@ -400,8 +396,7 @@ void DynamicLoaderHexagonDYLD::RefreshModules() {
|
|||
UnloadSections(module_sp);
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("Target is unloading '%s'", I->path.c_str());
|
||||
LLDB_LOGF(log, "Target is unloading '%s'", I->path.c_str());
|
||||
}
|
||||
loaded_modules.Remove(old_modules);
|
||||
m_process->GetTarget().ModulesDidUnload(old_modules, false);
|
||||
|
|
@ -472,10 +467,10 @@ void DynamicLoaderHexagonDYLD::LoadAllCurrentModules() {
|
|||
|
||||
if (!m_rendezvous.Resolve()) {
|
||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||
if (log)
|
||||
log->Printf(
|
||||
"DynamicLoaderHexagonDYLD::%s unable to resolve rendezvous address",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"DynamicLoaderHexagonDYLD::%s unable to resolve rendezvous address",
|
||||
__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -493,10 +488,10 @@ void DynamicLoaderHexagonDYLD::LoadAllCurrentModules() {
|
|||
module_list.Append(module_sp);
|
||||
} else {
|
||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderHexagonDYLD::%s failed loading module %s at "
|
||||
"0x%" PRIx64,
|
||||
__FUNCTION__, module_path, I->base_addr);
|
||||
LLDB_LOGF(log,
|
||||
"DynamicLoaderHexagonDYLD::%s failed loading module %s at "
|
||||
"0x%" PRIx64,
|
||||
__FUNCTION__, module_path, I->base_addr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -604,12 +599,11 @@ DynamicLoaderHexagonDYLD::GetThreadLocalData(const lldb::ModuleSP module,
|
|||
|
||||
Module *mod = module.get();
|
||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderHexagonDYLD::Performed TLS lookup: "
|
||||
"module=%s, link_map=0x%" PRIx64 ", tp=0x%" PRIx64
|
||||
", modid=%i, tls_block=0x%" PRIx64,
|
||||
mod->GetObjectName().AsCString(""), link_map, tp, modid,
|
||||
tls_block);
|
||||
LLDB_LOGF(log,
|
||||
"DynamicLoaderHexagonDYLD::Performed TLS lookup: "
|
||||
"module=%s, link_map=0x%" PRIx64 ", tp=0x%" PRIx64
|
||||
", modid=%i, tls_block=0x%" PRIx64,
|
||||
mod->GetObjectName().AsCString(""), link_map, tp, modid, tls_block);
|
||||
|
||||
if (tls_block == LLDB_INVALID_ADDRESS)
|
||||
return LLDB_INVALID_ADDRESS;
|
||||
|
|
|
|||
|
|
@ -339,16 +339,16 @@ void HexagonDYLDRendezvous::DumpToLog(Log *log) const {
|
|||
return;
|
||||
|
||||
log->PutCString("HexagonDYLDRendezvous:");
|
||||
log->Printf(" Address: %" PRIx64, GetRendezvousAddress());
|
||||
log->Printf(" Version: %" PRIu64, GetVersion());
|
||||
log->Printf(" Link : %" PRIx64, GetLinkMapAddress());
|
||||
log->Printf(" Break : %" PRIx64, GetBreakAddress());
|
||||
log->Printf(" LDBase : %" PRIx64, GetLDBase());
|
||||
log->Printf(" State : %s",
|
||||
(state == eConsistent)
|
||||
? "consistent"
|
||||
: (state == eAdd) ? "add" : (state == eDelete) ? "delete"
|
||||
: "unknown");
|
||||
LLDB_LOGF(log, " Address: %" PRIx64, GetRendezvousAddress());
|
||||
LLDB_LOGF(log, " Version: %" PRIu64, GetVersion());
|
||||
LLDB_LOGF(log, " Link : %" PRIx64, GetLinkMapAddress());
|
||||
LLDB_LOGF(log, " Break : %" PRIx64, GetBreakAddress());
|
||||
LLDB_LOGF(log, " LDBase : %" PRIx64, GetLDBase());
|
||||
LLDB_LOGF(log, " State : %s",
|
||||
(state == eConsistent)
|
||||
? "consistent"
|
||||
: (state == eAdd) ? "add"
|
||||
: (state == eDelete) ? "delete" : "unknown");
|
||||
|
||||
iterator I = begin();
|
||||
iterator E = end();
|
||||
|
|
@ -357,11 +357,11 @@ void HexagonDYLDRendezvous::DumpToLog(Log *log) const {
|
|||
log->PutCString("HexagonDYLDRendezvous SOEntries:");
|
||||
|
||||
for (int i = 1; I != E; ++I, ++i) {
|
||||
log->Printf("\n SOEntry [%d] %s", i, I->path.c_str());
|
||||
log->Printf(" Base : %" PRIx64, I->base_addr);
|
||||
log->Printf(" Path : %" PRIx64, I->path_addr);
|
||||
log->Printf(" Dyn : %" PRIx64, I->dyn_addr);
|
||||
log->Printf(" Next : %" PRIx64, I->next);
|
||||
log->Printf(" Prev : %" PRIx64, I->prev);
|
||||
LLDB_LOGF(log, "\n SOEntry [%d] %s", i, I->path.c_str());
|
||||
LLDB_LOGF(log, " Base : %" PRIx64, I->base_addr);
|
||||
LLDB_LOGF(log, " Path : %" PRIx64, I->path_addr);
|
||||
LLDB_LOGF(log, " Dyn : %" PRIx64, I->dyn_addr);
|
||||
LLDB_LOGF(log, " Next : %" PRIx64, I->next);
|
||||
LLDB_LOGF(log, " Prev : %" PRIx64, I->prev);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,9 +135,8 @@ void DynamicLoaderDarwin::UnloadImages(
|
|||
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||
Target &target = m_process->GetTarget();
|
||||
if (log)
|
||||
log->Printf("Removing %" PRId64 " modules.",
|
||||
(uint64_t)solib_addresses.size());
|
||||
LLDB_LOGF(log, "Removing %" PRId64 " modules.",
|
||||
(uint64_t)solib_addresses.size());
|
||||
|
||||
ModuleList unloaded_module_list;
|
||||
|
||||
|
|
@ -147,8 +146,7 @@ void DynamicLoaderDarwin::UnloadImages(
|
|||
if (header.GetOffset() == 0) {
|
||||
ModuleSP module_to_remove(header.GetModule());
|
||||
if (module_to_remove.get()) {
|
||||
if (log)
|
||||
log->Printf("Removing module at address 0x%" PRIx64, solib_addr);
|
||||
LLDB_LOGF(log, "Removing module at address 0x%" PRIx64, solib_addr);
|
||||
// remove the sections from the Target
|
||||
UnloadSections(module_to_remove);
|
||||
// add this to the list of modules to remove
|
||||
|
|
@ -537,9 +535,8 @@ void DynamicLoaderDarwin::UpdateSpecialBinariesFromNewImageInfos(
|
|||
ModuleSP exe_module_sp(FindTargetModuleForImageInfo(image_infos[exe_idx],
|
||||
can_create, nullptr));
|
||||
if (exe_module_sp) {
|
||||
if (log)
|
||||
log->Printf("Found executable module: %s",
|
||||
exe_module_sp->GetFileSpec().GetPath().c_str());
|
||||
LLDB_LOGF(log, "Found executable module: %s",
|
||||
exe_module_sp->GetFileSpec().GetPath().c_str());
|
||||
target.GetImages().AppendIfNeeded(exe_module_sp);
|
||||
UpdateImageLoadAddress(exe_module_sp.get(), image_infos[exe_idx]);
|
||||
if (exe_module_sp.get() != target.GetExecutableModulePointer()) {
|
||||
|
|
@ -553,9 +550,8 @@ void DynamicLoaderDarwin::UpdateSpecialBinariesFromNewImageInfos(
|
|||
ModuleSP dyld_sp = FindTargetModuleForImageInfo(image_infos[dyld_idx],
|
||||
can_create, nullptr);
|
||||
if (dyld_sp.get()) {
|
||||
if (log)
|
||||
log->Printf("Found dyld module: %s",
|
||||
dyld_sp->GetFileSpec().GetPath().c_str());
|
||||
LLDB_LOGF(log, "Found dyld module: %s",
|
||||
dyld_sp->GetFileSpec().GetPath().c_str());
|
||||
target.GetImages().AppendIfNeeded(dyld_sp);
|
||||
UpdateImageLoadAddress(dyld_sp.get(), image_infos[dyld_idx]);
|
||||
SetDYLDModule(dyld_sp);
|
||||
|
|
@ -598,8 +594,8 @@ bool DynamicLoaderDarwin::AddModulesUsingImageInfos(
|
|||
|
||||
for (uint32_t idx = 0; idx < image_infos.size(); ++idx) {
|
||||
if (log) {
|
||||
log->Printf("Adding new image at address=0x%16.16" PRIx64 ".",
|
||||
image_infos[idx].address);
|
||||
LLDB_LOGF(log, "Adding new image at address=0x%16.16" PRIx64 ".",
|
||||
image_infos[idx].address);
|
||||
image_infos[idx].PutToLog(log);
|
||||
}
|
||||
|
||||
|
|
@ -704,13 +700,14 @@ void DynamicLoaderDarwin::Segment::PutToLog(Log *log,
|
|||
lldb::addr_t slide) const {
|
||||
if (log) {
|
||||
if (slide == 0)
|
||||
log->Printf("\t\t%16s [0x%16.16" PRIx64 " - 0x%16.16" PRIx64 ")",
|
||||
name.AsCString(""), vmaddr + slide, vmaddr + slide + vmsize);
|
||||
LLDB_LOGF(log, "\t\t%16s [0x%16.16" PRIx64 " - 0x%16.16" PRIx64 ")",
|
||||
name.AsCString(""), vmaddr + slide, vmaddr + slide + vmsize);
|
||||
else
|
||||
log->Printf("\t\t%16s [0x%16.16" PRIx64 " - 0x%16.16" PRIx64
|
||||
") slide = 0x%" PRIx64,
|
||||
name.AsCString(""), vmaddr + slide, vmaddr + slide + vmsize,
|
||||
slide);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -820,9 +817,9 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread &thread,
|
|||
addr_t load_addr =
|
||||
addr_range.GetBaseAddress().GetLoadAddress(target_sp.get());
|
||||
|
||||
log->Printf("Found a trampoline target symbol at 0x%" PRIx64
|
||||
".",
|
||||
load_addr);
|
||||
LLDB_LOGF(log,
|
||||
"Found a trampoline target symbol at 0x%" PRIx64 ".",
|
||||
load_addr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -847,7 +844,8 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread &thread,
|
|||
if (log) {
|
||||
lldb::addr_t load_addr =
|
||||
actual_symbol_addr.GetLoadAddress(target_sp.get());
|
||||
log->Printf(
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"Found a re-exported symbol: %s at 0x%" PRIx64 ".",
|
||||
actual_symbol->GetName().GetCString(), load_addr);
|
||||
}
|
||||
|
|
@ -874,8 +872,9 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread &thread,
|
|||
addr_t load_addr =
|
||||
addr_range.GetBaseAddress().GetLoadAddress(target_sp.get());
|
||||
|
||||
log->Printf("Found an indirect target symbol at 0x%" PRIx64 ".",
|
||||
load_addr);
|
||||
LLDB_LOGF(log,
|
||||
"Found an indirect target symbol at 0x%" PRIx64 ".",
|
||||
load_addr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -890,13 +889,13 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread &thread,
|
|||
if (actual_symbol) {
|
||||
Address target_addr(actual_symbol->GetAddress());
|
||||
if (target_addr.IsValid()) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"Found a re-exported symbol: %s pointing to: %s at 0x%" PRIx64
|
||||
".",
|
||||
current_symbol->GetName().GetCString(),
|
||||
actual_symbol->GetName().GetCString(),
|
||||
target_addr.GetLoadAddress(target_sp.get()));
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"Found a re-exported symbol: %s pointing to: %s at 0x%" PRIx64
|
||||
".",
|
||||
current_symbol->GetName().GetCString(),
|
||||
actual_symbol->GetName().GetCString(),
|
||||
target_addr.GetLoadAddress(target_sp.get()));
|
||||
addresses.push_back(target_addr.GetLoadAddress(target_sp.get()));
|
||||
}
|
||||
}
|
||||
|
|
@ -915,10 +914,10 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread &thread,
|
|||
&symbol_address, error);
|
||||
if (error.Success()) {
|
||||
load_addrs.push_back(resolved_addr);
|
||||
if (log)
|
||||
log->Printf("ResolveIndirectFunction found resolved target for "
|
||||
"%s at 0x%" PRIx64 ".",
|
||||
symbol->GetName().GetCString(), resolved_addr);
|
||||
LLDB_LOGF(log,
|
||||
"ResolveIndirectFunction found resolved target for "
|
||||
"%s at 0x%" PRIx64 ".",
|
||||
symbol->GetName().GetCString(), resolved_addr);
|
||||
}
|
||||
} else {
|
||||
load_addrs.push_back(address.GetLoadAddress(target_sp.get()));
|
||||
|
|
@ -928,8 +927,7 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread &thread,
|
|||
thread, load_addrs, stop_others);
|
||||
}
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("Could not find symbol for step through.");
|
||||
LLDB_LOGF(log, "Could not find symbol for step through.");
|
||||
}
|
||||
|
||||
return thread_plan_sp;
|
||||
|
|
@ -1109,11 +1107,11 @@ bool DynamicLoaderDarwin::UseDYLDSPI(Process *process) {
|
|||
|
||||
if (log) {
|
||||
if (use_new_spi_interface)
|
||||
log->Printf(
|
||||
"DynamicLoaderDarwin::UseDYLDSPI: Use new DynamicLoader plugin");
|
||||
LLDB_LOGF(
|
||||
log, "DynamicLoaderDarwin::UseDYLDSPI: Use new DynamicLoader plugin");
|
||||
else
|
||||
log->Printf(
|
||||
"DynamicLoaderDarwin::UseDYLDSPI: Use old DynamicLoader plugin");
|
||||
LLDB_LOGF(
|
||||
log, "DynamicLoaderDarwin::UseDYLDSPI: Use old DynamicLoader plugin");
|
||||
}
|
||||
return use_new_spi_interface;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,9 +173,8 @@ void DynamicLoaderMacOS::DoInitialImageFetch() {
|
|||
->GetAsArray()) {
|
||||
if (JSONImageInformationIntoImageInfo(all_image_info_json_sp,
|
||||
image_infos)) {
|
||||
if (log)
|
||||
log->Printf("Initial module fetch: Adding %" PRId64 " modules.\n",
|
||||
(uint64_t)image_infos.size());
|
||||
LLDB_LOGF(log, "Initial module fetch: Adding %" PRId64 " modules.\n",
|
||||
(uint64_t)image_infos.size());
|
||||
|
||||
UpdateSpecialBinariesFromNewImageInfos(image_infos);
|
||||
AddModulesUsingImageInfos(image_infos);
|
||||
|
|
@ -310,8 +309,8 @@ void DynamicLoaderMacOS::AddBinaries(
|
|||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||
ImageInfo::collection image_infos;
|
||||
|
||||
if (log)
|
||||
log->Printf("Adding %" PRId64 " modules.", (uint64_t)load_addresses.size());
|
||||
LLDB_LOGF(log, "Adding %" PRId64 " modules.",
|
||||
(uint64_t)load_addresses.size());
|
||||
StructuredData::ObjectSP binaries_info_sp =
|
||||
m_process->GetLoadedDynamicLibrariesInfos(load_addresses);
|
||||
if (binaries_info_sp.get() && binaries_info_sp->GetAsDictionary() &&
|
||||
|
|
|
|||
|
|
@ -525,8 +525,7 @@ bool DynamicLoaderMacOSXDYLD::AddModulesUsingImageInfosAddress(
|
|||
lldb::addr_t image_infos_addr, uint32_t image_infos_count) {
|
||||
ImageInfo::collection image_infos;
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||
if (log)
|
||||
log->Printf("Adding %d modules.\n", image_infos_count);
|
||||
LLDB_LOGF(log, "Adding %d modules.\n", image_infos_count);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> baseclass_guard(GetMutex());
|
||||
|
|
@ -581,14 +580,13 @@ bool DynamicLoaderMacOSXDYLD::RemoveModulesUsingImageInfosAddress(
|
|||
return false;
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("Removing %d modules.", image_infos_count);
|
||||
LLDB_LOGF(log, "Removing %d modules.", image_infos_count);
|
||||
|
||||
ModuleList unloaded_module_list;
|
||||
for (uint32_t idx = 0; idx < image_infos.size(); ++idx) {
|
||||
if (log) {
|
||||
log->Printf("Removing module at address=0x%16.16" PRIx64 ".",
|
||||
image_infos[idx].address);
|
||||
LLDB_LOGF(log, "Removing module at address=0x%16.16" PRIx64 ".",
|
||||
image_infos[idx].address);
|
||||
image_infos[idx].PutToLog(log);
|
||||
}
|
||||
|
||||
|
|
@ -617,7 +615,7 @@ bool DynamicLoaderMacOSXDYLD::RemoveModulesUsingImageInfosAddress(
|
|||
unloaded_module_list.AppendIfNeeded(unload_image_module_sp);
|
||||
} else {
|
||||
if (log) {
|
||||
log->Printf("Could not find module for unloading info entry:");
|
||||
LLDB_LOGF(log, "Could not find module for unloading info entry:");
|
||||
image_infos[idx].PutToLog(log);
|
||||
}
|
||||
}
|
||||
|
|
@ -631,7 +629,7 @@ bool DynamicLoaderMacOSXDYLD::RemoveModulesUsingImageInfosAddress(
|
|||
|
||||
if (pos == end) {
|
||||
if (log) {
|
||||
log->Printf("Could not find image_info entry for unloading image:");
|
||||
LLDB_LOGF(log, "Could not find image_info entry for unloading image:");
|
||||
image_infos[idx].PutToLog(log);
|
||||
}
|
||||
}
|
||||
|
|
@ -736,7 +734,7 @@ bool DynamicLoaderMacOSXDYLD::InitializeFromAllImageInfos() {
|
|||
if (log) {
|
||||
StreamString s;
|
||||
module_sp->GetDescription(&s);
|
||||
log->Printf("Unloading pre-run module: %s.", s.GetData());
|
||||
LLDB_LOGF(log, "Unloading pre-run module: %s.", s.GetData());
|
||||
}
|
||||
not_loaded_modules.Append(module_sp);
|
||||
}
|
||||
|
|
@ -975,12 +973,13 @@ void DynamicLoaderMacOSXDYLD::PutToLog(Log *log) const {
|
|||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
std::lock_guard<std::recursive_mutex> baseclass_guard(GetMutex());
|
||||
log->Printf(
|
||||
"dyld_all_image_infos = { version=%d, count=%d, addr=0x%8.8" PRIx64
|
||||
", notify=0x%8.8" PRIx64 " }",
|
||||
m_dyld_all_image_infos.version, m_dyld_all_image_infos.dylib_info_count,
|
||||
(uint64_t)m_dyld_all_image_infos.dylib_info_addr,
|
||||
(uint64_t)m_dyld_all_image_infos.notification);
|
||||
LLDB_LOGF(log,
|
||||
"dyld_all_image_infos = { version=%d, count=%d, addr=0x%8.8" PRIx64
|
||||
", notify=0x%8.8" PRIx64 " }",
|
||||
m_dyld_all_image_infos.version,
|
||||
m_dyld_all_image_infos.dylib_info_count,
|
||||
(uint64_t)m_dyld_all_image_infos.dylib_info_addr,
|
||||
(uint64_t)m_dyld_all_image_infos.notification);
|
||||
size_t i;
|
||||
const size_t count = m_dyld_image_infos.size();
|
||||
if (count > 0) {
|
||||
|
|
|
|||
|
|
@ -33,16 +33,14 @@ static addr_t ResolveRendezvousAddress(Process *process) {
|
|||
Status error;
|
||||
|
||||
if (!process) {
|
||||
if (log)
|
||||
log->Printf("%s null process provided", __FUNCTION__);
|
||||
LLDB_LOGF(log, "%s null process provided", __FUNCTION__);
|
||||
return LLDB_INVALID_ADDRESS;
|
||||
}
|
||||
|
||||
// Try to get it from our process. This might be a remote process and might
|
||||
// grab it via some remote-specific mechanism.
|
||||
info_location = process->GetImageInfoAddress();
|
||||
if (log)
|
||||
log->Printf("%s info_location = 0x%" PRIx64, __FUNCTION__, info_location);
|
||||
LLDB_LOGF(log, "%s info_location = 0x%" PRIx64, __FUNCTION__, info_location);
|
||||
|
||||
// If the process fails to return an address, fall back to seeing if the
|
||||
// local object file can help us find it.
|
||||
|
|
@ -54,42 +52,38 @@ static addr_t ResolveRendezvousAddress(Process *process) {
|
|||
|
||||
if (addr.IsValid()) {
|
||||
info_location = addr.GetLoadAddress(target);
|
||||
if (log)
|
||||
log->Printf(
|
||||
"%s resolved via direct object file approach to 0x%" PRIx64,
|
||||
__FUNCTION__, info_location);
|
||||
LLDB_LOGF(log,
|
||||
"%s resolved via direct object file approach to 0x%" PRIx64,
|
||||
__FUNCTION__, info_location);
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("%s FAILED - direct object file approach did not yield a "
|
||||
"valid address",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log,
|
||||
"%s FAILED - direct object file approach did not yield a "
|
||||
"valid address",
|
||||
__FUNCTION__);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (info_location == LLDB_INVALID_ADDRESS) {
|
||||
if (log)
|
||||
log->Printf("%s FAILED - invalid info address", __FUNCTION__);
|
||||
LLDB_LOGF(log, "%s FAILED - invalid info address", __FUNCTION__);
|
||||
return LLDB_INVALID_ADDRESS;
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("%s reading pointer (%" PRIu32 " bytes) from 0x%" PRIx64,
|
||||
__FUNCTION__, process->GetAddressByteSize(), info_location);
|
||||
LLDB_LOGF(log, "%s reading pointer (%" PRIu32 " bytes) from 0x%" PRIx64,
|
||||
__FUNCTION__, process->GetAddressByteSize(), info_location);
|
||||
|
||||
info_addr = process->ReadPointerFromMemory(info_location, error);
|
||||
if (error.Fail()) {
|
||||
if (log)
|
||||
log->Printf("%s FAILED - could not read from the info location: %s",
|
||||
__FUNCTION__, error.AsCString());
|
||||
LLDB_LOGF(log, "%s FAILED - could not read from the info location: %s",
|
||||
__FUNCTION__, error.AsCString());
|
||||
return LLDB_INVALID_ADDRESS;
|
||||
}
|
||||
|
||||
if (info_addr == 0) {
|
||||
if (log)
|
||||
log->Printf("%s FAILED - the rendezvous address contained at 0x%" PRIx64
|
||||
" returned a null value",
|
||||
__FUNCTION__, info_location);
|
||||
LLDB_LOGF(log,
|
||||
"%s FAILED - the rendezvous address contained at 0x%" PRIx64
|
||||
" returned a null value",
|
||||
__FUNCTION__, info_location);
|
||||
return LLDB_INVALID_ADDRESS;
|
||||
}
|
||||
|
||||
|
|
@ -109,14 +103,13 @@ DYLDRendezvous::DYLDRendezvous(Process *process)
|
|||
Module *exe_mod = m_process->GetTarget().GetExecutableModulePointer();
|
||||
if (exe_mod) {
|
||||
m_exe_file_spec = exe_mod->GetPlatformFileSpec();
|
||||
if (log)
|
||||
log->Printf("DYLDRendezvous::%s exe module executable path set: '%s'",
|
||||
__FUNCTION__, m_exe_file_spec.GetCString());
|
||||
LLDB_LOGF(log, "DYLDRendezvous::%s exe module executable path set: '%s'",
|
||||
__FUNCTION__, m_exe_file_spec.GetCString());
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("DYLDRendezvous::%s cannot cache exe module path: null "
|
||||
"executable module pointer",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log,
|
||||
"DYLDRendezvous::%s cannot cache exe module path: null "
|
||||
"executable module pointer",
|
||||
__FUNCTION__);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -133,17 +126,16 @@ bool DYLDRendezvous::Resolve() {
|
|||
|
||||
address_size = m_process->GetAddressByteSize();
|
||||
padding = address_size - word_size;
|
||||
if (log)
|
||||
log->Printf("DYLDRendezvous::%s address size: %" PRIu64
|
||||
", padding %" PRIu64,
|
||||
__FUNCTION__, uint64_t(address_size), uint64_t(padding));
|
||||
LLDB_LOGF(log,
|
||||
"DYLDRendezvous::%s address size: %" PRIu64 ", padding %" PRIu64,
|
||||
__FUNCTION__, uint64_t(address_size), uint64_t(padding));
|
||||
|
||||
if (m_rendezvous_addr == LLDB_INVALID_ADDRESS)
|
||||
cursor = info_addr = ResolveRendezvousAddress(m_process);
|
||||
else
|
||||
cursor = info_addr = m_rendezvous_addr;
|
||||
if (log)
|
||||
log->Printf("DYLDRendezvous::%s cursor = 0x%" PRIx64, __FUNCTION__, cursor);
|
||||
LLDB_LOGF(log, "DYLDRendezvous::%s cursor = 0x%" PRIx64, __FUNCTION__,
|
||||
cursor);
|
||||
|
||||
if (cursor == LLDB_INVALID_ADDRESS)
|
||||
return false;
|
||||
|
|
@ -569,16 +561,16 @@ void DYLDRendezvous::DumpToLog(Log *log) const {
|
|||
return;
|
||||
|
||||
log->PutCString("DYLDRendezvous:");
|
||||
log->Printf(" Address: %" PRIx64, GetRendezvousAddress());
|
||||
log->Printf(" Version: %" PRIu64, GetVersion());
|
||||
log->Printf(" Link : %" PRIx64, GetLinkMapAddress());
|
||||
log->Printf(" Break : %" PRIx64, GetBreakAddress());
|
||||
log->Printf(" LDBase : %" PRIx64, GetLDBase());
|
||||
log->Printf(" State : %s",
|
||||
(state == eConsistent)
|
||||
? "consistent"
|
||||
: (state == eAdd) ? "add" : (state == eDelete) ? "delete"
|
||||
: "unknown");
|
||||
LLDB_LOGF(log, " Address: %" PRIx64, GetRendezvousAddress());
|
||||
LLDB_LOGF(log, " Version: %" PRIu64, GetVersion());
|
||||
LLDB_LOGF(log, " Link : %" PRIx64, GetLinkMapAddress());
|
||||
LLDB_LOGF(log, " Break : %" PRIx64, GetBreakAddress());
|
||||
LLDB_LOGF(log, " LDBase : %" PRIx64, GetLDBase());
|
||||
LLDB_LOGF(log, " State : %s",
|
||||
(state == eConsistent)
|
||||
? "consistent"
|
||||
: (state == eAdd) ? "add"
|
||||
: (state == eDelete) ? "delete" : "unknown");
|
||||
|
||||
iterator I = begin();
|
||||
iterator E = end();
|
||||
|
|
@ -587,11 +579,11 @@ void DYLDRendezvous::DumpToLog(Log *log) const {
|
|||
log->PutCString("DYLDRendezvous SOEntries:");
|
||||
|
||||
for (int i = 1; I != E; ++I, ++i) {
|
||||
log->Printf("\n SOEntry [%d] %s", i, I->file_spec.GetCString());
|
||||
log->Printf(" Base : %" PRIx64, I->base_addr);
|
||||
log->Printf(" Path : %" PRIx64, I->path_addr);
|
||||
log->Printf(" Dyn : %" PRIx64, I->dyn_addr);
|
||||
log->Printf(" Next : %" PRIx64, I->next);
|
||||
log->Printf(" Prev : %" PRIx64, I->prev);
|
||||
LLDB_LOGF(log, "\n SOEntry [%d] %s", i, I->file_spec.GetCString());
|
||||
LLDB_LOGF(log, " Base : %" PRIx64, I->base_addr);
|
||||
LLDB_LOGF(log, " Path : %" PRIx64, I->path_addr);
|
||||
LLDB_LOGF(log, " Dyn : %" PRIx64, I->dyn_addr);
|
||||
LLDB_LOGF(log, " Next : %" PRIx64, I->next);
|
||||
LLDB_LOGF(log, " Prev : %" PRIx64, I->prev);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,15 +85,13 @@ DynamicLoaderPOSIXDYLD::~DynamicLoaderPOSIXDYLD() {
|
|||
|
||||
void DynamicLoaderPOSIXDYLD::DidAttach() {
|
||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderPOSIXDYLD::%s() pid %" PRIu64, __FUNCTION__,
|
||||
m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID);
|
||||
LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s() pid %" PRIu64, __FUNCTION__,
|
||||
m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID);
|
||||
m_auxv = llvm::make_unique<AuxVector>(m_process->GetAuxvData());
|
||||
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderPOSIXDYLD::%s pid %" PRIu64 " reloaded auxv data",
|
||||
__FUNCTION__,
|
||||
m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID);
|
||||
LLDB_LOGF(
|
||||
log, "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64 " reloaded auxv data",
|
||||
__FUNCTION__, m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID);
|
||||
|
||||
// ask the process if it can load any of its own modules
|
||||
m_process->LoadModules();
|
||||
|
|
@ -103,14 +101,14 @@ void DynamicLoaderPOSIXDYLD::DidAttach() {
|
|||
|
||||
// find the main process load offset
|
||||
addr_t load_offset = ComputeLoadOffset();
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
|
||||
" executable '%s', load_offset 0x%" PRIx64,
|
||||
__FUNCTION__,
|
||||
m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID,
|
||||
executable_sp ? executable_sp->GetFileSpec().GetPath().c_str()
|
||||
: "<null executable>",
|
||||
load_offset);
|
||||
LLDB_LOGF(log,
|
||||
"DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
|
||||
" executable '%s', load_offset 0x%" PRIx64,
|
||||
__FUNCTION__,
|
||||
m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID,
|
||||
executable_sp ? executable_sp->GetFileSpec().GetPath().c_str()
|
||||
: "<null executable>",
|
||||
load_offset);
|
||||
|
||||
EvalSpecialModulesStatus();
|
||||
|
||||
|
|
@ -137,12 +135,12 @@ void DynamicLoaderPOSIXDYLD::DidAttach() {
|
|||
ModuleList module_list;
|
||||
|
||||
module_list.Append(executable_sp);
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
|
||||
" added executable '%s' to module load list",
|
||||
__FUNCTION__,
|
||||
m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID,
|
||||
executable_sp->GetFileSpec().GetPath().c_str());
|
||||
LLDB_LOGF(log,
|
||||
"DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
|
||||
" added executable '%s' to module load list",
|
||||
__FUNCTION__,
|
||||
m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID,
|
||||
executable_sp->GetFileSpec().GetPath().c_str());
|
||||
|
||||
UpdateLoadedSections(executable_sp, LLDB_INVALID_ADDRESS, load_offset,
|
||||
true);
|
||||
|
|
@ -151,14 +149,15 @@ void DynamicLoaderPOSIXDYLD::DidAttach() {
|
|||
|
||||
m_process->GetTarget().ModulesDidLoad(module_list);
|
||||
if (log) {
|
||||
log->Printf("DynamicLoaderPOSIXDYLD::%s told the target about the "
|
||||
"modules that loaded:",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log,
|
||||
"DynamicLoaderPOSIXDYLD::%s told the target about the "
|
||||
"modules that loaded:",
|
||||
__FUNCTION__);
|
||||
for (auto module_sp : module_list.Modules()) {
|
||||
log->Printf("-- [module] %s (pid %" PRIu64 ")",
|
||||
module_sp ? module_sp->GetFileSpec().GetPath().c_str()
|
||||
: "<null>",
|
||||
m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID);
|
||||
LLDB_LOGF(log, "-- [module] %s (pid %" PRIu64 ")",
|
||||
module_sp ? module_sp->GetFileSpec().GetPath().c_str()
|
||||
: "<null>",
|
||||
m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -174,8 +173,7 @@ void DynamicLoaderPOSIXDYLD::DidAttach() {
|
|||
|
||||
void DynamicLoaderPOSIXDYLD::DidLaunch() {
|
||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderPOSIXDYLD::%s()", __FUNCTION__);
|
||||
LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s()", __FUNCTION__);
|
||||
|
||||
ModuleSP executable;
|
||||
addr_t load_offset;
|
||||
|
|
@ -191,9 +189,8 @@ void DynamicLoaderPOSIXDYLD::DidLaunch() {
|
|||
module_list.Append(executable);
|
||||
UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, load_offset, true);
|
||||
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderPOSIXDYLD::%s about to call ProbeEntry()",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s about to call ProbeEntry()",
|
||||
__FUNCTION__);
|
||||
|
||||
if (!SetRendezvousBreakpoint()) {
|
||||
// If we cannot establish rendezvous breakpoint right now we'll try again
|
||||
|
|
@ -227,22 +224,20 @@ void DynamicLoaderPOSIXDYLD::ProbeEntry() {
|
|||
|
||||
const addr_t entry = GetEntryPoint();
|
||||
if (entry == LLDB_INVALID_ADDRESS) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
|
||||
" GetEntryPoint() returned no address, not setting entry breakpoint",
|
||||
__FUNCTION__,
|
||||
m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID);
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
|
||||
" GetEntryPoint() returned no address, not setting entry breakpoint",
|
||||
__FUNCTION__, m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID);
|
||||
return;
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
|
||||
" GetEntryPoint() returned address 0x%" PRIx64
|
||||
", setting entry breakpoint",
|
||||
__FUNCTION__,
|
||||
m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID,
|
||||
entry);
|
||||
LLDB_LOGF(log,
|
||||
"DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
|
||||
" GetEntryPoint() returned address 0x%" PRIx64
|
||||
", setting entry breakpoint",
|
||||
__FUNCTION__,
|
||||
m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID, entry);
|
||||
|
||||
if (m_process) {
|
||||
Breakpoint *const entry_break =
|
||||
|
|
@ -271,11 +266,10 @@ bool DynamicLoaderPOSIXDYLD::EntryBreakpointHit(
|
|||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||
DynamicLoaderPOSIXDYLD *const dyld_instance =
|
||||
static_cast<DynamicLoaderPOSIXDYLD *>(baton);
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderPOSIXDYLD::%s called for pid %" PRIu64,
|
||||
__FUNCTION__,
|
||||
dyld_instance->m_process ? dyld_instance->m_process->GetID()
|
||||
: LLDB_INVALID_PROCESS_ID);
|
||||
LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s called for pid %" PRIu64,
|
||||
__FUNCTION__,
|
||||
dyld_instance->m_process ? dyld_instance->m_process->GetID()
|
||||
: LLDB_INVALID_PROCESS_ID);
|
||||
|
||||
// Disable the breakpoint --- if a stop happens right after this, which we've
|
||||
// seen on occasion, we don't want the breakpoint stepping thread-plan logic
|
||||
|
|
@ -287,22 +281,22 @@ bool DynamicLoaderPOSIXDYLD::EntryBreakpointHit(
|
|||
BreakpointSP breakpoint_sp =
|
||||
dyld_instance->m_process->GetTarget().GetBreakpointByID(break_id);
|
||||
if (breakpoint_sp) {
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
|
||||
" disabling breakpoint id %" PRIu64,
|
||||
__FUNCTION__, dyld_instance->m_process->GetID(), break_id);
|
||||
LLDB_LOGF(log,
|
||||
"DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
|
||||
" disabling breakpoint id %" PRIu64,
|
||||
__FUNCTION__, dyld_instance->m_process->GetID(), break_id);
|
||||
breakpoint_sp->SetEnabled(false);
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
|
||||
" failed to find breakpoint for breakpoint id %" PRIu64,
|
||||
__FUNCTION__, dyld_instance->m_process->GetID(), break_id);
|
||||
LLDB_LOGF(log,
|
||||
"DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
|
||||
" failed to find breakpoint for breakpoint id %" PRIu64,
|
||||
__FUNCTION__, dyld_instance->m_process->GetID(), break_id);
|
||||
}
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderPOSIXDYLD::%s breakpoint id %" PRIu64
|
||||
" no Process instance! Cannot disable breakpoint",
|
||||
__FUNCTION__, break_id);
|
||||
LLDB_LOGF(log,
|
||||
"DynamicLoaderPOSIXDYLD::%s breakpoint id %" PRIu64
|
||||
" no Process instance! Cannot disable breakpoint",
|
||||
__FUNCTION__, break_id);
|
||||
}
|
||||
|
||||
dyld_instance->LoadAllCurrentModules();
|
||||
|
|
@ -393,23 +387,22 @@ bool DynamicLoaderPOSIXDYLD::RendezvousBreakpointHit(
|
|||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||
DynamicLoaderPOSIXDYLD *const dyld_instance =
|
||||
static_cast<DynamicLoaderPOSIXDYLD *>(baton);
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderPOSIXDYLD::%s called for pid %" PRIu64,
|
||||
__FUNCTION__,
|
||||
dyld_instance->m_process ? dyld_instance->m_process->GetID()
|
||||
: LLDB_INVALID_PROCESS_ID);
|
||||
LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s called for pid %" PRIu64,
|
||||
__FUNCTION__,
|
||||
dyld_instance->m_process ? dyld_instance->m_process->GetID()
|
||||
: LLDB_INVALID_PROCESS_ID);
|
||||
|
||||
dyld_instance->RefreshModules();
|
||||
|
||||
// Return true to stop the target, false to just let the target run.
|
||||
const bool stop_when_images_change = dyld_instance->GetStopWhenImagesChange();
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
|
||||
" stop_when_images_change=%s",
|
||||
__FUNCTION__,
|
||||
dyld_instance->m_process ? dyld_instance->m_process->GetID()
|
||||
: LLDB_INVALID_PROCESS_ID,
|
||||
stop_when_images_change ? "true" : "false");
|
||||
LLDB_LOGF(log,
|
||||
"DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
|
||||
" stop_when_images_change=%s",
|
||||
__FUNCTION__,
|
||||
dyld_instance->m_process ? dyld_instance->m_process->GetID()
|
||||
: LLDB_INVALID_PROCESS_ID,
|
||||
stop_when_images_change ? "true" : "false");
|
||||
return stop_when_images_change;
|
||||
}
|
||||
|
||||
|
|
@ -562,10 +555,10 @@ void DynamicLoaderPOSIXDYLD::LoadAllCurrentModules() {
|
|||
LoadVDSO();
|
||||
|
||||
if (!m_rendezvous.Resolve()) {
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderPOSIXDYLD::%s unable to resolve POSIX DYLD "
|
||||
"rendezvous address",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log,
|
||||
"DynamicLoaderPOSIXDYLD::%s unable to resolve POSIX DYLD "
|
||||
"rendezvous address",
|
||||
__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -589,10 +582,10 @@ void DynamicLoaderPOSIXDYLD::LoadAllCurrentModules() {
|
|||
module_list.Append(module_sp);
|
||||
} else {
|
||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||
if (log)
|
||||
log->Printf(
|
||||
"DynamicLoaderPOSIXDYLD::%s failed loading module %s at 0x%" PRIx64,
|
||||
__FUNCTION__, I->file_spec.GetCString(), I->base_addr);
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"DynamicLoaderPOSIXDYLD::%s failed loading module %s at 0x%" PRIx64,
|
||||
__FUNCTION__, I->file_spec.GetCString(), I->base_addr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -697,12 +690,12 @@ DynamicLoaderPOSIXDYLD::GetThreadLocalData(const lldb::ModuleSP module_sp,
|
|||
addr_t tls_block = ReadPointer(dtv_slot + metadata.tls_offset);
|
||||
|
||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderPOSIXDYLD::Performed TLS lookup: "
|
||||
"module=%s, link_map=0x%" PRIx64 ", tp=0x%" PRIx64
|
||||
", modid=%" PRId64 ", tls_block=0x%" PRIx64 "\n",
|
||||
module_sp->GetObjectName().AsCString(""), link_map, tp,
|
||||
(int64_t)modid, tls_block);
|
||||
LLDB_LOGF(log,
|
||||
"DynamicLoaderPOSIXDYLD::Performed TLS lookup: "
|
||||
"module=%s, link_map=0x%" PRIx64 ", tp=0x%" PRIx64
|
||||
", modid=%" PRId64 ", tls_block=0x%" PRIx64 "\n",
|
||||
module_sp->GetObjectName().AsCString(""), link_map, tp,
|
||||
(int64_t)modid, tls_block);
|
||||
|
||||
if (tls_block == LLDB_INVALID_ADDRESS)
|
||||
return LLDB_INVALID_ADDRESS;
|
||||
|
|
@ -722,18 +715,17 @@ void DynamicLoaderPOSIXDYLD::ResolveExecutableModule(
|
|||
|
||||
ProcessInstanceInfo process_info;
|
||||
if (!m_process->GetProcessInfo(process_info)) {
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderPOSIXDYLD::%s - failed to get process info for "
|
||||
"pid %" PRIu64,
|
||||
__FUNCTION__, m_process->GetID());
|
||||
LLDB_LOGF(log,
|
||||
"DynamicLoaderPOSIXDYLD::%s - failed to get process info for "
|
||||
"pid %" PRIu64,
|
||||
__FUNCTION__, m_process->GetID());
|
||||
return;
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderPOSIXDYLD::%s - got executable by pid %" PRIu64
|
||||
": %s",
|
||||
__FUNCTION__, m_process->GetID(),
|
||||
process_info.GetExecutableFile().GetPath().c_str());
|
||||
LLDB_LOGF(
|
||||
log, "DynamicLoaderPOSIXDYLD::%s - got executable by pid %" PRIu64 ": %s",
|
||||
__FUNCTION__, m_process->GetID(),
|
||||
process_info.GetExecutableFile().GetPath().c_str());
|
||||
|
||||
ModuleSpec module_spec(process_info.GetExecutableFile(),
|
||||
process_info.GetArchitecture());
|
||||
|
|
@ -748,10 +740,10 @@ void DynamicLoaderPOSIXDYLD::ResolveExecutableModule(
|
|||
StreamString stream;
|
||||
module_spec.Dump(stream);
|
||||
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderPOSIXDYLD::%s - failed to resolve executable "
|
||||
"with module spec \"%s\": %s",
|
||||
__FUNCTION__, stream.GetData(), error.AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"DynamicLoaderPOSIXDYLD::%s - failed to resolve executable "
|
||||
"with module spec \"%s\": %s",
|
||||
__FUNCTION__, stream.GetData(), error.AsCString());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -122,38 +122,36 @@ lldb::addr_t DynamicLoaderWindowsDYLD::GetLoadAddress(ModuleSP executable) {
|
|||
|
||||
void DynamicLoaderWindowsDYLD::DidAttach() {
|
||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
|
||||
LLDB_LOGF(log, "DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
|
||||
|
||||
ModuleSP executable = GetTargetExecutable();
|
||||
ModuleSP executable = GetTargetExecutable();
|
||||
|
||||
if (!executable.get())
|
||||
return;
|
||||
if (!executable.get())
|
||||
return;
|
||||
|
||||
// Try to fetch the load address of the file from the process, since there
|
||||
// could be randomization of the load address.
|
||||
lldb::addr_t load_addr = GetLoadAddress(executable);
|
||||
if (load_addr == LLDB_INVALID_ADDRESS)
|
||||
return;
|
||||
// Try to fetch the load address of the file from the process, since there
|
||||
// could be randomization of the load address.
|
||||
lldb::addr_t load_addr = GetLoadAddress(executable);
|
||||
if (load_addr == LLDB_INVALID_ADDRESS)
|
||||
return;
|
||||
|
||||
// Request the process base address.
|
||||
lldb::addr_t image_base = m_process->GetImageInfoAddress();
|
||||
if (image_base == load_addr)
|
||||
return;
|
||||
// Request the process base address.
|
||||
lldb::addr_t image_base = m_process->GetImageInfoAddress();
|
||||
if (image_base == load_addr)
|
||||
return;
|
||||
|
||||
// Rebase the process's modules if there is a mismatch.
|
||||
UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, load_addr, false);
|
||||
// Rebase the process's modules if there is a mismatch.
|
||||
UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, load_addr, false);
|
||||
|
||||
ModuleList module_list;
|
||||
module_list.Append(executable);
|
||||
m_process->GetTarget().ModulesDidLoad(module_list);
|
||||
m_process->LoadModules();
|
||||
ModuleList module_list;
|
||||
module_list.Append(executable);
|
||||
m_process->GetTarget().ModulesDidLoad(module_list);
|
||||
m_process->LoadModules();
|
||||
}
|
||||
|
||||
void DynamicLoaderWindowsDYLD::DidLaunch() {
|
||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||
if (log)
|
||||
log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
|
||||
LLDB_LOGF(log, "DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
|
||||
|
||||
ModuleSP executable = GetTargetExecutable();
|
||||
if (!executable.get())
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ void ASTDumper::ToLog(Log *log, const char *prefix) {
|
|||
while (end) {
|
||||
*end = '\0';
|
||||
|
||||
log->Printf("%s%s", prefix, str);
|
||||
LLDB_LOGF(log, "%s%s", prefix, str);
|
||||
|
||||
*end = '\n';
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ void ASTDumper::ToLog(Log *log, const char *prefix) {
|
|||
end = strchr(str, '\n');
|
||||
}
|
||||
|
||||
log->Printf("%s%s", prefix, str);
|
||||
LLDB_LOGF(log, "%s%s", prefix, str);
|
||||
|
||||
free(alloc);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,13 +58,13 @@ void ASTResultSynthesizer::TransformTopLevelDecl(Decl *D) {
|
|||
if (NamedDecl *named_decl = dyn_cast<NamedDecl>(D)) {
|
||||
if (log && log->GetVerbose()) {
|
||||
if (named_decl->getIdentifier())
|
||||
log->Printf("TransformTopLevelDecl(%s)",
|
||||
named_decl->getIdentifier()->getNameStart());
|
||||
LLDB_LOGF(log, "TransformTopLevelDecl(%s)",
|
||||
named_decl->getIdentifier()->getNameStart());
|
||||
else if (ObjCMethodDecl *method_decl = dyn_cast<ObjCMethodDecl>(D))
|
||||
log->Printf("TransformTopLevelDecl(%s)",
|
||||
method_decl->getSelector().getAsString().c_str());
|
||||
LLDB_LOGF(log, "TransformTopLevelDecl(%s)",
|
||||
method_decl->getSelector().getAsString().c_str());
|
||||
else
|
||||
log->Printf("TransformTopLevelDecl(<complex>)");
|
||||
LLDB_LOGF(log, "TransformTopLevelDecl(<complex>)");
|
||||
}
|
||||
|
||||
if (m_top_level) {
|
||||
|
|
@ -130,7 +130,7 @@ bool ASTResultSynthesizer::SynthesizeFunctionResult(FunctionDecl *FunDecl) {
|
|||
|
||||
os.flush();
|
||||
|
||||
log->Printf("Untransformed function AST:\n%s", s.c_str());
|
||||
LLDB_LOGF(log, "Untransformed function AST:\n%s", s.c_str());
|
||||
}
|
||||
|
||||
Stmt *function_body = function_decl->getBody();
|
||||
|
|
@ -146,7 +146,7 @@ bool ASTResultSynthesizer::SynthesizeFunctionResult(FunctionDecl *FunDecl) {
|
|||
|
||||
os.flush();
|
||||
|
||||
log->Printf("Transformed function AST:\n%s", s.c_str());
|
||||
LLDB_LOGF(log, "Transformed function AST:\n%s", s.c_str());
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -170,7 +170,7 @@ bool ASTResultSynthesizer::SynthesizeObjCMethodResult(
|
|||
|
||||
os.flush();
|
||||
|
||||
log->Printf("Untransformed method AST:\n%s", s.c_str());
|
||||
LLDB_LOGF(log, "Untransformed method AST:\n%s", s.c_str());
|
||||
}
|
||||
|
||||
Stmt *method_body = MethodDecl->getBody();
|
||||
|
|
@ -190,7 +190,7 @@ bool ASTResultSynthesizer::SynthesizeObjCMethodResult(
|
|||
|
||||
os.flush();
|
||||
|
||||
log->Printf("Transformed method AST:\n%s", s.c_str());
|
||||
LLDB_LOGF(log, "Transformed method AST:\n%s", s.c_str());
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -308,8 +308,8 @@ bool ASTResultSynthesizer::SynthesizeBodyResult(CompoundStmt *Body,
|
|||
if (log) {
|
||||
std::string s = expr_qual_type.getAsString();
|
||||
|
||||
log->Printf("Last statement is an %s with type: %s",
|
||||
(is_lvalue ? "lvalue" : "rvalue"), s.c_str());
|
||||
LLDB_LOGF(log, "Last statement is an %s with type: %s",
|
||||
(is_lvalue ? "lvalue" : "rvalue"), s.c_str());
|
||||
}
|
||||
|
||||
clang::VarDecl *result_decl = nullptr;
|
||||
|
|
@ -422,8 +422,7 @@ void ASTResultSynthesizer::MaybeRecordPersistentType(TypeDecl *D) {
|
|||
|
||||
ConstString name_cs(name.str().c_str());
|
||||
|
||||
if (log)
|
||||
log->Printf("Recording persistent type %s\n", name_cs.GetCString());
|
||||
LLDB_LOGF(log, "Recording persistent type %s\n", name_cs.GetCString());
|
||||
|
||||
m_decls.push_back(D);
|
||||
}
|
||||
|
|
@ -443,8 +442,7 @@ void ASTResultSynthesizer::RecordPersistentDecl(NamedDecl *D) {
|
|||
|
||||
ConstString name_cs(name.str().c_str());
|
||||
|
||||
if (log)
|
||||
log->Printf("Recording persistent decl %s\n", name_cs.GetCString());
|
||||
LLDB_LOGF(log, "Recording persistent decl %s\n", name_cs.GetCString());
|
||||
|
||||
m_decls.push_back(D);
|
||||
}
|
||||
|
|
@ -467,7 +465,7 @@ void ASTResultSynthesizer::CommitPersistentDecls() {
|
|||
decl->dump(ss);
|
||||
ss.flush();
|
||||
|
||||
log->Printf("Couldn't commit persistent decl: %s\n", s.c_str());
|
||||
LLDB_LOGF(log, "Couldn't commit persistent decl: %s\n", s.c_str());
|
||||
}
|
||||
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -273,13 +273,13 @@ void ClangASTSource::CompleteType(TagDecl *tag_decl) {
|
|||
unsigned int current_id = invocation_id++;
|
||||
|
||||
if (log) {
|
||||
log->Printf(" CompleteTagDecl[%u] on (ASTContext*)%p Completing "
|
||||
"(TagDecl*)%p named %s",
|
||||
current_id, static_cast<void *>(m_ast_context),
|
||||
static_cast<void *>(tag_decl),
|
||||
tag_decl->getName().str().c_str());
|
||||
LLDB_LOGF(log,
|
||||
" CompleteTagDecl[%u] on (ASTContext*)%p Completing "
|
||||
"(TagDecl*)%p named %s",
|
||||
current_id, static_cast<void *>(m_ast_context),
|
||||
static_cast<void *>(tag_decl), tag_decl->getName().str().c_str());
|
||||
|
||||
log->Printf(" CTD[%u] Before:", current_id);
|
||||
LLDB_LOGF(log, " CTD[%u] Before:", current_id);
|
||||
ASTDumper dumper((Decl *)tag_decl);
|
||||
dumper.ToLog(log, " [CTD] ");
|
||||
}
|
||||
|
|
@ -301,10 +301,10 @@ void ClangASTSource::CompleteType(TagDecl *tag_decl) {
|
|||
// We couldn't complete the type. Maybe there's a definition somewhere
|
||||
// else that can be completed.
|
||||
|
||||
if (log)
|
||||
log->Printf(" CTD[%u] Type could not be completed in the module in "
|
||||
"which it was first found.",
|
||||
current_id);
|
||||
LLDB_LOGF(log,
|
||||
" CTD[%u] Type could not be completed in the module in "
|
||||
"which it was first found.",
|
||||
current_id);
|
||||
|
||||
bool found = false;
|
||||
|
||||
|
|
@ -316,9 +316,9 @@ void ClangASTSource::CompleteType(TagDecl *tag_decl) {
|
|||
m_ast_importer_sp->GetNamespaceMap(namespace_context);
|
||||
|
||||
if (log && log->GetVerbose())
|
||||
log->Printf(" CTD[%u] Inspecting namespace map %p (%d entries)",
|
||||
current_id, static_cast<void *>(namespace_map.get()),
|
||||
static_cast<int>(namespace_map->size()));
|
||||
LLDB_LOGF(log, " CTD[%u] Inspecting namespace map %p (%d entries)",
|
||||
current_id, static_cast<void *>(namespace_map.get()),
|
||||
static_cast<int>(namespace_map->size()));
|
||||
|
||||
if (!namespace_map)
|
||||
return;
|
||||
|
|
@ -326,10 +326,9 @@ void ClangASTSource::CompleteType(TagDecl *tag_decl) {
|
|||
for (ClangASTImporter::NamespaceMap::iterator i = namespace_map->begin(),
|
||||
e = namespace_map->end();
|
||||
i != e && !found; ++i) {
|
||||
if (log)
|
||||
log->Printf(" CTD[%u] Searching namespace %s in module %s",
|
||||
current_id, i->second.GetName().AsCString(),
|
||||
i->first->GetFileSpec().GetFilename().GetCString());
|
||||
LLDB_LOGF(log, " CTD[%u] Searching namespace %s in module %s",
|
||||
current_id, i->second.GetName().AsCString(),
|
||||
i->first->GetFileSpec().GetFilename().GetCString());
|
||||
|
||||
TypeList types;
|
||||
|
||||
|
|
@ -409,7 +408,7 @@ void ClangASTSource::CompleteType(TagDecl *tag_decl) {
|
|||
}
|
||||
|
||||
if (log) {
|
||||
log->Printf(" [CTD] After:");
|
||||
LLDB_LOGF(log, " [CTD] After:");
|
||||
ASTDumper dumper((Decl *)tag_decl);
|
||||
dumper.ToLog(log, " [CTD] ");
|
||||
}
|
||||
|
|
@ -419,11 +418,12 @@ void ClangASTSource::CompleteType(clang::ObjCInterfaceDecl *interface_decl) {
|
|||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
|
||||
|
||||
if (log) {
|
||||
log->Printf(" [CompleteObjCInterfaceDecl] on (ASTContext*)%p Completing "
|
||||
"an ObjCInterfaceDecl named %s",
|
||||
static_cast<void *>(m_ast_context),
|
||||
interface_decl->getName().str().c_str());
|
||||
log->Printf(" [COID] Before:");
|
||||
LLDB_LOGF(log,
|
||||
" [CompleteObjCInterfaceDecl] on (ASTContext*)%p Completing "
|
||||
"an ObjCInterfaceDecl named %s",
|
||||
static_cast<void *>(m_ast_context),
|
||||
interface_decl->getName().str().c_str());
|
||||
LLDB_LOGF(log, " [COID] Before:");
|
||||
ASTDumper dumper((Decl *)interface_decl);
|
||||
dumper.ToLog(log, " [COID] ");
|
||||
}
|
||||
|
|
@ -467,7 +467,7 @@ void ClangASTSource::CompleteType(clang::ObjCInterfaceDecl *interface_decl) {
|
|||
CompleteType(interface_decl->getSuperClass());
|
||||
|
||||
if (log) {
|
||||
log->Printf(" [COID] After:");
|
||||
LLDB_LOGF(log, " [COID] After:");
|
||||
ASTDumper dumper((Decl *)interface_decl);
|
||||
dumper.ToLog(log, " [COID] ");
|
||||
}
|
||||
|
|
@ -554,20 +554,22 @@ void ClangASTSource::FindExternalLexicalDecls(
|
|||
|
||||
if (log) {
|
||||
if (const NamedDecl *context_named_decl = dyn_cast<NamedDecl>(context_decl))
|
||||
log->Printf(
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"FindExternalLexicalDecls[%u] on (ASTContext*)%p in '%s' (%sDecl*)%p",
|
||||
current_id, static_cast<void *>(m_ast_context),
|
||||
context_named_decl->getNameAsString().c_str(),
|
||||
context_decl->getDeclKindName(),
|
||||
static_cast<const void *>(context_decl));
|
||||
else if (context_decl)
|
||||
log->Printf(
|
||||
"FindExternalLexicalDecls[%u] on (ASTContext*)%p in (%sDecl*)%p",
|
||||
LLDB_LOGF(
|
||||
log, "FindExternalLexicalDecls[%u] on (ASTContext*)%p in (%sDecl*)%p",
|
||||
current_id, static_cast<void *>(m_ast_context),
|
||||
context_decl->getDeclKindName(),
|
||||
static_cast<const void *>(context_decl));
|
||||
else
|
||||
log->Printf(
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"FindExternalLexicalDecls[%u] on (ASTContext*)%p in a NULL context",
|
||||
current_id, static_cast<const void *>(m_ast_context));
|
||||
}
|
||||
|
|
@ -580,9 +582,9 @@ void ClangASTSource::FindExternalLexicalDecls(
|
|||
return;
|
||||
|
||||
if (log) {
|
||||
log->Printf(" FELD[%u] Original decl (ASTContext*)%p (Decl*)%p:",
|
||||
current_id, static_cast<void *>(original_ctx),
|
||||
static_cast<void *>(original_decl));
|
||||
LLDB_LOGF(
|
||||
log, " FELD[%u] Original decl (ASTContext*)%p (Decl*)%p:", current_id,
|
||||
static_cast<void *>(original_ctx), static_cast<void *>(original_decl));
|
||||
ASTDumper(original_decl).ToLog(log, " ");
|
||||
}
|
||||
|
||||
|
|
@ -626,13 +628,13 @@ void ClangASTSource::FindExternalLexicalDecls(
|
|||
ASTDumper ast_dumper(decl);
|
||||
if (const NamedDecl *context_named_decl =
|
||||
dyn_cast<NamedDecl>(context_decl))
|
||||
log->Printf(" FELD[%d] Adding [to %sDecl %s] lexical %sDecl %s",
|
||||
current_id, context_named_decl->getDeclKindName(),
|
||||
context_named_decl->getNameAsString().c_str(),
|
||||
decl->getDeclKindName(), ast_dumper.GetCString());
|
||||
LLDB_LOGF(log, " FELD[%d] Adding [to %sDecl %s] lexical %sDecl %s",
|
||||
current_id, context_named_decl->getDeclKindName(),
|
||||
context_named_decl->getNameAsString().c_str(),
|
||||
decl->getDeclKindName(), ast_dumper.GetCString());
|
||||
else
|
||||
log->Printf(" FELD[%d] Adding lexical %sDecl %s", current_id,
|
||||
decl->getDeclKindName(), ast_dumper.GetCString());
|
||||
LLDB_LOGF(log, " FELD[%d] Adding lexical %sDecl %s", current_id,
|
||||
decl->getDeclKindName(), ast_dumper.GetCString());
|
||||
}
|
||||
|
||||
Decl *copied_decl = CopyDecl(decl);
|
||||
|
|
@ -678,22 +680,25 @@ void ClangASTSource::FindExternalVisibleDecls(NameSearchContext &context) {
|
|||
|
||||
if (log) {
|
||||
if (!context.m_decl_context)
|
||||
log->Printf("ClangASTSource::FindExternalVisibleDecls[%u] on "
|
||||
"(ASTContext*)%p for '%s' in a NULL DeclContext",
|
||||
current_id, static_cast<void *>(m_ast_context),
|
||||
name.GetCString());
|
||||
LLDB_LOGF(log,
|
||||
"ClangASTSource::FindExternalVisibleDecls[%u] on "
|
||||
"(ASTContext*)%p for '%s' in a NULL DeclContext",
|
||||
current_id, static_cast<void *>(m_ast_context),
|
||||
name.GetCString());
|
||||
else if (const NamedDecl *context_named_decl =
|
||||
dyn_cast<NamedDecl>(context.m_decl_context))
|
||||
log->Printf("ClangASTSource::FindExternalVisibleDecls[%u] on "
|
||||
"(ASTContext*)%p for '%s' in '%s'",
|
||||
current_id, static_cast<void *>(m_ast_context),
|
||||
name.GetCString(),
|
||||
context_named_decl->getNameAsString().c_str());
|
||||
LLDB_LOGF(log,
|
||||
"ClangASTSource::FindExternalVisibleDecls[%u] on "
|
||||
"(ASTContext*)%p for '%s' in '%s'",
|
||||
current_id, static_cast<void *>(m_ast_context),
|
||||
name.GetCString(),
|
||||
context_named_decl->getNameAsString().c_str());
|
||||
else
|
||||
log->Printf("ClangASTSource::FindExternalVisibleDecls[%u] on "
|
||||
"(ASTContext*)%p for '%s' in a '%s'",
|
||||
current_id, static_cast<void *>(m_ast_context),
|
||||
name.GetCString(), context.m_decl_context->getDeclKindName());
|
||||
LLDB_LOGF(log,
|
||||
"ClangASTSource::FindExternalVisibleDecls[%u] on "
|
||||
"(ASTContext*)%p for '%s' in a '%s'",
|
||||
current_id, static_cast<void *>(m_ast_context),
|
||||
name.GetCString(), context.m_decl_context->getDeclKindName());
|
||||
}
|
||||
|
||||
if (HasMerger() && !isa<TranslationUnitDecl>(context.m_decl_context)
|
||||
|
|
@ -723,9 +728,9 @@ void ClangASTSource::FindExternalVisibleDecls(NameSearchContext &context) {
|
|||
m_ast_importer_sp->GetNamespaceMap(namespace_context) : nullptr;
|
||||
|
||||
if (log && log->GetVerbose())
|
||||
log->Printf(" CAS::FEVD[%u] Inspecting namespace map %p (%d entries)",
|
||||
current_id, static_cast<void *>(namespace_map.get()),
|
||||
static_cast<int>(namespace_map->size()));
|
||||
LLDB_LOGF(log, " CAS::FEVD[%u] Inspecting namespace map %p (%d entries)",
|
||||
current_id, static_cast<void *>(namespace_map.get()),
|
||||
static_cast<int>(namespace_map->size()));
|
||||
|
||||
if (!namespace_map)
|
||||
return;
|
||||
|
|
@ -733,10 +738,9 @@ void ClangASTSource::FindExternalVisibleDecls(NameSearchContext &context) {
|
|||
for (ClangASTImporter::NamespaceMap::iterator i = namespace_map->begin(),
|
||||
e = namespace_map->end();
|
||||
i != e; ++i) {
|
||||
if (log)
|
||||
log->Printf(" CAS::FEVD[%u] Searching namespace %s in module %s",
|
||||
current_id, i->second.GetName().AsCString(),
|
||||
i->first->GetFileSpec().GetFilename().GetCString());
|
||||
LLDB_LOGF(log, " CAS::FEVD[%u] Searching namespace %s in module %s",
|
||||
current_id, i->second.GetName().AsCString(),
|
||||
i->first->GetFileSpec().GetFilename().GetCString());
|
||||
|
||||
FindExternalVisibleDecls(context, i->first, i->second, current_id);
|
||||
}
|
||||
|
|
@ -748,8 +752,7 @@ void ClangASTSource::FindExternalVisibleDecls(NameSearchContext &context) {
|
|||
} else {
|
||||
CompilerDeclContext namespace_decl;
|
||||
|
||||
if (log)
|
||||
log->Printf(" CAS::FEVD[%u] Searching the root namespace", current_id);
|
||||
LLDB_LOGF(log, " CAS::FEVD[%u] Searching the root namespace", current_id);
|
||||
|
||||
FindExternalVisibleDecls(context, lldb::ModuleSP(), namespace_decl,
|
||||
current_id);
|
||||
|
|
@ -757,10 +760,10 @@ void ClangASTSource::FindExternalVisibleDecls(NameSearchContext &context) {
|
|||
|
||||
if (!context.m_namespace_map->empty()) {
|
||||
if (log && log->GetVerbose())
|
||||
log->Printf(" CAS::FEVD[%u] Registering namespace map %p (%d entries)",
|
||||
current_id,
|
||||
static_cast<void *>(context.m_namespace_map.get()),
|
||||
static_cast<int>(context.m_namespace_map->size()));
|
||||
LLDB_LOGF(log,
|
||||
" CAS::FEVD[%u] Registering namespace map %p (%d entries)",
|
||||
current_id, static_cast<void *>(context.m_namespace_map.get()),
|
||||
static_cast<int>(context.m_namespace_map->size()));
|
||||
|
||||
NamespaceDecl *clang_namespace_decl =
|
||||
AddNamespace(context, context.m_namespace_map);
|
||||
|
|
@ -818,10 +821,9 @@ void ClangASTSource::FindExternalVisibleDecls(
|
|||
std::pair<lldb::ModuleSP, CompilerDeclContext>(
|
||||
module_sp, found_namespace_decl));
|
||||
|
||||
if (log)
|
||||
log->Printf(" CAS::FEVD[%u] Found namespace %s in module %s",
|
||||
current_id, name.GetCString(),
|
||||
module_sp->GetFileSpec().GetFilename().GetCString());
|
||||
LLDB_LOGF(log, " CAS::FEVD[%u] Found namespace %s in module %s",
|
||||
current_id, name.GetCString(),
|
||||
module_sp->GetFileSpec().GetFilename().GetCString());
|
||||
}
|
||||
}
|
||||
} else if (!HasMerger()) {
|
||||
|
|
@ -849,10 +851,9 @@ void ClangASTSource::FindExternalVisibleDecls(
|
|||
std::pair<lldb::ModuleSP, CompilerDeclContext>(
|
||||
image, found_namespace_decl));
|
||||
|
||||
if (log)
|
||||
log->Printf(" CAS::FEVD[%u] Found namespace %s in module %s",
|
||||
current_id, name.GetCString(),
|
||||
image->GetFileSpec().GetFilename().GetCString());
|
||||
LLDB_LOGF(log, " CAS::FEVD[%u] Found namespace %s in module %s",
|
||||
current_id, name.GetCString(),
|
||||
image->GetFileSpec().GetFilename().GetCString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -878,9 +879,9 @@ void ClangASTSource::FindExternalVisibleDecls(
|
|||
if (log) {
|
||||
const char *name_string = type_sp->GetName().GetCString();
|
||||
|
||||
log->Printf(" CAS::FEVD[%u] Matching type found for \"%s\": %s",
|
||||
current_id, name.GetCString(),
|
||||
(name_string ? name_string : "<anonymous>"));
|
||||
LLDB_LOGF(log, " CAS::FEVD[%u] Matching type found for \"%s\": %s",
|
||||
current_id, name.GetCString(),
|
||||
(name_string ? name_string : "<anonymous>"));
|
||||
}
|
||||
|
||||
CompilerType full_type = type_sp->GetFullCompilerType();
|
||||
|
|
@ -888,8 +889,8 @@ void ClangASTSource::FindExternalVisibleDecls(
|
|||
CompilerType copied_clang_type(GuardedCopyType(full_type));
|
||||
|
||||
if (!copied_clang_type) {
|
||||
if (log)
|
||||
log->Printf(" CAS::FEVD[%u] - Couldn't export a type", current_id);
|
||||
LLDB_LOGF(log, " CAS::FEVD[%u] - Couldn't export a type",
|
||||
current_id);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
|
@ -915,9 +916,10 @@ void ClangASTSource::FindExternalVisibleDecls(
|
|||
break;
|
||||
|
||||
if (log) {
|
||||
log->Printf(" CAS::FEVD[%u] Matching entity found for \"%s\" in "
|
||||
"the modules",
|
||||
current_id, name.GetCString());
|
||||
LLDB_LOGF(log,
|
||||
" CAS::FEVD[%u] Matching entity found for \"%s\" in "
|
||||
"the modules",
|
||||
current_id, name.GetCString());
|
||||
}
|
||||
|
||||
clang::NamedDecl *const decl_from_modules = decls[0];
|
||||
|
|
@ -930,10 +932,10 @@ void ClangASTSource::FindExternalVisibleDecls(
|
|||
copied_decl ? dyn_cast<clang::NamedDecl>(copied_decl) : nullptr;
|
||||
|
||||
if (!copied_named_decl) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
" CAS::FEVD[%u] - Couldn't export a type from the modules",
|
||||
current_id);
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
" CAS::FEVD[%u] - Couldn't export a type from the modules",
|
||||
current_id);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -975,7 +977,8 @@ void ClangASTSource::FindExternalVisibleDecls(
|
|||
break;
|
||||
|
||||
if (log) {
|
||||
log->Printf(
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
" CAS::FEVD[%u] Matching type found for \"%s\" in the runtime",
|
||||
current_id, name.GetCString());
|
||||
}
|
||||
|
|
@ -985,10 +988,9 @@ void ClangASTSource::FindExternalVisibleDecls(
|
|||
copied_decl ? dyn_cast<clang::NamedDecl>(copied_decl) : nullptr;
|
||||
|
||||
if (!copied_named_decl) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
" CAS::FEVD[%u] - Couldn't export a type from the runtime",
|
||||
current_id);
|
||||
LLDB_LOGF(log,
|
||||
" CAS::FEVD[%u] - Couldn't export a type from the runtime",
|
||||
current_id);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -1126,8 +1128,8 @@ bool ClangASTSource::FindObjCMethodDeclsWithOrigin(
|
|||
|
||||
if (log) {
|
||||
ASTDumper dumper((Decl *)copied_method_decl);
|
||||
log->Printf(" CAS::FOMD[%d] found (%s) %s", current_id, log_info,
|
||||
dumper.GetCString());
|
||||
LLDB_LOGF(log, " CAS::FOMD[%d] found (%s) %s", current_id, log_info,
|
||||
dumper.GetCString());
|
||||
}
|
||||
|
||||
context.AddNamedDecl(copied_method_decl);
|
||||
|
|
@ -1205,12 +1207,12 @@ void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) {
|
|||
|
||||
ConstString selector_name(ss.GetString());
|
||||
|
||||
if (log)
|
||||
log->Printf("ClangASTSource::FindObjCMethodDecls[%d] on (ASTContext*)%p "
|
||||
"for selector [%s %s]",
|
||||
current_id, static_cast<void *>(m_ast_context),
|
||||
interface_decl->getNameAsString().c_str(),
|
||||
selector_name.AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"ClangASTSource::FindObjCMethodDecls[%d] on (ASTContext*)%p "
|
||||
"for selector [%s %s]",
|
||||
current_id, static_cast<void *>(m_ast_context),
|
||||
interface_decl->getNameAsString().c_str(),
|
||||
selector_name.AsCString());
|
||||
SymbolContextList sc_list;
|
||||
|
||||
const bool include_symbols = false;
|
||||
|
|
@ -1331,8 +1333,8 @@ void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) {
|
|||
|
||||
if (log) {
|
||||
ASTDumper dumper((Decl *)copied_method_decl);
|
||||
log->Printf(" CAS::FOMD[%d] found (in symbols) %s", current_id,
|
||||
dumper.GetCString());
|
||||
LLDB_LOGF(log, " CAS::FOMD[%d] found (in symbols) %s", current_id,
|
||||
dumper.GetCString());
|
||||
}
|
||||
|
||||
context.AddNamedDecl(copied_method_decl);
|
||||
|
|
@ -1360,11 +1362,11 @@ void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) {
|
|||
if (complete_interface_decl == interface_decl)
|
||||
break; // already checked this one
|
||||
|
||||
if (log)
|
||||
log->Printf("CAS::FOPD[%d] trying origin "
|
||||
"(ObjCInterfaceDecl*)%p/(ASTContext*)%p...",
|
||||
current_id, static_cast<void *>(complete_interface_decl),
|
||||
static_cast<void *>(&complete_iface_decl->getASTContext()));
|
||||
LLDB_LOGF(log,
|
||||
"CAS::FOPD[%d] trying origin "
|
||||
"(ObjCInterfaceDecl*)%p/(ASTContext*)%p...",
|
||||
current_id, static_cast<void *>(complete_interface_decl),
|
||||
static_cast<void *>(&complete_iface_decl->getASTContext()));
|
||||
|
||||
FindObjCMethodDeclsWithOrigin(current_id, context, complete_interface_decl,
|
||||
"in debug info");
|
||||
|
|
@ -1462,8 +1464,8 @@ static bool FindObjCPropertyAndIvarDeclsWithOrigin(
|
|||
if (parser_property_decl.IsValid()) {
|
||||
if (log) {
|
||||
ASTDumper dumper((Decl *)parser_property_decl.decl);
|
||||
log->Printf(" CAS::FOPD[%d] found %s", current_id,
|
||||
dumper.GetCString());
|
||||
LLDB_LOGF(log, " CAS::FOPD[%d] found %s", current_id,
|
||||
dumper.GetCString());
|
||||
}
|
||||
|
||||
context.AddNamedDecl(parser_property_decl.decl);
|
||||
|
|
@ -1480,8 +1482,8 @@ static bool FindObjCPropertyAndIvarDeclsWithOrigin(
|
|||
if (parser_ivar_decl.IsValid()) {
|
||||
if (log) {
|
||||
ASTDumper dumper((Decl *)parser_ivar_decl.decl);
|
||||
log->Printf(" CAS::FOPD[%d] found %s", current_id,
|
||||
dumper.GetCString());
|
||||
LLDB_LOGF(log, " CAS::FOPD[%d] found %s", current_id,
|
||||
dumper.GetCString());
|
||||
}
|
||||
|
||||
context.AddNamedDecl(parser_ivar_decl.decl);
|
||||
|
|
@ -1505,23 +1507,23 @@ void ClangASTSource::FindObjCPropertyAndIvarDecls(NameSearchContext &context) {
|
|||
|
||||
ConstString class_name(parser_iface_decl->getNameAsString().c_str());
|
||||
|
||||
if (log)
|
||||
log->Printf("ClangASTSource::FindObjCPropertyAndIvarDecls[%d] on "
|
||||
"(ASTContext*)%p for '%s.%s'",
|
||||
current_id, static_cast<void *>(m_ast_context),
|
||||
parser_iface_decl->getNameAsString().c_str(),
|
||||
context.m_decl_name.getAsString().c_str());
|
||||
LLDB_LOGF(log,
|
||||
"ClangASTSource::FindObjCPropertyAndIvarDecls[%d] on "
|
||||
"(ASTContext*)%p for '%s.%s'",
|
||||
current_id, static_cast<void *>(m_ast_context),
|
||||
parser_iface_decl->getNameAsString().c_str(),
|
||||
context.m_decl_name.getAsString().c_str());
|
||||
|
||||
if (FindObjCPropertyAndIvarDeclsWithOrigin(
|
||||
current_id, context, *this, origin_iface_decl))
|
||||
return;
|
||||
|
||||
if (log)
|
||||
log->Printf("CAS::FOPD[%d] couldn't find the property on origin "
|
||||
"(ObjCInterfaceDecl*)%p/(ASTContext*)%p, searching "
|
||||
"elsewhere...",
|
||||
current_id, static_cast<const void *>(origin_iface_decl.decl),
|
||||
static_cast<void *>(&origin_iface_decl->getASTContext()));
|
||||
LLDB_LOGF(log,
|
||||
"CAS::FOPD[%d] couldn't find the property on origin "
|
||||
"(ObjCInterfaceDecl*)%p/(ASTContext*)%p, searching "
|
||||
"elsewhere...",
|
||||
current_id, static_cast<const void *>(origin_iface_decl.decl),
|
||||
static_cast<void *>(&origin_iface_decl->getASTContext()));
|
||||
|
||||
SymbolContext null_sc;
|
||||
TypeList type_list;
|
||||
|
|
@ -1542,12 +1544,11 @@ void ClangASTSource::FindObjCPropertyAndIvarDecls(NameSearchContext &context) {
|
|||
if (complete_iface_decl.decl == origin_iface_decl.decl)
|
||||
break; // already checked this one
|
||||
|
||||
if (log)
|
||||
log->Printf("CAS::FOPD[%d] trying origin "
|
||||
"(ObjCInterfaceDecl*)%p/(ASTContext*)%p...",
|
||||
current_id,
|
||||
static_cast<const void *>(complete_iface_decl.decl),
|
||||
static_cast<void *>(&complete_iface_decl->getASTContext()));
|
||||
LLDB_LOGF(log,
|
||||
"CAS::FOPD[%d] trying origin "
|
||||
"(ObjCInterfaceDecl*)%p/(ASTContext*)%p...",
|
||||
current_id, static_cast<const void *>(complete_iface_decl.decl),
|
||||
static_cast<void *>(&complete_iface_decl->getASTContext()));
|
||||
|
||||
FindObjCPropertyAndIvarDeclsWithOrigin(current_id, context, *this,
|
||||
complete_iface_decl);
|
||||
|
|
@ -1578,13 +1579,12 @@ void ClangASTSource::FindObjCPropertyAndIvarDecls(NameSearchContext &context) {
|
|||
if (!interface_decl_from_modules.IsValid())
|
||||
break;
|
||||
|
||||
if (log)
|
||||
log->Printf(
|
||||
"CAS::FOPD[%d] trying module "
|
||||
"(ObjCInterfaceDecl*)%p/(ASTContext*)%p...",
|
||||
current_id,
|
||||
static_cast<const void *>(interface_decl_from_modules.decl),
|
||||
static_cast<void *>(&interface_decl_from_modules->getASTContext()));
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"CAS::FOPD[%d] trying module "
|
||||
"(ObjCInterfaceDecl*)%p/(ASTContext*)%p...",
|
||||
current_id, static_cast<const void *>(interface_decl_from_modules.decl),
|
||||
static_cast<void *>(&interface_decl_from_modules->getASTContext()));
|
||||
|
||||
if (FindObjCPropertyAndIvarDeclsWithOrigin(current_id, context, *this,
|
||||
interface_decl_from_modules))
|
||||
|
|
@ -1623,13 +1623,12 @@ void ClangASTSource::FindObjCPropertyAndIvarDecls(NameSearchContext &context) {
|
|||
if (!interface_decl_from_runtime.IsValid())
|
||||
break;
|
||||
|
||||
if (log)
|
||||
log->Printf(
|
||||
"CAS::FOPD[%d] trying runtime "
|
||||
"(ObjCInterfaceDecl*)%p/(ASTContext*)%p...",
|
||||
current_id,
|
||||
static_cast<const void *>(interface_decl_from_runtime.decl),
|
||||
static_cast<void *>(&interface_decl_from_runtime->getASTContext()));
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"CAS::FOPD[%d] trying runtime "
|
||||
"(ObjCInterfaceDecl*)%p/(ASTContext*)%p...",
|
||||
current_id, static_cast<const void *>(interface_decl_from_runtime.decl),
|
||||
static_cast<void *>(&interface_decl_from_runtime->getASTContext()));
|
||||
|
||||
if (FindObjCPropertyAndIvarDeclsWithOrigin(
|
||||
current_id, context, *this, interface_decl_from_runtime))
|
||||
|
|
@ -1729,12 +1728,12 @@ bool ClangASTSource::layoutRecordType(const RecordDecl *record, uint64_t &size,
|
|||
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
|
||||
|
||||
if (log)
|
||||
log->Printf("LayoutRecordType[%u] on (ASTContext*)%p for (RecordDecl*)%p "
|
||||
"[name = '%s']",
|
||||
current_id, static_cast<void *>(m_ast_context),
|
||||
static_cast<const void *>(record),
|
||||
record->getNameAsString().c_str());
|
||||
LLDB_LOGF(log,
|
||||
"LayoutRecordType[%u] on (ASTContext*)%p for (RecordDecl*)%p "
|
||||
"[name = '%s']",
|
||||
current_id, static_cast<void *>(m_ast_context),
|
||||
static_cast<const void *>(record),
|
||||
record->getNameAsString().c_str());
|
||||
|
||||
DeclFromParser<const RecordDecl> parser_record(record);
|
||||
DeclFromUser<const RecordDecl> origin_record(
|
||||
|
|
@ -1798,24 +1797,25 @@ bool ClangASTSource::layoutRecordType(const RecordDecl *record, uint64_t &size,
|
|||
m_ast_context->getCharWidth();
|
||||
|
||||
if (log) {
|
||||
log->Printf("LRT[%u] returned:", current_id);
|
||||
log->Printf("LRT[%u] Original = (RecordDecl*)%p", current_id,
|
||||
static_cast<const void *>(origin_record.decl));
|
||||
log->Printf("LRT[%u] Size = %" PRId64, current_id, size);
|
||||
log->Printf("LRT[%u] Alignment = %" PRId64, current_id, alignment);
|
||||
log->Printf("LRT[%u] Fields:", current_id);
|
||||
LLDB_LOGF(log, "LRT[%u] returned:", current_id);
|
||||
LLDB_LOGF(log, "LRT[%u] Original = (RecordDecl*)%p", current_id,
|
||||
static_cast<const void *>(origin_record.decl));
|
||||
LLDB_LOGF(log, "LRT[%u] Size = %" PRId64, current_id, size);
|
||||
LLDB_LOGF(log, "LRT[%u] Alignment = %" PRId64, current_id, alignment);
|
||||
LLDB_LOGF(log, "LRT[%u] Fields:", current_id);
|
||||
for (RecordDecl::field_iterator fi = record->field_begin(),
|
||||
fe = record->field_end();
|
||||
fi != fe; ++fi) {
|
||||
log->Printf("LRT[%u] (FieldDecl*)%p, Name = '%s', Offset = %" PRId64
|
||||
" bits",
|
||||
current_id, static_cast<void *>(*fi),
|
||||
fi->getNameAsString().c_str(), field_offsets[*fi]);
|
||||
LLDB_LOGF(log,
|
||||
"LRT[%u] (FieldDecl*)%p, Name = '%s', Offset = %" PRId64
|
||||
" bits",
|
||||
current_id, static_cast<void *>(*fi),
|
||||
fi->getNameAsString().c_str(), field_offsets[*fi]);
|
||||
}
|
||||
DeclFromParser<const CXXRecordDecl> parser_cxx_record =
|
||||
DynCast<const CXXRecordDecl>(parser_record);
|
||||
if (parser_cxx_record.IsValid()) {
|
||||
log->Printf("LRT[%u] Bases:", current_id);
|
||||
LLDB_LOGF(log, "LRT[%u] Bases:", current_id);
|
||||
for (CXXRecordDecl::base_class_const_iterator
|
||||
bi = parser_cxx_record->bases_begin(),
|
||||
be = parser_cxx_record->bases_end();
|
||||
|
|
@ -1828,7 +1828,8 @@ bool ClangASTSource::layoutRecordType(const RecordDecl *record, uint64_t &size,
|
|||
DeclFromParser<CXXRecordDecl> base_cxx_record =
|
||||
DynCast<CXXRecordDecl>(base_record);
|
||||
|
||||
log->Printf(
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"LRT[%u] %s(CXXRecordDecl*)%p, Name = '%s', Offset = %" PRId64
|
||||
" chars",
|
||||
current_id, (is_virtual ? "Virtual " : ""),
|
||||
|
|
@ -1839,7 +1840,7 @@ bool ClangASTSource::layoutRecordType(const RecordDecl *record, uint64_t &size,
|
|||
: base_offsets[base_cxx_record.decl].getQuantity()));
|
||||
}
|
||||
} else {
|
||||
log->Printf("LRD[%u] Not a CXXRecord, so no bases", current_id);
|
||||
LLDB_LOGF(log, "LRD[%u] Not a CXXRecord, so no bases", current_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1856,16 +1857,18 @@ void ClangASTSource::CompleteNamespaceMap(
|
|||
|
||||
if (log) {
|
||||
if (parent_map && parent_map->size())
|
||||
log->Printf("CompleteNamespaceMap[%u] on (ASTContext*)%p Searching for "
|
||||
"namespace %s in namespace %s",
|
||||
current_id, static_cast<void *>(m_ast_context),
|
||||
name.GetCString(),
|
||||
parent_map->begin()->second.GetName().AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"CompleteNamespaceMap[%u] on (ASTContext*)%p Searching for "
|
||||
"namespace %s in namespace %s",
|
||||
current_id, static_cast<void *>(m_ast_context),
|
||||
name.GetCString(),
|
||||
parent_map->begin()->second.GetName().AsCString());
|
||||
else
|
||||
log->Printf("CompleteNamespaceMap[%u] on (ASTContext*)%p Searching for "
|
||||
"namespace %s",
|
||||
current_id, static_cast<void *>(m_ast_context),
|
||||
name.GetCString());
|
||||
LLDB_LOGF(log,
|
||||
"CompleteNamespaceMap[%u] on (ASTContext*)%p Searching for "
|
||||
"namespace %s",
|
||||
current_id, static_cast<void *>(m_ast_context),
|
||||
name.GetCString());
|
||||
}
|
||||
|
||||
if (parent_map) {
|
||||
|
|
@ -1891,10 +1894,9 @@ void ClangASTSource::CompleteNamespaceMap(
|
|||
namespace_map->push_back(std::pair<lldb::ModuleSP, CompilerDeclContext>(
|
||||
module_sp, found_namespace_decl));
|
||||
|
||||
if (log)
|
||||
log->Printf(" CMN[%u] Found namespace %s in module %s", current_id,
|
||||
name.GetCString(),
|
||||
module_sp->GetFileSpec().GetFilename().GetCString());
|
||||
LLDB_LOGF(log, " CMN[%u] Found namespace %s in module %s", current_id,
|
||||
name.GetCString(),
|
||||
module_sp->GetFileSpec().GetFilename().GetCString());
|
||||
}
|
||||
} else {
|
||||
const ModuleList &target_images = m_target->GetImages();
|
||||
|
|
@ -1924,10 +1926,9 @@ void ClangASTSource::CompleteNamespaceMap(
|
|||
namespace_map->push_back(std::pair<lldb::ModuleSP, CompilerDeclContext>(
|
||||
image, found_namespace_decl));
|
||||
|
||||
if (log)
|
||||
log->Printf(" CMN[%u] Found namespace %s in module %s", current_id,
|
||||
name.GetCString(),
|
||||
image->GetFileSpec().GetFilename().GetCString());
|
||||
LLDB_LOGF(log, " CMN[%u] Found namespace %s in module %s", current_id,
|
||||
name.GetCString(),
|
||||
image->GetFileSpec().GetFilename().GetCString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2162,8 +2163,7 @@ clang::NamedDecl *NameSearchContext::AddFunDecl(const CompilerType &type,
|
|||
} else {
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
|
||||
|
||||
if (log)
|
||||
log->Printf("Function type wasn't a FunctionProtoType");
|
||||
LLDB_LOGF(log, "Function type wasn't a FunctionProtoType");
|
||||
}
|
||||
|
||||
// If this is an operator (e.g. operator new or operator==), only insert the
|
||||
|
|
|
|||
|
|
@ -383,8 +383,7 @@ bool ClangExpressionDeclMap::AddPersistentVariable(const NamedDecl *decl,
|
|||
TypeFromUser user_type = DeportType(*context, *ast, parser_type);
|
||||
|
||||
if (!user_type.GetOpaqueQualType()) {
|
||||
if (log)
|
||||
log->Printf("Persistent variable's type wasn't copied successfully");
|
||||
LLDB_LOGF(log, "Persistent variable's type wasn't copied successfully");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -423,8 +422,7 @@ bool ClangExpressionDeclMap::AddPersistentVariable(const NamedDecl *decl,
|
|||
var->m_flags |= ClangExpressionVariable::EVKeepInTarget;
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("Created persistent variable with flags 0x%hx", var->m_flags);
|
||||
LLDB_LOGF(log, "Created persistent variable with flags 0x%hx", var->m_flags);
|
||||
|
||||
var->EnableParserVars(GetParserID());
|
||||
|
||||
|
|
@ -466,10 +464,9 @@ bool ClangExpressionDeclMap::AddValueToStruct(const NamedDecl *decl,
|
|||
if (!var)
|
||||
return false;
|
||||
|
||||
if (log)
|
||||
log->Printf("Adding value for (NamedDecl*)%p [%s - %s] to the structure",
|
||||
static_cast<const void *>(decl), name.GetCString(),
|
||||
var->GetName().GetCString());
|
||||
LLDB_LOGF(log, "Adding value for (NamedDecl*)%p [%s - %s] to the structure",
|
||||
static_cast<const void *>(decl), name.GetCString(),
|
||||
var->GetName().GetCString());
|
||||
|
||||
// We know entity->m_parser_vars is valid because we used a parser variable
|
||||
// to find it
|
||||
|
|
@ -483,9 +480,8 @@ bool ClangExpressionDeclMap::AddValueToStruct(const NamedDecl *decl,
|
|||
llvm::cast<ClangExpressionVariable>(var)->GetJITVars(GetParserID())) {
|
||||
// We already laid this out; do not touch
|
||||
|
||||
if (log)
|
||||
log->Printf("Already placed at 0x%llx",
|
||||
(unsigned long long)jit_vars->m_offset);
|
||||
LLDB_LOGF(log, "Already placed at 0x%llx",
|
||||
(unsigned long long)jit_vars->m_offset);
|
||||
}
|
||||
|
||||
llvm::cast<ClangExpressionVariable>(var)->EnableJITVars(GetParserID());
|
||||
|
|
@ -520,8 +516,7 @@ bool ClangExpressionDeclMap::AddValueToStruct(const NamedDecl *decl,
|
|||
if (!err.Success())
|
||||
return false;
|
||||
|
||||
if (log)
|
||||
log->Printf("Placed at 0x%llx", (unsigned long long)offset);
|
||||
LLDB_LOGF(log, "Placed at 0x%llx", (unsigned long long)offset);
|
||||
|
||||
jit_vars->m_offset =
|
||||
offset; // TODO DoStructLayout() should not change this.
|
||||
|
|
@ -787,7 +782,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
|
|||
|
||||
if (GetImportInProgress()) {
|
||||
if (log && log->GetVerbose())
|
||||
log->Printf("Ignoring a query during an import");
|
||||
LLDB_LOGF(log, "Ignoring a query during an import");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -796,20 +791,23 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
|
|||
|
||||
if (log) {
|
||||
if (!context.m_decl_context)
|
||||
log->Printf("ClangExpressionDeclMap::FindExternalVisibleDecls[%u] for "
|
||||
"'%s' in a NULL DeclContext",
|
||||
current_id, name.GetCString());
|
||||
LLDB_LOGF(log,
|
||||
"ClangExpressionDeclMap::FindExternalVisibleDecls[%u] for "
|
||||
"'%s' in a NULL DeclContext",
|
||||
current_id, name.GetCString());
|
||||
else if (const NamedDecl *context_named_decl =
|
||||
dyn_cast<NamedDecl>(context.m_decl_context))
|
||||
log->Printf("ClangExpressionDeclMap::FindExternalVisibleDecls[%u] for "
|
||||
"'%s' in '%s'",
|
||||
current_id, name.GetCString(),
|
||||
context_named_decl->getNameAsString().c_str());
|
||||
LLDB_LOGF(log,
|
||||
"ClangExpressionDeclMap::FindExternalVisibleDecls[%u] for "
|
||||
"'%s' in '%s'",
|
||||
current_id, name.GetCString(),
|
||||
context_named_decl->getNameAsString().c_str());
|
||||
else
|
||||
log->Printf("ClangExpressionDeclMap::FindExternalVisibleDecls[%u] for "
|
||||
"'%s' in a '%s'",
|
||||
current_id, name.GetCString(),
|
||||
context.m_decl_context->getDeclKindName());
|
||||
LLDB_LOGF(log,
|
||||
"ClangExpressionDeclMap::FindExternalVisibleDecls[%u] for "
|
||||
"'%s' in a '%s'",
|
||||
current_id, name.GetCString(),
|
||||
context.m_decl_context->getDeclKindName());
|
||||
}
|
||||
|
||||
if (const NamespaceDecl *namespace_context =
|
||||
|
|
@ -930,9 +928,8 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
|
|||
MaybeRegisterFunctionBody(parser_function_decl);
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf(" CEDM::FEVD[%u] Found persistent decl %s", current_id,
|
||||
name.GetCString());
|
||||
LLDB_LOGF(log, " CEDM::FEVD[%u] Found persistent decl %s", current_id,
|
||||
name.GetCString());
|
||||
|
||||
context.AddNamedDecl(parser_named_decl);
|
||||
} while (false);
|
||||
|
|
@ -987,8 +984,8 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
|
|||
|
||||
if (log) {
|
||||
ASTDumper ast_dumper(class_qual_type);
|
||||
log->Printf(" CEDM::FEVD[%u] Adding type for $__lldb_class: %s",
|
||||
current_id, ast_dumper.GetCString());
|
||||
LLDB_LOGF(log, " CEDM::FEVD[%u] Adding type for $__lldb_class: %s",
|
||||
current_id, ast_dumper.GetCString());
|
||||
}
|
||||
|
||||
AddThisType(context, class_user_type, current_id);
|
||||
|
|
@ -1032,8 +1029,8 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
|
|||
if (pointee_type.IsValid()) {
|
||||
if (log) {
|
||||
ASTDumper ast_dumper(pointee_type);
|
||||
log->Printf(" FEVD[%u] Adding type for $__lldb_class: %s",
|
||||
current_id, ast_dumper.GetCString());
|
||||
LLDB_LOGF(log, " FEVD[%u] Adding type for $__lldb_class: %s",
|
||||
current_id, ast_dumper.GetCString());
|
||||
}
|
||||
|
||||
AddThisType(context, pointee_type, current_id);
|
||||
|
|
@ -1104,8 +1101,8 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
|
|||
|
||||
if (log) {
|
||||
ASTDumper ast_dumper(interface_type);
|
||||
log->Printf(" FEVD[%u] Adding type for $__lldb_objc_class: %s",
|
||||
current_id, ast_dumper.GetCString());
|
||||
LLDB_LOGF(log, " FEVD[%u] Adding type for $__lldb_objc_class: %s",
|
||||
current_id, ast_dumper.GetCString());
|
||||
}
|
||||
|
||||
AddOneType(context, class_user_type, current_id);
|
||||
|
|
@ -1165,8 +1162,9 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
|
|||
|
||||
if (log) {
|
||||
ASTDumper ast_dumper(self_type->GetFullCompilerType());
|
||||
log->Printf(" FEVD[%u] Adding type for $__lldb_objc_class: %s",
|
||||
current_id, ast_dumper.GetCString());
|
||||
LLDB_LOGF(log,
|
||||
" FEVD[%u] Adding type for $__lldb_objc_class: %s",
|
||||
current_id, ast_dumper.GetCString());
|
||||
}
|
||||
|
||||
TypeFromUser class_user_type(self_clang_type);
|
||||
|
|
@ -1230,9 +1228,8 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
|
|||
reg_name));
|
||||
|
||||
if (reg_info) {
|
||||
if (log)
|
||||
log->Printf(" CEDM::FEVD[%u] Found register %s", current_id,
|
||||
reg_info->name);
|
||||
LLDB_LOGF(log, " CEDM::FEVD[%u] Found register %s", current_id,
|
||||
reg_info->name);
|
||||
|
||||
AddOneRegister(context, reg_info, current_id);
|
||||
}
|
||||
|
|
@ -1519,9 +1516,10 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
|
|||
|
||||
if (llvm::isa<clang::FunctionDecl>(decl_from_modules)) {
|
||||
if (log) {
|
||||
log->Printf(" CAS::FEVD[%u] Matching function found for "
|
||||
"\"%s\" in the modules",
|
||||
current_id, name.GetCString());
|
||||
LLDB_LOGF(log,
|
||||
" CAS::FEVD[%u] Matching function found for "
|
||||
"\"%s\" in the modules",
|
||||
current_id, name.GetCString());
|
||||
}
|
||||
|
||||
clang::Decl *copied_decl = CopyDecl(decl_from_modules);
|
||||
|
|
@ -1530,10 +1528,10 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
|
|||
: nullptr;
|
||||
|
||||
if (!copied_function_decl) {
|
||||
if (log)
|
||||
log->Printf(" CAS::FEVD[%u] - Couldn't export a function "
|
||||
"declaration from the modules",
|
||||
current_id);
|
||||
LLDB_LOGF(log,
|
||||
" CAS::FEVD[%u] - Couldn't export a function "
|
||||
"declaration from the modules",
|
||||
current_id);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -1546,9 +1544,10 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
|
|||
context.m_found.function = true;
|
||||
} else if (llvm::isa<clang::VarDecl>(decl_from_modules)) {
|
||||
if (log) {
|
||||
log->Printf(" CAS::FEVD[%u] Matching variable found for "
|
||||
"\"%s\" in the modules",
|
||||
current_id, name.GetCString());
|
||||
LLDB_LOGF(log,
|
||||
" CAS::FEVD[%u] Matching variable found for "
|
||||
"\"%s\" in the modules",
|
||||
current_id, name.GetCString());
|
||||
}
|
||||
|
||||
clang::Decl *copied_decl = CopyDecl(decl_from_modules);
|
||||
|
|
@ -1557,10 +1556,10 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
|
|||
: nullptr;
|
||||
|
||||
if (!copied_var_decl) {
|
||||
if (log)
|
||||
log->Printf(" CAS::FEVD[%u] - Couldn't export a variable "
|
||||
"declaration from the modules",
|
||||
current_id);
|
||||
LLDB_LOGF(log,
|
||||
" CAS::FEVD[%u] - Couldn't export a variable "
|
||||
"declaration from the modules",
|
||||
current_id);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -1655,8 +1654,7 @@ bool ClangExpressionDeclMap::GetVariableValue(VariableSP &var,
|
|||
const_value_extractor.GetByteSize());
|
||||
var_location.SetValueType(Value::eValueTypeHostAddress);
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("Error evaluating constant variable: %s", err.AsCString());
|
||||
LLDB_LOGF(log, "Error evaluating constant variable: %s", err.AsCString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1664,9 +1662,8 @@ bool ClangExpressionDeclMap::GetVariableValue(VariableSP &var,
|
|||
CompilerType type_to_use = GuardedCopyType(var_clang_type);
|
||||
|
||||
if (!type_to_use) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"Couldn't copy a variable's type into the parser's AST context");
|
||||
LLDB_LOGF(log,
|
||||
"Couldn't copy a variable's type into the parser's AST context");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1759,9 +1756,10 @@ void ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context,
|
|||
if (log) {
|
||||
ASTDumper orig_dumper(ut.GetOpaqueQualType());
|
||||
ASTDumper ast_dumper(var_decl);
|
||||
log->Printf(" CEDM::FEVD[%u] Found variable %s, returned %s (original %s)",
|
||||
current_id, decl_name.c_str(), ast_dumper.GetCString(),
|
||||
orig_dumper.GetCString());
|
||||
LLDB_LOGF(log,
|
||||
" CEDM::FEVD[%u] Found variable %s, returned %s (original %s)",
|
||||
current_id, decl_name.c_str(), ast_dumper.GetCString(),
|
||||
orig_dumper.GetCString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1776,9 +1774,8 @@ void ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context,
|
|||
TypeFromParser parser_type(GuardedCopyType(user_type));
|
||||
|
||||
if (!parser_type.GetOpaqueQualType()) {
|
||||
if (log)
|
||||
log->Printf(" CEDM::FEVD[%u] Couldn't import type for pvar %s",
|
||||
current_id, pvar_sp->GetName().GetCString());
|
||||
LLDB_LOGF(log, " CEDM::FEVD[%u] Couldn't import type for pvar %s",
|
||||
current_id, pvar_sp->GetName().GetCString());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1797,8 +1794,8 @@ void ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context,
|
|||
|
||||
if (log) {
|
||||
ASTDumper ast_dumper(var_decl);
|
||||
log->Printf(" CEDM::FEVD[%u] Added pvar %s, returned %s", current_id,
|
||||
pvar_sp->GetName().GetCString(), ast_dumper.GetCString());
|
||||
LLDB_LOGF(log, " CEDM::FEVD[%u] Added pvar %s, returned %s", current_id,
|
||||
pvar_sp->GetName().GetCString(), ast_dumper.GetCString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1856,8 +1853,8 @@ void ClangExpressionDeclMap::AddOneGenericVariable(NameSearchContext &context,
|
|||
if (log) {
|
||||
ASTDumper ast_dumper(var_decl);
|
||||
|
||||
log->Printf(" CEDM::FEVD[%u] Found variable %s, returned %s", current_id,
|
||||
decl_name.c_str(), ast_dumper.GetCString());
|
||||
LLDB_LOGF(log, " CEDM::FEVD[%u] Found variable %s, returned %s",
|
||||
current_id, decl_name.c_str(), ast_dumper.GetCString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1882,15 +1879,14 @@ bool ClangExpressionDeclMap::ResolveUnknownTypes() {
|
|||
const VarDecl *var_decl = dyn_cast<VarDecl>(named_decl);
|
||||
|
||||
if (!var_decl) {
|
||||
if (log)
|
||||
log->Printf("Entity of unknown type does not have a VarDecl");
|
||||
LLDB_LOGF(log, "Entity of unknown type does not have a VarDecl");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (log) {
|
||||
ASTDumper ast_dumper(const_cast<VarDecl *>(var_decl));
|
||||
log->Printf("Variable of unknown type now has Decl %s",
|
||||
ast_dumper.GetCString());
|
||||
LLDB_LOGF(log, "Variable of unknown type now has Decl %s",
|
||||
ast_dumper.GetCString());
|
||||
}
|
||||
|
||||
QualType var_type = var_decl->getType();
|
||||
|
|
@ -1914,9 +1910,8 @@ bool ClangExpressionDeclMap::ResolveUnknownTypes() {
|
|||
}
|
||||
|
||||
if (!copied_type) {
|
||||
if (log)
|
||||
log->Printf("ClangExpressionDeclMap::ResolveUnknownType - Couldn't "
|
||||
"import the type for a variable");
|
||||
LLDB_LOGF(log, "ClangExpressionDeclMap::ResolveUnknownType - Couldn't "
|
||||
"import the type for a variable");
|
||||
|
||||
return (bool)lldb::ExpressionVariableSP();
|
||||
}
|
||||
|
|
@ -1947,9 +1942,8 @@ void ClangExpressionDeclMap::AddOneRegister(NameSearchContext &context,
|
|||
m_ast_context, reg_info->encoding, reg_info->byte_size * 8);
|
||||
|
||||
if (!clang_type) {
|
||||
if (log)
|
||||
log->Printf(" Tried to add a type for %s, but couldn't get one",
|
||||
context.m_decl_name.getAsString().c_str());
|
||||
LLDB_LOGF(log, " Tried to add a type for %s, but couldn't get one",
|
||||
context.m_decl_name.getAsString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1977,9 +1971,9 @@ void ClangExpressionDeclMap::AddOneRegister(NameSearchContext &context,
|
|||
|
||||
if (log) {
|
||||
ASTDumper ast_dumper(var_decl);
|
||||
log->Printf(" CEDM::FEVD[%d] Added register %s, returned %s", current_id,
|
||||
context.m_decl_name.getAsString().c_str(),
|
||||
ast_dumper.GetCString());
|
||||
LLDB_LOGF(log, " CEDM::FEVD[%d] Added register %s, returned %s",
|
||||
current_id, context.m_decl_name.getAsString().c_str(),
|
||||
ast_dumper.GetCString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2049,19 +2043,20 @@ void ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context,
|
|||
|
||||
function->DumpSymbolContext(&ss);
|
||||
|
||||
log->Printf(" CEDM::FEVD[%u] Imported decl for function %s "
|
||||
"(description %s), returned %s",
|
||||
current_id,
|
||||
copied_function_decl->getNameAsString().c_str(),
|
||||
ss.GetData(), ast_dumper.GetCString());
|
||||
LLDB_LOGF(log,
|
||||
" CEDM::FEVD[%u] Imported decl for function %s "
|
||||
"(description %s), returned %s",
|
||||
current_id,
|
||||
copied_function_decl->getNameAsString().c_str(),
|
||||
ss.GetData(), ast_dumper.GetCString());
|
||||
}
|
||||
|
||||
context.AddNamedDecl(copied_function_decl);
|
||||
return;
|
||||
} else {
|
||||
if (log) {
|
||||
log->Printf(" Failed to import the function decl for '%s'",
|
||||
src_function_decl->getName().str().c_str());
|
||||
LLDB_LOGF(log, " Failed to import the function decl for '%s'",
|
||||
src_function_decl->getName().str().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2090,7 +2085,8 @@ void ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context,
|
|||
|
||||
if (!function_decl) {
|
||||
if (log) {
|
||||
log->Printf(
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
" Failed to create a function decl for '%s' {0x%8.8" PRIx64 "}",
|
||||
function_type->GetName().GetCString(), function_type->GetID());
|
||||
}
|
||||
|
|
@ -2100,10 +2096,11 @@ void ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context,
|
|||
} else {
|
||||
// We failed to copy the type we found
|
||||
if (log) {
|
||||
log->Printf(" Failed to import the function type '%s' {0x%8.8" PRIx64
|
||||
"} into the expression parser AST contenxt",
|
||||
function_type->GetName().GetCString(),
|
||||
function_type->GetID());
|
||||
LLDB_LOGF(log,
|
||||
" Failed to import the function type '%s' {0x%8.8" PRIx64
|
||||
"} into the expression parser AST contenxt",
|
||||
function_type->GetName().GetCString(),
|
||||
function_type->GetID());
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
@ -2162,7 +2159,8 @@ void ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context,
|
|||
m_parser_vars->m_exe_ctx.GetBestExecutionContextScope(),
|
||||
Address::DumpStyleResolvedDescription);
|
||||
|
||||
log->Printf(
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
" CEDM::FEVD[%u] Found %s function %s (description %s), returned %s",
|
||||
current_id, (function ? "specific" : "generic"), decl_name.c_str(),
|
||||
ss.GetData(), function_str.c_str());
|
||||
|
|
@ -2178,7 +2176,8 @@ void ClangExpressionDeclMap::AddThisType(NameSearchContext &context,
|
|||
|
||||
if (!copied_clang_type) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"ClangExpressionDeclMap::AddThisType - Couldn't import the type");
|
||||
|
||||
return;
|
||||
|
|
@ -2211,9 +2210,10 @@ void ClangExpressionDeclMap::AddThisType(NameSearchContext &context,
|
|||
ASTDumper method_ast_dumper((clang::Decl *)method_decl);
|
||||
ASTDumper type_ast_dumper(copied_clang_type);
|
||||
|
||||
log->Printf(" CEDM::AddThisType Added function $__lldb_expr "
|
||||
"(description %s) for this type %s",
|
||||
method_ast_dumper.GetCString(), type_ast_dumper.GetCString());
|
||||
LLDB_LOGF(log,
|
||||
" CEDM::AddThisType Added function $__lldb_expr "
|
||||
"(description %s) for this type %s",
|
||||
method_ast_dumper.GetCString(), type_ast_dumper.GetCString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2252,8 +2252,8 @@ void ClangExpressionDeclMap::AddOneType(NameSearchContext &context,
|
|||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
|
||||
|
||||
if (log)
|
||||
log->Printf(
|
||||
"ClangExpressionDeclMap::AddOneType - Couldn't import the type");
|
||||
LLDB_LOGF(
|
||||
log, "ClangExpressionDeclMap::AddOneType - Couldn't import the type");
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -331,9 +331,8 @@ ClangExpressionParser::ClangExpressionParser(
|
|||
|
||||
if (process_sp && frame_lang != lldb::eLanguageTypeUnknown) {
|
||||
lang_rt = process_sp->GetLanguageRuntime(frame_lang);
|
||||
if (log)
|
||||
log->Printf("Frame has language of type %s",
|
||||
Language::GetNameForLanguageType(frame_lang));
|
||||
LLDB_LOGF(log, "Frame has language of type %s",
|
||||
Language::GetNameForLanguageType(frame_lang));
|
||||
}
|
||||
|
||||
// 2. Configure the compiler with a set of default options that are
|
||||
|
|
@ -341,9 +340,8 @@ ClangExpressionParser::ClangExpressionParser(
|
|||
if (target_arch.IsValid()) {
|
||||
std::string triple = target_arch.GetTriple().str();
|
||||
m_compiler->getTargetOpts().Triple = triple;
|
||||
if (log)
|
||||
log->Printf("Using %s as the target triple",
|
||||
m_compiler->getTargetOpts().Triple.c_str());
|
||||
LLDB_LOGF(log, "Using %s as the target triple",
|
||||
m_compiler->getTargetOpts().Triple.c_str());
|
||||
} else {
|
||||
// If we get here we don't have a valid target and just have to guess.
|
||||
// Sometimes this will be ok to just use the host target triple (when we
|
||||
|
|
@ -352,9 +350,8 @@ ClangExpressionParser::ClangExpressionParser(
|
|||
// the host triple. In such a case the language runtime should expose an
|
||||
// overridden options set (3), below.
|
||||
m_compiler->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple();
|
||||
if (log)
|
||||
log->Printf("Using default target triple of %s",
|
||||
m_compiler->getTargetOpts().Triple.c_str());
|
||||
LLDB_LOGF(log, "Using default target triple of %s",
|
||||
m_compiler->getTargetOpts().Triple.c_str());
|
||||
}
|
||||
// Now add some special fixes for known architectures: Any arm32 iOS
|
||||
// environment, but not on arm64
|
||||
|
|
@ -408,12 +405,13 @@ ClangExpressionParser::ClangExpressionParser(
|
|||
auto target_info = TargetInfo::CreateTargetInfo(
|
||||
m_compiler->getDiagnostics(), m_compiler->getInvocation().TargetOpts);
|
||||
if (log) {
|
||||
log->Printf("Using SIMD alignment: %d", target_info->getSimdDefaultAlign());
|
||||
log->Printf("Target datalayout string: '%s'",
|
||||
target_info->getDataLayout().getStringRepresentation().c_str());
|
||||
log->Printf("Target ABI: '%s'", target_info->getABI().str().c_str());
|
||||
log->Printf("Target vector alignment: %d",
|
||||
target_info->getMaxVectorAlign());
|
||||
LLDB_LOGF(log, "Using SIMD alignment: %d",
|
||||
target_info->getSimdDefaultAlign());
|
||||
LLDB_LOGF(log, "Target datalayout string: '%s'",
|
||||
target_info->getDataLayout().getStringRepresentation().c_str());
|
||||
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);
|
||||
|
||||
|
|
@ -1181,9 +1179,8 @@ lldb_private::Status ClangExpressionParser::PrepareForExecution(
|
|||
m_expr.FunctionName());
|
||||
return err;
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("Found function %s for %s", function_name.AsCString(),
|
||||
m_expr.FunctionName());
|
||||
LLDB_LOGF(log, "Found function %s for %s", function_name.AsCString(),
|
||||
m_expr.FunctionName());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1198,9 +1195,8 @@ lldb_private::Status ClangExpressionParser::PrepareForExecution(
|
|||
LLVMUserExpression::IRPasses custom_passes;
|
||||
{
|
||||
auto lang = m_expr.Language();
|
||||
if (log)
|
||||
log->Printf("%s - Current expression language is %s\n", __FUNCTION__,
|
||||
Language::GetNameForLanguageType(lang));
|
||||
LLDB_LOGF(log, "%s - Current expression language is %s\n", __FUNCTION__,
|
||||
Language::GetNameForLanguageType(lang));
|
||||
lldb::ProcessSP process_sp = exe_ctx.GetProcessSP();
|
||||
if (process_sp && lang != lldb::eLanguageTypeUnknown) {
|
||||
auto runtime = process_sp->GetLanguageRuntime(lang);
|
||||
|
|
@ -1210,10 +1206,10 @@ lldb_private::Status ClangExpressionParser::PrepareForExecution(
|
|||
}
|
||||
|
||||
if (custom_passes.EarlyPasses) {
|
||||
if (log)
|
||||
log->Printf("%s - Running Early IR Passes from LanguageRuntime on "
|
||||
"expression module '%s'",
|
||||
__FUNCTION__, m_expr.FunctionName());
|
||||
LLDB_LOGF(log,
|
||||
"%s - Running Early IR Passes from LanguageRuntime on "
|
||||
"expression module '%s'",
|
||||
__FUNCTION__, m_expr.FunctionName());
|
||||
|
||||
custom_passes.EarlyPasses->run(*llvm_module_up);
|
||||
}
|
||||
|
|
@ -1298,9 +1294,8 @@ lldb_private::Status ClangExpressionParser::PrepareForExecution(
|
|||
|
||||
process->SetDynamicCheckers(dynamic_checkers);
|
||||
|
||||
if (log)
|
||||
log->Printf("== [ClangExpressionParser::PrepareForExecution] "
|
||||
"Finished installing dynamic checkers ==");
|
||||
LLDB_LOGF(log, "== [ClangExpressionParser::PrepareForExecution] "
|
||||
"Finished installing dynamic checkers ==");
|
||||
}
|
||||
|
||||
if (auto *checker_funcs = llvm::dyn_cast<ClangDynamicCheckerFunctions>(
|
||||
|
|
@ -1316,10 +1311,10 @@ lldb_private::Status ClangExpressionParser::PrepareForExecution(
|
|||
}
|
||||
|
||||
if (custom_passes.LatePasses) {
|
||||
if (log)
|
||||
log->Printf("%s - Running Late IR Passes from LanguageRuntime on "
|
||||
"expression module '%s'",
|
||||
__FUNCTION__, m_expr.FunctionName());
|
||||
LLDB_LOGF(log,
|
||||
"%s - Running Late IR Passes from LanguageRuntime on "
|
||||
"expression module '%s'",
|
||||
__FUNCTION__, m_expr.FunctionName());
|
||||
|
||||
custom_passes.LatePasses->run(*module);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,8 +179,7 @@ ClangFunctionCaller::CompileFunction(lldb::ThreadSP thread_to_use_sp,
|
|||
m_wrapper_function_text.append(");\n}\n");
|
||||
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
|
||||
if (log)
|
||||
log->Printf("Expression: \n\n%s\n\n", m_wrapper_function_text.c_str());
|
||||
LLDB_LOGF(log, "Expression: \n\n%s\n\n", m_wrapper_function_text.c_str());
|
||||
|
||||
// Okay, now compile this expression
|
||||
|
||||
|
|
|
|||
|
|
@ -30,10 +30,10 @@ static bool VerifyClangPath(const llvm::Twine &clang_path) {
|
|||
if (FileSystem::Instance().IsDirectory(clang_path))
|
||||
return true;
|
||||
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
|
||||
if (log)
|
||||
log->Printf("VerifyClangPath(): "
|
||||
"failed to stat clang resource directory at \"%s\"",
|
||||
clang_path.str().c_str());
|
||||
LLDB_LOGF(log,
|
||||
"VerifyClangPath(): "
|
||||
"failed to stat clang resource directory at \"%s\"",
|
||||
clang_path.str().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -67,10 +67,10 @@ static bool DefaultComputeClangResourceDirectory(FileSpec &lldb_shlib_spec,
|
|||
llvm::sys::path::native(relative_path);
|
||||
llvm::sys::path::append(clang_dir, relative_path);
|
||||
if (!verify || VerifyClangPath(clang_dir)) {
|
||||
if (log)
|
||||
log->Printf("DefaultComputeClangResourceDir: Setting ClangResourceDir "
|
||||
"to \"%s\", verify = %s",
|
||||
clang_dir.str().str().c_str(), verify ? "true" : "false");
|
||||
LLDB_LOGF(log,
|
||||
"DefaultComputeClangResourceDir: Setting ClangResourceDir "
|
||||
"to \"%s\", verify = %s",
|
||||
clang_dir.str().str().c_str(), verify ? "true" : "false");
|
||||
file_spec.GetDirectory().SetString(clang_dir);
|
||||
FileSystem::Instance().Resolve(file_spec);
|
||||
return true;
|
||||
|
|
@ -160,9 +160,8 @@ FileSpec lldb_private::GetClangResourceDir() {
|
|||
ComputeClangResourceDirectory(lldb_file_spec, g_cached_resource_dir,
|
||||
true);
|
||||
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
|
||||
if (log)
|
||||
log->Printf("GetClangResourceDir() => '%s'",
|
||||
g_cached_resource_dir.GetPath().c_str());
|
||||
LLDB_LOGF(log, "GetClangResourceDir() => '%s'",
|
||||
g_cached_resource_dir.GetPath().c_str());
|
||||
});
|
||||
return g_cached_resource_dir;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,21 +90,18 @@ ClangUserExpression::~ClangUserExpression() {}
|
|||
void ClangUserExpression::ScanContext(ExecutionContext &exe_ctx, Status &err) {
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
|
||||
|
||||
if (log)
|
||||
log->Printf("ClangUserExpression::ScanContext()");
|
||||
LLDB_LOGF(log, "ClangUserExpression::ScanContext()");
|
||||
|
||||
m_target = exe_ctx.GetTargetPtr();
|
||||
|
||||
if (!(m_allow_cxx || m_allow_objc)) {
|
||||
if (log)
|
||||
log->Printf(" [CUE::SC] Settings inhibit C++ and Objective-C");
|
||||
LLDB_LOGF(log, " [CUE::SC] Settings inhibit C++ and Objective-C");
|
||||
return;
|
||||
}
|
||||
|
||||
StackFrame *frame = exe_ctx.GetFramePtr();
|
||||
if (frame == nullptr) {
|
||||
if (log)
|
||||
log->Printf(" [CUE::SC] Null stack frame");
|
||||
LLDB_LOGF(log, " [CUE::SC] Null stack frame");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -112,8 +109,7 @@ void ClangUserExpression::ScanContext(ExecutionContext &exe_ctx, Status &err) {
|
|||
lldb::eSymbolContextBlock);
|
||||
|
||||
if (!sym_ctx.function) {
|
||||
if (log)
|
||||
log->Printf(" [CUE::SC] Null function");
|
||||
LLDB_LOGF(log, " [CUE::SC] Null function");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -121,16 +117,14 @@ void ClangUserExpression::ScanContext(ExecutionContext &exe_ctx, Status &err) {
|
|||
Block *function_block = sym_ctx.GetFunctionBlock();
|
||||
|
||||
if (!function_block) {
|
||||
if (log)
|
||||
log->Printf(" [CUE::SC] Null function block");
|
||||
LLDB_LOGF(log, " [CUE::SC] Null function block");
|
||||
return;
|
||||
}
|
||||
|
||||
CompilerDeclContext decl_context = function_block->GetDeclContext();
|
||||
|
||||
if (!decl_context) {
|
||||
if (log)
|
||||
log->Printf(" [CUE::SC] Null decl context");
|
||||
LLDB_LOGF(log, " [CUE::SC] Null decl context");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -527,8 +521,7 @@ bool ClangUserExpression::Parse(DiagnosticManager &diagnostic_manager,
|
|||
if (!PrepareForParsing(diagnostic_manager, exe_ctx, /*for_completion*/ false))
|
||||
return false;
|
||||
|
||||
if (log)
|
||||
log->Printf("Parsing the following code:\n%s", m_transformed_text.c_str());
|
||||
LLDB_LOGF(log, "Parsing the following code:\n%s", m_transformed_text.c_str());
|
||||
|
||||
////////////////////////////////////
|
||||
// Set up the target and compiler
|
||||
|
|
@ -726,8 +719,7 @@ bool ClangUserExpression::Complete(ExecutionContext &exe_ctx,
|
|||
if (!PrepareForParsing(diagnostic_manager, exe_ctx, /*for_completion*/ true))
|
||||
return false;
|
||||
|
||||
if (log)
|
||||
log->Printf("Parsing the following code:\n%s", m_transformed_text.c_str());
|
||||
LLDB_LOGF(log, "Parsing the following code:\n%s", m_transformed_text.c_str());
|
||||
|
||||
//////////////////////////
|
||||
// Parse the expression
|
||||
|
|
|
|||
|
|
@ -320,9 +320,8 @@ protected:
|
|||
bool InstrumentInstruction(llvm::Instruction *inst) override {
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
|
||||
|
||||
if (log)
|
||||
log->Printf("Instrumenting load/store instruction: %s\n",
|
||||
PrintValue(inst).c_str());
|
||||
LLDB_LOGF(log, "Instrumenting load/store instruction: %s\n",
|
||||
PrintValue(inst).c_str());
|
||||
|
||||
if (!m_valid_pointer_check_func)
|
||||
m_valid_pointer_check_func =
|
||||
|
|
@ -483,9 +482,8 @@ protected:
|
|||
std::string name_str = called_function->getName().str();
|
||||
const char *name_cstr = name_str.c_str();
|
||||
|
||||
if (log)
|
||||
log->Printf("Found call to %s: %s\n", name_cstr,
|
||||
PrintValue(call_inst).c_str());
|
||||
LLDB_LOGF(log, "Found call to %s: %s\n", name_cstr,
|
||||
PrintValue(call_inst).c_str());
|
||||
|
||||
if (name_str.find("objc_msgSend") == std::string::npos)
|
||||
return true;
|
||||
|
|
@ -520,10 +518,9 @@ protected:
|
|||
return true;
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf(
|
||||
"Function name '%s' contains 'objc_msgSend' but is not handled",
|
||||
name_str.c_str());
|
||||
LLDB_LOGF(log,
|
||||
"Function name '%s' contains 'objc_msgSend' but is not handled",
|
||||
name_str.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -548,8 +545,7 @@ bool IRDynamicChecks::runOnModule(llvm::Module &M) {
|
|||
llvm::Function *function = M.getFunction(StringRef(m_func_name));
|
||||
|
||||
if (!function) {
|
||||
if (log)
|
||||
log->Printf("Couldn't find %s() in the module", m_func_name.c_str());
|
||||
LLDB_LOGF(log, "Couldn't find %s() in the module", m_func_name.c_str());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -582,7 +578,7 @@ bool IRDynamicChecks::runOnModule(llvm::Module &M) {
|
|||
|
||||
oss.flush();
|
||||
|
||||
log->Printf("Module after dynamic checks: \n%s", s.c_str());
|
||||
LLDB_LOGF(log, "Module after dynamic checks: \n%s", s.c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -195,8 +195,7 @@ bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("Result name: \"%s\"", result_name);
|
||||
LLDB_LOGF(log, "Result name: \"%s\"", result_name);
|
||||
|
||||
Value *result_value = m_module->getNamedValue(result_name);
|
||||
|
||||
|
|
@ -211,9 +210,8 @@ bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("Found result in the IR: \"%s\"",
|
||||
PrintValue(result_value, false).c_str());
|
||||
LLDB_LOGF(log, "Found result in the IR: \"%s\"",
|
||||
PrintValue(result_value, false).c_str());
|
||||
|
||||
GlobalVariable *result_global = dyn_cast<GlobalVariable>(result_value);
|
||||
|
||||
|
|
@ -246,7 +244,7 @@ bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) {
|
|||
result_decl->print(decl_desc_stream);
|
||||
decl_desc_stream.flush();
|
||||
|
||||
log->Printf("Found result decl: \"%s\"", decl_desc_str.c_str());
|
||||
LLDB_LOGF(log, "Found result decl: \"%s\"", decl_desc_str.c_str());
|
||||
}
|
||||
|
||||
clang::VarDecl *result_var = dyn_cast<clang::VarDecl>(result_decl);
|
||||
|
|
@ -316,8 +314,7 @@ bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) {
|
|||
lldb_private::StreamString type_desc_stream;
|
||||
m_result_type.DumpTypeDescription(&type_desc_stream);
|
||||
|
||||
if (log)
|
||||
log->Printf("Result type has unknown size");
|
||||
LLDB_LOGF(log, "Result type has unknown size");
|
||||
|
||||
m_error_stream.Printf("Error [IRForTarget]: Size of result type '%s' "
|
||||
"couldn't be determined\n",
|
||||
|
|
@ -329,15 +326,14 @@ bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) {
|
|||
lldb_private::StreamString type_desc_stream;
|
||||
m_result_type.DumpTypeDescription(&type_desc_stream);
|
||||
|
||||
log->Printf("Result decl type: \"%s\"", type_desc_stream.GetData());
|
||||
LLDB_LOGF(log, "Result decl type: \"%s\"", type_desc_stream.GetData());
|
||||
}
|
||||
|
||||
m_result_name = lldb_private::ConstString("$RESULT_NAME");
|
||||
|
||||
if (log)
|
||||
log->Printf("Creating a new result global: \"%s\" with size 0x%" PRIx64,
|
||||
m_result_name.GetCString(),
|
||||
m_result_type.GetByteSize(nullptr).getValueOr(0));
|
||||
LLDB_LOGF(log, "Creating a new result global: \"%s\" with size 0x%" PRIx64,
|
||||
m_result_name.GetCString(),
|
||||
m_result_type.GetByteSize(nullptr).getValueOr(0));
|
||||
|
||||
// Construct a new result global and set up its metadata
|
||||
|
||||
|
|
@ -369,10 +365,9 @@ bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) {
|
|||
m_module->getNamedMetadata("clang.global.decl.ptrs");
|
||||
named_metadata->addOperand(persistent_global_md);
|
||||
|
||||
if (log)
|
||||
log->Printf("Replacing \"%s\" with \"%s\"",
|
||||
PrintValue(result_global).c_str(),
|
||||
PrintValue(new_result_global).c_str());
|
||||
LLDB_LOGF(log, "Replacing \"%s\" with \"%s\"",
|
||||
PrintValue(result_global).c_str(),
|
||||
PrintValue(new_result_global).c_str());
|
||||
|
||||
if (result_global->use_empty()) {
|
||||
// We need to synthesize a store for this variable, because otherwise
|
||||
|
|
@ -385,8 +380,7 @@ bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) {
|
|||
return false;
|
||||
|
||||
if (!result_global->hasInitializer()) {
|
||||
if (log)
|
||||
log->Printf("Couldn't find initializer for unused variable");
|
||||
LLDB_LOGF(log, "Couldn't find initializer for unused variable");
|
||||
|
||||
m_error_stream.Printf("Internal error [IRForTarget]: Result variable "
|
||||
"(%s) has no writes and no initializer\n",
|
||||
|
|
@ -400,9 +394,8 @@ bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) {
|
|||
StoreInst *synthesized_store =
|
||||
new StoreInst(initializer, new_result_global, first_entry_instruction);
|
||||
|
||||
if (log)
|
||||
log->Printf("Synthesized result store \"%s\"\n",
|
||||
PrintValue(synthesized_store).c_str());
|
||||
LLDB_LOGF(log, "Synthesized result store \"%s\"\n",
|
||||
PrintValue(synthesized_store).c_str());
|
||||
} else {
|
||||
result_global->replaceAllUsesWith(new_result_global);
|
||||
}
|
||||
|
|
@ -438,7 +431,6 @@ bool IRForTarget::RewriteObjCConstString(llvm::GlobalVariable *ns_str,
|
|||
m_execution_unit.FindSymbol(g_CFStringCreateWithBytes_str,
|
||||
missing_weak);
|
||||
if (CFStringCreateWithBytes_addr == LLDB_INVALID_ADDRESS || missing_weak) {
|
||||
if (log)
|
||||
log->PutCString("Couldn't find CFStringCreateWithBytes in the target");
|
||||
|
||||
m_error_stream.Printf("Error [IRForTarget]: Rewriting an Objective-C "
|
||||
|
|
@ -448,9 +440,8 @@ bool IRForTarget::RewriteObjCConstString(llvm::GlobalVariable *ns_str,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("Found CFStringCreateWithBytes at 0x%" PRIx64,
|
||||
CFStringCreateWithBytes_addr);
|
||||
LLDB_LOGF(log, "Found CFStringCreateWithBytes at 0x%" PRIx64,
|
||||
CFStringCreateWithBytes_addr);
|
||||
|
||||
// Build the function type:
|
||||
//
|
||||
|
|
@ -622,9 +613,10 @@ bool IRForTarget::RewriteObjCConstStrings() {
|
|||
|
||||
if (nsstring_struct->getNumOperands() != 4) {
|
||||
if (log)
|
||||
log->Printf("NSString variable's initializer structure has an "
|
||||
"unexpected number of members. Should be 4, is %d",
|
||||
nsstring_struct->getNumOperands());
|
||||
LLDB_LOGF(log,
|
||||
"NSString variable's initializer structure has an "
|
||||
"unexpected number of members. Should be 4, is %d",
|
||||
nsstring_struct->getNumOperands());
|
||||
|
||||
m_error_stream.Printf("Internal error [IRForTarget]: The struct for an "
|
||||
"Objective-C constant string is not as "
|
||||
|
|
@ -728,11 +720,11 @@ bool IRForTarget::RewriteObjCConstStrings() {
|
|||
|
||||
if (log) {
|
||||
if (cstr_array)
|
||||
log->Printf("Found NSString constant %s, which contains \"%s\"",
|
||||
value_name_cstr, cstr_array->getAsString().str().c_str());
|
||||
LLDB_LOGF(log, "Found NSString constant %s, which contains \"%s\"",
|
||||
value_name_cstr, cstr_array->getAsString().str().c_str());
|
||||
else
|
||||
log->Printf("Found NSString constant %s, which contains \"\"",
|
||||
value_name_cstr);
|
||||
LLDB_LOGF(log, "Found NSString constant %s, which contains \"\"",
|
||||
value_name_cstr);
|
||||
}
|
||||
|
||||
if (!cstr_array)
|
||||
|
|
@ -851,8 +843,8 @@ bool IRForTarget::RewriteObjCSelector(Instruction *selector_load) {
|
|||
std::string omvn_initializer_string = omvn_initializer_array->getAsString();
|
||||
|
||||
if (log)
|
||||
log->Printf("Found Objective-C selector reference \"%s\"",
|
||||
omvn_initializer_string.c_str());
|
||||
LLDB_LOGF(log, "Found Objective-C selector reference \"%s\"",
|
||||
omvn_initializer_string.c_str());
|
||||
|
||||
// Construct a call to sel_registerName
|
||||
|
||||
|
|
@ -867,8 +859,8 @@ bool IRForTarget::RewriteObjCSelector(Instruction *selector_load) {
|
|||
return false;
|
||||
|
||||
if (log)
|
||||
log->Printf("Found sel_registerName at 0x%" PRIx64,
|
||||
sel_registerName_addr);
|
||||
LLDB_LOGF(log, "Found sel_registerName at 0x%" PRIx64,
|
||||
sel_registerName_addr);
|
||||
|
||||
// Build the function type: struct objc_selector
|
||||
// *sel_registerName(uint8_t*)
|
||||
|
|
@ -1023,8 +1015,8 @@ bool IRForTarget::RewriteObjCClassReference(Instruction *class_load) {
|
|||
std::string ocn_initializer_string = ocn_initializer_array->getAsString();
|
||||
|
||||
if (log)
|
||||
log->Printf("Found Objective-C class reference \"%s\"",
|
||||
ocn_initializer_string.c_str());
|
||||
LLDB_LOGF(log, "Found Objective-C class reference \"%s\"",
|
||||
ocn_initializer_string.c_str());
|
||||
|
||||
// Construct a call to objc_getClass
|
||||
|
||||
|
|
@ -1039,8 +1031,7 @@ bool IRForTarget::RewriteObjCClassReference(Instruction *class_load) {
|
|||
return false;
|
||||
|
||||
if (log)
|
||||
log->Printf("Found objc_getClass at 0x%" PRIx64,
|
||||
objc_getClass_addr);
|
||||
LLDB_LOGF(log, "Found objc_getClass at 0x%" PRIx64, objc_getClass_addr);
|
||||
|
||||
// Build the function type: %struct._objc_class *objc_getClass(i8*)
|
||||
|
||||
|
|
@ -1181,8 +1172,8 @@ bool IRForTarget::RewritePersistentAlloc(llvm::Instruction *persistent_alloc) {
|
|||
LoadInst *persistent_load = new LoadInst(persistent_global, "", alloc);
|
||||
|
||||
if (log)
|
||||
log->Printf("Replacing \"%s\" with \"%s\"", PrintValue(alloc).c_str(),
|
||||
PrintValue(persistent_load).c_str());
|
||||
LLDB_LOGF(log, "Replacing \"%s\" with \"%s\"", PrintValue(alloc).c_str(),
|
||||
PrintValue(persistent_load).c_str());
|
||||
|
||||
alloc->replaceAllUsesWith(persistent_load);
|
||||
alloc->eraseFromParent();
|
||||
|
|
@ -1213,7 +1204,7 @@ bool IRForTarget::RewritePersistentAllocs(llvm::BasicBlock &basic_block) {
|
|||
if (alloc_name.startswith("$") && !alloc_name.startswith("$__lldb")) {
|
||||
if (alloc_name.find_first_of("0123456789") == 1) {
|
||||
if (log)
|
||||
log->Printf("Rejecting a numeric persistent variable.");
|
||||
LLDB_LOGF(log, "Rejecting a numeric persistent variable.");
|
||||
|
||||
m_error_stream.Printf("Error [IRForTarget]: Names starting with $0, "
|
||||
"$1, ... are reserved for use as result "
|
||||
|
|
@ -1253,8 +1244,8 @@ bool IRForTarget::MaterializeInitializer(uint8_t *data, Constant *initializer) {
|
|||
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
|
||||
|
||||
if (log && log->GetVerbose())
|
||||
log->Printf(" MaterializeInitializer(%p, %s)", (void *)data,
|
||||
PrintValue(initializer).c_str());
|
||||
LLDB_LOGF(log, " MaterializeInitializer(%p, %s)", (void *)data,
|
||||
PrintValue(initializer).c_str());
|
||||
|
||||
Type *initializer_type = initializer->getType();
|
||||
|
||||
|
|
@ -1317,7 +1308,8 @@ bool IRForTarget::MaybeHandleVariable(Value *llvm_value_ptr) {
|
|||
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
|
||||
|
||||
if (log)
|
||||
log->Printf("MaybeHandleVariable (%s)", PrintValue(llvm_value_ptr).c_str());
|
||||
LLDB_LOGF(log, "MaybeHandleVariable (%s)",
|
||||
PrintValue(llvm_value_ptr).c_str());
|
||||
|
||||
if (ConstantExpr *constant_expr = dyn_cast<ConstantExpr>(llvm_value_ptr)) {
|
||||
switch (constant_expr->getOpcode()) {
|
||||
|
|
@ -1344,8 +1336,8 @@ bool IRForTarget::MaybeHandleVariable(Value *llvm_value_ptr) {
|
|||
return true;
|
||||
|
||||
if (log)
|
||||
log->Printf("Found global variable \"%s\" without metadata",
|
||||
global_variable->getName().str().c_str());
|
||||
LLDB_LOGF(log, "Found global variable \"%s\" without metadata",
|
||||
global_variable->getName().str().c_str());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1385,13 +1377,14 @@ bool IRForTarget::MaybeHandleVariable(Value *llvm_value_ptr) {
|
|||
(compiler_type.GetTypeBitAlign() + 7ull) / 8ull;
|
||||
|
||||
if (log) {
|
||||
log->Printf("Type of \"%s\" is [clang \"%s\", llvm \"%s\"] [size %" PRIu64
|
||||
", align %" PRIu64 "]",
|
||||
name.c_str(),
|
||||
lldb_private::ClangUtil::GetQualType(compiler_type)
|
||||
.getAsString()
|
||||
.c_str(),
|
||||
PrintType(value_type).c_str(), *value_size, value_alignment);
|
||||
LLDB_LOGF(log,
|
||||
"Type of \"%s\" is [clang \"%s\", llvm \"%s\"] [size %" PRIu64
|
||||
", align %" PRIu64 "]",
|
||||
name.c_str(),
|
||||
lldb_private::ClangUtil::GetQualType(compiler_type)
|
||||
.getAsString()
|
||||
.c_str(),
|
||||
PrintType(value_type).c_str(), *value_size, value_alignment);
|
||||
}
|
||||
|
||||
if (named_decl &&
|
||||
|
|
@ -1405,7 +1398,7 @@ bool IRForTarget::MaybeHandleVariable(Value *llvm_value_ptr) {
|
|||
}
|
||||
} else if (dyn_cast<llvm::Function>(llvm_value_ptr)) {
|
||||
if (log)
|
||||
log->Printf("Function pointers aren't handled right now");
|
||||
LLDB_LOGF(log, "Function pointers aren't handled right now");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1425,13 +1418,14 @@ bool IRForTarget::HandleSymbol(Value *symbol) {
|
|||
|
||||
if (symbol_addr == LLDB_INVALID_ADDRESS) {
|
||||
if (log)
|
||||
log->Printf("Symbol \"%s\" had no address", name.GetCString());
|
||||
LLDB_LOGF(log, "Symbol \"%s\" had no address", name.GetCString());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("Found \"%s\" at 0x%" PRIx64, name.GetCString(), symbol_addr);
|
||||
LLDB_LOGF(log, "Found \"%s\" at 0x%" PRIx64, name.GetCString(),
|
||||
symbol_addr);
|
||||
|
||||
Type *symbol_type = symbol->getType();
|
||||
|
||||
|
|
@ -1441,8 +1435,8 @@ bool IRForTarget::HandleSymbol(Value *symbol) {
|
|||
ConstantExpr::getIntToPtr(symbol_addr_int, symbol_type);
|
||||
|
||||
if (log)
|
||||
log->Printf("Replacing %s with %s", PrintValue(symbol).c_str(),
|
||||
PrintValue(symbol_addr_ptr).c_str());
|
||||
LLDB_LOGF(log, "Replacing %s with %s", PrintValue(symbol).c_str(),
|
||||
PrintValue(symbol_addr_ptr).c_str());
|
||||
|
||||
symbol->replaceAllUsesWith(symbol_addr_ptr);
|
||||
|
||||
|
|
@ -1454,7 +1448,7 @@ bool IRForTarget::MaybeHandleCallArguments(CallInst *Old) {
|
|||
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
|
||||
|
||||
if (log)
|
||||
log->Printf("MaybeHandleCallArguments(%s)", PrintValue(Old).c_str());
|
||||
LLDB_LOGF(log, "MaybeHandleCallArguments(%s)", PrintValue(Old).c_str());
|
||||
|
||||
for (unsigned op_index = 0, num_ops = Old->getNumArgOperands();
|
||||
op_index < num_ops; ++op_index)
|
||||
|
|
@ -1494,8 +1488,8 @@ bool IRForTarget::HandleObjCClass(Value *classlist_reference) {
|
|||
m_decl_map->GetSymbolAddress(name_cstr, lldb::eSymbolTypeObjCClass);
|
||||
|
||||
if (log)
|
||||
log->Printf("Found reference to Objective-C class %s (0x%llx)",
|
||||
name_cstr.AsCString(), (unsigned long long)class_ptr);
|
||||
LLDB_LOGF(log, "Found reference to Objective-C class %s (0x%llx)",
|
||||
name_cstr.AsCString(), (unsigned long long)class_ptr);
|
||||
|
||||
if (class_ptr == LLDB_INVALID_ADDRESS)
|
||||
return false;
|
||||
|
|
@ -1594,9 +1588,9 @@ bool IRForTarget::ResolveExternals(Function &llvm_function) {
|
|||
std::string global_name = global_var.getName().str();
|
||||
|
||||
if (log)
|
||||
log->Printf("Examining %s, DeclForGlobalValue returns %p",
|
||||
global_name.c_str(),
|
||||
static_cast<void *>(DeclForGlobal(&global_var)));
|
||||
LLDB_LOGF(log, "Examining %s, DeclForGlobalValue returns %p",
|
||||
global_name.c_str(),
|
||||
static_cast<void *>(DeclForGlobal(&global_var)));
|
||||
|
||||
if (global_name.find("OBJC_IVAR") == 0) {
|
||||
if (!HandleSymbol(&global_var)) {
|
||||
|
|
@ -1838,7 +1832,7 @@ bool IRForTarget::ReplaceVariables(Function &llvm_function) {
|
|||
m_decl_map->DoStructLayout();
|
||||
|
||||
if (log)
|
||||
log->Printf("Element arrangement:");
|
||||
LLDB_LOGF(log, "Element arrangement:");
|
||||
|
||||
uint32_t num_elements;
|
||||
uint32_t element_index;
|
||||
|
|
@ -1913,7 +1907,7 @@ bool IRForTarget::ReplaceVariables(Function &llvm_function) {
|
|||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("Arg: \"%s\"", PrintValue(argument).c_str());
|
||||
LLDB_LOGF(log, "Arg: \"%s\"", PrintValue(argument).c_str());
|
||||
|
||||
BasicBlock &entry_block(llvm_function.getEntryBlock());
|
||||
Instruction *FirstEntryInstruction(entry_block.getFirstNonPHIOrDbg());
|
||||
|
|
@ -1951,12 +1945,12 @@ bool IRForTarget::ReplaceVariables(Function &llvm_function) {
|
|||
}
|
||||
|
||||
if (log)
|
||||
log->Printf(" \"%s\" (\"%s\") placed at %" PRIu64, name.GetCString(),
|
||||
decl->getNameAsString().c_str(), offset);
|
||||
LLDB_LOGF(log, " \"%s\" (\"%s\") placed at %" PRIu64, name.GetCString(),
|
||||
decl->getNameAsString().c_str(), offset);
|
||||
|
||||
if (value) {
|
||||
if (log)
|
||||
log->Printf(" Replacing [%s]", PrintValue(value).c_str());
|
||||
LLDB_LOGF(log, " Replacing [%s]", PrintValue(value).c_str());
|
||||
|
||||
FunctionValueCache body_result_maker(
|
||||
[this, name, offset_type, offset, argument,
|
||||
|
|
@ -2006,8 +2000,8 @@ bool IRForTarget::ReplaceVariables(Function &llvm_function) {
|
|||
body_result_maker.GetValue(instruction->getParent()->getParent()));
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("Unhandled non-constant type: \"%s\"",
|
||||
PrintValue(value).c_str());
|
||||
LLDB_LOGF(log, "Unhandled non-constant type: \"%s\"",
|
||||
PrintValue(value).c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -2017,8 +2011,8 @@ bool IRForTarget::ReplaceVariables(Function &llvm_function) {
|
|||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("Total structure [align %" PRId64 ", size %" PRIu64 "]",
|
||||
(int64_t)alignment, (uint64_t)size);
|
||||
LLDB_LOGF(log, "Total structure [align %" PRId64 ", size %" PRIu64 "]",
|
||||
(int64_t)alignment, (uint64_t)size);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2062,7 +2056,7 @@ bool IRForTarget::runOnModule(Module &llvm_module) {
|
|||
|
||||
oss.flush();
|
||||
|
||||
log->Printf("Module as passed in to IRForTarget: \n\"%s\"", s.c_str());
|
||||
LLDB_LOGF(log, "Module as passed in to IRForTarget: \n\"%s\"", s.c_str());
|
||||
}
|
||||
|
||||
Function *const main_function =
|
||||
|
|
@ -2071,8 +2065,8 @@ bool IRForTarget::runOnModule(Module &llvm_module) {
|
|||
|
||||
if (!m_func_name.IsEmpty() && !main_function) {
|
||||
if (log)
|
||||
log->Printf("Couldn't find \"%s()\" in the module",
|
||||
m_func_name.AsCString());
|
||||
LLDB_LOGF(log, "Couldn't find \"%s()\" in the module",
|
||||
m_func_name.AsCString());
|
||||
|
||||
m_error_stream.Printf("Internal error [IRForTarget]: Couldn't find wrapper "
|
||||
"'%s' in the module",
|
||||
|
|
@ -2084,7 +2078,7 @@ bool IRForTarget::runOnModule(Module &llvm_module) {
|
|||
if (main_function) {
|
||||
if (!FixFunctionLinkage(*main_function)) {
|
||||
if (log)
|
||||
log->Printf("Couldn't fix the linkage for the function");
|
||||
LLDB_LOGF(log, "Couldn't fix the linkage for the function");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -2105,7 +2099,7 @@ bool IRForTarget::runOnModule(Module &llvm_module) {
|
|||
if (main_function) {
|
||||
if (!CreateResultVariable(*main_function)) {
|
||||
if (log)
|
||||
log->Printf("CreateResultVariable() failed");
|
||||
LLDB_LOGF(log, "CreateResultVariable() failed");
|
||||
|
||||
// CreateResultVariable() reports its own errors, so we don't do so here
|
||||
|
||||
|
|
@ -2121,8 +2115,8 @@ bool IRForTarget::runOnModule(Module &llvm_module) {
|
|||
|
||||
oss.flush();
|
||||
|
||||
log->Printf("Module after creating the result variable: \n\"%s\"",
|
||||
s.c_str());
|
||||
LLDB_LOGF(log, "Module after creating the result variable: \n\"%s\"",
|
||||
s.c_str());
|
||||
}
|
||||
|
||||
for (Module::iterator fi = m_module->begin(), fe = m_module->end(); fi != fe;
|
||||
|
|
@ -2137,7 +2131,7 @@ bool IRForTarget::runOnModule(Module &llvm_module) {
|
|||
for (bbi = function->begin(); bbi != function->end(); ++bbi) {
|
||||
if (!RemoveGuards(*bbi)) {
|
||||
if (log)
|
||||
log->Printf("RemoveGuards() failed");
|
||||
LLDB_LOGF(log, "RemoveGuards() failed");
|
||||
|
||||
// RemoveGuards() reports its own errors, so we don't do so here
|
||||
|
||||
|
|
@ -2146,7 +2140,7 @@ bool IRForTarget::runOnModule(Module &llvm_module) {
|
|||
|
||||
if (!RewritePersistentAllocs(*bbi)) {
|
||||
if (log)
|
||||
log->Printf("RewritePersistentAllocs() failed");
|
||||
LLDB_LOGF(log, "RewritePersistentAllocs() failed");
|
||||
|
||||
// RewritePersistentAllocs() reports its own errors, so we don't do so
|
||||
// here
|
||||
|
|
@ -2156,7 +2150,7 @@ bool IRForTarget::runOnModule(Module &llvm_module) {
|
|||
|
||||
if (!RemoveCXAAtExit(*bbi)) {
|
||||
if (log)
|
||||
log->Printf("RemoveCXAAtExit() failed");
|
||||
LLDB_LOGF(log, "RemoveCXAAtExit() failed");
|
||||
|
||||
// RemoveCXAAtExit() reports its own errors, so we don't do so here
|
||||
|
||||
|
|
@ -2171,7 +2165,7 @@ bool IRForTarget::runOnModule(Module &llvm_module) {
|
|||
|
||||
if (!RewriteObjCConstStrings()) {
|
||||
if (log)
|
||||
log->Printf("RewriteObjCConstStrings() failed");
|
||||
LLDB_LOGF(log, "RewriteObjCConstStrings() failed");
|
||||
|
||||
// RewriteObjCConstStrings() reports its own errors, so we don't do so here
|
||||
|
||||
|
|
@ -2187,7 +2181,7 @@ bool IRForTarget::runOnModule(Module &llvm_module) {
|
|||
bbi != bbe; ++bbi) {
|
||||
if (!RewriteObjCSelectors(*bbi)) {
|
||||
if (log)
|
||||
log->Printf("RewriteObjCSelectors() failed");
|
||||
LLDB_LOGF(log, "RewriteObjCSelectors() failed");
|
||||
|
||||
// RewriteObjCSelectors() reports its own errors, so we don't do so
|
||||
// here
|
||||
|
|
@ -2197,7 +2191,7 @@ bool IRForTarget::runOnModule(Module &llvm_module) {
|
|||
|
||||
if (!RewriteObjCClassReferences(*bbi)) {
|
||||
if (log)
|
||||
log->Printf("RewriteObjCClassReferences() failed");
|
||||
LLDB_LOGF(log, "RewriteObjCClassReferences() failed");
|
||||
|
||||
// RewriteObjCClasses() reports its own errors, so we don't do so here
|
||||
|
||||
|
|
@ -2215,7 +2209,7 @@ bool IRForTarget::runOnModule(Module &llvm_module) {
|
|||
bbi != bbe; ++bbi) {
|
||||
if (!ResolveCalls(*bbi)) {
|
||||
if (log)
|
||||
log->Printf("ResolveCalls() failed");
|
||||
LLDB_LOGF(log, "ResolveCalls() failed");
|
||||
|
||||
// ResolveCalls() reports its own errors, so we don't do so here
|
||||
|
||||
|
|
@ -2231,7 +2225,7 @@ bool IRForTarget::runOnModule(Module &llvm_module) {
|
|||
if (main_function) {
|
||||
if (!ResolveExternals(*main_function)) {
|
||||
if (log)
|
||||
log->Printf("ResolveExternals() failed");
|
||||
LLDB_LOGF(log, "ResolveExternals() failed");
|
||||
|
||||
// ResolveExternals() reports its own errors, so we don't do so here
|
||||
|
||||
|
|
@ -2240,7 +2234,7 @@ bool IRForTarget::runOnModule(Module &llvm_module) {
|
|||
|
||||
if (!ReplaceVariables(*main_function)) {
|
||||
if (log)
|
||||
log->Printf("ReplaceVariables() failed");
|
||||
LLDB_LOGF(log, "ReplaceVariables() failed");
|
||||
|
||||
// ReplaceVariables() reports its own errors, so we don't do so here
|
||||
|
||||
|
|
@ -2256,7 +2250,7 @@ bool IRForTarget::runOnModule(Module &llvm_module) {
|
|||
|
||||
oss.flush();
|
||||
|
||||
log->Printf("Module after preparing for execution: \n\"%s\"", s.c_str());
|
||||
LLDB_LOGF(log, "Module after preparing for execution: \n\"%s\"", s.c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -177,8 +177,8 @@ void JITLoaderGDB::SetJITBreakpoint(lldb_private::ModuleList &module_list) {
|
|||
return;
|
||||
|
||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_JIT_LOADER));
|
||||
if (log)
|
||||
log->Printf("JITLoaderGDB::%s looking for JIT register hook", __FUNCTION__);
|
||||
LLDB_LOGF(log, "JITLoaderGDB::%s looking for JIT register hook",
|
||||
__FUNCTION__);
|
||||
|
||||
addr_t jit_addr = GetSymbolAddress(
|
||||
module_list, ConstString("__jit_debug_register_code"), eSymbolTypeAny);
|
||||
|
|
@ -188,14 +188,12 @@ void JITLoaderGDB::SetJITBreakpoint(lldb_private::ModuleList &module_list) {
|
|||
m_jit_descriptor_addr = GetSymbolAddress(
|
||||
module_list, ConstString("__jit_debug_descriptor"), eSymbolTypeData);
|
||||
if (m_jit_descriptor_addr == LLDB_INVALID_ADDRESS) {
|
||||
if (log)
|
||||
log->Printf("JITLoaderGDB::%s failed to find JIT descriptor address",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log, "JITLoaderGDB::%s failed to find JIT descriptor address",
|
||||
__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("JITLoaderGDB::%s setting JIT breakpoint", __FUNCTION__);
|
||||
LLDB_LOGF(log, "JITLoaderGDB::%s setting JIT breakpoint", __FUNCTION__);
|
||||
|
||||
Breakpoint *bp =
|
||||
m_process->GetTarget().CreateBreakpoint(jit_addr, true, false).get();
|
||||
|
|
@ -211,8 +209,7 @@ bool JITLoaderGDB::JITDebugBreakpointHit(void *baton,
|
|||
user_id_t break_id,
|
||||
user_id_t break_loc_id) {
|
||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_JIT_LOADER));
|
||||
if (log)
|
||||
log->Printf("JITLoaderGDB::%s hit JIT breakpoint", __FUNCTION__);
|
||||
LLDB_LOGF(log, "JITLoaderGDB::%s hit JIT breakpoint", __FUNCTION__);
|
||||
JITLoaderGDB *instance = static_cast<JITLoaderGDB *>(baton);
|
||||
return instance->ReadJITDescriptor(false);
|
||||
}
|
||||
|
|
@ -285,9 +282,8 @@ bool JITLoaderGDB::ReadJITDescriptorImpl(bool all_entries) {
|
|||
size_t bytes_read = m_process->DoReadMemory(m_jit_descriptor_addr, &jit_desc,
|
||||
jit_desc_size, error);
|
||||
if (bytes_read != jit_desc_size || !error.Success()) {
|
||||
if (log)
|
||||
log->Printf("JITLoaderGDB::%s failed to read JIT descriptor",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log, "JITLoaderGDB::%s failed to read JIT descriptor",
|
||||
__FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -301,9 +297,8 @@ bool JITLoaderGDB::ReadJITDescriptorImpl(bool all_entries) {
|
|||
while (jit_relevant_entry != 0) {
|
||||
jit_code_entry<ptr_t> jit_entry;
|
||||
if (!ReadJITEntry(jit_relevant_entry, m_process, &jit_entry)) {
|
||||
if (log)
|
||||
log->Printf("JITLoaderGDB::%s failed to read JIT entry at 0x%" PRIx64,
|
||||
__FUNCTION__, jit_relevant_entry);
|
||||
LLDB_LOGF(log, "JITLoaderGDB::%s failed to read JIT entry at 0x%" PRIx64,
|
||||
__FUNCTION__, jit_relevant_entry);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -312,10 +307,10 @@ bool JITLoaderGDB::ReadJITDescriptorImpl(bool all_entries) {
|
|||
ModuleSP module_sp;
|
||||
|
||||
if (jit_action == JIT_REGISTER_FN) {
|
||||
if (log)
|
||||
log->Printf("JITLoaderGDB::%s registering JIT entry at 0x%" PRIx64
|
||||
" (%" PRIu64 " bytes)",
|
||||
__FUNCTION__, symbolfile_addr, (uint64_t)symbolfile_size);
|
||||
LLDB_LOGF(log,
|
||||
"JITLoaderGDB::%s registering JIT entry at 0x%" PRIx64
|
||||
" (%" PRIu64 " bytes)",
|
||||
__FUNCTION__, symbolfile_addr, (uint64_t)symbolfile_size);
|
||||
|
||||
char jit_name[64];
|
||||
snprintf(jit_name, 64, "JIT(0x%" PRIx64 ")", symbolfile_addr);
|
||||
|
|
@ -357,15 +352,14 @@ bool JITLoaderGDB::ReadJITDescriptorImpl(bool all_entries) {
|
|||
module_list.Append(module_sp);
|
||||
target.ModulesDidLoad(module_list);
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("JITLoaderGDB::%s failed to load module for "
|
||||
"JIT entry at 0x%" PRIx64,
|
||||
__FUNCTION__, symbolfile_addr);
|
||||
LLDB_LOGF(log,
|
||||
"JITLoaderGDB::%s failed to load module for "
|
||||
"JIT entry at 0x%" PRIx64,
|
||||
__FUNCTION__, symbolfile_addr);
|
||||
}
|
||||
} else if (jit_action == JIT_UNREGISTER_FN) {
|
||||
if (log)
|
||||
log->Printf("JITLoaderGDB::%s unregistering JIT entry at 0x%" PRIx64,
|
||||
__FUNCTION__, symbolfile_addr);
|
||||
LLDB_LOGF(log, "JITLoaderGDB::%s unregistering JIT entry at 0x%" PRIx64,
|
||||
__FUNCTION__, symbolfile_addr);
|
||||
|
||||
JITObjectMap::iterator it = m_jit_objects.find(symbolfile_addr);
|
||||
if (it != m_jit_objects.end()) {
|
||||
|
|
|
|||
|
|
@ -79,11 +79,10 @@ TypeAndOrName ItaniumABILanguageRuntime::GetTypeInfoFromVTableAddress(
|
|||
if (name && strstr(name, vtable_demangled_prefix) == name) {
|
||||
Log *log(
|
||||
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
|
||||
if (log)
|
||||
log->Printf("0x%16.16" PRIx64
|
||||
": static-type = '%s' has vtable symbol '%s'\n",
|
||||
original_ptr, in_value.GetTypeName().GetCString(),
|
||||
name);
|
||||
LLDB_LOGF(log,
|
||||
"0x%16.16" PRIx64
|
||||
": static-type = '%s' has vtable symbol '%s'\n",
|
||||
original_ptr, in_value.GetTypeName().GetCString(), name);
|
||||
// We are a C++ class, that's good. Get the class name and look it
|
||||
// up:
|
||||
const char *class_name = name + strlen(vtable_demangled_prefix);
|
||||
|
|
@ -116,9 +115,8 @@ TypeAndOrName ItaniumABILanguageRuntime::GetTypeInfoFromVTableAddress(
|
|||
|
||||
lldb::TypeSP type_sp;
|
||||
if (num_matches == 0) {
|
||||
if (log)
|
||||
log->Printf("0x%16.16" PRIx64 ": is not dynamic\n",
|
||||
original_ptr);
|
||||
LLDB_LOGF(log, "0x%16.16" PRIx64 ": is not dynamic\n",
|
||||
original_ptr);
|
||||
return TypeAndOrName();
|
||||
}
|
||||
if (num_matches == 1) {
|
||||
|
|
@ -126,13 +124,13 @@ TypeAndOrName ItaniumABILanguageRuntime::GetTypeInfoFromVTableAddress(
|
|||
if (type_sp) {
|
||||
if (ClangASTContext::IsCXXClassType(
|
||||
type_sp->GetForwardCompilerType())) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"0x%16.16" PRIx64
|
||||
": static-type = '%s' has dynamic type: uid={0x%" PRIx64
|
||||
"}, type-name='%s'\n",
|
||||
original_ptr, in_value.GetTypeName().AsCString(),
|
||||
type_sp->GetID(), type_sp->GetName().GetCString());
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"0x%16.16" PRIx64
|
||||
": static-type = '%s' has dynamic type: uid={0x%" PRIx64
|
||||
"}, type-name='%s'\n",
|
||||
original_ptr, in_value.GetTypeName().AsCString(),
|
||||
type_sp->GetID(), type_sp->GetName().GetCString());
|
||||
type_info.SetTypeSP(type_sp);
|
||||
}
|
||||
}
|
||||
|
|
@ -142,13 +140,13 @@ TypeAndOrName ItaniumABILanguageRuntime::GetTypeInfoFromVTableAddress(
|
|||
for (i = 0; i < num_matches; i++) {
|
||||
type_sp = class_types.GetTypeAtIndex(i);
|
||||
if (type_sp) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"0x%16.16" PRIx64
|
||||
": static-type = '%s' has multiple matching dynamic "
|
||||
"types: uid={0x%" PRIx64 "}, type-name='%s'\n",
|
||||
original_ptr, in_value.GetTypeName().AsCString(),
|
||||
type_sp->GetID(), type_sp->GetName().GetCString());
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"0x%16.16" PRIx64
|
||||
": static-type = '%s' has multiple matching dynamic "
|
||||
"types: uid={0x%" PRIx64 "}, type-name='%s'\n",
|
||||
original_ptr, in_value.GetTypeName().AsCString(),
|
||||
type_sp->GetID(), type_sp->GetName().GetCString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -158,25 +156,24 @@ TypeAndOrName ItaniumABILanguageRuntime::GetTypeInfoFromVTableAddress(
|
|||
if (type_sp) {
|
||||
if (ClangASTContext::IsCXXClassType(
|
||||
type_sp->GetForwardCompilerType())) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"0x%16.16" PRIx64 ": static-type = '%s' has multiple "
|
||||
"matching dynamic types, picking "
|
||||
"this one: uid={0x%" PRIx64
|
||||
"}, type-name='%s'\n",
|
||||
original_ptr, in_value.GetTypeName().AsCString(),
|
||||
type_sp->GetID(), type_sp->GetName().GetCString());
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"0x%16.16" PRIx64 ": static-type = '%s' has multiple "
|
||||
"matching dynamic types, picking "
|
||||
"this one: uid={0x%" PRIx64 "}, type-name='%s'\n",
|
||||
original_ptr, in_value.GetTypeName().AsCString(),
|
||||
type_sp->GetID(), type_sp->GetName().GetCString());
|
||||
type_info.SetTypeSP(type_sp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (log && i == num_matches) {
|
||||
log->Printf(
|
||||
"0x%16.16" PRIx64
|
||||
": static-type = '%s' has multiple matching dynamic "
|
||||
"types, didn't find a C++ match\n",
|
||||
original_ptr, 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",
|
||||
original_ptr, in_value.GetTypeName().AsCString());
|
||||
}
|
||||
}
|
||||
if (type_info)
|
||||
|
|
|
|||
|
|
@ -38,12 +38,13 @@ public:
|
|||
LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
|
||||
|
||||
if (log) {
|
||||
log->Printf("AppleObjCExternalASTSource::FindExternalVisibleDeclsByName[%"
|
||||
"u] on (ASTContext*)%p Looking for %s in (%sDecl*)%p",
|
||||
current_id,
|
||||
static_cast<void *>(&decl_ctx->getParentASTContext()),
|
||||
name.getAsString().c_str(), decl_ctx->getDeclKindName(),
|
||||
static_cast<const void *>(decl_ctx));
|
||||
LLDB_LOGF(log,
|
||||
"AppleObjCExternalASTSource::FindExternalVisibleDeclsByName[%"
|
||||
"u] on (ASTContext*)%p Looking for %s in (%sDecl*)%p",
|
||||
current_id,
|
||||
static_cast<void *>(&decl_ctx->getParentASTContext()),
|
||||
name.getAsString().c_str(), decl_ctx->getDeclKindName(),
|
||||
static_cast<const void *>(decl_ctx));
|
||||
}
|
||||
|
||||
do {
|
||||
|
|
@ -77,19 +78,20 @@ public:
|
|||
LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
|
||||
|
||||
if (log) {
|
||||
log->Printf("AppleObjCExternalASTSource::CompleteType[%u] on "
|
||||
"(ASTContext*)%p Completing (TagDecl*)%p named %s",
|
||||
current_id, static_cast<void *>(&tag_decl->getASTContext()),
|
||||
static_cast<void *>(tag_decl),
|
||||
tag_decl->getName().str().c_str());
|
||||
LLDB_LOGF(log,
|
||||
"AppleObjCExternalASTSource::CompleteType[%u] on "
|
||||
"(ASTContext*)%p Completing (TagDecl*)%p named %s",
|
||||
current_id, static_cast<void *>(&tag_decl->getASTContext()),
|
||||
static_cast<void *>(tag_decl),
|
||||
tag_decl->getName().str().c_str());
|
||||
|
||||
log->Printf(" AOEAS::CT[%u] Before:", current_id);
|
||||
LLDB_LOGF(log, " AOEAS::CT[%u] Before:", current_id);
|
||||
ASTDumper dumper((clang::Decl *)tag_decl);
|
||||
dumper.ToLog(log, " [CT] ");
|
||||
}
|
||||
|
||||
if (log) {
|
||||
log->Printf(" AOEAS::CT[%u] After:", current_id);
|
||||
LLDB_LOGF(log, " AOEAS::CT[%u] After:", current_id);
|
||||
ASTDumper dumper((clang::Decl *)tag_decl);
|
||||
dumper.ToLog(log, " [CT] ");
|
||||
}
|
||||
|
|
@ -104,14 +106,15 @@ public:
|
|||
LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
|
||||
|
||||
if (log) {
|
||||
log->Printf("AppleObjCExternalASTSource::CompleteType[%u] on "
|
||||
"(ASTContext*)%p Completing (ObjCInterfaceDecl*)%p named %s",
|
||||
current_id,
|
||||
static_cast<void *>(&interface_decl->getASTContext()),
|
||||
static_cast<void *>(interface_decl),
|
||||
interface_decl->getName().str().c_str());
|
||||
LLDB_LOGF(log,
|
||||
"AppleObjCExternalASTSource::CompleteType[%u] on "
|
||||
"(ASTContext*)%p Completing (ObjCInterfaceDecl*)%p named %s",
|
||||
current_id,
|
||||
static_cast<void *>(&interface_decl->getASTContext()),
|
||||
static_cast<void *>(interface_decl),
|
||||
interface_decl->getName().str().c_str());
|
||||
|
||||
log->Printf(" AOEAS::CT[%u] Before:", current_id);
|
||||
LLDB_LOGF(log, " AOEAS::CT[%u] Before:", current_id);
|
||||
ASTDumper dumper((clang::Decl *)interface_decl);
|
||||
dumper.ToLog(log, " [CT] ");
|
||||
}
|
||||
|
|
@ -119,7 +122,7 @@ public:
|
|||
m_decl_vendor.FinishDecl(interface_decl);
|
||||
|
||||
if (log) {
|
||||
log->Printf(" [CT] After:");
|
||||
LLDB_LOGF(log, " [CT] After:");
|
||||
ASTDumper dumper((clang::Decl *)interface_decl);
|
||||
dumper.ToLog(log, " [CT] ");
|
||||
}
|
||||
|
|
@ -462,8 +465,7 @@ bool AppleObjCDeclVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl) {
|
|||
clang::ObjCMethodDecl *method_decl =
|
||||
method_type.BuildMethod(interface_decl, name, true, m_type_realizer_sp);
|
||||
|
||||
if (log)
|
||||
log->Printf("[ AOTV::FD] Instance method [%s] [%s]", name, types);
|
||||
LLDB_LOGF(log, "[ AOTV::FD] Instance method [%s] [%s]", name, types);
|
||||
|
||||
if (method_decl)
|
||||
interface_decl->addDecl(method_decl);
|
||||
|
|
@ -481,8 +483,7 @@ bool AppleObjCDeclVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl) {
|
|||
clang::ObjCMethodDecl *method_decl = method_type.BuildMethod(
|
||||
interface_decl, name, false, m_type_realizer_sp);
|
||||
|
||||
if (log)
|
||||
log->Printf("[ AOTV::FD] Class method [%s] [%s]", name, types);
|
||||
LLDB_LOGF(log, "[ AOTV::FD] Class method [%s] [%s]", name, types);
|
||||
|
||||
if (method_decl)
|
||||
interface_decl->addDecl(method_decl);
|
||||
|
|
@ -498,10 +499,9 @@ bool AppleObjCDeclVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl) {
|
|||
|
||||
const bool for_expression = false;
|
||||
|
||||
if (log)
|
||||
log->Printf(
|
||||
"[ AOTV::FD] Instance variable [%s] [%s], offset at %" PRIx64, name,
|
||||
type, offset_ptr);
|
||||
LLDB_LOGF(log,
|
||||
"[ AOTV::FD] Instance variable [%s] [%s], offset at %" PRIx64,
|
||||
name, type, offset_ptr);
|
||||
|
||||
CompilerType ivar_type = m_runtime.GetEncodingToType()->RealizeType(
|
||||
m_ast_ctx, type, for_expression);
|
||||
|
|
@ -527,9 +527,10 @@ bool AppleObjCDeclVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl) {
|
|||
if (log) {
|
||||
ASTDumper method_dumper((clang::Decl *)interface_decl);
|
||||
|
||||
log->Printf("[AppleObjCDeclVendor::FinishDecl] Finishing Objective-C "
|
||||
"interface for %s",
|
||||
descriptor->GetClassName().AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"[AppleObjCDeclVendor::FinishDecl] Finishing Objective-C "
|
||||
"interface for %s",
|
||||
descriptor->GetClassName().AsCString());
|
||||
}
|
||||
|
||||
if (!descriptor->Describe(superclass_func, instance_method_func,
|
||||
|
|
@ -539,7 +540,8 @@ bool AppleObjCDeclVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl) {
|
|||
if (log) {
|
||||
ASTDumper method_dumper((clang::Decl *)interface_decl);
|
||||
|
||||
log->Printf(
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"[AppleObjCDeclVendor::FinishDecl] Finished Objective-C interface");
|
||||
|
||||
method_dumper.ToLog(log, " [AOTV::FD] ");
|
||||
|
|
@ -558,10 +560,9 @@ AppleObjCDeclVendor::FindDecls(ConstString name, bool append,
|
|||
Log *log(GetLogIfAllCategoriesSet(
|
||||
LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
|
||||
|
||||
if (log)
|
||||
log->Printf("AppleObjCDeclVendor::FindDecls [%u] ('%s', %s, %u, )",
|
||||
current_id, (const char *)name.AsCString(),
|
||||
append ? "true" : "false", max_matches);
|
||||
LLDB_LOGF(log, "AppleObjCDeclVendor::FindDecls [%u] ('%s', %s, %u, )",
|
||||
current_id, (const char *)name.AsCString(),
|
||||
append ? "true" : "false", max_matches);
|
||||
|
||||
if (!append)
|
||||
decls.clear();
|
||||
|
|
@ -595,24 +596,25 @@ AppleObjCDeclVendor::FindDecls(ConstString name, bool append,
|
|||
if (metadata)
|
||||
isa_value = metadata->GetISAPtr();
|
||||
|
||||
log->Printf("AOCTV::FT [%u] Found %s (isa 0x%" PRIx64
|
||||
") in the ASTContext",
|
||||
current_id, dumper.GetCString(), isa_value);
|
||||
LLDB_LOGF(log,
|
||||
"AOCTV::FT [%u] Found %s (isa 0x%" PRIx64
|
||||
") in the ASTContext",
|
||||
current_id, dumper.GetCString(), isa_value);
|
||||
}
|
||||
|
||||
decls.push_back(result_iface_decl);
|
||||
ret++;
|
||||
break;
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("AOCTV::FT [%u] There's something in the ASTContext, but "
|
||||
"it's not something we know about",
|
||||
current_id);
|
||||
LLDB_LOGF(log,
|
||||
"AOCTV::FT [%u] There's something in the ASTContext, but "
|
||||
"it's not something we know about",
|
||||
current_id);
|
||||
break;
|
||||
}
|
||||
} else if (log) {
|
||||
log->Printf("AOCTV::FT [%u] Couldn't find %s in the ASTContext",
|
||||
current_id, name.AsCString());
|
||||
LLDB_LOGF(log, "AOCTV::FT [%u] Couldn't find %s in the ASTContext",
|
||||
current_id, name.AsCString());
|
||||
}
|
||||
|
||||
// It's not. If it exists, we have to put it into our ASTContext.
|
||||
|
|
@ -620,8 +622,7 @@ AppleObjCDeclVendor::FindDecls(ConstString name, bool append,
|
|||
ObjCLanguageRuntime::ObjCISA isa = m_runtime.GetISA(name);
|
||||
|
||||
if (!isa) {
|
||||
if (log)
|
||||
log->Printf("AOCTV::FT [%u] Couldn't find the isa", current_id);
|
||||
LLDB_LOGF(log, "AOCTV::FT [%u] Couldn't find the isa", current_id);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -629,10 +630,10 @@ AppleObjCDeclVendor::FindDecls(ConstString name, bool append,
|
|||
clang::ObjCInterfaceDecl *iface_decl = GetDeclForISA(isa);
|
||||
|
||||
if (!iface_decl) {
|
||||
if (log)
|
||||
log->Printf("AOCTV::FT [%u] Couldn't get the Objective-C interface for "
|
||||
"isa 0x%" PRIx64,
|
||||
current_id, (uint64_t)isa);
|
||||
LLDB_LOGF(log,
|
||||
"AOCTV::FT [%u] Couldn't get the Objective-C interface for "
|
||||
"isa 0x%" PRIx64,
|
||||
current_id, (uint64_t)isa);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -641,8 +642,8 @@ AppleObjCDeclVendor::FindDecls(ConstString name, bool append,
|
|||
clang::QualType new_iface_type =
|
||||
ast_ctx->getObjCInterfaceType(iface_decl);
|
||||
ASTDumper dumper(new_iface_type);
|
||||
log->Printf("AOCTV::FT [%u] Created %s (isa 0x%" PRIx64 ")", current_id,
|
||||
dumper.GetCString(), (uint64_t)isa);
|
||||
LLDB_LOGF(log, "AOCTV::FT [%u] Created %s (isa 0x%" PRIx64 ")",
|
||||
current_id, dumper.GetCString(), (uint64_t)isa);
|
||||
}
|
||||
|
||||
decls.push_back(iface_decl);
|
||||
|
|
|
|||
|
|
@ -395,10 +395,11 @@ void AppleObjCRuntimeV1::UpdateISAToDescriptorMapIfNeeded() {
|
|||
new ClassDescriptorV1(isa, process_sp));
|
||||
|
||||
if (log && log->GetVerbose())
|
||||
log->Printf("AppleObjCRuntimeV1 added (ObjCISA)0x%" PRIx64
|
||||
" from _objc_debug_class_hash to "
|
||||
"isa->descriptor cache",
|
||||
isa);
|
||||
LLDB_LOGF(log,
|
||||
"AppleObjCRuntimeV1 added (ObjCISA)0x%" PRIx64
|
||||
" from _objc_debug_class_hash to "
|
||||
"isa->descriptor cache",
|
||||
isa);
|
||||
|
||||
AddClass(isa, descriptor_sp);
|
||||
}
|
||||
|
|
@ -417,7 +418,8 @@ void AppleObjCRuntimeV1::UpdateISAToDescriptorMapIfNeeded() {
|
|||
new ClassDescriptorV1(isa, process_sp));
|
||||
|
||||
if (log && log->GetVerbose())
|
||||
log->Printf(
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"AppleObjCRuntimeV1 added (ObjCISA)0x%" PRIx64
|
||||
" from _objc_debug_class_hash to isa->descriptor "
|
||||
"cache",
|
||||
|
|
|
|||
|
|
@ -1209,11 +1209,11 @@ AppleObjCRuntimeV2::GetClassDescriptor(ValueObject &valobj) {
|
|||
objc_class_sp = GetClassDescriptorFromISA(isa);
|
||||
if (isa && !objc_class_sp) {
|
||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
|
||||
if (log)
|
||||
log->Printf("0x%" PRIx64
|
||||
": AppleObjCRuntimeV2::GetClassDescriptor() ISA was "
|
||||
"not in class descriptor cache 0x%" PRIx64,
|
||||
isa_pointer, isa);
|
||||
LLDB_LOGF(log,
|
||||
"0x%" PRIx64
|
||||
": AppleObjCRuntimeV2::GetClassDescriptor() ISA was "
|
||||
"not in class descriptor cache 0x%" PRIx64,
|
||||
isa_pointer, isa);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1317,8 +1317,7 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
|
|||
// Read the total number of classes from the hash table
|
||||
const uint32_t num_classes = hash_table.GetCount();
|
||||
if (num_classes == 0) {
|
||||
if (log)
|
||||
log->Printf("No dynamic classes found in gdb_objc_realized_classes.");
|
||||
LLDB_LOGF(log, "No dynamic classes found in gdb_objc_realized_classes.");
|
||||
return DescriptorMapUpdateResult::Success(0);
|
||||
}
|
||||
|
||||
|
|
@ -1337,17 +1336,16 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
|
|||
g_get_dynamic_class_info_body, eLanguageTypeObjC,
|
||||
g_get_dynamic_class_info_name, error));
|
||||
if (error.Fail()) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"Failed to get Utility Function for implementation lookup: %s",
|
||||
error.AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"Failed to get Utility Function for implementation lookup: %s",
|
||||
error.AsCString());
|
||||
m_get_class_info_code.reset();
|
||||
} else {
|
||||
diagnostics.Clear();
|
||||
|
||||
if (!m_get_class_info_code->Install(diagnostics, exe_ctx)) {
|
||||
if (log) {
|
||||
log->Printf("Failed to install implementation lookup");
|
||||
LLDB_LOGF(log, "Failed to install implementation lookup");
|
||||
diagnostics.Dump(log);
|
||||
}
|
||||
m_get_class_info_code.reset();
|
||||
|
|
@ -1372,17 +1370,16 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
|
|||
clang_uint32_t_type, arguments, thread_sp, error);
|
||||
|
||||
if (error.Fail()) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"Failed to make function caller for implementation lookup: %s.",
|
||||
error.AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"Failed to make function caller for implementation lookup: %s.",
|
||||
error.AsCString());
|
||||
return DescriptorMapUpdateResult::Fail();
|
||||
}
|
||||
} else {
|
||||
get_class_info_function = m_get_class_info_code->GetFunctionCaller();
|
||||
if (!get_class_info_function) {
|
||||
if (log) {
|
||||
log->Printf("Failed to get implementation lookup function caller.");
|
||||
LLDB_LOGF(log, "Failed to get implementation lookup function caller.");
|
||||
diagnostics.Dump(log);
|
||||
}
|
||||
|
||||
|
|
@ -1399,10 +1396,10 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
|
|||
class_infos_byte_size, ePermissionsReadable | ePermissionsWritable, err);
|
||||
|
||||
if (class_infos_addr == LLDB_INVALID_ADDRESS) {
|
||||
if (log)
|
||||
log->Printf("unable to allocate %" PRIu32
|
||||
" bytes in process for shared cache read",
|
||||
class_infos_byte_size);
|
||||
LLDB_LOGF(log,
|
||||
"unable to allocate %" PRIu32
|
||||
" bytes in process for shared cache read",
|
||||
class_infos_byte_size);
|
||||
return DescriptorMapUpdateResult::Fail();
|
||||
}
|
||||
|
||||
|
|
@ -1451,8 +1448,7 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
|
|||
if (results == eExpressionCompleted) {
|
||||
// The result is the number of ClassInfo structures that were filled in
|
||||
num_class_infos = return_value.GetScalar().ULong();
|
||||
if (log)
|
||||
log->Printf("Discovered %u ObjC classes\n", num_class_infos);
|
||||
LLDB_LOGF(log, "Discovered %u ObjC classes\n", num_class_infos);
|
||||
if (num_class_infos > 0) {
|
||||
// Read the ClassInfo structures
|
||||
DataBufferHeap buffer(num_class_infos * class_info_byte_size, 0);
|
||||
|
|
@ -1468,13 +1464,13 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
|
|||
success = true;
|
||||
} else {
|
||||
if (log) {
|
||||
log->Printf("Error evaluating our find class name function.");
|
||||
LLDB_LOGF(log, "Error evaluating our find class name function.");
|
||||
diagnostics.Dump(log);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (log) {
|
||||
log->Printf("Error writing function arguments.");
|
||||
LLDB_LOGF(log, "Error writing function arguments.");
|
||||
diagnostics.Dump(log);
|
||||
}
|
||||
}
|
||||
|
|
@ -1507,17 +1503,18 @@ uint32_t AppleObjCRuntimeV2::ParseClassInfoArray(const DataExtractor &data,
|
|||
|
||||
if (isa == 0) {
|
||||
if (should_log)
|
||||
log->Printf(
|
||||
"AppleObjCRuntimeV2 found NULL isa, ignoring this class info");
|
||||
LLDB_LOGF(
|
||||
log, "AppleObjCRuntimeV2 found NULL isa, ignoring this class info");
|
||||
continue;
|
||||
}
|
||||
// Check if we already know about this ISA, if we do, the info will never
|
||||
// change, so we can just skip it.
|
||||
if (ISAIsCached(isa)) {
|
||||
if (should_log)
|
||||
log->Printf("AppleObjCRuntimeV2 found cached isa=0x%" PRIx64
|
||||
", ignoring this class info",
|
||||
isa);
|
||||
LLDB_LOGF(log,
|
||||
"AppleObjCRuntimeV2 found cached isa=0x%" PRIx64
|
||||
", ignoring this class info",
|
||||
isa);
|
||||
offset += 4;
|
||||
} else {
|
||||
// Read the 32 bit hash for the class name
|
||||
|
|
@ -1536,15 +1533,16 @@ uint32_t AppleObjCRuntimeV2::ParseClassInfoArray(const DataExtractor &data,
|
|||
AddClass(isa, descriptor_sp, descriptor_sp->GetClassName().AsCString(nullptr));
|
||||
num_parsed++;
|
||||
if (should_log)
|
||||
log->Printf("AppleObjCRuntimeV2 added isa=0x%" PRIx64
|
||||
", hash=0x%8.8x, name=%s",
|
||||
isa, name_hash,
|
||||
descriptor_sp->GetClassName().AsCString("<unknown>"));
|
||||
LLDB_LOGF(log,
|
||||
"AppleObjCRuntimeV2 added isa=0x%" PRIx64
|
||||
", hash=0x%8.8x, name=%s",
|
||||
isa, name_hash,
|
||||
descriptor_sp->GetClassName().AsCString("<unknown>"));
|
||||
}
|
||||
}
|
||||
if (should_log)
|
||||
log->Printf("AppleObjCRuntimeV2 parsed %" PRIu32 " class infos",
|
||||
num_parsed);
|
||||
LLDB_LOGF(log, "AppleObjCRuntimeV2 parsed %" PRIu32 " class infos",
|
||||
num_parsed);
|
||||
return num_parsed;
|
||||
}
|
||||
|
||||
|
|
@ -1646,17 +1644,16 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache() {
|
|||
shared_class_expression.c_str(), eLanguageTypeObjC,
|
||||
g_get_shared_cache_class_info_name, error));
|
||||
if (error.Fail()) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"Failed to get Utility function for implementation lookup: %s.",
|
||||
error.AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"Failed to get Utility function for implementation lookup: %s.",
|
||||
error.AsCString());
|
||||
m_get_shared_cache_class_info_code.reset();
|
||||
} else {
|
||||
diagnostics.Clear();
|
||||
|
||||
if (!m_get_shared_cache_class_info_code->Install(diagnostics, exe_ctx)) {
|
||||
if (log) {
|
||||
log->Printf("Failed to install implementation lookup.");
|
||||
LLDB_LOGF(log, "Failed to install implementation lookup.");
|
||||
diagnostics.Dump(log);
|
||||
}
|
||||
m_get_shared_cache_class_info_code.reset();
|
||||
|
|
@ -1703,10 +1700,10 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache() {
|
|||
class_infos_byte_size, ePermissionsReadable | ePermissionsWritable, err);
|
||||
|
||||
if (class_infos_addr == LLDB_INVALID_ADDRESS) {
|
||||
if (log)
|
||||
log->Printf("unable to allocate %" PRIu32
|
||||
" bytes in process for shared cache read",
|
||||
class_infos_byte_size);
|
||||
LLDB_LOGF(log,
|
||||
"unable to allocate %" PRIu32
|
||||
" bytes in process for shared cache read",
|
||||
class_infos_byte_size);
|
||||
return DescriptorMapUpdateResult::Fail();
|
||||
}
|
||||
|
||||
|
|
@ -1757,9 +1754,8 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache() {
|
|||
if (results == eExpressionCompleted) {
|
||||
// The result is the number of ClassInfo structures that were filled in
|
||||
num_class_infos = return_value.GetScalar().ULong();
|
||||
if (log)
|
||||
log->Printf("Discovered %u ObjC classes in shared cache\n",
|
||||
num_class_infos);
|
||||
LLDB_LOGF(log, "Discovered %u ObjC classes in shared cache\n",
|
||||
num_class_infos);
|
||||
assert(num_class_infos <= num_classes);
|
||||
if (num_class_infos > 0) {
|
||||
if (num_class_infos > num_classes) {
|
||||
|
|
@ -1786,13 +1782,13 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache() {
|
|||
}
|
||||
} else {
|
||||
if (log) {
|
||||
log->Printf("Error evaluating our find class name function.");
|
||||
LLDB_LOGF(log, "Error evaluating our find class name function.");
|
||||
diagnostics.Dump(log);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (log) {
|
||||
log->Printf("Error writing function arguments.");
|
||||
LLDB_LOGF(log, "Error writing function arguments.");
|
||||
diagnostics.Dump(log);
|
||||
}
|
||||
}
|
||||
|
|
@ -1827,9 +1823,10 @@ bool AppleObjCRuntimeV2::UpdateISAToDescriptorMapFromMemory(
|
|||
new ClassDescriptorV2(*this, elt.second, elt.first.AsCString()));
|
||||
|
||||
if (log && log->GetVerbose())
|
||||
log->Printf("AppleObjCRuntimeV2 added (ObjCISA)0x%" PRIx64
|
||||
" (%s) from dynamic table to isa->descriptor cache",
|
||||
elt.second, elt.first.AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"AppleObjCRuntimeV2 added (ObjCISA)0x%" PRIx64
|
||||
" (%s) from dynamic table to isa->descriptor cache",
|
||||
elt.second, elt.first.AsCString());
|
||||
|
||||
AddClass(elt.second, descriptor_sp, elt.first.AsCString());
|
||||
}
|
||||
|
|
@ -1912,14 +1909,14 @@ void AppleObjCRuntimeV2::UpdateISAToDescriptorMapIfNeeded() {
|
|||
DescriptorMapUpdateResult shared_cache_update_result =
|
||||
UpdateISAToDescriptorMapSharedCache();
|
||||
|
||||
if (log)
|
||||
log->Printf("attempted to read objc class data - results: "
|
||||
"[dynamic_update]: ran: %s, count: %" PRIu32
|
||||
" [shared_cache_update]: ran: %s, count: %" PRIu32,
|
||||
dynamic_update_result.m_update_ran ? "yes" : "no",
|
||||
dynamic_update_result.m_num_found,
|
||||
shared_cache_update_result.m_update_ran ? "yes" : "no",
|
||||
shared_cache_update_result.m_num_found);
|
||||
LLDB_LOGF(log,
|
||||
"attempted to read objc class data - results: "
|
||||
"[dynamic_update]: ran: %s, count: %" PRIu32
|
||||
" [shared_cache_update]: ran: %s, count: %" PRIu32,
|
||||
dynamic_update_result.m_update_ran ? "yes" : "no",
|
||||
dynamic_update_result.m_num_found,
|
||||
shared_cache_update_result.m_update_ran ? "yes" : "no",
|
||||
shared_cache_update_result.m_num_found);
|
||||
|
||||
// warn if:
|
||||
// - we could not run either expression
|
||||
|
|
@ -2516,8 +2513,7 @@ bool AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA(
|
|||
ObjCISA isa, ObjCISA &ret_isa) {
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES));
|
||||
|
||||
if (log)
|
||||
log->Printf("AOCRT::NPI Evalulate(isa = 0x%" PRIx64 ")", (uint64_t)isa);
|
||||
LLDB_LOGF(log, "AOCRT::NPI Evalulate(isa = 0x%" PRIx64 ")", (uint64_t)isa);
|
||||
|
||||
if ((isa & ~m_objc_debug_isa_class_mask) == 0)
|
||||
return false;
|
||||
|
|
@ -2543,10 +2539,10 @@ bool AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA(
|
|||
// read the count again, and update the cache if the count has been
|
||||
// updated.
|
||||
if (index > m_indexed_isa_cache.size()) {
|
||||
if (log)
|
||||
log->Printf("AOCRT::NPI (index = %" PRIu64
|
||||
") exceeds cache (size = %" PRIu64 ")",
|
||||
(uint64_t)index, (uint64_t)m_indexed_isa_cache.size());
|
||||
LLDB_LOGF(log,
|
||||
"AOCRT::NPI (index = %" PRIu64
|
||||
") exceeds cache (size = %" PRIu64 ")",
|
||||
(uint64_t)index, (uint64_t)m_indexed_isa_cache.size());
|
||||
|
||||
Process *process(m_runtime.GetProcess());
|
||||
|
||||
|
|
@ -2561,9 +2557,8 @@ bool AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA(
|
|||
if (error.Fail())
|
||||
return false;
|
||||
|
||||
if (log)
|
||||
log->Printf("AOCRT::NPI (new class count = %" PRIu64 ")",
|
||||
(uint64_t)objc_indexed_classes_count);
|
||||
LLDB_LOGF(log, "AOCRT::NPI (new class count = %" PRIu64 ")",
|
||||
(uint64_t)objc_indexed_classes_count);
|
||||
|
||||
if (objc_indexed_classes_count > m_indexed_isa_cache.size()) {
|
||||
// Read the class entries we don't have. We should just read all of
|
||||
|
|
@ -2581,9 +2576,8 @@ bool AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA(
|
|||
if (error.Fail() || bytes_read != buffer.GetByteSize())
|
||||
return false;
|
||||
|
||||
if (log)
|
||||
log->Printf("AOCRT::NPI (read new classes count = %" PRIu64 ")",
|
||||
(uint64_t)num_new_classes);
|
||||
LLDB_LOGF(log, "AOCRT::NPI (read new classes count = %" PRIu64 ")",
|
||||
(uint64_t)num_new_classes);
|
||||
|
||||
// Append the new entries to the existing cache.
|
||||
DataExtractor data(buffer.GetBytes(), buffer.GetByteSize(),
|
||||
|
|
@ -2600,9 +2594,8 @@ bool AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA(
|
|||
if (index > m_indexed_isa_cache.size())
|
||||
return false;
|
||||
|
||||
if (log)
|
||||
log->Printf("AOCRT::NPI Evalulate(ret_isa = 0x%" PRIx64 ")",
|
||||
(uint64_t)m_indexed_isa_cache[index]);
|
||||
LLDB_LOGF(log, "AOCRT::NPI Evalulate(ret_isa = 0x%" PRIx64 ")",
|
||||
(uint64_t)m_indexed_isa_cache[index]);
|
||||
|
||||
ret_isa = m_indexed_isa_cache[index];
|
||||
return (ret_isa != 0); // this is a pointer so 0 is not a valid value
|
||||
|
|
|
|||
|
|
@ -593,7 +593,7 @@ bool AppleObjCTrampolineHandler::AppleObjCVTables::ReadRegions(
|
|||
if (log) {
|
||||
StreamString s;
|
||||
m_regions.back().Dump(s);
|
||||
log->Printf("Read vtable region: \n%s", s.GetData());
|
||||
LLDB_LOGF(log, "Read vtable region: \n%s", s.GetData());
|
||||
}
|
||||
|
||||
next_region = m_regions.back().GetNextRegionAddr();
|
||||
|
|
@ -779,25 +779,24 @@ AppleObjCTrampolineHandler::SetupDispatchFunction(Thread &thread,
|
|||
m_lookup_implementation_function_code, eLanguageTypeObjC,
|
||||
g_lookup_implementation_function_name, error));
|
||||
if (error.Fail()) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"Failed to get Utility Function for implementation lookup: %s.",
|
||||
error.AsCString());
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"Failed to get Utility Function for implementation lookup: %s.",
|
||||
error.AsCString());
|
||||
m_impl_code.reset();
|
||||
return args_addr;
|
||||
}
|
||||
|
||||
if (!m_impl_code->Install(diagnostics, exe_ctx)) {
|
||||
if (log) {
|
||||
log->Printf("Failed to install implementation lookup.");
|
||||
LLDB_LOGF(log, "Failed to install implementation lookup.");
|
||||
diagnostics.Dump(log);
|
||||
}
|
||||
m_impl_code.reset();
|
||||
return args_addr;
|
||||
}
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("No method lookup implementation code.");
|
||||
LLDB_LOGF(log, "No method lookup implementation code.");
|
||||
return LLDB_INVALID_ADDRESS;
|
||||
}
|
||||
|
||||
|
|
@ -811,10 +810,9 @@ AppleObjCTrampolineHandler::SetupDispatchFunction(Thread &thread,
|
|||
impl_function_caller = m_impl_code->MakeFunctionCaller(
|
||||
clang_void_ptr_type, dispatch_values, thread_sp, error);
|
||||
if (error.Fail()) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"Error getting function caller for dispatch lookup: \"%s\".",
|
||||
error.AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"Error getting function caller for dispatch lookup: \"%s\".",
|
||||
error.AsCString());
|
||||
return args_addr;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -833,7 +831,7 @@ AppleObjCTrampolineHandler::SetupDispatchFunction(Thread &thread,
|
|||
if (!impl_function_caller->WriteFunctionArguments(
|
||||
exe_ctx, args_addr, dispatch_values, diagnostics)) {
|
||||
if (log) {
|
||||
log->Printf("Error writing function arguments.");
|
||||
LLDB_LOGF(log, "Error writing function arguments.");
|
||||
diagnostics.Dump(log);
|
||||
}
|
||||
return args_addr;
|
||||
|
|
@ -934,9 +932,9 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
|
|||
lldb::addr_t obj_addr =
|
||||
argument_values.GetValueAtIndex(obj_index)->GetScalar().ULongLong();
|
||||
if (obj_addr == 0x0) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"Asked to step to dispatch to nil object, returning empty plan.");
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"Asked to step to dispatch to nil object, returning empty plan.");
|
||||
return ret_plan_sp;
|
||||
}
|
||||
|
||||
|
|
@ -976,13 +974,11 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
|
|||
if (super_value.GetScalar().IsValid())
|
||||
isa_addr = super_value.GetScalar().ULongLong();
|
||||
else {
|
||||
if (log)
|
||||
log->Printf("Failed to extract the super class value from the "
|
||||
"class in objc_super.");
|
||||
LLDB_LOGF(log, "Failed to extract the super class value from the "
|
||||
"class in objc_super.");
|
||||
}
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("Failed to extract the class value from objc_super.");
|
||||
LLDB_LOGF(log, "Failed to extract the class value from objc_super.");
|
||||
}
|
||||
} else {
|
||||
// In the objc_msgSendSuper case, we don't get the object
|
||||
|
|
@ -998,8 +994,7 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
|
|||
if (super_value.GetScalar().IsValid()) {
|
||||
isa_addr = super_value.GetScalar().ULongLong();
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("Failed to extract the class value from objc_super.");
|
||||
LLDB_LOGF(log, "Failed to extract the class value from objc_super.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1022,8 +1017,7 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
|
|||
if (isa_value.GetScalar().IsValid()) {
|
||||
isa_addr = isa_value.GetScalar().ULongLong();
|
||||
} else {
|
||||
if (log)
|
||||
log->Printf("Failed to extract the isa value from object.");
|
||||
LLDB_LOGF(log, "Failed to extract the isa value from object.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1033,9 +1027,10 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
|
|||
|
||||
if (isa_addr != LLDB_INVALID_ADDRESS) {
|
||||
if (log) {
|
||||
log->Printf("Resolving call for class - 0x%" PRIx64
|
||||
" and selector - 0x%" PRIx64,
|
||||
isa_addr, sel_addr);
|
||||
LLDB_LOGF(log,
|
||||
"Resolving call for class - 0x%" PRIx64
|
||||
" and selector - 0x%" PRIx64,
|
||||
isa_addr, sel_addr);
|
||||
}
|
||||
ObjCLanguageRuntime *objc_runtime =
|
||||
ObjCLanguageRuntime::Get(*thread.GetProcess());
|
||||
|
|
@ -1047,9 +1042,8 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
|
|||
if (impl_addr != LLDB_INVALID_ADDRESS) {
|
||||
// Yup, it was in the cache, so we can run to that address directly.
|
||||
|
||||
if (log)
|
||||
log->Printf("Found implementation address in cache: 0x%" PRIx64,
|
||||
impl_addr);
|
||||
LLDB_LOGF(log, "Found implementation address in cache: 0x%" PRIx64,
|
||||
impl_addr);
|
||||
|
||||
ret_plan_sp = std::make_shared<ThreadPlanRunToAddress>(thread, impl_addr,
|
||||
stop_others);
|
||||
|
|
@ -1137,7 +1131,7 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
|
|||
if (log) {
|
||||
StreamString s;
|
||||
ret_plan_sp->GetDescription(&s, eDescriptionLevelFull);
|
||||
log->Printf("Using ObjC step plan: %s.\n", s.GetData());
|
||||
LLDB_LOGF(log, "Using ObjC step plan: %s.\n", s.GetData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,17 +141,15 @@ bool AppleThreadPlanStepThroughObjCTrampoline::ShouldStop(Event *event_ptr) {
|
|||
target_so_addr.SetOpcodeLoadAddress(target_addr, exc_ctx.GetTargetPtr());
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
|
||||
if (target_addr == 0) {
|
||||
if (log)
|
||||
log->Printf("Got target implementation of 0x0, stopping.");
|
||||
LLDB_LOGF(log, "Got target implementation of 0x0, stopping.");
|
||||
SetPlanComplete();
|
||||
return true;
|
||||
}
|
||||
if (m_trampoline_handler->AddrIsMsgForward(target_addr)) {
|
||||
if (log)
|
||||
log->Printf(
|
||||
"Implementation lookup returned msgForward function: 0x%" PRIx64
|
||||
", stopping.",
|
||||
target_addr);
|
||||
LLDB_LOGF(log,
|
||||
"Implementation lookup returned msgForward function: 0x%" PRIx64
|
||||
", stopping.",
|
||||
target_addr);
|
||||
|
||||
SymbolContext sc = m_thread.GetStackFrameAtIndex(0)->GetSymbolContext(
|
||||
eSymbolContextEverything);
|
||||
|
|
@ -167,18 +165,17 @@ bool AppleThreadPlanStepThroughObjCTrampoline::ShouldStop(Event *event_ptr) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("Running to ObjC method implementation: 0x%" PRIx64,
|
||||
target_addr);
|
||||
LLDB_LOGF(log, "Running to ObjC method implementation: 0x%" PRIx64,
|
||||
target_addr);
|
||||
|
||||
ObjCLanguageRuntime *objc_runtime =
|
||||
ObjCLanguageRuntime::Get(*GetThread().GetProcess());
|
||||
assert(objc_runtime != nullptr);
|
||||
objc_runtime->AddToMethodCache(m_isa_addr, m_sel_addr, target_addr);
|
||||
if (log)
|
||||
log->Printf("Adding {isa-addr=0x%" PRIx64 ", sel-addr=0x%" PRIx64
|
||||
"} = addr=0x%" PRIx64 " to cache.",
|
||||
m_isa_addr, m_sel_addr, target_addr);
|
||||
LLDB_LOGF(log,
|
||||
"Adding {isa-addr=0x%" PRIx64 ", sel-addr=0x%" PRIx64
|
||||
"} = addr=0x%" PRIx64 " to cache.",
|
||||
m_isa_addr, m_sel_addr, target_addr);
|
||||
|
||||
// Extract the target address from the value:
|
||||
|
||||
|
|
|
|||
|
|
@ -64,9 +64,10 @@ void ObjCLanguageRuntime::AddToMethodCache(lldb::addr_t class_addr,
|
|||
lldb::addr_t impl_addr) {
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
|
||||
if (log) {
|
||||
log->Printf("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));
|
||||
|
|
|
|||
|
|
@ -140,10 +140,10 @@ bool RenderScriptRuntimeModulePass::runOnModule(llvm::Module &module) {
|
|||
// We've been using a triple and datalayout of some ARM variant all along,
|
||||
// so we need to let the backend know that this is no longer the case.
|
||||
if (log) {
|
||||
log->Printf("%s - Changing RS target triple to '%s'", __FUNCTION__,
|
||||
real_triple.str().c_str());
|
||||
log->Printf(
|
||||
"%s - Changing RS datalayout to '%s'", __FUNCTION__,
|
||||
LLDB_LOGF(log, "%s - Changing RS target triple to '%s'", __FUNCTION__,
|
||||
real_triple.str().c_str());
|
||||
LLDB_LOGF(
|
||||
log, "%s - Changing RS datalayout to '%s'", __FUNCTION__,
|
||||
target_machine->createDataLayout().getStringRepresentation().c_str());
|
||||
}
|
||||
module.setTargetTriple(real_triple);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -93,9 +93,8 @@ llvm::FunctionType *cloneToStructRetFnTy(llvm::CallInst *call_inst) {
|
|||
assert(orig && "CallInst has no called function");
|
||||
llvm::FunctionType *orig_type = orig->getFunctionType();
|
||||
auto name = orig->getName();
|
||||
if (log)
|
||||
log->Printf("%s - cloning to StructRet function for '%s'", __FUNCTION__,
|
||||
name.str().c_str());
|
||||
LLDB_LOGF(log, "%s - cloning to StructRet function for '%s'", __FUNCTION__,
|
||||
name.str().c_str());
|
||||
|
||||
unsigned num_params = orig_type->getNumParams();
|
||||
std::vector<llvm::Type *> new_params{num_params + 1, nullptr};
|
||||
|
|
@ -113,9 +112,9 @@ llvm::FunctionType *cloneToStructRetFnTy(llvm::CallInst *call_inst) {
|
|||
if (!return_type_ptr_type)
|
||||
return nullptr;
|
||||
|
||||
if (log)
|
||||
log->Printf("%s - return type pointer type for StructRet clone @ '0x%p':\n",
|
||||
__FUNCTION__, (void *)return_type_ptr_type);
|
||||
LLDB_LOGF(log,
|
||||
"%s - return type pointer type for StructRet clone @ '0x%p':\n",
|
||||
__FUNCTION__, (void *)return_type_ptr_type);
|
||||
// put the sret pointer argument in place at the beginning of the
|
||||
// argument list.
|
||||
params.emplace(params.begin(), return_type_ptr_type);
|
||||
|
|
|
|||
|
|
@ -264,8 +264,7 @@ bool ELFNote::Parse(const DataExtractor &data, lldb::offset_t *offset) {
|
|||
const char *cstr = data.GetCStr(offset, llvm::alignTo(n_namesz, 4));
|
||||
if (cstr == nullptr) {
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS));
|
||||
if (log)
|
||||
log->Printf("Failed to parse note name lacking nul terminator");
|
||||
LLDB_LOGF(log, "Failed to parse note name lacking nul terminator");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -608,10 +607,9 @@ size_t ObjectFileELF::GetModuleSpecifications(
|
|||
llvm::Triple::OSType spec_ostype =
|
||||
spec.GetArchitecture().GetTriple().getOS();
|
||||
|
||||
if (log)
|
||||
log->Printf("ObjectFileELF::%s file '%s' module OSABI: %s",
|
||||
__FUNCTION__, file.GetPath().c_str(),
|
||||
OSABIAsCString(header.e_ident[EI_OSABI]));
|
||||
LLDB_LOGF(log, "ObjectFileELF::%s file '%s' module OSABI: %s",
|
||||
__FUNCTION__, file.GetPath().c_str(),
|
||||
OSABIAsCString(header.e_ident[EI_OSABI]));
|
||||
|
||||
// SetArchitecture should have set the vendor to unknown
|
||||
vendor = spec.GetArchitecture().GetTriple().getVendor();
|
||||
|
|
@ -623,10 +621,10 @@ size_t ObjectFileELF::GetModuleSpecifications(
|
|||
GetOsFromOSABI(header.e_ident[EI_OSABI], ostype);
|
||||
assert(spec_ostype == ostype);
|
||||
if (spec_ostype != llvm::Triple::OSType::UnknownOS) {
|
||||
if (log)
|
||||
log->Printf("ObjectFileELF::%s file '%s' set ELF module OS type "
|
||||
"from ELF header OSABI.",
|
||||
__FUNCTION__, file.GetPath().c_str());
|
||||
LLDB_LOGF(log,
|
||||
"ObjectFileELF::%s file '%s' set ELF module OS type "
|
||||
"from ELF header OSABI.",
|
||||
__FUNCTION__, file.GetPath().c_str());
|
||||
}
|
||||
|
||||
data_sp = MapFileData(file, -1, file_offset);
|
||||
|
|
@ -652,12 +650,12 @@ size_t ObjectFileELF::GetModuleSpecifications(
|
|||
|
||||
llvm::Triple &spec_triple = spec.GetArchitecture().GetTriple();
|
||||
|
||||
if (log)
|
||||
log->Printf("ObjectFileELF::%s file '%s' module set to triple: %s "
|
||||
"(architecture %s)",
|
||||
__FUNCTION__, file.GetPath().c_str(),
|
||||
spec_triple.getTriple().c_str(),
|
||||
spec.GetArchitecture().GetArchitectureName());
|
||||
LLDB_LOGF(log,
|
||||
"ObjectFileELF::%s file '%s' module set to triple: %s "
|
||||
"(architecture %s)",
|
||||
__FUNCTION__, file.GetPath().c_str(),
|
||||
spec_triple.getTriple().c_str(),
|
||||
spec.GetArchitecture().GetArchitectureName());
|
||||
|
||||
if (!uuid.IsValid()) {
|
||||
uint32_t core_notes_crc = 0;
|
||||
|
|
@ -1109,9 +1107,8 @@ ObjectFileELF::RefineModuleDetailsFromNote(lldb_private::DataExtractor &data,
|
|||
return error;
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("ObjectFileELF::%s parsing note name='%s', type=%" PRIu32,
|
||||
__FUNCTION__, note.n_name.c_str(), note.n_type);
|
||||
LLDB_LOGF(log, "ObjectFileELF::%s parsing note name='%s', type=%" PRIu32,
|
||||
__FUNCTION__, note.n_name.c_str(), note.n_type);
|
||||
|
||||
// Process FreeBSD ELF notes.
|
||||
if ((note.n_name == LLDB_NT_OWNER_FREEBSD) &&
|
||||
|
|
@ -1136,11 +1133,11 @@ ObjectFileELF::RefineModuleDetailsFromNote(lldb_private::DataExtractor &data,
|
|||
arch_spec.GetTriple().setOSName(os_name);
|
||||
arch_spec.GetTriple().setVendor(llvm::Triple::VendorType::UnknownVendor);
|
||||
|
||||
if (log)
|
||||
log->Printf("ObjectFileELF::%s detected FreeBSD %" PRIu32 ".%" PRIu32
|
||||
".%" PRIu32,
|
||||
__FUNCTION__, version_major, version_minor,
|
||||
static_cast<uint32_t>(version_info % 1000));
|
||||
LLDB_LOGF(log,
|
||||
"ObjectFileELF::%s detected FreeBSD %" PRIu32 ".%" PRIu32
|
||||
".%" PRIu32,
|
||||
__FUNCTION__, version_major, version_minor,
|
||||
static_cast<uint32_t>(version_info % 1000));
|
||||
}
|
||||
// Process GNU ELF notes.
|
||||
else if (note.n_name == LLDB_NT_OWNER_GNU) {
|
||||
|
|
@ -1161,12 +1158,11 @@ ObjectFileELF::RefineModuleDetailsFromNote(lldb_private::DataExtractor &data,
|
|||
arch_spec.GetTriple().setOS(llvm::Triple::OSType::Linux);
|
||||
arch_spec.GetTriple().setVendor(
|
||||
llvm::Triple::VendorType::UnknownVendor);
|
||||
if (log)
|
||||
log->Printf(
|
||||
"ObjectFileELF::%s detected Linux, min version %" PRIu32
|
||||
".%" PRIu32 ".%" PRIu32,
|
||||
__FUNCTION__, version_info[1], version_info[2],
|
||||
version_info[3]);
|
||||
LLDB_LOGF(log,
|
||||
"ObjectFileELF::%s detected Linux, min version %" PRIu32
|
||||
".%" PRIu32 ".%" PRIu32,
|
||||
__FUNCTION__, version_info[1], version_info[2],
|
||||
version_info[3]);
|
||||
// FIXME we have the minimal version number, we could be propagating
|
||||
// that. version_info[1] = OS Major, version_info[2] = OS Minor,
|
||||
// version_info[3] = Revision.
|
||||
|
|
@ -1175,30 +1171,28 @@ ObjectFileELF::RefineModuleDetailsFromNote(lldb_private::DataExtractor &data,
|
|||
arch_spec.GetTriple().setOS(llvm::Triple::OSType::UnknownOS);
|
||||
arch_spec.GetTriple().setVendor(
|
||||
llvm::Triple::VendorType::UnknownVendor);
|
||||
if (log)
|
||||
log->Printf("ObjectFileELF::%s detected Hurd (unsupported), min "
|
||||
"version %" PRIu32 ".%" PRIu32 ".%" PRIu32,
|
||||
__FUNCTION__, version_info[1], version_info[2],
|
||||
version_info[3]);
|
||||
LLDB_LOGF(log,
|
||||
"ObjectFileELF::%s detected Hurd (unsupported), min "
|
||||
"version %" PRIu32 ".%" PRIu32 ".%" PRIu32,
|
||||
__FUNCTION__, version_info[1], version_info[2],
|
||||
version_info[3]);
|
||||
break;
|
||||
case LLDB_NT_GNU_ABI_OS_SOLARIS:
|
||||
arch_spec.GetTriple().setOS(llvm::Triple::OSType::Solaris);
|
||||
arch_spec.GetTriple().setVendor(
|
||||
llvm::Triple::VendorType::UnknownVendor);
|
||||
if (log)
|
||||
log->Printf(
|
||||
"ObjectFileELF::%s detected Solaris, min version %" PRIu32
|
||||
".%" PRIu32 ".%" PRIu32,
|
||||
__FUNCTION__, version_info[1], version_info[2],
|
||||
version_info[3]);
|
||||
LLDB_LOGF(log,
|
||||
"ObjectFileELF::%s detected Solaris, min version %" PRIu32
|
||||
".%" PRIu32 ".%" PRIu32,
|
||||
__FUNCTION__, version_info[1], version_info[2],
|
||||
version_info[3]);
|
||||
break;
|
||||
default:
|
||||
if (log)
|
||||
log->Printf(
|
||||
"ObjectFileELF::%s unrecognized OS in note, id %" PRIu32
|
||||
", min version %" PRIu32 ".%" PRIu32 ".%" PRIu32,
|
||||
__FUNCTION__, version_info[0], version_info[1],
|
||||
version_info[2], version_info[3]);
|
||||
LLDB_LOGF(log,
|
||||
"ObjectFileELF::%s unrecognized OS in note, id %" PRIu32
|
||||
", min version %" PRIu32 ".%" PRIu32 ".%" PRIu32,
|
||||
__FUNCTION__, version_info[0], version_info[1],
|
||||
version_info[2], version_info[3]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1607,9 +1601,8 @@ size_t ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl §ion_headers,
|
|||
section_size) == section_size)) {
|
||||
Status error = RefineModuleDetailsFromNote(data, arch_spec, uuid);
|
||||
if (error.Fail()) {
|
||||
if (log)
|
||||
log->Printf("ObjectFileELF::%s ELF note processing failed: %s",
|
||||
__FUNCTION__, error.AsCString());
|
||||
LLDB_LOGF(log, "ObjectFileELF::%s ELF note processing failed: %s",
|
||||
__FUNCTION__, error.AsCString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2643,7 +2636,7 @@ unsigned ObjectFileELF::ApplyRelocations(
|
|||
((int64_t)value > INT32_MAX && (int64_t)value < INT32_MIN))) {
|
||||
Log *log =
|
||||
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES);
|
||||
log->Printf("Failed to apply debug info relocations");
|
||||
LLDB_LOGF(log, "Failed to apply debug info relocations");
|
||||
break;
|
||||
}
|
||||
uint32_t truncated_addr = (value & 0xFFFFFFFF);
|
||||
|
|
|
|||
|
|
@ -2103,8 +2103,9 @@ UUID ObjectFileMachO::GetSharedCacheUUID(FileSpec dyld_shared_cache,
|
|||
}
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS));
|
||||
if (log && dsc_uuid.IsValid()) {
|
||||
log->Printf("Shared cache %s has UUID %s", dyld_shared_cache.GetPath().c_str(),
|
||||
dsc_uuid.GetAsString().c_str());
|
||||
LLDB_LOGF(log, "Shared cache %s has UUID %s",
|
||||
dyld_shared_cache.GetPath().c_str(),
|
||||
dsc_uuid.GetAsString().c_str());
|
||||
}
|
||||
return dsc_uuid;
|
||||
}
|
||||
|
|
@ -4933,8 +4934,7 @@ namespace {
|
|||
default: {
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS |
|
||||
LIBLLDB_LOG_PROCESS));
|
||||
if (log)
|
||||
log->Printf("unsupported platform in LC_BUILD_VERSION");
|
||||
LLDB_LOGF(log, "unsupported platform in LC_BUILD_VERSION");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5718,8 +5718,10 @@ void ObjectFileMachO::GetProcessSharedCacheUUID(Process *process, addr_t &base_a
|
|||
private_shared_cache);
|
||||
}
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS | LIBLLDB_LOG_PROCESS));
|
||||
if (log)
|
||||
log->Printf("inferior process shared cache has a UUID of %s, base address 0x%" PRIx64 , uuid.GetAsString().c_str(), base_addr);
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"inferior process shared cache has a UUID of %s, base address 0x%" PRIx64,
|
||||
uuid.GetAsString().c_str(), base_addr);
|
||||
}
|
||||
|
||||
// From dyld SPI header dyld_process_info.h
|
||||
|
|
@ -5804,7 +5806,10 @@ void ObjectFileMachO::GetLLDBSharedCacheUUID(addr_t &base_addr, UUID &uuid) {
|
|||
}
|
||||
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS | LIBLLDB_LOG_PROCESS));
|
||||
if (log && uuid.IsValid())
|
||||
log->Printf("lldb's in-memory shared cache has a UUID of %s base address of 0x%" PRIx64, uuid.GetAsString().c_str(), base_addr);
|
||||
LLDB_LOGF(log,
|
||||
"lldb's in-memory shared cache has a UUID of %s base address of "
|
||||
"0x%" PRIx64,
|
||||
uuid.GetAsString().c_str(), base_addr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -235,11 +235,11 @@ bool ObjectFilePECOFF::CreateBinary() {
|
|||
|
||||
auto binary = llvm::object::createBinary(m_file.GetPath());
|
||||
if (!binary) {
|
||||
if (log)
|
||||
log->Printf("ObjectFilePECOFF::CreateBinary() - failed to create binary "
|
||||
"for file (%s): %s",
|
||||
m_file ? m_file.GetPath().c_str() : "<NULL>",
|
||||
errorToErrorCode(binary.takeError()).message().c_str());
|
||||
LLDB_LOGF(log,
|
||||
"ObjectFilePECOFF::CreateBinary() - failed to create binary "
|
||||
"for file (%s): %s",
|
||||
m_file ? m_file.GetPath().c_str() : "<NULL>",
|
||||
errorToErrorCode(binary.takeError()).message().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -249,15 +249,14 @@ bool ObjectFilePECOFF::CreateBinary() {
|
|||
return false;
|
||||
|
||||
m_owningbin = OWNBINType(std::move(*binary));
|
||||
if (log)
|
||||
log->Printf("%p ObjectFilePECOFF::CreateBinary() module = %p (%s), file = "
|
||||
"%s, binary = %p (Bin = %p)",
|
||||
static_cast<void *>(this),
|
||||
static_cast<void *>(GetModule().get()),
|
||||
GetModule()->GetSpecificationDescription().c_str(),
|
||||
m_file ? m_file.GetPath().c_str() : "<NULL>",
|
||||
static_cast<void *>(m_owningbin.getPointer()),
|
||||
static_cast<void *>(m_owningbin->getBinary()));
|
||||
LLDB_LOGF(log,
|
||||
"%p ObjectFilePECOFF::CreateBinary() module = %p (%s), file = "
|
||||
"%s, binary = %p (Bin = %p)",
|
||||
static_cast<void *>(this), static_cast<void *>(GetModule().get()),
|
||||
GetModule()->GetSpecificationDescription().c_str(),
|
||||
m_file ? m_file.GetPath().c_str() : "<NULL>",
|
||||
static_cast<void *>(m_owningbin.getPointer()),
|
||||
static_cast<void *>(m_owningbin->getBinary()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -911,13 +910,13 @@ uint32_t ObjectFilePECOFF::ParseDependentModules() {
|
|||
return 0;
|
||||
|
||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
|
||||
if (log)
|
||||
log->Printf("%p ObjectFilePECOFF::ParseDependentModules() module = %p "
|
||||
"(%s), binary = %p (Bin = %p)",
|
||||
static_cast<void *>(this), static_cast<void *>(module_sp.get()),
|
||||
module_sp->GetSpecificationDescription().c_str(),
|
||||
static_cast<void *>(m_owningbin.getPointer()),
|
||||
static_cast<void *>(m_owningbin->getBinary()));
|
||||
LLDB_LOGF(log,
|
||||
"%p ObjectFilePECOFF::ParseDependentModules() module = %p "
|
||||
"(%s), binary = %p (Bin = %p)",
|
||||
static_cast<void *>(this), static_cast<void *>(module_sp.get()),
|
||||
module_sp->GetSpecificationDescription().c_str(),
|
||||
static_cast<void *>(m_owningbin.getPointer()),
|
||||
static_cast<void *>(m_owningbin->getBinary()));
|
||||
|
||||
auto COFFObj =
|
||||
llvm::dyn_cast<llvm::object::COFFObjectFile>(m_owningbin->getBinary());
|
||||
|
|
@ -931,10 +930,10 @@ uint32_t ObjectFilePECOFF::ParseDependentModules() {
|
|||
auto ec = entry.getName(dll_name);
|
||||
// Report a bogus entry.
|
||||
if (ec != std::error_code()) {
|
||||
if (log)
|
||||
log->Printf("ObjectFilePECOFF::ParseDependentModules() - failed to get "
|
||||
"import directory entry name: %s",
|
||||
ec.message().c_str());
|
||||
LLDB_LOGF(log,
|
||||
"ObjectFilePECOFF::ParseDependentModules() - failed to get "
|
||||
"import directory entry name: %s",
|
||||
ec.message().c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -120,10 +120,10 @@ DynamicRegisterInfo *OperatingSystemPython::GetDynamicRegisterInfo() {
|
|||
return nullptr;
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OS));
|
||||
|
||||
if (log)
|
||||
log->Printf("OperatingSystemPython::GetDynamicRegisterInfo() fetching "
|
||||
"thread register definitions from python for pid %" PRIu64,
|
||||
m_process->GetID());
|
||||
LLDB_LOGF(log,
|
||||
"OperatingSystemPython::GetDynamicRegisterInfo() fetching "
|
||||
"thread register definitions from python for pid %" PRIu64,
|
||||
m_process->GetID());
|
||||
|
||||
StructuredData::DictionarySP dictionary =
|
||||
m_interpreter->OSPlugin_RegisterInfo(m_python_object_sp);
|
||||
|
|
@ -169,10 +169,10 @@ bool OperatingSystemPython::UpdateThreadList(ThreadList &old_thread_list,
|
|||
api_lock.try_lock();
|
||||
auto interpreter_lock = m_interpreter->AcquireInterpreterLock();
|
||||
|
||||
if (log)
|
||||
log->Printf("OperatingSystemPython::UpdateThreadList() fetching thread "
|
||||
"data from python for pid %" PRIu64,
|
||||
m_process->GetID());
|
||||
LLDB_LOGF(log,
|
||||
"OperatingSystemPython::UpdateThreadList() fetching thread "
|
||||
"data from python for pid %" PRIu64,
|
||||
m_process->GetID());
|
||||
|
||||
// The threads that are in "new_thread_list" upon entry are the threads from
|
||||
// the lldb_private::Process subclass, no memory threads will be in this
|
||||
|
|
@ -190,7 +190,7 @@ bool OperatingSystemPython::UpdateThreadList(ThreadList &old_thread_list,
|
|||
if (log) {
|
||||
StreamString strm;
|
||||
threads_list->Dump(strm);
|
||||
log->Printf("threads_list = %s", strm.GetData());
|
||||
LLDB_LOGF(log, "threads_list = %s", strm.GetData());
|
||||
}
|
||||
|
||||
const uint32_t num_threads = threads_list->GetSize();
|
||||
|
|
@ -316,21 +316,21 @@ OperatingSystemPython::CreateRegisterContextForThread(Thread *thread,
|
|||
if (reg_data_addr != LLDB_INVALID_ADDRESS) {
|
||||
// The registers data is in contiguous memory, just create the register
|
||||
// context using the address provided
|
||||
if (log)
|
||||
log->Printf("OperatingSystemPython::CreateRegisterContextForThread (tid "
|
||||
"= 0x%" PRIx64 ", 0x%" PRIx64 ", reg_data_addr = 0x%" PRIx64
|
||||
") creating memory register context",
|
||||
thread->GetID(), thread->GetProtocolID(), reg_data_addr);
|
||||
LLDB_LOGF(log,
|
||||
"OperatingSystemPython::CreateRegisterContextForThread (tid "
|
||||
"= 0x%" PRIx64 ", 0x%" PRIx64 ", reg_data_addr = 0x%" PRIx64
|
||||
") creating memory register context",
|
||||
thread->GetID(), thread->GetProtocolID(), reg_data_addr);
|
||||
reg_ctx_sp = std::make_shared<RegisterContextMemory>(
|
||||
*thread, 0, *GetDynamicRegisterInfo(), reg_data_addr);
|
||||
} else {
|
||||
// No register data address is provided, query the python plug-in to let it
|
||||
// make up the data as it sees fit
|
||||
if (log)
|
||||
log->Printf("OperatingSystemPython::CreateRegisterContextForThread (tid "
|
||||
"= 0x%" PRIx64 ", 0x%" PRIx64
|
||||
") fetching register data from python",
|
||||
thread->GetID(), thread->GetProtocolID());
|
||||
LLDB_LOGF(log,
|
||||
"OperatingSystemPython::CreateRegisterContextForThread (tid "
|
||||
"= 0x%" PRIx64 ", 0x%" PRIx64
|
||||
") fetching register data from python",
|
||||
thread->GetID(), thread->GetProtocolID());
|
||||
|
||||
StructuredData::StringSP reg_context_data =
|
||||
m_interpreter->OSPlugin_RegisterContextData(m_python_object_sp,
|
||||
|
|
@ -351,10 +351,10 @@ OperatingSystemPython::CreateRegisterContextForThread(Thread *thread,
|
|||
// if we still have no register data, fallback on a dummy context to avoid
|
||||
// crashing
|
||||
if (!reg_ctx_sp) {
|
||||
if (log)
|
||||
log->Printf("OperatingSystemPython::CreateRegisterContextForThread (tid "
|
||||
"= 0x%" PRIx64 ") forcing a dummy register context",
|
||||
thread->GetID());
|
||||
LLDB_LOGF(log,
|
||||
"OperatingSystemPython::CreateRegisterContextForThread (tid "
|
||||
"= 0x%" PRIx64 ") forcing a dummy register context",
|
||||
thread->GetID());
|
||||
reg_ctx_sp = std::make_shared<RegisterContextDummy>(
|
||||
*thread, 0, target.GetArchitecture().GetAddressByteSize());
|
||||
}
|
||||
|
|
@ -375,10 +375,10 @@ lldb::ThreadSP OperatingSystemPython::CreateThread(lldb::tid_t tid,
|
|||
addr_t context) {
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
|
||||
|
||||
if (log)
|
||||
log->Printf("OperatingSystemPython::CreateThread (tid = 0x%" PRIx64
|
||||
", context = 0x%" PRIx64 ") fetching register data from python",
|
||||
tid, context);
|
||||
LLDB_LOGF(log,
|
||||
"OperatingSystemPython::CreateThread (tid = 0x%" PRIx64
|
||||
", context = 0x%" PRIx64 ") fetching register data from python",
|
||||
tid, context);
|
||||
|
||||
if (m_interpreter && m_python_object_sp) {
|
||||
// First thing we have to do is to try to get the API lock, and the
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ PlatformSP PlatformAndroid::CreateInstance(bool force, const ArchSpec *arch) {
|
|||
const char *triple_cstr =
|
||||
arch ? arch->GetTriple().getTriple().c_str() : "<null>";
|
||||
|
||||
log->Printf("PlatformAndroid::%s(force=%s, arch={%s,%s})", __FUNCTION__,
|
||||
force ? "true" : "false", arch_name, triple_cstr);
|
||||
LLDB_LOGF(log, "PlatformAndroid::%s(force=%s, arch={%s,%s})", __FUNCTION__,
|
||||
force ? "true" : "false", arch_name, triple_cstr);
|
||||
}
|
||||
|
||||
bool create = force;
|
||||
|
|
@ -113,16 +113,14 @@ PlatformSP PlatformAndroid::CreateInstance(bool force, const ArchSpec *arch) {
|
|||
}
|
||||
|
||||
if (create) {
|
||||
if (log)
|
||||
log->Printf("PlatformAndroid::%s() creating remote-android platform",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log, "PlatformAndroid::%s() creating remote-android platform",
|
||||
__FUNCTION__);
|
||||
return PlatformSP(new PlatformAndroid(false));
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf(
|
||||
"PlatformAndroid::%s() aborting creation of remote-android platform",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(
|
||||
log, "PlatformAndroid::%s() aborting creation of remote-android platform",
|
||||
__FUNCTION__);
|
||||
|
||||
return PlatformSP();
|
||||
}
|
||||
|
|
@ -212,9 +210,8 @@ Status PlatformAndroid::GetFile(const FileSpec &source,
|
|||
auto source_file = source_spec.GetCString(false);
|
||||
|
||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
|
||||
if (log)
|
||||
log->Printf("Got mode == 0 on '%s': try to get file via 'shell cat'",
|
||||
source_file);
|
||||
LLDB_LOGF(log, "Got mode == 0 on '%s': try to get file via 'shell cat'",
|
||||
source_file);
|
||||
|
||||
if (strchr(source_file, '\'') != nullptr)
|
||||
return Status("Doesn't support single-quotes in filenames");
|
||||
|
|
@ -288,9 +285,8 @@ uint32_t PlatformAndroid::GetSdkVersion() {
|
|||
|
||||
if (error.Fail() || version_string.empty()) {
|
||||
Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM);
|
||||
if (log)
|
||||
log->Printf("Get SDK version failed. (error: %s, output: %s)",
|
||||
error.AsCString(), version_string.c_str());
|
||||
LLDB_LOGF(log, "Get SDK version failed. (error: %s, output: %s)",
|
||||
error.AsCString(), version_string.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -337,7 +333,7 @@ Status PlatformAndroid::DownloadSymbolFile(const lldb::ModuleSP &module_sp,
|
|||
|
||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
|
||||
if (log && error.Fail())
|
||||
log->Printf("Failed to remove temp directory: %s", error.AsCString());
|
||||
LLDB_LOGF(log, "Failed to remove temp directory: %s", error.AsCString());
|
||||
});
|
||||
|
||||
FileSpec symfile_platform_filespec(tmpdir);
|
||||
|
|
|
|||
|
|
@ -36,19 +36,16 @@ static Status ForwardPortWithAdb(
|
|||
return error;
|
||||
|
||||
device_id = adb.GetDeviceID();
|
||||
if (log)
|
||||
log->Printf("Connected to Android device \"%s\"", device_id.c_str());
|
||||
LLDB_LOGF(log, "Connected to Android device \"%s\"", device_id.c_str());
|
||||
|
||||
if (remote_port != 0) {
|
||||
if (log)
|
||||
log->Printf("Forwarding remote TCP port %d to local TCP port %d",
|
||||
remote_port, local_port);
|
||||
LLDB_LOGF(log, "Forwarding remote TCP port %d to local TCP port %d",
|
||||
remote_port, local_port);
|
||||
return adb.SetPortForwarding(local_port, remote_port);
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("Forwarding remote socket \"%s\" to local TCP port %d",
|
||||
remote_socket_name.str().c_str(), local_port);
|
||||
LLDB_LOGF(log, "Forwarding remote socket \"%s\" to local TCP port %d",
|
||||
remote_socket_name.str().c_str(), local_port);
|
||||
|
||||
if (!socket_namespace)
|
||||
return Status("Invalid socket namespace");
|
||||
|
|
@ -95,7 +92,7 @@ bool PlatformAndroidRemoteGDBServer::LaunchGDBServer(lldb::pid_t &pid,
|
|||
auto error =
|
||||
MakeConnectURL(pid, remote_port, socket_name.c_str(), connect_url);
|
||||
if (error.Success() && log)
|
||||
log->Printf("gdbserver connect URL: %s", connect_url.c_str());
|
||||
LLDB_LOGF(log, "gdbserver connect URL: %s", connect_url.c_str());
|
||||
|
||||
return error.Success();
|
||||
}
|
||||
|
|
@ -139,8 +136,7 @@ Status PlatformAndroidRemoteGDBServer::ConnectRemote(Args &args) {
|
|||
args.ReplaceArgumentAtIndex(0, connect_url);
|
||||
|
||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
|
||||
if (log)
|
||||
log->Printf("Rewritten platform connect URL: %s", connect_url.c_str());
|
||||
LLDB_LOGF(log, "Rewritten platform connect URL: %s", connect_url.c_str());
|
||||
|
||||
error = PlatformRemoteGDBServer::ConnectRemote(args);
|
||||
if (error.Fail())
|
||||
|
|
@ -164,10 +160,10 @@ void PlatformAndroidRemoteGDBServer::DeleteForwardPort(lldb::pid_t pid) {
|
|||
const auto port = it->second;
|
||||
const auto error = DeleteForwardPortWithAdb(port, m_device_id);
|
||||
if (error.Fail()) {
|
||||
if (log)
|
||||
log->Printf("Failed to delete port forwarding (pid=%" PRIu64
|
||||
", port=%d, device=%s): %s",
|
||||
pid, port, m_device_id.c_str(), error.AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"Failed to delete port forwarding (pid=%" PRIu64
|
||||
", port=%d, device=%s): %s",
|
||||
pid, port, m_device_id.c_str(), error.AsCString());
|
||||
}
|
||||
m_port_forwards.erase(it);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,8 +70,8 @@ PlatformSP PlatformAppleTVSimulator::CreateInstance(bool force,
|
|||
const char *triple_cstr =
|
||||
arch ? arch->GetTriple().getTriple().c_str() : "<null>";
|
||||
|
||||
log->Printf("PlatformAppleTVSimulator::%s(force=%s, arch={%s,%s})",
|
||||
__FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
|
||||
LLDB_LOGF(log, "PlatformAppleTVSimulator::%s(force=%s, arch={%s,%s})",
|
||||
__FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
|
||||
}
|
||||
|
||||
bool create = force;
|
||||
|
|
@ -120,16 +120,14 @@ PlatformSP PlatformAppleTVSimulator::CreateInstance(bool force,
|
|||
}
|
||||
}
|
||||
if (create) {
|
||||
if (log)
|
||||
log->Printf("PlatformAppleTVSimulator::%s() creating platform",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log, "PlatformAppleTVSimulator::%s() creating platform",
|
||||
__FUNCTION__);
|
||||
|
||||
return PlatformSP(new PlatformAppleTVSimulator());
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("PlatformAppleTVSimulator::%s() aborting creation of platform",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log, "PlatformAppleTVSimulator::%s() aborting creation of platform",
|
||||
__FUNCTION__);
|
||||
|
||||
return PlatformSP();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,8 +69,8 @@ PlatformSP PlatformAppleWatchSimulator::CreateInstance(bool force,
|
|||
const char *triple_cstr =
|
||||
arch ? arch->GetTriple().getTriple().c_str() : "<null>";
|
||||
|
||||
log->Printf("PlatformAppleWatchSimulator::%s(force=%s, arch={%s,%s})",
|
||||
__FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
|
||||
LLDB_LOGF(log, "PlatformAppleWatchSimulator::%s(force=%s, arch={%s,%s})",
|
||||
__FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
|
||||
}
|
||||
|
||||
bool create = force;
|
||||
|
|
@ -119,17 +119,15 @@ PlatformSP PlatformAppleWatchSimulator::CreateInstance(bool force,
|
|||
}
|
||||
}
|
||||
if (create) {
|
||||
if (log)
|
||||
log->Printf("PlatformAppleWatchSimulator::%s() creating platform",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log, "PlatformAppleWatchSimulator::%s() creating platform",
|
||||
__FUNCTION__);
|
||||
|
||||
return PlatformSP(new PlatformAppleWatchSimulator());
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf(
|
||||
"PlatformAppleWatchSimulator::%s() aborting creation of platform",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log,
|
||||
"PlatformAppleWatchSimulator::%s() aborting creation of platform",
|
||||
__FUNCTION__);
|
||||
|
||||
return PlatformSP();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -220,16 +220,16 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(
|
|||
lldb::ModuleSP *old_module_sp_ptr, bool *did_create_ptr) {
|
||||
|
||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
|
||||
if (log)
|
||||
log->Printf("[%s] Trying to find module %s/%s - platform path %s/%s symbol "
|
||||
"path %s/%s",
|
||||
(IsHost() ? "host" : "remote"),
|
||||
module_spec.GetFileSpec().GetDirectory().AsCString(),
|
||||
module_spec.GetFileSpec().GetFilename().AsCString(),
|
||||
module_spec.GetPlatformFileSpec().GetDirectory().AsCString(),
|
||||
module_spec.GetPlatformFileSpec().GetFilename().AsCString(),
|
||||
module_spec.GetSymbolFileSpec().GetDirectory().AsCString(),
|
||||
module_spec.GetSymbolFileSpec().GetFilename().AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"[%s] Trying to find module %s/%s - platform path %s/%s symbol "
|
||||
"path %s/%s",
|
||||
(IsHost() ? "host" : "remote"),
|
||||
module_spec.GetFileSpec().GetDirectory().AsCString(),
|
||||
module_spec.GetFileSpec().GetFilename().AsCString(),
|
||||
module_spec.GetPlatformFileSpec().GetDirectory().AsCString(),
|
||||
module_spec.GetPlatformFileSpec().GetFilename().AsCString(),
|
||||
module_spec.GetSymbolFileSpec().GetDirectory().AsCString(),
|
||||
module_spec.GetSymbolFileSpec().GetFilename().AsCString());
|
||||
|
||||
Status err;
|
||||
|
||||
|
|
@ -256,11 +256,10 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(
|
|||
return err;
|
||||
if (FileSystem::Instance().Exists(module_cache_spec)) {
|
||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
|
||||
if (log)
|
||||
log->Printf("[%s] module %s/%s was rsynced and is now there",
|
||||
(IsHost() ? "host" : "remote"),
|
||||
module_spec.GetFileSpec().GetDirectory().AsCString(),
|
||||
module_spec.GetFileSpec().GetFilename().AsCString());
|
||||
LLDB_LOGF(log, "[%s] module %s/%s was rsynced and is now there",
|
||||
(IsHost() ? "host" : "remote"),
|
||||
module_spec.GetFileSpec().GetDirectory().AsCString(),
|
||||
module_spec.GetFileSpec().GetFilename().AsCString());
|
||||
ModuleSpec local_spec(module_cache_spec,
|
||||
module_spec.GetArchitecture());
|
||||
module_sp = std::make_shared<Module>(local_spec);
|
||||
|
|
@ -287,12 +286,11 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(
|
|||
if (low_local != low_remote || high_local != high_remote) {
|
||||
// bring in the remote file
|
||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
|
||||
if (log)
|
||||
log->Printf(
|
||||
"[%s] module %s/%s needs to be replaced from remote copy",
|
||||
(IsHost() ? "host" : "remote"),
|
||||
module_spec.GetFileSpec().GetDirectory().AsCString(),
|
||||
module_spec.GetFileSpec().GetFilename().AsCString());
|
||||
LLDB_LOGF(log,
|
||||
"[%s] module %s/%s needs to be replaced from remote copy",
|
||||
(IsHost() ? "host" : "remote"),
|
||||
module_spec.GetFileSpec().GetDirectory().AsCString(),
|
||||
module_spec.GetFileSpec().GetFilename().AsCString());
|
||||
Status err =
|
||||
BringInRemoteFile(this, module_spec, module_cache_spec);
|
||||
if (err.Fail())
|
||||
|
|
@ -304,30 +302,27 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(
|
|||
module_sp = std::make_shared<Module>(local_spec);
|
||||
module_sp->SetPlatformFileSpec(module_spec.GetFileSpec());
|
||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
|
||||
if (log)
|
||||
log->Printf("[%s] module %s/%s was found in the cache",
|
||||
(IsHost() ? "host" : "remote"),
|
||||
module_spec.GetFileSpec().GetDirectory().AsCString(),
|
||||
module_spec.GetFileSpec().GetFilename().AsCString());
|
||||
LLDB_LOGF(log, "[%s] module %s/%s was found in the cache",
|
||||
(IsHost() ? "host" : "remote"),
|
||||
module_spec.GetFileSpec().GetDirectory().AsCString(),
|
||||
module_spec.GetFileSpec().GetFilename().AsCString());
|
||||
return Status();
|
||||
}
|
||||
|
||||
// bring in the remote module file
|
||||
if (log)
|
||||
log->Printf("[%s] module %s/%s needs to come in remotely",
|
||||
(IsHost() ? "host" : "remote"),
|
||||
module_spec.GetFileSpec().GetDirectory().AsCString(),
|
||||
module_spec.GetFileSpec().GetFilename().AsCString());
|
||||
LLDB_LOGF(log, "[%s] module %s/%s needs to come in remotely",
|
||||
(IsHost() ? "host" : "remote"),
|
||||
module_spec.GetFileSpec().GetDirectory().AsCString(),
|
||||
module_spec.GetFileSpec().GetFilename().AsCString());
|
||||
Status err = BringInRemoteFile(this, module_spec, module_cache_spec);
|
||||
if (err.Fail())
|
||||
return err;
|
||||
if (FileSystem::Instance().Exists(module_cache_spec)) {
|
||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
|
||||
if (log)
|
||||
log->Printf("[%s] module %s/%s is now cached and fine",
|
||||
(IsHost() ? "host" : "remote"),
|
||||
module_spec.GetFileSpec().GetDirectory().AsCString(),
|
||||
module_spec.GetFileSpec().GetFilename().AsCString());
|
||||
LLDB_LOGF(log, "[%s] module %s/%s is now cached and fine",
|
||||
(IsHost() ? "host" : "remote"),
|
||||
module_spec.GetFileSpec().GetDirectory().AsCString(),
|
||||
module_spec.GetFileSpec().GetFilename().AsCString());
|
||||
ModuleSpec local_spec(module_cache_spec, module_spec.GetArchitecture());
|
||||
module_sp = std::make_shared<Module>(local_spec);
|
||||
module_sp->SetPlatformFileSpec(module_spec.GetFileSpec());
|
||||
|
|
@ -1713,8 +1708,11 @@ PlatformDarwin::FindBundleBinaryInExecSearchPaths (const ModuleSpec &module_spec
|
|||
size_t num_module_search_paths = module_search_paths_ptr->GetSize();
|
||||
for (size_t i = 0; i < num_module_search_paths; ++i) {
|
||||
Log *log_verbose = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
|
||||
if (log_verbose)
|
||||
log_verbose->Printf ("PlatformRemoteDarwinDevice::GetSharedModule searching for binary in search-path %s", module_search_paths_ptr->GetFileSpecAtIndex(i).GetPath().c_str());
|
||||
LLDB_LOGF(
|
||||
log_verbose,
|
||||
"PlatformRemoteDarwinDevice::GetSharedModule searching for binary in "
|
||||
"search-path %s",
|
||||
module_search_paths_ptr->GetFileSpecAtIndex(i).GetPath().c_str());
|
||||
// Create a new FileSpec with this module_search_paths_ptr plus just the
|
||||
// filename ("UIFoundation"), then the parent dir plus filename
|
||||
// ("UIFoundation.framework/UIFoundation") etc - up to four names (to
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ PlatformSP PlatformDarwinKernel::CreateInstance(bool force,
|
|||
const char *triple_cstr =
|
||||
arch ? arch->GetTriple().getTriple().c_str() : "<null>";
|
||||
|
||||
log->Printf("PlatformDarwinKernel::%s(force=%s, arch={%s,%s})",
|
||||
__FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
|
||||
LLDB_LOGF(log, "PlatformDarwinKernel::%s(force=%s, arch={%s,%s})",
|
||||
__FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
|
||||
}
|
||||
|
||||
// This is a special plugin that we don't want to activate just based on an
|
||||
|
|
@ -89,10 +89,10 @@ PlatformSP PlatformDarwinKernel::CreateInstance(bool force,
|
|||
// sessions and the DynamicLoaderDarwinPlugin (or a user doing 'platform
|
||||
// select') will force the creation of this Platform plugin.
|
||||
if (!force) {
|
||||
if (log)
|
||||
log->Printf("PlatformDarwinKernel::%s() aborting creation of platform "
|
||||
"because force == false",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log,
|
||||
"PlatformDarwinKernel::%s() aborting creation of platform "
|
||||
"because force == false",
|
||||
__FUNCTION__);
|
||||
return PlatformSP();
|
||||
}
|
||||
|
||||
|
|
@ -154,15 +154,14 @@ PlatformSP PlatformDarwinKernel::CreateInstance(bool force,
|
|||
}
|
||||
}
|
||||
if (create) {
|
||||
if (log)
|
||||
log->Printf("PlatformDarwinKernel::%s() creating platform", __FUNCTION__);
|
||||
LLDB_LOGF(log, "PlatformDarwinKernel::%s() creating platform",
|
||||
__FUNCTION__);
|
||||
|
||||
return PlatformSP(new PlatformDarwinKernel(is_ios_debug_session));
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("PlatformDarwinKernel::%s() aborting creation of platform",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log, "PlatformDarwinKernel::%s() aborting creation of platform",
|
||||
__FUNCTION__);
|
||||
|
||||
return PlatformSP();
|
||||
}
|
||||
|
|
@ -298,24 +297,24 @@ void PlatformDarwinKernel::GetStatus(Stream &strm) {
|
|||
|
||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
|
||||
if (log) {
|
||||
log->Printf("\nkexts with dSYMs");
|
||||
LLDB_LOGF(log, "\nkexts with dSYMs");
|
||||
for (auto pos : m_name_to_kext_path_map_with_dsyms) {
|
||||
log->Printf("%s", pos.second.GetPath().c_str());
|
||||
LLDB_LOGF(log, "%s", pos.second.GetPath().c_str());
|
||||
}
|
||||
log->Printf("\nkexts without dSYMs");
|
||||
LLDB_LOGF(log, "\nkexts without dSYMs");
|
||||
|
||||
for (auto pos : m_name_to_kext_path_map_without_dsyms) {
|
||||
log->Printf("%s", pos.second.GetPath().c_str());
|
||||
LLDB_LOGF(log, "%s", pos.second.GetPath().c_str());
|
||||
}
|
||||
log->Printf("\nkernels with dSYMS");
|
||||
LLDB_LOGF(log, "\nkernels with dSYMS");
|
||||
for (auto fs : m_kernel_binaries_with_dsyms) {
|
||||
log->Printf("%s", fs.GetPath().c_str());
|
||||
LLDB_LOGF(log, "%s", fs.GetPath().c_str());
|
||||
}
|
||||
log->Printf("\nkernels without dSYMS");
|
||||
LLDB_LOGF(log, "\nkernels without dSYMS");
|
||||
for (auto fs : m_kernel_binaries_without_dsyms) {
|
||||
log->Printf("%s", fs.GetPath().c_str());
|
||||
LLDB_LOGF(log, "%s", fs.GetPath().c_str());
|
||||
}
|
||||
log->Printf("\n");
|
||||
LLDB_LOGF(log, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -495,8 +494,8 @@ PlatformDarwinKernel::GetKernelsAndKextsInDirectoryHelper(
|
|||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
|
||||
Log *log_verbose(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM | LLDB_LOG_OPTION_VERBOSE));
|
||||
|
||||
if (log_verbose)
|
||||
log_verbose->Printf ("PlatformDarwinKernel examining '%s'", file_spec.GetPath().c_str());
|
||||
LLDB_LOGF(log_verbose, "PlatformDarwinKernel examining '%s'",
|
||||
file_spec.GetPath().c_str());
|
||||
|
||||
PlatformDarwinKernel *thisp = (PlatformDarwinKernel *)baton;
|
||||
if (ft == llvm::sys::fs::file_type::regular_file ||
|
||||
|
|
@ -507,18 +506,17 @@ PlatformDarwinKernel::GetKernelsAndKextsInDirectoryHelper(
|
|||
file_spec_extension != g_dsym_suffix) {
|
||||
if (KernelHasdSYMSibling(file_spec))
|
||||
{
|
||||
if (log)
|
||||
{
|
||||
log->Printf ("PlatformDarwinKernel registering kernel binary '%s' with dSYM sibling", file_spec.GetPath().c_str());
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"PlatformDarwinKernel registering kernel binary '%s' with "
|
||||
"dSYM sibling",
|
||||
file_spec.GetPath().c_str());
|
||||
thisp->m_kernel_binaries_with_dsyms.push_back(file_spec);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (log)
|
||||
{
|
||||
log->Printf ("PlatformDarwinKernel registering kernel binary '%s', no dSYM", file_spec.GetPath().c_str());
|
||||
}
|
||||
LLDB_LOGF(
|
||||
log, "PlatformDarwinKernel registering kernel binary '%s', no dSYM",
|
||||
file_spec.GetPath().c_str());
|
||||
thisp->m_kernel_binaries_without_dsyms.push_back(file_spec);
|
||||
}
|
||||
return FileSystem::eEnumerateDirectoryResultNext;
|
||||
|
|
@ -554,8 +552,9 @@ PlatformDarwinKernel::GetKernelsAndKextsInDirectoryHelper(
|
|||
if (recurse && file_spec_extension != g_dsym_suffix &&
|
||||
file_spec_extension != g_kext_suffix &&
|
||||
file_spec_extension != g_bundle_suffix) {
|
||||
if (log_verbose)
|
||||
log_verbose->Printf ("PlatformDarwinKernel descending into directory '%s'", file_spec.GetPath().c_str());
|
||||
LLDB_LOGF(log_verbose,
|
||||
"PlatformDarwinKernel descending into directory '%s'",
|
||||
file_spec.GetPath().c_str());
|
||||
return FileSystem::eEnumerateDirectoryResultEnter;
|
||||
} else {
|
||||
return FileSystem::eEnumerateDirectoryResultNext;
|
||||
|
|
@ -574,19 +573,18 @@ void PlatformDarwinKernel::AddKextToMap(PlatformDarwinKernel *thisp,
|
|||
ConstString bundle_conststr(bundle_id_buf);
|
||||
if (KextHasdSYMSibling(file_spec))
|
||||
{
|
||||
if (log)
|
||||
{
|
||||
log->Printf ("PlatformDarwinKernel registering kext binary '%s' with dSYM sibling", file_spec.GetPath().c_str());
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"PlatformDarwinKernel registering kext binary '%s' with dSYM "
|
||||
"sibling",
|
||||
file_spec.GetPath().c_str());
|
||||
thisp->m_name_to_kext_path_map_with_dsyms.insert(
|
||||
std::pair<ConstString, FileSpec>(bundle_conststr, file_spec));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (log)
|
||||
{
|
||||
log->Printf ("PlatformDarwinKernel registering kext binary '%s', no dSYM", file_spec.GetPath().c_str());
|
||||
}
|
||||
LLDB_LOGF(log,
|
||||
"PlatformDarwinKernel registering kext binary '%s', no dSYM",
|
||||
file_spec.GetPath().c_str());
|
||||
thisp->m_name_to_kext_path_map_without_dsyms.insert(
|
||||
std::pair<ConstString, FileSpec>(bundle_conststr, file_spec));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,8 +70,8 @@ PlatformSP PlatformMacOSX::CreateInstance(bool force, const ArchSpec *arch) {
|
|||
const char *triple_cstr =
|
||||
arch ? arch->GetTriple().getTriple().c_str() : "<null>";
|
||||
|
||||
log->Printf("PlatformMacOSX::%s(force=%s, arch={%s,%s})", __FUNCTION__,
|
||||
force ? "true" : "false", arch_name, triple_cstr);
|
||||
LLDB_LOGF(log, "PlatformMacOSX::%s(force=%s, arch={%s,%s})", __FUNCTION__,
|
||||
force ? "true" : "false", arch_name, triple_cstr);
|
||||
}
|
||||
|
||||
// The only time we create an instance is when we are creating a remote
|
||||
|
|
@ -117,14 +117,12 @@ PlatformSP PlatformMacOSX::CreateInstance(bool force, const ArchSpec *arch) {
|
|||
}
|
||||
}
|
||||
if (create) {
|
||||
if (log)
|
||||
log->Printf("PlatformMacOSX::%s() creating platform", __FUNCTION__);
|
||||
LLDB_LOGF(log, "PlatformMacOSX::%s() creating platform", __FUNCTION__);
|
||||
return PlatformSP(new PlatformMacOSX(is_host));
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("PlatformMacOSX::%s() aborting creation of platform",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log, "PlatformMacOSX::%s() aborting creation of platform",
|
||||
__FUNCTION__);
|
||||
|
||||
return PlatformSP();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ PlatformSP PlatformRemoteAppleBridge::CreateInstance(bool force,
|
|||
const char *triple_cstr =
|
||||
arch ? arch->GetTriple().getTriple().c_str() : "<null>";
|
||||
|
||||
log->Printf("PlatformRemoteAppleBridge::%s(force=%s, arch={%s,%s})",
|
||||
__FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
|
||||
LLDB_LOGF(log, "PlatformRemoteAppleBridge::%s(force=%s, arch={%s,%s})",
|
||||
__FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
|
||||
}
|
||||
|
||||
bool create = force;
|
||||
|
|
@ -112,16 +112,15 @@ PlatformSP PlatformRemoteAppleBridge::CreateInstance(bool force,
|
|||
}
|
||||
|
||||
if (create) {
|
||||
if (log)
|
||||
log->Printf("PlatformRemoteAppleBridge::%s() creating platform",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log, "PlatformRemoteAppleBridge::%s() creating platform",
|
||||
__FUNCTION__);
|
||||
|
||||
return lldb::PlatformSP(new PlatformRemoteAppleBridge());
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("PlatformRemoteAppleBridge::%s() aborting creation of platform",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log,
|
||||
"PlatformRemoteAppleBridge::%s() aborting creation of platform",
|
||||
__FUNCTION__);
|
||||
|
||||
return lldb::PlatformSP();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,8 +69,8 @@ PlatformSP PlatformRemoteAppleTV::CreateInstance(bool force,
|
|||
const char *triple_cstr =
|
||||
arch ? arch->GetTriple().getTriple().c_str() : "<null>";
|
||||
|
||||
log->Printf("PlatformRemoteAppleTV::%s(force=%s, arch={%s,%s})",
|
||||
__FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
|
||||
LLDB_LOGF(log, "PlatformRemoteAppleTV::%s(force=%s, arch={%s,%s})",
|
||||
__FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
|
||||
}
|
||||
|
||||
bool create = force;
|
||||
|
|
@ -116,16 +116,14 @@ PlatformSP PlatformRemoteAppleTV::CreateInstance(bool force,
|
|||
}
|
||||
|
||||
if (create) {
|
||||
if (log)
|
||||
log->Printf("PlatformRemoteAppleTV::%s() creating platform",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log, "PlatformRemoteAppleTV::%s() creating platform",
|
||||
__FUNCTION__);
|
||||
|
||||
return lldb::PlatformSP(new PlatformRemoteAppleTV());
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("PlatformRemoteAppleTV::%s() aborting creation of platform",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log, "PlatformRemoteAppleTV::%s() aborting creation of platform",
|
||||
__FUNCTION__);
|
||||
|
||||
return lldb::PlatformSP();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,8 +66,8 @@ PlatformSP PlatformRemoteAppleWatch::CreateInstance(bool force,
|
|||
const char *triple_cstr =
|
||||
arch ? arch->GetTriple().getTriple().c_str() : "<null>";
|
||||
|
||||
log->Printf("PlatformRemoteAppleWatch::%s(force=%s, arch={%s,%s})",
|
||||
__FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
|
||||
LLDB_LOGF(log, "PlatformRemoteAppleWatch::%s(force=%s, arch={%s,%s})",
|
||||
__FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
|
||||
}
|
||||
|
||||
bool create = force;
|
||||
|
|
@ -122,16 +122,14 @@ PlatformSP PlatformRemoteAppleWatch::CreateInstance(bool force,
|
|||
#endif
|
||||
|
||||
if (create) {
|
||||
if (log)
|
||||
log->Printf("PlatformRemoteAppleWatch::%s() creating platform",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log, "PlatformRemoteAppleWatch::%s() creating platform",
|
||||
__FUNCTION__);
|
||||
|
||||
return lldb::PlatformSP(new PlatformRemoteAppleWatch());
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("PlatformRemoteAppleWatch::%s() aborting creation of platform",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log, "PlatformRemoteAppleWatch::%s() aborting creation of platform",
|
||||
__FUNCTION__);
|
||||
|
||||
return lldb::PlatformSP();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,17 +150,21 @@ bool PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded() {
|
|||
const SDKDirectoryInfo sdk_sysroot_directory_info(sdk_sysroot_fspec);
|
||||
m_sdk_directory_infos.push_back(sdk_sysroot_directory_info);
|
||||
if (log) {
|
||||
log->Printf("PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded added "
|
||||
"--sysroot SDK directory %s",
|
||||
m_sdk_sysroot.GetCString());
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded added "
|
||||
"--sysroot SDK directory %s",
|
||||
m_sdk_sysroot.GetCString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
const char *device_support_dir = GetDeviceSupportDirectory();
|
||||
if (log) {
|
||||
log->Printf("PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded Got "
|
||||
"DeviceSupport directory %s",
|
||||
device_support_dir);
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded Got "
|
||||
"DeviceSupport directory %s",
|
||||
device_support_dir);
|
||||
}
|
||||
if (device_support_dir) {
|
||||
const bool find_directories = true;
|
||||
|
|
@ -183,9 +187,11 @@ bool PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded() {
|
|||
if (FileSystem::Instance().Exists(sdk_symbols_symlink_fspec)) {
|
||||
m_sdk_directory_infos.push_back(sdk_directory_info);
|
||||
if (log) {
|
||||
log->Printf("PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
|
||||
"added builtin SDK directory %s",
|
||||
sdk_symbols_symlink_fspec.GetPath().c_str());
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
|
||||
"added builtin SDK directory %s",
|
||||
sdk_symbols_symlink_fspec.GetPath().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -202,9 +208,11 @@ bool PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded() {
|
|||
FileSystem::Instance().Resolve(local_sdk_cache);
|
||||
if (FileSystem::Instance().Exists(local_sdk_cache)) {
|
||||
if (log) {
|
||||
log->Printf("PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
|
||||
"searching %s for additional SDKs",
|
||||
local_sdk_cache.GetPath().c_str());
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
|
||||
"searching %s for additional SDKs",
|
||||
local_sdk_cache.GetPath().c_str());
|
||||
}
|
||||
char path[PATH_MAX];
|
||||
if (local_sdk_cache.GetPath(path, sizeof(path))) {
|
||||
|
|
@ -217,9 +225,12 @@ bool PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded() {
|
|||
for (uint32_t i = num_installed; i < num_sdk_infos; ++i) {
|
||||
m_sdk_directory_infos[i].user_cached = true;
|
||||
if (log) {
|
||||
log->Printf("PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
|
||||
"user SDK directory %s",
|
||||
m_sdk_directory_infos[i].directory.GetPath().c_str());
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"PlatformRemoteDarwinDevice::"
|
||||
"UpdateSDKDirectoryInfosIfNeeded "
|
||||
"user SDK directory %s",
|
||||
m_sdk_directory_infos[i].directory.GetPath().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -240,9 +251,11 @@ bool PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded() {
|
|||
if (FileSystem::Instance().Exists(sdk_symbols_symlink_fspec)) {
|
||||
m_sdk_directory_infos.push_back(sdk_directory_info);
|
||||
if (log) {
|
||||
log->Printf("PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
|
||||
"added env var SDK directory %s",
|
||||
sdk_symbols_symlink_fspec.GetPath().c_str());
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
|
||||
"added env var SDK directory %s",
|
||||
sdk_symbols_symlink_fspec.GetPath().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -418,10 +431,8 @@ bool PlatformRemoteDarwinDevice::GetFileInSDK(const char *platform_file_path,
|
|||
local_file.AppendPathComponent(platform_file_path);
|
||||
FileSystem::Instance().Resolve(local_file);
|
||||
if (FileSystem::Instance().Exists(local_file)) {
|
||||
if (log)
|
||||
log->Printf("Found a copy of %s in the SDK dir %s/%s",
|
||||
platform_file_path, sdkroot_path.c_str(),
|
||||
paths_to_try[i]);
|
||||
LLDB_LOGF(log, "Found a copy of %s in the SDK dir %s/%s",
|
||||
platform_file_path, sdkroot_path.c_str(), paths_to_try[i]);
|
||||
return true;
|
||||
}
|
||||
local_file.Clear();
|
||||
|
|
@ -449,8 +460,8 @@ Status PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file,
|
|||
FileSystem::Instance().Resolve(local_file);
|
||||
if (FileSystem::Instance().Exists(local_file)) {
|
||||
if (log) {
|
||||
log->Printf("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;
|
||||
}
|
||||
|
|
@ -462,7 +473,8 @@ Status PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file,
|
|||
FileSystem::Instance().Resolve(local_file);
|
||||
if (FileSystem::Instance().Exists(local_file)) {
|
||||
if (log) {
|
||||
log->Printf(
|
||||
LLDB_LOGF(
|
||||
log,
|
||||
"Found a copy of %s in the DeviceSupport dir %s/Symbols.Internal",
|
||||
platform_file_path, os_version_dir);
|
||||
}
|
||||
|
|
@ -475,8 +487,9 @@ Status PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file,
|
|||
FileSystem::Instance().Resolve(local_file);
|
||||
if (FileSystem::Instance().Exists(local_file)) {
|
||||
if (log) {
|
||||
log->Printf("Found a copy of %s in the DeviceSupport dir %s/Symbols",
|
||||
platform_file_path, os_version_dir);
|
||||
LLDB_LOGF(log,
|
||||
"Found a copy of %s in the DeviceSupport dir %s/Symbols",
|
||||
platform_file_path, os_version_dir);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,8 +61,8 @@ PlatformSP PlatformRemoteiOS::CreateInstance(bool force, const ArchSpec *arch) {
|
|||
const char *triple_cstr =
|
||||
arch ? arch->GetTriple().getTriple().c_str() : "<null>";
|
||||
|
||||
log->Printf("PlatformRemoteiOS::%s(force=%s, arch={%s,%s})", __FUNCTION__,
|
||||
force ? "true" : "false", arch_name, triple_cstr);
|
||||
LLDB_LOGF(log, "PlatformRemoteiOS::%s(force=%s, arch={%s,%s})",
|
||||
__FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
|
||||
}
|
||||
|
||||
bool create = force;
|
||||
|
|
@ -111,14 +111,14 @@ PlatformSP PlatformRemoteiOS::CreateInstance(bool force, const ArchSpec *arch) {
|
|||
|
||||
if (create) {
|
||||
if (log)
|
||||
log->Printf("PlatformRemoteiOS::%s() creating platform", __FUNCTION__);
|
||||
LLDB_LOGF(log, "PlatformRemoteiOS::%s() creating platform", __FUNCTION__);
|
||||
|
||||
return lldb::PlatformSP(new PlatformRemoteiOS());
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf("PlatformRemoteiOS::%s() aborting creation of platform",
|
||||
__FUNCTION__);
|
||||
LLDB_LOGF(log, "PlatformRemoteiOS::%s() aborting creation of platform",
|
||||
__FUNCTION__);
|
||||
|
||||
return lldb::PlatformSP();
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue