aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-08-04 14:52:44 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2020-08-04 14:52:44 -0400
commitfedfee8850a861dd5eba402de7db67f9f01c92c6 (patch)
tree907d7ce437b365b61ea76f23127ea09e2fa9a6a5
parent6cfa9b59e25aaddae2f09d185330787b68a3559d (diff)
downloadgdb-fedfee8850a861dd5eba402de7db67f9f01c92c6.zip
gdb-fedfee8850a861dd5eba402de7db67f9f01c92c6.tar.gz
gdb-fedfee8850a861dd5eba402de7db67f9f01c92c6.tar.bz2
gdb: change frame_info::prev_func::p type to cached_copy_status
One might think that variable `frame_info::prev_func::p` is a simple true/false value, but that's not the case, it can also have the value -1 to mean "unavaiable". Change it to use the `cached_copy_status` enum, which seems designed exactly for this purpose. Rename to `status` to be consistent with `prev_pc::status` (and be cause `p` means `predicate`, which implies boolean, which this is not). gdb/ChangeLog: * frame.c (frame_info) <prev_func> <p>: Rename to status, change type to cached_copy_status. (fprintf_frame): Adjust. (get_frame_func_if_available): Adjust. (frame_cleanup_after_sniffer): Adjust. Change-Id: I50c6ebef6c0acb076e25c741f7f417bfd101d953
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/frame.c18
2 files changed, 18 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b18627c..da1f2e1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2020-08-04 Simon Marchi <simon.marchi@efficios.com>
+
+ * frame.c (frame_info) <prev_func> <p>: Rename to status, change
+ type to cached_copy_status.
+ (fprintf_frame): Adjust.
+ (get_frame_func_if_available): Adjust.
+ (frame_cleanup_after_sniffer): Adjust.
+
2020-08-04 Mark Wielaard <mark@klomp.org>
* MAINTAINERS (Write After Approval): Update email address.
diff --git a/gdb/frame.c b/gdb/frame.c
index a3599e8..9c3a1ae 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -133,7 +133,7 @@ struct frame_info
/* Cached copy of the previous frame's resume address. */
struct {
- enum cached_copy_status status;
+ cached_copy_status status;
/* Did VALUE require unmasking when being read. */
bool masked;
CORE_ADDR value;
@@ -143,7 +143,7 @@ struct frame_info
struct
{
CORE_ADDR addr;
- int p;
+ cached_copy_status status;
} prev_func;
/* This frame's ID. */
@@ -478,7 +478,7 @@ fprint_frame (struct ui_file *file, struct frame_info *fi)
fprintf_unfiltered (file, "<unknown>");
fprintf_unfiltered (file, ",");
fprintf_unfiltered (file, "func=");
- if (fi->next != NULL && fi->next->prev_func.p)
+ if (fi->next != NULL && fi->next->prev_func.status == CC_VALUE)
fprintf_unfiltered (file, "%s", hex_string (fi->next->prev_func.addr));
else
fprintf_unfiltered (file, "<unknown>");
@@ -1008,7 +1008,7 @@ get_frame_func_if_available (struct frame_info *this_frame, CORE_ADDR *pc)
{
struct frame_info *next_frame = this_frame->next;
- if (!next_frame->prev_func.p)
+ if (next_frame->prev_func.status == CC_UNKNOWN)
{
CORE_ADDR addr_in_block;
@@ -1016,7 +1016,7 @@ get_frame_func_if_available (struct frame_info *this_frame, CORE_ADDR *pc)
found. */
if (!get_frame_address_in_block_if_available (this_frame, &addr_in_block))
{
- next_frame->prev_func.p = -1;
+ next_frame->prev_func.status = CC_UNAVAILABLE;
if (frame_debug)
fprintf_unfiltered (gdb_stdlog,
"{ get_frame_func (this_frame=%d)"
@@ -1025,7 +1025,7 @@ get_frame_func_if_available (struct frame_info *this_frame, CORE_ADDR *pc)
}
else
{
- next_frame->prev_func.p = 1;
+ next_frame->prev_func.status = CC_VALUE;
next_frame->prev_func.addr = get_pc_function_start (addr_in_block);
if (frame_debug)
fprintf_unfiltered (gdb_stdlog,
@@ -1035,13 +1035,15 @@ get_frame_func_if_available (struct frame_info *this_frame, CORE_ADDR *pc)
}
}
- if (next_frame->prev_func.p < 0)
+ if (next_frame->prev_func.status == CC_UNAVAILABLE)
{
*pc = -1;
return 0;
}
else
{
+ gdb_assert (next_frame->prev_func.status == CC_VALUE);
+
*pc = next_frame->prev_func.addr;
return 1;
}
@@ -2908,7 +2910,7 @@ frame_cleanup_after_sniffer (struct frame_info *frame)
The previous PC is independent of the unwinder, but the previous
function is not (see get_frame_address_in_block). */
- frame->prev_func.p = 0;
+ frame->prev_func.status = CC_UNKNOWN;
frame->prev_func.addr = 0;
/* Discard the unwinder last, so that we can easily find it if an assertion