diff options
| author | Andrew Gallatin <gallatin@FreeBSD.org> | 2002-02-18 14:13:59 +0000 |
|---|---|---|
| committer | Andrew Gallatin <gallatin@FreeBSD.org> | 2002-02-18 14:13:59 +0000 |
| commit | c48944beea730eac060b742eebe879533b4516a4 (patch) | |
| tree | b0849b36f50f219fcbcf3e264d603bbe98e53224 | |
| parent | aeda92b5f20d8205a2ccb8e632025e3c2f03ac85 (diff) | |
Notes
| -rw-r--r-- | gnu/usr.bin/binutils/gdb/alpha/kvm-fbsd.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gnu/usr.bin/binutils/gdb/alpha/kvm-fbsd.c b/gnu/usr.bin/binutils/gdb/alpha/kvm-fbsd.c index 55e4c83bcdfc..23a016eaa24b 100644 --- a/gnu/usr.bin/binutils/gdb/alpha/kvm-fbsd.c +++ b/gnu/usr.bin/binutils/gdb/alpha/kvm-fbsd.c @@ -378,7 +378,7 @@ static void set_proc_cmd(arg) char *arg; { - CORE_ADDR addr; + CORE_ADDR addr, first_td; void *val; if (!arg) @@ -389,11 +389,17 @@ set_proc_cmd(arg) addr = (CORE_ADDR)parse_and_eval_address(arg); - /* Read the PCB address in proc structure. */ - addr += (int) &((struct proc *)0)->p_thread.td_pcb; + /* Find the first thread in the process XXXKSE */ + addr += offsetof(struct proc, p_threads.tqh_first); + if (kvread(addr, &first_td)) + error("cannot read thread ptr"); + + /* Read the PCB address in thread structure. */ + addr = first_td + offsetof(struct thread, td_pcb); if (kvread(addr, &val)) error("cannot read pcb ptr"); + /* Read the PCB address in proc structure. */ if (set_context((CORE_ADDR)val)) error("invalid proc address"); } |
