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

Re: [Xen-devel] Debugging Dom0 kernel over serial



On Wed, Jun 06, 2012 at 10:13:44AM +0100, Ian Campbell wrote:
> On Wed, 2012-06-06 at 00:24 +0100, James Paton wrote:
> > Hi,
> >
> > Apologies if this is not the appropriate list, but I thought I would
> > have better luck here than on xen-users.
> >
> > I'm a CS graduate student hacking on the xen-blkback driver and would
> > like to be able to debug it using gdb over serial. I have spent a great
> > deal of time on this with no success (more details can be found at
> > http://bit.ly/KMEF6o (Stack Overflow)).
> >
> > It eventually occurred to me that it might not even be possible to do
> > what I'm trying to do if Xen intercepts interrupts from the serial port
> > and tries to direct them to dom0 through some unexpected channel. Then,
> > after I've done `echo g > /proc/sysrq_trigger`, the kernel debugger
> > might not see the interrupt. Can anyone confirm or disconfirm this?
>
> It's not something I've ever tried but I expect that if you avoid
> console=com1 (or com*) on your hypervisor command line then the com port
> should be available for dom0 just like on native.
>
> Alternatively you could perhaps separate the two by using com1 for Xen
> and com2/ttyS1 for dom0/kdb etc.
>
> I've no idea if kdb would be expected to work over hvc*. I suspect you'd
> be treading fresh ground with that one...
>
> I'd also start by taking virtual box out of the equation on the host
> side. Start by using a MacOS terminal emulator and checking that you can
> see the dom0 console messages and login via a getty running on ttyS0
> before trying to hook up gdb.
>
> > What is the usual procedure for debugging the Dom0 kernel?
>
> Printk ;-)

:-)))))) any variation of this is the best debugging tool for every piece of 
software...

... but another option is plain QEMU. Just download it 
(http://wiki.qemu.org/Main_Page),
install minimal set of software relevant for your needs and look for following 
options:
  - -serial - is a must; I use following combination:
     ... -serial telnet:127.0.0.1:10232,server ...
     you could access it by: telnet 127.0.0.1 10232
  - -gdb - remote access for GDB; I use following combination:
    ... -gdb tcp:127.0.0.1:1234 ...
    you could connect from GDB using following command:
    target remote :1234
    do not forget to compile your software with symbols
  - -monitor - useful if you need check something in memory
    (especially if you know only physical address - xp command;
    but also look for others; I am sure that some could be useful
    for you); I use following combination:
    ... -monitor telnet:127.0.0.1:1233,server,nowait ...
    you could access it by: telnet 127.0.0.1 1233
    quit from monitor: Ctrl-] and then quit command
  - -debugcon - I have not tested it yet but it looks very promising;
    usage is very similar to serial option; however, you do not need
    to do any hardware initialization (serial ports require it);
    just send anything to port 0xe9 (simple outb)

Daniel

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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