cvs commit: src/gnu/usr.bin/gdb/kgdb kgdb.h kld.c kthr.c main.c
trgt.c trgt_amd64.c trgt_arm.c trgt_i386.c trgt_ia64.c
trgt_powerpc.c trgt_sparc64.c
John Baldwin
jhb at FreeBSD.org
Tue Apr 29 20:32:46 UTC 2008
jhb 2008-04-29 20:32:46 UTC
FreeBSD src repository
Modified files:
gnu/usr.bin/gdb/kgdb kgdb.h kld.c kthr.c main.c trgt.c
trgt_amd64.c trgt_arm.c trgt_i386.c
trgt_ia64.c trgt_powerpc.c trgt_sparc64.c
Log:
Rework how kgdb manages kernel and vmcore files to be a bit more gdb-ish
so that kgdb can be used more like a normal gdb:
- Load the kernel via the standard 'exec' target and allow it to be changed
via the 'file' command.
- Instead of explicitly loading the kernel file as the mail symbol file
during startup, just pass it to gdb_main() as the executable file.
- Change the kld support (via shared libraries) to cache the address of
the linker_files and linker_kernel_file variables in addition to the
offsets of various members in 'struct linker_file'.
- When a new symbol file is loaded, recompute the addresses and offsets
used by the kld support code.
- When a new symbol file is loaded, recalculate the ofs_fix variable to
account for the different ways a trapframe can be passed to trap
frame handlers in i386. This is done by adding a MD
kgdb_trgt_new_objfile() hook that is empty on all but i386.
- Don't use the directory name of the kernel specified on the command
line to find kernel modules in the kld support code. Instead,
extract the filename of the current executable via exec_bfd. Now
the 'kernel' variable is private to main.c again.
- Make the 'add-kld' command explicitly fail if no executable is loaded.
- Make the support for vmcores a real core-dump target that opens the
kernel and vmcore on open and closes the kvm connection when closed, etc.
- The 'core' command can now be used to select a vmcore to use, either
a crash dump file or /dev/mem for live debugging.
- The 'detach' command can be used to detach from a vmcore w/o attaching
to a new one.
- kgdb no longer explicitly opens a core dump during startup and no longer
has to use an atexit() hook to close the kvm connection on shutdown.
- Symbols for kld's are automatically loaded anytime a core is opened.
Also, the unread portion of dmesg is dumped just as it was done on kgdb
startup previously.
- Don't require either a remote target or core dump if a kernel is specified.
You can now just run 'kgdb kernel' similar to running gdb on an executable
and later connect to a remote target or core dump.
- Use a more relaxed way to verify remote targets specified via -r.
Instead of explicitly allowing a few non-file target specifications,
just assume that if stat() on the arg and on "/dev/" + arg both fail
that is some non-file target and pass it to gdb.
- Don't use a custom interpreter. The existing kgdb_init() hook and the
target_new_objfile() hook give us sufficient hooks during startup to
setup kgdb-specific behavior now.
- Always add the 'proc', 'tid', and 'add-kld' commands on startup and not
just if we have a core dump. Currently the 'proc' and 'tid' commands do
not work for remote targets (I will fix at least 'tid' in the next round
of changes though). However, the 'add-kld' command works fine for
loading symbols for a kernel module on a remote target.
- Always setup the 'kld' shared library target operations instead of just
if we have a core dump. Although symbols for kernel modules are not
automatically loaded when connecting to a remote target, you can do
'info sharedlibrary' after connecting to the remote target and kgdb will
find all the modules. You can then use the 'sharedlibrary' command to
load symbols from the module files.
- Change kthr_init() to free the existing list of kthr objects before
generating a new one. This allows it to be invoked multiple times
w/o leaking memory.
MFC after: 1 week
Revision Changes Path
1.13 +10 -6 src/gnu/usr.bin/gdb/kgdb/kgdb.h
1.9 +52 -23 src/gnu/usr.bin/gdb/kgdb/kld.c
1.11 +6 -0 src/gnu/usr.bin/gdb/kgdb/kthr.c
1.16 +86 -119 src/gnu/usr.bin/gdb/kgdb/main.c
1.11 +139 -22 src/gnu/usr.bin/gdb/kgdb/trgt.c
1.9 +5 -0 src/gnu/usr.bin/gdb/kgdb/trgt_amd64.c
1.4 +5 -0 src/gnu/usr.bin/gdb/kgdb/trgt_arm.c
1.10 +20 -14 src/gnu/usr.bin/gdb/kgdb/trgt_i386.c
1.5 +5 -0 src/gnu/usr.bin/gdb/kgdb/trgt_ia64.c
1.3 +5 -0 src/gnu/usr.bin/gdb/kgdb/trgt_powerpc.c
1.7 +5 -0 src/gnu/usr.bin/gdb/kgdb/trgt_sparc64.c
More information about the cvs-src
mailing list