When a frame is inlined, LLDB will display its name in backtraces as follows: ``` * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.3 * frame #0: 0x0000000100000398 a.out`func() [inlined] baz(x=10) at inline.cpp:1:42 frame #1: 0x0000000100000398 a.out`func() [inlined] bar() at inline.cpp:2:37 frame #2: 0x0000000100000398 a.out`func() at inline.cpp:4:15 frame #3: 0x00000001000003c0 a.out`main at inline.cpp:7:5 frame #4: 0x000000026eb29ab8 dyld`start + 6812 ``` The longer the names get the more confusing this gets because the first function name that appears is the parent frame. My assumption (which may need some more surveying) is that for the majority of cases we only care about the actual frame name (not the parent). So this patch removes all the special logic that prints the parent frame. Another quirk of the current format is that the inlined frame name does not abide by the `${function.name-XXX}` format variables. We always just print the raw demangled name. With this patch, we would format the inlined frame name according to the `frame-format` setting (see the test-cases). If we really want to have the `parentFrame [inlined] inlinedFrame` format, we could expose it through a new `frame-format` variable (e..g., `${function.inlined-at-name}` and let the user decide where to place things.
56 lines
1.9 KiB
Plaintext
56 lines
1.9 KiB
Plaintext
# UNSUPPORTED: system-windows
|
|
# Test different name formats.
|
|
|
|
# RUN: %build %S/Inputs/names.cpp --std c++17 -o %t.out
|
|
# RUN: split-file %s %t
|
|
|
|
#--- name_with_args.input
|
|
# RUN: %lldb -b -s %t/name_with_args.input %t.out | FileCheck %s --check-prefix=NAME_WITH_ARGS
|
|
settings set -f frame-format "frame ${function.name-with-args}\n"
|
|
break set -n foo
|
|
break set -n operator<<
|
|
break set -n returns_func_ptr
|
|
break set -n inlined_foo
|
|
run
|
|
# NAME_WITH_ARGS: frame int ns::foo<int ()>(t={{.*}})
|
|
c
|
|
# NAME_WITH_ARGS: frame int ns::foo<int ()>(str="bar")
|
|
c
|
|
# NAME_WITH_ARGS: frame int ns::foo<(anonymous namespace)::$_0>(t=(anonymous namespace)::(unnamed class) @ {{.*}})
|
|
c
|
|
# NAME_WITH_ARGS: frame int ns::foo<int (*)()>(t=({{.*}}`(anonymous namespace)::anon_bar() at {{.*}}))
|
|
c
|
|
# NAME_WITH_ARGS: frame int ns::foo<void (Foo::*)(int (*)(int)) const noexcept>(str="method")
|
|
c
|
|
# NAME_WITH_ARGS: frame ns::returns_func_ptr<int>((null)={{.*}})
|
|
c
|
|
# NAME_WITH_ARGS: frame void Foo::foo<int (*)()>(this={{.*}}, arg=({{.*}}`(anonymous namespace)::anon_bar() at {{.*}}))
|
|
c
|
|
# NAME_WITH_ARGS: frame void Foo::operator<<<1>(this={{.*}}, (null)=0)
|
|
c
|
|
# NAME_WITH_ARGS: frame Foo::returns_func_ptr<int>(this={{.*}}, (null)={{.*}})
|
|
c
|
|
# NAME_WITH_ARGS: frame inlined_foo(str="bar")
|
|
q
|
|
|
|
#--- name.input
|
|
# RUN: %lldb -b -s %t/name.input %t.out | FileCheck %s --check-prefix=NAME
|
|
settings set -f frame-format "frame ${function.name}\n"
|
|
break set -n inlined_foo
|
|
run
|
|
# NAME: frame inlined_foo(char const*)
|
|
|
|
#--- name_without_args.input
|
|
# RUN: %lldb -b -s %t/name_without_args.input %t.out | FileCheck %s --check-prefix=NAME_WITHOUT_ARGS
|
|
settings set -f frame-format "frame ${function.name-without-args}\n"
|
|
break set -n inlined_foo
|
|
run
|
|
# NAME_WITHOUT_ARGS: frame inlined_foo
|
|
|
|
#--- mangled_name.input
|
|
# RUN: %lldb -b -s %t/mangled_name.input %t.out | FileCheck %s --check-prefix=MANGLED_NAME
|
|
settings set -f frame-format "frame ${function.mangled-name}\n"
|
|
break set -n inlined_foo
|
|
run
|
|
# MANGLED_NAME: frame _Z11inlined_fooPKc
|