9 Commits

Author SHA1 Message Date
Michael Buch
ebeae6402d Reland "[lldb][Format] Make function name frame-format variables work without debug-info" (#137757)
This reverts commit da7099290cea7d11b83da01adda8afeb3bcd5362.

Same as the original PR. The failing test-case was resolved in https://github.com/llvm/llvm-project/pull/137763
2025-04-29 11:49:21 +01:00
Michael Buch
da7099290c
Revert "[lldb][Format] Make function name frame-format variables work without debug-info" (#137757)
Reverts llvm/llvm-project#137408

This change broke `lldb/test/Shell/Unwind/split-machine-functions.test`.

The test binary has a symbol named `_Z3foov.cold` and the test expects
the backtrace to print the name of the cold part of the function like
this:

```
# SPLIT: frame #1: {{.*}}`foo() (.cold) +
```
but now it gets

```
frame #1: 0x000055555555514f split-machine-functions.test.tmp`foo() + 12
```
2025-04-29 07:13:04 +01:00
Michael Buch
cebf86eb1d
[lldb][Format] Make function name frame-format variables work without debug-info (#137408)
This patch makes the frame-format variables introduced in
https://github.com/llvm/llvm-project/pull/131836 also work when no
debug-info is available. Previously, we assumed `sc.function` was
available, but without debug-info we might only have `sc.symbol`. We
don't really need the `sc.function` apart from when formatting
arguments.

For the function arguments case I added a fallback that will just print
the arguments we get from the demangler (which is what LLDB does for
stacktraces with no debug-info anyway). Ideally we'd have a separate
`FormatEntity::Entry::Type::FunctionArguments` that will just print the
arguments from the demangler and have something like the following in
the `plugin.cplusplus.display.function-name-format`:
```
{ ${function.formatted-arguments} || ${function.arguments} }
```
I.e., when we can't format the arguments, print the ones from the
demangler. But we currently don't have the `||` operator in the
frame-format language yet.
2025-04-28 10:46:00 +01:00
Michael Buch
10f379e686 [lldb][test] TestFrameFormat: set breakpoints by name
Without this for some reason Linux PR CI was failing with:
```
 (lldb) settings set -f frame-format "custom-frame '${function.basename}'\n"
check:50'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:50'1                                          ?                                       possible intended match
            9: (lldb) break set -l 5 -f main.cpp
check:50'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           10: Breakpoint 1: no locations (pending).
check:50'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           11: WARNING: Unable to resolve breakpoint to any actual locations.
check:50'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
2025-04-27 21:43:27 +01:00
Michael Buch
d605a0d70e [lldb][test] FrameFormat tests: Specify filename when setting breakpoints
Try to work around following error on some of the Linux CI:
```
            8: (lldb) settings set -f frame-format "custom-frame '${function.basename}'\n"
check:50'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:50'1                                          ?                                       possible intended match
            9: (lldb) break set -l 5
check:50'0     ~~~~~~~~~~~~~~~~~~~~~~
           10: error: No selected frame to use to find the default file.
check:50'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           11: error: No file supplied and no default file available.
check:50'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           12: (lldb) exit
check:50'0     ~~~~~~~~~~~~
```
2025-04-27 11:21:01 +01:00
Michael Buch
28293ea023 [lldb][test] XFAIL FrameFormat tests on Windows again
These are failing for various reasons on CI, most likely due to us
requiring the Microsoft mangler. So XFAIL these.
2025-04-26 13:23:47 +01:00
Michael Buch
7581aa1d8e [lldb][test] Make sure we compile FrameFormat tests with DWARF
These don't make sense for PDB on Windows
2025-04-26 11:28:32 +01:00
Michael Buch
e6f7e3418e [lldb][test] Fix/XFAIL FrameFormat tests on Windows
All of these were failing on Windows CI. Some are failing because
breakpoints on template functions can't be set by name. Others are
failing because of slight textual differences. Most are failing because
we can't track components of a mangled name from PDB, so XFAIL those.
2025-04-26 08:56:16 +01:00
Michael Buch
8b91b44a3b [lldb][Format] Introduce new frame-format variables for function parts (#131836)
Adds new frame-format variables and implements them in the CPlusPlusLanguage plugin.

We use the `DemangledNameInfo` type to retrieve the necessary part of the demangled name.

https://github.com/llvm/llvm-project/pull/131836
2025-04-25 10:04:27 +01:00