diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2020-08-31 13:23:12 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2020-08-31 13:23:12 -0400 |
commit | 84154d166a1a4592c70e2a8296d5df0ad7f89be9 (patch) | |
tree | 345797bd9e9d6319c482b8f082a4ab26c08d46c6 /gdb/frame.h | |
parent | 8efaf6b352ef4f88d26e130726e1099442956134 (diff) | |
download | gdb-84154d166a1a4592c70e2a8296d5df0ad7f89be9.zip gdb-84154d166a1a4592c70e2a8296d5df0ad7f89be9.tar.gz gdb-84154d166a1a4592c70e2a8296d5df0ad7f89be9.tar.bz2 |
gdb: introduce explicit outer frame id kind
In the following patch, we'll need to easily differentiate the frame_id
of the outer frame (or the frame id of a frame inlined into the outer
frame) from a simply invalid frame id.
Currently, the frame id of the outer frame has `stack_status` set to
FID_STACK_INVALID plus special_addr_p set. A frame inlined into the
outer frame would also have `artificial_depth` set to greater than one.
That makes the job of differntiating the frame id of the outer frame (or a
frame inlined into the outer frame) cumbersome.
To make it easier, give the outer frame id its own frame_id_stack_status
enum value. outer_frame_id then becomes very similar to
sentinel_frame_id, another "special" frame id value.
In frame_id_p, we don't need a special case for the outer frame id, as
it's no long a special case of FID_STACK_INVALID. Same goes for
frame_id_eq.
So in the end, FID_STACK_OUTER isn't even used (except in
fprint_frame_id). But that's expected: all the times we wanted to
identify an outer frame was to differentiate it from an otherwise
invalid frame. Since their frame_id_stack_status value is different
now, that is done naturally.
gdb/ChangeLog:
* frame.h (enum frame_id_stack_status) <FID_STACK_OUTER>: New.
* frame.c (fprint_frame_id): Handle FID_STACK_OUTER.
(outer_frame_id): Use FID_STACK_OUTER instead of
FID_STACK_INVALID.
(frame_id_p): Don't check for outer_frame_id.
Change-Id: I654e7f936349debc4f04f7f684b15e71a0c37619
Diffstat (limited to 'gdb/frame.h')
-rw-r--r-- | gdb/frame.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gdb/frame.h b/gdb/frame.h index 1c6afad..3ceb7b3 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -85,8 +85,7 @@ struct frame_print_options; enum frame_id_stack_status { - /* Stack address is invalid. E.g., this frame is the outermost - (i.e., _start), and the stack hasn't been setup yet. */ + /* Stack address is invalid. */ FID_STACK_INVALID = 0, /* Stack address is valid, and is found in the stack_addr field. */ @@ -95,6 +94,12 @@ enum frame_id_stack_status /* Sentinel frame. */ FID_STACK_SENTINEL = 2, + /* Outer frame. Since a frame's stack address is typically defined as the + value the stack pointer had prior to the activation of the frame, an outer + frame doesn't have a stack address. The frame ids of frames inlined in the + outer frame are also of this type. */ + FID_STACK_OUTER = 3, + /* Stack address is unavailable. I.e., there's a valid stack, but we don't know where it is (because memory or registers we'd compute it from were not collected). */ |