aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Thorpe <thorpej@netbsd.org>2002-04-22 20:38:41 +0000
committerJason Thorpe <thorpej@netbsd.org>2002-04-22 20:38:41 +0000
commit5516aa921e57f45c4d2bd559209c67f4b81d8368 (patch)
tree876aff53e9edbe7e851061cb54c59679e0976eac
parent36af0b355e0cb0d2072d5361771adf6ab3289eb9 (diff)
downloadgdb-5516aa921e57f45c4d2bd559209c67f4b81d8368.zip
gdb-5516aa921e57f45c4d2bd559209c67f4b81d8368.tar.gz
gdb-5516aa921e57f45c4d2bd559209c67f4b81d8368.tar.bz2
* vax-tdep.c (vax_frame_saved_pc): New function.
(vax_frame_args_address_correct): Ditto. (vax_frame_args_address): Ditto. (vax_frame_locals_address): Ditto. (vax_frame_num_args): Move code to be in proximity to other frame-related functions. * config/vax/tm-vax.h (INNER_THAN): Use core_addr_lessthan. (FRAME_SAVED_PC): Use vax_frame_saved_pc. (FRAME_ARGS_ADDRESS_CORRECT): Use vax_frame_args_address_correct. (FRAME_ARGS_ADDRESS): Use vax_frame_args_address. (FRAME_LOCALS_ADDRESS): Use vax_frame_locals_address.
-rw-r--r--gdb/ChangeLog14
-rw-r--r--gdb/config/vax/tm-vax.h44
-rw-r--r--gdb/vax-tdep.c61
3 files changed, 79 insertions, 40 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index dae2a02..6785efb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,17 @@
+2002-04-22 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * vax-tdep.c (vax_frame_saved_pc): New function.
+ (vax_frame_args_address_correct): Ditto.
+ (vax_frame_args_address): Ditto.
+ (vax_frame_locals_address): Ditto.
+ (vax_frame_num_args): Move code to be in proximity to
+ other frame-related functions.
+ * config/vax/tm-vax.h (INNER_THAN): Use core_addr_lessthan.
+ (FRAME_SAVED_PC): Use vax_frame_saved_pc.
+ (FRAME_ARGS_ADDRESS_CORRECT): Use vax_frame_args_address_correct.
+ (FRAME_ARGS_ADDRESS): Use vax_frame_args_address.
+ (FRAME_LOCALS_ADDRESS): Use vax_frame_locals_address.
+
2002-04-22 H.J. Lu (hjl@gnu.org)
* Makefile.in (FLAGS_TO_PASS): Add libdir, mandir, datadir and
diff --git a/gdb/config/vax/tm-vax.h b/gdb/config/vax/tm-vax.h
index 90819f4..e8bab7e 100644
--- a/gdb/config/vax/tm-vax.h
+++ b/gdb/config/vax/tm-vax.h
@@ -51,7 +51,7 @@ extern CORE_ADDR vax_skip_prologue (CORE_ADDR);
/* Stack grows downward. */
-#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
+#define INNER_THAN(lhs,rhs) core_addr_lessthan ((lhs), (rhs))
/* Sequence of bytes for breakpoint instruction. */
@@ -173,37 +173,21 @@ extern struct type *vax_register_virtual_type (int);
/* Saved Pc. Get it from sigcontext if within sigtramp. */
/* Offset to saved PC in sigcontext, from <sys/signal.h>. */
+/* XXXJRT should go away */
#define SIGCONTEXT_PC_OFFSET 12
-#define FRAME_SAVED_PC(FRAME) \
- (((FRAME)->signal_handler_caller \
- ? sigtramp_saved_pc (FRAME) \
- : read_memory_integer ((FRAME)->frame + 16, 4)) \
- )
-
-/* Cannot find the AP register value directly from the FP value. Must
- find it saved in the frame called by this one, or in the AP
- register for the innermost frame. However, there is no way to tell
- the difference between the innermost frame and a frame for which we
- just don't know the frame that it called (e.g. "info frame
- 0x7ffec789"). For the sake of argument suppose that the stack is
- somewhat trashed (which is one reason that "info frame" exists).
- So return 0 (indicating we don't know the address of
- the arglist) if we don't know what frame this frame calls. */
-#define FRAME_ARGS_ADDRESS_CORRECT(fi) \
- (((fi)->next \
- ? read_memory_integer ((fi)->next->frame + 8, 4) \
- : /* read_register (AP_REGNUM) */ 0))
-
-/* In most of GDB, getting the args address is too important to
- just say "I don't know". This is sometimes wrong for functions
- that aren't on top of the stack, but c'est la vie. */
-#define FRAME_ARGS_ADDRESS(fi) \
- (((fi)->next \
- ? read_memory_integer ((fi)->next->frame + 8, 4) \
- : read_register (AP_REGNUM) /* 0 */))
-
-#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
+#define FRAME_SAVED_PC(FRAME) vax_frame_saved_pc ((FRAME))
+extern CORE_ADDR vax_frame_saved_pc (struct frame_info *);
+
+/* XXXJRT not yet under gdbarch control */
+#define FRAME_ARGS_ADDRESS_CORRECT(fi) vax_frame_args_address ((fi))
+extern CORE_ADDR vax_frame_args_address (struct frame_info *);
+
+#define FRAME_ARGS_ADDRESS(fi) vax_frame_args_address ((fi))
+extern CORE_ADDR vax_frame_args_address (struct frame_info *);
+
+#define FRAME_LOCALS_ADDRESS(fi) vax_frame_locals_address ((fi))
+extern CORE_ADDR vax_frame_locals_address (struct frame_info *);
/* Return number of args passed to a frame.
Can return -1, meaning no way to tell. */
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index 15cff55..8e4c083 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -126,6 +126,57 @@ vax_frame_init_saved_regs (struct frame_info *frame)
frame->saved_regs[AP_REGNUM] = frame->frame + 8;
frame->saved_regs[PS_REGNUM] = frame->frame + 4;
}
+
+CORE_ADDR
+vax_frame_saved_pc (struct frame_info *frame)
+{
+ if (frame->signal_handler_caller)
+ return (sigtramp_saved_pc (frame)); /* XXXJRT */
+
+ return (read_memory_integer (frame->frame + 16, 4));
+}
+
+CORE_ADDR
+vax_frame_args_address_correct (struct frame_info *frame)
+{
+ /* Cannot find the AP register value directly from the FP value. Must
+ find it saved in the frame called by this one, or in the AP register
+ for the innermost frame. However, there is no way to tell the
+ difference between the innermost frame and a frame for which we
+ just don't know the frame that it called (e.g. "info frame 0x7ffec789").
+ For the sake of argument, suppose that the stack is somewhat trashed
+ (which is one reason that "info frame" exists). So, return 0 (indicating
+ we don't know the address of the arglist) if we don't know what frame
+ this frame calls. */
+ if (frame->next)
+ return (read_memory_integer (frame->next->frame + 8, 4));
+
+ return (0);
+}
+
+CORE_ADDR
+vax_frame_args_address (struct frame_info *frame)
+{
+ /* In most of GDB, getting the args address is too important to
+ just say "I don't know". This is sometimes wrong for functions
+ that aren't on top of the stack, but c'est la vie. */
+ if (frame->next)
+ return (read_memory_integer (frame->next->frame + 8, 4));
+
+ return (read_register (AP_REGNUM));
+}
+
+CORE_ADDR
+vax_frame_locals_address (struct frame_info *frame)
+{
+ return (frame->frame);
+}
+
+int
+vax_frame_num_args (struct frame_info *fi)
+{
+ return (0xff & read_memory_integer (FRAME_ARGS_ADDRESS (fi), 1));
+}
/* Advance PC across any function entry prologue instructions
to reach some "real" code. */
@@ -156,16 +207,6 @@ vax_skip_prologue (CORE_ADDR pc)
return pc;
}
-/* Return number of args passed to a frame.
- Can return -1, meaning no way to tell. */
-
-int
-vax_frame_num_args (struct frame_info *fi)
-{
- return (0xff & read_memory_integer (FRAME_ARGS_ADDRESS (fi), 1));
-}
-
-
/* Print the vax instruction at address MEMADDR in debugged memory,
from disassembler info INFO.