kernel/kld debugging on amd64 (qemu gdbstub, gdbinit, asf(1)...)
jhb at freebsd.org
Thu May 1 14:36:15 UTC 2008
On Thursday 01 May 2008 06:51:38 am Juergen Lock wrote:
> Before I forget, here are some things I found out while debugging the
> kqemu amd64 SMP issue...
> 1. I used a patched kgdb to be able to use it with qemu's gdbstub
> (kgdb -r 127.1:1234 kernel.debug), that patch I already posted:
> (Yeah you can also used regular gdb or gdb66 from ports with qemu's
> gdbstub, but those don't understand kernel stack frames and maybe
> other things...)
This patch just went into the tree (a variant of it) in the commits to kgdb in
HEAD earlier this week.
> 2. the ps and kldstat macros from src/tools/debugscripts/gdbinit.kernel
> (and probably others) use %08x for pointers, so on 64 bit archs like amd64
> the upper half gets chopped off. I didn't fix this correctly tho, but
> instead defined my own ps64 and kldstat64 macros using %016lx...
Try using macros at www.freebsd.org/~jhb/gdb/gdb6 instead as they handle
64-bit vs 32-bit.
> 3. asf(1) also didn't work correctly for amd64 (bss and data were wrong),
> here is the patch I ended up using: (maybe you want to ifdef for amd64
> instead of checking for zero VMA tho)
I haven't seen this, but I also haven't used asf(8) on amd64. You can grab
the kgdb sources from HEAD though and then you can use kgdb's native kld
support (i.e. add-kld and the shared library stuff) for remote targets to
More information about the freebsd-amd64