Files
Dave Lee 2959051e65 [lldb] Preserve original symbol of Mangled function names (#152201)
Fixes a bug that surfaces in frame recognizers.

Details about the bug:

A new frame recognizer is configured to match a specific symbol
(`swift_willThrow`). This is an `extern "C"` symbol defined in a C++
source file. When Swift is built with debug info, the function
`ParseFunctionFromDWARF` will use the debug info to construct a function
name that looks like a C++ declaration (`::swift_willThrow(void *,
SwiftError**)`). The `Mangled` instance will have this string as its
`m_demangled` field, and have _no_ string for its `m_mangled` field.

The result is the frame recognizer would not match the symbol to the
name (`swift_willThrow` != `::swift_willThrow(void *, SwiftError**)`.

By changing `ParseFunctionFromDWARF` to assign both a demangled name and
a mangled, frame recognizers can successfully match symbols in this
configuration.
2025-08-05 21:23:46 -07:00

23 lines
431 B
C++

#include <stdio.h>
#include <stdint.h>
extern "C"
{
int foo();
};
int foo()
{
puts("foo"); //% self.expect("image lookup -va $pc",
//% substrs=[' name = "::foo()"',
//% ' mangled = "foo"'])
return 2;
}
int main (int argc, char const *argv[], char const *envp[])
{
foo();
return 0; //% self.expect("expression -- foo()", substrs = ['2'])
}