Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ bool ClangExpressionDeclMap::AddPersistentVariable(const NamedDecl *decl,
return true;
}

Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);
ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx;
Target *target = exe_ctx.GetTargetPtr();
if (target == nullptr)
Expand Down Expand Up @@ -328,7 +328,7 @@ bool ClangExpressionDeclMap::AddValueToStruct(const NamedDecl *decl,

bool is_persistent_variable = false;

Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

m_struct_vars->m_struct_laid_out = false;

Expand Down Expand Up @@ -646,7 +646,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(

const ConstString name(context.m_decl_name.getAsString().c_str());

Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

if (log) {
if (!context.m_decl_context)
Expand Down Expand Up @@ -728,7 +728,7 @@ clang::NamedDecl *ClangExpressionDeclMap::GetPersistentDecl(ConstString name) {

void ClangExpressionDeclMap::SearchPersistenDecls(NameSearchContext &context,
const ConstString name) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

NamedDecl *persistent_decl = GetPersistentDecl(name);

Expand Down Expand Up @@ -756,7 +756,7 @@ void ClangExpressionDeclMap::SearchPersistenDecls(NameSearchContext &context,
}

void ClangExpressionDeclMap::LookUpLldbClass(NameSearchContext &context) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr();
SymbolContext sym_ctx;
Expand Down Expand Up @@ -857,7 +857,7 @@ void ClangExpressionDeclMap::LookUpLldbClass(NameSearchContext &context) {
}

void ClangExpressionDeclMap::LookUpLldbObjCClass(NameSearchContext &context) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr();

Expand Down Expand Up @@ -1014,7 +1014,7 @@ void ClangExpressionDeclMap::LookupLocalVarNamespace(

void ClangExpressionDeclMap::LookupInModulesDeclVendor(
NameSearchContext &context, ConstString name) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

if (!m_target)
return;
Expand Down Expand Up @@ -1331,7 +1331,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
const CompilerDeclContext &namespace_decl) {
assert(m_ast_context);

Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

const ConstString name(context.m_decl_name.getAsString().c_str());
if (IgnoreName(name, false))
Expand Down Expand Up @@ -1460,7 +1460,7 @@ bool ClangExpressionDeclMap::GetVariableValue(VariableSP &var,
lldb_private::Value &var_location,
TypeFromUser *user_type,
TypeFromParser *parser_type) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

Type *var_type = var->GetType();

Expand Down Expand Up @@ -1546,7 +1546,7 @@ void ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context,
ValueObjectSP valobj) {
assert(m_parser_vars.get());

Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

TypeFromUser ut;
TypeFromParser pt;
Expand Down Expand Up @@ -1600,7 +1600,7 @@ void ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context,

void ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context,
ExpressionVariableSP &pvar_sp) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

TypeFromUser user_type(
llvm::cast<ClangExpressionVariable>(pvar_sp.get())->GetTypeFromUser());
Expand Down Expand Up @@ -1633,7 +1633,7 @@ void ClangExpressionDeclMap::AddOneGenericVariable(NameSearchContext &context,
const Symbol &symbol) {
assert(m_parser_vars.get());

Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr();

Expand Down Expand Up @@ -1683,7 +1683,7 @@ void ClangExpressionDeclMap::AddOneGenericVariable(NameSearchContext &context,

void ClangExpressionDeclMap::AddOneRegister(NameSearchContext &context,
const RegisterInfo *reg_info) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

CompilerType clang_type =
m_clang_ast_context->GetBuiltinTypeForEncodingAndBitSize(
Expand Down Expand Up @@ -1725,7 +1725,7 @@ void ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context,
Symbol *symbol) {
assert(m_parser_vars.get());

Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

NamedDecl *function_decl = nullptr;
Address fun_address;
Expand Down Expand Up @@ -1895,7 +1895,7 @@ void ClangExpressionDeclMap::AddContextClassType(NameSearchContext &context,
const TypeFromUser &ut) {
CompilerType copied_clang_type = GuardedCopyType(ut);

Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

if (!copied_clang_type) {
LLDB_LOG(log,
Expand Down Expand Up @@ -1961,7 +1961,7 @@ void ClangExpressionDeclMap::AddOneType(NameSearchContext &context,
CompilerType copied_clang_type = GuardedCopyType(ut);

if (!copied_clang_type) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

LLDB_LOG(log,
"ClangExpressionDeclMap::AddOneType - Couldn't import the type");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class ClangDiagnosticManagerAdapter : public clang::DiagnosticConsumer {
// when we move the expression result ot the ScratchASTContext). Let's at
// least log these diagnostics until we find a way to properly render
// them and display them to the user.
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);
if (log) {
llvm::SmallVector<char, 32> diag_str;
Info.FormatDiagnostic(diag_str);
Expand Down Expand Up @@ -282,7 +282,7 @@ class ClangDiagnosticManagerAdapter : public clang::DiagnosticConsumer {
static void SetupModuleHeaderPaths(CompilerInstance *compiler,
std::vector<std::string> include_directories,
lldb::TargetSP target_sp) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

HeaderSearchOptions &search_opts = compiler->getHeaderSearchOpts();

Expand Down Expand Up @@ -364,7 +364,7 @@ ClangExpressionParser::ClangExpressionParser(
m_pp_callbacks(nullptr),
m_include_directories(std::move(include_directories)),
m_filename(std::move(filename)) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

// We can't compile expressions without a target. So if the exe_scope is
// null or doesn't have a target, then we just need to get out of here. I'll
Expand Down Expand Up @@ -1325,7 +1325,7 @@ lldb_private::Status ClangExpressionParser::PrepareForExecution(
bool &can_interpret, ExecutionPolicy execution_policy) {
func_addr = LLDB_INVALID_ADDRESS;
func_end = LLDB_INVALID_ADDRESS;
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

lldb_private::Status err;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ ClangFunctionCaller::CompileFunction(lldb::ThreadSP thread_to_use_sp,
m_wrapper_function_text.append(args_list_buffer);
m_wrapper_function_text.append(");\n}\n");

Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);
LLDB_LOGF(log, "Expression: \n\n%s\n\n", m_wrapper_function_text.c_str());

// Okay, now compile this expression
Expand Down
6 changes: 3 additions & 3 deletions lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ using namespace lldb_private;
static bool VerifyClangPath(const llvm::Twine &clang_path) {
if (FileSystem::Instance().IsDirectory(clang_path))
return true;
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
Log *log = GetLog(LLDBLog::Host);
LLDB_LOGF(log,
"VerifyClangPath(): "
"failed to stat clang resource directory at \"%s\"",
Expand All @@ -47,7 +47,7 @@ static bool VerifyClangPath(const llvm::Twine &clang_path) {
static bool DefaultComputeClangResourceDirectory(FileSpec &lldb_shlib_spec,
FileSpec &file_spec,
bool verify) {
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
Log *log = GetLog(LLDBLog::Host);
std::string raw_path = lldb_shlib_spec.GetPath();
llvm::StringRef parent_dir = llvm::sys::path::parent_path(raw_path);

Expand Down Expand Up @@ -157,7 +157,7 @@ FileSpec lldb_private::GetClangResourceDir() {
if (FileSpec lldb_file_spec = HostInfo::GetShlibDir())
ComputeClangResourceDirectory(lldb_file_spec, g_cached_resource_dir,
true);
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
Log *log = GetLog(LLDBLog::Host);
LLDB_LOGF(log, "GetClangResourceDir() => '%s'",
g_cached_resource_dir.GetPath().c_str());
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class ClangModulesDeclVendorImpl : public ClangModulesDeclVendor {
} // anonymous namespace

StoringDiagnosticConsumer::StoringDiagnosticConsumer() {
m_log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS);
m_log = GetLog(LLDBLog::Expressions);

clang::DiagnosticOptions *m_options = new clang::DiagnosticOptions();
m_os = std::make_shared<llvm::raw_string_ostream>(m_output);
Expand Down Expand Up @@ -656,7 +656,7 @@ ClangModulesDeclVendor::Create(Target &target) {
for (const std::string &arg : compiler_invocation_arguments)
compiler_invocation_argument_cstrs.push_back(arg.c_str());

Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);
LLDB_LOG(log, "ClangModulesDeclVendor's compiler flags {0:$[ ]}",
llvm::make_range(compiler_invocation_arguments.begin(),
compiler_invocation_arguments.end()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ ClangUserExpression::ClangUserExpression(
ClangUserExpression::~ClangUserExpression() = default;

void ClangUserExpression::ScanContext(ExecutionContext &exe_ctx, Status &err) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

LLDB_LOGF(log, "ClangUserExpression::ScanContext()");

Expand Down Expand Up @@ -456,14 +456,14 @@ static bool SupportsCxxModuleImport(lldb::LanguageType language) {
/// Utility method that puts a message into the expression log and
/// returns an invalid module configuration.
static CppModuleConfiguration LogConfigError(const std::string &msg) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);
LLDB_LOG(log, "[C++ module config] {0}", msg);
return CppModuleConfiguration();
}

CppModuleConfiguration GetModuleConfig(lldb::LanguageType language,
ExecutionContext &exe_ctx) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

// Don't do anything if this is not a C++ module configuration.
if (!SupportsCxxModuleImport(language))
Expand Down Expand Up @@ -621,7 +621,7 @@ bool ClangUserExpression::TryParse(
}

void ClangUserExpression::SetupCppModuleImports(ExecutionContext &exe_ctx) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

CppModuleConfiguration module_config = GetModuleConfig(m_language, exe_ctx);
m_imported_cpp_modules = module_config.GetImportedModules();
Expand All @@ -647,7 +647,7 @@ bool ClangUserExpression::Parse(DiagnosticManager &diagnostic_manager,
lldb_private::ExecutionPolicy execution_policy,
bool keep_result_in_memory,
bool generate_debug_info) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

if (!PrepareForParsing(diagnostic_manager, exe_ctx, /*for_completion*/ false))
return false;
Expand Down Expand Up @@ -806,7 +806,7 @@ static void AbsPosToLineColumnPos(size_t abs_pos, llvm::StringRef code,
bool ClangUserExpression::Complete(ExecutionContext &exe_ctx,
CompletionRequest &request,
unsigned complete_pos) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

// We don't want any visible feedback when completing an expression. Mostly
// because the results we get from an incomplete invocation are probably not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ T *createDecl(ASTImporter &importer, Decl *from_d, Args &&... args) {
}

llvm::Optional<Decl *> CxxModuleHandler::tryInstantiateStdTemplate(Decl *d) {
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS);
Log *log = GetLog(LLDBLog::Expressions);

// If we don't have a template to instiantiate, then there is nothing to do.
auto td = dyn_cast<ClassTemplateSpecializationDecl>(d);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ class ValidPointerChecker : public Instrumenter {

protected:
bool InstrumentInstruction(llvm::Instruction *inst) override {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

LLDB_LOGF(log, "Instrumenting load/store instruction: %s\n",
PrintValue(inst).c_str());
Expand Down Expand Up @@ -467,7 +467,7 @@ class ObjcObjectChecker : public Instrumenter {
}

bool InspectInstruction(llvm::Instruction &i) override {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

CallInst *call_inst = dyn_cast<CallInst>(&i);

Expand Down Expand Up @@ -538,7 +538,7 @@ IRDynamicChecks::IRDynamicChecks(
IRDynamicChecks::~IRDynamicChecks() = default;

bool IRDynamicChecks::runOnModule(llvm::Module &M) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

llvm::Function *function = M.getFunction(StringRef(m_func_name));

Expand Down
49 changes: 17 additions & 32 deletions lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <map>

using namespace llvm;
using lldb_private::LLDBLog;

typedef SmallVector<Instruction *, 2> InstrList;

Expand Down Expand Up @@ -158,8 +159,7 @@ static bool isGuardVariableSymbol(llvm::StringRef mangled_symbol,
}

bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) {
lldb_private::Log *log(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
lldb_private::Log *log(GetLog(LLDBLog::Expressions));

if (!m_resolve_vars)
return true;
Expand Down Expand Up @@ -399,8 +399,7 @@ bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) {

bool IRForTarget::RewriteObjCConstString(llvm::GlobalVariable *ns_str,
llvm::GlobalVariable *cstr) {
lldb_private::Log *log(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
lldb_private::Log *log(GetLog(LLDBLog::Expressions));

Type *ns_str_ty = ns_str->getType();

Expand Down Expand Up @@ -537,8 +536,7 @@ bool IRForTarget::RewriteObjCConstString(llvm::GlobalVariable *ns_str,
}

bool IRForTarget::RewriteObjCConstStrings() {
lldb_private::Log *log(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
lldb_private::Log *log(GetLog(LLDBLog::Expressions));

ValueSymbolTable &value_symbol_table = m_module->getValueSymbolTable();

Expand Down Expand Up @@ -750,8 +748,7 @@ static bool IsObjCSelectorRef(Value *value) {

// This function does not report errors; its callers are responsible.
bool IRForTarget::RewriteObjCSelector(Instruction *selector_load) {
lldb_private::Log *log(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
lldb_private::Log *log(GetLog(LLDBLog::Expressions));

LoadInst *load = dyn_cast<LoadInst>(selector_load);

Expand Down Expand Up @@ -877,8 +874,7 @@ bool IRForTarget::RewriteObjCSelector(Instruction *selector_load) {
}

bool IRForTarget::RewriteObjCSelectors(BasicBlock &basic_block) {
lldb_private::Log *log(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
lldb_private::Log *log(GetLog(LLDBLog::Expressions));

InstrList selector_loads;

Expand Down Expand Up @@ -912,8 +908,7 @@ static bool IsObjCClassReference(Value *value) {

// This function does not report errors; its callers are responsible.
bool IRForTarget::RewriteObjCClassReference(Instruction *class_load) {
lldb_private::Log *log(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
lldb_private::Log *log(GetLog(LLDBLog::Expressions));

LoadInst *load = dyn_cast<LoadInst>(class_load);

Expand Down Expand Up @@ -1029,8 +1024,7 @@ bool IRForTarget::RewriteObjCClassReference(Instruction *class_load) {
}

bool IRForTarget::RewriteObjCClassReferences(BasicBlock &basic_block) {
lldb_private::Log *log(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
lldb_private::Log *log(GetLog(LLDBLog::Expressions));

InstrList class_loads;

Expand All @@ -1057,8 +1051,7 @@ bool IRForTarget::RewriteObjCClassReferences(BasicBlock &basic_block) {

// This function does not report errors; its callers are responsible.
bool IRForTarget::RewritePersistentAlloc(llvm::Instruction *persistent_alloc) {
lldb_private::Log *log(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
lldb_private::Log *log(GetLog(LLDBLog::Expressions));

AllocaInst *alloc = dyn_cast<AllocaInst>(persistent_alloc);

Expand Down Expand Up @@ -1129,8 +1122,7 @@ bool IRForTarget::RewritePersistentAllocs(llvm::BasicBlock &basic_block) {
if (!m_resolve_vars)
return true;

lldb_private::Log *log(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
lldb_private::Log *log(GetLog(LLDBLog::Expressions));

InstrList pvar_allocs;

Expand Down Expand Up @@ -1171,8 +1163,7 @@ bool IRForTarget::RewritePersistentAllocs(llvm::BasicBlock &basic_block) {

// This function does not report errors; its callers are responsible.
bool IRForTarget::MaybeHandleVariable(Value *llvm_value_ptr) {
lldb_private::Log *log(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
lldb_private::Log *log(GetLog(LLDBLog::Expressions));

LLDB_LOG(log, "MaybeHandleVariable ({0})", PrintValue(llvm_value_ptr));

Expand Down Expand Up @@ -1266,8 +1257,7 @@ bool IRForTarget::MaybeHandleVariable(Value *llvm_value_ptr) {

// This function does not report errors; its callers are responsible.
bool IRForTarget::HandleSymbol(Value *symbol) {
lldb_private::Log *log(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
lldb_private::Log *log(GetLog(LLDBLog::Expressions));

lldb_private::ConstString name(symbol->getName().str().c_str());

Expand Down Expand Up @@ -1298,8 +1288,7 @@ bool IRForTarget::HandleSymbol(Value *symbol) {
}

bool IRForTarget::MaybeHandleCallArguments(CallInst *Old) {
lldb_private::Log *log(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
lldb_private::Log *log(GetLog(LLDBLog::Expressions));

LLDB_LOG(log, "MaybeHandleCallArguments({0})", PrintValue(Old));

Expand All @@ -1317,8 +1306,7 @@ bool IRForTarget::MaybeHandleCallArguments(CallInst *Old) {
}

bool IRForTarget::HandleObjCClass(Value *classlist_reference) {
lldb_private::Log *log(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
lldb_private::Log *log(GetLog(LLDBLog::Expressions));

GlobalVariable *global_variable =
dyn_cast<GlobalVariable>(classlist_reference);
Expand Down Expand Up @@ -1419,8 +1407,7 @@ bool IRForTarget::ResolveCalls(BasicBlock &basic_block) {
}

bool IRForTarget::ResolveExternals(Function &llvm_function) {
lldb_private::Log *log(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
lldb_private::Log *log(GetLog(LLDBLog::Expressions));

for (GlobalVariable &global_var : m_module->globals()) {
llvm::StringRef global_name = global_var.getName();
Expand Down Expand Up @@ -1638,8 +1625,7 @@ bool IRForTarget::ReplaceVariables(Function &llvm_function) {
if (!m_resolve_vars)
return true;

lldb_private::Log *log(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
lldb_private::Log *log(GetLog(LLDBLog::Expressions));

m_decl_map->DoStructLayout();

Expand Down Expand Up @@ -1827,8 +1813,7 @@ bool IRForTarget::ReplaceVariables(Function &llvm_function) {
}

bool IRForTarget::runOnModule(Module &llvm_module) {
lldb_private::Log *log(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
lldb_private::Log *log(GetLog(LLDBLog::Expressions));

m_module = &llvm_module;
m_target_data = std::make_unique<DataLayout>(m_module);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ clang::NamedDecl *NameSearchContext::AddFunDecl(const CompilerType &type,

func_decl->setParams(ArrayRef<ParmVarDecl *>(parm_var_decls));
} else {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Expressions);

LLDB_LOG(log, "Function type wasn't a FunctionProtoType");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ bool EmulateInstructionPPC64::EmulateMFSPR(uint32_t opcode) {
if (rt != gpr_r0_ppc64le || spr != SPR_LR)
return false;

Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND));
Log *log = GetLog(LLDBLog::Unwind);
LLDB_LOG(log, "EmulateMFSPR: {0:X+8}: mfspr r0, lr", m_addr);

bool success;
Expand All @@ -237,7 +237,7 @@ bool EmulateInstructionPPC64::EmulateLD(uint32_t opcode) {
if (ra != gpr_r1_ppc64le || rt != gpr_r1_ppc64le || ids != 0)
return false;

Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND));
Log *log = GetLog(LLDBLog::Unwind);
LLDB_LOG(log, "EmulateLD: {0:X+8}: ld r{1}, {2}(r{3})", m_addr, rt, ids, ra);

RegisterInfo r1_info;
Expand Down Expand Up @@ -274,7 +274,7 @@ bool EmulateInstructionPPC64::EmulateSTD(uint32_t opcode) {
return false;

int32_t ids = llvm::SignExtend32<16>(ds << 2);
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND));
Log *log = GetLog(LLDBLog::Unwind);
LLDB_LOG(log, "EmulateSTD: {0:X+8}: std{1} r{2}, {3}(r{4})", m_addr,
u ? "u" : "", rs, ids, ra);

Expand Down Expand Up @@ -331,7 +331,7 @@ bool EmulateInstructionPPC64::EmulateOR(uint32_t opcode) {
(ra != gpr_r30_ppc64le && ra != gpr_r31_ppc64le) || rb != gpr_r1_ppc64le)
return false;

Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND));
Log *log = GetLog(LLDBLog::Unwind);
LLDB_LOG(log, "EmulateOR: {0:X+8}: mr r{1}, r{2}", m_addr, ra, rb);

// set context
Expand Down Expand Up @@ -366,7 +366,7 @@ bool EmulateInstructionPPC64::EmulateADDI(uint32_t opcode) {
return false;

int32_t si_val = llvm::SignExtend32<16>(si);
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND));
Log *log = GetLog(LLDBLog::Unwind);
LLDB_LOG(log, "EmulateADDI: {0:X+8}: addi r1, r1, {1}", m_addr, si_val);

// set context
Expand Down
6 changes: 3 additions & 3 deletions lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ void JITLoaderGDB::SetJITBreakpoint(lldb_private::ModuleList &module_list) {
if (DidSetJITBreakpoint())
return;

Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_JIT_LOADER));
Log *log = GetLog(LLDBLog::JITLoader);
LLDB_LOGF(log, "JITLoaderGDB::%s looking for JIT register hook",
__FUNCTION__);

Expand Down Expand Up @@ -218,7 +218,7 @@ bool JITLoaderGDB::JITDebugBreakpointHit(void *baton,
StoppointCallbackContext *context,
user_id_t break_id,
user_id_t break_loc_id) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_JIT_LOADER));
Log *log = GetLog(LLDBLog::JITLoader);
LLDB_LOGF(log, "JITLoaderGDB::%s hit JIT breakpoint", __FUNCTION__);
JITLoaderGDB *instance = static_cast<JITLoaderGDB *>(baton);
return instance->ReadJITDescriptor(false);
Expand Down Expand Up @@ -282,7 +282,7 @@ bool JITLoaderGDB::ReadJITDescriptorImpl(bool all_entries) {
if (m_jit_descriptor_addr == LLDB_INVALID_ADDRESS)
return false;

Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_JIT_LOADER));
Log *log = GetLog(LLDBLog::JITLoader);
Target &target = m_process->GetTarget();
ModuleList &module_list = target.GetImages();

Expand Down
5 changes: 2 additions & 3 deletions lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ class BlockPointerSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
auto type_system_or_err = target_sp->GetScratchTypeSystemForLanguage(
lldb::eLanguageTypeC_plus_plus);
if (auto err = type_system_or_err.takeError()) {
LLDB_LOG_ERROR(
lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS),
std::move(err), "Failed to get scratch TypeSystemClang");
LLDB_LOG_ERROR(GetLog(LLDBLog::DataFormatters), std::move(err),
"Failed to get scratch TypeSystemClang");
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ class ManglingSubstitutor
}

ConstString substituteImpl(llvm::StringRef Mangled) {
Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE);
Log *log = GetLog(LLDBLog::Language);
if (this->parse() == nullptr) {
LLDB_LOG(log, "Failed to substitute mangling in {0}", Mangled);
return ConstString();
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Language/ObjC/Cocoa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ bool lldb_private::formatters::NSNumberSummaryProvider(
if (!process_sp)
return false;

Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS);
Log *log = GetLog(LLDBLog::DataFormatters);
ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);

if (!runtime)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ TypeAndOrName ItaniumABILanguageRuntime::GetTypeInfoFromVTableAddress(
const char *name =
symbol->GetMangled().GetDemangledName().AsCString();
if (name && strstr(name, vtable_demangled_prefix) == name) {
Log *log(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
Log *log = GetLog(LLDBLog::Object);
LLDB_LOGF(log,
"0x%16.16" PRIx64
": static-type = '%s' has vtable symbol '%s'\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ void ClassDescriptorV2::iVarsStorage::fill(AppleObjCRuntimeV2 &runtime,
if (m_filled)
return;
std::lock_guard<std::recursive_mutex> guard(m_mutex);
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES));
Log *log = GetLog(LLDBLog::Commands);
LLDB_LOGV(log, "class_name = {0}", descriptor.GetClassName());
m_filled = true;
ObjCLanguageRuntime::EncodingToTypeSP encoding_to_type_sp(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class lldb_private::AppleObjCExternalASTSource
bool FindExternalVisibleDeclsByName(const clang::DeclContext *decl_ctx,
clang::DeclarationName name) override {

Log *log(GetLogIfAllCategoriesSet(
LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
Log *log(GetLog(
LLDBLog::Expressions)); // FIXME - a more appropriate log channel?

if (log) {
LLDB_LOGF(log,
Expand Down Expand Up @@ -68,8 +68,8 @@ class lldb_private::AppleObjCExternalASTSource

void CompleteType(clang::TagDecl *tag_decl) override {

Log *log(GetLogIfAllCategoriesSet(
LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
Log *log(GetLog(
LLDBLog::Expressions)); // FIXME - a more appropriate log channel?

LLDB_LOGF(log,
"AppleObjCExternalASTSource::CompleteType on "
Expand All @@ -84,8 +84,8 @@ class lldb_private::AppleObjCExternalASTSource

void CompleteType(clang::ObjCInterfaceDecl *interface_decl) override {

Log *log(GetLogIfAllCategoriesSet(
LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
Log *log(GetLog(
LLDBLog::Expressions)); // FIXME - a more appropriate log channel?

if (log) {
LLDB_LOGF(log,
Expand Down Expand Up @@ -394,8 +394,8 @@ class ObjCRuntimeMethodType {
};

bool AppleObjCDeclVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl) {
Log *log(GetLogIfAllCategoriesSet(
LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
Log *log(
GetLog(LLDBLog::Expressions)); // FIXME - a more appropriate log channel?

ClangASTMetadata *metadata = m_ast_ctx.GetMetadata(interface_decl);
ObjCLanguageRuntime::ObjCISA objc_isa = 0;
Expand Down Expand Up @@ -525,8 +525,8 @@ uint32_t AppleObjCDeclVendor::FindDecls(ConstString name, bool append,
uint32_t max_matches,
std::vector<CompilerDecl> &decls) {

Log *log(GetLogIfAllCategoriesSet(
LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
Log *log(
GetLog(LLDBLog::Expressions)); // FIXME - a more appropriate log channel?

LLDB_LOGF(log, "AppleObjCDeclVendor::FindDecls ('%s', %s, %u, )",
(const char *)name.AsCString(), append ? "true" : "false",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ ValueObjectSP AppleObjCRuntime::GetExceptionObjectForThread(
/// GetBacktraceThreadFromException.
LLVM_NODISCARD
static ThreadSP FailExceptionParsing(llvm::StringRef msg) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));
Log *log = GetLog(LLDBLog::Language);
LLDB_LOG(log, "Failed getting backtrace from exception: {0}", msg);
return ThreadSP();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ void AppleObjCRuntimeV1::UpdateISAToDescriptorMapIfNeeded() {
// map, whether it was successful or not.
m_isa_to_descriptor_stop_id = process->GetStopID();

Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
Log *log = GetLog(LLDBLog::Process);

ProcessSP process_sp = process->shared_from_this();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ AppleObjCRuntimeV2::GetClassDescriptor(ValueObject &valobj) {

objc_class_sp = GetClassDescriptorFromISA(isa);
if (isa && !objc_class_sp) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
Log *log = GetLog(LLDBLog::Process | LLDBLog::Commands);
LLDB_LOGF(log,
"0x%" PRIx64 ": AppleObjCRuntimeV2::GetClassDescriptor() ISA was "
"not in class descriptor cache 0x%" PRIx64,
Expand Down Expand Up @@ -1538,7 +1538,7 @@ lldb::addr_t AppleObjCRuntimeV2::GetISAHashTablePointer() {
std::unique_ptr<UtilityFunction>
AppleObjCRuntimeV2::DynamicClassInfoExtractor::GetClassInfoUtilityFunctionImpl(
ExecutionContext &exe_ctx, std::string code, std::string name) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
Log *log = GetLog(LLDBLog::Process | LLDBLog::Commands);

LLDB_LOG(log, "Creating utility function {0}", name);

Expand Down Expand Up @@ -1643,7 +1643,7 @@ AppleObjCRuntimeV2::DynamicClassInfoExtractor::ComputeHelper() const {
std::unique_ptr<UtilityFunction>
AppleObjCRuntimeV2::SharedCacheClassInfoExtractor::
GetClassInfoUtilityFunctionImpl(ExecutionContext &exe_ctx) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
Log *log = GetLog(LLDBLog::Process | LLDBLog::Commands);

LLDB_LOG(log, "Creating utility function {0}",
g_get_shared_cache_class_info_name);
Expand Down Expand Up @@ -1746,7 +1746,7 @@ AppleObjCRuntimeV2::DynamicClassInfoExtractor::UpdateISAToDescriptorMap(

uint32_t num_class_infos = 0;

Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
Log *log = GetLog(LLDBLog::Process | LLDBLog::Commands);

ExecutionContext exe_ctx;

Expand Down Expand Up @@ -1822,7 +1822,7 @@ AppleObjCRuntimeV2::DynamicClassInfoExtractor::UpdateISAToDescriptorMap(

// Only dump the runtime classes from the expression evaluation if the log is
// verbose:
Log *type_log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES);
Log *type_log = GetLog(LLDBLog::Commands);
bool dump_log = type_log && type_log->GetVerbose();

arguments.GetValueAtIndex(3)->GetScalar() = dump_log ? 1 : 0;
Expand Down Expand Up @@ -1902,7 +1902,7 @@ uint32_t AppleObjCRuntimeV2::ParseClassInfoArray(const DataExtractor &data,
// uint32_t hash;
// } __attribute__((__packed__));

Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES));
Log *log = GetLog(LLDBLog::Commands);
bool should_log = log && log->GetVerbose();

uint32_t num_parsed = 0;
Expand Down Expand Up @@ -1975,7 +1975,7 @@ AppleObjCRuntimeV2::SharedCacheClassInfoExtractor::UpdateISAToDescriptorMap() {
if (process == nullptr)
return DescriptorMapUpdateResult::Fail();

Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
Log *log = GetLog(LLDBLog::Process | LLDBLog::Commands);

ExecutionContext exe_ctx;

Expand Down Expand Up @@ -2055,7 +2055,7 @@ AppleObjCRuntimeV2::SharedCacheClassInfoExtractor::UpdateISAToDescriptorMap() {
arguments.GetValueAtIndex(4)->GetScalar() = class_infos_byte_size;
// Only dump the runtime classes from the expression evaluation if the log is
// verbose:
Log *type_log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES);
Log *type_log = GetLog(LLDBLog::Commands);
bool dump_log = type_log && type_log->GetVerbose();

arguments.GetValueAtIndex(5)->GetScalar() = dump_log ? 1 : 0;
Expand Down Expand Up @@ -2213,7 +2213,7 @@ lldb::addr_t AppleObjCRuntimeV2::GetSharedCacheBaseAddress() {
void AppleObjCRuntimeV2::UpdateISAToDescriptorMapIfNeeded() {
LLDB_SCOPED_TIMER();

Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
Log *log = GetLog(LLDBLog::Process | LLDBLog::Commands);

// Else we need to check with our process to see when the map was updated.
Process *process = GetProcess();
Expand Down Expand Up @@ -2300,7 +2300,7 @@ bool AppleObjCRuntimeV2::RealizedClassGenerationCountChanged() {
objc_debug_realized_class_generation_count)
return false;

Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
Log *log = GetLog(LLDBLog::Process | LLDBLog::Commands);
LLDB_LOG(log,
"objc_debug_realized_class_generation_count changed from {0} to {1}",
m_realized_class_generation_count,
Expand Down Expand Up @@ -2454,7 +2454,7 @@ AppleObjCRuntimeV2::NonPointerISACache::CreateInstance(

Status error;

Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES));
Log *log = GetLog(LLDBLog::Commands);

auto objc_debug_isa_magic_mask = ExtractRuntimeGlobalSymbol(
process, ConstString("objc_debug_isa_magic_mask"), objc_module_sp, error);
Expand Down Expand Up @@ -2884,7 +2884,7 @@ AppleObjCRuntimeV2::NonPointerISACache::GetClassDescriptor(ObjCISA isa) {

bool AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA(
ObjCISA isa, ObjCISA &ret_isa) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES));
Log *log = GetLog(LLDBLog::Commands);

LLDB_LOGF(log, "AOCRT::NPI Evaluate(isa = 0x%" PRIx64 ")", (uint64_t)isa);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ bool AppleObjCTrampolineHandler::AppleObjCVTables::ReadRegions(
if (!process_sp)
return false;

Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
Log *log = GetLog(LLDBLog::Step);

// We aren't starting at the trampoline symbol.
InitializeVTableSymbols();
Expand Down Expand Up @@ -794,7 +794,7 @@ AppleObjCTrampolineHandler::SetupDispatchFunction(Thread &thread,
ValueList &dispatch_values) {
ThreadSP thread_sp(thread.shared_from_this());
ExecutionContext exe_ctx(thread_sp);
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
Log *log = GetLog(LLDBLog::Step);

lldb::addr_t args_addr = LLDB_INVALID_ADDRESS;
FunctionCaller *impl_function_caller = nullptr;
Expand Down Expand Up @@ -911,7 +911,7 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
}

if (this_dispatch) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
Log *log = GetLog(LLDBLog::Step);

// We are decoding a method dispatch. First job is to pull the
// arguments out:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ bool AppleThreadPlanStepThroughObjCTrampoline::ShouldStop(Event *event_ptr) {
}
Address target_so_addr;
target_so_addr.SetOpcodeLoadAddress(target_addr, exc_ctx.GetTargetPtr());
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
Log *log = GetLog(LLDBLog::Step);
if (target_addr == 0) {
LLDB_LOGF(log, "Got target implementation of 0x0, stopping.");
SetPlanComplete();
Expand Down Expand Up @@ -354,7 +354,7 @@ bool AppleThreadPlanStepThroughDirectDispatch::ShouldStop(Event *event_ptr) {
// If we have a step through plan, then w're in the process of getting
// through an ObjC msgSend. If we arrived at the target function, then
// check whether we have debug info, and if we do, stop.
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
Log *log = GetLog(LLDBLog::Step);

if (m_objc_step_through_sp && m_objc_step_through_sp->IsPlanComplete()) {
// If the plan failed for some reason, we should probably just let the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ bool ObjCLanguageRuntime::AddClass(ObjCISA isa,
void ObjCLanguageRuntime::AddToMethodCache(lldb::addr_t class_addr,
lldb::addr_t selector,
lldb::addr_t impl_addr) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
Log *log = GetLog(LLDBLog::Step);
if (log) {
LLDB_LOGF(log,
"Caching: class 0x%" PRIx64 " selector 0x%" PRIx64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ static bool registerRSDefaultTargetOpts(clang::TargetOptions &proto,

bool RenderScriptRuntimeModulePass::runOnModule(llvm::Module &module) {
bool changed_module = false;
Log *log(
GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Language | LLDBLog::Expressions);

std::string err;
llvm::StringRef real_triple =
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ static llvm::FunctionType *cloneToStructRetFnTy(llvm::CallInst *call_inst) {
// create a return type by getting the pointer type of the old return type,
// and inserting a new initial argument of pointer type of the original
// return type.
Log *log(
GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Language | LLDBLog::Expressions);

assert(call_inst && "no CallInst");
llvm::Function *orig = call_inst->getCalledFunction();
Expand Down
13 changes: 6 additions & 7 deletions lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,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));
Log *log = GetLog(LLDBLog::Symbols);
LLDB_LOGF(log, "Failed to parse note name lacking nul terminator");

return false;
Expand Down Expand Up @@ -504,7 +504,7 @@ size_t ObjectFileELF::GetModuleSpecifications(
const lldb_private::FileSpec &file, lldb::DataBufferSP &data_sp,
lldb::offset_t data_offset, lldb::offset_t file_offset,
lldb::offset_t length, lldb_private::ModuleSpecList &specs) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES));
Log *log = GetLog(LLDBLog::Modules);

const size_t initial_count = specs.GetSize();

Expand Down Expand Up @@ -998,7 +998,7 @@ lldb_private::Status
ObjectFileELF::RefineModuleDetailsFromNote(lldb_private::DataExtractor &data,
lldb_private::ArchSpec &arch_spec,
lldb_private::UUID &uuid) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES));
Log *log = GetLog(LLDBLog::Modules);
Status error;

lldb::offset_t offset = 0;
Expand Down Expand Up @@ -1365,7 +1365,7 @@ size_t ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl &section_headers,
if (header.e_shnum == 0)
return 0;

Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES));
Log *log = GetLog(LLDBLog::Modules);

section_headers.resize(header.e_shnum);
if (section_headers.size() != header.e_shnum)
Expand Down Expand Up @@ -1680,7 +1680,7 @@ class VMAddressProvider {
VMMap::Allocator Alloc;
VMMap Segments = VMMap(Alloc);
VMMap Sections = VMMap(Alloc);
lldb_private::Log *Log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES);
lldb_private::Log *Log = GetLog(LLDBLog::Modules);
size_t SegmentCount = 0;
std::string SegmentName;

Expand Down Expand Up @@ -2616,8 +2616,7 @@ unsigned ObjectFileELF::ApplyRelocations(
((int64_t)value > INT32_MAX && (int64_t)value < INT32_MIN)) ||
(reloc_type(rel) == R_AARCH64_ABS32 &&
((int64_t)value > INT32_MAX && (int64_t)value < INT32_MIN))) {
Log *log =
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES);
Log *log = GetLog(LLDBLog::Modules);
LLDB_LOGF(log, "Failed to apply debug info relocations");
break;
}
Expand Down
20 changes: 8 additions & 12 deletions lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1666,7 +1666,7 @@ void ObjectFileMachO::ProcessSegmentCommand(
// addresses will differ from what the ObjectFile had originally,
// and what the dSYM has.
if (is_dsym && unified_section_sp->GetFileAddress() != load_cmd.vmaddr) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS));
Log *log = GetLog(LLDBLog::Symbols);
if (log) {
log->Printf(
"Installing dSYM's %s segment file address over ObjectFile's "
Expand Down Expand Up @@ -2174,7 +2174,7 @@ UUID ObjectFileMachO::GetSharedCacheUUID(FileSpec dyld_shared_cache,
dsc_uuid = UUID::fromOptionalData(
dsc_header_data.GetData(&offset, sizeof(uuid_t)), sizeof(uuid_t));
}
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS));
Log *log = GetLog(LLDBLog::Symbols);
if (log && dsc_uuid.IsValid()) {
LLDB_LOGF(log, "Shared cache %s has UUID %s",
dyld_shared_cache.GetPath().c_str(),
Expand Down Expand Up @@ -2235,7 +2235,7 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic);
uint32_t i;
FileSpecList dylib_files;
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS));
Log *log = GetLog(LLDBLog::Symbols);
llvm::StringRef g_objc_v2_prefix_class("_OBJC_CLASS_$_");
llvm::StringRef g_objc_v2_prefix_metaclass("_OBJC_METACLASS_$_");
llvm::StringRef g_objc_v2_prefix_ivar("_OBJC_IVAR_$_");
Expand Down Expand Up @@ -2593,8 +2593,7 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
// sections - we should not make any assumptions about them based on that.
if (function_starts_count == 0 && CalculateStrata() == eStrataUser) {
m_allow_assembly_emulation_unwind_plans = false;
Log *unwind_or_symbol_log(lldb_private::GetLogIfAnyCategoriesSet(
LIBLLDB_LOG_SYMBOLS | LIBLLDB_LOG_UNWIND));
Log *unwind_or_symbol_log(GetLog(LLDBLog::Symbols | LLDBLog::Unwind));

if (unwind_or_symbol_log)
module_sp->LogMessage(
Expand Down Expand Up @@ -4908,8 +4907,7 @@ struct OSEnv {
llvm::Triple::getEnvironmentTypeName(llvm::Triple::Simulator);
return;
default: {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS |
LIBLLDB_LOG_PROCESS));
Log *log(GetLog(LLDBLog::Symbols | LLDBLog::Process));
LLDB_LOGF(log, "unsupported platform in LC_BUILD_VERSION");
}
}
Expand Down Expand Up @@ -5838,8 +5836,7 @@ void ObjectFileMachO::GetProcessSharedCacheUUID(Process *process,
dl->GetSharedCacheInformation(base_addr, uuid, using_shared_cache,
private_shared_cache);
}
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS |
LIBLLDB_LOG_PROCESS));
Log *log(GetLog(LLDBLog::Symbols | LLDBLog::Process));
LLDB_LOGF(
log,
"inferior process shared cache has a UUID of %s, base address 0x%" PRIx64,
Expand Down Expand Up @@ -5933,8 +5930,7 @@ void ObjectFileMachO::GetLLDBSharedCacheUUID(addr_t &base_addr, UUID &uuid) {
}
}
}
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS |
LIBLLDB_LOG_PROCESS));
Log *log(GetLog(LLDBLog::Symbols | LLDBLog::Process));
if (log && uuid.IsValid())
LLDB_LOGF(log,
"lldb's in-memory shared cache has a UUID of %s base address of "
Expand Down Expand Up @@ -6942,7 +6938,7 @@ ObjectFileMachO::GetCorefileAllImageInfos() {

bool ObjectFileMachO::LoadCoreFileImages(lldb_private::Process &process) {
MachOCorefileAllImageInfos image_infos = GetCorefileAllImageInfos();
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
Log *log = GetLog(LLDBLog::DynamicLoader);

ModuleList added_modules;
for (const MachOCorefileImageEntry &image : image_infos.all_image_infos) {
Expand Down
6 changes: 3 additions & 3 deletions lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ size_t ObjectFilePECOFF::GetModuleSpecifications(
if (!data_sp || !ObjectFilePECOFF::MagicBytesMatch(data_sp))
return initial_count;

Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
Log *log = GetLog(LLDBLog::Object);

if (data_sp->GetByteSize() < length)
if (DataBufferSP full_sp = MapFileData(file, -1, file_offset))
Expand Down Expand Up @@ -212,7 +212,7 @@ bool ObjectFilePECOFF::CreateBinary() {
if (m_binary)
return true;

Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
Log *log = GetLog(LLDBLog::Object);

auto binary = llvm::object::createBinary(llvm::MemoryBufferRef(
toStringRef(m_data.GetData()), m_file.GetFilename().GetStringRef()));
Expand Down Expand Up @@ -884,7 +884,7 @@ uint32_t ObjectFilePECOFF::ParseDependentModules() {
if (!CreateBinary())
return 0;

Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
Log *log = GetLog(LLDBLog::Object);
LLDB_LOG(log, "this = {0}, module = {1} ({2}), file = {3}, binary = {4}",
this, GetModule().get(), GetModule()->GetSpecificationDescription(),
m_file.GetPath(), m_binary.get());
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ ObjectFile *
ObjectFileWasm::CreateInstance(const ModuleSP &module_sp, DataBufferSP &data_sp,
offset_t data_offset, const FileSpec *file,
offset_t file_offset, offset_t length) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
Log *log = GetLog(LLDBLog::Object);

if (!data_sp) {
data_sp = MapFileData(*file, length, file_offset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ DynamicRegisterInfo *OperatingSystemPython::GetDynamicRegisterInfo() {
if (m_register_info_up == nullptr) {
if (!m_interpreter || !m_python_object_sp)
return nullptr;
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OS));
Log *log = GetLog(LLDBLog::OS);

LLDB_LOGF(log,
"OperatingSystemPython::GetDynamicRegisterInfo() fetching "
Expand All @@ -141,7 +141,7 @@ bool OperatingSystemPython::UpdateThreadList(ThreadList &old_thread_list,
if (!m_interpreter || !m_python_object_sp)
return false;

Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OS));
Log *log = GetLog(LLDBLog::OS);

// First thing we have to do is to try to get the API lock, and the
// interpreter lock. We're going to change the thread content of the process,
Expand Down Expand Up @@ -301,7 +301,7 @@ OperatingSystemPython::CreateRegisterContextForThread(Thread *thread,
(void)api_lock.try_lock(); // See above.
auto interpreter_lock = m_interpreter->AcquireInterpreterLock();

Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
Log *log = GetLog(LLDBLog::Thread);

if (reg_data_addr != LLDB_INVALID_ADDRESS) {
// The registers data is in contiguous memory, just create the register
Expand Down Expand Up @@ -363,7 +363,7 @@ OperatingSystemPython::CreateThreadStopReason(lldb_private::Thread *thread) {

lldb::ThreadSP OperatingSystemPython::CreateThread(lldb::tid_t tid,
addr_t context) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
Log *log = GetLog(LLDBLog::Thread);

LLDB_LOGF(log,
"OperatingSystemPython::CreateThread (tid = 0x%" PRIx64
Expand Down
8 changes: 4 additions & 4 deletions lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void PlatformAndroid::Terminate() {
}

PlatformSP PlatformAndroid::CreateInstance(bool force, const ArchSpec *arch) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
if (log) {
const char *arch_name;
if (arch && arch->GetArchitectureName())
Expand Down Expand Up @@ -190,7 +190,7 @@ Status PlatformAndroid::GetFile(const FileSpec &source,

auto source_file = source_spec.GetCString(false);

Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOGF(log, "Got mode == 0 on '%s': try to get file via 'shell cat'",
source_file);

Expand Down Expand Up @@ -265,7 +265,7 @@ uint32_t PlatformAndroid::GetSdkVersion() {
version_string = llvm::StringRef(version_string).trim().str();

if (error.Fail() || version_string.empty()) {
Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM);
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOGF(log, "Get SDK version failed. (error: %s, output: %s)",
error.AsCString(), version_string.c_str());
return 0;
Expand Down Expand Up @@ -313,7 +313,7 @@ Status PlatformAndroid::DownloadSymbolFile(const lldb::ModuleSP &module_sp,
command.Printf("rm -rf %s", s->c_str());
Status error = adb.Shell(command.GetData(), seconds(5), nullptr);

Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
if (log && error.Fail())
LLDB_LOGF(log, "Failed to remove temp directory: %s", error.AsCString());
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static Status ForwardPortWithAdb(
llvm::StringRef remote_socket_name,
const llvm::Optional<AdbClient::UnixSocketNamespace> &socket_namespace,
std::string &device_id) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);

AdbClient adb;
auto error = AdbClient::CreateByDeviceID(device_id, adb);
Expand Down Expand Up @@ -89,7 +89,7 @@ bool PlatformAndroidRemoteGDBServer::LaunchGDBServer(lldb::pid_t &pid,
socket_name))
return false;

Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);

auto error =
MakeConnectURL(pid, remote_port, socket_name.c_str(), connect_url);
Expand Down Expand Up @@ -137,7 +137,7 @@ Status PlatformAndroidRemoteGDBServer::ConnectRemote(Args &args) {

args.ReplaceArgumentAtIndex(0, connect_url);

Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOGF(log, "Rewritten platform connect URL: %s", connect_url.c_str());

error = PlatformRemoteGDBServer::ConnectRemote(args);
Expand All @@ -153,7 +153,7 @@ Status PlatformAndroidRemoteGDBServer::DisconnectRemote() {
}

void PlatformAndroidRemoteGDBServer::DeleteForwardPort(lldb::pid_t pid) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);

auto it = m_port_forwards.find(pid);
if (it == m_port_forwards.end())
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static uint32_t g_initialize_count = 0;


PlatformSP PlatformFreeBSD::CreateInstance(bool force, const ArchSpec *arch) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOG(log, "force = {0}, arch=({1}, {2})", force,
arch ? arch->GetArchitectureName() : "<null>",
arch ? arch->GetTriple().getTriple() : "<null>");
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static uint32_t g_initialize_count = 0;


PlatformSP PlatformLinux::CreateInstance(bool force, const ArchSpec *arch) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOG(log, "force = {0}, arch=({1}, {2})", force,
arch ? arch->GetArchitectureName() : "<null>",
arch ? arch->GetTriple().getTriple() : "<null>");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ PlatformSP PlatformAppleSimulator::CreateInstance(
llvm::StringRef sdk, lldb_private::XcodeSDK::Type sdk_type,
CoreSimulatorSupport::DeviceType::ProductFamilyID kind, bool force,
const ArchSpec *arch) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
if (log) {
const char *arch_name;
if (arch && arch->GetArchitectureName())
Expand Down
21 changes: 10 additions & 11 deletions lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(
const lldb_private::FileSpecList *module_search_paths_ptr,
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules, bool *did_create_ptr) {

Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOGF(log,
"[%s] Trying to find module %s/%s - platform path %s/%s symbol "
"path %s/%s",
Expand Down Expand Up @@ -283,7 +283,7 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(
if (err.Fail())
return err;
if (FileSystem::Instance().Exists(module_cache_spec)) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOGF(log, "[%s] module %s/%s was rsynced and is now there",
(IsHost() ? "host" : "remote"),
module_spec.GetFileSpec().GetDirectory().AsCString(),
Expand Down Expand Up @@ -313,7 +313,7 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(
low_remote, high_remote);
if (low_local != low_remote || high_local != high_remote) {
// bring in the remote file
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOGF(log,
"[%s] module %s/%s needs to be replaced from remote copy",
(IsHost() ? "host" : "remote"),
Expand All @@ -329,7 +329,7 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(
ModuleSpec local_spec(module_cache_spec, module_spec.GetArchitecture());
module_sp = std::make_shared<Module>(local_spec);
module_sp->SetPlatformFileSpec(module_spec.GetFileSpec());
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOGF(log, "[%s] module %s/%s was found in the cache",
(IsHost() ? "host" : "remote"),
module_spec.GetFileSpec().GetDirectory().AsCString(),
Expand All @@ -346,7 +346,7 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(
if (err.Fail())
return err;
if (FileSystem::Instance().Exists(module_cache_spec)) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOGF(log, "[%s] module %s/%s is now cached and fine",
(IsHost() ? "host" : "remote"),
module_spec.GetFileSpec().GetDirectory().AsCString(),
Expand Down Expand Up @@ -892,7 +892,7 @@ PlatformDarwin::ParseVersionBuildDir(llvm::StringRef dir) {

llvm::Expected<StructuredData::DictionarySP>
PlatformDarwin::FetchExtendedCrashInformation(Process &process) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
Log *log = GetLog(LLDBLog::Process);

StructuredData::ArraySP annotations = ExtractCrashInfoAnnotations(process);

Expand All @@ -911,7 +911,7 @@ PlatformDarwin::FetchExtendedCrashInformation(Process &process) {

StructuredData::ArraySP
PlatformDarwin::ExtractCrashInfoAnnotations(Process &process) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
Log *log = GetLog(LLDBLog::Process);

ConstString section_name("__crash_info");
Target &target = process.GetTarget();
Expand Down Expand Up @@ -1089,11 +1089,10 @@ void PlatformDarwin::AddClangModuleCompilationOptionsForSDKType(
case XcodeSDK::Type::bridgeOS:
case XcodeSDK::Type::Linux:
case XcodeSDK::Type::unknown:
if (lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST)) {
if (Log *log = GetLog(LLDBLog::Host)) {
XcodeSDK::Info info;
info.type = sdk_type;
LLDB_LOGF(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST),
"Clang modules on %s are not supported",
LLDB_LOGF(log, "Clang modules on %s are not supported",
XcodeSDK::GetCanonicalName(info).c_str());
}
return;
Expand Down Expand Up @@ -1256,7 +1255,7 @@ lldb_private::Status PlatformDarwin::FindBundleBinaryInExecSearchPaths(

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);
Log *log_verbose = GetLog(LLDBLog::Host);
LLDB_LOGF(
log_verbose,
"PlatformRemoteDarwinDevice::GetSharedModule searching for binary in "
Expand Down
8 changes: 4 additions & 4 deletions lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void PlatformDarwinKernel::Terminate() {

PlatformSP PlatformDarwinKernel::CreateInstance(bool force,
const ArchSpec *arch) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
if (log) {
const char *arch_name;
if (arch && arch->GetArchitectureName())
Expand Down Expand Up @@ -279,7 +279,7 @@ void PlatformDarwinKernel::GetStatus(Stream &strm) {
strm.Printf(" Number of Kernel dSYM.yaa's indexed: %d\n",
(int)m_kernel_dsyms_yaas.size());

Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
if (log) {
LLDB_LOGF(log, "\nkexts with dSYMs");
for (auto pos : m_name_to_kext_path_map_with_dsyms) {
Expand Down Expand Up @@ -483,7 +483,7 @@ PlatformDarwinKernel::GetKernelsAndKextsInDirectoryHelper(
FileSpec file_spec(path);
ConstString file_spec_extension = file_spec.GetFileNameExtension();

Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);

LLDB_LOGV(log, "PlatformDarwinKernel examining '{0}'", file_spec);

Expand Down Expand Up @@ -575,7 +575,7 @@ PlatformDarwinKernel::GetKernelsAndKextsInDirectoryHelper(

void PlatformDarwinKernel::AddKextToMap(PlatformDarwinKernel *thisp,
const FileSpec &file_spec) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
CFCBundle bundle(file_spec.GetPath().c_str());
CFStringRef bundle_id(bundle.GetIdentifier());
if (bundle_id && CFGetTypeID(bundle_id) == CFStringGetTypeID()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void PlatformRemoteAppleBridge::Terminate() {

PlatformSP PlatformRemoteAppleBridge::CreateInstance(bool force,
const ArchSpec *arch) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
if (log) {
const char *arch_name;
if (arch && arch->GetArchitectureName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void PlatformRemoteAppleTV::Terminate() {

PlatformSP PlatformRemoteAppleTV::CreateInstance(bool force,
const ArchSpec *arch) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
if (log) {
const char *arch_name;
if (arch && arch->GetArchitectureName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void PlatformRemoteAppleWatch::Terminate() {

PlatformSP PlatformRemoteAppleWatch::CreateInstance(bool force,
const ArchSpec *arch) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
if (log) {
const char *arch_name;
if (arch && arch->GetArchitectureName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ PlatformRemoteDarwinDevice::GetContainedFilesIntoVectorOfStringsCallback(
}

bool PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded() {
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
Log *log = GetLog(LLDBLog::Host);
std::lock_guard<std::mutex> guard(m_sdk_dir_mutex);
if (m_sdk_directory_infos.empty()) {
// A --sysroot option was supplied - add it to our list of SDKs to check
Expand Down Expand Up @@ -382,7 +382,7 @@ const char *PlatformRemoteDarwinDevice::GetDeviceSupportDirectoryForOSVersion()

uint32_t PlatformRemoteDarwinDevice::FindFileInAllSDKs(const char *platform_file_path,
FileSpecList &file_list) {
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
Log *log = GetLog(LLDBLog::Host);
if (platform_file_path && platform_file_path[0] &&
UpdateSDKDirectoryInfosIfNeeded()) {
const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
Expand All @@ -402,7 +402,7 @@ uint32_t PlatformRemoteDarwinDevice::FindFileInAllSDKs(const char *platform_file
bool PlatformRemoteDarwinDevice::GetFileInSDK(const char *platform_file_path,
uint32_t sdk_idx,
lldb_private::FileSpec &local_file) {
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
Log *log = GetLog(LLDBLog::Host);
if (sdk_idx < m_sdk_directory_infos.size()) {
std::string sdkroot_path =
m_sdk_directory_infos[sdk_idx].directory.GetPath();
Expand Down Expand Up @@ -435,7 +435,7 @@ bool PlatformRemoteDarwinDevice::GetFileInSDK(const char *platform_file_path,
Status PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file,
const UUID *uuid_ptr,
FileSpec &local_file) {
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
Log *log = GetLog(LLDBLog::Host);
Status error;
char platform_file_path[PATH_MAX];
if (platform_file.GetPath(platform_file_path, sizeof(platform_file_path))) {
Expand Down Expand Up @@ -500,7 +500,7 @@ Status PlatformRemoteDarwinDevice::GetSharedModule(
// we ask for the file in the cached SDK, then we attempt to get a shared
// module for the right architecture with the right UUID.
const FileSpec &platform_file = module_spec.GetFileSpec();
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
Log *log = GetLog(LLDBLog::Host);

Status error;
char platform_file_path[PATH_MAX];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void PlatformRemoteMacOSX::Terminate() {

PlatformSP PlatformRemoteMacOSX::CreateInstance(bool force,
const ArchSpec *arch) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
if (log) {
const char *arch_name;
if (arch && arch->GetArchitectureName())
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void PlatformRemoteiOS::Terminate() {
}

PlatformSP PlatformRemoteiOS::CreateInstance(bool force, const ArchSpec *arch) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
if (log) {
const char *arch_name;
if (arch && arch->GetArchitectureName())
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static uint32_t g_initialize_count = 0;


PlatformSP PlatformNetBSD::CreateInstance(bool force, const ArchSpec *arch) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOG(log, "force = {0}, arch=({1}, {2})", force,
arch ? arch->GetArchitectureName() : "<null>",
arch ? arch->GetTriple().getTriple() : "<null>");
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static uint32_t g_initialize_count = 0;


PlatformSP PlatformOpenBSD::CreateInstance(bool force, const ArchSpec *arch) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOG(log, "force = {0}, arch=({1}, {2})", force,
arch ? arch->GetArchitectureName() : "<null>",
arch ? arch->GetTriple().getTriple() : "<null>");
Expand Down
8 changes: 4 additions & 4 deletions lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ lldb_private::Status
PlatformPOSIX::PutFile(const lldb_private::FileSpec &source,
const lldb_private::FileSpec &destination, uint32_t uid,
uint32_t gid) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);

if (IsHost()) {
if (source == destination)
Expand Down Expand Up @@ -154,7 +154,7 @@ lldb_private::Status PlatformPOSIX::GetFile(
const lldb_private::FileSpec &source, // remote file path
const lldb_private::FileSpec &destination) // local file path
{
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);

// Check the args, first.
std::string src_path(source.GetPath());
Expand Down Expand Up @@ -360,7 +360,7 @@ lldb::ProcessSP PlatformPOSIX::Attach(ProcessAttachInfo &attach_info,
Debugger &debugger, Target *target,
Status &error) {
lldb::ProcessSP process_sp;
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);

if (IsHost()) {
if (target == nullptr) {
Expand Down Expand Up @@ -413,7 +413,7 @@ lldb::ProcessSP PlatformPOSIX::Attach(ProcessAttachInfo &attach_info,
lldb::ProcessSP PlatformPOSIX::DebugProcess(ProcessLaunchInfo &launch_info,
Debugger &debugger, Target &target,
Status &error) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOG(log, "target {0}", &target);

ProcessSP process_sp;
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ static Environment ComputeLaunchEnvironment(Environment target,
lldb::ProcessSP PlatformQemuUser::DebugProcess(ProcessLaunchInfo &launch_info,
Debugger &debugger,
Target &target, Status &error) {
Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
Log *log = GetLog(LLDBLog::Platform);

FileSpec qemu = GetGlobalProperties().GetEmulatorPath();
if (!qemu)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ llvm::StringRef PlatformRemoteGDBServer::GetDescription() {
bool PlatformRemoteGDBServer::GetModuleSpec(const FileSpec &module_file_spec,
const ArchSpec &arch,
ModuleSpec &module_spec) {
Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
Log *log = GetLog(LLDBLog::Platform);

const auto module_path = module_file_spec.GetPath(false);

Expand Down Expand Up @@ -171,7 +171,7 @@ ArchSpec PlatformRemoteGDBServer::GetRemoteSystemArchitecture() {

FileSpec PlatformRemoteGDBServer::GetRemoteWorkingDirectory() {
if (IsConnected()) {
Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
Log *log = GetLog(LLDBLog::Platform);
FileSpec working_dir;
if (m_gdb_client_up->GetWorkingDir(working_dir) && log)
LLDB_LOGF(log,
Expand All @@ -188,7 +188,7 @@ bool PlatformRemoteGDBServer::SetRemoteWorkingDirectory(
if (IsConnected()) {
// Clear the working directory it case it doesn't get set correctly. This
// will for use to re-read it
Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOGF(log, "PlatformRemoteGDBServer::SetRemoteWorkingDirectory('%s')",
working_dir.GetCString());
return m_gdb_client_up->SetWorkingDir(working_dir) == 0;
Expand Down Expand Up @@ -318,7 +318,7 @@ bool PlatformRemoteGDBServer::GetProcessInfo(
}

Status PlatformRemoteGDBServer::LaunchProcess(ProcessLaunchInfo &launch_info) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
Status error;

LLDB_LOGF(log, "PlatformRemoteGDBServer::%s() called", __FUNCTION__);
Expand Down Expand Up @@ -539,7 +539,7 @@ Status PlatformRemoteGDBServer::MakeDirectory(const FileSpec &file_spec,
if (!IsConnected())
return Status("Not connected.");
Status error = m_gdb_client_up->MakeDirectory(file_spec, mode);
Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOGF(log,
"PlatformRemoteGDBServer::MakeDirectory(path='%s', mode=%o) "
"error = %u (%s)",
Expand All @@ -553,7 +553,7 @@ Status PlatformRemoteGDBServer::GetFilePermissions(const FileSpec &file_spec,
return Status("Not connected.");
Status error =
m_gdb_client_up->GetFilePermissions(file_spec, file_permissions);
Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOGF(log,
"PlatformRemoteGDBServer::GetFilePermissions(path='%s', "
"file_permissions=%o) error = %u (%s)",
Expand All @@ -568,7 +568,7 @@ Status PlatformRemoteGDBServer::SetFilePermissions(const FileSpec &file_spec,
return Status("Not connected.");
Status error =
m_gdb_client_up->SetFilePermissions(file_spec, file_permissions);
Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOGF(log,
"PlatformRemoteGDBServer::SetFilePermissions(path='%s', "
"file_permissions=%o) error = %u (%s)",
Expand Down Expand Up @@ -637,7 +637,7 @@ Status PlatformRemoteGDBServer::CreateSymlink(
if (!IsConnected())
return Status("Not connected.");
Status error = m_gdb_client_up->CreateSymlink(src, dst);
Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOGF(log,
"PlatformRemoteGDBServer::CreateSymlink(src='%s', dst='%s') "
"error = %u (%s)",
Expand All @@ -650,7 +650,7 @@ Status PlatformRemoteGDBServer::Unlink(const FileSpec &file_spec) {
if (!IsConnected())
return Status("Not connected.");
Status error = m_gdb_client_up->Unlink(file_spec);
Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOGF(log, "PlatformRemoteGDBServer::Unlink(path='%s') error = %u (%s)",
file_spec.GetCString(), error.GetError(), error.AsCString());
return error;
Expand Down
11 changes: 4 additions & 7 deletions lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ Status NativeProcessLinux::SetDefaultPtraceOpts(lldb::pid_t pid) {
// Handles all waitpid events from the inferior process.
void NativeProcessLinux::MonitorCallback(NativeThreadLinux &thread,
WaitStatus status) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
Log *log = GetLog(LLDBLog::Process);

// Certain activities differ based on whether the pid is the tid of the main
// thread.
Expand Down Expand Up @@ -714,8 +714,7 @@ void NativeProcessLinux::MonitorTrace(NativeThreadLinux &thread) {
}

void NativeProcessLinux::MonitorBreakpoint(NativeThreadLinux &thread) {
Log *log(
GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_BREAKPOINTS));
Log *log = GetLog(LLDBLog::Process | LLDBLog::Breakpoints);
LLDB_LOG(log, "received breakpoint event, pid = {0}", thread.GetID());

// Mark the thread as stopped at breakpoint.
Expand All @@ -731,8 +730,7 @@ void NativeProcessLinux::MonitorBreakpoint(NativeThreadLinux &thread) {

void NativeProcessLinux::MonitorWatchpoint(NativeThreadLinux &thread,
uint32_t wp_index) {
Log *log(
GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_WATCHPOINTS));
Log *log = GetLog(LLDBLog::Process | LLDBLog::Watchpoints);
LLDB_LOG(log, "received watchpoint event, pid = {0}, wp_index = {1}",
thread.GetID(), wp_index);

Expand Down Expand Up @@ -1828,8 +1826,7 @@ void NativeProcessLinux::SignalIfAllThreadsStopped() {
}

// We have a pending notification and all threads have stopped.
Log *log(
GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_BREAKPOINTS));
Log *log = GetLog(LLDBLog::Process | LLDBLog::Breakpoints);

// Clear any temporary breakpoints we used to implement software single
// stepping.
Expand Down
10 changes: 5 additions & 5 deletions lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ lldb::StateType NativeThreadLinux::GetState() { return m_state; }

bool NativeThreadLinux::GetStopReason(ThreadStopInfo &stop_info,
std::string &description) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
Log *log = GetLog(LLDBLog::Thread);

description.clear();

Expand Down Expand Up @@ -277,7 +277,7 @@ Status NativeThreadLinux::SingleStep(uint32_t signo) {

void NativeThreadLinux::SetStoppedBySignal(uint32_t signo,
const siginfo_t *info) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
Log *log = GetLog(LLDBLog::Thread);
LLDB_LOGF(log, "NativeThreadLinux::%s called with signal 0x%02" PRIx32,
__FUNCTION__, signo);

Expand Down Expand Up @@ -391,7 +391,7 @@ void NativeThreadLinux::SetStopped() {
}

void NativeThreadLinux::SetStoppedByExec() {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
Log *log = GetLog(LLDBLog::Thread);
LLDB_LOGF(log, "NativeThreadLinux::%s()", __FUNCTION__);

SetStopped();
Expand Down Expand Up @@ -493,7 +493,7 @@ void NativeThreadLinux::SetExited() {
}

Status NativeThreadLinux::RequestStop() {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
Log *log = GetLog(LLDBLog::Thread);

NativeProcessLinux &process = GetProcess();

Expand All @@ -519,7 +519,7 @@ Status NativeThreadLinux::RequestStop() {
}

void NativeThreadLinux::MaybeLogStateChange(lldb::StateType new_state) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
Log *log = GetLog(LLDBLog::Thread);
// If we're not logging, we're done.
if (!log)
return;
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Plugins/Process/Utility/HistoryThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ HistoryThread::HistoryThread(lldb_private::Process &process, lldb::tid_t tid,
m_queue_id(LLDB_INVALID_QUEUE_ID) {
m_unwinder_up =
std::make_unique<HistoryUnwind>(*this, pcs, pcs_are_call_addresses);
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
Log *log = GetLog(LLDBLog::Object);
LLDB_LOGF(log, "%p HistoryThread::HistoryThread", static_cast<void *>(this));
}

// Destructor

HistoryThread::~HistoryThread() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
Log *log = GetLog(LLDBLog::Object);
LLDB_LOGF(log, "%p HistoryThread::~HistoryThread (tid=0x%" PRIx64 ")",
static_cast<void *>(this), GetID());
DestroyThread();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static constexpr inline uint64_t GetSizeBits(int size) {
}

uint32_t NativeRegisterContextDBReg_arm64::NumSupportedHardwareBreakpoints() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
Log *log = GetLog(LLDBLog::Breakpoints);
llvm::Error error = ReadHardwareDebugInfo();
if (error) {
LLDB_LOG_ERROR(log, std::move(error),
Expand All @@ -43,7 +43,7 @@ uint32_t NativeRegisterContextDBReg_arm64::NumSupportedHardwareBreakpoints() {
uint32_t
NativeRegisterContextDBReg_arm64::SetHardwareBreakpoint(lldb::addr_t addr,
size_t size) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
Log *log = GetLog(LLDBLog::Breakpoints);
LLDB_LOG(log, "addr: {0:x}, size: {1:x}", addr, size);

// Read hardware breakpoint and watchpoint information.
Expand Down Expand Up @@ -104,7 +104,7 @@ NativeRegisterContextDBReg_arm64::SetHardwareBreakpoint(lldb::addr_t addr,

bool NativeRegisterContextDBReg_arm64::ClearHardwareBreakpoint(
uint32_t hw_idx) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
Log *log = GetLog(LLDBLog::Breakpoints);
LLDB_LOG(log, "hw_idx: {0}", hw_idx);

// Read hardware breakpoint and watchpoint information.
Expand Down Expand Up @@ -144,7 +144,7 @@ bool NativeRegisterContextDBReg_arm64::ClearHardwareBreakpoint(

Status NativeRegisterContextDBReg_arm64::GetHardwareBreakHitIndex(
uint32_t &bp_index, lldb::addr_t trap_addr) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
Log *log = GetLog(LLDBLog::Breakpoints);

LLDB_LOGF(log, "NativeRegisterContextDBReg_arm64::%s()", __FUNCTION__);

Expand All @@ -164,7 +164,7 @@ Status NativeRegisterContextDBReg_arm64::GetHardwareBreakHitIndex(
}

Status NativeRegisterContextDBReg_arm64::ClearAllHardwareBreakpoints() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
Log *log = GetLog(LLDBLog::Breakpoints);

LLDB_LOGF(log, "NativeRegisterContextDBReg_arm64::%s()", __FUNCTION__);

Expand Down Expand Up @@ -206,7 +206,7 @@ bool NativeRegisterContextDBReg_arm64::BreakpointIsEnabled(uint32_t bp_index) {
}

uint32_t NativeRegisterContextDBReg_arm64::NumSupportedHardwareWatchpoints() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
Log *log = GetLog(LLDBLog::Watchpoints);
llvm::Error error = ReadHardwareDebugInfo();
if (error) {
LLDB_LOG_ERROR(log, std::move(error),
Expand All @@ -219,7 +219,7 @@ uint32_t NativeRegisterContextDBReg_arm64::NumSupportedHardwareWatchpoints() {

uint32_t NativeRegisterContextDBReg_arm64::SetHardwareWatchpoint(
lldb::addr_t addr, size_t size, uint32_t watch_flags) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
Log *log = GetLog(LLDBLog::Watchpoints);
LLDB_LOG(log, "addr: {0:x}, size: {1:x} watch_flags: {2:x}", addr, size,
watch_flags);

Expand Down Expand Up @@ -312,7 +312,7 @@ uint32_t NativeRegisterContextDBReg_arm64::SetHardwareWatchpoint(

bool NativeRegisterContextDBReg_arm64::ClearHardwareWatchpoint(
uint32_t wp_index) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
Log *log = GetLog(LLDBLog::Watchpoints);
LLDB_LOG(log, "wp_index: {0}", wp_index);

// Read hardware breakpoint and watchpoint information.
Expand Down Expand Up @@ -384,7 +384,7 @@ Status NativeRegisterContextDBReg_arm64::ClearAllHardwareWatchpoints() {

uint32_t
NativeRegisterContextDBReg_arm64::GetWatchpointSize(uint32_t wp_index) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
Log *log = GetLog(LLDBLog::Watchpoints);
LLDB_LOG(log, "wp_index: {0}", wp_index);

switch ((m_hwp_regs[wp_index].control >> 5) & 0xff) {
Expand All @@ -402,7 +402,7 @@ NativeRegisterContextDBReg_arm64::GetWatchpointSize(uint32_t wp_index) {
}

bool NativeRegisterContextDBReg_arm64::WatchpointIsEnabled(uint32_t wp_index) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
Log *log = GetLog(LLDBLog::Watchpoints);
LLDB_LOG(log, "wp_index: {0}", wp_index);

if ((m_hwp_regs[wp_index].control & g_enable_bit) != 0)
Expand All @@ -413,7 +413,7 @@ bool NativeRegisterContextDBReg_arm64::WatchpointIsEnabled(uint32_t wp_index) {

Status NativeRegisterContextDBReg_arm64::GetWatchpointHitIndex(
uint32_t &wp_index, lldb::addr_t trap_addr) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
Log *log = GetLog(LLDBLog::Watchpoints);
LLDB_LOG(log, "wp_index: {0}, trap_addr: {1:x}", wp_index, trap_addr);

// Read hardware breakpoint and watchpoint information.
Expand Down Expand Up @@ -444,7 +444,7 @@ Status NativeRegisterContextDBReg_arm64::GetWatchpointHitIndex(

lldb::addr_t
NativeRegisterContextDBReg_arm64::GetWatchpointAddress(uint32_t wp_index) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
Log *log = GetLog(LLDBLog::Watchpoints);
LLDB_LOG(log, "wp_index: {0}", wp_index);

if (wp_index >= m_max_hwp_supported)
Expand All @@ -457,7 +457,7 @@ NativeRegisterContextDBReg_arm64::GetWatchpointAddress(uint32_t wp_index) {

lldb::addr_t
NativeRegisterContextDBReg_arm64::GetWatchpointHitAddress(uint32_t wp_index) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
Log *log = GetLog(LLDBLog::Watchpoints);
LLDB_LOG(log, "wp_index: {0}", wp_index);

if (wp_index >= m_max_hwp_supported)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ Status NativeRegisterContextDBReg_x86::ClearAllHardwareWatchpoints() {

uint32_t NativeRegisterContextDBReg_x86::SetHardwareWatchpoint(
lldb::addr_t addr, size_t size, uint32_t watch_flags) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
Log *log = GetLog(LLDBLog::Watchpoints);
const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints();
for (uint32_t wp_index = 0; wp_index < num_hw_watchpoints; ++wp_index) {
bool is_vacant;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Status NativeThreadWindows::DoResume(lldb::StateType resume_state) {
return Status();

if (resume_state == eStateStepping) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
Log *log = GetLog(LLDBLog::Thread);

uint32_t flags_index =
GetRegisterContext().ConvertRegisterKindToRegisterNumber(
Expand Down Expand Up @@ -118,7 +118,7 @@ void NativeThreadWindows::SetStopReason(ThreadStopInfo stop_info,

bool NativeThreadWindows::GetStopReason(ThreadStopInfo &stop_info,
std::string &description) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
Log *log = GetLog(LLDBLog::Thread);

switch (m_state) {
case eStateStopped:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ RegisterContextSP
TargetThreadWindows::CreateRegisterContextForFrame(StackFrame *frame) {
RegisterContextSP reg_ctx_sp;
uint32_t concrete_frame_idx = 0;
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
Log *log = GetLog(LLDBLog::Thread);

if (frame)
concrete_frame_idx = frame->GetConcreteFrameIndex();
Expand Down Expand Up @@ -131,7 +131,7 @@ Status TargetThreadWindows::DoResume() {
return Status();

if (resume_state == eStateStepping) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
Log *log = GetLog(LLDBLog::Thread);

uint32_t flags_index =
GetRegisterContext()->ConvertRegisterKindToRegisterNumber(
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ static void ParseFreeBSDPrStatus(ThreadData &thread_data,
lldb::offset_t offset = 0;
int pr_version = data.GetU32(&offset);

Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
Log *log = GetLog(LLDBLog::Process);
if (log) {
if (pr_version > 1)
LLDB_LOGF(log, "FreeBSD PRSTATUS unexpected version %d", pr_version);
Expand Down Expand Up @@ -430,7 +430,7 @@ static void ParseFreeBSDPrPsInfo(ProcessElfCore &process,
lldb::offset_t offset = 0;
int pr_version = data.GetU32(&offset);

Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
Log *log = GetLog(LLDBLog::Process);
if (log) {
if (pr_version > 1)
LLDB_LOGF(log, "FreeBSD PRPSINFO unexpected version %d", pr_version);
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ RegisterContextSP
ThreadElfCore::CreateRegisterContextForFrame(StackFrame *frame) {
RegisterContextSP reg_ctx_sp;
uint32_t concrete_frame_idx = 0;
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
Log *log = GetLog(LLDBLog::Thread);

if (frame)
concrete_frame_idx = frame->GetConcreteFrameIndex();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2778,7 +2778,7 @@ bool GDBRemoteCommunicationClient::GetThreadStopInfo(
uint8_t GDBRemoteCommunicationClient::SendGDBStoppointTypePacket(
GDBStoppointType type, bool insert, addr_t addr, uint32_t length,
std::chrono::seconds timeout) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
Log *log = GetLog(LLDBLog::Breakpoints);
LLDB_LOGF(log, "GDBRemoteCommunicationClient::%s() %s at addr = 0x%" PRIx64,
__FUNCTION__, insert ? "add" : "remove", addr);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServerCommon::Handle_qUserName(
StringExtractorGDBRemote &packet) {
#if LLDB_ENABLE_POSIX
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
Log *log = GetLog(LLDBLog::Process);
LLDB_LOGF(log, "GDBRemoteCommunicationServerCommon::%s begin", __FUNCTION__);

// Packet format: "qUserName:%i" where %i is the uid
Expand Down Expand Up @@ -1020,7 +1020,7 @@ GDBRemoteCommunicationServerCommon::Handle_A(StringExtractorGDBRemote &packet) {
// encoded argument value list, but we will stay true to the documented
// version of the 'A' packet here...

Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
Log *log = GetLog(LLDBLog::Process);
int actual_arg_index = 0;

packet.SetFilePos(1); // Skip the 'A'
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ Status GDBRemoteCommunicationServerPlatform::LaunchGDBServer(
if (hostname.empty())
hostname = "127.0.0.1";

Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOGF(log, "Launching debugserver with: %s:%u...", hostname.c_str(),
*port);

Expand Down Expand Up @@ -228,7 +228,7 @@ GDBRemoteCommunicationServerPlatform::Handle_qLaunchGDBServer(
// Spawn a local debugserver as a platform so we can then attach or launch a
// process...

Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOGF(log, "GDBRemoteCommunicationServerPlatform::%s() called",
__FUNCTION__);

Expand Down
18 changes: 8 additions & 10 deletions lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ Status ProcessGDBRemote::DoConnectRemote(llvm::StringRef remote_url) {
ReadModuleFromMemory(FileSpec(namebuf), standalone_value);
}

Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
Log *log = GetLog(LLDBLog::DynamicLoader);
if (module_sp.get()) {
target.GetImages().AppendIfNeeded(module_sp, false);

Expand Down Expand Up @@ -2919,8 +2919,7 @@ size_t ProcessGDBRemote::DoWriteMemory(addr_t addr, const void *buf,
lldb::addr_t ProcessGDBRemote::DoAllocateMemory(size_t size,
uint32_t permissions,
Status &error) {
Log *log(
GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_EXPRESSIONS));
Log *log = GetLog(LLDBLog::Process | LLDBLog::Expressions);
addr_t allocated_addr = LLDB_INVALID_ADDRESS;

if (m_gdb_comm.SupportsAllocDeallocMemory() != eLazyBoolNo) {
Expand Down Expand Up @@ -3544,8 +3543,7 @@ bool ProcessGDBRemote::StartAsyncThread() {
llvm::Expected<HostThread> async_thread = ThreadLauncher::LaunchThread(
"<lldb.process.gdb-remote.async>", ProcessGDBRemote::AsyncThread, this);
if (!async_thread) {
LLDB_LOG_ERROR(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST),
async_thread.takeError(),
LLDB_LOG_ERROR(GetLog(LLDBLog::Host), async_thread.takeError(),
"failed to launch host thread: {}");
return false;
}
Expand Down Expand Up @@ -3781,7 +3779,7 @@ bool ProcessGDBRemote::NewThreadNotifyBreakpointHit(
// I don't think I have to do anything here, just make sure I notice the new
// thread when it starts to
// run so I can stop it if that's what I want to do.
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
Log *log = GetLog(LLDBLog::Step);
LLDB_LOGF(log, "Hit New Thread Notification breakpoint.");
return false;
}
Expand Down Expand Up @@ -3824,7 +3822,7 @@ Status ProcessGDBRemote::UpdateAutomaticSignalFiltering() {
}

bool ProcessGDBRemote::StartNoticingNewThreads() {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
Log *log = GetLog(LLDBLog::Step);
if (m_thread_create_bp_sp) {
if (log && log->GetVerbose())
LLDB_LOGF(log, "Enabled noticing new thread breakpoint.");
Expand All @@ -3850,7 +3848,7 @@ bool ProcessGDBRemote::StartNoticingNewThreads() {
}

bool ProcessGDBRemote::StopNoticingNewThreads() {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
Log *log = GetLog(LLDBLog::Step);
if (log && log->GetVerbose())
LLDB_LOGF(log, "Disabling new thread notification breakpoint.");

Expand Down Expand Up @@ -4116,7 +4114,7 @@ void ProcessGDBRemote::SetUserSpecifiedMaxMemoryTransferSize(
bool ProcessGDBRemote::GetModuleSpec(const FileSpec &module_file_spec,
const ArchSpec &arch,
ModuleSpec &module_spec) {
Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
Log *log = GetLog(LLDBLog::Platform);

const ModuleCacheKey key(module_file_spec.GetPath(),
arch.GetTriple().getTriple());
Expand Down Expand Up @@ -4495,7 +4493,7 @@ llvm::Expected<LoadedModuleInfoList> ProcessGDBRemote::GetLoadedModuleList() {
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"XML parsing not available");

Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS);
Log *log = GetLog(LLDBLog::Process);
LLDB_LOGF(log, "ProcessGDBRemote::%s", __FUNCTION__);

LoadedModuleInfoList list;
Expand Down
6 changes: 2 additions & 4 deletions lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ ProcessMachCore::~ProcessMachCore() {
}

bool ProcessMachCore::GetDynamicLoaderAddress(lldb::addr_t addr) {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER |
LIBLLDB_LOG_PROCESS));
Log *log(GetLog(LLDBLog::DynamicLoader | LLDBLog::Process));
llvm::MachO::mach_header header;
Status error;
if (DoReadMemory(addr, &header, sizeof(header), error) != sizeof(header))
Expand Down Expand Up @@ -252,8 +251,7 @@ static bool load_standalone_binary(UUID uuid, addr_t value,

// Process Control
Status ProcessMachCore::DoLoadCore() {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER |
LIBLLDB_LOG_PROCESS));
Log *log(GetLog(LLDBLog::DynamicLoader | LLDBLog::Process));
Status error;
if (!m_core_module_sp) {
error.SetErrorString("invalid core module");
Expand Down
25 changes: 10 additions & 15 deletions lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ llvm::ArrayRef<minidump::Thread> MinidumpParser::GetThreads() {
if (ExpectedThreads)
return *ExpectedThreads;

LLDB_LOG_ERROR(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD),
ExpectedThreads.takeError(),
LLDB_LOG_ERROR(GetLog(LLDBLog::Thread), ExpectedThreads.takeError(),
"Failed to read thread list: {0}");
return {};
}
Expand Down Expand Up @@ -141,8 +140,7 @@ ArchSpec MinidumpParser::GetArchitecture() {
llvm::Expected<const SystemInfo &> system_info = m_file->getSystemInfo();

if (!system_info) {
LLDB_LOG_ERROR(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS),
system_info.takeError(),
LLDB_LOG_ERROR(GetLog(LLDBLog::Process), system_info.takeError(),
"Failed to read SystemInfo stream: {0}");
return m_arch;
}
Expand Down Expand Up @@ -200,8 +198,7 @@ ArchSpec MinidumpParser::GetArchitecture() {
triple.setOS(llvm::Triple::OSType::UnknownOS);
auto ExpectedCSD = m_file->getString(system_info->CSDVersionRVA);
if (!ExpectedCSD) {
LLDB_LOG_ERROR(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS),
ExpectedCSD.takeError(),
LLDB_LOG_ERROR(GetLog(LLDBLog::Process), ExpectedCSD.takeError(),
"Failed to CSD Version string: {0}");
} else {
if (ExpectedCSD->find("Linux") != std::string::npos)
Expand Down Expand Up @@ -251,8 +248,7 @@ llvm::ArrayRef<minidump::Module> MinidumpParser::GetModuleList() {
if (ExpectedModules)
return *ExpectedModules;

LLDB_LOG_ERROR(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES),
ExpectedModules.takeError(),
LLDB_LOG_ERROR(GetLog(LLDBLog::Modules), ExpectedModules.takeError(),
"Failed to read module list: {0}");
return {};
}
Expand All @@ -264,7 +260,7 @@ CreateRegionsCacheFromLinuxMaps(MinidumpParser &parser,
if (data.empty())
return false;

Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS);
Log *log = GetLog(LLDBLog::Expressions);
ParseLinuxMapRegions(
llvm::toStringRef(data),
[&regions, &log](llvm::Expected<MemoryRegionInfo> region) -> bool {
Expand Down Expand Up @@ -345,7 +341,7 @@ static bool CheckForLinuxExecutable(ConstString path,
}

std::vector<const minidump::Module *> MinidumpParser::GetFilteredModuleList() {
Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES);
Log *log = GetLog(LLDBLog::Modules);
auto ExpectedModules = GetMinidumpFile().getModuleList();
if (!ExpectedModules) {
LLDB_LOG_ERROR(log, ExpectedModules.takeError(),
Expand Down Expand Up @@ -425,16 +421,15 @@ const minidump::ExceptionStream *MinidumpParser::GetExceptionStream() {
if (ExpectedStream)
return &*ExpectedStream;

LLDB_LOG_ERROR(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS),
ExpectedStream.takeError(),
LLDB_LOG_ERROR(GetLog(LLDBLog::Process), ExpectedStream.takeError(),
"Failed to read minidump exception stream: {0}");
return nullptr;
}

llvm::Optional<minidump::Range>
MinidumpParser::FindMemoryRange(lldb::addr_t addr) {
llvm::ArrayRef<uint8_t> data64 = GetStream(StreamType::Memory64List);
Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES);
Log *log = GetLog(LLDBLog::Modules);

auto ExpectedMemory = GetMinidumpFile().getMemoryList();
if (!ExpectedMemory) {
Expand Down Expand Up @@ -519,7 +514,7 @@ llvm::ArrayRef<uint8_t> MinidumpParser::GetMemory(lldb::addr_t addr,
static bool
CreateRegionsCacheFromMemoryInfoList(MinidumpParser &parser,
std::vector<MemoryRegionInfo> &regions) {
Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES);
Log *log = GetLog(LLDBLog::Modules);
auto ExpectedInfo = parser.GetMinidumpFile().getMemoryInfoList();
if (!ExpectedInfo) {
LLDB_LOG_ERROR(log, ExpectedInfo.takeError(),
Expand Down Expand Up @@ -556,7 +551,7 @@ CreateRegionsCacheFromMemoryInfoList(MinidumpParser &parser,
static bool
CreateRegionsCacheFromMemoryList(MinidumpParser &parser,
std::vector<MemoryRegionInfo> &regions) {
Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES);
Log *log = GetLog(LLDBLog::Modules);
auto ExpectedMemory = parser.GetMinidumpFile().getMemoryList();
if (!ExpectedMemory) {
LLDB_LOG_ERROR(log, ExpectedMemory.takeError(),
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ bool ProcessMinidump::DoUpdateThreadList(ThreadList &old_thread_list,
ModuleSP ProcessMinidump::GetOrCreateModule(UUID minidump_uuid,
llvm::StringRef name,
ModuleSpec module_spec) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
Log *log = GetLog(LLDBLog::DynamicLoader);
Status error;

ModuleSP module_sp =
Expand Down Expand Up @@ -528,7 +528,7 @@ void ProcessMinidump::ReadModuleList() {
std::vector<const minidump::Module *> filtered_modules =
m_minidump_parser->GetFilteredModuleList();

Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
Log *log = GetLog(LLDBLog::DynamicLoader);

for (auto module : filtered_modules) {
std::string name = cantFail(m_minidump_parser->GetMinidumpFile().getString(
Expand Down
7 changes: 3 additions & 4 deletions lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ lldb::ProcessSP ScriptedProcess::CreateInstance(lldb::TargetSP target_sp,

if (error.Fail() || !process_sp || !process_sp->m_script_object_sp ||
!process_sp->m_script_object_sp->IsValid()) {
LLDB_LOGF(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS), "%s",
error.AsCString());
LLDB_LOGF(GetLog(LLDBLog::Process), "%s", error.AsCString());
return nullptr;
}

Expand Down Expand Up @@ -175,7 +174,7 @@ void ScriptedProcess::DidLaunch() {
Status ScriptedProcess::DoResume() {
CheckInterpreterAndScriptObject();

Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
Log *log = GetLog(LLDBLog::Process);
// FIXME: Fetch data from thread.
const StateType thread_resume_state = eStateRunning;
LLDB_LOGF(log, "ScriptedProcess::%s thread_resume_state = %s", __FUNCTION__,
Expand All @@ -199,7 +198,7 @@ Status ScriptedProcess::DoResume() {
Status ScriptedProcess::DoStop() {
CheckInterpreterAndScriptObject();

Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
Log *log = GetLog(LLDBLog::Process);

if (GetInterface().ShouldStop()) {
SetPrivateState(eStateStopped);
Expand Down
16 changes: 8 additions & 8 deletions lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,23 +125,23 @@ ScriptedThread::CreateRegisterContextForFrame(StackFrame *frame) {
if (!reg_data)
return GetInterface()->ErrorWithMessage<lldb::RegisterContextSP>(
LLVM_PRETTY_FUNCTION, "Failed to get scripted thread registers data.",
error, LIBLLDB_LOG_THREAD);
error, LLDBLog::Thread);

DataBufferSP data_sp(
std::make_shared<DataBufferHeap>(reg_data->c_str(), reg_data->size()));

if (!data_sp->GetByteSize())
return GetInterface()->ErrorWithMessage<lldb::RegisterContextSP>(
LLVM_PRETTY_FUNCTION, "Failed to copy raw registers data.", error,
LIBLLDB_LOG_THREAD);
LLDBLog::Thread);

std::shared_ptr<RegisterContextMemory> reg_ctx_memory =
std::make_shared<RegisterContextMemory>(
*this, 0, *GetDynamicRegisterInfo(), LLDB_INVALID_ADDRESS);
if (!reg_ctx_memory)
return GetInterface()->ErrorWithMessage<lldb::RegisterContextSP>(
LLVM_PRETTY_FUNCTION, "Failed to create a register context.", error,
LIBLLDB_LOG_THREAD);
LLDBLog::Thread);

reg_ctx_memory->SetAllRegisterData(data_sp);
m_reg_context_sp = reg_ctx_memory;
Expand All @@ -156,7 +156,7 @@ bool ScriptedThread::CalculateStopInfo() {
if (!dict_sp)
return GetInterface()->ErrorWithMessage<bool>(
LLVM_PRETTY_FUNCTION, "Failed to get scripted thread stop info.", error,
LIBLLDB_LOG_THREAD);
LLDBLog::Thread);

lldb::StopInfoSP stop_info_sp;
lldb::StopReason stop_reason_type;
Expand All @@ -165,14 +165,14 @@ bool ScriptedThread::CalculateStopInfo() {
return GetInterface()->ErrorWithMessage<bool>(
LLVM_PRETTY_FUNCTION,
"Couldn't find value for key 'type' in stop reason dictionary.", error,
LIBLLDB_LOG_THREAD);
LLDBLog::Thread);

StructuredData::Dictionary *data_dict;
if (!dict_sp->GetValueForKeyAsDictionary("data", data_dict))
return GetInterface()->ErrorWithMessage<bool>(
LLVM_PRETTY_FUNCTION,
"Couldn't find value for key 'data' in stop reason dictionary.", error,
LIBLLDB_LOG_THREAD);
LLDBLog::Thread);

switch (stop_reason_type) {
case lldb::eStopReasonNone:
Expand Down Expand Up @@ -206,7 +206,7 @@ bool ScriptedThread::CalculateStopInfo() {
llvm::Twine("Unsupported stop reason type (" +
llvm::Twine(stop_reason_type) + llvm::Twine(")."))
.str(),
error, LIBLLDB_LOG_THREAD);
error, LLDBLog::Thread);
}

if (!stop_info_sp)
Expand Down Expand Up @@ -236,7 +236,7 @@ std::shared_ptr<DynamicRegisterInfo> ScriptedThread::GetDynamicRegisterInfo() {
->ErrorWithMessage<std::shared_ptr<DynamicRegisterInfo>>(
LLVM_PRETTY_FUNCTION,
"Failed to get scripted thread registers info.", error,
LIBLLDB_LOG_THREAD);
LLDBLog::Thread);

m_register_info_sp = std::make_shared<DynamicRegisterInfo>(
*reg_info, m_scripted_process.GetTarget().GetArchitecture());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ PythonException::PythonException(const char *caller) {
PyErr_Clear();
}
}
Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT);
Log *log = GetLog(LLDBLog::Script);
if (caller)
LLDB_LOGF(log, "%s failed with exception: %s", caller, toCString());
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ struct InitializePythonRAII {

~InitializePythonRAII() {
if (m_was_already_initialized) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT));
Log *log = GetLog(LLDBLog::Script);
LLDB_LOGV(log, "Releasing PyGILState. Returning to state = {0}locked",
m_gil_state == PyGILState_UNLOCKED ? "un" : "");
PyGILState_Release(m_gil_state);
Expand Down Expand Up @@ -201,7 +201,7 @@ struct InitializePythonRAII {
#endif

if (PyEval_ThreadsInitialized()) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT));
Log *log = GetLog(LLDBLog::Script);

m_was_already_initialized = true;
m_gil_state = PyGILState_Ensure();
Expand Down Expand Up @@ -380,7 +380,7 @@ ScriptInterpreterPythonImpl::Locker::Locker(
}

bool ScriptInterpreterPythonImpl::Locker::DoAcquireLock() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT));
Log *log = GetLog(LLDBLog::Script);
m_GILState = PyGILState_Ensure();
LLDB_LOGV(log, "Ensured PyGILState. Previous state = {0}locked",
m_GILState == PyGILState_UNLOCKED ? "un" : "");
Expand All @@ -404,7 +404,7 @@ bool ScriptInterpreterPythonImpl::Locker::DoInitSession(uint16_t on_entry_flags,
}

bool ScriptInterpreterPythonImpl::Locker::DoFreeLock() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT));
Log *log = GetLog(LLDBLog::Script);
LLDB_LOGV(log, "Releasing PyGILState. Returning to state = {0}locked",
m_GILState == PyGILState_UNLOCKED ? "un" : "");
PyGILState_Release(m_GILState);
Expand Down Expand Up @@ -590,7 +590,7 @@ ScriptInterpreterPythonImpl::CreateInstance(Debugger &debugger) {
}

void ScriptInterpreterPythonImpl::LeaveSession() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT));
Log *log = GetLog(LLDBLog::Script);
if (log)
log->PutCString("ScriptInterpreterPythonImpl::LeaveSession()");

Expand Down Expand Up @@ -660,7 +660,7 @@ bool ScriptInterpreterPythonImpl::EnterSession(uint16_t on_entry_flags,
FileSP err_sp) {
// If we have already entered the session, without having officially 'left'
// it, then there is no need to 'enter' it again.
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT));
Log *log = GetLog(LLDBLog::Script);
if (m_session_is_active) {
LLDB_LOGF(
log,
Expand Down Expand Up @@ -962,7 +962,7 @@ bool ScriptInterpreterPythonImpl::Interrupt() {
// just our (hardcoded) input signal code SIGINT, so that's not useful at all.
return true;
#else
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT));
Log *log = GetLog(LLDBLog::Script);

if (IsExecutingPython()) {
PyThreadState *state = PyThreadState_GET();
Expand Down
Loading