After one request too many for support for alternative debuggers and gdb
wrappers, I decided that it actually wasn't that hard. So, I did it.
There is a new switch, 'gdb-pid=<pid>', that must be used in conjunction with
'debug', which you use to specify the debugger process.
To use gdb inside a wrapper, like emacs or ddd (I think), start it up, get the
pid of gdb and pass it into the 'gdb-pid' switch. Then, 'att 1' to gdb, and
you'll find yourself debugging UML.
As an example of an alternative debugger, I decided to see if this allowed UML
to be straced. The answer is yes, via the following concoction:
At the shell do this:
sh -c 'echo pid=$$; echo -n hit return; read x; exec strace -p 1 -o
It will print out a pid. Stick that pid in the 'gdb-pid' switch and run UML.
UML will do nothing. Now hit return at that shell, and UML will start doing
It will do it unbelievably slowly. It took about 25 minutes to boot up my
favorite Slackware filesystem, log in, and shut it down. I ended up with a 33
meg strace log.
A hint: Do not run it with a lot of memory. The first thing will will notice
is the 4 system calls per page as the bootmem allocator hands its memory over
There's a fair amount of interesting information in that 33 meg log, and some
obvious optimization opportunities. Here's the system call and signal count:
2703 --- SIGALRM
1209 --- SIGIO
921 --- SIGSEGV
43 --- SIGVTALRM
The munmap count is a symptom of the swap fix. When a page is not present, I
can't tell if it's newly not present or if it was never there. So I unmap it
just in case.
The rt_sigprocmask is because of my hyperactive sti/cli routines.
The sum of the signals isn't equal to the number of sigreturns, which I don't
And, that's a surprisingly small range of system calls. "I can implement that
virtual machine with 21 system calls."
The patch is available from http://prdownloads.sourceforge.net/user-mode-linux/
uml-patch-latest.bz2, but not ftp://ftp.nl.linux.org/pub/uml/uml-patch-latest.b
z2 yet, because ftp.nl.linux.org is out of commission until Tuesday or so.