2 .\" This file and its contents are supplied under the terms of the
3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
4 .\" You may only use this file in accordance with the terms of version
7 .\" A full copy of the text of the CDDL should have accompanied this
8 .\" source. A copy of the CDDL is also available via the Internet at
9 .\" http://www.illumos.org/license/CDDL.
12 .\" Copyright (c) 2015, Joyent, Inc.
19 .Nd dump parts of ctf data from files
29 utility dumps and decodes the
31 data contained inside of
38 can dump information about the
50 the types of the return function and the arguments for
52 and of course, it displays information about the
59 can also be used to dump out the raw
61 data and send it to another file. When writing out data, it always
64 data is decompressed. In this form, the
66 data can be inspected using
68 and other tools such as
71 When no options are specified,
73 displays all information. However, when the
75 option is used, then no information is displayed by default, unless
76 requested through the the appropriate option.
78 The following options are supported:
82 Dump the types of symbols that correspond to objects.
86 Dump the types of the return values and arguments of the functions.
98 labels associated with the file.
102 Use the type information in
104 to supplement output. This is useful when a
112 to use the names of types when used with
123 Displays statistics about the
129 Dump the type information contained in the
135 Copies the uncompressed
137 data to the file specified by
139 This can be used to make it easier to inspect the raw
147 utility is executed with its default options, it prints out a textual
148 representation of the
150 information. Note, the output format of
152 is subject to change at any time and should not be relied upon as a
153 stable format to be used for parsing.
155 This section describes the values in the
157 header. Each line in the section describes the value of one of the
158 members of the header. For more information on the meaning and
159 interpretation of these members, see
162 This section describes information about the labels present in the
164 information. Each entry in this section, if present, starts with a
165 number and is followed by a string. An example entry in the label
166 section might look like:
169 2270 joyent_20151001T070028Z
175 represents the last type that the label applies to. The string,
176 .Em joyent_20151001T070028Z ,
177 is the name of the label. In this case, if there were no other labels,
178 it would indicate that the label applied to all types up to, and
179 including, the type number 2270. For more information
180 on how labels are used with
182 information, see the section
183 .Em The Label Section
187 This section describes the type information relating to data objects
188 from the symbol table. An entry for a data object consists of four
189 columns. The first column is just a monotonic ID. The second number is
190 the type id of the object. The third column is the name of the symbol
191 and the fourth column is the corresponding index from the symbol table.
193 Take for example, the following couple of entries:
198 [2] 1656 __pfmt_label (56)
199 [3] 926 _aio_hash (68)
200 [4] 13 _lio_free (70)
201 [5] 1321 u8_number_of_bytes (73)
205 Let's take the first entry in the list above. The symbol is named
207 It is the first data object, as indicated by the number zero in
208 brackets. It has a type id of 13 and in this case, it has a symbol table
211 This section describes the type information for functions. For each
212 function present in the symbol table with type information, the
213 function's entry into the function section, the function's name, the
214 function's symbol table index, the function's return type, and the types
215 of the function's arguments are printed. If a function is a variadic
216 function, then the variadic argument is printed as the string
219 Take for example, the following couple of entries:
222 [687] pfprint_stack (3110) returns: 11 args: (385, 115, 29, 1704, 223, 116, 2)
223 [688] pfprint_stddev (3111) returns: 11 args: (385, 115, 29, 1704, 223, 116, 2)
224 [689] pfprint_quantize (3112) returns: 11 args: (385, 115, 29, 1704, 223, 116, 2)
225 [690] pfprint_lquantize (3113) returns: 11 args: (385, 115, 29, 1704, 223, 116, 2)
226 [691] pfprint_llquantize (3114) returns: 11 args: (385, 115, 29, 1704, 223, 116, 2)
230 The first column is the function's entry number in the function type
231 information section. It is enclosed in brackets. The next column is the
232 function's name and it is followed in parenthesis by the its index in the
233 symbol table. The following portions of this entry describe the return
234 type and then all of the arguments, in positional order.
236 The types section gives information about each type in the
238 container. Each entry begins with its type identifier. The type
239 identifier may either be in square brackets or in angle brackets. If the
240 type identifier is enclosed in angle brackets, then that represents that
241 it is a root type or top-level type. If it is square brackets, then it
242 is not. For more information on root types, see
245 Next, the type will have its name and kind. If it is an array, it will
246 be followed with a subscript that describes the number of entries in the
247 array. If it is a pointer, it will followed by the
249 symbol to indicate that it is a pointer. If the type has the
255 keyword applied to it, that will precede the name. All of these
256 reference types, including pointer, will then be followed with an
257 example of the type that they refer to.
259 Types which are an integral or floating point value will be followed by
260 information about their encoding and the number of bits represented in
263 Arrays will be followed by two different entries, the contents and
264 index. The contents member contains the type id of the array's contents
265 and the index member describes a type which can represent the array's
268 Structures and unions will be preceded with the corresponding C keyword,
272 After that, the size in bytes of the structure will be indicated. ON
273 each subsequent line, a single member will be listed. That line will
274 contain the member's name, it's type identifier, and the offset into the
275 structure that it can be found in, in bits.
277 The following show examples of type information for all of these
281 [5] char [12] contents: 1, index: 2
282 [6] short encoding=SIGNED offset=0 bits=16
283 <7> struct exit_status (4 bytes)
284 e_termination type=6 off=0
287 <8> typedef time_t refers to 2
288 <9> struct utmp (36 bytes)
291 ut_line type=5 off=96
292 ut_pid type=6 off=192
293 ut_type type=6 off=208
294 ut_exit type=7 off=224
295 ut_time type=8 off=256
297 <10> struct utmp * refers to 9
298 [11] const struct utmp refers to 9
299 [12] const struct utmp * refers to 11
300 <13> int encoding=SIGNED offset=0 bits=32
301 <14> typedef int32_t refers to 13
305 This section describes all of the strings that are present in the
307 container. Each line represents an entry in the string table. First the
308 byte offset into the string table is shown in brackets and then the
309 string's value is displayed. Note the following examples:
312 [1] joyent_20151001T070028Z
318 This section contains miscellaneous statistics about the
320 data present. Each line contains a single statistic. A brief explanation
321 of the statistic is placed first, followed by an equals sign, and then
326 .Dl Execution completed successfully.
328 .Dl A fatal error occured.
330 .Dl Invalid command line options were specified.
334 Displaying the Type Section of a Single File
336 The following example dumps the type section of the file
337 .Sy /usr/lib/libc.so.1 .
338 .Bd -literal -offset 6n
339 $ ctfdump -t /usr/lib/libc.so.1
340 - Types ----------------------------------------------------
342 <1> int encoding=SIGNED offset=0 bits=32
343 <2> long encoding=SIGNED offset=0 bits=32
344 <3> typedef pid_t refers to 2
345 <4> unsigned int encoding=0x0 offset=0 bits=32
346 <5> typedef uid_t refers to 4
347 <6> typedef gid_t refers to 5
348 <7> typedef uintptr_t refers to 4
353 Dumping the CTF data to Another File
355 The following example dumps the entire CTF data from the file
356 .Sy /usr/lib/libc.so.1
357 and places it into the file
359 This then shows how you can use the
361 to inspect its contents.
362 .Bd -literal -offset 6n
363 $ ctfdump -u ctf.out /usr/lib/libc.so.1
365 > ::typedef -r /usr/lib/libctf.so.1
366 > 0::print ctf_header_t
383 .Sh INTERFACE STABILITY
384 The command syntax is