diff options
author | Scott Linder <scott@scottlinder.com> | 2020-08-31 13:24:20 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2020-08-31 13:25:05 -0400 |
commit | 22b9b4b05bfad806eb3d16535dcd4dbedb028c40 (patch) | |
tree | 5c066a02a1f0ad1446fc1cc96ac94d74e85d7701 /gdb/inline-frame.c | |
parent | 84154d166a1a4592c70e2a8296d5df0ad7f89be9 (diff) | |
download | gdb-22b9b4b05bfad806eb3d16535dcd4dbedb028c40.zip gdb-22b9b4b05bfad806eb3d16535dcd4dbedb028c40.tar.gz gdb-22b9b4b05bfad806eb3d16535dcd4dbedb028c40.tar.bz2 |
gdb: support frames inlined into the outer frame
Remove the restriction (gdb_assert) that prevents creating frames
inlined in the outer frame. Like for frames inlined in a standard frame
(FID_STACK_VALID), a frame inlined into the outer frame will have:
- artificial_depth greater than 0
- code_addr equal to the first executed instruction in the block
corresponding to the inlined function
It will however have its stack_status set to FID_STACK_OUTER, like the
outer frame.
This is not typically seen on your everyday system (e.g. a Linux /
x86-64 process), because the outer frame would be for instance the
_start function, probably written in assembly and very unlikely to have
anything inlined in it. However this could happen in more "bare-metal"
scenarios. In particular, this was seen in ROCm GDB [1], where the
compiler does inline functions in the top-level kernel functions (kernel
in the sense of compute kernel, not userspace vs kernel).
I however wrote a test that replicates the issue on x86-64 and a few
other arches I had access to. Since we need to control precisely the
emitted DWARF CFI, I didn't find another way than to write it in
assembly. The DWARF is generated using the testsuite's DWARF assembler,
except the unwind information, which is written using CFI directives
(and therefore generated by the actual assembler). I think the test is
adequately commented, but if anything is unclear, just ask and I'll add
more info.
[1] https://github.com/ROCm-Developer-Tools/ROCgdb/
gdb/ChangeLog:
YYYY-MM-DD Scott Linder <scott@scottlinder.com>
YYYY-MM-DD Simon Marchi <simon.marchi@efficios.com>
* inline-frame.c (inline_frame_this_id): Remove assert that prevents
inline frame ids in outer frame.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/frame-inlined-in-outer-frame.exp: New file.
* gdb.dwarf2/frame-inlined-in-outer-frame.S: New file.
Change-Id: I8aa129c667dccc31590ffdf426586418493a6ebe
Diffstat (limited to 'gdb/inline-frame.c')
-rw-r--r-- | gdb/inline-frame.c | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/gdb/inline-frame.c b/gdb/inline-frame.c index 35ceb27..300b122 100644 --- a/gdb/inline-frame.c +++ b/gdb/inline-frame.c @@ -171,10 +171,6 @@ inline_frame_this_id (struct frame_info *this_frame, frame"). This will take work. */ gdb_assert (frame_id_p (*this_id)); - /* For now, require we don't match outer_frame_id either (see - comment above). */ - gdb_assert (!frame_id_eq (*this_id, outer_frame_id)); - /* Future work NOTE: Alexandre Oliva applied a patch to GCC 4.3 which generates DW_AT_entry_pc for inlined functions when possible. If this attribute is available, we should use it |