[Lldb-commits] [lldb] [DRAFT] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels (PR #148877)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Jul 15 09:04:45 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- lldb/include/lldb/Expression/Expression.h lldb/include/lldb/Symbol/SymbolFile.h lldb/source/Expression/IRExecutionUnit.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h lldb/unittests/Symbol/TestTypeSystemClang.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp
index 2edfa661b..4f8e84612 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -775,19 +775,22 @@ private:
lldb::addr_t m_best_internal_load_address = LLDB_INVALID_ADDRESS;
};
-static llvm::Expected<Module *> GetModulePtr(llvm::StringRef module, Target &target) {
+static llvm::Expected<Module *> GetModulePtr(llvm::StringRef module,
+ Target &target) {
uintptr_t module_ptr = 0;
- if (module.starts_with("0x") && !module.consumeInteger(0, module_ptr)
- && module_ptr != 0)
+ if (module.starts_with("0x") && !module.consumeInteger(0, module_ptr) &&
+ module_ptr != 0)
return reinterpret_cast<Module *>(module_ptr);
UUID module_uuid;
if (!module_uuid.SetFromStringRef(module) || !module_uuid.IsValid())
- return llvm::createStringError("failed to create Module UUID from '%s'", module.data());
+ return llvm::createStringError("failed to create Module UUID from '%s'",
+ module.data());
Module *found_module = target.GetImages().FindModule(module_uuid).get();
if (!found_module)
- return llvm::createStringError("failed to find module with UUID '{0}'", module.data());
+ return llvm::createStringError("failed to find module with UUID '{0}'",
+ module.data());
return found_module;
}
@@ -841,13 +844,13 @@ ResolveFunctionCallLabel(llvm::StringRef label,
// TODO: module UID is only a Darwin concept (?)
auto found_module_or_err = GetModulePtr(module, *target);
if (!found_module_or_err) {
- LLDB_LOG_ERROR(GetLog(LLDBLog::Expressions), found_module_or_err.takeError(),
- "Failed to resolve function label {1}: {0}",
- label);
+ LLDB_LOG_ERROR(GetLog(LLDBLog::Expressions),
+ found_module_or_err.takeError(),
+ "Failed to resolve function label {1}: {0}", label);
return LLDB_INVALID_ADDRESS;
}
- Module * found_module = *found_module_or_err;
+ Module *found_module = *found_module_or_err;
lldb::user_id_t die_id;
if (die.consumeInteger(/*Radix=*/0, die_id)) {
@@ -857,7 +860,7 @@ ResolveFunctionCallLabel(llvm::StringRef label,
label, components[2]);
return LLDB_INVALID_ADDRESS;
}
-
+
auto *symbol_file = found_module->GetSymbolFile();
if (!symbol_file) {
LLDB_LOG(GetLog(LLDBLog::Expressions),
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 069e817fb..a7cbc794c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -272,7 +272,7 @@ static std::optional<std::string> MakeLLDBFuncAsmLabel(const DWARFDIE &die) {
// Maybe add character to signal whether this is a pointer
// or UUID. Or maybe if it's not hex that implies a UUID?
auto module_id = module_sp->GetUUID();
- Module * module_ptr = nullptr;
+ Module *module_ptr = nullptr;
if (!module_id.IsValid())
module_ptr = module_sp.get();
@@ -281,7 +281,10 @@ static std::optional<std::string> MakeLLDBFuncAsmLabel(const DWARFDIE &die) {
return label;
return llvm::formatv("{0}:{1}:{2}:{3:x}", FunctionCallLabelPrefix,
- mangled ? mangled : "", module_ptr ? llvm::formatv("{0:x}", module_ptr).str() : module_id.GetAsString(), die_id)
+ mangled ? mangled : "",
+ module_ptr ? llvm::formatv("{0:x}", module_ptr).str()
+ : module_id.GetAsString(),
+ die_id)
.str();
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/148877
More information about the lldb-commits
mailing list