Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] i386-tdep.c: Remove call to inside_entry_file
@ 2003-04-01 15:44 Corinna Vinschen
  2003-04-01 15:57 ` Andrew Cagney
  2003-04-06 16:38 ` Mark Kettenis
  0 siblings, 2 replies; 5+ messages in thread
From: Corinna Vinschen @ 2003-04-01 15:44 UTC (permalink / raw)
  To: gdb-patches

Hi,

as suggested by Andrew I'm sending this patch separately.  I've checked
the patch for i686-pc-linux and i686-pc-cygwin.  Linux is unaffected
(no change in testsuite results), Cygwin has additional PASSes in
asm-source.exp.

If the change is unacceptable for some reason, I'd add a new frame_chain
function to i386-cygwin-tdep.c.  I've added this as an alternative patch.

Corinna


2003-04-01  Corinna Vinschen  <vinschen@redhat.com>

	* i386-tdep.c (i386_frame_chain): Remove call to inside_entry_file().

Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.130
diff -u -p -r1.130 i386-tdep.c
--- i386-tdep.c	1 Apr 2003 14:38:49 -0000	1.130
+++ i386-tdep.c	1 Apr 2003 15:32:49 -0000
@@ -519,10 +519,7 @@ i386_frame_chain (struct frame_info *fra
       || i386_frameless_signal_p (frame))
     return get_frame_base (frame);
 
-  if (! inside_entry_file (get_frame_pc (frame)))
-    return read_memory_unsigned_integer (get_frame_base (frame), 4);
-
-  return 0;
+  return read_memory_unsigned_integer (get_frame_base (frame), 4);
 }
 
 /* Determine whether the function invocation represented by FRAME does


Alternative Cygwin patch:
=========================

2003-04-01  Corinna Vinschen  <vinschen@redhat.com>

        * i386-cygwin-tdep.c (i386_cygwin_frame_chain): New function.
	(i386_cygwin_init_abi): Set i386_cygwin_frame_chain as new
	frame_chain function.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.354
diff -u -p -r1.354 Makefile.in
--- Makefile.in	30 Mar 2003 14:52:41 -0000	1.354
+++ Makefile.in	1 Apr 2003 15:42:03 -0000
@@ -1791,7 +1791,7 @@ i386gnu-tdep.o: i386gnu-tdep.c $(defs_h)
 i386ly-tdep.o: i386ly-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \
 	$(regcache_h) $(target_h) $(i386_tdep_h) $(osabi_h)
 i386-cygwin-tdep.o: i386-cygwin-tdep.c $(defs_h) $(gdb_string_h) \
-	$(i386_tdep_h) $(osabi_h)
+	$(i386_tdep_h) $(osabi_h) $(gdbcore_h) $(frame_h) $(dummy_frame_h)
 i386nbsd-tdep.o: i386nbsd-tdep.c $(defs_h) $(gdbtypes_h) $(gdbcore_h) \
 	$(regcache_h) $(arch_utils_h) $(i386_tdep_h) $(i387_tdep_h) \
 	$(nbsd_tdep_h) $(solib_svr4_h) $(osabi_h)
Index: i386-cygwin-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-cygwin-tdep.c,v
retrieving revision 1.1
diff -u -p -r1.1 i386-cygwin-tdep.c
--- i386-cygwin-tdep.c	21 Mar 2003 10:07:17 -0000	1.1
+++ i386-cygwin-tdep.c	1 Apr 2003 15:42:03 -0000
@@ -20,8 +20,27 @@ Foundation, Inc., 59 Temple Place - Suit
 #include "defs.h"
 
 #include "gdb_string.h"
+#include "gdbcore.h"
 #include "i386-tdep.h"
 #include "osabi.h"
+#include "frame.h"
+#include "dummy-frame.h"
+
+/* Return the chain-pointer for FRAME.  In the case of the i386, the
+   frame's nominal address is the address of a 4-byte word containing
+   the calling frame's address.  */
+static CORE_ADDR
+i386_cygwin_frame_chain (struct frame_info *frame)
+{
+  if (pc_in_dummy_frame (get_frame_pc (frame)))
+    return get_frame_base (frame);
+
+  if (get_frame_type (frame) == SIGTRAMP_FRAME
+      || i386_frameless_signal_p (frame))
+    return get_frame_base (frame);
+
+  return read_memory_unsigned_integer (get_frame_base (frame), 4);
+}
 
 static void
 i386_cygwin_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -29,6 +48,7 @@ i386_cygwin_init_abi (struct gdbarch_inf
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   tdep->struct_return = reg_struct_return;
+  set_gdbarch_frame_chain (gdbarch, i386_cygwin_frame_chain);
 }
 
 static enum gdb_osabi

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] i386-tdep.c: Remove call to inside_entry_file
  2003-04-01 15:44 [RFA] i386-tdep.c: Remove call to inside_entry_file Corinna Vinschen
@ 2003-04-01 15:57 ` Andrew Cagney
  2003-04-01 16:21   ` Corinna Vinschen
  2003-04-06 16:38 ` Mark Kettenis
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2003-04-01 15:57 UTC (permalink / raw)
  To: gdb-patches


> +  set_gdbarch_frame_chain (gdbarch, i386_cygwin_frame_chain);

this doesn't build.

Andrew



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] i386-tdep.c: Remove call to inside_entry_file
  2003-04-01 15:57 ` Andrew Cagney
@ 2003-04-01 16:21   ` Corinna Vinschen
  0 siblings, 0 replies; 5+ messages in thread
From: Corinna Vinschen @ 2003-04-01 16:21 UTC (permalink / raw)
  To: gdb-patches

On Tue, Apr 01, 2003 at 10:57:13AM -0500, Andrew Cagney wrote:
> 
> >+  set_gdbarch_frame_chain (gdbarch, i386_cygwin_frame_chain);
> 
> this doesn't build.

Sic.  Corinna

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.354
diff -u -p -r1.354 Makefile.in
--- Makefile.in	30 Mar 2003 14:52:41 -0000	1.354
+++ Makefile.in	1 Apr 2003 16:21:16 -0000
@@ -1791,7 +1791,7 @@ i386gnu-tdep.o: i386gnu-tdep.c $(defs_h)
 i386ly-tdep.o: i386ly-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \
 	$(regcache_h) $(target_h) $(i386_tdep_h) $(osabi_h)
 i386-cygwin-tdep.o: i386-cygwin-tdep.c $(defs_h) $(gdb_string_h) \
-	$(i386_tdep_h) $(osabi_h)
+	$(i386_tdep_h) $(osabi_h) $(gdbcore_h) $(frame_h) $(dummy_frame_h)
 i386nbsd-tdep.o: i386nbsd-tdep.c $(defs_h) $(gdbtypes_h) $(gdbcore_h) \
 	$(regcache_h) $(arch_utils_h) $(i386_tdep_h) $(i387_tdep_h) \
 	$(nbsd_tdep_h) $(solib_svr4_h) $(osabi_h)
Index: i386-cygwin-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-cygwin-tdep.c,v
retrieving revision 1.1
diff -u -p -r1.1 i386-cygwin-tdep.c
--- i386-cygwin-tdep.c	21 Mar 2003 10:07:17 -0000	1.1
+++ i386-cygwin-tdep.c	1 Apr 2003 16:21:16 -0000
@@ -20,8 +20,27 @@ Foundation, Inc., 59 Temple Place - Suit
 #include "defs.h"
 
 #include "gdb_string.h"
+#include "gdbcore.h"
 #include "i386-tdep.h"
 #include "osabi.h"
+#include "frame.h"
+#include "dummy-frame.h"
+
+/* Return the chain-pointer for FRAME.  In the case of the i386, the
+   frame's nominal address is the address of a 4-byte word containing
+   the calling frame's address.  */
+static CORE_ADDR
+i386_cygwin_frame_chain (struct frame_info *frame)
+{
+  if (pc_in_dummy_frame (get_frame_pc (frame)))
+    return get_frame_base (frame);
+
+  if (get_frame_type (frame) == SIGTRAMP_FRAME
+      || i386_frameless_signal_p (frame))
+    return get_frame_base (frame);
+
+  return read_memory_unsigned_integer (get_frame_base (frame), 4);
+}
 
 static void
 i386_cygwin_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -29,6 +48,7 @@ i386_cygwin_init_abi (struct gdbarch_inf
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   tdep->struct_return = reg_struct_return;
+  set_gdbarch_deprecated_frame_chain (gdbarch, i386_cygwin_frame_chain);
 }
 
 static enum gdb_osabi

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] i386-tdep.c: Remove call to inside_entry_file
  2003-04-01 15:44 [RFA] i386-tdep.c: Remove call to inside_entry_file Corinna Vinschen
  2003-04-01 15:57 ` Andrew Cagney
@ 2003-04-06 16:38 ` Mark Kettenis
  2003-04-10 13:19   ` Corinna Vinschen
  1 sibling, 1 reply; 5+ messages in thread
From: Mark Kettenis @ 2003-04-06 16:38 UTC (permalink / raw)
  To: gdb-patches; +Cc: vinschen

Corinna Vinschen <vinschen@redhat.com> writes:

> Hi,
> 
> as suggested by Andrew I'm sending this patch separately.  I've checked
> the patch for i686-pc-linux and i686-pc-cygwin.  Linux is unaffected
> (no change in testsuite results), Cygwin has additional PASSes in
> asm-source.exp.
>
> If the change is unacceptable for some reason, I'd add a new frame_chain
> function to i386-cygwin-tdep.c.  I've added this as an alternative patch.

Hi Corinna,

I'm sorry, but yes, I think the change is not obviously right.  There
are i386 targets that do not correctly terminate the frame chain, that
is, they do not mark the deepest stack frame as such by setting %ebp
to zero.  The inside_entry_file() check is there to prevent GDB from
walking off the stack on such targets.

Therefore, I think it's best to apply your alternative patch.  Your
second version is herewith approved.

Mark


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] i386-tdep.c: Remove call to inside_entry_file
  2003-04-06 16:38 ` Mark Kettenis
@ 2003-04-10 13:19   ` Corinna Vinschen
  0 siblings, 0 replies; 5+ messages in thread
From: Corinna Vinschen @ 2003-04-10 13:19 UTC (permalink / raw)
  To: gdb-patches

On Sun, Apr 06, 2003 at 06:38:07PM +0200, Mark Kettenis wrote:
> Therefore, I think it's best to apply your alternative patch.  Your
> second version is herewith approved.

Thanks.  I've applied a changed version which additionally defines
a new frame_chain_valid function for Cygwin.  This exactly eliminates
all FAILs in gdb.asm/asm-source.exp.

Corinna


2003-04-10  Corinna Vinschen  <vinschen@redhat.com>

        * i386-cygwin-tdep.c (i386_cygwin_frame_chain): New function.
        (i386_cygwin_init_abi): Set i386_cygwin_frame_chain as new
        frame_chain function.
        * Makefile.in: Add dependencies due to above change.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.360
retrieving revision 1.361
diff -p -u -r1.360 -r1.361
--- Makefile.in	6 Apr 2003 01:13:58 -0000	1.360
+++ Makefile.in	10 Apr 2003 13:15:50 -0000	1.361
@@ -1798,7 +1798,7 @@ i386gnu-tdep.o: i386gnu-tdep.c $(defs_h)
 i386ly-tdep.o: i386ly-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \
 	$(regcache_h) $(target_h) $(i386_tdep_h) $(osabi_h)
 i386-cygwin-tdep.o: i386-cygwin-tdep.c $(defs_h) $(gdb_string_h) \
-	$(i386_tdep_h) $(osabi_h)
+	$(i386_tdep_h) $(osabi_h) $(gdbcore_h) $(frame_h) $(dummy_frame_h)
 i386nbsd-tdep.o: i386nbsd-tdep.c $(defs_h) $(gdbtypes_h) $(gdbcore_h) \
 	$(regcache_h) $(arch_utils_h) $(i386_tdep_h) $(i387_tdep_h) \
 	$(nbsd_tdep_h) $(solib_svr4_h) $(osabi_h)
Index: i386-cygwin-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-cygwin-tdep.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -p -u -r1.1 -r1.2
--- i386-cygwin-tdep.c	21 Mar 2003 10:07:17 -0000	1.1
+++ i386-cygwin-tdep.c	10 Apr 2003 13:15:50 -0000	1.2
@@ -20,8 +20,37 @@ Foundation, Inc., 59 Temple Place - Suit
 #include "defs.h"
 
 #include "gdb_string.h"
+#include "gdbcore.h"
 #include "i386-tdep.h"
 #include "osabi.h"
+#include "frame.h"
+#include "dummy-frame.h"
+
+static int
+i386_cygwin_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe)
+{
+  /* In the context where this is used, we get the saved PC before we've
+     successfully unwound far enough to be sure what we've got (it may
+     be a signal handler caller).  If we're dealing with a signal
+     handler caller, this will return valid, which is fine.  If not,
+     it'll make the correct test.  */
+  return ((get_frame_type (thisframe) == SIGTRAMP_FRAME) || chain != 0);
+}
+/* Return the chain-pointer for FRAME.  In the case of the i386, the
+   frame's nominal address is the address of a 4-byte word containing
+   the calling frame's address.  */
+static CORE_ADDR
+i386_cygwin_frame_chain (struct frame_info *frame)
+{
+  if (pc_in_dummy_frame (get_frame_pc (frame)))
+    return get_frame_base (frame);
+
+  if (get_frame_type (frame) == SIGTRAMP_FRAME
+      || i386_frameless_signal_p (frame))
+    return get_frame_base (frame);
+
+  return read_memory_unsigned_integer (get_frame_base (frame), 4);
+}
 
 static void
 i386_cygwin_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -29,6 +58,8 @@ i386_cygwin_init_abi (struct gdbarch_inf
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   tdep->struct_return = reg_struct_return;
+  set_gdbarch_deprecated_frame_chain (gdbarch, i386_cygwin_frame_chain);
+  set_gdbarch_deprecated_frame_chain_valid (gdbarch, i386_cygwin_frame_chain_valid);
 }
 
 static enum gdb_osabi


-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-04-10 13:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-01 15:44 [RFA] i386-tdep.c: Remove call to inside_entry_file Corinna Vinschen
2003-04-01 15:57 ` Andrew Cagney
2003-04-01 16:21   ` Corinna Vinschen
2003-04-06 16:38 ` Mark Kettenis
2003-04-10 13:19   ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox