Files
xen/tools/debugger/gdb
kaf24@firebug.cl.cam.ac.uk e265d47bd6 Consolidate xc_ptrace and xc_ptrace_core
* xc_ptrace
  - Merge xc_ptrace_core into xc_ptrace
  - ATTACH now reads the data argument. If non-zero then
    a corefile is being debuged. Otherwise a thread has
    been attached to. This allows xc_waitdomain_core() or
    xc_waitdomain() to be called as appropriate in
    subsequent xc_ptrace() calls.
* xc_waitdomain
  - Rename xc_waitdomain (xc_ptrace.c version) __xc_waitdomain
  - Rename xc_waitdomain (xc_ptrace_core.c version) xc_waitdomain_core
  - Create xc_waitdomain (in xc_ptrace.c), a wrapper for __xc_waitdomain
    and xc_waitdomain_core.
  Consolidation seemed difficult but ctxt needs to be
  passed into xc_waitdomain_core or made global.
  Alternatively, xc_waitdomain_core could be moved into xc_ptrace.c,
  but this seems messy.
* map_domain_va
  - Rename map_domain_va (xc_ptrace_core.c version) map_domain_va_core
  - Have it accept ctxt, like xc_waitdomain_core
* myptrace and myxcwait (linux-xen-low.c)
  Removed, call the now generic xc_ptrace() and xc_waitdomain() instead

When calling xc_ptrace ATTACH, if a corefile is in use, a fd will
be passed, otherwise a pid. The fd part is important, as this
is saved internally in xc_ptrace_core.c, and passed to xc_waitdomain_core()
as neccessary. Pereviously xc_waitdomain_core() received a pid and
thus could not open the corefile.

Signed-Off-By: Horms <horms@verge.net.au>
2006-03-06 12:06:55 +01:00
..

DomU GDB server for 32-bit (PAE and non-PAE) systems
----------------------------------------------------

Lines marked below with [*] are optional, if you want full
source-level debugging of your kernel image.

To build the GDB server:
 1. Run ./gdbbuild from within this directory.
 2. Copy ./gdb-6.2.1-linux-i386-xen/gdb/gdbserver/gdbserver-xen
    to your test machine.

To build a debuggable guest kernel image:
 1. cd linux-2.6.12-xenU
 2. ARCH=xen make menuconfig
 3. From within the configurator, enable the following options:
    # Kernel hacking -> Compile the kernel with debug info [*]
                     -> Compile the kernel with frame pointers
 4. (Re)build and (re)install your xenU kernel image.

To debug a running guest:
 1. Use 'xm list' to discover its domain id ($domid). 
 2. Run 'gdbserver-xen 127.0.0.1:9999 --attach $domid'.
 3. Run 'gdb /path/to/vmlinux-syms-2.6.xx-xenU'.
 4. From within the gdb client session:
    # directory /path/to/linux-2.6.xx-xenU [*]
    # target remote 127.0.0.1:9999
    # bt
    # disass

To debug a crashed guest:
 1. Add '(enable-dump yes)' to /etc/xen/xend-config.sxp before
    starting xend.
 2. When the domain crashes, a core file is written to
    '/var/xen/dump/<domain-name>.<domain-id>.core'.
 3. Run 'gdbserver-xen 127.0.0.1:9999 --file <core-file>'.
 4. Connect to the server as for a running guest.