* config/i386/tm-i386bsd.h (SIGTRAMP_START, SIGTRAMP_END, FRAME_CHAIN,
authorPeter Schauer <Peter.Schauer@mytum.de>
Tue, 17 Aug 1993 08:49:07 +0000 (08:49 +0000)
committerPeter Schauer <Peter.Schauer@mytum.de>
Tue, 17 Aug 1993 08:49:07 +0000 (08:49 +0000)
FRAMELESS_FUNCTION_INVOCATION, FRAME_SAVED_PC, SIGCONTEXT_PC_OFFSET):
Define to make backtracing through sigtramp work.
* config/vax/tm-vax.h (SIGTRAMP_START, SIGTRAMP_END, TARGET_UPAGES,
FRAME_SAVED_PC, SIGCONTEXT_PC_OFFSET):  Ditto.

gdb/config/i386/tm-i386bsd.h
gdb/config/vax/tm-vax.h

index 6f4dbd939ae27b416d78cfa04ca5706ae3dec862..f75fd93ae6e6a46cfcc478b27480cc2fdd28c12c 100644 (file)
@@ -27,3 +27,50 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 /* BSDI can't handle them either.  */
 #undef NUM_REGS
 #define NUM_REGS 10
+
+/* On 386 bsd, sigtramp is above the user stack and immediately below
+   the user area. Using constants here allows for cross debugging.
+   These are tested for BSDI but should work on 386BSD.  */
+#define SIGTRAMP_START 0xfdbfdfc0
+#define SIGTRAMP_END   0xfdbfe000
+
+/* The following redefines make backtracing through sigtramp work.
+   They manufacture a fake sigtramp frame and obtain the saved pc in sigtramp
+   from the sigcontext structure which is pushed by the kernel on the
+   user stack, along with a pointer to it.  */
+
+/* FRAME_CHAIN takes a frame's nominal address and produces the frame's
+   chain-pointer.
+   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.  */
+#undef FRAME_CHAIN
+#define FRAME_CHAIN(thisframe)  \
+  (thisframe->signal_handler_caller \
+   ? thisframe->frame \
+   : (!inside_entry_file ((thisframe)->pc) \
+      ? read_memory_integer ((thisframe)->frame, 4) \
+      : 0))
+
+/* A macro that tells us whether the function invocation represented
+   by FI does not have a frame on the stack associated with it.  If it
+   does not, FRAMELESS is set to 1, else 0.  */
+#undef FRAMELESS_FUNCTION_INVOCATION
+#define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \
+  do { \
+    if ((FI)->signal_handler_caller) \
+      (FRAMELESS) = 0; \
+    else \
+      (FRAMELESS) = frameless_look_for_prologue(FI); \
+  } while (0)
+
+/* Saved Pc.  Get it from sigcontext if within sigtramp.  */
+
+/* Offset to saved PC in sigcontext, from <sys/signal.h>.  */
+#define SIGCONTEXT_PC_OFFSET 20
+
+#undef FRAME_SAVED_PC(FRAME)
+#define FRAME_SAVED_PC(FRAME) \
+  (((FRAME)->signal_handler_caller \
+    ? sigtramp_saved_pc (FRAME) \
+    : read_memory_integer ((FRAME)->frame + 4, 4)) \
+   )
index 6fd245412ef3e30073b57ccf8bd4168eec637260..856b889a45ffcb822dbe7726b034a680bfbc79f9 100644 (file)
@@ -17,26 +17,6 @@ You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
-/* There is one known bug with VAX support that I don't know how to
-   fix:  if you do a backtrace from a signal handler, you get something
-   like:
-#0  0xbc in kill (592, 3)
-#1  0x7f in hand (...) (...)
-#2  0x7fffec7e in ?? (2, 0, 2147478112, 94)
-                  ^^ GDB doesn't know about sigtramp
-#3  0x7fffec70 in ?? (592, 2)
-    ^^^^^^^^^^ wrong address
-#4  0xae in main (...) (...)
-
-when the correct backtrace (as given by adb) is:
-_kill(250,3) from _hand+21
-_hand(2,0,7fffea60,5e) from 7fffec7e
-sigtramp(2,0,7fffea60,5e) from _kill+4
-_kill(250,2) from _main+2e
-_main(1,7fffeac4,7fffeacc) from start+3d
-
-If anyone knows enough about VAX BSD to fix this, please send the
-fix to bug-gdb@prep.ai.mit.edu.  */
 
 #define TARGET_BYTE_ORDER LITTLE_ENDIAN
 
@@ -76,14 +56,15 @@ fix to bug-gdb@prep.ai.mit.edu.  */
 
 #define SAVED_PC_AFTER_CALL(frame) FRAME_SAVED_PC(frame)
 
-#define TARGET_UPAGES 10
+#define TARGET_UPAGES 14
 #define TARGET_NBPG 512
 #define STACK_END_ADDR (0x80000000 - (TARGET_UPAGES * TARGET_NBPG))
 
 /* On the VAX, sigtramp is in the u area.  Can't check the exact
    addresses because for cross-debugging we don't have VAX include
    files around.  This should be close enough.  */
-#define IN_SIGTRAMP(pc, name) ((pc) >= STACK_END_ADDR && (pc < 0x80000000))
+#define SIGTRAMP_START STACK_END_ADDR
+#define SIGTRAMP_END   0x80000000
 
 /* Stack grows downward.  */
 
@@ -231,9 +212,16 @@ fix to bug-gdb@prep.ai.mit.edu.  */
 /* On the vax, all functions have frames.  */
 #define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS)  {(FRAMELESS) = 0;}
 
-/* Saved Pc.  */
+/* Saved Pc.  Get it from sigcontext if within sigtramp.  */
 
-#define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame + 16, 4))
+/* Offset to saved PC in sigcontext, from <sys/signal.h>.  */
+#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
This page took 0.027106 seconds and 4 git commands to generate.