aboutsummaryrefslogtreecommitdiff
path: root/man/man3/mach-cmd.html
blob: 978e80b5339bb63ac8e9fa4bab177c715998655b (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<head>
<title>mach-cmd(3) - Plan 9 from User Space</title>
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
</head>
<body bgcolor=#ffffff>
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr height=10><td>
<tr><td width=20><td>
<tr><td width=20><td><b>MACH-CMD(3)</b><td align=right><b>MACH-CMD(3)</b>
<tr><td width=20><td colspan=2>
    <br>
<p><font size=+1><b>NAME     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    attachargs, attachcore, attachdynamic, attachproc, proctextfile
    &ndash; debugging processes and core files<br>
    
</table>
<p><font size=+1><b>SYNOPSIS     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    <tt><font size=+1>#include &lt;u.h&gt;<br>
    #include &lt;libc.h&gt;<br>
    #include &lt;mach.h&gt; 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;attachcore(Fhdr *hdr) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;attachproc(int pid) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;attachdynamic(void) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>char* &nbsp;&nbsp;&nbsp;proctextfile(int pid) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;attachargs(int argc, char **argv, int omode) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>extern Fhdr* symhdr;<br>
    </font></tt>extern &nbsp;&nbsp;&nbsp;&nbsp;char* &nbsp;&nbsp;&nbsp;symfil;<br>
    extern &nbsp;&nbsp;&nbsp;&nbsp;Map* &nbsp;&nbsp;&nbsp;symmap;<br>
    extern &nbsp;&nbsp;&nbsp;&nbsp;Fhdr* &nbsp;&nbsp;&nbsp;fhdrlist;<br>
    extern &nbsp;&nbsp;&nbsp;&nbsp;Fhdr* &nbsp;&nbsp;&nbsp;corhdr;<br>
    extern &nbsp;&nbsp;&nbsp;&nbsp;char* &nbsp;&nbsp;&nbsp;corfil;<br>
    extern &nbsp;&nbsp;&nbsp;&nbsp;Map* &nbsp;&nbsp;&nbsp;cormap;<br>
    extern &nbsp;&nbsp;&nbsp;&nbsp;int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;corpid;<br>
    extern &nbsp;&nbsp;&nbsp;&nbsp;Regs* &nbsp;&nbsp;&nbsp;correg;<br>
    
</table>
<p><font size=+1><b>DESCRIPTION     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    These routines provide access to the objects a typical debugger
    manipulates: an executable binary, some number of shared libraries,
    a memory image in the form of a core dump or active process, and
    a register set. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    The maintained state is:<br>
    <i>symhdr<br>
    </i>
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        The file header for the main binary.<br>
        
    </table>
    <i>symfil</i>The file name of the main binary.<br>
    <i>symmap<br>
    </i>
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        The memory map of the main binary.<br>
        
    </table>
    <i>fhdrlist<br>
    </i>
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        A linked list (via the <tt><font size=+1>Fhdr.next</font></tt> fields) of all currently open
        headers (see <i>symopen</i> in <a href="../man3/mach-symbol.html"><i>mach-symbol</i>(3)</a>). When dynamically linked
        objects have been attached, they are present in this linked list,
        and therefore included in searches by <i>indexsym</i>, <i>lookupsym</i>, and
        <i>findsym</i> (see <a href="../man3/mach-symbol.html"><i>mach-symbol</i>(3)</a>).
        
    </table>
    <i>corhdr</i>The file header for the core dump, if any.<br>
    <i>corfil</i>The file name of the core dump, if any.<br>
    <i>cormap<br>
    </i>
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        The memory map of the core dump or attached process.<br>
        
    </table>
    <i>corpid</i>The process id of the attached process, if any.<br>
    <i>correg</i>The register set of the core dump or attached process. If
    these fields are not valid, they are zeroed. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Attachcore</i> and <i>attachproc</i> attach to an opened core file or an
    executing process. They set <i>corhdr</i>, <i>corfil</i>, <i>cormap</i>, <i>corpid</i>, and
    <i>correg</i>. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Proctextfile</i> returns the name of the main binary for the process
    with id <i>pid</i>. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Attachdynamic</i> requires that the memory image already be attached.
    It reads the dynamic linker&#8217;s internal run-time data structures
    and then opens all the dynamic objects that are currently loaded.
    
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Attachargs</i> uses all of these functions while parsing an argument
    vector as would be passed to a debugger like <a href="../man1/db.html"><i>db</i>(1)</a> or <a href="../man1/acid.html"><i>acid</i>(1)</a>.
    It expects a list of executable files, core dump files, or process
    ids, given in any order. If extra arguments are given (for example,
    more than one executable, or both a core dump and a
    process id), they are ignored and diagnostics are printed to standard
    error. If arguments are missing (for example, the process id is
    given without an executable file), <i>attachargs</i> fills them in as
    best it can.<br>
    
</table>
<p><font size=+1><b>SOURCE     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    <tt><font size=+1>/usr/local/plan9/src/libmach<br>
    </font></tt>
</table>
<p><font size=+1><b>SEE ALSO     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    <a href="../man3/mach.html"><i>mach</i>(3)</a>, <a href="../man3/mach-file.html"><i>mach-file</i>(3)</a>, <a href="../man3/mach-map.html"><i>mach-map</i>(3)</a><br>
    
</table>
<p><font size=+1><b>BUGS     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    The interface needs to be changed to support multiple threads,
    each with its own register set.<br>
    
</table>

<td width=20>
<tr height=20><td>
</table>
<!-- TRAILER -->
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr height=15><td width=10><td><td width=10>
<tr><td><td>
<center>
<a href="../../"><img src="../../dist/spaceglenda100.png" alt="Space Glenda" border=1></a>
</center>
</table>
<!-- TRAILER -->
</body></html>