diff --git a/gnu/dist/gdb6/gdb/i386nbsd-nat.c b/gnu/dist/gdb6/gdb/i386nbsd-nat.c index c7f40dad2a54..f89f82df1440 100644 --- a/gnu/dist/gdb6/gdb/i386nbsd-nat.c +++ b/gnu/dist/gdb6/gdb/i386nbsd-nat.c @@ -44,22 +44,22 @@ i386nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) /* The following is true for NetBSD 1.6.2 and after: The pcb contains %esp and %ebp at the point of the context switch - in cpu_switch(). At that point we have a stack frame as - described by `struct switchframe', which for NetBSD has the - following layout: + in cpu_switch()/cpu_switchto(). At that point we have a stack frame as + described by `struct switchframe', which for NetBSD (2.0 and later) has + the following layout: - interrupt level %edi %esi %ebx return address we reconstruct the register state as it would look when we just - returned from cpu_switch(). + returned from cpu_switch()/cpu_switchto(). - For core dumps the pcb is saved by savectx() and contains the - stack pointer and frame pointer. In this case extract a return - address from the stack. */ + For core dumps the pcb is saved by savectx()/dumpsys() and contains the + stack pointer and frame pointer. A new dumpsys() fakes a switchframe + whereas older code isn't reliable so use an iffy heuristic to detect this + and use the frame pointer to recover enough state. */ /* The stack pointer shouldn't be zero. */ if (pcb->pcb_esp == 0) @@ -69,7 +69,8 @@ i386nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) if ( (unsigned long)sf.sf_eip >= (unsigned long)0xc0100000 ) { - /* Yes, we have a frame that matches cpu_switch(). */ + /* Yes, we have a switchframe that matches cpu_switchto() or + the new dumpsys(). */ pcb->pcb_esp += sizeof (struct switchframe); regcache_raw_supply (regcache, I386_EDI_REGNUM, &sf.sf_edi); @@ -83,8 +84,8 @@ i386nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) { CORE_ADDR pc, fp; - /* No, the pcb must have been last updated by savectx() in - dumpsys. Use the frame pointer to recover enough state. */ + /* No, the pcb must have been last updated by savectx() in old + dumpsys(). Use the frame pointer to recover enough state. */ read_memory (pcb->pcb_ebp, (gdb_byte *) &fp, sizeof(fp)); read_memory (pcb->pcb_ebp + 4, (gdb_byte *) &pc, sizeof(pc));