blob: 2bce26bd85a353b218f169a90ab70f1cb26c2f86 [file] [log] [blame]
Ulrich Drepperb08d5a82005-07-26 05:00:05 +00001/* Interfaces for libdw.
2 Copyright (C) 2002, 2004, 2005 Red Hat, Inc.
3 Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
4
5 This program is Open Source software; you can redistribute it and/or
6 modify it under the terms of the Open Software License version 1.0 as
7 published by the Open Source Initiative.
8
9 You should have received a copy of the Open Software License along
10 with this program; if not, you may obtain a copy of the Open Software
11 License version 1.0 from http://www.opensource.org/licenses/osl.php or
12 by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
13 3001 King Ranch Road, Ukiah, CA 95482. */
14
15#ifndef _LIBDW_H
16#define _LIBDW_H 1
17
18#include <gelf.h>
19#include <stdbool.h>
20#include <stddef.h>
21
22
23#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
24# define __nonnull_attribute__(...) __attribute__ ((__nonnull__ (__VA_ARGS__)))
25#else
26# define __nonnull_attribute__(args...)
27#endif
28
29
30/* Mode for the session. */
31typedef enum
32 {
33 DWARF_C_READ, /* Read .. */
34 DWARF_C_RDWR, /* Read and write .. */
35 DWARF_C_WRITE, /* Write .. */
36 }
37Dwarf_Cmd;
38
39
40/* Callback results. */
41enum
42{
43 DWARF_CB_OK = 0,
44 DWARF_CB_ABORT
45};
46
47
48/* Error values. */
49enum
50 {
51 DW_TAG_invalid = 0
52#define DW_TAG_invalid DW_TAG_invalid
53 };
54
55
56/* Type for offset in DWARF file. */
57typedef GElf_Off Dwarf_Off;
58
59/* Type for address in DWARF file. */
60typedef GElf_Addr Dwarf_Addr;
61
62/* Integer types. Big enough to hold any numeric value. */
63typedef GElf_Xword Dwarf_Word;
64typedef GElf_Sxword Dwarf_Sword;
65/* For the times we know we do not need that much. */
66typedef GElf_Half Dwarf_Half;
67
68
69/* DWARF abbreviation record. */
70typedef struct Dwarf_Abbrev Dwarf_Abbrev;
71
72/* Returned to show the last DIE has be returned. */
73#define DWARF_END_ABBREV ((Dwarf_Abbrev *) -1l)
74
75/* Source code line information for CU. */
76typedef struct Dwarf_Lines_s Dwarf_Lines;
77
78/* One source code line information. */
79typedef struct Dwarf_Line_s Dwarf_Line;
80
81/* Source file information. */
82typedef struct Dwarf_Files_s Dwarf_Files;
83
84/* One address range record. */
85typedef struct Dwarf_Arange_s Dwarf_Arange;
86
87/* Address ranges of a file. */
88typedef struct Dwarf_Aranges_s Dwarf_Aranges;
89
90/* CU representation. */
91struct Dwarf_CU;
92
93/* Function information. */
94typedef struct Dwarf_Func_s Dwarf_Func;
95
96/* Macro information. */
97typedef struct Dwarf_Macro_s Dwarf_Macro;
98
99/* Attribute representation. */
100typedef struct
101{
102 unsigned int code;
103 unsigned int form;
104 unsigned char *valp;
105 struct Dwarf_CU *cu;
106} Dwarf_Attribute;
107
108
109/* Data block representation. */
110typedef struct
111{
112 Dwarf_Word length;
113 unsigned char *data;
114} Dwarf_Block;
115
116
117/* DIE information. */
118typedef struct
119{
120 /* The offset can be computed from the address. */
121 void *addr;
122 struct Dwarf_CU *cu;
123 Dwarf_Abbrev *abbrev;
124 // XXX We'll see what other information will be needed.
125 long int padding__;
126} Dwarf_Die;
127
128/* Returned to show the last DIE has be returned. */
129#define DWARF_END_DIE ((Dwarf_Die *) -1l)
130
131
132/* Global symbol information. */
133typedef struct
134{
135 Dwarf_Off cu_offset;
136 Dwarf_Off die_offset;
137 const char *name;
138} Dwarf_Global;
139
140
141// XXX It remains to be seen whether the next two need to be exported.
142/* Location record. */
143typedef struct
144{
145 uint8_t atom; /* Operation */
146 Dwarf_Word number; /* Operand */
147 Dwarf_Word number2; /* Possible second operand */
148 Dwarf_Word offset; /* Offset in location expression */
149} Dwarf_Loc;
150
151
152/* Handle for debug sessions. */
153typedef struct Dwarf Dwarf;
154
155
156/* Out-Of-Memory handler. */
157#if __GNUC__ < 4
158typedef void (*Dwarf_OOM) (void);
159#else
160typedef void (*__attribute__ ((noreturn)) Dwarf_OOM) (void);
161#endif
162
163
164/* Create a handle for a new debug session. */
165extern Dwarf *dwarf_begin (int fildes, Dwarf_Cmd cmd);
166
167/* Create a handle for a new debug session for an ELF file. */
168extern Dwarf *dwarf_begin_elf (Elf *elf, Dwarf_Cmd cmd, Elf_Scn *scngrp);
169
170/* Retrieve ELF descriptor used for DWARF access. */
171extern Elf *dwarf_getelf (Dwarf *dwarf);
172
173/* Release debugging handling context. */
174extern int dwarf_end (Dwarf *dwarf);
175
176
177/* Get the data block for the .debug_info section. */
178extern Elf_Data *dwarf_getscn_info (Dwarf *dwarf);
179
180/* Read the header for the DWARF CU header. */
181extern int dwarf_nextcu (Dwarf *dwarf, Dwarf_Off off, Dwarf_Off *next_off,
182 size_t *header_sizep, Dwarf_Off *abbrev_offsetp,
183 uint8_t *address_sizep, uint8_t *offset_sizep)
184 __nonnull_attribute__ (3);
185
186
187/* Return DIE at given offset. */
188extern Dwarf_Die *dwarf_offdie (Dwarf *dbg, Dwarf_Off offset,
189 Dwarf_Die *result) __nonnull_attribute__ (3);
190
191/* Return offset of DIE. */
192extern Dwarf_Off dwarf_dieoffset (Dwarf_Die *die);
193
194/* Return offset of DIE in CU. */
195extern Dwarf_Off dwarf_cuoffset (Dwarf_Die *die);
196
Roland McGrath07d4f2f2005-10-28 06:56:24 +0000197/* Return CU DIE containing given DIE. */
198extern Dwarf_Die *dwarf_diecu (Dwarf_Die *die, Dwarf_Die *result,
199 uint8_t *address_sizep, uint8_t *offset_sizep);
200
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000201/* Return CU DIE containing given address. */
202extern Dwarf_Die *dwarf_addrdie (Dwarf *dbg, Dwarf_Addr addr,
203 Dwarf_Die *result) __nonnull_attribute__ (3);
204
205/* Return child of current DIE. */
206extern int dwarf_child (Dwarf_Die *die, Dwarf_Die *result)
207 __nonnull_attribute__ (2);
208
209/* Return sibling of given DIE. */
210extern int dwarf_siblingof (Dwarf_Die *die, Dwarf_Die *result)
211 __nonnull_attribute__ (2);
212
213/* Check whether the DIE has children. */
214extern int dwarf_haschildren (Dwarf_Die *die);
215
216/* Get attributes of the DIE. */
217extern ptrdiff_t dwarf_getattrs (Dwarf_Die *die,
218 int (*callback) (Dwarf_Attribute *, void *),
219 void *arg, ptrdiff_t offset);
220
221/* Return tag of given DIE. */
222extern int dwarf_tag (Dwarf_Die *die);
223
224
225/* Return specific attribute of DIE. */
226extern Dwarf_Attribute *dwarf_attr (Dwarf_Die *die, unsigned int search_name,
227 Dwarf_Attribute *result)
228 __nonnull_attribute__ (3);
229
230/* Check whether given DIE has specific attribute. */
231extern int dwarf_hasattr (Dwarf_Die *die, unsigned int search_name);
232
233/* These are the same as dwarf_attr and dwarf_hasattr, respectively,
234 but they resolve an indirect attribute through DW_AT_abstract_origin. */
235extern Dwarf_Attribute *dwarf_attr_integrate (Dwarf_Die *die,
236 unsigned int search_name,
237 Dwarf_Attribute *result)
238 __nonnull_attribute__ (3);
239extern int dwarf_hasattr_integrate (Dwarf_Die *die, unsigned int search_name);
240
241
242
243
244/* Check whether given attribute has specific form. */
245extern int dwarf_hasform (Dwarf_Attribute *attr, unsigned int search_form);
246
247/* Return attribute code of given attribute. */
248extern unsigned int dwarf_whatattr (Dwarf_Attribute *attr);
249
250/* Return form code of given attribute. */
251extern unsigned int dwarf_whatform (Dwarf_Attribute *attr);
252
253
254/* Return string associated with given attribute. */
255extern const char *dwarf_formstring (Dwarf_Attribute *attrp);
256
257/* Return unsigned constant represented by attribute. */
258extern int dwarf_formudata (Dwarf_Attribute *attr, Dwarf_Word *return_uval)
259 __nonnull_attribute__ (2);
260
261/* Return signed constant represented by attribute. */
262extern int dwarf_formsdata (Dwarf_Attribute *attr, Dwarf_Sword *return_uval)
263 __nonnull_attribute__ (2);
264
265/* Return address represented by attribute. */
266extern int dwarf_formaddr (Dwarf_Attribute *attr, Dwarf_Addr *return_addr)
267 __nonnull_attribute__ (2);
268
269/* Return reference offset represented by attribute. */
270extern int dwarf_formref (Dwarf_Attribute *attr, Dwarf_Off *return_offset)
271 __nonnull_attribute__ (2);
272
273/* Look up the DIE in a reference-form attribute. */
274extern Dwarf_Die *dwarf_formref_die (Dwarf_Attribute *attr, Dwarf_Die *die_mem)
275 __nonnull_attribute__ (2);
276
277/* Return block represented by attribute. */
278extern int dwarf_formblock (Dwarf_Attribute *attr, Dwarf_Block *return_block)
279 __nonnull_attribute__ (2);
280
281/* Return flag represented by attribute. */
282extern int dwarf_formflag (Dwarf_Attribute *attr, bool *return_bool)
283 __nonnull_attribute__ (2);
284
285
286/* Simplified attribute value access functions. */
287
288/* Return string in name attribute of DIE. */
289extern const char *dwarf_diename (Dwarf_Die *die);
290
291/* Return high PC attribute of DIE. */
292extern int dwarf_highpc (Dwarf_Die *die, Dwarf_Addr *return_addr)
293 __nonnull_attribute__ (2);
294
295/* Return low PC attribute of DIE. */
296extern int dwarf_lowpc (Dwarf_Die *die, Dwarf_Addr *return_addr)
297 __nonnull_attribute__ (2);
298
Roland McGrath07d4f2f2005-10-28 06:56:24 +0000299/* Return entry_pc or low_pc attribute of DIE. */
300extern int dwarf_entrypc (Dwarf_Die *die, Dwarf_Addr *return_addr)
301 __nonnull_attribute__ (2);
302
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000303/* Return 1 if DIE's lowpc/highpc or ranges attributes match the PC address,
304 0 if not, or -1 for errors. */
305extern int dwarf_haspc (Dwarf_Die *die, Dwarf_Addr pc);
306
Roland McGrath07d4f2f2005-10-28 06:56:24 +0000307/* Enumerate the PC address ranges covered by this DIE, covering all
308 addresses where dwarf_haspc returns true. In the first call OFFSET
309 should be zero and *BASEP need not be initialized. Returns -1 for
310 errors, zero when there are no more address ranges to report, or a
311 nonzero OFFSET value to pass to the next call. Each subsequent call
312 must preserve *BASEP from the prior call. Successful calls fill in
313 *STARTP and *ENDP with a contiguous address range. */
314extern ptrdiff_t dwarf_ranges (Dwarf_Die *die,
315 ptrdiff_t offset, Dwarf_Addr *basep,
316 Dwarf_Addr *startp, Dwarf_Addr *endp);
317
318
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000319/* Return byte size attribute of DIE. */
320extern int dwarf_bytesize (Dwarf_Die *die);
321
322/* Return bit size attribute of DIE. */
323extern int dwarf_bitsize (Dwarf_Die *die);
324
325/* Return bit offset attribute of DIE. */
326extern int dwarf_bitoffset (Dwarf_Die *die);
327
328/* Return array order attribute of DIE. */
329extern int dwarf_arrayorder (Dwarf_Die *die);
330
331/* Return source language attribute of DIE. */
332extern int dwarf_srclang (Dwarf_Die *die);
333
334
335/* Get abbreviation at given offset for given DIE. */
336extern Dwarf_Abbrev *dwarf_getabbrev (Dwarf_Die *die, Dwarf_Off offset,
337 size_t *lengthp);
338
339/* Get abbreviation at given offset in .debug_abbrev section. */
340extern int dwarf_offabbrev (Dwarf *dbg, Dwarf_Off offset, size_t *lengthp,
341 Dwarf_Abbrev *abbrevp)
342 __nonnull_attribute__ (4);
343
344/* Get abbreviation code. */
345extern unsigned int dwarf_getabbrevcode (Dwarf_Abbrev *abbrev);
346
347/* Get abbreviation tag. */
348extern unsigned int dwarf_getabbrevtag (Dwarf_Abbrev *abbrev);
349
350/* Return true if abbreviation is children flag set. */
351extern int dwarf_abbrevhaschildren (Dwarf_Abbrev *abbrev);
352
353/* Get number of attributes of abbreviation. */
354extern int dwarf_getattrcnt (Dwarf_Abbrev *abbrev, size_t *attrcntp)
355 __nonnull_attribute__ (2);
356
357/* Get specific attribute of abbreviation. */
358extern int dwarf_getabbrevattr (Dwarf_Abbrev *abbrev, size_t idx,
359 unsigned int *namep, unsigned int *formp,
360 Dwarf_Off *offset);
361
362
363/* Get string from-debug_str section. */
364extern const char *dwarf_getstring (Dwarf *dbg, Dwarf_Off offset,
365 size_t *lenp);
366
367
368/* Get public symbol information. */
369extern ptrdiff_t dwarf_getpubnames (Dwarf *dbg,
370 int (*callback) (Dwarf *, Dwarf_Global *,
371 void *),
372 void *arg, ptrdiff_t offset)
373 __nonnull_attribute__ (2);
374
375
376/* Get source file information for CU. */
377extern int dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines,
378 size_t *nlines) __nonnull_attribute__ (2, 3);
379
380/* Return one of the source lines of the CU. */
381extern Dwarf_Line *dwarf_onesrcline (Dwarf_Lines *lines, size_t idx);
382
383/* Get the file source files used in the CU. */
384extern int dwarf_getsrcfiles (Dwarf_Die *cudie, Dwarf_Files **files,
385 size_t *nfiles)
386 __nonnull_attribute__ (2);
387
388
389/* Get source for address in CU. */
390extern Dwarf_Line *dwarf_getsrc_die (Dwarf_Die *cudie, Dwarf_Addr addr);
391
392/* Get source for file and line number. */
393extern int dwarf_getsrc_file (Dwarf *dbg, const char *fname, int line, int col,
394 Dwarf_Line ***srcsp, size_t *nsrcs)
395 __nonnull_attribute__ (2, 5, 6);
396
397
398/* Return line address. */
399extern int dwarf_lineaddr (Dwarf_Line *line, Dwarf_Addr *addrp);
400
401/* Return line number. */
402extern int dwarf_lineno (Dwarf_Line *line, int *linep)
403 __nonnull_attribute__ (2);
404
405/* Return column in line. */
406extern int dwarf_linecol (Dwarf_Line *line, int *colp)
407 __nonnull_attribute__ (2);
408
409/* Return true if record is for beginning of a statement. */
410extern int dwarf_linebeginstatement (Dwarf_Line *line, bool *flagp)
411 __nonnull_attribute__ (2);
412
413/* Return true if record is for end of sequence. */
414extern int dwarf_lineendsequence (Dwarf_Line *line, bool *flagp)
415 __nonnull_attribute__ (2);
416
417/* Return true if record is for beginning of a basic block. */
418extern int dwarf_lineblock (Dwarf_Line *line, bool *flagp)
419 __nonnull_attribute__ (2);
420
421/* Return true if record is for end of prologue. */
422extern int dwarf_lineprologueend (Dwarf_Line *line, bool *flagp)
423 __nonnull_attribute__ (2);
424
425/* Return true if record is for beginning of epilogue. */
426extern int dwarf_lineepiloguebegin (Dwarf_Line *line, bool *flagp)
427 __nonnull_attribute__ (2);
428
429
430/* Find line information for address. */
431extern const char *dwarf_linesrc (Dwarf_Line *line,
432 Dwarf_Word *mtime, Dwarf_Word *length);
433
434/* Return file information. */
435extern const char *dwarf_filesrc (Dwarf_Files *file, size_t idx,
436 Dwarf_Word *mtime, Dwarf_Word *length);
437
438
439/* Return location expression list. */
440extern int dwarf_getloclist (Dwarf_Attribute *attr, Dwarf_Loc **llbuf,
441 size_t *listlen) __nonnull_attribute__ (2, 3);
442
443/* Return location expression lists. If the attribute uses a location
444 list, ADDRESS selects the relevant location expressions from the list.
445 There can be multiple matches, resulting in multiple expressions to
446 return. LLBUFS and LISTLENS are parallel arrays of NLOCS slots to fill
447 in. Returns the number of locations filled in, or -1 for errors. If
448 LLBUFS is a null pointer, stores nothing and returns the total number of
449 locations. A return value of zero means that the location list
450 indicated no value is accessible. */
451extern int dwarf_addrloclists (Dwarf_Attribute *attr, Dwarf_Addr address,
452 Dwarf_Loc **llbufs, size_t *listlens,
453 size_t nlocs);
454
455
456/* Return scope DIEs containing PC address.
457 Sets *SCOPES to a malloc'd array of Dwarf_Die structures,
458 and returns the number of elements in the array.
459 (*SCOPES)[0] is the DIE for the innermost scope containing PC,
460 (*SCOPES)[1] is the DIE for the scope containing that scope, and so on.
461 Returns -1 for errors or 0 if no scopes match PC. */
462extern int dwarf_getscopes (Dwarf_Die *cudie, Dwarf_Addr pc,
463 Dwarf_Die **scopes);
464
Roland McGrath71e15a02005-08-27 10:33:26 +0000465/* Return scope DIEs containing the given DIE.
466 Sets *SCOPES to a malloc'd array of Dwarf_Die structures,
467 and returns the number of elements in the array.
468 (*SCOPES)[0] is a copy of DIE.
469 (*SCOPES)[1] is the DIE for the scope containing that scope, and so on.
470 Returns -1 for errors or 0 if DIE is not found in any scope entry. */
471extern int dwarf_getscopes_die (Dwarf_Die *die, Dwarf_Die **scopes);
472
473
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000474/* Search SCOPES[0..NSCOPES-1] for a variable called NAME.
475 Ignore the first SKIP_SHADOWS scopes that match the name.
476 If MATCH_FILE is not null, accept only declaration in that source file;
477 if MATCH_LINENO or MATCH_LINECOL are also nonzero, accept only declaration
478 at that line and column.
479
480 If successful, fill in *RESULT with the DIE of the variable found,
481 and return N where SCOPES[N] is the scope defining the variable.
482 Return -1 for errors or -2 for no matching variable found. */
483extern int dwarf_getscopevar (Dwarf_Die *scopes, int nscopes,
484 const char *name, int skip_shadows,
485 const char *match_file,
486 int match_lineno, int match_linecol,
487 Dwarf_Die *result);
488
489
490
491/* Return list address ranges. */
492extern int dwarf_getaranges (Dwarf *dbg, Dwarf_Aranges **aranges,
493 size_t *naranges)
494 __nonnull_attribute__ (2);
495
496/* Return one of the address range entries. */
497extern Dwarf_Arange *dwarf_onearange (Dwarf_Aranges *aranges, size_t idx);
498
499/* Return information in address range record. */
500extern int dwarf_getarangeinfo (Dwarf_Arange *arange, Dwarf_Addr *addrp,
501 Dwarf_Word *lengthp, Dwarf_Off *offsetp);
502
503/* Get address range which includes given address. */
504extern Dwarf_Arange *dwarf_getarange_addr (Dwarf_Aranges *aranges,
505 Dwarf_Addr addr);
506
507
508
509/* Get functions in CUDIE. */
510extern ptrdiff_t dwarf_getfuncs (Dwarf_Die *cudie,
511 int (*callback) (Dwarf_Func *, void *),
512 void *arg, ptrdiff_t offset);
513
514/* Return name of function. */
515extern const char *dwarf_func_name (Dwarf_Func *func);
516
517/* Return start address of function. */
518extern int dwarf_func_lowpc (Dwarf_Func *func, Dwarf_Addr *return_addr)
519 __nonnull_attribute__ (2);
520
521/* Return end address of function. */
522extern int dwarf_func_highpc (Dwarf_Func *func, Dwarf_Addr *return_addr)
523 __nonnull_attribute__ (2);
524
525/* Return entry point address of function. */
526extern int dwarf_func_entrypc (Dwarf_Func *func, Dwarf_Addr *return_addr)
527 __nonnull_attribute__ (2);
528
529/* Return file name containing definition of the given function. */
530extern const char *dwarf_func_file (Dwarf_Func *func);
531
532/* Get line number of beginning of given function. */
533extern int dwarf_func_line (Dwarf_Func *func, int *linep)
534 __nonnull_attribute__ (2);
535
536/* Get column number of beginning of given function. */
537extern int dwarf_func_col (Dwarf_Func *func, int *colp)
538 __nonnull_attribute__ (2);
539
Roland McGrath1ecb6062005-08-15 09:53:04 +0000540/* Get definition DIE of given function. */
541extern Dwarf_Die *dwarf_func_die (Dwarf_Func *func, Dwarf_Die *die_mem)
542 __nonnull_attribute__ (2);
543
544/* Return nonzero if given function is an abstract inline definition. */
545extern int dwarf_func_inline (Dwarf_Func *func);
546
547/* Find each concrete inlined instance of the abstract inline definition. */
548extern int dwarf_func_inline_instances (Dwarf_Func *func,
549 int (*callback) (Dwarf_Die *, void *),
550 void *arg);
551
552
Roland McGrath07d4f2f2005-10-28 06:56:24 +0000553/* Find the appropriate PC location or locations for function entry
554 breakpoints for the given DW_TAG_subprogram DIE. Returns -1 for errors.
555 On success, returns the number of breakpoint locations (never zero)
556 and sets *BKPTS to a malloc'd vector of addresses. */
557extern int dwarf_entry_breakpoints (Dwarf_Die *die, Dwarf_Addr **bkpts);
558
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000559
560/* Call callback function for each of the macro information entry for
561 the CU. */
562extern ptrdiff_t dwarf_getmacros (Dwarf_Die *cudie,
563 int (*callback) (Dwarf_Macro *, void *),
564 void *arg, ptrdiff_t offset)
565 __nonnull_attribute__ (2);
566
567/* Return macro opcode. */
568extern int dwarf_macro_opcode (Dwarf_Macro *macro, unsigned int *opcodep)
569 __nonnull_attribute__ (2);
570
571/* Return first macro parameter. */
572extern int dwarf_macro_param1 (Dwarf_Macro *macro, Dwarf_Word *paramp)
573 __nonnull_attribute__ (2);
574
575/* Return second macro parameter. */
576extern int dwarf_macro_param2 (Dwarf_Macro *macro, Dwarf_Word *paramp,
577 const char **strp);
578
579
580/* Return error code of last failing function call. This value is kept
581 separately for each thread. */
582extern int dwarf_errno (void);
583
584/* Return error string for ERROR. If ERROR is zero, return error string
585 for most recent error or NULL is none occurred. If ERROR is -1 the
586 behaviour is similar to the last case except that not NULL but a legal
587 string is returned. */
588extern const char *dwarf_errmsg (int err);
589
590
591/* Register new Out-Of-Memory handler. The old handler is returned. */
592extern Dwarf_OOM dwarf_new_oom_handler (Dwarf *dbg, Dwarf_OOM handler);
593
594
595/* Inline optimizations. */
596#ifdef __OPTIMIZE__
597/* Return attribute code of given attribute. */
598extern inline unsigned int
599dwarf_whatattr (Dwarf_Attribute *attr)
600{
601 return attr == NULL ? 0 : attr->code;
602}
603
604/* Return attribute code of given attribute. */
605extern inline unsigned int
606dwarf_whatform (Dwarf_Attribute *attr)
607{
608 return attr == NULL ? 0 : attr->form;
609}
610#endif /* Optimize. */
611
612#endif /* libdw.h */