Commit Graph

46 Commits

Author SHA1 Message Date
John Baldwin
4ba3dab395 NMIs now come from 'nmi_calltrap' rather than 'calltrap', so teach 'kgdb'
to treat the frame under 'nmi_calltrap' as a trapframe.

MFC after:	3 days
Approved by:	re (bmah)
2007-08-22 20:28:13 +00:00
Alexander Kabaev
44f3233714 Remove extern int verbose declaration. It is declared static in the
only file it is used in.
2007-05-19 03:23:43 +00:00
Konstantin Belousov
0a592d0535 Unbreak the kgdb stepping over the special frames on i386 after rev. 1.117 of
i386/i386/exception.s.

No objections from:	marcel
2007-03-01 13:56:08 +00:00
Konstantin Belousov
d7eb5fb599 Rename lookup() to kgdb_lookup() and make it global (for use in trgt_i386.c).
No objections from:	marcel
2007-03-01 13:55:15 +00:00
Craig Rodrigues
c4b1628e07 Try to avoid a possible infinite loop when parsing an invalid kernel dump file.
PR:		108229
Submitted by:	Jessica Han <jessicah juniper net>
Reviewed by:	marcel
MFC after:	1 week
2007-01-25 06:39:25 +00:00
Ruslan Ermilov
afa56e7db8 Bump document date for the previous change. 2006-10-21 17:39:35 +00:00
John Baldwin
a5146161ae Trim trailing whitespace. 2006-10-16 20:07:23 +00:00
John Baldwin
62f6176c27 Restore the 'proc' and 'tid' commands which allow one to switch to the
first thread in a process or to a specific thread via PIDs and TIDs,
respectively.

Submitted by:	kan
Approved by:	marcel
2006-10-16 20:06:32 +00:00
David E. O'Brien
1d60a995b9 Document '-w' from main.c rev. 1.11. 2006-10-11 14:42:43 +00:00
Warner Losh
280075717e Add cross debug support to arm.
Submitted by: cognet@
2006-09-14 07:51:52 +00:00
John Baldwin
63ed2c123d Use the pcb in stoppcbs[] if it is present for threads that were running
on other CPUs in system when a dump is written.

Submitted by:	ups
Reviewed by:	marcel
MFC after:	3 days
2006-08-25 16:20:17 +00:00
Marcel Moolenaar
8788b6eb7a Add initial support for kgdb(1) on PowerPC. 2006-08-24 21:53:49 +00:00
John Baldwin
c198287ff3 Remove special handling for PC == 0. With this, kgdb can now properly
unwind across a page fault due to a null function pointer.  It does a
better job than ddb now in fact.

Reviewed by:	marcel
MFC after:	3 days
2006-08-23 19:16:17 +00:00
Ruslan Ermilov
9d26d008ac Remove alpha-specific stuff.
Approved by:	marcel
2006-08-23 12:14:26 +00:00
David E. O'Brien
ff0c6b70eb Add initial platform support.
Submitted by:	cognet
2006-07-22 15:27:18 +00:00
Alexander Kabaev
daefc6601d Add -w parameter which tells kgdb to open kmem-based targets in read-write
mode. This allows one to use kgdb on /dev/mem and be able to patch memory
on a live system. This is identical to what -wcore used to do in previous
gdb versions for FreeBSD.

Requested by:	wpaul
2006-01-04 23:17:52 +00:00
Marcel Moolenaar
6631d1e9cd Fix dump of the unread portion of the kernel message buffer.
PR: bin/87964
Submitted by: Frank Mayhar	frank at exit dot com
2005-10-26 02:22:28 +00:00
Peter Wemm
de143d260c Unbreak - remove leftover reference to pcb_rflags. 2005-09-28 07:40:27 +00:00
Marcel Moolenaar
dc78598a0f Claim frames corresponding to tl(0|1)_intr and tl0_trap as well. I
think that's the lot, but it's hard to understand the exception code
by mere glancing at it.

MFC after: 1 week
2005-09-11 06:52:14 +00:00
Marcel Moolenaar
78af1d5d26 Unwind across intrframes as well. While here, better handle bottom of
stack by claiming the frame when the IP is 0. It's a bit of a kluge,
but avoids screens full of bogus frames.

MFC after: 1 week
2005-09-11 05:55:24 +00:00
Marcel Moolenaar
af08e55700 Unwind across intrframes as well.
MFC after: 1 week
2005-09-11 05:36:30 +00:00
Marcel Moolenaar
4784fd9ce2 Unwind across trap frames. Handles all entry points, except the EPC
syscall. This is an entry from userland anyway.

MFC after: 1 week
2005-09-11 00:47:03 +00:00
Marcel Moolenaar
2a5bd389cf Unwind across trapframes. All kernel entries are handled.
MFC after: 1 week
2005-09-10 23:11:54 +00:00
Marcel Moolenaar
35f38699dc Unwind across trap frames. This adds most of the meat. The sniffer
just needs to be taught about all the other entry points and the
unwinder needs to be taught about the frame variation between them.

MFC after: 1 week
2005-09-10 22:03:09 +00:00
Marcel Moolenaar
a8f01390e1 Unwind across trap frames. This adds most of the meat. The sniffer
just needs to be taught about all the other entry points and the
unwinder needs to be taught about the frame variation between them.

MFC after: 1 week
2005-09-10 21:01:36 +00:00
Marcel Moolenaar
6ab0894870 Unwind across trap frames. This adds most of the meat. The sniffer
just needs to be taught about all the other entry points and the
unwinder needs to be taught about the frame variation between them.

MFC after: 1 week
2005-09-10 20:12:52 +00:00
Marcel Moolenaar
c67d07416a Add a kluge to allow kgdb(1) to inject its own frame sniffer in the
list of frame sniffers so that trapframes can be detected. The kluge
is needed because this version of gdb only supports appending a
sniffer to the list of sniffers and the moment kgdb gets a chance to
add its own frame sniffer, the target's default frame sniffer is
already in the list. Since the default frame sniffer claims any
frame thrown at it, kgdb's frame sniffer never gets to smell (a
process much akin to tasting, but with lesser chance of hurling :-)

This commit adds dummy frame sniffers that never claim a frame and
as such don't fix anything yet. However, we now have frame sniffers
and they are being called, so it's just a matter of adding meat to
the bones and we'll be able to properly unwind across trapframes.

MFC after: 1 week
2005-09-10 18:25:53 +00:00
Marcel Moolenaar
3b347f6ccc Fix backtraces. Supply registers from the register window.
MFC after: 3 days
2005-08-16 05:13:57 +00:00
Marcel Moolenaar
688deacdfa o Remove the obscure tid command, because it does what the thread
command does, but worse.
o  Remove the obscure proc command, because it does what the thread
   command does, but not unambigously.
o  Move the PID to the extra thread info, where it makes sense and
   where it doesn't confuse users. The extra thread info holds some
   process information, to which the PID belongs.
o  Implement the to_find_new_threads target method by having it call
   the target beneath us if we're not using KVM. This makes sure that
   new threads are found when using the remote target.

o  Fix various core dump scenarios:
   -  Implement the to_files_info target method. Previously the
      'info target' command would cause a NULL pointer dereference.
   -  Don't assume there's a current thread. We're not initialized
      in all cases. This prevents a NULL pointer dereference.
   -  When we're not ussing KVM, have the to_xfer_memory target
      method call the target beneath us. This avoids calling into
      KVM with a NULL pointer.

MFC after: 1 week
2005-08-06 19:22:27 +00:00
Marcel Moolenaar
9ca14a4113 o As mentioned in the previous commit: make the KVM error buffer
static.
o  Register a function with atexit(3) to close the KVM object if
   we have one open.
o  Show the unread portion of the kernel's message buffer before
   presenting the prompt. It's bound to provide some useful info.
o  Don't call kgdb_target() twice. It results in having all threads
   listed twice.

MFC after: 1 week
2005-08-06 19:07:07 +00:00
Giorgos Keramidas
75eb780790 Spell "currently" correctly. 2005-07-28 15:59:52 +00:00
Peter Wemm
8015e78d5d kvm_openfiles() uses the supplied buffer for storing error messages
in future calls, so we can't free it here.  The right place to free the
buffer would be to be after kvm_close(), but we don't do that yet.  A
static buffer would work too.

Reviewed by:  marcel (who has other plans for this anyway)
Approved by:  re
2005-06-24 00:50:12 +00:00
Marcel Moolenaar
7c6ae50b9d Implement and document the -q and -f options with their corresponding
long form (-quiet and -fullname resp.) Bump documentation date.

PR: bin/78031
MFC after: 5 days
2005-03-02 18:40:04 +00:00
David E. O'Brien
39e38e7623 .It the -v option. 2005-03-01 20:41:38 +00:00
Alexander Kabaev
d723452067 Restore r1.2 change to use TARGET_ARCH.
Submitted by:	kris
2005-02-20 23:06:03 +00:00
Alexander Kabaev
325ce5d8fb Attempt to make kgdb little more useful and easy to use. Properly initialize
it to recognise what ABI  to use on amd64 (and possibly others) platform.
Display PID and process name as a part of the 'info threads' output, TIDs
alone are too confusing. Introduce new commmands 'tid <tid>' and 'proc <pid>'
to accompany gdb's default 'thread <thread num>' to make the task of switching
between different contexts easier.
2005-02-20 22:55:07 +00:00
David E. O'Brien
01950bb64f Use the system gnuregex library vs. building GNU regex bits into libiberty
and using them.

Reviewed by:	marcel,imp
Desired by:	ache
2005-02-14 12:10:14 +00:00
Ruslan Ermilov
42b28e8149 Markup nits. 2005-01-13 10:07:51 +00:00
Marcel Moolenaar
20a9661305 Makefile (only) changes to allow building a cross debugger. 2004-11-30 05:12:37 +00:00
Marcel Moolenaar
88bca61ea5 s/MACHINE_ARCH/TARGET_ARCH/. We use TARGET_ARCH to pick the MD files
for libgdb and should do so here as well.
2004-11-30 02:56:53 +00:00
Joerg Wunsch
466bc517d1 [Sorry, forgot to commit my source changes in my previous commit.]
Document all options and general usage.

Implement the -a option to bump the annotation_level.  This improves
the Emacs gud behaviour.  You can now supply the following function

(defun gud-gdb-massage-args (file args) (cons "-a" args))

(e.g. by evaluating it from the *scratch* buffer) and get the normal
jump to the source window when browsing the stack.

We should probably eventually supply our own kgdb submode to gud.el.
2004-11-22 16:08:19 +00:00
Joerg Wunsch
fa632bb17f Document all options and general usage.
Implement the -a option to bump the annotation_level.  This improves
the Emacs gud behaviour.  You can now supply the following function

(defun gud-gdb-massage-args (file args) (cons "-a" args))

(e.g. by evaluating it from the *scratch* buffer) and get the normal
jump to the source window when browsing the stack.

We should probably eventually supply our own kgdb submode to gud.el.
2004-11-22 16:07:28 +00:00
Joerg Wunsch
05127e036e Fix the abuse of Ar macros for designating flag options, use Fl instead. 2004-11-22 15:43:46 +00:00
Brooks Davis
f52501ba8c If the argument to the -r flag starts with a ':' or a '|', don't try to
make sure it is a device.  GDB special cases these prefixes and treats
:#### as a tcp port on localhost and executes what ever follows '|'.

This allows kgdb to debug via dconschat.

Discussed with:	marcel
2004-09-03 07:11:42 +00:00
Marcel Moolenaar
7a5bf37951 Improve the usage. Without any arguments, kgdb(1) works on /dev/mem
with the currently running kernel image. Otherwise, one of -c, -n or
-r is expected for working on a particular core file (-c), working
on a saved dump (-n) or working remotely (-r). When working on a
saved dump, a kernel may be omitted.
For a remote debugging session (-r), kgdb(1) will use the specified
device.
2004-08-15 02:39:20 +00:00
Marcel Moolenaar
60b992ff2f Add the beginnings of kernel debugging support. the kgdb(1) tool
is basicly a shell on top of libgdb that knows about kernel threads,
kernel modules and kvm(3). As the word "beginnings" implies, not
all of the features have been implemented yet. The tool is useful
and I'd like feedback on the taken route.

The simplest way to debug a kernel core file is:
	kgdb -n 0

This opens /var/crash/vmcore.0 with the corresponding kernel in
the object directory (kernel.debug is used if it exists).

Typical things that need to be added are:
o  Auto loading of kernel modules,
o  Handling of trapframes so that backtraces can be taken across
   them,
o  Some fancy commands to extract useful information out of a core
   file,
o  Various (probably many) other things.
2004-07-25 05:29:15 +00:00