xref: /titanic_51/usr/src/man/man1/ctfdump.1 (revision 7fd791373689a6af05e27efec3b1ab556e02aa23)
1*7fd79137SRobert Mustacchi.\"
2*7fd79137SRobert Mustacchi.\" This file and its contents are supplied under the terms of the
3*7fd79137SRobert Mustacchi.\" Common Development and Distribution License ("CDDL"), version 1.0.
4*7fd79137SRobert Mustacchi.\" You may only use this file in accordance with the terms of version
5*7fd79137SRobert Mustacchi.\" 1.0 of the CDDL.
6*7fd79137SRobert Mustacchi.\"
7*7fd79137SRobert Mustacchi.\" A full copy of the text of the CDDL should have accompanied this
8*7fd79137SRobert Mustacchi.\" source.  A copy of the CDDL is also available via the Internet at
9*7fd79137SRobert Mustacchi.\" http://www.illumos.org/license/CDDL.
10*7fd79137SRobert Mustacchi.\"
11*7fd79137SRobert Mustacchi.\"
12*7fd79137SRobert Mustacchi.\" Copyright 2018, Joyent, Inc.
13*7fd79137SRobert Mustacchi.\"
14*7fd79137SRobert Mustacchi.Dd Oct 2, 2018
15*7fd79137SRobert Mustacchi.Dt CTFDUMP 1
16*7fd79137SRobert Mustacchi.Os
17*7fd79137SRobert Mustacchi.Sh NAME
18*7fd79137SRobert Mustacchi.Nm ctfdump
19*7fd79137SRobert Mustacchi.Nd dump parts of ctf data from files
20*7fd79137SRobert Mustacchi.Sh SYNOPSIS
21*7fd79137SRobert Mustacchi.Nm ctfdump
22*7fd79137SRobert Mustacchi.Op Fl cdfhlsSt
23*7fd79137SRobert Mustacchi.Op Fl p Ar parent
24*7fd79137SRobert Mustacchi.Op Fl u Ar outfile
25*7fd79137SRobert Mustacchi.Ar file
26*7fd79137SRobert Mustacchi.Sh DESCRIPTION
27*7fd79137SRobert MustacchiThe
28*7fd79137SRobert Mustacchi.Nm
29*7fd79137SRobert Mustacchiutility dumps and decodes the
30*7fd79137SRobert Mustacchi.Sy CTF
31*7fd79137SRobert Mustacchidata contained inside of
32*7fd79137SRobert Mustacchi.Sy ELF
33*7fd79137SRobert Mustacchiobjects and raw
34*7fd79137SRobert Mustacchi.Sy CTF
35*7fd79137SRobert Mustacchifiles.
36*7fd79137SRobert Mustacchi.Lp
37*7fd79137SRobert Mustacchi.Nm
38*7fd79137SRobert Mustacchican dump information about the
39*7fd79137SRobert Mustacchi.Sy CTF header ,
40*7fd79137SRobert Mustacchithe
41*7fd79137SRobert Mustacchi.Sy labels
42*7fd79137SRobert Mustacchiencoded in the
43*7fd79137SRobert Mustacchi.Sy CTF
44*7fd79137SRobert Mustacchicontainer,
45*7fd79137SRobert Mustacchithe types of
46*7fd79137SRobert Mustacchi.Sy data objects ,
47*7fd79137SRobert Mustacchithe internal
48*7fd79137SRobert Mustacchi.Sy string
49*7fd79137SRobert Mustacchitable,
50*7fd79137SRobert Mustacchithe types of the return function and the arguments for
51*7fd79137SRobert Mustacchi.Sy functions ,
52*7fd79137SRobert Mustacchiand of course, it displays information about the
53*7fd79137SRobert Mustacchi.Sy types
54*7fd79137SRobert Mustacchidefined in the
55*7fd79137SRobert Mustacchi.Sy CTF
56*7fd79137SRobert Mustacchicontainer.
57*7fd79137SRobert Mustacchi.Lp
58*7fd79137SRobert Mustacchi.Nm
59*7fd79137SRobert Mustacchican also be used to dump out the raw
60*7fd79137SRobert Mustacchi.Sy CTF
61*7fd79137SRobert Mustacchidata and send it to another file.
62*7fd79137SRobert MustacchiWhen writing out data, it always ensures that the
63*7fd79137SRobert Mustacchi.Sy CTF
64*7fd79137SRobert Mustacchidata is decompressed.
65*7fd79137SRobert MustacchiIn this form, the
66*7fd79137SRobert Mustacchi.Sy CTF
67*7fd79137SRobert Mustacchidata can be inspected using
68*7fd79137SRobert Mustacchi.Nm
69*7fd79137SRobert Mustacchiand other tools such as
70*7fd79137SRobert Mustacchi.Xr mdb 1 .
71*7fd79137SRobert Mustacchi.Lp
72*7fd79137SRobert Mustacchi.Nm
73*7fd79137SRobert Mustacchiin
74*7fd79137SRobert Mustacchi.Fl c
75*7fd79137SRobert Mustacchimode will generate C-style output, which can be used for comparison.
76*7fd79137SRobert MustacchiNote that this output is not directly compilable.
77*7fd79137SRobert Mustacchi.Lp
78*7fd79137SRobert MustacchiWhen no options are specified,
79*7fd79137SRobert Mustacchi.Nm
80*7fd79137SRobert Mustacchidisplays all information, except the C-style output.
81*7fd79137SRobert MustacchiHowever, when the
82*7fd79137SRobert Mustacchi.Fl u
83*7fd79137SRobert Mustacchioption is used, then no information is displayed by default, unless
84*7fd79137SRobert Mustacchirequested through the appropriate option.
85*7fd79137SRobert Mustacchi.Sh OPTIONS
86*7fd79137SRobert MustacchiThe following options are supported:
87*7fd79137SRobert Mustacchi.Bl -hang -width Ds
88*7fd79137SRobert Mustacchi.It Fl c
89*7fd79137SRobert Mustacchi.Bd -filled -compact
90*7fd79137SRobert MustacchiGenerate C-style output.
91*7fd79137SRobert Mustacchi.Ed
92*7fd79137SRobert Mustacchi.It Fl d
93*7fd79137SRobert Mustacchi.Bd -filled -compact
94*7fd79137SRobert MustacchiDump the types of symbols that correspond to objects.
95*7fd79137SRobert Mustacchi.Ed
96*7fd79137SRobert Mustacchi.It Fl f
97*7fd79137SRobert Mustacchi.Bd -filled -compact
98*7fd79137SRobert MustacchiDump the types of the return values and arguments of the functions.
99*7fd79137SRobert Mustacchi.Ed
100*7fd79137SRobert Mustacchi.It Fl h
101*7fd79137SRobert Mustacchi.Bd -filled -compact
102*7fd79137SRobert MustacchiDump the
103*7fd79137SRobert Mustacchi.Sy CTF
104*7fd79137SRobert Mustacchiheader
105*7fd79137SRobert Mustacchi.Ed
106*7fd79137SRobert Mustacchi.It Fl l
107*7fd79137SRobert Mustacchi.Bd -filled -compact
108*7fd79137SRobert MustacchiDump all
109*7fd79137SRobert Mustacchi.Sy CTF
110*7fd79137SRobert Mustacchilabels associated with the file.
111*7fd79137SRobert Mustacchi.Ed
112*7fd79137SRobert Mustacchi.It Fl p Ar parent
113*7fd79137SRobert Mustacchi.Bd -filled -compact
114*7fd79137SRobert MustacchiUse the type information in
115*7fd79137SRobert Mustacchi.Em parent
116*7fd79137SRobert Mustacchito supplement output.
117*7fd79137SRobert MustacchiThis is useful when a
118*7fd79137SRobert Mustacchi.Nm CTF
119*7fd79137SRobert Mustacchicontainer has been
120*7fd79137SRobert Mustacchi.Sy uniquified
121*7fd79137SRobert Mustacchiagainst
122*7fd79137SRobert Mustacchi.Em parent .
123*7fd79137SRobert MustacchiThis allows
124*7fd79137SRobert Mustacchi.Nm
125*7fd79137SRobert Mustacchito use the names of types when used with
126*7fd79137SRobert Mustacchi.Fl t .
127*7fd79137SRobert Mustacchi.Ed
128*7fd79137SRobert Mustacchi.It Fl s
129*7fd79137SRobert Mustacchi.Bd -filled -compact
130*7fd79137SRobert MustacchiDump the internal
131*7fd79137SRobert Mustacchi.Sy CTF
132*7fd79137SRobert Mustacchistring table
133*7fd79137SRobert Mustacchi.Ed
134*7fd79137SRobert Mustacchi.It Fl S
135*7fd79137SRobert Mustacchi.Bd -filled -compact
136*7fd79137SRobert MustacchiDisplays statistics about the
137*7fd79137SRobert Mustacchi.Sy CTF
138*7fd79137SRobert Mustacchicontainer.
139*7fd79137SRobert Mustacchi.Ed
140*7fd79137SRobert Mustacchi.It Fl t
141*7fd79137SRobert Mustacchi.Bd -filled -compact
142*7fd79137SRobert MustacchiDump the type information contained in the
143*7fd79137SRobert Mustacchi.Sy CTF
144*7fd79137SRobert Mustacchiconatiner.
145*7fd79137SRobert Mustacchi.Ed
146*7fd79137SRobert Mustacchi.It Fl u Ar outfile
147*7fd79137SRobert Mustacchi.Bd -filled -compact
148*7fd79137SRobert MustacchiCopies the uncompressed
149*7fd79137SRobert Mustacchi.Sy CTF
150*7fd79137SRobert Mustacchidata to the file specified by
151*7fd79137SRobert Mustacchi.Em outfile .
152*7fd79137SRobert MustacchiThis can be used to make it easier to inspect the raw
153*7fd79137SRobert Mustacchi.Sy CTF
154*7fd79137SRobert Mustacchidata.
155*7fd79137SRobert Mustacchi.Ed
156*7fd79137SRobert Mustacchi.El
157*7fd79137SRobert Mustacchi.Sh OUTPUT
158*7fd79137SRobert MustacchiWhen the
159*7fd79137SRobert Mustacchi.Nm
160*7fd79137SRobert Mustacchiutility is executed with its default options, it prints out a textual
161*7fd79137SRobert Mustacchirepresentation of the
162*7fd79137SRobert Mustacchi.Sy CTF
163*7fd79137SRobert Mustacchiinformation.
164*7fd79137SRobert MustacchiNote, the output format of
165*7fd79137SRobert Mustacchi.Nm
166*7fd79137SRobert Mustacchiis subject to change at any time and should not be relied upon as a
167*7fd79137SRobert Mustacchistable format to be used for parsing.
168*7fd79137SRobert Mustacchi.Ss CTF Header
169*7fd79137SRobert MustacchiThis section describes the values in the
170*7fd79137SRobert Mustacchi.Sy CTF
171*7fd79137SRobert Mustacchiheader.
172*7fd79137SRobert MustacchiEach line in the section describes the value of one of the
173*7fd79137SRobert Mustacchimembers of the header.
174*7fd79137SRobert MustacchiFor more information on the meaning and interpretation of these members,
175*7fd79137SRobert Mustacchisee
176*7fd79137SRobert Mustacchi.Xr ctf 4 .
177*7fd79137SRobert Mustacchi.Ss Label Table
178*7fd79137SRobert MustacchiThis section describes information about the labels present in the
179*7fd79137SRobert Mustacchi.Sy CTF
180*7fd79137SRobert Mustacchiinformation.
181*7fd79137SRobert MustacchiEach entry in this section, if present, starts with a
182*7fd79137SRobert Mustacchinumber and is followed by a string.
183*7fd79137SRobert MustacchiAn example entry in the label section might look like:
184*7fd79137SRobert Mustacchi.Bd -literal
185*7fd79137SRobert Mustacchi\&...
186*7fd79137SRobert Mustacchi   2270 joyent_20151001T070028Z
187*7fd79137SRobert Mustacchi\&...
188*7fd79137SRobert Mustacchi.Ed
189*7fd79137SRobert Mustacchi.Pp
190*7fd79137SRobert MustacchiThe number,
191*7fd79137SRobert Mustacchi.Em 2270 ,
192*7fd79137SRobert Mustacchirepresents the last type that the label applies to.
193*7fd79137SRobert MustacchiThe string,
194*7fd79137SRobert Mustacchi.Em joyent_20151001T070028Z ,
195*7fd79137SRobert Mustacchiis the name of the label.
196*7fd79137SRobert MustacchiIn this case, if there were no other labels,
197*7fd79137SRobert Mustacchiit would indicate that the label applied to all types up to, and
198*7fd79137SRobert Mustacchiincluding, the type number 2270.
199*7fd79137SRobert MustacchiFor more information on how labels are used with
200*7fd79137SRobert Mustacchi.Sy CTF
201*7fd79137SRobert Mustacchiinformation, see the section
202*7fd79137SRobert Mustacchi.Em The Label Section
203*7fd79137SRobert Mustacchiin
204*7fd79137SRobert Mustacchi.Xr ctf 4 .
205*7fd79137SRobert Mustacchi.Ss Data Objects
206*7fd79137SRobert MustacchiThis section describes the type information relating to data objects
207*7fd79137SRobert Mustacchifrom the symbol table.
208*7fd79137SRobert MustacchiAn entry for a data object consists of four columns.
209*7fd79137SRobert MustacchiThe first column is just a monotonic ID.
210*7fd79137SRobert MustacchiThe second number is the type id of the object.
211*7fd79137SRobert MustacchiThe third column is the name of the symbol and the fourth column is the
212*7fd79137SRobert Mustacchicorresponding index from the symbol table.
213*7fd79137SRobert Mustacchi.Pp
214*7fd79137SRobert MustacchiTake for example, the following couple of entries:
215*7fd79137SRobert Mustacchi.Bd -literal
216*7fd79137SRobert Mustacchi\&...
217*7fd79137SRobert Mustacchi  [0] 13        hz (48)
218*7fd79137SRobert Mustacchi  [1] 78        _nd (49)
219*7fd79137SRobert Mustacchi  [2] 1656      __pfmt_label (56)
220*7fd79137SRobert Mustacchi  [3] 926       _aio_hash (68)
221*7fd79137SRobert Mustacchi  [4] 13        _lio_free (70)
222*7fd79137SRobert Mustacchi  [5] 1321      u8_number_of_bytes (73)
223*7fd79137SRobert Mustacchi\&...
224*7fd79137SRobert Mustacchi.Ed
225*7fd79137SRobert Mustacchi.Pp
226*7fd79137SRobert MustacchiLet's take the first entry in the list above.
227*7fd79137SRobert MustacchiThe symbol is named
228*7fd79137SRobert Mustacchi.Sy hz .
229*7fd79137SRobert MustacchiIt is the first data object, as indicated by the number zero in
230*7fd79137SRobert Mustacchibrackets.
231*7fd79137SRobert MustacchiIt has a type id of 13 and in this case, it has a symbol table index of
232*7fd79137SRobert Mustacchi48.
233*7fd79137SRobert Mustacchi.Ss Functions
234*7fd79137SRobert MustacchiThis section describes the type information for functions.
235*7fd79137SRobert MustacchiFor each function present in the symbol table with type information, the
236*7fd79137SRobert Mustacchifunction's entry into the function section, the function's name, the
237*7fd79137SRobert Mustacchifunction's symbol table index, the function's return type, and the types
238*7fd79137SRobert Mustacchiof the function's arguments are printed.
239*7fd79137SRobert MustacchiIf a function is a variadic function, then the variadic argument is
240*7fd79137SRobert Mustacchiprinted as the string
241*7fd79137SRobert Mustacchi.Sy '...' .
242*7fd79137SRobert Mustacchi.Pp
243*7fd79137SRobert MustacchiTake for example, the following couple of entries:
244*7fd79137SRobert Mustacchi.Bd -literal
245*7fd79137SRobert Mustacchi\&...
246*7fd79137SRobert Mustacchi  [687] pfprint_stack (3110) returns: 11 args: (385, 115, 29, 1704, 223, 116, 2)
247*7fd79137SRobert Mustacchi  [688] pfprint_stddev (3111) returns: 11 args: (385, 115, 29, 1704, 223, 116, 2)
248*7fd79137SRobert Mustacchi  [689] pfprint_quantize (3112) returns: 11 args: (385, 115, 29, 1704, 223, 116, 2)
249*7fd79137SRobert Mustacchi  [690] pfprint_lquantize (3113) returns: 11 args: (385, 115, 29, 1704, 223, 116, 2)
250*7fd79137SRobert Mustacchi  [691] pfprint_llquantize (3114) returns: 11 args: (385, 115, 29, 1704, 223, 116, 2)
251*7fd79137SRobert Mustacchi\&...
252*7fd79137SRobert Mustacchi.Ed
253*7fd79137SRobert Mustacchi.Pp
254*7fd79137SRobert MustacchiThe first column is the function's entry number in the function type
255*7fd79137SRobert Mustacchiinformation section.
256*7fd79137SRobert MustacchiIt is enclosed in brackets.
257*7fd79137SRobert MustacchiThe next column is the function's name and it is followed in parenthesis
258*7fd79137SRobert Mustacchiby the its index in the
259*7fd79137SRobert Mustacchisymbol table.
260*7fd79137SRobert MustacchiThe following portions of this entry describe the return
261*7fd79137SRobert Mustacchitype and then all of the arguments, in positional order.
262*7fd79137SRobert Mustacchi.Ss Types
263*7fd79137SRobert MustacchiThe types section gives information about each type in the
264*7fd79137SRobert Mustacchi.Sy CTF
265*7fd79137SRobert Mustacchicontainer.
266*7fd79137SRobert MustacchiEach entry begins with its type identifier.
267*7fd79137SRobert MustacchiThe type identifier may either be in square brackets or in angle
268*7fd79137SRobert Mustacchibrackets.
269*7fd79137SRobert MustacchiIf the type identifier is enclosed in angle brackets, then that
270*7fd79137SRobert Mustacchirepresents that it is a root type or top-level type.
271*7fd79137SRobert MustacchiIf it is square brackets, then it is not.
272*7fd79137SRobert MustacchiFor more information on root types, see
273*7fd79137SRobert Mustacchi.Xr ctf 4 .
274*7fd79137SRobert Mustacchi.Pp
275*7fd79137SRobert MustacchiNext, the type will have its name and kind.
276*7fd79137SRobert MustacchiIf it is an array, it will be followed with a subscript that describes
277*7fd79137SRobert Mustacchithe number of entries in the array.
278*7fd79137SRobert MustacchiIf it is a pointer, it will followed by the
279*7fd79137SRobert Mustacchi.Sy *
280*7fd79137SRobert Mustacchisymbol to indicate that it is a pointer.
281*7fd79137SRobert MustacchiIf the type has the
282*7fd79137SRobert Mustacchi.Sy const ,
283*7fd79137SRobert Mustacchi.Sy volatile ,
284*7fd79137SRobert Mustacchi.Sy typedef ,
285*7fd79137SRobert Mustacchior
286*7fd79137SRobert Mustacchi.Sy restrict
287*7fd79137SRobert Mustacchikeyword applied to it, that will precede the name.
288*7fd79137SRobert MustacchiAll of these reference types, including pointer, will then be followed
289*7fd79137SRobert Mustacchiwith an example of the type that they refer to.
290*7fd79137SRobert Mustacchi.Pp
291*7fd79137SRobert MustacchiTypes which are an integral or floating point value will be followed by
292*7fd79137SRobert Mustacchiinformation about their encoding and the number of bits represented in
293*7fd79137SRobert Mustacchithe type.
294*7fd79137SRobert Mustacchi.Pp
295*7fd79137SRobert MustacchiArrays will be followed by two different entries, the contents and
296*7fd79137SRobert Mustacchiindex.
297*7fd79137SRobert MustacchiThe contents member contains the type id of the array's contents
298*7fd79137SRobert Mustacchiand the index member describes a type which can represent the array's
299*7fd79137SRobert Mustacchiindex.
300*7fd79137SRobert Mustacchi.Pp
301*7fd79137SRobert MustacchiStructures and unions will be preceded with the corresponding C keyword,
302*7fd79137SRobert Mustacchi.Sy struct
303*7fd79137SRobert Mustacchior
304*7fd79137SRobert Mustacchi.Sy union .
305*7fd79137SRobert MustacchiAfter that, the size in bytes of the structure will be indicated.
306*7fd79137SRobert MustacchiON each subsequent line, a single member will be listed.
307*7fd79137SRobert MustacchiThat line will contain the member's name, it's type identifier, and the
308*7fd79137SRobert Mustacchioffset into the structure that it can be found in, in bits.
309*7fd79137SRobert Mustacchi.Pp
310*7fd79137SRobert MustacchiThe following show examples of type information for all of these
311*7fd79137SRobert Mustacchidifferent types:
312*7fd79137SRobert Mustacchi.Bd -literal
313*7fd79137SRobert Mustacchi\&...
314*7fd79137SRobert Mustacchi  [5] char [12] contents: 1, index: 2
315*7fd79137SRobert Mustacchi  [6] short encoding=SIGNED offset=0 bits=16
316*7fd79137SRobert Mustacchi  <7> struct exit_status (4 bytes)
317*7fd79137SRobert Mustacchi        e_termination type=6 off=0
318*7fd79137SRobert Mustacchi        e_exit type=6 off=16
319*7fd79137SRobert Mustacchi
320*7fd79137SRobert Mustacchi  <8> typedef time_t refers to 2
321*7fd79137SRobert Mustacchi  <9> struct utmp (36 bytes)
322*7fd79137SRobert Mustacchi        ut_user type=3 off=0
323*7fd79137SRobert Mustacchi        ut_id type=4 off=64
324*7fd79137SRobert Mustacchi        ut_line type=5 off=96
325*7fd79137SRobert Mustacchi        ut_pid type=6 off=192
326*7fd79137SRobert Mustacchi        ut_type type=6 off=208
327*7fd79137SRobert Mustacchi        ut_exit type=7 off=224
328*7fd79137SRobert Mustacchi        ut_time type=8 off=256
329*7fd79137SRobert Mustacchi
330*7fd79137SRobert Mustacchi  <10> struct utmp * refers to 9
331*7fd79137SRobert Mustacchi  [11] const struct utmp refers to 9
332*7fd79137SRobert Mustacchi  [12] const struct utmp * refers to 11
333*7fd79137SRobert Mustacchi  <13> int encoding=SIGNED offset=0 bits=32
334*7fd79137SRobert Mustacchi  <14> typedef int32_t refers to 13
335*7fd79137SRobert Mustacchi\&...
336*7fd79137SRobert Mustacchi.Ed
337*7fd79137SRobert Mustacchi.Ss String Table
338*7fd79137SRobert MustacchiThis section describes all of the strings that are present in the
339*7fd79137SRobert Mustacchi.Sy CTF
340*7fd79137SRobert Mustacchicontainer.
341*7fd79137SRobert MustacchiEach line represents an entry in the string table.
342*7fd79137SRobert MustacchiFirst the byte offset into the string table is shown in brackets and
343*7fd79137SRobert Mustacchithen the
344*7fd79137SRobert Mustacchistring's value is displayed.
345*7fd79137SRobert MustacchiNote the following examples:
346*7fd79137SRobert Mustacchi.Bd -literal
347*7fd79137SRobert Mustacchi  [0] \0
348*7fd79137SRobert Mustacchi  [1] joyent_20151001T070028Z
349*7fd79137SRobert Mustacchi  [25] char
350*7fd79137SRobert Mustacchi  [30] long
351*7fd79137SRobert Mustacchi  [35] short
352*7fd79137SRobert Mustacchi.Ed
353*7fd79137SRobert Mustacchi.Ss Statistics
354*7fd79137SRobert MustacchiThis section contains miscellaneous statistics about the
355*7fd79137SRobert Mustacchi.Sy CTF
356*7fd79137SRobert Mustacchidata present.
357*7fd79137SRobert MustacchiEach line contains a single statistic.
358*7fd79137SRobert MustacchiA brief explanation of the statistic is placed first, followed by an
359*7fd79137SRobert Mustacchiequals sign, and then finally the value.
360*7fd79137SRobert Mustacchi.Sh EXIT STATUS
361*7fd79137SRobert Mustacchi.Bl -inset
362*7fd79137SRobert Mustacchi.It Sy 0
363*7fd79137SRobert Mustacchi.Dl Execution completed successfully.
364*7fd79137SRobert Mustacchi.It Sy 1
365*7fd79137SRobert Mustacchi.Dl A fatal error occurred.
366*7fd79137SRobert Mustacchi.It Sy 2
367*7fd79137SRobert Mustacchi.Dl Invalid command line options were specified.
368*7fd79137SRobert Mustacchi.El
369*7fd79137SRobert Mustacchi.Sh EXAMPLES
370*7fd79137SRobert Mustacchi.Sy Example 1
371*7fd79137SRobert MustacchiDisplaying the Type Section of a Single File
372*7fd79137SRobert Mustacchi.Lp
373*7fd79137SRobert MustacchiThe following example dumps the type section of the file
374*7fd79137SRobert Mustacchi.Sy /usr/lib/libc.so.1 .
375*7fd79137SRobert Mustacchi.Bd -literal -offset 6n
376*7fd79137SRobert Mustacchi$ ctfdump -t /usr/lib/libc.so.1
377*7fd79137SRobert Mustacchi- Types ----------------------------------------------------
378*7fd79137SRobert Mustacchi
379*7fd79137SRobert Mustacchi  <1> int encoding=SIGNED offset=0 bits=32
380*7fd79137SRobert Mustacchi  <2> long encoding=SIGNED offset=0 bits=32
381*7fd79137SRobert Mustacchi  <3> typedef pid_t refers to 2
382*7fd79137SRobert Mustacchi  <4> unsigned int encoding=0x0 offset=0 bits=32
383*7fd79137SRobert Mustacchi  <5> typedef uid_t refers to 4
384*7fd79137SRobert Mustacchi  <6> typedef gid_t refers to 5
385*7fd79137SRobert Mustacchi  <7> typedef uintptr_t refers to 4
386*7fd79137SRobert Mustacchi\&...
387*7fd79137SRobert Mustacchi.Ed
388*7fd79137SRobert Mustacchi.Lp
389*7fd79137SRobert Mustacchi.Sy Example 2
390*7fd79137SRobert MustacchiDumping the CTF data to Another File
391*7fd79137SRobert Mustacchi.Lp
392*7fd79137SRobert MustacchiThe following example dumps the entire CTF data from the file
393*7fd79137SRobert Mustacchi.Sy /usr/lib/libc.so.1
394*7fd79137SRobert Mustacchiand places it into the file
395*7fd79137SRobert Mustacchi.Sy ctf.out .
396*7fd79137SRobert MustacchiThis then shows how you can use the
397*7fd79137SRobert Mustacchi.Xr mdb 1
398*7fd79137SRobert Mustacchito inspect its contents.
399*7fd79137SRobert Mustacchi.Bd -literal -offset 6n
400*7fd79137SRobert Mustacchi$ ctfdump -u ctf.out /usr/lib/libc.so.1
401*7fd79137SRobert Mustacchi$ mdb ./ctf.out
402*7fd79137SRobert Mustacchi> ::typedef -r /usr/lib/libctf.so.1
403*7fd79137SRobert Mustacchi> 0::print ctf_header_t
404*7fd79137SRobert Mustacchi{
405*7fd79137SRobert Mustacchi    cth_preamble = {
406*7fd79137SRobert Mustacchi        ctp_magic = 0xcff1
407*7fd79137SRobert Mustacchi        ctp_version = 0x2
408*7fd79137SRobert Mustacchi        ctp_flags = 0
409*7fd79137SRobert Mustacchi    }
410*7fd79137SRobert Mustacchi    cth_parlabel = 0
411*7fd79137SRobert Mustacchi    cth_parname = 0
412*7fd79137SRobert Mustacchi    cth_lbloff = 0
413*7fd79137SRobert Mustacchi    cth_objtoff = 0x8
414*7fd79137SRobert Mustacchi    cth_funcoff = 0x5e0
415*7fd79137SRobert Mustacchi    cth_typeoff = 0x7178
416*7fd79137SRobert Mustacchi    cth_stroff = 0x12964
417*7fd79137SRobert Mustacchi    cth_strlen = 0x7c9c
418*7fd79137SRobert Mustacchi}
419*7fd79137SRobert Mustacchi.Ed
420*7fd79137SRobert Mustacchi.Lp
421*7fd79137SRobert Mustacchi.Sy Example 3
422*7fd79137SRobert MustacchiDumping C-style output
423*7fd79137SRobert Mustacchi.Bd -literal -offset 6n
424*7fd79137SRobert Mustacchi$ ctfdump -c ./genunix | more
425*7fd79137SRobert Mustacchi/* Types */
426*7fd79137SRobert Mustacchi
427*7fd79137SRobert Mustacchitypedef Elf64_Addr Addr;
428*7fd79137SRobert Mustacchi
429*7fd79137SRobert Mustacchitypedef unsigned char Bool;
430*7fd79137SRobert Mustacchi
431*7fd79137SRobert Mustacchitypedef struct CK_AES_CCM_PARAMS CK_AES_CCM_PARAMS;
432*7fd79137SRobert Mustacchi
433*7fd79137SRobert Mustacchitypedef struct CK_AES_GCM_PARAMS CK_AES_GCM_PARAMS;
434*7fd79137SRobert Mustacchi\&...
435*7fd79137SRobert Mustacchi.Ed
436*7fd79137SRobert Mustacchi.Sh INTERFACE STABILITY
437*7fd79137SRobert MustacchiThe command syntax is
438*7fd79137SRobert Mustacchi.Sy Committed .
439*7fd79137SRobert MustacchiThe output format is
440*7fd79137SRobert Mustacchi.Sy Uncommitted .
441*7fd79137SRobert Mustacchi.Sh SEE ALSO
442*7fd79137SRobert Mustacchi.Xr ctfdiff 1 ,
443*7fd79137SRobert Mustacchi.Xr dump 1 ,
444*7fd79137SRobert Mustacchi.Xr elfdump 1 ,
445*7fd79137SRobert Mustacchi.Xr mdb 1 ,
446*7fd79137SRobert Mustacchi.Xr ctf 4
447