## General Information
See the [[SubhurdHowto]] for general information about subhurds.
----
## 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_.
W1
$ 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](http://savannah.gnu.org/bugs/?17341).)
W2
$ 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](http://savannah.gnu.org/bugs/?19254), so that one wouldn't have to fumble with _ps_.)
W3
$ 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
W1
[.]
/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.
W2
(gdb) continue
Continuing.
warning: Can't wait for pid 853: No child processes
W1
Hurd server bootstrap: ext2fs.static[pseudo-root] exec
W3
(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>
----
Sources:
*
*
* [[ThomasSchwinge]]'s mind