Index: gnu/usr.bin/binutils/gdb/Makefile =================================================================== RCS file: /home/ncvs/src/gnu/usr.bin/binutils/gdb/Makefile,v retrieving revision 1.65 diff -u -r1.65 Makefile --- gnu/usr.bin/binutils/gdb/Makefile 21 Mar 2003 00:30:53 -0000 1.65 +++ gnu/usr.bin/binutils/gdb/Makefile 18 May 2003 22:37:15 -0000 @@ -127,8 +127,10 @@ .PRECIOUS: init.c nm.h: - echo '#include "${GDB_CPU}/nm-fbsd.h"' >${.TARGET} + echo '#include "tm.h"' >${.TARGET} + echo '#include "${GDB_CPU}/nm-fbsd.h"' >>${.TARGET} echo '#include "fbsd-kgdb.h"' >>${.TARGET} + echo '#include "fbsd-kgdb-${TARGET_ARCH}.h"' >>${.TARGET} .for H in tm-fbsd xm-${GDB_CPU} ${H:C/-.*$//}.h: Index: gnu/usr.bin/binutils/gdb/fbsd-kgdb-alpha.h =================================================================== RCS file: /home/ncvs/src/gnu/usr.bin/binutils/gdb/fbsd-kgdb-alpha.h,v retrieving revision 1.1 diff -u -r1.1 fbsd-kgdb-alpha.h --- gnu/usr.bin/binutils/gdb/fbsd-kgdb-alpha.h 10 Jul 2002 06:40:03 -0000 1.1 +++ gnu/usr.bin/binutils/gdb/fbsd-kgdb-alpha.h 10 Aug 2003 12:35:45 -0000 @@ -7,5 +7,18 @@ #define FRAME_SAVED_PC(FRAME) \ (kernel_debugging ? fbsd_kern_frame_saved_pc(FRAME) : \ alpha_saved_pc_after_call(FRAME)) - +#undef FRAME_CHAIN +#define FRAME_CHAIN(FRAME) \ + (kernel_debugging ? fbsd_kern_frame_chain(FRAME) : \ + alpha_frame_chain(FRAME)) + +#undef INIT_EXTRA_FRAME_INFO +#define INIT_EXTRA_FRAME_INFO(fromleaf, fci) \ + (kernel_debugging ? fbsd_kern_init_extra_frame_info(fromleaf, fci) : \ + alpha_init_extra_frame_info(fromleaf, fci)) + +CORE_ADDR fbsd_kern_frame_saved_pc (struct frame_info *fi); +CORE_ADDR fbsd_kern_frame_chain (struct frame_info *fi); +void fbsd_kern_init_extra_frame_info (int fromlead, struct frame_info *fi); + #endif /* FBSD_KGDB_ALPHA_H */ Index: gnu/usr.bin/binutils/gdb/fbsd-kgdb-i386.h =================================================================== RCS file: /home/ncvs/src/gnu/usr.bin/binutils/gdb/fbsd-kgdb-i386.h,v retrieving revision 1.3 diff -u -r1.3 fbsd-kgdb-i386.h --- gnu/usr.bin/binutils/gdb/fbsd-kgdb-i386.h 18 Sep 2002 16:20:49 -0000 1.3 +++ gnu/usr.bin/binutils/gdb/fbsd-kgdb-i386.h 18 May 2003 22:37:15 -0000 @@ -20,10 +20,8 @@ #undef FRAME_SAVED_PC #define FRAME_SAVED_PC(FRAME) \ (kernel_debugging \ - ? fbsd_kern_frame_saved_pc (FRAME) : \ - (FRAME)->signal_handler_caller \ - ? sigtramp_saved_pc (FRAME) \ - : read_memory_integer ((FRAME)->frame + 4, 4)) + ? fbsd_kern_frame_saved_pc (FRAME) \ + : i386bsd_frame_saved_pc (FRAME)) /* Offset to saved PC in sigcontext, from . */ #define SIGCONTEXT_PC_OFFSET 20 Index: gnu/usr.bin/binutils/gdb/kvm-fbsd.c =================================================================== RCS file: /home/ncvs/src/gnu/usr.bin/binutils/gdb/kvm-fbsd.c,v retrieving revision 1.45 diff -u -r1.45 kvm-fbsd.c --- gnu/usr.bin/binutils/gdb/kvm-fbsd.c 21 Mar 2003 00:30:53 -0000 1.45 +++ gnu/usr.bin/binutils/gdb/kvm-fbsd.c 16 Oct 2003 20:14:18 -0000 @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -356,6 +357,22 @@ #define S0_REGNUM (T7_REGNUM+1) #endif +static int istrapsym (struct minimal_symbol *sym); + +static int +istrapsym (struct minimal_symbol *sym) +{ + const char *name; + + name = SYMBOL_NAME (sym); + + return (strcmp (name, "XentArith") == 0 || strcmp (name, "XentIF") == 0 || + strcmp (name, "XentInt") == 0 || strcmp (name, "XentMM") == 0 || + strcmp (name, "XentSys") == 0 || strcmp (name, "XentUna") == 0 || + strcmp (name, "XentRestart") == 0); +} + +void fetch_kcore_registers (struct pcb *pcbp) { @@ -377,25 +394,23 @@ registers_fetched (); } - CORE_ADDR fbsd_kern_frame_saved_pc (struct frame_info *fi) { struct minimal_symbol *sym; CORE_ADDR this_saved_pc; + int aftertrap, aftertrap2; + aftertrap = fi->next != NULL && fi->next->frame == fi->frame; + aftertrap2 = fi->next != NULL && fi->next->next != NULL && + fi->next->next->frame == fi->next->frame; this_saved_pc = alpha_frame_saved_pc (fi); + if (this_saved_pc == 0 && aftertrap2) { + this_saved_pc = read_memory_integer (fi->frame, 8); + } sym = lookup_minimal_symbol_by_pc (this_saved_pc); - - if (sym != NULL && - (strcmp (SYMBOL_NAME (sym), "XentArith") == 0 || - strcmp (SYMBOL_NAME (sym), "XentIF") == 0 || - strcmp (SYMBOL_NAME (sym), "XentInt") == 0 || - strcmp (SYMBOL_NAME (sym), "XentMM") == 0 || - strcmp (SYMBOL_NAME (sym), "XentSys") == 0 || - strcmp (SYMBOL_NAME (sym), "XentUna") == 0 || - strcmp (SYMBOL_NAME (sym), "XentRestart") == 0)) + if (aftertrap && sym != NULL && istrapsym (sym)) { return (read_memory_integer (fi->frame + 32 * 8, 8)); } @@ -405,6 +420,66 @@ } } +CORE_ADDR +fbsd_kern_frame_chain (struct frame_info *fi) +{ + struct minimal_symbol *sym; + CORE_ADDR this_saved_pc, newframe; + int aftertrap, i; + + aftertrap = fi->next != NULL && fi->next->frame == fi->frame; + this_saved_pc = alpha_frame_saved_pc (fi); + sym = lookup_minimal_symbol_by_pc (this_saved_pc); + + if (sym != NULL && istrapsym (sym)) + { + return fi->frame; + } + else if (aftertrap) + { + newframe = alpha_frame_chain (fi); + return (newframe + 37 * 8); + } + else + { + return (alpha_frame_chain(fi)); + } +} + +void +fbsd_kern_init_extra_frame_info (int fromleaf, struct frame_info *fi) +{ + struct minimal_symbol *sym; + CORE_ADDR prev_pc; + int i; + + alpha_init_extra_frame_info (fromleaf, fi); + if (fi->next == NULL) + return; + fi->frame = fbsd_kern_frame_chain (fi->next); + if (fi->saved_regs == NULL) + { + return; + } + + prev_pc = alpha_frame_saved_pc (fi->next); + sym = lookup_minimal_symbol_by_pc (prev_pc); + if (sym == NULL || !istrapsym (sym)) + { + if (fi->next->next == NULL || fi->next->frame != fi->next->next->frame) + return; + prev_pc = alpha_frame_saved_pc (fi->next->next); + sym = lookup_minimal_symbol_by_pc (prev_pc); + if (sym == NULL || !istrapsym (sym)) + return; + fi->saved_regs[RA_REGNUM] = fi->next->frame + 37 * 8; + return; + } + + for (i = 0; i < 32; i++) + fi->saved_regs[i] = fi->frame + 8 * i; + fi->saved_regs[RA_REGNUM] = fi->frame + 32 * 8; +} #endif /* __alpha__ */ #ifdef __i386__