summaryrefslogtreecommitdiff
path: root/hurd/debugging/subhurd.mdwn
blob: 7b5b07b12c4366ee87169dfe0cd3294e5ee4e6a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# General Information

* [[/hurd/subhurd]]

---

# 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

    [<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.

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:

* [[subhurd/running_a_subhurd]]
* <http://lists.gnu.org/archive/html/bug-hurd/2007-02/msg00030.html>
* [[Thomas_Schwinge|tschwinge]]'s mind