~nabijaczleweli/febug

ref: 4d5e0ab71443175931b78ab84beccfcd49a32108 febug/FreeBSD/febug-abi.5.html -rw-r--r-- 13.5 KiB
4d5e0ab7 — наб autouploader FreeBSD manpage update by job 406609 9 months ago
                                                                                
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
<!DOCTYPE html>
<html>
<!-- This is an automatically generated file.  Do not edit.
  " SPDX-License-Identifier: MIT
 -->
<head>
  <meta charset="utf-8"/>
<style>
/* $OpenBSD: mandoc.css,v 1.33 2019/06/02 16:50:46 schwarze Exp $ */
/*
 * Standard style sheet for mandoc(1) -Thtml and man.cgi(8).
 *
 * Written by Ingo Schwarze <schwarze@openbsd.org>.
 * I place this file into the public domain.
 * Permission to use, copy, modify, and distribute it for any purpose
 * with or without fee is hereby granted, without any conditions.
 */
/* Tooltips removed. */

/* Global defaults. */

html {		max-width: 65em;
		--bg: #FFFFFF;
		--fg: #000000; }
body {		background: var(--bg);
		color: var(--fg);
		font-family: Helvetica,Arial,sans-serif; }
h1 {		font-size: 110%; }
table {		margin-top: 0em;
		margin-bottom: 0em;
		border-collapse: collapse; }
/* Some browsers set border-color in a browser style for tbody,
 * but not for table, resulting in inconsistent border styling. */
tbody {		border-color: inherit; }
tr {		border-color: inherit; }
td {		vertical-align: top;
		padding-left: 0.2em;
		padding-right: 0.2em;
		border-color: inherit; }
ul, ol, dl {	margin-top: 0em;
		margin-bottom: 0em; }
li, dt {	margin-top: 1em; }

.permalink {	border-bottom: thin dotted;
		color: inherit;
		font: inherit;
		text-decoration: inherit; }
* {		clear: both }

/* Search form and search results. */

fieldset {	border: thin solid silver;
		border-radius: 1em;
		text-align: center; }
input[name=expr] {
		width: 25%; }

table.results {	margin-top: 1em;
		margin-left: 2em;
		font-size: smaller; }

/* Header and footer lines. */

table.head {	width: 100%;
		border-bottom: 1px dotted #808080;
		margin-bottom: 1em;
		font-size: smaller; }
td.head-vol {	text-align: center; }
td.head-rtitle {
		text-align: right; }

table.foot {	width: 100%;
		border-top: 1px dotted #808080;
		margin-top: 1em;
		font-size: smaller; }
td.foot-os {	text-align: right; }

/* Sections and paragraphs. */

.manual-text {
		margin-left: 3.8em; }
.Nd { }
section.Sh { }
h1.Sh {		margin-top: 1.2em;
		margin-bottom: 0.6em;
		margin-left: -3.2em; }
section.Ss { }
h2.Ss {		margin-top: 1.2em;
		margin-bottom: 0.6em;
		margin-left: -1.2em;
		font-size: 105%; }
.Pp {		margin: 0.6em 0em; }
.Sx { }
.Xr { }

/* Displays and lists. */

.Bd { }
.Bd-indent {	margin-left: 3.8em; }

.Bl-bullet {	list-style-type: disc;
		padding-left: 1em; }
.Bl-bullet > li { }
.Bl-dash {	list-style-type: none;
		padding-left: 0em; }
.Bl-dash > li:before {
		content: "\2014  "; }
.Bl-item {	list-style-type: none;
		padding-left: 0em; }
.Bl-item > li { }
.Bl-compact > li {
		margin-top: 0em; }

.Bl-enum {	padding-left: 2em; }
.Bl-enum > li { }
.Bl-compact > li {
		margin-top: 0em; }

.Bl-diag { }
.Bl-diag > dt {
		font-style: normal;
		font-weight: bold; }
.Bl-diag > dd {
		margin-left: 0em; }
.Bl-hang { }
.Bl-hang > dt { }
.Bl-hang > dd {
		margin-left: 5.5em; }
.Bl-inset { }
.Bl-inset > dt { }
.Bl-inset > dd {
		margin-left: 0em; }
.Bl-ohang { }
.Bl-ohang > dt { }
.Bl-ohang > dd {
		margin-left: 0em; }
.Bl-tag {	margin-top: 0.6em;
		margin-left: 5.5em; }
.Bl-tag > dt {
		float: left;
		margin-top: 0em;
		margin-left: -5.5em;
		padding-right: 0.5em;
		vertical-align: top; }
.Bl-tag > dd {
		clear: right;
		column-count: 1;  /* Force block formatting context. */
		width: 100%;
		margin-top: 0em;
		margin-left: 0em;
		margin-bottom: 0.6em;
		vertical-align: top; }
.Bl-compact {	margin-top: 0em; }
.Bl-compact > dd {
		margin-bottom: 0em; }
.Bl-compact > dt {
		margin-top: 0em; }

.Bl-column { }
.Bl-column > tbody > tr { }
.Bl-column > tbody > tr > td {
		margin-top: 1em; }
.Bl-compact > tbody > tr > td {
		margin-top: 0em; }

.Rs {		font-style: normal;
		font-weight: normal; }
.RsA { }
.RsB {		font-style: italic;
		font-weight: normal; }
.RsC { }
.RsD { }
.RsI {		font-style: italic;
		font-weight: normal; }
.RsJ {		font-style: italic;
		font-weight: normal; }
.RsN { }
.RsO { }
.RsP { }
.RsQ { }
.RsR { }
.RsT {		text-decoration: underline; }
.RsU { }
.RsV { }

.eqn { }
.tbl td {	vertical-align: middle; }

.HP {		margin-left: 3.8em;
		text-indent: -3.8em; }

/* Semantic markup for command line utilities. */

table.Nm { }
code.Nm {	font-style: normal;
		font-weight: bold;
		font-family: inherit; }
.Fl {		font-style: normal;
		font-weight: bold;
		font-family: inherit; }
.Cm {		font-style: normal;
		font-weight: bold;
		font-family: inherit; }
.Ar {		font-style: italic;
		font-weight: normal; }
.Op {		display: inline; }
.Ic {		font-style: normal;
		font-weight: bold;
		font-family: inherit; }
.Ev {		font-style: normal;
		font-weight: normal;
		font-family: monospace; }
.Pa {		font-style: italic;
		font-weight: normal; }

/* Semantic markup for function libraries. */

.Lb { }
code.In {	font-style: normal;
		font-weight: bold;
		font-family: inherit; }
a.In { }
.Fd {		font-style: normal;
		font-weight: bold;
		font-family: inherit; }
.Ft {		font-style: italic;
		font-weight: normal; }
.Fn {		font-style: normal;
		font-weight: bold;
		font-family: inherit; }
.Fa {		font-style: italic;
		font-weight: normal; }
.Vt {		font-style: italic;
		font-weight: normal; }
.Va {		font-style: italic;
		font-weight: normal; }
.Dv {		font-style: normal;
		font-weight: normal;
		font-family: monospace; }
.Er {		font-style: normal;
		font-weight: normal;
		font-family: monospace; }

/* Various semantic markup. */

.An { }
.Lk { }
.Mt { }
.Cd {		font-style: normal;
		font-weight: bold;
		font-family: inherit; }
.Ad {		font-style: italic;
		font-weight: normal; }
.Ms {		font-style: normal;
		font-weight: bold; }
.St { }
.Ux { }

/* Physical markup. */

.Bf {		display: inline; }
.No {		font-style: normal;
		font-weight: normal; }
.Em {		font-style: italic;
		font-weight: normal; }
.Sy {		font-style: normal;
		font-weight: bold; }
.Li {		font-style: normal;
		font-weight: normal;
		font-family: monospace; }

/* Tooltip support. */

h1.Sh, h2.Ss {	position: relative; }
.An, .Ar, .Cd, .Cm, .Dv, .Em, .Er, .Ev, .Fa, .Fd, .Fl, .Fn, .Ft,
.Ic, code.In, .Lb, .Lk, .Ms, .Mt, .Nd, code.Nm, .Pa, .Rs,
.St, .Sx, .Sy, .Va, .Vt, .Xr {
		display: inline-block;
		position: relative; }

/* Overrides to avoid excessive margins on small devices. */

@media (max-width: 37.5em) {
.manual-text {
		margin-left: 0.5em; }
h1.Sh, h2.Ss {	margin-left: 0em; }
.Bd-indent {	margin-left: 2em; }
.Bl-hang > dd {
		margin-left: 2em; }
.Bl-tag {	margin-left: 2em; }
.Bl-tag > dt {
		margin-left: -2em; }
.HP {		margin-left: 2em;
		text-indent: -2em; }
}

/* Overrides for a dark color scheme for accessibility. */

@media (prefers-color-scheme: dark) {
html {		--bg: #1E1F21;
		--fg: #EEEFF1; }
:link {		color: #BAD7FF; }
:visited {	color: #F6BAFF; }
}
</style>
  <title>FEBUG-ABI(3)</title>
</head>
<body>
<table class="head">
  <tr>
    <td class="head-ltitle">FEBUG-ABI(3)</td>
    <td class="head-vol">FreeBSD Library Functions Manual</td>
    <td class="head-rtitle">FEBUG-ABI(3)</td>
  </tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<code class="Nm">struct febug_message</code>, <code class="Nm">struct
  stop_febug_message</code>, <code class="Nm">struct attn_febug_message</code>
  &#x2014;
<div class="Nd">User-space debugfs ABI</div>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<code class="In">#include
  &lt;<a class="In" href="https://git.sr.ht/~nabijaczleweli/febug/tree/trunk/item/include/febug-abi.h">febug-abi.h</a>&gt;</code>
<p class="Pp"><b class="Sy">struct febug_message;</b></p>
<p class="Pp"><b class="Sy">struct stop_febug_message;</b></p>
<p class="Pp"><b class="Sy">struct attn_febug_message;</b></p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
The febug ABI consists of two messages sent from the program wishing to be
  debugged to <a class="Xr" href="febug.8.html">febug(8)</a>, and one sent from
  <a class="Xr" href="febug.8.html">febug(8)</a> to the program.
<p class="Pp">To be debugged, the program must create a socket with
    <code class="Li">socket(AF_UNIX, SOCK_SEQPACKET, 0)</code> and
    <a class="Xr">connect(2)</a> to the appropriate end-point
    (<span class="Pa">/var/run/febug.sock</span>, conventionally). Afterward, it
    should send the null message with auxilliary data of type
    <code class="Dv">SCM_CREDS</code>. However, sending it alongside the first
    non-null message works as well. After <a class="Xr" href="febug.8.html">febug(8)</a> receives
    credentials, a directory corresponding to the debugged process' PID will be
    created in the filesystem.</p>
<p class="Pp"><i class="Em">All</i> messages must be sent in a single
    <a class="Xr">send(2)</a> or <a class="Xr">sendmsg(2)</a> call, specifying
    the exact size of the message, as that's what's used to differentiate
    between different messages. <a class="Xr" href="febug.8.html">febug(8)</a> will ignore messages
    (whose sizes) it does not recognise.</p>
<p class="Pp">Afterward, for each variable of interest, the process should send
    a 4096-byte <b class="Sy">febug_message</b>, defined as follows:</p>
<div class="Bd Pp Bd-indent">
<pre>
struct [[packed]] febug_message {
    uint64_t variable_id;
    uint64_t variable_type;
    uint8_t signal;
    char name[/* Enough to bring the overall size to 4096. */];
};
</pre>
</div>
<p class="Pp">Wherein:</p>
<dl class="Bl-tag">
  <dt></dt>
  <dd><i class="Em">variable_id</i> is the locally unique identifier of the
      variable (e.g. a pointer to that variable).</dd>
  <dt></dt>
  <dd><i class="Em">variable_type</i> is the moral equivalent of
      <var class="Vt">void *</var> <var class="Va">userdata</var> &#x2014; it is
      simply passed back to the program, unchanged (e.g. a function pointer to a
      formatter).</dd>
  <dt></dt>
  <dd><i class="Em">signal</i> is the signal to send to the program when a
      variable is to be read (see below). <i class="Em">name</i> is the globally
      unique name of this variable &#x2014; a NUL terminator is respected, if it
      occurs before the end of the array, but is not required if the name truly
      spans to the final byte. If the name is the same as one of an
      already-present variable, it will be overridden.</dd>
</dl>
<p class="Pp">When <a class="Xr" href="febug.8.html">febug(8)</a> receives
    <b class="Sy">febug_message</b>, it creates a file under the process'
    directory. When that file is opened, <a class="Xr" href="febug.8.html">febug(8)</a> will:</p>
<ol class="Bl-enum">
  <li>send the process an <b class="Sy">attn_febug_message</b> with a single
      file descriptor via <code class="Dv">SCM_RIGHTS</code> auxilliary data
      (confer <a class="Xr">cmsg(3)</a>) representing the write end of a pipe
      &#x2014; subsequent reads are serviced directly by the opposing end.</li>
  <li><a class="Xr">kill(2)</a> the process with the signal from the
      <var class="Va">signal</var> field if it wasn't
      <code class="Dv">SIGKILL</code>.</li>
</ol>
<p class="Pp">Note, that the sent file descriptor <i class="Em">must</i> be
    closed by the program when it's done serialising the variable, and
    therefore, if the process opts not to receive a signal, it
    <i class="Em">must</i> handle the message through some other mechanism.</p>
<p class="Pp"><b class="Sy">attn_febug_message</b> is 16 bytes, and defined as
    follows:</p>
<div class="Bd Pp Bd-indent">
<pre>
struct [[packed]] attn_febug_message {
    uint64_t variable_id;
    uint64_t variable_type;
};
</pre>
</div>
<p class="Pp">Both fields correspond to the ones sent in the
    <b class="Sy">febug_message</b> that installed the variable.</p>
<p class="Pp">The process may receive any amount of
    <b class="Sy">attn_febug_message</b> until it sends an 8-byte
    <b class="Sy">stop_febug_message</b>, defined as follows:</p>
<div class="Bd Pp Bd-indent">
<pre>
struct [[packed]] stop_febug_message {
    uint64_t variable_id;
};
</pre>
</div>
<p class="Pp">Upon receipt, the corresponding variable, if any, is removed from
    the filesystem.</p>
<p class="Pp">When the process' end of the socket is closed, all extant
    variables are freed, and the process' directory is removed.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
  ALSO</a></h1>
<a class="Xr" href="libfebug.3.html">libfebug(3)</a> and <a class="Xr" href="libfebug++.3.html">libfebug++(3)</a> &#x2014;
  libraries that wrap this ABI.
</section>
<section class="Sh">
<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
Written by <span class="An">&#x043D;&#x0430;&#x0431;</span>
  &lt;<a class="Mt" href="mailto:nabijaczleweli@nabijaczleweli.xyz">nabijaczleweli@nabijaczleweli.xyz</a>&gt;
</section>
<section class="Sh">
<h1 class="Sh" id="SPECIAL_THANKS"><a class="permalink" href="#SPECIAL_THANKS">SPECIAL
  THANKS</a></h1>
To all who support further development, in particular:
<ul class="Bl-bullet Bl-compact">
  <li>ThePhD</li>
  <li>Embark Studios</li>
</ul>
</section>
<section class="Sh">
<h1 class="Sh" id="REPORTING_BUGS"><a class="permalink" href="#REPORTING_BUGS">REPORTING
  BUGS</a></h1>
<a class="Lk" href="https://todo.sr.ht/~nabijaczleweli/febug">febug tracker</a>
<p class="Pp">febug mailing list:
    &lt;<a class="Mt" href="mailto:~nabijaczleweli/febug@lists.sr.ht">~nabijaczleweli/febug@lists.sr.ht</a>&gt;
    archived at
    <a class="Lk" href="https://lists.sr.ht/~nabijaczleweli/febug">https://lists.sr.ht/~nabijaczleweli/febug</a></p>
</section>
</div>
<table class="foot">
  <tr>
    <td class="foot-date">January 25, 2021</td>
    <td class="foot-os">FreeBSD 12.1-RELEASE-p7</td>
  </tr>
</table>
</body>
</html>