1
Xen crash debugger notes
2
------------------------
4
Xen has a simple gdb stub for doing post-mortem debugging i.e. once
5
you've crashed it, you get to poke around and find out why. There's
6
also a special key handler for making it crash, which is handy.
8
You need to have crash_debug=y set when compiling , and you also need
9
to enable it on the Xen command line, eg by gdb=com1.
11
If you need to have a serial port shared between gdb and the console,
12
you can use gdb=com1H. CDB will then set the high bit on every byte
13
it sends, and only respond to bytes with the high bit set. Similarly
14
for com2. If you do this you will need a demultiplexing program on
15
the debugging workstation, such as perhaps tools/misc/nsplitd.
17
The next step depends on your individual setup. This is how to do it
18
if you have a simple null modem connection between the test box and
19
the workstation, and aren't using a H/L split console:
21
* Set debug=y in Config.mk
22
* Set crash_debug=y in xen/Rules.mk
23
* Make the changes in the attached patch, and build.
24
* Arrange to pass gdb=com1 as a hypervisor command line argument
25
(I already have com1=38400,8n1 console=com1,vga sync_console)
27
* Boot the system with minicom (or your favourite terminal program)
28
connected from your workstation via a null modem cable in the
30
* In minicom, give the escape character (^A by default) three times
31
to talk to Xen (Xen prints `(XEN) *** Serial input -> Xen...').
32
* Press % and observe the messages
33
(XEN) '%' pressed -> trapping into debugger
34
(XEN) GDB connection activated.
35
(XEN) Waiting for GDB to attach...
36
* Disconnect from minicom without allowing minicom to send any
37
modem control sequences.
38
* Start gdb with gdb /path/to/build/tree/xen/xen-syms and then
39
(gdb) set remotebaud 38400
40
Remote debugging using /dev/ttyS0
41
0xff124d61 in idle_loop () at domain.c:78
45
There is code which was once intended to make it possible to resume
46
after entering the debugger. However this does not presently work; it
47
has been nonfunctional for quite some time.
49
As soon as you reach the debugger, we disable interrupts, the
50
watchdog, and every other CPU, so the state of the world shouldn't
51
change too much behind your back.
54
Reasons why we might fail to reach the debugger:
55
-----------------------------------------------
57
-- In order to stop the other processors, we need to acquire the SMP
58
call lock. If you happen to have crashed in the middle of that,
60
-- If the page tables are wrong, you're screwed
61
-- If the serial port setup is wrong, badness happens
62
-- Obviously, the low level processor state can be screwed in any
63
number of wonderful ways