[RFC][PATCH] Support frames inlined into the outer frame

scott@scottlinder.com scott@scottlinder.com
Wed Mar 18 20:43:55 GMT 2020


AMD is working on a port of GDB for our GPUs based on the ROCm stack
(https://rocm.github.io/). We recently open-sourced the fork at
https://github.com/ROCm-Developer-Tools/ROCgdb. We hope to begin 
upstreaming
patches where possible,
and https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/767 is the 
first
such patch.

We frequently have functions inlined into the outermost frame. The 
current
implementation which introduced `outer_frame_id` as a "valid" ID 
distinct from
`null_frame_id` does not support this, asserting the need for both a 
valid
and non-`outer_frame_id` ID to base the ID of the inlined frame on.

This patch changes the definition of `outer_frame_id` slightly to 
effectively
represent a class of IDs which identify a frame inlined into the outer 
frame.
These differ in `artificial_depth`, but otherwise behave just as
`outer_frame_id` in that they are `FID_STACK_INVALID`, yet `frame_id_p` 
returns
`true` and they compare equal to each other.

Running the testsuite both with and without the patch doesn't yield any 
obvious
regressions, although I have not come up with a test case to prove this 
out on
e.g. x86.

Does this seem reasonable? It is a bit of a hack on a hack, considering 
the
existing issues with `outer_frame_id` and the obvious desire to remove 
it
completely. At the same time, there is a fair amount of thought and 
effort
involved in making that change, and I think it can/should be done 
independently
of fixing this bug. My feeling is this patch is a pretty non-invasive 
change
that doesn't make the situation fundamentally worse, but any feedback is
appreciated.

Cheers,
Scott


More information about the Gdb-patches mailing list