[Lldb-commits] [lldb] [DRAFT] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels (PR #148877)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Wed Jul 16 03:55:30 PDT 2025
================
@@ -249,6 +250,41 @@ static unsigned GetCXXMethodCVQuals(const DWARFDIE &subprogram,
return cv_quals;
}
+// TODO:
+// 0. Adjust FindInSymbols
+// 1. log failure paths
+// 2. What happens for functions without a linkage name? Previously we didn't
+// attach a label for those but now we would
+// 3. Unit-test
+// 4. API test (whilch checks expr and AST dump)
+static std::optional<std::string> MakeLLDBFuncAsmLabel(const DWARFDIE &die) {
+ std::optional<std::string> label;
+ char const *mangled = die.GetMangledName(/*substitute_name_allowed=*/false);
+ if (mangled)
+ label.emplace(mangled);
+
+ auto module_sp = die.GetModule();
+ if (!module_sp)
+ return label;
+
+ // Module UID is only a Darwin concept (?)
+ // If UUID is not available encode as pointer.
+ // 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;
+ if (!module_id.IsValid())
+ module_ptr = module_sp.get();
----------------
Michael137 wrote:
> There are plenty of other ways to implement this detail though, the most obvious one being assigning a surrogate ID (an increasing integer) to each module upon creation (just like we do with debuggers).
Yea that seems like a good alternative
https://github.com/llvm/llvm-project/pull/148877
More information about the lldb-commits
mailing list