aboutsummaryrefslogtreecommitdiff
path: root/gdb
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
commit12b0b6deedc672f75f59aac556e21e290e202ca2 (patch)
tree5737980f3af0401e980a7010ca22f0db1c0899f4 /gdb
parent47b42a3eace3322ecb7dfaad92ad8f9b3976f601 (diff)
downloadgdb-12b0b6deedc672f75f59aac556e21e290e202ca2.zip
gdb-12b0b6deedc672f75f59aac556e21e290e202ca2.tar.gz
gdb-12b0b6deedc672f75f59aac556e21e290e202ca2.tar.bz2
* 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')
-rw-r--r--gdb/ChangeLog11
-rw-r--r--gdb/frame.c40
-rw-r--r--gdb/frame.h40
3 files changed, 69 insertions, 22 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 3e48f0b..de06f93 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,14 @@
+2004-06-27 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * 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.
+
2004-06-27 Mark Kettenis <kettenis@gnu.org>
* config/djgpp/fnchange.lst: Add entries for hppabsd-nat.c and
diff --git a/gdb/frame.c b/gdb/frame.c
index 428eb81..0e3531a 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
diff --git a/gdb/frame.h b/gdb/frame.h
index 62eb5da..d9c59d1 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -94,23 +94,39 @@ struct frame_id
outer-most address (the inner-most address of the previous frame)
is used. Watch out for all the legacy targets that still use the
function pointer register or stack pointer register. They are
- wrong. */
+ wrong.
+
+ This field is valid only if stack_addr_p is true. Otherwise, this
+ frame represents the null frame. */
CORE_ADDR stack_addr;
+
/* The frame's code address. This shall be constant through out the
lifetime of the frame. While the PC (a.k.a. resume address)
changes as the function is executed, this code address cannot.
Typically, it is set to the address of the entry point of the
- frame's function (as returned by frame_func_unwind(). */
+ frame's function (as returned by frame_func_unwind().
+
+ This field is valid only if code_addr_p is true. Otherwise, this
+ frame is considered to have a wildcard code address, i.e. one that
+ matches every address value in frame comparisons. */
CORE_ADDR code_addr;
+
/* The frame's special address. This shall be constant through out the
lifetime of the frame. This is used for architectures that may have
frames that do not change the stack but are still distinct and have
some form of distinct identifier (e.g. the ia64 which uses a 2nd
stack for registers). This field is treated as unordered - i.e. will
not be used in frame ordering comparisons such as frame_id_inner().
- A zero in this field will be treated as a wild-card when comparing
- frames for equality. */
+
+ This field is valid only if special_addr_p is true. Otherwise, this
+ frame is considered to have a wildcard special address, i.e. one that
+ matches every address value in frame comparisons. */
CORE_ADDR special_addr;
+
+ /* Flags to indicate the above fields have valid contents. */
+ int stack_addr_p : 1;
+ int code_addr_p : 1;
+ int special_addr_p : 1;
};
/* Methods for constructing and comparing Frame IDs.
@@ -135,22 +151,24 @@ extern const struct frame_id null_frame_id;
/* Construct a frame ID. The first parameter is the frame's constant
stack address (typically the outer-bound), and the second the
- frame's constant code address (typically the entry point) (or zero,
- to indicate a wild card). The special identifier address is
- defaulted to zero. */
+ frame's constant code address (typically the entry point).
+ The special identifier address is set to indicate a wild card. */
extern struct frame_id frame_id_build (CORE_ADDR stack_addr,
CORE_ADDR code_addr);
/* Construct a special frame ID. The first parameter is the frame's constant
stack address (typically the outer-bound), the second is the
- frame's constant code address (typically the entry point) (or zero,
- to indicate a wild card), and the third parameter is the frame's
- special identifier address (or zero to indicate a wild card or
- unused default). */
+ frame's constant code address (typically the entry point),
+ and the third parameter is the frame's special identifier address. */
extern struct frame_id frame_id_build_special (CORE_ADDR stack_addr,
CORE_ADDR code_addr,
CORE_ADDR special_addr);
+/* Construct a wild card frame ID. The parameter is the frame's constant
+ stack address (typically the outer-bound). The code address as well
+ as the special identifier address are set to indicate wild cards. */
+extern struct frame_id frame_id_build_wild (CORE_ADDR stack_addr);
+
/* Returns non-zero when L is a valid frame (a valid frame has a
non-zero .base). */
extern int frame_id_p (struct frame_id l);