[all-commits] [llvm/llvm-project] f89059: [lldb][Expression] Encode Module and DIE UIDs into...
Michael Buch via All-commits
all-commits at lists.llvm.org
Thu Jul 31 23:22:03 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f89059140bd54699771fe076da30dd1db060cc93
https://github.com/llvm/llvm-project/commit/f89059140bd54699771fe076da30dd1db060cc93
Author: Michael Buch <michaelbuch12 at gmail.com>
Date: 2025-08-01 (Fri, 01 Aug 2025)
Changed paths:
M lldb/include/lldb/Core/Module.h
M lldb/include/lldb/Core/ModuleList.h
M lldb/include/lldb/Expression/Expression.h
M lldb/include/lldb/Symbol/SymbolFile.h
M lldb/source/Core/Module.cpp
M lldb/source/Core/ModuleList.cpp
M lldb/source/Expression/Expression.cpp
M lldb/source/Expression/IRExecutionUnit.cpp
M lldb/source/Expression/IRInterpreter.cpp
M lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
M lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
M lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
M lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
M lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
A lldb/test/API/lang/cpp/expr-definition-in-dylib/Makefile
A lldb/test/API/lang/cpp/expr-definition-in-dylib/TestExprDefinitionInDylib.py
A lldb/test/API/lang/cpp/expr-definition-in-dylib/lib.cpp
A lldb/test/API/lang/cpp/expr-definition-in-dylib/lib.h
A lldb/test/API/lang/cpp/expr-definition-in-dylib/main.cpp
M lldb/unittests/Expression/CMakeLists.txt
A lldb/unittests/Expression/ExpressionTest.cpp
M lldb/unittests/Symbol/TestTypeSystemClang.cpp
Log Message:
-----------
[lldb][Expression] Encode Module and DIE UIDs into function AsmLabels (#148877)
LLDB currently attaches `AsmLabel`s to `FunctionDecl`s such that that
the `IRExecutionUnit` can determine which mangled name to call (we can't
rely on Clang deriving the correct mangled name to call because the
debug-info AST doesn't contain all the info that would be encoded in the
DWARF linkage names). However, we don't attach `AsmLabel`s for structors
because they have multiple variants and thus it's not clear which
mangled name to use. In the [RFC on fixing expression evaluation of
abi-tagged
structors](https://discourse.llvm.org/t/rfc-lldb-handling-abi-tagged-constructors-destructors-in-expression-evaluator/82816)
we discussed encoding the structor variant into the `AsmLabel`s.
Specifically in [this
thread](https://discourse.llvm.org/t/rfc-lldb-handling-abi-tagged-constructors-destructors-in-expression-evaluator/82816/7)
we discussed that the contents of the `AsmLabel` are completely under
LLDB's control and we could make use of it to uniquely identify a
function by encoding the exact module and DIE that the function is
associated with (mangled names need not be enough since two identical
mangled symbols may live in different modules). So if we already have a
custom `AsmLabel` format, we can encode the structor variant in a
follow-up (the current idea is to append the structor variant as a
suffix to our custom `AsmLabel` when Clang emits the mangled name into
the JITted IR). Then we would just have to teach the `IRExecutionUnit`
to pick the correct structor variant DIE during symbol resolution. The
draft of this is available
[here](https://github.com/llvm/llvm-project/pull/149827)
This patch sets up the infrastructure for the custom `AsmLabel` format
by encoding the module id, DIE id and mangled name in it.
**Implementation**
The flow is as follows:
1. Create the label in `DWARFASTParserClang`. The format is:
`$__lldb_func:module_id:die_id:mangled_name`
2. When resolving external symbols in `IRExecutionUnit`, we parse this
label and then do a lookup by DIE ID (or mangled name into the module if
the encoded DIE is a declaration).
Depends on https://github.com/llvm/llvm-project/pull/151355
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list