This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

new gdb arch routine FRAME_UNCHANGED


The patch below defines a new gdbarch routine called FRAME_UNCHANGED.
This is needed for gdb/ia64 because the ia64 architecture has two
separate stack pointers (one for memory stack and one for register stack).
Because of the two stacks, it's not possible to look just at the frame
pointer and PC to determine whether a frame changed.

If the patch looks OK, I'd appreciate if someone could apply it.

Note: the patch below doesn't include the ia64 version of
FRAME_UNCHANGED.  It is part of a larger update to add unwind library
support to gdb/ia64 and I'll submit that separately.  So, for now, the
patch is effectively a no-op for all platforms.

Also, it will be necessary to re-generate gdbarch.[ch] after applying
the patch.

Thanks,

	--david

ChangeLog

2002-05-08  David Mosberger-Tang  <David.Mosberger@acm.org>

	* gdbarch.sh (FRAME_UNCHANGED): New routine.

	* frame.h: Declare default_frame_unchanged() and
	generic_dummy_frame_chain().

	* blockframe.c (default_frame_unchanged): New function.
	(get_prev_frame): Use FRAME_UNCHANGED() to determine whether
	the new frame is different from the old one.

diff -u -r1.134 gdbarch.sh
--- gdbarch.sh	8 May 2002 20:43:04 -0000	1.134
+++ gdbarch.sh	9 May 2002 05:33:48 -0000
@@ -548,6 +548,7 @@
 f:2:BREAKPOINT_FROM_PC:const unsigned char *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr:::legacy_breakpoint_from_pc::0
 f:2:MEMORY_INSERT_BREAKPOINT:int:memory_insert_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_insert_breakpoint::0
 f:2:MEMORY_REMOVE_BREAKPOINT:int:memory_remove_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_remove_breakpoint::0
+f:2:FRAME_UNCHANGED:int:frame_unchanged:struct frame_info *prev, struct frame_info *next:prev, next::0:default_frame_unchanged::0
 v:2:DECR_PC_AFTER_BREAK:CORE_ADDR:decr_pc_after_break::::0:-1
 f::PREPARE_TO_PROCEED:int:prepare_to_proceed:int select_it:select_it::0:default_prepare_to_proceed::0
 v:2:FUNCTION_START_OFFSET:CORE_ADDR:function_start_offset::::0:-1
diff -u -r1.27 blockframe.c
--- blockframe.c	5 May 2002 01:15:12 -0000	1.27
+++ blockframe.c	9 May 2002 05:33:25 -0000
@@ -39,6 +39,16 @@
 
 void _initialize_blockframe (void);
 
+/* Default FRAME_UNCHANGED.  Returns true if the current and next
+   frame have the same frame address and the same PC.  This version
+   should work for most platforms.  One exception is ia64, since it
+   has separate memory and register stacks.  */
+int
+default_frame_unchanged (struct frame_info *prev, struct frame_info *next)
+{
+  return (prev->frame == next->frame && prev->pc == next->pc);
+}
+
 /* A default FRAME_CHAIN_VALID, in the form that is suitable for most
    targets.  If FRAME_CHAIN_VALID returns zero it means that the given
    frame is the outermost one and has no caller. */
@@ -447,8 +457,7 @@
      this can't be an architecture-independent check.  */
   if (next_frame != NULL)
     {
-      if (prev->frame == next_frame->frame
-	  && prev->pc == next_frame->pc)
+      if (FRAME_UNCHANGED (prev, next_frame))
 	{
 	  next_frame->prev = NULL;
 	  obstack_free (&frame_cache_obstack, prev);
diff -u -r1.17 frame.h
--- frame.h	5 May 2002 02:24:38 -0000	1.17
+++ frame.h	9 May 2002 05:33:38 -0000
@@ -160,6 +160,12 @@
 
 #define FRAME_FP(fi) ((fi)->frame)
 
+/* Define a default FRAME_UNCHANGED in the form that that is suitable
+   for most targets.  If FRAME_UNCHANGED returns zero it means that
+   the two frames are indistinguishable.  */
+
+extern int default_frame_unchanged (struct frame_info *, struct frame_info *);
+
 /* Level of the frame: 0 for innermost, 1 for its caller, ...; or -1
    for an invalid frame.  */
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]