Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Sep 2009 23:08:22 -0700
From:      Kip Macy <kmacy@freebsd.org>
To:        freebsd-xen <freebsd-xen@freebsd.org>
Subject:   gdbserver-xen updates
Message-ID:  <3c1674c90909112308u1778ce71ud1198236fe6a675a@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
In case you're not already familiar with it, gdbserver-xen is
something I added to xen several years ago, it makes it possible to
debug domU guests as if they were ordinary single or threaded
processes (UP or SMP).

You can find an updated patch for xen-3.3 and xen-3.4 at:

http://people.freebsd.org/~kmacy/xen/


pandemonium is a linux xen host
delirium is a freebsd system

patch xen-3.3 (or xen-3.4)

cd xen-3.3/tools
make
sudo -c make install

cd ../debugger/gdb
./gdbbuild
sudo -c cp gdb-6.8-linux-i386-xen/gdb/gdbserver/gdbserver-xen /usr/local/bin


[root@pandemonium ~]# xm list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0  5093     4     r-----    281.0
ExampleDomain                                1  3000     1     -b----     39.5


[root@pandemonium kmacy]# ip  addr show dev eth0
6: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
   link/ether 00:30:48:94:f5:62 brd ff:ff:ff:ff:ff:ff
   inet 192.168.1.152/16 brd 192.168.255.255 scope global eth0
   inet6 fe80::230:48ff:fe94:f562/64 scope link
      valid_lft forever preferred_lft forever

[root@pandemonium kmacy]# gdbserver-xen 192.168.1.152:5555 --attach 1
xc_ptrace(PTRACE_ATTACH, 1, 0, 0)
Attached; pid = 1
Listening on port 5555



% gdb  /usr/home/kmacy/svn_checkouts/objdir/i386/usr/home/kmacy/svn_checkouts/head_new/sys/XEN/kernel.debug
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
(gdb)
 target remote 192.168.1.152:5555
Remote debugging using 192.168.1.152:5555
[New Thread 1]
0xc003e3a7 in hypercall_page () at
/usr/home/kmacy/svn_checkouts/head_new/sys/i386/xen/locore.s:249
249             /* At the end of our stack, we shall have free space -
so store it */
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
warning: shared library handler failed to enable breakpoint
Current language:  auto; currently asm
(gdb)
(gdb) bt
#0  0xc003e3a7 in hypercall_page () at
/usr/home/kmacy/svn_checkouts/head_new/sys/i386/xen/locore.s:249
#1  0xc032b5df in idle_block () at hypercall.h:189
#2  0xc0314ed7 in cpu_idle_hlt (busy=1) at
/usr/home/kmacy/svn_checkouts/head_new/sys/i386/i386/machdep.c:1200
#3  0xc03142c2 in cpu_idle (busy=1) at
/usr/home/kmacy/svn_checkouts/head_new/sys/i386/i386/machdep.c:1324
#4  0xc00f7d32 in sched_idletd (dummy=0x0) at
/usr/home/kmacy/svn_checkouts/head_new/sys/kern/sched_ule.c:2562
#5  0xc00aeed8 in fork_exit (callout=0xc00f7ca0 <sched_idletd>,
arg=0x0, frame=0xc5a4fd38)
   at /usr/home/kmacy/svn_checkouts/head_new/sys/kern/kern_fork.c:843
#6  0xc030f5b4 in fork_trampoline () at
/usr/home/kmacy/svn_checkouts/head_new/sys/i386/xen/exception.s:271
(gdb)

To debug from boot  pass -p to xm create to pause at the first instruction.


-- 
When harsh accusations depart too far from the truth, they leave
bitter consequences.
--Tacitus



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3c1674c90909112308u1778ce71ud1198236fe6a675a>