
PDB 0.3.3
http://www.cl.cam.ac.uk/netos/pdb

Alex Ho  
August 2005


This is the latest incarnation of the pervasive debugger.
PDB is a remote stub for GDB.  Running as a user-space
application in domain 0, it can debug any other domain.


+------+    tcp/ip    +-------+  
| GDB  |--------------|  PDB  |
+------+              +-------+   +-------+
                      | Dom 0 |   | Dom U |
                      +-------+---+-------+
                      |  Xen              |
                      +-------------------+

Installation

- Install OCaml 3.08 in domain 0.
  http://caml.inria.fr/download.en.html  is a good place to start.

- Build Xen with debugger support
  make domu_debug=y xen

- (optional)
  Build the target domains with debugging symbols.
  make CONFIG_DEBUG_INFO=true CONFIG_FRAME_POINTER=false linux-2.6-xenU-build

  You can also change linux-2.6.12-xenU/Makefile
  CONFIG_CC_OPTIMIZE_FOR_SIZE from -O2 to -O

- Build PDB
  (cd tools/debugger/libxendebug; make install)
  (cd tools/debugger/pdb; make)

Usage

- PDB does not currently support SMP.  Please boot xen with "maxcpus=1"

- Run PDB
  domain-0.xeno# ./pdb <port>

- Run GDB
  hostname% gdb <xeno.bk>/dist/install/boot/vmlinux-syms-2.6.12-xenU

  (gdb) target remote domain-0.xeno:<port>

  At this point, you'll get an error message such as:
  Remote debugging using domain-0.xeno:5000
  0x00000000 in ?? ()
  warning: shared library handler failed to enable breakpoint
  Although GDB is connected to PDB, PDB doesn't know which domain
  you'd like to debug, so it's just feeding GDB a bunch of zeros.

  (gdb) maint packet x context = domain <domid> <vcpu>

  This tells PDB that we'd like to debug a particular domain & vcpu.
  However, since we're sending the command directly to PDB, GDB doesn't 
  know that we now have a proper target.  We can force GDB to invalidate
  its register cache.  This is optional; the next time the program
  stops GDB will query for the registers automatically.

  (gdb) flushreg

  
  the following gdb commands should work :)

  break
  step,   stepi
  next,   nexti
  continue
  print

Process

  PDB can also debug a process running in a Linux 2.6 domain. 
  You will need to patch the Linux 2.6 domain U tree to export some
  additional symbols for the pdb module

  % make -C linux-2.6-patches

  After running PDB in domain 0, insert the pdb module in dom u:
  
  % insmod linux-2.6-module/pdb.ko

  Load GDB with the appropriate symbols, and attach with

  (gdb) maint packet x context = process <domid> <pid>

  Read, write, and access watchpoint should also work for processes, 
  use the "rwatch", "watch" and "awatch" gdb commands respectively.

  If you are having trouble with GDB 5.3 (i386-redhat-linux-gnu),
  try GDB 6.3 (configured with --target=i386-linux-gnu).

  
To Do

- watchpoints for domains
- support for SMP
