-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_libdwarf.h
More file actions
1080 lines (949 loc) · 38.7 KB
/
_libdwarf.h
File metadata and controls
1080 lines (949 loc) · 38.7 KB
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
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*-
* Copyright (c) 2007 John Birrell (jb@freebsd.org)
* Copyright (c) 2009-2011 Kai Wang
* 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 THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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.
*/
#ifndef __LIBDWARF_H_
#define __LIBDWARF_H_
#include <sys/param.h>
#include <sys/queue.h>
#include <assert.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gelf.h>
#include "dwarf.h"
#include "libdwarf.h"
#include "uthash.h"
/* #include "_elftc.h" */
#ifndef offsetof
#define offsetof(T, M) ((int) &((T*) 0) -> M)
#endif
#ifndef STAILQ_HEAD
#define STAILQ_HEAD(name, type) \
struct name { \
struct type *stqh_first;/* first element */ \
struct type **stqh_last;/* addr of last next element */ \
}
#endif
#ifndef STAILQ_ENTRY
#define STAILQ_ENTRY(type) \
struct { \
struct type *stqe_next; /* next element */ \
}
#endif
#ifndef STAILQ_NEXT
#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
#endif
#ifndef STAILQ_EMPTY
#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL)
#endif
#ifndef STAILQ_FIRST
#define STAILQ_FIRST(head) ((head)->stqh_first)
#endif
#ifndef STAILQ_FOREACH
#define STAILQ_FOREACH(var, head, field) \
for((var) = STAILQ_FIRST((head)); \
(var); \
(var) = STAILQ_NEXT((var), field))
#endif
#ifndef STAILQ_FOREACH_SAFE
#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = STAILQ_FIRST((head)); \
(var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
(var) = (tvar))
#endif
#ifndef STAILQ_LAST
#define STAILQ_LAST(head, type, field) \
(STAILQ_EMPTY((head)) ? \
NULL : \
((struct type *)(void *) \
((char *)((head)->stqh_last) - offsetof(struct type, field))))
#endif
#ifndef STAILQ_INSERT_TAIL
#define STAILQ_INSERT_TAIL(head, elm, field) do { \
STAILQ_NEXT((elm), field) = NULL; \
*(head)->stqh_last = (elm); \
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
} while (0)
#endif
#ifndef STAILQ_REMOVE
#define STAILQ_REMOVE_HEAD(head, field) do { \
if ((STAILQ_FIRST((head)) = \
STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \
(head)->stqh_last = &STAILQ_FIRST((head)); \
} while (0)
#endif
#ifndef STAILQ_REMOVE_AFTER
#define STAILQ_REMOVE_AFTER(head, elm, field) do { \
if ((STAILQ_NEXT(elm, field) = \
STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
} while (0)
#endif
#define QMD_TRACE_ELEM(elem)
#define QMD_TRACE_HEAD(head)
#define QMD_SAVELINK(name, link)
#define TRACEBUF
#define TRASHIT(x)
#define QMD_TAILQ_CHECK_HEAD(head, field)
#define QMD_TAILQ_CHECK_TAIL(head, headname)
#define QMD_TAILQ_CHECK_NEXT(elm, field)
#define QMD_TAILQ_CHECK_PREV(elm, field)
#ifndef STAILQ_REMOVE
#define STAILQ_REMOVE(head, elm, type, field) do { \
QMD_SAVELINK(oldnext, (elm)->field.stqe_next); \
if (STAILQ_FIRST((head)) == (elm)) { \
STAILQ_REMOVE_HEAD((head), field); \
} \
else { \
struct type *curelm = STAILQ_FIRST((head)); \
while (STAILQ_NEXT(curelm, field) != (elm)) \
curelm = STAILQ_NEXT(curelm, field); \
STAILQ_REMOVE_AFTER(head, curelm, field); \
} \
TRASHIT(*oldnext); \
} while (0)
#endif
#ifndef TAILQ_FIRST
#define TAILQ_FIRST(head) ((head)->tqh_first)
#endif
#ifndef TAILQ_NEXT
#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
#endif
#ifndef TAILQ_FOREACH
#define TAILQ_FOREACH(var, head, field) \
for ((var) = TAILQ_FIRST((head)); \
(var); \
(var) = TAILQ_NEXT((var), field))
#endif
#ifndef TAILQ_FOREACH_SAFE
#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = TAILQ_FIRST((head)); \
(var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
(var) = (tvar))
#endif
#ifndef TAILQ_INSERT_BEFORE
#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
QMD_TAILQ_CHECK_PREV(listelm, field); \
(elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
TAILQ_NEXT((elm), field) = (listelm); \
*(listelm)->field.tqe_prev = (elm); \
(listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \
QMD_TRACE_ELEM(&(elm)->field); \
QMD_TRACE_ELEM(&listelm->field); \
} while (0)
#endif
#ifndef TAILQ_INSERT_TAIL
#define TAILQ_INSERT_TAIL(head, elm, field) do { \
QMD_TAILQ_CHECK_TAIL(head, field); \
TAILQ_NEXT((elm), field) = NULL; \
(elm)->field.tqe_prev = (head)->tqh_last; \
*(head)->tqh_last = (elm); \
(head)->tqh_last = &TAILQ_NEXT((elm), field); \
QMD_TRACE_HEAD(head); \
QMD_TRACE_ELEM(&(elm)->field); \
} while (0)
#endif
/**
** Per-OS configuration.
**/
#if defined(__linux__)
#include <endian.h>
#define ELFTC_BYTE_ORDER __BYTE_ORDER
#define ELFTC_BYTE_ORDER_LITTLE_ENDIAN __LITTLE_ENDIAN
#define ELFTC_BYTE_ORDER_BIG_ENDIAN __BIG_ENDIAN
/*
* Debian GNU/Linux is missing strmode(3).
*/
#define ELFTC_HAVE_STRMODE 0
/* Whether we need to supply {be,le}32dec. */
#define ELFTC_NEED_BYTEORDER_EXTENSIONS 1
#define roundup2 roundup
#endif /* __linux__ */
#if defined(__FreeBSD__)
#include <sys/endian.h>
#define ELFTC_BYTE_ORDER _BYTE_ORDER
#define ELFTC_BYTE_ORDER_LITTLE_ENDIAN _LITTLE_ENDIAN
#define ELFTC_BYTE_ORDER_BIG_ENDIAN _BIG_ENDIAN
#define ELFTC_HAVE_STRMODE 1
#endif /* __FreeBSD__ */
#if defined(__NetBSD__)
#include <sys/endian.h>
#define ELFTC_BYTE_ORDER _BYTE_ORDER
#define ELFTC_BYTE_ORDER_LITTLE_ENDIAN _LITTLE_ENDIAN
#define ELFTC_BYTE_ORDER_BIG_ENDIAN _BIG_ENDIAN
#define ELFTC_HAVE_STRMODE 1
#endif /* __NetBSD __ */
#if defined(__sun)
#include <sys/isa_defs.h>
#define ELFTC_BYTE_ORDER_LITTLE_ENDIAN 1234
#define ELFTC_BYTE_ORDER_BIG_ENDIAN 4321
#if defined(_LITTLE_ENDIAN)
#define ELFTC_BYTE_ORDER ELFTC_BYTE_ORDER_LITTLE_ENDIAN
#elif defined(_BIG_ENDIAN)
#define ELFTC_BYTE_ORDER ELFTC_BYTE_ORDER_BIG_ENDIAN
#else
#error "Can't detect byte order"
#endif
#endif // __sun
/* #include "_elftc.h" */
#ifndef offsetof
#define offsetof(T, M) ((int) &((T*) 0) -> M)
#endif
#ifndef STAILQ_HEAD
#define STAILQ_HEAD(name, type) \
struct name { \
struct type *stqh_first;/* first element */ \
struct type **stqh_last;/* addr of last next element */ \
}
#endif
#ifndef STAILQ_ENTRY
#define STAILQ_ENTRY(type) \
struct { \
struct type *stqe_next; /* next element */ \
}
#endif
#ifndef STAILQ_INIT
#define STAILQ_INIT(head) do { \
(head)->stqh_first = NULL; \
(head)->stqh_last = &(head)->stqh_first; \
} while (/*CONSTCOND*/0)
#endif
#ifndef STAILQ_NEXT
#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
#endif
#ifndef STAILQ_EMPTY
#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL)
#endif
#ifndef STAILQ_FIRST
#define STAILQ_FIRST(head) ((head)->stqh_first)
#endif
#ifndef STAILQ_FOREACH
#define STAILQ_FOREACH(var, head, field) \
for((var) = STAILQ_FIRST((head)); \
(var); \
(var) = STAILQ_NEXT((var), field))
#endif
#ifndef STAILQ_FOREACH_SAFE
#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = STAILQ_FIRST((head)); \
(var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
(var) = (tvar))
#endif
#ifndef STAILQ_LAST
#define STAILQ_LAST(head, type, field) \
(STAILQ_EMPTY((head)) ? \
NULL : \
((struct type *)(void *) \
((char *)((head)->stqh_last) - offsetof(struct type, field))))
#endif
#ifndef STAILQ_INSERT_TAIL
#define STAILQ_INSERT_TAIL(head, elm, field) do { \
STAILQ_NEXT((elm), field) = NULL; \
*(head)->stqh_last = (elm); \
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
} while (0)
#endif
#ifndef STAILQ_REMOVE
#define STAILQ_REMOVE_HEAD(head, field) do { \
if ((STAILQ_FIRST((head)) = \
STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \
(head)->stqh_last = &STAILQ_FIRST((head)); \
} while (0)
#endif
#ifndef STAILQ_REMOVE_AFTER
#define STAILQ_REMOVE_AFTER(head, elm, field) do { \
if ((STAILQ_NEXT(elm, field) = \
STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
} while (0)
#endif
#define QMD_TRACE_ELEM(elem)
#define QMD_TRACE_HEAD(head)
#define QMD_SAVELINK(name, link)
#define TRACEBUF
#define TRASHIT(x)
#define QMD_TAILQ_CHECK_HEAD(head, field)
#define QMD_TAILQ_CHECK_TAIL(head, headname)
#define QMD_TAILQ_CHECK_NEXT(elm, field)
#define QMD_TAILQ_CHECK_PREV(elm, field)
#ifndef STAILQ_REMOVE
#define STAILQ_REMOVE(head, elm, type, field) do { \
QMD_SAVELINK(oldnext, (elm)->field.stqe_next); \
if (STAILQ_FIRST((head)) == (elm)) { \
STAILQ_REMOVE_HEAD((head), field); \
} \
else { \
struct type *curelm = STAILQ_FIRST((head)); \
while (STAILQ_NEXT(curelm, field) != (elm)) \
curelm = STAILQ_NEXT(curelm, field); \
STAILQ_REMOVE_AFTER(head, curelm, field); \
} \
TRASHIT(*oldnext); \
} while (0)
#endif
#ifndef TAILQ_FIRST
#define TAILQ_FIRST(head) ((head)->tqh_first)
#endif
#ifndef TAILQ_NEXT
#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
#endif
#ifndef TAILQ_FOREACH
#define TAILQ_FOREACH(var, head, field) \
for ((var) = TAILQ_FIRST((head)); \
(var); \
(var) = TAILQ_NEXT((var), field))
#endif
#ifndef TAILQ_FOREACH_SAFE
#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = TAILQ_FIRST((head)); \
(var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
(var) = (tvar))
#endif
#ifndef TAILQ_INSERT_BEFORE
#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
QMD_TAILQ_CHECK_PREV(listelm, field); \
(elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
TAILQ_NEXT((elm), field) = (listelm); \
*(listelm)->field.tqe_prev = (elm); \
(listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \
QMD_TRACE_ELEM(&(elm)->field); \
QMD_TRACE_ELEM(&listelm->field); \
} while (0)
#endif
#ifndef TAILQ_INSERT_TAIL
#define TAILQ_INSERT_TAIL(head, elm, field) do { \
QMD_TAILQ_CHECK_TAIL(head, field); \
TAILQ_NEXT((elm), field) = NULL; \
(elm)->field.tqe_prev = (head)->tqh_last; \
*(head)->tqh_last = (elm); \
(head)->tqh_last = &TAILQ_NEXT((elm), field); \
QMD_TRACE_HEAD(head); \
QMD_TRACE_ELEM(&(elm)->field); \
} while (0)
#endif
/**
** Per-OS configuration.
**/
#if defined(__linux__)
#include <endian.h>
#define ELFTC_BYTE_ORDER __BYTE_ORDER
#define ELFTC_BYTE_ORDER_LITTLE_ENDIAN __LITTLE_ENDIAN
#define ELFTC_BYTE_ORDER_BIG_ENDIAN __BIG_ENDIAN
/*
* Debian GNU/Linux is missing strmode(3).
*/
#define ELFTC_HAVE_STRMODE 0
/* Whether we need to supply {be,le}32dec. */
#define ELFTC_NEED_BYTEORDER_EXTENSIONS 1
#define roundup2 roundup
#endif /* __linux__ */
#if defined(__FreeBSD__)
#include <sys/endian.h>
#define ELFTC_BYTE_ORDER _BYTE_ORDER
#define ELFTC_BYTE_ORDER_LITTLE_ENDIAN _LITTLE_ENDIAN
#define ELFTC_BYTE_ORDER_BIG_ENDIAN _BIG_ENDIAN
#define ELFTC_HAVE_STRMODE 1
#endif /* __FreeBSD__ */
#if defined(__NetBSD__)
#include <sys/endian.h>
#define ELFTC_BYTE_ORDER _BYTE_ORDER
#define ELFTC_BYTE_ORDER_LITTLE_ENDIAN _LITTLE_ENDIAN
#define ELFTC_BYTE_ORDER_BIG_ENDIAN _BIG_ENDIAN
#define ELFTC_HAVE_STRMODE 1
#endif /* __NetBSD __ */
#define DWARF_DIE_HASH_SIZE 8191
struct _libdwarf_globals {
Dwarf_Handler errhand;
Dwarf_Ptr errarg;
int applyrela;
};
extern struct _libdwarf_globals _libdwarf;
#define _DWARF_SET_ERROR(_d, _e, _err, _elf_err) \
_dwarf_set_error(_d, _e, _err, _elf_err, __func__, __LINE__)
#define DWARF_SET_ERROR(_d, _e, _err) \
_DWARF_SET_ERROR(_d, _e, _err, 0)
#define DWARF_SET_ELF_ERROR(_d, _e) \
_DWARF_SET_ERROR(_d, _e, DW_DLE_ELF, elf_errno())
/*
* Convenient macros for producer bytes stream generation.
*/
#define WRITE_VALUE(value, bytes) \
dbg->write_alloc(&ds->ds_data, &ds->ds_cap, &ds->ds_size, \
(value), (bytes), error)
#define WRITE_ULEB128(value) \
_dwarf_write_uleb128_alloc(&ds->ds_data, &ds->ds_cap, \
&ds->ds_size, (value), error)
#define WRITE_SLEB128(value) \
_dwarf_write_sleb128_alloc(&ds->ds_data, &ds->ds_cap, \
&ds->ds_size, (value), error)
#define WRITE_STRING(string) \
_dwarf_write_string_alloc(&ds->ds_data, &ds->ds_cap, \
&ds->ds_size, (string), error)
#define WRITE_BLOCK(blk, size) \
_dwarf_write_block_alloc(&ds->ds_data, &ds->ds_cap, \
&ds->ds_size, (blk), (size), error)
#define WRITE_PADDING(byte, cnt) \
_dwarf_write_padding_alloc(&ds->ds_data, &ds->ds_cap, \
&ds->ds_size, (byte), (cnt), error)
#define RCHECK(expr) \
do { \
ret = expr; \
if (ret != DW_DLE_NONE) \
goto gen_fail; \
} while(0)
struct _Dwarf_AttrDef {
uint64_t ad_attrib; /* DW_AT_XXX */
uint64_t ad_form; /* DW_FORM_XXX */
uint64_t ad_offset; /* Offset in abbrev section. */
STAILQ_ENTRY(_Dwarf_AttrDef) ad_next; /* Next attribute define. */
};
struct _Dwarf_Attribute {
Dwarf_Die at_die; /* Ptr to containing DIE. */
Dwarf_Die at_refdie; /* Ptr to reference DIE. */
uint64_t at_offset; /* Offset in info section. */
uint64_t at_attrib; /* DW_AT_XXX */
uint64_t at_form; /* DW_FORM_XXX */
int at_indirect; /* Has indirect form. */
union {
uint64_t u64; /* Unsigned value. */
int64_t s64; /* Signed value. */
char *s; /* String. */
uint8_t *u8p; /* Block data. */
} u[2]; /* Value. */
Dwarf_Block at_block; /* Block. */
Dwarf_Locdesc *at_ld; /* at value is locdesc. */
Dwarf_P_Expr at_expr; /* at value is expr. */
uint64_t at_relsym; /* Relocation symbol index. */
const char *at_relsec; /* Rel. to dwarf section. */
STAILQ_ENTRY(_Dwarf_Attribute) at_next; /* Next attribute. */
};
struct _Dwarf_Abbrev {
uint64_t ab_entry; /* Abbrev entry. */
uint64_t ab_tag; /* Tag: DW_TAG_ */
uint8_t ab_children; /* DW_CHILDREN_no or DW_CHILDREN_yes */
uint64_t ab_offset; /* Offset in abbrev section. */
uint64_t ab_length; /* Length of this abbrev entry. */
uint64_t ab_atnum; /* Number of attribute defines. */
UT_hash_handle ab_hh; /* Uthash handle. */
STAILQ_HEAD(, _Dwarf_AttrDef) ab_attrdef; /* List of attribute defs. */
};
struct _Dwarf_Die {
Dwarf_Die die_parent; /* Parent DIE. */
Dwarf_Die die_child; /* First child DIE. */
Dwarf_Die die_left; /* Left sibling DIE. */
Dwarf_Die die_right; /* Right sibling DIE. */
uint64_t die_offset; /* DIE offset in section. */
uint64_t die_next_off; /* Next DIE offset in section. */
uint64_t die_abnum; /* Abbrev number. */
Dwarf_Abbrev die_ab; /* Abbrev pointer. */
Dwarf_Tag die_tag; /* DW_TAG_ */
Dwarf_Debug die_dbg; /* Dwarf_Debug pointer. */
Dwarf_CU die_cu; /* Compilation unit pointer. */
char *die_name; /* Ptr to the name string. */
Dwarf_Attribute *die_attrarray; /* Array of attributes. */
STAILQ_HEAD(, _Dwarf_Attribute) die_attr; /* List of attributes. */
STAILQ_ENTRY(_Dwarf_Die) die_pro_next; /* Next die in pro-die list. */
};
struct _Dwarf_Loclist {
Dwarf_Locdesc **ll_ldlist; /* Array of Locdesc pointer. */
int ll_ldlen; /* Number of Locdesc. */
Dwarf_Unsigned ll_offset; /* Offset in .debug_loc section. */
Dwarf_Unsigned ll_length; /* Length (in bytes) of the loclist. */
TAILQ_ENTRY(_Dwarf_Loclist) ll_next; /* Next loclist in list. */
};
struct _Dwarf_P_Expr_Entry {
Dwarf_Loc ee_loc; /* Location expression. */
Dwarf_Unsigned ee_sym; /* Optional related reloc sym index. */
STAILQ_ENTRY(_Dwarf_P_Expr_Entry) ee_next; /* Next entry in list. */
};
struct _Dwarf_P_Expr {
Dwarf_Debug pe_dbg; /* Dwarf_Debug pointer. */
uint8_t *pe_block; /* Expression block data. */
int pe_invalid; /* Block data is up-to-date or not. */
Dwarf_Unsigned pe_length; /* Length of the block. */
STAILQ_HEAD(, _Dwarf_P_Expr_Entry) pe_eelist; /* List of entries. */
STAILQ_ENTRY(_Dwarf_P_Expr) pe_next; /* Next expr in list. */
};
struct _Dwarf_Line {
Dwarf_LineInfo ln_li; /* Ptr to line info. */
Dwarf_Addr ln_addr; /* Line address. */
Dwarf_Unsigned ln_symndx; /* Symbol index for relocation. */
Dwarf_Unsigned ln_fileno; /* File number. */
Dwarf_Unsigned ln_lineno; /* Line number. */
Dwarf_Signed ln_column; /* Column number. */
Dwarf_Bool ln_bblock; /* Basic block flag. */
Dwarf_Bool ln_stmt; /* Begin statement flag. */
Dwarf_Bool ln_endseq; /* End sequence flag. */
STAILQ_ENTRY(_Dwarf_Line) ln_next; /* Next line in list. */
};
struct _Dwarf_LineFile {
char *lf_fname; /* Filename. */
char *lf_fullpath; /* Full pathname of the file. */
Dwarf_Unsigned lf_dirndx; /* Dir index. */
Dwarf_Unsigned lf_mtime; /* Modification time. */
Dwarf_Unsigned lf_size; /* File size. */
STAILQ_ENTRY(_Dwarf_LineFile) lf_next; /* Next file in list. */
};
struct _Dwarf_LineInfo {
Dwarf_Unsigned li_length; /* Length of line info data. */
Dwarf_Half li_version; /* Version of line info. */
Dwarf_Unsigned li_hdrlen; /* Length of line info header. */
Dwarf_Small li_minlen; /* Minimum instrutction length. */
Dwarf_Small li_defstmt; /* Default value of is_stmt. */
int8_t li_lbase; /* Line base for special opcode. */
Dwarf_Small li_lrange; /* Line range for special opcode. */
Dwarf_Small li_opbase; /* Fisrt std opcode number. */
Dwarf_Small *li_oplen; /* Array of std opcode len. */
char **li_incdirs; /* Array of include dirs. */
Dwarf_Unsigned li_inclen; /* Length of inc dir array. */
char **li_lfnarray; /* Array of file names. */
Dwarf_Unsigned li_lflen; /* Length of filename array. */
STAILQ_HEAD(, _Dwarf_LineFile) li_lflist; /* List of files. */
Dwarf_Line *li_lnarray; /* Array of lines. */
Dwarf_Unsigned li_lnlen; /* Length of the line array. */
STAILQ_HEAD(, _Dwarf_Line) li_lnlist; /* List of lines. */
};
struct _Dwarf_NamePair {
Dwarf_NameTbl np_nt; /* Ptr to containing name table. */
Dwarf_Die np_die; /* Ptr to Ref. Die. */
Dwarf_Unsigned np_offset; /* Offset in CU. */
char *np_name; /* Object/Type name. */
STAILQ_ENTRY(_Dwarf_NamePair) np_next; /* Next pair in the list. */
};
struct _Dwarf_NameTbl {
Dwarf_Unsigned nt_length; /* Name lookup table length. */
Dwarf_Half nt_version; /* Name lookup table version. */
Dwarf_CU nt_cu; /* Ptr to Ref. CU. */
Dwarf_Off nt_cu_offset; /* Ref. CU offset in .debug_info */
Dwarf_Unsigned nt_cu_length; /* Ref. CU length. */
STAILQ_HEAD(, _Dwarf_NamePair) nt_nplist; /* List of offset+name pairs. */
STAILQ_ENTRY(_Dwarf_NameTbl) nt_next; /* Next name table in the list. */
};
struct _Dwarf_NameSec {
STAILQ_HEAD(, _Dwarf_NameTbl) ns_ntlist; /* List of name tables. */
Dwarf_NamePair *ns_array; /* Array of pairs of all tables. */
Dwarf_Unsigned ns_len; /* Length of the pair array. */
};
struct _Dwarf_Fde {
Dwarf_Debug fde_dbg; /* Ptr to containing dbg. */
Dwarf_Cie fde_cie; /* Ptr to associated CIE. */
Dwarf_FrameSec fde_fs; /* Ptr to containing .debug_frame. */
Dwarf_Ptr fde_addr; /* Ptr to start of the FDE. */
Dwarf_Unsigned fde_offset; /* Offset of the FDE. */
Dwarf_Unsigned fde_length; /* Length of the FDE. */
Dwarf_Unsigned fde_cieoff; /* Offset of associated CIE. */
Dwarf_Unsigned fde_initloc; /* Initial location. */
Dwarf_Unsigned fde_adrange; /* Address range. */
Dwarf_Unsigned fde_auglen; /* Augmentation length. */
uint8_t *fde_augdata; /* Augmentation data. */
uint8_t *fde_inst; /* Instructions. */
Dwarf_Unsigned fde_instlen; /* Length of instructions. */
Dwarf_Unsigned fde_instcap; /* Capacity of inst buffer. */
Dwarf_Unsigned fde_symndx; /* Symbol index for relocation. */
Dwarf_Unsigned fde_esymndx; /* End symbol index for relocation. */
Dwarf_Addr fde_eoff; /* Offset from the end symbol. */
STAILQ_ENTRY(_Dwarf_Fde) fde_next; /* Next FDE in list. */
};
struct _Dwarf_Cie {
Dwarf_Debug cie_dbg; /* Ptr to containing dbg. */
Dwarf_Unsigned cie_index; /* Index of the CIE. */
Dwarf_Unsigned cie_offset; /* Offset of the CIE. */
Dwarf_Unsigned cie_length; /* Length of the CIE. */
Dwarf_Half cie_version; /* CIE version. */
uint8_t *cie_augment; /* CIE augmentation (UTF-8). */
Dwarf_Unsigned cie_ehdata; /* Optional EH Data. */
Dwarf_Unsigned cie_caf; /* Code alignment factor. */
Dwarf_Signed cie_daf; /* Data alignment factor. */
Dwarf_Unsigned cie_ra; /* Return address register. */
Dwarf_Unsigned cie_auglen; /* Augmentation length. */
uint8_t *cie_augdata; /* Augmentation data; */
uint8_t cie_fde_encode; /* FDE PC start/range encode. */
Dwarf_Ptr cie_initinst; /* Initial instructions. */
Dwarf_Unsigned cie_instlen; /* Length of init instructions. */
STAILQ_ENTRY(_Dwarf_Cie) cie_next; /* Next CIE in list. */
};
struct _Dwarf_FrameSec {
STAILQ_HEAD(, _Dwarf_Cie) fs_cielist; /* List of CIE. */
STAILQ_HEAD(, _Dwarf_Fde) fs_fdelist; /* List of FDE. */
Dwarf_Cie *fs_ciearray; /* Array of CIE. */
Dwarf_Unsigned fs_cielen; /* Length of CIE array. */
Dwarf_Fde *fs_fdearray; /* Array of FDE.*/
Dwarf_Unsigned fs_fdelen; /* Length of FDE array. */
};
struct _Dwarf_Arange {
Dwarf_ArangeSet ar_as; /* Ptr to the set it belongs to. */
Dwarf_Unsigned ar_address; /* Start PC. */
Dwarf_Unsigned ar_range; /* PC range. */
Dwarf_Unsigned ar_symndx; /* First symbol index for reloc. */
Dwarf_Unsigned ar_esymndx; /* Second symbol index for reloc. */
Dwarf_Addr ar_eoff; /* Offset from second symbol. */
STAILQ_ENTRY(_Dwarf_Arange) ar_next; /* Next arange in list. */
};
struct _Dwarf_ArangeSet {
Dwarf_Unsigned as_length; /* Length of the arange set. */
Dwarf_Half as_version; /* Version of the arange set. */
Dwarf_Off as_cu_offset; /* Offset of associated CU. */
Dwarf_CU as_cu; /* Ptr to associated CU. */
Dwarf_Small as_addrsz; /* Target address size. */
Dwarf_Small as_segsz; /* Target segment size. */
STAILQ_HEAD (, _Dwarf_Arange) as_arlist; /* List of ae entries. */
STAILQ_ENTRY(_Dwarf_ArangeSet) as_next; /* Next set in list. */
};
struct _Dwarf_MacroSet {
Dwarf_Macro_Details *ms_mdlist; /* Array of macinfo entries. */
Dwarf_Unsigned ms_cnt; /* Length of the array. */
STAILQ_ENTRY(_Dwarf_MacroSet) ms_next; /* Next set in list. */
};
struct _Dwarf_Rangelist {
Dwarf_CU rl_cu; /* Ptr to associated CU. */
Dwarf_Unsigned rl_offset; /* Offset of the rangelist. */
Dwarf_Ranges *rl_rgarray; /* Array of ranges. */
Dwarf_Unsigned rl_rglen; /* Length of the ranges array. */
STAILQ_ENTRY(_Dwarf_Rangelist) rl_next; /* Next rangelist in list. */
};
struct _Dwarf_CU {
Dwarf_Debug cu_dbg; /* Ptr to containing dbg. */
Dwarf_Off cu_offset; /* Offset to the this CU. */
uint32_t cu_length; /* Length of CU data. */
uint16_t cu_length_size; /* Size in bytes of the length field. */
uint16_t cu_version; /* DWARF version. */
uint64_t cu_abbrev_offset; /* Offset into .debug_abbrev. */
uint64_t cu_abbrev_offset_cur; /* Current abbrev offset. */
int cu_abbrev_loaded; /* Abbrev table parsed. */
uint64_t cu_abbrev_cnt; /* Abbrev entry count. */
uint64_t cu_lineno_offset; /* Offset into .debug_lineno. */
uint8_t cu_pointer_size;/* Number of bytes in pointer. */
uint8_t cu_dwarf_size; /* CU section dwarf size. */
Dwarf_Off cu_next_offset; /* Offset to the next CU. */
uint64_t cu_1st_offset; /* First DIE offset. */
int cu_pass2; /* Two pass DIE traverse. */
Dwarf_LineInfo cu_lineinfo; /* Ptr to Dwarf_LineInfo. */
Dwarf_Abbrev cu_abbrev_hash; /* Abbrev hash table. */
STAILQ_ENTRY(_Dwarf_CU) cu_next; /* Next compilation unit. */
};
typedef struct _Dwarf_Section {
const char *ds_name; /* Section name. */
Dwarf_Small *ds_data; /* Section data. */
Dwarf_Unsigned ds_addr; /* Section virtual addr. */
Dwarf_Unsigned ds_size; /* Section size. */
} Dwarf_Section;
typedef struct _Dwarf_P_Section {
char *ds_name; /* Section name. */
Dwarf_Small *ds_data; /* Section data. */
Dwarf_Unsigned ds_size; /* Section size. */
Dwarf_Unsigned ds_cap; /* Section capacity. */
Dwarf_Unsigned ds_ndx; /* ELF section index. */
Dwarf_Unsigned ds_symndx; /* Section symbol index. (for reloc) */
STAILQ_ENTRY(_Dwarf_P_Section) ds_next; /* Next section in the list. */
} *Dwarf_P_Section;
typedef struct _Dwarf_Rel_Entry {
unsigned char dre_type; /* Reloc type. */
unsigned char dre_length; /* Reloc storage unit length. */
Dwarf_Unsigned dre_offset; /* Reloc storage unit offset. */
Dwarf_Unsigned dre_addend; /* Reloc addend. */
Dwarf_Unsigned dre_symndx; /* Reloc symbol index. */
const char *dre_secname; /* Refer to some debug section. */
STAILQ_ENTRY(_Dwarf_Rel_Entry) dre_next; /* Next reloc entry. */
} *Dwarf_Rel_Entry;
typedef struct _Dwarf_Rel_Section {
struct _Dwarf_P_Section *drs_ds; /* Ptr to actual reloc ELF section. */
struct _Dwarf_P_Section *drs_ref; /* Which debug section it refers. */
struct Dwarf_Relocation_Data_s *drs_drd; /* Reloc data array. */
STAILQ_HEAD(, _Dwarf_Rel_Entry) drs_dre; /* Reloc entry list. */
Dwarf_Unsigned drs_drecnt; /* Count of entries. */
Dwarf_Unsigned drs_size; /* Size of ELF section in bytes. */
int drs_addend; /* Elf_Rel or Elf_Rela */
STAILQ_ENTRY(_Dwarf_Rel_Section) drs_next; /* Next reloc section. */
} *Dwarf_Rel_Section;
typedef struct {
Elf_Data *ed_data;
void *ed_alloc;
} Dwarf_Elf_Data;
typedef struct {
Elf *eo_elf;
GElf_Ehdr eo_ehdr;
GElf_Shdr *eo_shdr;
Dwarf_Elf_Data *eo_data;
Dwarf_Unsigned eo_seccnt;
size_t eo_strndx;
Dwarf_Obj_Access_Methods eo_methods;
} Dwarf_Elf_Object;
struct _Dwarf_Debug {
Dwarf_Obj_Access_Interface *dbg_iface;
Dwarf_Section *dbg_section; /* Dwarf section list. */
Dwarf_Section *dbg_info_sec; /* Pointer to info section. */
Dwarf_Off dbg_info_off; /* Current info section offset. */
Dwarf_Unsigned dbg_seccnt; /* Total number of dwarf sections. */
int dbg_mode; /* Access mode. */
int dbg_pointer_size; /* Object address size. */
int dbg_offset_size; /* DWARF offset size. */
int dbg_info_loaded; /* Flag indicating all CU loaded. */
Dwarf_Half dbg_machine; /* ELF machine architecture. */
Dwarf_Handler dbg_errhand; /* Error handler. */
Dwarf_Ptr dbg_errarg; /* Argument to the error handler. */
STAILQ_HEAD(, _Dwarf_CU) dbg_cu;/* List of compilation units. */
Dwarf_CU dbg_cu_current; /* Ptr to the current CU. */
TAILQ_HEAD(, _Dwarf_Loclist) dbg_loclist; /* List of location list. */
Dwarf_NameSec dbg_globals; /* Ptr to pubnames lookup section. */
Dwarf_NameSec dbg_pubtypes; /* Ptr to pubtypes lookup section. */
Dwarf_NameSec dbg_weaks; /* Ptr to weaknames lookup section. */
Dwarf_NameSec dbg_funcs; /* Ptr to static funcs lookup sect. */
Dwarf_NameSec dbg_vars; /* Ptr to static vars lookup sect. */
Dwarf_NameSec dbg_types; /* Ptr to types lookup section. */
Dwarf_FrameSec dbg_frame; /* Ptr to .debug_frame section. */
Dwarf_FrameSec dbg_eh_frame; /* Ptr to .eh_frame section. */
STAILQ_HEAD(, _Dwarf_ArangeSet) dbg_aslist; /* List of arange set. */
Dwarf_Arange *dbg_arange_array; /* Array of arange. */
Dwarf_Unsigned dbg_arange_cnt; /* Length of the arange array. */
char *dbg_strtab; /* Dwarf string table. */
Dwarf_Unsigned dbg_strtab_cap; /* Dwarf string table capacity. */
Dwarf_Unsigned dbg_strtab_size; /* Dwarf string table size. */
STAILQ_HEAD(, _Dwarf_MacroSet) dbg_mslist; /* List of macro set. */
STAILQ_HEAD(, _Dwarf_Rangelist) dbg_rllist; /* List of rangelist. */
uint64_t (*read)(uint8_t *, uint64_t *, int);
void (*write)(uint8_t *, uint64_t *, uint64_t, int);
int (*write_alloc)(uint8_t **, uint64_t *, uint64_t *,
uint64_t, int, Dwarf_Error *);
uint64_t (*decode)(uint8_t **, int);
Dwarf_Half dbg_frame_rule_table_size;
Dwarf_Half dbg_frame_rule_initial_value;
Dwarf_Half dbg_frame_cfa_value;
Dwarf_Half dbg_frame_same_value;
Dwarf_Half dbg_frame_undefined_value;
Dwarf_Regtable3 *dbg_internal_reg_table;
/*
* Fields used by libdwarf producer.
*/
Dwarf_Unsigned dbgp_flags;
Dwarf_Unsigned dbgp_isa;
Dwarf_Callback_Func dbgp_func;
Dwarf_Callback_Func_b dbgp_func_b;
Dwarf_Die dbgp_root_die;
STAILQ_HEAD(, _Dwarf_Die) dbgp_dielist;
STAILQ_HEAD(, _Dwarf_P_Expr) dbgp_pelist;
Dwarf_LineInfo dbgp_lineinfo;
Dwarf_ArangeSet dbgp_as;
Dwarf_Macro_Details *dbgp_mdlist;
Dwarf_Unsigned dbgp_mdcnt;
STAILQ_HEAD(, _Dwarf_Cie) dbgp_cielist;
STAILQ_HEAD(, _Dwarf_Fde) dbgp_fdelist;
Dwarf_Unsigned dbgp_cielen;
Dwarf_Unsigned dbgp_fdelen;
Dwarf_NameTbl dbgp_pubs;
Dwarf_NameTbl dbgp_weaks;
Dwarf_NameTbl dbgp_funcs;
Dwarf_NameTbl dbgp_types;
Dwarf_NameTbl dbgp_vars;
STAILQ_HEAD(, _Dwarf_P_Section) dbgp_seclist;
Dwarf_Unsigned dbgp_seccnt;
Dwarf_P_Section dbgp_secpos;
Dwarf_P_Section dbgp_info;
STAILQ_HEAD(, _Dwarf_Rel_Section) dbgp_drslist;
Dwarf_Unsigned dbgp_drscnt;
Dwarf_Rel_Section dbgp_drspos;
};
/*
* Internal function prototypes.
*/
int _dwarf_abbrev_add(Dwarf_CU, uint64_t, uint64_t, uint8_t,
uint64_t, Dwarf_Abbrev *, Dwarf_Error *);
void _dwarf_abbrev_cleanup(Dwarf_CU);
int _dwarf_abbrev_find(Dwarf_CU, uint64_t, Dwarf_Abbrev *,
Dwarf_Error *);
int _dwarf_abbrev_gen(Dwarf_P_Debug, Dwarf_Error *);
int _dwarf_abbrev_parse(Dwarf_Debug, Dwarf_CU, Dwarf_Unsigned *,
Dwarf_Abbrev *, Dwarf_Error *);
int _dwarf_add_AT_dataref(Dwarf_P_Debug, Dwarf_P_Die, Dwarf_Half,
Dwarf_Unsigned, Dwarf_Unsigned, const char *,
Dwarf_P_Attribute *, Dwarf_Error *);
int _dwarf_add_string_attr(Dwarf_P_Die, Dwarf_P_Attribute *,
Dwarf_Half, char *, Dwarf_Error *);
int _dwarf_alloc(Dwarf_Debug *, int, Dwarf_Error *);
void _dwarf_arange_cleanup(Dwarf_Debug);
int _dwarf_arange_gen(Dwarf_P_Debug, Dwarf_Error *);
int _dwarf_arange_init(Dwarf_Debug, Dwarf_Error *);
void _dwarf_arange_pro_cleanup(Dwarf_P_Debug);
int _dwarf_attr_alloc(Dwarf_Die, Dwarf_Attribute *, Dwarf_Error *);
Dwarf_Attribute _dwarf_attr_find(Dwarf_Die, Dwarf_Half);
int _dwarf_attr_gen(Dwarf_P_Debug, Dwarf_P_Section, Dwarf_Rel_Section,
Dwarf_CU, Dwarf_Die, int, Dwarf_Error *);
int _dwarf_attr_init(Dwarf_Debug, Dwarf_Section *, uint64_t *, int,
Dwarf_CU, Dwarf_Die, Dwarf_AttrDef, uint64_t, int,
Dwarf_Error *);
int _dwarf_attrdef_add(Dwarf_Debug, Dwarf_Abbrev, uint64_t,
uint64_t, uint64_t, Dwarf_AttrDef *, Dwarf_Error *);
uint64_t _dwarf_decode_lsb(uint8_t **, int);
uint64_t _dwarf_decode_msb(uint8_t **, int);
int64_t _dwarf_decode_sleb128(uint8_t **);
uint64_t _dwarf_decode_uleb128(uint8_t **);
void _dwarf_deinit(Dwarf_Debug);
int _dwarf_die_alloc(Dwarf_Debug, Dwarf_Die *, Dwarf_Error *);
int _dwarf_die_count_links(Dwarf_P_Die, Dwarf_P_Die,
Dwarf_P_Die, Dwarf_P_Die);
Dwarf_Die _dwarf_die_find(Dwarf_Die, Dwarf_Unsigned);
int _dwarf_die_gen(Dwarf_P_Debug, Dwarf_CU, Dwarf_Rel_Section,
Dwarf_Error *);
void _dwarf_die_link(Dwarf_P_Die, Dwarf_P_Die, Dwarf_P_Die,
Dwarf_P_Die, Dwarf_P_Die);
int _dwarf_die_parse(Dwarf_Debug, Dwarf_Section *, Dwarf_CU, int,
uint64_t, uint64_t, Dwarf_Die *, int, Dwarf_Error *);
void _dwarf_die_pro_cleanup(Dwarf_P_Debug);
void _dwarf_elf_deinit(Dwarf_Debug);
int _dwarf_elf_init(Dwarf_Debug, Elf *, Dwarf_Error *);
int _dwarf_elf_load_section(void *, Dwarf_Half, Dwarf_Small **,
int *);
Dwarf_Endianness _dwarf_elf_get_byte_order(void *);
Dwarf_Small _dwarf_elf_get_length_size(void *);
Dwarf_Small _dwarf_elf_get_pointer_size(void *);
Dwarf_Unsigned _dwarf_elf_get_section_count(void *);
int _dwarf_elf_get_section_info(void *, Dwarf_Half,
Dwarf_Obj_Access_Section *, int *);
void _dwarf_expr_cleanup(Dwarf_P_Debug);
int _dwarf_expr_into_block(Dwarf_P_Expr, Dwarf_Error *);
Dwarf_Section *_dwarf_find_section(Dwarf_Debug, const char *);
void _dwarf_frame_cleanup(Dwarf_Debug);
int _dwarf_frame_fde_add_inst(Dwarf_P_Fde, Dwarf_Small,
Dwarf_Unsigned, Dwarf_Unsigned, Dwarf_Error *);
int _dwarf_frame_gen(Dwarf_P_Debug, Dwarf_Error *);
int _dwarf_frame_get_fop(Dwarf_Debug, uint8_t *, Dwarf_Unsigned,
Dwarf_Frame_Op **, Dwarf_Signed *, Dwarf_Error *);
int _dwarf_frame_get_internal_table(Dwarf_Fde, Dwarf_Addr,
Dwarf_Regtable3 **, Dwarf_Addr *, Dwarf_Error *);
int _dwarf_frame_interal_table_init(Dwarf_Debug, Dwarf_Error *);
void _dwarf_frame_params_init(Dwarf_Debug);
void _dwarf_frame_pro_cleanup(Dwarf_P_Debug);
int _dwarf_frame_regtable_copy(Dwarf_Debug, Dwarf_Regtable3 **,
Dwarf_Regtable3 *, Dwarf_Error *);
int _dwarf_frame_section_load(Dwarf_Debug, Dwarf_Error *);
int _dwarf_frame_section_load_eh(Dwarf_Debug, Dwarf_Error *);
int _dwarf_generate_sections(Dwarf_P_Debug, Dwarf_Error *);
Dwarf_Unsigned _dwarf_get_reloc_type(Dwarf_P_Debug, int);
int _dwarf_get_reloc_size(Dwarf_Debug, Dwarf_Unsigned);
void _dwarf_info_cleanup(Dwarf_Debug);
int _dwarf_info_first_cu(Dwarf_Debug, Dwarf_Error *);
int _dwarf_info_gen(Dwarf_P_Debug, Dwarf_Error *);
int _dwarf_info_load(Dwarf_Debug, int, Dwarf_Error *);
int _dwarf_info_next_cu(Dwarf_Debug, Dwarf_Error *);
void _dwarf_info_pro_cleanup(Dwarf_P_Debug);
int _dwarf_init(Dwarf_Debug, Dwarf_Unsigned, Dwarf_Handler,
Dwarf_Ptr, Dwarf_Error *);
int _dwarf_lineno_gen(Dwarf_P_Debug, Dwarf_Error *);
int _dwarf_lineno_init(Dwarf_Die, uint64_t, Dwarf_Error *);
void _dwarf_lineno_cleanup(Dwarf_LineInfo);
void _dwarf_lineno_pro_cleanup(Dwarf_P_Debug);
int _dwarf_loc_fill_locdesc(Dwarf_Debug, Dwarf_Locdesc *, uint8_t *,
uint64_t, uint8_t, Dwarf_Error *);
int _dwarf_loc_fill_locexpr(Dwarf_Debug, Dwarf_Locdesc **,
uint8_t *, uint64_t, uint8_t, Dwarf_Error *);
int _dwarf_loc_add(Dwarf_Die, Dwarf_Attribute, Dwarf_Error *);
int _dwarf_loc_expr_add_atom(Dwarf_Debug, uint8_t *, uint8_t *,
Dwarf_Small, Dwarf_Unsigned, Dwarf_Unsigned, int *,
Dwarf_Error *);
int _dwarf_loclist_find(Dwarf_Debug, Dwarf_CU, uint64_t,
Dwarf_Loclist *, Dwarf_Error *);
void _dwarf_loclist_cleanup(Dwarf_Debug);
void _dwarf_loclist_free(Dwarf_Loclist);
int _dwarf_loclist_add(Dwarf_Debug, Dwarf_CU, uint64_t,