summaryrefslogtreecommitdiff
path: root/gdb/frame.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2004-06-27 20:45:05 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2004-06-27 20:45:05 +0000
commite54f9027b61d38d7b91d952c3eab9babd4792d7a (patch)
tree4f89f488dbd8dac9435f7bbdb5fdefd607ca9307 /gdb/frame.c
parent69f03b421a5fb57ecd75382cb46fa656f069fa85 (diff)
downloadgdb-e54f9027b61d38d7b91d952c3eab9babd4792d7a.tar.gz
* frame.h (struct frame_id): New fields stack_addr_p, code_addr_p
and special_addr_p. (frame_id_build, frame_id_build_special): Update comments. (frame_id_build_wild): New prototype. * frame.c (frame_id_build, frame_id_build_special): Fill in new struct frame_id fields. (frame_id_build_wild): New function. (frame_id_eq, frame_id_inner): Use new struct frame_id fields.
Diffstat (limited to 'gdb/frame.c')
-rw-r--r--gdb/frame.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/gdb/frame.c b/gdb/frame.c
index 428eb816e81..0e3531aceaf 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -268,25 +268,42 @@ struct frame_id
frame_id_build_special (CORE_ADDR stack_addr, CORE_ADDR code_addr,
CORE_ADDR special_addr)
{
- struct frame_id id;
+ struct frame_id id = null_frame_id;
id.stack_addr = stack_addr;
+ id.stack_addr_p = 1;
id.code_addr = code_addr;
+ id.code_addr_p = 1;
id.special_addr = special_addr;
+ id.special_addr_p = 1;
return id;
}
struct frame_id
frame_id_build (CORE_ADDR stack_addr, CORE_ADDR code_addr)
{
- return frame_id_build_special (stack_addr, code_addr, 0);
+ struct frame_id id = null_frame_id;
+ id.stack_addr = stack_addr;
+ id.stack_addr_p = 1;
+ id.code_addr = code_addr;
+ id.code_addr_p = 1;
+ return id;
+}
+
+struct frame_id
+frame_id_build_wild (CORE_ADDR stack_addr)
+{
+ struct frame_id id = null_frame_id;
+ id.stack_addr = stack_addr;
+ id.stack_addr_p = 1;
+ return id;
}
int
frame_id_p (struct frame_id l)
{
int p;
- /* The .code can be NULL but the .stack cannot. */
- p = (l.stack_addr != 0);
+ /* The frame is valid iff it has a valid stack address. */
+ p = l.stack_addr_p;
if (frame_debug)
{
fprintf_unfiltered (gdb_stdlog, "{ frame_id_p (l=");
@@ -300,20 +317,21 @@ int
frame_id_eq (struct frame_id l, struct frame_id r)
{
int eq;
- if (l.stack_addr == 0 || r.stack_addr == 0)
- /* Like a NaN, if either ID is invalid, the result is false. */
+ if (!l.stack_addr_p || !r.stack_addr_p)
+ /* Like a NaN, if either ID is invalid, the result is false.
+ Note that a frame ID is invalid iff it is the null frame ID. */
eq = 0;
else if (l.stack_addr != r.stack_addr)
/* If .stack addresses are different, the frames are different. */
eq = 0;
- else if (l.code_addr == 0 || r.code_addr == 0)
- /* A zero code addr is a wild card, always succeed. */
+ else if (!l.code_addr_p || !r.code_addr_p)
+ /* An invalid code addr is a wild card, always succeed. */
eq = 1;
else if (l.code_addr != r.code_addr)
/* If .code addresses are different, the frames are different. */
eq = 0;
- else if (l.special_addr == 0 || r.special_addr == 0)
- /* A zero special addr is a wild card (or unused), always succeed. */
+ else if (!l.special_addr_p || !r.special_addr_p)
+ /* An invalid special addr is a wild card (or unused), always succeed. */
eq = 1;
else if (l.special_addr == r.special_addr)
/* Frames are equal. */
@@ -336,7 +354,7 @@ int
frame_id_inner (struct frame_id l, struct frame_id r)
{
int inner;
- if (l.stack_addr == 0 || r.stack_addr == 0)
+ if (!l.stack_addr_p || !r.stack_addr_p)
/* Like NaN, any operation involving an invalid ID always fails. */
inner = 0;
else