diff options
| author | yamt <yamt@NetBSD.org> | 2007-05-25 15:14:21 +0000 |
|---|---|---|
| committer | yamt <yamt@NetBSD.org> | 2007-05-25 15:14:21 +0000 |
| commit | 68f37fd0aa88eab4e9550a4f76bbd6069d900e65 (patch) | |
| tree | 70289034f643a5787573a4581f293f26f2c965af /gnu | |
| parent | 8e69ce0726eacc9d39d7fc4519b23892a5440443 (diff) | |
amd64nbsd_supply_pcb: as dumpsys() was changed to prepare switchframe,
always use switchframe. fixes a build problem after yamt-idlelwp.
update some comments. reviewed by Frank van der Linden.
Diffstat (limited to 'gnu')
| -rw-r--r-- | gnu/dist/gdb6/gdb/amd64nbsd-nat.c | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/gnu/dist/gdb6/gdb/amd64nbsd-nat.c b/gnu/dist/gdb6/gdb/amd64nbsd-nat.c index 0cc780d700f..bd1dc4ee761 100644 --- a/gnu/dist/gdb6/gdb/amd64nbsd-nat.c +++ b/gnu/dist/gdb6/gdb/amd64nbsd-nat.c @@ -70,7 +70,7 @@ amd64nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) /* The following is true for NetBSD/amd64: The pcb contains the stack pointer at the point of the context - switch in cpu_switch(). At that point we have a stack frame as + switch in cpu_switchto(). At that point we have a stack frame as described by `struct switchframe', which for NetBSD/amd64 has the following layout: @@ -79,18 +79,15 @@ amd64nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) %r14 %r13 %r12 - %rbp %rbx return address Together with %rsp in the pcb, this accounts for all callee-saved registers specified by the psABI. From this information we reconstruct the register state as it would look when we just - returned from cpu_switch(). + returned from cpu_switchto(). - For kernel core dumps the pcb is saved by savectx(). In that case - the stack frame only contains the return address, and there is no way - to recover the other registers. */ + For kernel core dumps, dumpsys() builds a fake switchframe for us. */ /* The stack pointer shouldn't be zero. */ if (pcb->pcb_rsp == 0) @@ -98,23 +95,13 @@ amd64nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) /* Read the stack frame, and check its validity. */ read_memory (pcb->pcb_rsp, (gdb_byte *) &sf, sizeof sf); - if (sf.sf_rbp == pcb->pcb_rbp) - { - /* Yes, we have a frame that matches cpu_switch(). */ - pcb->pcb_rsp += sizeof (struct switchframe); - regcache_raw_supply (regcache, 12, &sf.sf_r12); - regcache_raw_supply (regcache, 13, &sf.sf_r13); - regcache_raw_supply (regcache, 14, &sf.sf_r14); - regcache_raw_supply (regcache, 15, &sf.sf_r15); - regcache_raw_supply (regcache, AMD64_RBX_REGNUM, &sf.sf_rbx); - regcache_raw_supply (regcache, AMD64_RIP_REGNUM, &sf.sf_rip); - } - else - { - /* No, the pcb must have been last updated by savectx(). */ - pcb->pcb_rsp += 8; - regcache_raw_supply (regcache, AMD64_RIP_REGNUM, &sf); - } + pcb->pcb_rsp += sizeof (struct switchframe); + regcache_raw_supply (regcache, 12, &sf.sf_r12); + regcache_raw_supply (regcache, 13, &sf.sf_r13); + regcache_raw_supply (regcache, 14, &sf.sf_r14); + regcache_raw_supply (regcache, 15, &sf.sf_r15); + regcache_raw_supply (regcache, AMD64_RBX_REGNUM, &sf.sf_rbx); + regcache_raw_supply (regcache, AMD64_RIP_REGNUM, &sf.sf_rip); regcache_raw_supply (regcache, AMD64_RSP_REGNUM, &pcb->pcb_rsp); regcache_raw_supply (regcache, AMD64_RBP_REGNUM, &pcb->pcb_rbp); |
