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
```
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.
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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
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 ~~~~~~~~~~~~
```
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.
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