summaryrefslogtreecommitdiffstats
path: root/rtemstoolkit/elftoolchain/libdwarf/dwarf.3
blob: 863bee6dcfdf54b35c72c7111386994716d8979e (plain) (blame)
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
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
.\" Copyright (c) 2011 Joseph Koshy.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" This software is provided by Joseph Koshy ``as is'' and
.\" any express or implied warranties, including, but not limited to, the
.\" implied warranties of merchantability and fitness for a particular purpose
.\" are disclaimed.  in no event shall Joseph Koshy be liable
.\" for any direct, indirect, incidental, special, exemplary, or consequential
.\" damages (including, but not limited to, procurement of substitute goods
.\" or services; loss of use, data, or profits; or business interruption)
.\" however caused and on any theory of liability, whether in contract, strict
.\" liability, or tort (including negligence or otherwise) arising in any way
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
.\" $Id: dwarf.3 3295 2016-01-08 22:08:10Z jkoshy $
.\"
.Dd December 21, 2014
.Os
.Dt DWARF 3
.Sh NAME
.Nm dwarf
.Nd access debugging information in object files
.Sh LIBRARY
.Lb libdwarf
.Sh SYNOPSIS
.In libdwarf.h
.Sh DESCRIPTION
.Pp
The
.Lb libdwarf
provides functions that allow an application to read and write debugging
information in object files.
The format of debugging information accessible through this API
is defined by the DWARF standard, see
.Xr dwarf 4 .
.Pp
The
.Xr DWARF 3
API has two parts:
.Bl -bullet
.It
A consumer API set allows applications to read existing debug information
in a program object.
The functions that comprise the DWARF consumer API are described in
the section
.Sx "DWARF Consumer API"
below.
.It
A producer API set that allows applications to add debug information
to a program object.
The functions that comprise the DWARF producer API are described in
the section
.Sx "DWARF Producer API"
below.
.El
.Pp
Each function referenced below is further described in its own manual page.
.Ss Namespace use
The DWARF library uses the following prefixes:
.Pp
.Bl -tag -width ".Li Dwarf_*" -compact
.It Li DWARF_*
Used for error numbers and constants.
.It Li DW_*
Used for constants.
.It Li Dwarf_*
Used for types.
.It Li dwarf_*
Used for functions and macros that make up the API.
.El
.Ss Data Types
The DWARF(3) API uses the following data types:
.Pp
.Bl -tag -width ".Vt Dwarf_Unsigned" -compact
.It Vt Dwarf_Abbrev
Describes DWARF abbreviations.
.It Vt Dwarf_Addr
A program address in the target object.
.It Vt Dwarf_Arange
Describes address ranges.
.It Vt Dwarf_Attribute , Vt Dwarf_P_Attribute
Describes attributes of debugging information entries.
.It Vt Dwarf_Bool
Used for boolean states.
.It Vt Dwarf_Cie , Vt Dwarf_P_Cie
Describes call information that is common to several frames.
.It Vt Dwarf_Debug , Vt Dwarf_P_Debug
An opaque type describing a debug context.
.It Vt Dwarf_Die , Vt Dwarf_P_Die
A debugging information entry.
.It Vt Dwarf_Fde , Vt Dwarf_P_Fde
A frame descriptor.
.It Vt Dwarf_Func
A descriptor representing a function.
.It Vt Dwarf_Global
A descriptor representing a global name.
.It Vt Dwarf_Half
A 16-bit wide unsigned numeric type.
.It Vt Dwarf_Handler
A pointer to an error handling function.
.It Vt Dwarf_Line
A descriptor for a source line.
.It Vt Dwarf_Off
An unsigned file offset.
.It Vt Dwarf_P_Expr
A descriptor for a location expression.
.It Vt Dwarf_Ptr
A virtual address used by an application.
.It Vt Dwarf_Signed
A 64-bit wide signed numeric type.
.It Vt Dwarf_Small
An 8-bit wide unsigned numeric type.
.It Vt Dwarf_Type
A descriptor representing a user-specified type.
.It Vt Dwarf_Unsigned
A 64-bit wide unsigned numeric type.
.It Vt Dwarf_Var
A descriptor representing a static variable.
.It Vt Dwarf_Weak
A descriptor representing a weak name.
.El
.Ss Error Handling
.Pp
Library functions that encounter an error will return with a value
other than
.Dv DW_DLV_OK .
.Pp
The
.Lb libdwarf
allows applications to specify three levels of error handling:
.Bl -enum -compact
.It
Most library functions take a parameter of type
.Vt Dwarf_Error
that specifies a location to store an error descriptor in
case of an error.
If an error occurs during the execution on an API, and if this
parameter is non-NULL, then an error descriptor is written to the
location specified.
.It
Otherwise, if the error parameter was NULL, but if an error handler
was defined for the debug context in use using
.Xr dwarf_init 3
or
.Xr dwarf_seterrhand 3 ,
then the library will invoke the specified error handler with an error
descriptor as argument.
.It
Otherwise, if a library wide error handler was specified using
.Xr dwarf_seterrhand 3 ,
it is called.
.El
.Pp
Error descriptors may be used with
.Xr dwarf_errmsg 3
or
.Xr dwarf_errno 3 .
.Sh The DWARF Consumer API
The DWARF consumer API permits applications to read DWARF information in
an object file.
.Pp
The major functional groups of functions in the consumer API are listed
below.
.Pp
.Bl -tag -compact -width "CCCC"
.It Abbreviations
.Bl -tag -compact
.It Fn dwarf_get_abbrev
Retrieve abbreviation information at a given offset.
.It Fn dwarf_get_abbrev_children_flag
Check if an abbreviation has child elements.
.It Fn dwarf_get_abbrev_code
Retrieve the abbreviation code for an abbreviation entry descriptor.
.It Fn dwarf_get_abbrev_entry
Retrieve abbreviation information for an abbreviation entry
descriptor.
.It Fn dwarf_get_abbrev_tag
Retrieve the tag for an abbreviation entry.
.El
.It Addresses
.Bl -tag -compact
.It Fn dwarf_get_address_size
Return the number of bytes needed to represent an address.
.It Fn dwarf_get_arange
Search for an address range descriptor covering an address.
.It Fn dwarf_get_arange_cu_header_offset
Retrieve the offsets associated with an address range descriptor.
.It Fn dwarf_get_arange_info
Extract address range information from a descriptor.
.It Fn dwarf_get_aranges
Retrieve program address space mappings.
.It Fn dwarf_get_cu_die_offset
Retrieve the offset associated with a compilation unit for an address
range descriptor.
.It Fn dwarf_get_ranges , Fn dwarf_get_ranges_a
Retrieve information about non-contiguous address ranges for
a debugging information entry.
.El
.It Attributes
.Bl -tag -compact
.It Fn dwarf_arrayorder
Retrieve the value of a
.Dv DW_AT_ordering
attribute.
.It Fn dwarf_attr
Retrieve an attribute descriptor.
.It Fn dwarf_attrlist
Retrieve attribute descriptors for a debugging information entry.
.It Fn dwarf_attroffset
Retrieve the section-relative offset of an attribute descriptor.
.It Fn dwarf_attrval_flag
Retrieve a
.Dv DW_AT_FORM_flag
value.
.It Fn dwarf_attrval_signed
Retrieve an attribute's value as a signed integral quantity.
.It Fn dwarf_attrval_string
Retrieve an attribute's value as a NUL-terminated string.
.It Fn dwarf_attrval_unsigned
Retrieve an attribute's value as an unsigned integral quantity.
.It Fn dwarf_bitoffset ,
Retrieve the value of a
.Dv DW_AT_bit_offset
attribute.
.It Fn dwarf_bitsize ,
Retrieve the value of a
.Dv DW_AT_bit_size
attribute.
.It Fn dwarf_bytesize
Retrieve the value of a
.Dv DW_AT_byte_size
attribute.
.It Fn dwarf_formaddr
Return the value of an
.Dv ADDRESS Ns - Ns
class attribute.
.It Fn dwarf_formblock
Return the value of a
.Dv BLOCK Ns - Ns
class attribute
.It Fn dwarf_formexprloc
Return information about a location expression.
.It Fn dwarf_formflag
Retrieve information about a
.Dv BOOLEAN Ns - Ns
class attribute.
.It Fn dwarf_formref , Fn dwarf_global_formref
Retrieve offsets for
.Dv REFERENCE Ns - Ns
class attributes.
.It Fn dwarf_formsdata , Fn dwarf_formudata
Retrieve the value of a
.Dv CONSTANT Ns - Ns
class attribute.
.It Fn dwarf_formsig8
Return the type signature for a DWARF type.
.It Fn dwarf_formstring
Retrieve information about a
.Dv STRING Ns - Ns
class attribute.
.It Fn dwarf_get_form_class
Retrieve the form class for an attribute.
.It Fn dwarf_hasattr
Check for the presence of an attribute.
.It Fn dwarf_hasform
Check if an attribute has the given form.
.It Fn dwarf_whatattr
Retrieve the attribute code for an attribute.
.It Fn dwarf_whatform , Fn dwarf_whatform_direct
Retrieve the form of an attribute.
.El
.It Call Information Entries and Frame Descriptor Entries
.Bl -tag -compact
.It Fn dwarf_get_cie_index
Retrieve the index for a CIE descriptor.
.It Fn dwarf_get_cie_info
Retrieve information from a CIE descriptor.
.It Fn dwarf_get_cie_of_fde
Retrieve a CIE descriptor.
.It Fn dwarf_get_fde_at_pc
Retrieve an FDE descriptor for an address.
.It Fn dwarf_get_fde_info_for_all_regs
Retrieve register rule row.
.It Fn dwarf_get_fde_info_for_all_regs3
Retrieve register rule row (revised API).
.It Fn dwarf_get_fde_info_for_cfa_reg3
Retrieve a CFA register rule.
.It Fn dwarf_get_fde_info_for_reg
Retrieve a register rule.
.It Fn dwarf_get_fde_info_for_reg3
Retrieve a register rule (revised API).
.It Fn dwarf_get_fde_instr_bytes
Retrieve instructions from an FDE descriptor.
.It Fn dwarf_get_fde_list , Fn dwarf_get_fde_list_eh
Retrieve frame information.
.It Fn dwarf_get_fde_n
Retrieve an FDE descriptor.
.It Fn dwarf_get_fde_range
Retrieve range information from an FDE descriptor.
.El
.It Compilation Units
.Bl -tag -compact
.It Xo
.Fn dwarf_get_cu_die_offset_given_cu_header_offset ,
.Fn dwarf_get_cu_die_offset_given_cu_header_offset_b
.Xc
Retrieve the offset of the debugging information entry for a
compilation or type unit.
.It Xo
.Fn dwarf_next_cu_header ,
.Fn dwarf_next_cu_header_b ,
.Fn dwarf_next_cu_header_c
.Xc
Step through compilation units in a debug context.
.El
.It Debugging Information Entries
.Bl -tag -compact
.It Fn dwarf_child
Returns the child of a debugging information entry.
.It Fn dwarf_die_abbrev_code
Returns the abbreviation code for a debugging information entry.
.It Fn dwarf_die_CU_offset , Fn dwarf_die_CU_offset_range
Retrieve offsets and lengths for a compilation unit.
.It Fn dwarf_diename
Returns the
.Dv DW_AT_name
attribute for a debugging information entry.
.It Fn dwarf_dieoffset
Retrieves the offset for a debugging information entry.
.It Fn dwarf_get_die_infotypes_flag
Indicate the originating section for a debugging information entry.
.It Fn dwarf_highpc , Fn dwarf_highpc_b
Return the highest PC value for a debugging information entry.
.It Fn dwarf_lowpc
Return the lowest PC value for a debugging information entry.
.It Fn dwarf_offdie , Fn dwarf_offdie_b
Retrieve a debugging information entry given an offset.
.It Fn dwarf_siblingof , Fn dwarf_siblingof_b
Retrieve the sibling descriptor for a debugging information entry.
.It Fn dwarf_srclang
Retrieve the source language attribute for a debugging information
entry.
.It Fn dwarf_tag
Retrieve the tag for a debugging information entry.
.El
.It Functions
.Bl -tag -compact
.It Fn dwarf_func_cu_offset
Retrieves the offset for the compilation unit for a function.
.It Fn dwarf_func_die_offset
Retrieves the offset for the debugging information entry for a
function.
.It Fn dwarf_funcname
Retrieves the name of a function.
.It Fn dwarf_func_name_offsets
Retrieve both the name and offsets for a function.
.It Fn dwarf_get_funcs
Retrieve information about static functions.
.El
.It Globals
.Bl -tag -compact
.It Fn dwarf_get_globals
Retrieve a list of globals.
.It Fn dwarf_global_cu_offset
Return the offset for compilation unit for a global.
.It Fn dwarf_global_die_offset
Return the offset for the debugging information entry for a global.
.It Fn dwarf_global_name_offsets
Return the name and offsets for a global.
.It Fn dwarf_globname
Return the name for a global.
.El
.It Initialization and Finalization
Functions
.Fn dwarf_elf_init
and
.Fn dwarf_init
may be used for initialization.
The function
.Fn dwarf_finish
may be used to release resources.
.Pp
The functions
.Fn dwarf_object_init
and
.Fn dwarf_object_finish
allow an application to specify alternate low-level file access
routines.
.It Line Numbers
.Bl -tag -compact
.It Fn dwarf_lineaddr
Retrieve the program address for a source line.
.It Fn dwarf_linebeginstatement
Check if a source line corresponds to the beginning of a statement.
.It Fn dwarf_lineblock
Check if a source line corresponds to the start of a basic block.
.It Fn dwarf_lineendsequence
Check if the source line corresponds to the end of a sequence of
instructions.
.It Fn dwarf_lineno
Retrieve the line number for a line descriptor.
.It Fn dwarf_lineoff
Retrieve the column number for a line descriptor.
.It Fn dwarf_linesrc
Retrieve the source file for a line descriptor.
.It Fn dwarf_line_srcfileno
Retrieve the index of the source file for a line descriptor.
.It Fn dwarf_srcfiles
Retrieve source files for a compilation unit.
.It Fn dwarf_srclines
Return line number information for a compilation unit.
.El
.It Location Lists
.Bl -tag -compact
.It Fn dwarf_get_loclist_entry
Retrieve a location list entry.
.It Fn dwarf_loclist , Fn dwarf_loclist_n
Retrieve location expressions.
.It Xo
.Fn dwarf_loclist_from_expr ,
.Fn dwarf_loclist_from_expr_a ,
.Fn dwarf_loclist_from_expr_b
.Xc
Translate a location expression into a location descriptor.
.El
.It Error Handling
.Bl -tag -compact
.It Fn dwarf_errmsg
Retrieve a human-readable error message.
.It Fn dwarf_errno
Retrieve an error number from an error descriptor.
.It Fn dwarf_seterrarg
Set the argument passed to a callback error handler.
.It Fn dwarf_seterrhand
Set the callback handler to be called in case of an error.
.El
.It Frame Handling
.Bl -tag -compact
.It Fn dwarf_expand_frame_instructions
Translate frame instruction bytes.
.It Fn dwarf_set_frame_cfa_value
Set the CFA parameter for the internal register rule table.
.It Fn dwarf_set_frame_rule_initial_value
Set the initial value of the register rules in the internal register
rule table.
.It Fn dwarf_set_frame_rule_table_size
Set the maximum number of columns in the register rule table.
.It Fn dwarf_set_frame_same_value
Set the register number representing the
.Dq "same value"
rule.
.It Fn dwarf_set_frame_undefined_value
Set the register number representing the
.Dq "undefined"
rule.
.El
.It Macros
.Bl -tag -compact
.It Fn dwarf_find_macro_value_start
Return the macro value part of a macro string.
.It Fn dwarf_get_macro_details
Retrieve macro information.
.El
.It Memory Management
In the DWARF consumer API, the rules for memory management differ
between functions.
In some cases, the memory areas returned to the application by the
library are freed by calling specific API functions.
In others, the deallocation function
.Fn dwarf_dealloc
suffices.
The individual manual pages for the API's functions document the
specific memory management rules to be followed.
.Pp
The function
.Fn dwarf_dealloc
is used to mark memory arenas as unused.
Additionally, the following functions release specific types of
DWARF resources:
.Fn dwarf_fde_cie_list_dealloc ,
.Fn dwarf_funcs_dealloc ,
.Fn dwarf_globals_dealloc ,
.Fn dwarf_pubtypes_dealloc ,
.Fn dwarf_ranges_dealloc ,
.Fn dwarf_srclines_dealloc ,
.Fn dwarf_types_dealloc ,
.Fn dwarf_vars_dealloc ,
and
.Fn dwarf_weaks_dealloc .
.It Symbol Constants
The following functions may be used to return symbolic names
for DWARF constants:
.Fn dwarf_get_ACCESS_name ,
.Fn dwarf_get_AT_name ,
.Fn dwarf_get_ATE_name ,
.Fn dwarf_get_CC_name ,
.Fn dwarf_get_CFA_name ,
.Fn dwarf_get_CHILDREN_name ,
.Fn dwarf_get_DS_name ,
.Fn dwarf_get_DSC_name ,
.Fn dwarf_get_EH_name ,
.Fn dwarf_get_END_name ,
.Fn dwarf_get_FORM_name ,
.Fn dwarf_get_ID_name ,
.Fn dwarf_get_INL_name ,
.Fn dwarf_get_LANG_name ,
.Fn dwarf_get_LNE_name ,
.Fn dwarf_get_LNS_name ,
.Fn dwarf_get_MACINFO_name ,
.Fn dwarf_get_OP_name ,
.Fn dwarf_get_ORD_name ,
.Fn dwarf_get_TAG_name ,
.Fn dwarf_get_VIRTUALITY_name ,
and
.Fn dwarf_get_VIS_name .
.It Types
.Bl -tag -compact
.It Fn dwarf_get_pubtypes , Fn dwarf_get_types
Retrieve descriptors for user-defined types.
.It Fn dwarf_next_types_section
Step through
.Dq \&.debug_types
sections in a debug context.
.It Fn dwarf_pubtype_cu_offset , Fn dwarf_type_cu_offset
Return the offset for the compilation unit for a type.
.It Fn dwarf_pubtype_die_offset , Fn dwarf_type_die_offset
Return the offset for the debugging information entry for a type.
.It Fn dwarf_pubtypename , Fn dwarf_typename
Retrieve the name of a type.
.It Fn dwarf_pubtype_name_offsets , Fn dwarf_type_name_offsets
Retrieve the name and offsets for a type.
.El
.It Variables
.Bl -tag -compact
.It Fn dwarf_get_vars
Retrieve descriptors for static variables.
.It Fn dwarf_var_cu_offset
Return the offset for the compilation unit for a variable.
.It Fn dwarf_var_die_offset
Return the offset for the debugging information entry for a variable.
.It Fn dwarf_varname
Retrieve the name of a variable.
.It Fn dwarf_var_name_offsets
Retrieve the name and offsets for a variable.
.El
.It Weak Symbols
.Bl -tag -compact
.It Fn dwarf_get_weaks
Retrieve information about weak symbols.
.It Fn dwarf_weak_cu_offset
Return the offset for the compilation unit for a weak symbol.
.It Fn dwarf_weak_die_offset
Return the offset for the debugging information entry for a weak symbol.
.It Fn dwarf_weakname
Retrieve the name of a weak symbol.
.It Fn dwarf_weak_name_offsets
Retrieve the name and offsets for a weak symbol.
.El
.It Miscellaneous
.Bl -tag -compact
.It Fn dwarf_get_elf
Retrieve the ELF descriptor for a debug context, see
.Xr elf 3 .
.It Fn dwarf_get_str
Retrieve a NUL-terminated string from the DWARF string section.
.It Fn dwarf_set_reloc_application
Control whether relocations are to be handled by
.Lb libdwarf .
.El
.El
.Sh The DWARF Producer API
The DWARF producer API permits applications to add DWARF information to
an object file.
.Pp
The major functional groups of functions in the producer API are listed
below.
.Bl -tag -width "CCCC"
.It Attribute Management
The following functions are used to attach attributes to a debugging
information entry:
.Fn dwarf_add_AT_comp_dir ,
.Fn dwarf_add_AT_const_value_signedint ,
.Fn dwarf_add_AT_const_value_string ,
.Fn dwarf_add_AT_const_value_unsignedint ,
.Fn dwarf_add_AT_dataref ,
.Fn dwarf_add_AT_flag ,
.Fn dwarf_add_AT_location_expr ,
.Fn dwarf_add_AT_name ,
.Fn dwarf_add_AT_producer ,
.Fn dwarf_add_AT_ref_address ,
.Fn dwarf_add_AT_reference ,
.Fn dwarf_add_AT_signed_const ,
.Fn dwarf_add_AT_string ,
.Fn dwarf_add_AT_targ_address ,
.Fn dwarf_add_AT_targ_address_b
and
.Fn dwarf_add_AT_unsigned_const .
.It Debugging Information Entry Management
.Bl -tag -compact
.It Fn dwarf_add_die_to_debug
Set the root debugging information entry for a DWARF producer instance.
.It Fn dwarf_die_link
Links debugging information entries.
.It Fn dwarf_new_die
Allocate a new debugging information entry.
.El
.It Initialization and Finalization
The functions
.Fn dwarf_producer_init
and
.Fn dwarf_producer_init_b
are used to initialize a producer instance.
.Pp
When done, applications release resources using the function
.Fn dwarf_producer_finish .
.It Relocations and Sections
.Bl -tag -compact
.It Fn dwarf_get_relocation_info
Retrieve a relocation array from a producer instance.
.It Fn dwarf_get_relocation_info_count
Return the number of relocation arrays for a producer instance.
.It Fn dwarf_get_section_bytes
Retrieve the ELF byte stream for a section.
.It Fn dwarf_reset_section_bytes
Reset internal state for a producer instance.
.It Fn dwarf_transform_to_disk_form
Prepare byte streams for writing out.
.El
.It Macros
.Bl -tag -compact
.It Fn dwarf_def_macro
Add a macro definition.
.It Fn dwarf_end_macro_file , Fn dwarf_start_macro_file
Record macro file related information.
.It Fn dwarf_undef_macro
Note the removal of a macro definition.
.It Fn dwarf_vendor_ext
Enables storing macro information as specified in the DWARF standard.
.El
.It Symbols, Expressions, Addresses and Offsets
.Bl -tag -compact
.It Fn dwarf_add_arange , Fn dwarf_add_arange_b
Add address range information.
.It Fn dwarf_add_directory_decl
Add information about an include directory to a producer instance.
.It Fn dwarf_add_fde_inst
Add an operation to a frame descriptor entry.
.It Fn dwarf_add_file_decl
Add information about a source file to a producer instance.
.It Fn dwarf_add_frame_cie
Add call information to a frame descriptor.
.It Fn dwarf_add_frame_fde , Fn dwarf_add_frame_fde_b
Link a frame descriptor to a producer instance.
.It Fn dwarf_add_funcname
Add information about a function to a producer instance.
.It Fn dwarf_add_line_entry
Record mapping information between machine addresses and a source line.
.It Fn dwarf_add_expr_addr , Fn dwarf_add_expr_addr_b
Add a
.Dv DW_OP_addr
opcode to a location expression.
.It Fn dwarf_add_expr_gen
Add an operator to a location expression.
.It Fn dwarf_add_pubname
Add information about a global name to a producer instance.
.It Fn dwarf_add_typename
Add information about a type to a producer instance.
.It Fn dwarf_add_varname
Add information about a static variable to a producer instance.
.It Fn dwarf_add_weakname
Add information about a weak symbol to a producer instance.
.It Fn dwarf_expr_current_offset
Retrieve the current size of a location expression.
.It Fn dwarf_expr_into_block
Convert a location expression into a byte stream.
.It Fn dwarf_fde_cfa_offset
Append a
.Dv DW_CFA_offset
operation to a frame descriptor.
.It Fn dwarf_lne_end_sequence , Fn dwarf_lne_set_address
Note address ranges for source lines.
.It Fn dwarf_new_expr
Allocate a location expression descriptor.
.It Fn dwarf_new_fde
Allocate a frame descriptor.
.El
.It Miscellaneous
The function
.Fn dwarf_producer_set_isa
sets the instruction set architecture for the producer instance.
.El
.Sh COMPATIBILITY
This implementation is believed to be source compatible with the
SGI/GNU DWARF(3) library, version 20110113.
.Pp
Known differences with the SGI/GNU library include:
.Bl -bullet -compact
.It
The memory management scheme used differs, in a backward-compatible
way.
See
.Sx Memory Management
above, for coding guidelines for portable applications.
.It
There is provision for setting a library-wide error handler in
addition to the per-debug context handlers supported by the SGI/GNU
API, see the subsection
.Sx Error Handling
above.
.El
.Ss Extensions
The following APIs are extensions specific to this implementation:
.Bl -bullet -compact
.It
.Fn dwarf_attroffset
.It
.Fn dwarf_next_types_section
.It
.Fn dwarf_producer_set_isa
.El
.Sh SEE ALSO
.Xr elf 3
.Sh STANDARDS
The DWARF standard is defined by
.Rs
.%T "The DWARF Debugging Information Format"
.%V "Version 4"
.%O "http://www.dwarfstd.org/"
.Re
.Sh HISTORY
The DWARF(3) API originated at Silicon Graphics Inc.
.Pp
A BSD-licensed implementation of a subset of the API was written by
.An John Birrell Aq Mt jb@FreeBSD.org
for the FreeBSD project.
The implementation was subsequently revised and completed by
.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net .
.Pp
Manual pages for this implementation were written by
.An Joseph Koshy Aq Mt jkoshy@users.sourceforge.net
and
.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net .