Don't try to dereference a kernel pointer in userland; use offsetof()

to get the right address.

This fixes kernel GDB after KSE2.

Reviewed by:	jhb, jake
This commit is contained in:
Bill Fenner 2001-09-19 18:42:19 +00:00
parent 2622bf6fe4
commit 9c52cf5785
2 changed files with 2 additions and 2 deletions

View File

@ -206,7 +206,7 @@ curProc ()
if (kvread (addr, &td))
error ("cannot read thread pointer at %x\n", addr);
addr = (CORE_ADDR)td->td_proc;
addr = (CORE_ADDR)td + offsetof(struct thread, td_proc);
if (kvread (addr, &p))
error ("cannot read proc pointer at %x\n", addr);
return p;

View File

@ -206,7 +206,7 @@ curProc ()
if (kvread (addr, &td))
error ("cannot read thread pointer at %x\n", addr);
addr = (CORE_ADDR)td->td_proc;
addr = (CORE_ADDR)td + offsetof(struct thread, td_proc);
if (kvread (addr, &p))
error ("cannot read proc pointer at %x\n", addr);
return p;