[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [RFC PATCH 0/2]: hypervisor debugger

Hi Keir,

As promised sending two patches after this. First is the changes to
common code. Other is a tar file of kdb subdirectory under

It seems there is enough interested that it's worth considering for
merging into xen. Good thing is I've developed it as I debug things. So
it's developed completely from a developer's perspective who did not
have access to any other tools like jtag etc.. 

BTW, I'd like to rename it from kdb to xdb or hdb in the final

The diffs are against c/s 25467 btw. 


At present I've following commands:

info:  Print basic info like version, compile flags, etc..

cur:  print current domain id and vcpu id

f: display current stack. If a vcpu ptr is given, then print stack for
that VCPU by using its IP and SP.

fg: display stack for a guest given domid, SP and IP.

dw: display words of memory. 'num' of bytes is optional, but if
displaying guest memory, then is required.

dd: same as above, but display doublewords.

dwm: same as above but the address is machine address instead of

ddm: same as above, but display doublewords.

dr: display registers. if 'sp' is specified then print few extra

drg: display guest context saved, ie, guest_cpu_user_regs.

dis: disassemble instructions. If disassembling for guest, then 'num'
must be specified. 'num' is number of instrs to display.

dism: toggle disassembly mode between Intel and ATT/GAS.

mw: modify word in memory given virtual address. 'domid' may be
specified if modifying guest memory. value is assumed in hex even
without 0x.

md: same as above but modify doubleword.

mr: modify register. value is assumd hex.

bc: clear given or all breakpoints

bp: display breakpoints or set a breakpoint. Domid may be specified to
set a bp in guest. kdb functions may not be specified if debugging kdb.
      xkdb> bp acpi_processor_idle  : will set bp in xen
      xkdb> bp default_idle 0 :   will set bp in domid 0
      xkdb> bp idle_cpu 9 :   will set bp in domid 9

     Conditions may be specified for a bp: lhs == rhs or lhs != rhs
     where : lhs is register like 'r6', 'rax', etc...  or memory
     location rhs is hex value with or without leading 0x.
      xkdb> bp acpi_processor_idle rdi == c000 
      xkdb> bp 0xffffffff80062ebc 0 rsi == ffff880021edbc98 : will
     break into kdb at 0xffffffff80062ebc in dom0 when rsi is

btp: break point trace. Upon bp, print some info and continue without
stopping. Ex: btp idle_cpu 7 rax rbx 0x20ef5a5 r9

   will print: rax, rbx, *(long *)0x20ef5a5, r9 upon hitting idle_cpu()
   and continue.

wp: set a watchpoint at a virtual address which can belong to
hypervisor or any guest. Do not specify wp in kdb path if debugging kdb.

wc: clear given or all watchpoints.

ni: single step, stepping over function calls.

ss: single step. Be carefull when in interrupt handlers or context
ssb: single step to branch. Use with care.

go: leave kdb and continue.

cpu: go back to orig cpu when entering kdb. If 'cpu number' given, then
switch to that cpu. If 'all' then show status of all cpus.

nmi: Only available in hung/crash state. Send NMI to a cpu that may be

sym: Initialize a symbol table for debugging a guest. Look into the
System.map file of guest for certain symbol values and provide them

mod: Display modules loaded in linux guest: modptr, address loaded at,
and name.

vcpuh: Given vcpu ptr, display hvm_vcpu struct.

vcpu: Display current vcpu struct. If 'vcpu-ptr' given, display that

dom: display current domain. If 'domid' then display that domid. If
'all', then display all domains.

sched: show schedular info and run queues.

mmu: print basic mmu info

p2m: convert a gpfn to mfn given a domid. input is in hex even without

m2p: convert mfn to pfn. input in hex even without 0x.

dpage: display struct page given a mfn or struct page ptr. Since, no
info is kept on page type, we display all possible page types.

dmsr: display an msr value.

dtrq: display timer queues.

cpuid: run cpuid.

wept: walk ept table for given domid and gfn

dtrq: dump timer queues on all cpus

didt: dump IDT table.

dgt: dump GDT table.

dirq: display IRQ bindings.

dvit: dump (per cpu)vector irq table

dvmc: display all or given dom/vcpu VMCS or VMCB.

mmio: dump mmio related info
trcon: turn tracing on. Trace hooks must be added in xen and kdb
function called directly from there.

trcoff: turn tracing off.

trcz: zero trace buffer.

trcp: give hints to print the circular trace buffer, like current
active ptr.

usr1: allows to add any arbitraty command quickly.

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.