Debugging the Hurd Startup Process
one.full is the subhurd's root file system image and has been installed as follows: [TODO]
Wx translates to terminal window x.
$ fsysopts one.full/ --readonly $ sudo boot -I -d -s -D one.full/ one.full/boot/script.boot one.full.ext2 Pausing. . .
(In theory it shouldn't be neccessary to run the subhurd as user root, but in practice that doesn't work at the moment.)
$ ps -Af [...] root 851 385 p4 0:00.01 boot -I -d -s -D one.full/ one.full/boot/script.boot one.full.ext2 - 853 1 ? 0:00.00 ? - 854 1 ? 0:00.00 ? [...] $ sudo gdb /var/tmp/one.full/hurd/ext2fs.static [...] (gdb) attach 853 Attaching to program `/var/tmp/one.full/hurd/ext2fs.static', pid 853 warning: Can't modify tracing state for pid 853: No signal thread Can't fetch registers from thread 1: No such thread
(The boot program could be modified to print out the pids, so that one wouldn't have to fumble with ps.)
$ sudo gdb /var/tmp/one.full/lib/ld.so.1 [...] (gdb) set solib-absolute-prefix /var/tmp/one.full (gdb) attach 854 Attaching to program `/var/tmp/one.full/lib/ld.so.1', pid 854 warning: Can't modify tracing state for pid 854: No signal thread Can't fetch registers from thread 1: No such thread
[<Enter>.] /hurd/ext2fs.static --bootflags=-dsf --host-priv-port=38 --device-master-port=43 --exec-server-task=47 -Tdevice pseudo-root /lib/ld.so.1 /hurd/exec
Now that this step has been accomplished, you can set break points in GDB, etc.
(gdb) continue Continuing. warning: Can't wait for pid 853: No child processes
Hurd server bootstrap: ext2fs.static[pseudo-root] exec
(gdb) continue Continuing. warning: Can't wait for pid 854: No child processes Program received signal EXC_BAD_ACCESS, Could not access memory. __mach_port_mod_refs (task=1, name=139802, right=1, delta=-1) at /var/tmp/glibc-2_5-branch/build_--without-tls_--without-__thread/mach/RPC_mach_port_mod_refs.c:132 132 InP->Head.msgh_reply_port = __mig_get_reply_port(); (gdb) x/i $pc 0x168f2 <__mach_port_mod_refs+82>: call 0x151b0 <__mig_get_reply_port>