Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame^] | 1 | /* Interface for libdwarf. |
| 2 | Copyright (C) 2000, 2001, 2002 Red Hat, Inc. |
| 3 | |
| 4 | This program is Open Source software; you can redistribute it and/or |
| 5 | modify it under the terms of the Open Software License version 1.0 as |
| 6 | published by the Open Source Initiative. |
| 7 | |
| 8 | You should have received a copy of the Open Software License along |
| 9 | with this program; if not, you may obtain a copy of the Open Software |
| 10 | License version 1.0 from http://www.opensource.org/licenses/osl.php or |
| 11 | by writing the Open Source Initiative c/o Lawrence Rosen, Esq., |
| 12 | 3001 King Ranch Road, Ukiah, CA 95482. */ |
| 13 | |
| 14 | #ifndef _LIBDWARF_H |
| 15 | #define _LIBDWARF_H 1 |
| 16 | |
| 17 | #include <libelf.h> |
| 18 | #include <stdint.h> |
| 19 | |
| 20 | /* Basic data types. */ |
| 21 | |
| 22 | /* Used for boolean values. */ |
| 23 | typedef int Dwarf_Bool; |
| 24 | |
| 25 | /* Numeric values of different sizes. */ |
| 26 | typedef uint8_t Dwarf_Small; |
| 27 | typedef uint16_t Dwarf_Half; |
| 28 | typedef uint64_t Dwarf_Unsigned; |
| 29 | typedef int64_t Dwarf_Signed; |
| 30 | |
| 31 | /* Offsets in the debugging sections. */ |
| 32 | typedef uint64_t Dwarf_Off; |
| 33 | |
| 34 | /* Program counter value in the target object file. */ |
| 35 | typedef uint64_t Dwarf_Addr; |
| 36 | |
| 37 | /* Address in the host process. */ |
| 38 | typedef void *Dwarf_Ptr; |
| 39 | |
| 40 | |
| 41 | /* Location record. */ |
| 42 | typedef struct |
| 43 | { |
| 44 | Dwarf_Small lr_atom; /* Operation */ |
| 45 | Dwarf_Unsigned lr_number; /* Operand */ |
| 46 | Dwarf_Unsigned lr_number2; /* Possible second operand */ |
| 47 | Dwarf_Unsigned lr_offset; /* Offset in location expression */ |
| 48 | } Dwarf_Loc; |
| 49 | |
| 50 | |
| 51 | /* Location description. */ |
| 52 | typedef struct |
| 53 | { |
| 54 | Dwarf_Addr ld_lopc; /* Beginning of range */ |
| 55 | Dwarf_Addr ld_hipc; /* End of range */ |
| 56 | Dwarf_Half ld_cents; /* Number of location records */ |
| 57 | Dwarf_Loc *ld_s; /* Array of location records */ |
| 58 | } Dwarf_Locdesc; |
| 59 | |
| 60 | |
| 61 | /* Error handler function. */ |
| 62 | typedef struct Dwarf_Error_s *Dwarf_Error; /* Forward declaration. */ |
| 63 | typedef void (*Dwarf_Handler) (Dwarf_Error *, Dwarf_Ptr); |
| 64 | |
| 65 | /* Descriptor for block of uninterpreted data. */ |
| 66 | typedef struct |
| 67 | { |
| 68 | Dwarf_Unsigned bl_len; |
| 69 | Dwarf_Ptr bl_data; |
| 70 | } Dwarf_Block; |
| 71 | |
| 72 | |
| 73 | /* Descriptor for libdwarf session. */ |
| 74 | typedef struct Dwarf_Debug_s *Dwarf_Debug; |
| 75 | |
| 76 | /* Descriptor for DWARF DIE. */ |
| 77 | typedef struct Dwarf_Die_s *Dwarf_Die; |
| 78 | |
| 79 | /* Descriptor for DWARF attribute list. */ |
| 80 | typedef struct Dwarf_Attribute_s *Dwarf_Attribute; |
| 81 | |
| 82 | /* Descriptor for source lines. */ |
| 83 | typedef struct Dwarf_Line_s *Dwarf_Line; |
| 84 | |
| 85 | /* Descriptor for global name. */ |
| 86 | typedef struct Dwarf_Global_s *Dwarf_Global; |
| 87 | |
| 88 | /* Descriptor for address range. */ |
| 89 | typedef struct Dwarf_Arange_s *Dwarf_Arange; |
| 90 | |
| 91 | /* Descriptor for common information entry. */ |
| 92 | typedef struct Dwarf_Cie_s *Dwarf_Cie; |
| 93 | |
| 94 | /* Descriptor for frame descriptor entry. */ |
| 95 | typedef struct Dwarf_Fde_s *Dwarf_Fde; |
| 96 | |
| 97 | /* Descriptor for abbreviations. */ |
| 98 | typedef struct Dwarf_Abbrev_s *Dwarf_Abbrev; |
| 99 | |
| 100 | |
| 101 | /* Return values. */ |
| 102 | enum |
| 103 | { |
| 104 | DW_DLV_NO_ENTRY = -1, /* No error, but no entry. */ |
| 105 | DW_DLV_OK = 0, /* Success. */ |
| 106 | DW_DLV_ERROR = 1, /* Failure. */ |
| 107 | }; |
| 108 | |
| 109 | |
| 110 | /* Values for ACCESS parameter of 'dwarf_init' and 'dwarf_elf_init'. */ |
| 111 | enum |
| 112 | { |
| 113 | DW_DLC_READ = 0, /* Read-only access. */ |
| 114 | DW_DLC_WRITE = 1, /* Write-only access. */ |
| 115 | DW_DLC_RDWR = 2 /* Read-write access. */ |
| 116 | }; |
| 117 | |
| 118 | |
| 119 | /* Open file associates with FD for use with the other functions of |
| 120 | this library. Set the error handler and the parameter passed. */ |
| 121 | extern int dwarf_init (int fd, Dwarf_Unsigned access, |
| 122 | Dwarf_Handler errhand, Dwarf_Ptr errarg, |
| 123 | Dwarf_Debug *dbg, Dwarf_Error *errdesc); |
| 124 | |
| 125 | /* Similar to `dwarf_init' but instead of a file descriptor of ELF |
| 126 | descriptor is passed. */ |
| 127 | extern int dwarf_elf_init (Elf *elf, Dwarf_Unsigned access, |
| 128 | Dwarf_Handler errhand, Dwarf_Ptr errarg, |
| 129 | Dwarf_Debug *dbg, Dwarf_Error *errdesc); |
| 130 | |
| 131 | /* Return ELF handle. */ |
| 132 | extern int dwarf_get_elf_init (Dwarf_Debug dbg, Elf **elf, |
| 133 | Dwarf_Error *errdesc); |
| 134 | |
| 135 | /* Free resources allocated for debug handle. */ |
| 136 | extern int dwarf_finish (Dwarf_Debug dbg, Dwarf_Error *errdesc); |
| 137 | |
| 138 | |
| 139 | /* Return information about current and find new compile unit header. */ |
| 140 | extern int dwarf_next_cu_header (Dwarf_Debug dbg, |
| 141 | Dwarf_Unsigned *cu_header_length, |
| 142 | Dwarf_Half *version_stamp, |
| 143 | Dwarf_Unsigned *abbrev_offset, |
| 144 | Dwarf_Half *address_size, |
| 145 | Dwarf_Unsigned *next_cu_header, |
| 146 | Dwarf_Error *errdesc); |
| 147 | |
| 148 | /* Return sibling of given DIE. */ |
| 149 | extern int dwarf_siblingof (Dwarf_Debug dbg, Dwarf_Die die, |
| 150 | Dwarf_Die *return_sub, Dwarf_Error *errdesc); |
| 151 | |
| 152 | /* Return child of DIE. */ |
| 153 | extern int dwarf_child (Dwarf_Die die, Dwarf_Die *return_kid, |
| 154 | Dwarf_Error *errdesc); |
| 155 | |
| 156 | /* Return DIE at given offset. */ |
| 157 | extern int dwarf_offdie (Dwarf_Debug dbg, Dwarf_Off offset, |
| 158 | Dwarf_Die *return_die, Dwarf_Error *errdesc); |
| 159 | |
| 160 | |
| 161 | /* Return tag of DIE. */ |
| 162 | extern int dwarf_tag (Dwarf_Die die, Dwarf_Half *tagval, Dwarf_Error *errdesc); |
| 163 | |
| 164 | /* Return offset of DIE in .debug_info section. */ |
| 165 | extern int dwarf_dieoffset (Dwarf_Die die, Dwarf_Off *return_offset, |
| 166 | Dwarf_Error *errdesc); |
| 167 | |
| 168 | /* Return offset of DIE in compile unit data. */ |
| 169 | extern int dwarf_die_CU_offset (Dwarf_Die die, Dwarf_Off *return_offset, |
| 170 | Dwarf_Error *errdesc); |
| 171 | |
| 172 | /* Return name attribute of DIE. */ |
| 173 | extern int dwarf_diename (Dwarf_Die die, char **return_name, |
| 174 | Dwarf_Error *errdesc); |
| 175 | |
| 176 | /* Return list of attributes for DIE. */ |
| 177 | extern int dwarf_attrlist (Dwarf_Die die, Dwarf_Attribute **attrbuf, |
| 178 | Dwarf_Signed *attrcount, Dwarf_Error *errdesc); |
| 179 | |
| 180 | /* Determine whether DIE has attribute specified of given type. */ |
| 181 | extern int dwarf_hasattr (Dwarf_Die die, Dwarf_Half attr, |
| 182 | Dwarf_Bool *return_bool, Dwarf_Error *errdesc); |
| 183 | |
| 184 | /* Return DIE attribute with specified of given type. */ |
| 185 | extern int dwarf_attr (Dwarf_Die die, Dwarf_Half attr, |
| 186 | Dwarf_Attribute *return_attr, Dwarf_Error *errdesc); |
| 187 | |
| 188 | /* Return low program counter value associated with die. */ |
| 189 | extern int dwarf_lowpc (Dwarf_Die die, Dwarf_Addr *return_lowpc, |
| 190 | Dwarf_Error *errdesc); |
| 191 | |
| 192 | /* Return high program counter value associated with die. */ |
| 193 | extern int dwarf_highpc (Dwarf_Die die, Dwarf_Addr *return_lowpc, |
| 194 | Dwarf_Error *errdesc); |
| 195 | |
| 196 | /* Return byte size value associated with die. */ |
| 197 | extern int dwarf_bytesize (Dwarf_Die die, Dwarf_Unsigned *return_size, |
| 198 | Dwarf_Error *errdesc); |
| 199 | |
| 200 | /* Return bit size value associated with die. */ |
| 201 | extern int dwarf_bitsize (Dwarf_Die die, Dwarf_Unsigned *return_size, |
| 202 | Dwarf_Error *errdesc); |
| 203 | |
| 204 | /* Return bit offset value associated with die. */ |
| 205 | extern int dwarf_bitoffset (Dwarf_Die die, Dwarf_Unsigned *return_size, |
| 206 | Dwarf_Error *errdesc); |
| 207 | |
| 208 | /* Return source language associated with die. */ |
| 209 | extern int dwarf_srclang (Dwarf_Die die, Dwarf_Unsigned *return_lang, |
| 210 | Dwarf_Error *errdesc); |
| 211 | |
| 212 | /* Return source language associated with die. */ |
| 213 | extern int dwarf_arrayorder (Dwarf_Die die, Dwarf_Unsigned *return_order, |
| 214 | Dwarf_Error *errdesc); |
| 215 | |
| 216 | |
| 217 | /* Determine whether attribute has given form. */ |
| 218 | extern int dwarf_hasform (Dwarf_Attribute attr, Dwarf_Half form, |
| 219 | Dwarf_Bool *return_hasform, Dwarf_Error *errdesc); |
| 220 | |
| 221 | /* Return form of attribute. */ |
| 222 | extern int dwarf_whatform (Dwarf_Attribute attr, Dwarf_Half *return_form, |
| 223 | Dwarf_Error *errdesc); |
| 224 | |
| 225 | /* Return code of attribute. */ |
| 226 | extern int dwarf_whatattr (Dwarf_Attribute attr, Dwarf_Half *return_attr, |
| 227 | Dwarf_Error *errdesc); |
| 228 | |
| 229 | /* Return compile-unit relative offset of reference associated with form. */ |
| 230 | extern int dwarf_formref (Dwarf_Attribute attr, Dwarf_Off *return_offset, |
| 231 | Dwarf_Error *errdesc); |
| 232 | |
| 233 | /* Return .debug_info section global offset of reference associated |
| 234 | with form. */ |
| 235 | extern int dwarf_global_formref (Dwarf_Attribute attr, |
| 236 | Dwarf_Off *return_offset, |
| 237 | Dwarf_Error *errdesc); |
| 238 | |
| 239 | /* Return address represented by attribute. */ |
| 240 | extern int dwarf_formaddr (Dwarf_Attribute attr, Dwarf_Addr *return_addr, |
| 241 | Dwarf_Error *errdesc); |
| 242 | |
| 243 | /* Return flag represented by attribute. */ |
| 244 | extern int dwarf_formflag (Dwarf_Attribute attr, Dwarf_Bool *return_bool, |
| 245 | Dwarf_Error *errdesc); |
| 246 | |
| 247 | /* Return unsigned constant represented by attribute. */ |
| 248 | extern int dwarf_formudata (Dwarf_Attribute attr, Dwarf_Unsigned *return_uval, |
| 249 | Dwarf_Error *errdesc); |
| 250 | |
| 251 | /* Return signed constant represented by attribute. */ |
| 252 | extern int dwarf_formsdata (Dwarf_Attribute attr, Dwarf_Signed *return_uval, |
| 253 | Dwarf_Error *errdesc); |
| 254 | |
| 255 | /* Return block of uninterpreted data represented by attribute. */ |
| 256 | extern int dwarf_formblock (Dwarf_Attribute attr, Dwarf_Block **return_block, |
| 257 | Dwarf_Error *errdesc); |
| 258 | |
| 259 | /* Return string represented by attribute. */ |
| 260 | extern int dwarf_formstring (Dwarf_Attribute attr, char **return_string, |
| 261 | Dwarf_Error *errdesc); |
| 262 | |
| 263 | /* Return location expression list. */ |
| 264 | extern int dwarf_loclist (Dwarf_Attribute attr, Dwarf_Locdesc **llbuf, |
| 265 | Dwarf_Signed *listlen, Dwarf_Error *errdesc); |
| 266 | |
| 267 | |
| 268 | /* Return source lines of compilation unit. */ |
| 269 | extern int dwarf_srclines (Dwarf_Die die, Dwarf_Line **linebuf, |
| 270 | Dwarf_Signed *linecount, Dwarf_Error *errdesc); |
| 271 | |
| 272 | /* Return files used in compilation unit. */ |
| 273 | extern int dwarf_srcfiles (Dwarf_Die die, char ***srcfiles, |
| 274 | Dwarf_Signed *srcfilecount, Dwarf_Error *errdesc); |
| 275 | |
| 276 | /* Determine whether line is the beginning of a statement. */ |
| 277 | extern int dwarf_linebeginstatement (Dwarf_Line line, Dwarf_Bool *return_bool, |
| 278 | Dwarf_Error *errdesc); |
| 279 | |
| 280 | /* Determine whether line is marked as ending a text sequence. */ |
| 281 | extern int dwarf_lineendsequence (Dwarf_Line line, Dwarf_Bool *return_bool, |
| 282 | Dwarf_Error *errdesc); |
| 283 | |
| 284 | /* Return source statement line number. */ |
| 285 | extern int dwarf_lineno (Dwarf_Line line, Dwarf_Unsigned *return_lineno, |
| 286 | Dwarf_Error *errdesc); |
| 287 | |
| 288 | /* Return address associate with line. */ |
| 289 | extern int dwarf_lineaddr (Dwarf_Line line, Dwarf_Addr *return_lineaddr, |
| 290 | Dwarf_Error *errdesc); |
| 291 | |
| 292 | /* Return column at which the statement begins. */ |
| 293 | extern int dwarf_lineoff (Dwarf_Line line, Dwarf_Signed *return_lineoff, |
| 294 | Dwarf_Error *errdesc); |
| 295 | |
| 296 | /* Return source file for line. */ |
| 297 | extern int dwarf_linesrc (Dwarf_Line line, char **return_linesrc, |
| 298 | Dwarf_Error *errdesc); |
| 299 | |
| 300 | /* Determine whether line is marked as beginning a basic block. */ |
| 301 | extern int dwarf_lineblock (Dwarf_Line line, Dwarf_Bool *return_bool, |
| 302 | Dwarf_Error *errdesc); |
| 303 | |
| 304 | /* Determine whether line is marked as ending the prologue. */ |
| 305 | extern int dwarf_lineprologueend (Dwarf_Line line, Dwarf_Bool *return_bool, |
| 306 | Dwarf_Error *errdesc); |
| 307 | |
| 308 | /* Determine whether line is marked as beginning the epilogue. */ |
| 309 | extern int dwarf_lineepiloguebegin (Dwarf_Line line, Dwarf_Bool *return_bool, |
| 310 | Dwarf_Error *errdesc); |
| 311 | |
| 312 | |
| 313 | /* Return list of global definitions. */ |
| 314 | extern int dwarf_get_globals (Dwarf_Debug dbg, Dwarf_Global **globals, |
| 315 | Dwarf_Signed *return_count, |
| 316 | Dwarf_Error *errdesc); |
| 317 | |
| 318 | /* Return name for global definition. */ |
| 319 | extern int dwarf_globname (Dwarf_Global global, char **return_name, |
| 320 | Dwarf_Error *errdesc); |
| 321 | |
| 322 | /* Return DIE offset for global definition. */ |
| 323 | extern int dwarf_global_die_offset (Dwarf_Global global, |
| 324 | Dwarf_Off *return_offset, |
| 325 | Dwarf_Error *errdesc); |
| 326 | |
| 327 | /* Return offset of header of compile unit containing the global definition. */ |
| 328 | extern int dwarf_global_cu_offset (Dwarf_Global global, |
| 329 | Dwarf_Off *return_offset, |
| 330 | Dwarf_Error *errdesc); |
| 331 | |
| 332 | /* Return name, DIE offset, and offset of the compile unit DIE for the |
| 333 | global definition. */ |
| 334 | extern int dwarf_global_name_offsets (Dwarf_Global global, char **return_name, |
| 335 | Dwarf_Off *die_offset, |
| 336 | Dwarf_Off *cu_offset, |
| 337 | Dwarf_Error *errdesc); |
| 338 | |
| 339 | |
| 340 | /* Find start of macro value. */ |
| 341 | extern char *dwarf_find_macro_value_start (char *macro_string); |
| 342 | |
| 343 | |
| 344 | /* Return string from debug string section. */ |
| 345 | extern int dwarf_get_str (Dwarf_Debug dbg, Dwarf_Off offset, char **string, |
| 346 | Dwarf_Signed *returned_str_len, |
| 347 | Dwarf_Error *errdesc); |
| 348 | |
| 349 | |
| 350 | /* Return list address ranges. */ |
| 351 | extern int dwarf_get_aranges (Dwarf_Debug dbg, Dwarf_Arange **aranges, |
| 352 | Dwarf_Signed *return_count, |
| 353 | Dwarf_Error *errdesc); |
| 354 | |
| 355 | /* Find matching range for address. */ |
| 356 | extern int dwarf_get_arange (Dwarf_Arange *aranges, |
| 357 | Dwarf_Unsigned arange_count, Dwarf_Addr address, |
| 358 | Dwarf_Arange *return_arange, |
| 359 | Dwarf_Error *errdesc); |
| 360 | |
| 361 | /* Return offset of compile unit DIE containing the range. */ |
| 362 | extern int dwarf_get_cu_die_offset (Dwarf_Arange arange, |
| 363 | Dwarf_Off *return_offset, |
| 364 | Dwarf_Error *errdesc); |
| 365 | |
| 366 | /* Return start, length, and CU DIE offset of range. */ |
| 367 | extern int dwarf_get_arange_info (Dwarf_Arange arange, Dwarf_Addr *start, |
| 368 | Dwarf_Unsigned *length, |
| 369 | Dwarf_Off *cu_die_offset, |
| 370 | Dwarf_Error *errdesc); |
| 371 | |
| 372 | |
| 373 | /* Frame descriptor handling. */ |
| 374 | |
| 375 | /* Get frame descriptions. GCC version using .eh_frame. */ |
| 376 | extern int dwarf_get_fde_list_eh (Dwarf_Debug dbg, Dwarf_Cie **cie_data, |
| 377 | Dwarf_Signed *cie_element_count, |
| 378 | Dwarf_Fde **fde_data, |
| 379 | Dwarf_Signed *fde_element_count, |
| 380 | Dwarf_Error *errdesc); |
| 381 | |
| 382 | /* Get CIE of FDE. */ |
| 383 | extern int dwarf_get_cie_of_fde (Dwarf_Fde fde, Dwarf_Cie *return_cie, |
| 384 | Dwarf_Error *errdesc); |
| 385 | |
| 386 | /* Get information about the function range. */ |
| 387 | extern int dwarf_get_fde_range (Dwarf_Fde fde, Dwarf_Addr *low_pc, |
| 388 | Dwarf_Unsigned *func_length, |
| 389 | Dwarf_Ptr *fde_bytes, |
| 390 | Dwarf_Unsigned *fde_byte_length, |
| 391 | Dwarf_Off *cie_offset, Dwarf_Signed *cie_index, |
| 392 | Dwarf_Off *fde_offset, Dwarf_Error *errdesc); |
| 393 | |
| 394 | /* Get information about CIE. */ |
| 395 | extern int dwarf_get_cie_info (Dwarf_Cie cie, Dwarf_Unsigned *bytes_in_cie, |
| 396 | Dwarf_Small *version, char **augmenter, |
| 397 | Dwarf_Unsigned *code_alignment_factor, |
| 398 | Dwarf_Signed *data_alignment_factor, |
| 399 | Dwarf_Half *return_address_register, |
| 400 | Dwarf_Ptr *initial_instructions, |
| 401 | Dwarf_Unsigned *initial_instructions_length, |
| 402 | Dwarf_Error *errdesc); |
| 403 | |
| 404 | /* Get frame construction instructions of FDE. */ |
| 405 | extern int dwarf_get_fde_instr_bytes (Dwarf_Fde fde, Dwarf_Ptr *outinstrs, |
| 406 | Dwarf_Unsigned *outlen, |
| 407 | Dwarf_Error *errdesc); |
| 408 | |
| 409 | /* Get nth frame descriptions. */ |
| 410 | extern int dwarf_get_fde_n (Dwarf_Fde *fde_data, Dwarf_Unsigned fde_index, |
| 411 | Dwarf_Fde *returned_fde, Dwarf_Error *errdesc); |
| 412 | |
| 413 | /* Find FDE for given address. */ |
| 414 | extern int dwarf_get_fde_at_pc (Dwarf_Fde *fde_data, Dwarf_Addr pc_of_interest, |
| 415 | Dwarf_Fde *returned_fde, Dwarf_Addr *lopc, |
| 416 | Dwarf_Addr *hipc, Dwarf_Error *errdesc); |
| 417 | |
| 418 | |
| 419 | /* Return location list entry. */ |
| 420 | extern int dwarf_get_loclist_entry (Dwarf_Debug dbg, Dwarf_Unsigned offset, |
| 421 | Dwarf_Addr *hipc_offset, |
| 422 | Dwarf_Addr *lopc_offset, Dwarf_Ptr *data, |
| 423 | Dwarf_Unsigned *entry_len, |
| 424 | Dwarf_Unsigned *next_entry, |
| 425 | Dwarf_Error *errdesc); |
| 426 | |
| 427 | |
| 428 | /* Get abbreviation record. */ |
| 429 | extern int dwarf_get_abbrev (Dwarf_Debug dbg, |
| 430 | Dwarf_Unsigned offset, |
| 431 | Dwarf_Abbrev *returned_abbrev, |
| 432 | Dwarf_Unsigned *length, |
| 433 | Dwarf_Unsigned *attr_count, Dwarf_Error *errdesc); |
| 434 | |
| 435 | /* Get tag of abbreviation record. */ |
| 436 | extern int dwarf_get_abbrev_tag (Dwarf_Abbrev abbrev, Dwarf_Half *return_tag, |
| 437 | Dwarf_Error *errdesc); |
| 438 | |
| 439 | /* Get code of abbreviation record. */ |
| 440 | extern int dwarf_get_abbrev_code (Dwarf_Abbrev abbrev, |
| 441 | Dwarf_Unsigned *return_code, |
| 442 | Dwarf_Error *errdesc); |
| 443 | |
| 444 | /* Get children flag of abbreviation record. */ |
| 445 | extern int dwarf_get_abbrev_children_flag (Dwarf_Abbrev abbrev, |
| 446 | Dwarf_Signed *return_flag, |
| 447 | Dwarf_Error *errdesc); |
| 448 | |
| 449 | /* Get attribute from abbreviation record. */ |
| 450 | extern int dwarf_get_abbrev_entry (Dwarf_Abbrev abbrev, Dwarf_Signed idx, |
| 451 | Dwarf_Half *attr_num, Dwarf_Signed *form, |
| 452 | Dwarf_Off *offset, Dwarf_Error *errdesc); |
| 453 | |
| 454 | |
| 455 | /* Memory handling. */ |
| 456 | |
| 457 | /* Values for ALLOC_TYPE parameter of 'dwarf_dealloc'. */ |
| 458 | enum |
| 459 | { |
| 460 | DW_DLA_NONE = 0, |
| 461 | DW_DLA_STRING, /* char* */ |
| 462 | DW_DLA_LOC, /* Dwarf_Loc */ |
| 463 | DW_DLA_LOCDESC, /* Dwarf_Locdesc */ |
| 464 | DW_DLA_ELLIST, /* Dwarf_Ellist */ |
| 465 | DW_DLA_BOUNDS, /* Dwarf_Bounds */ |
| 466 | DW_DLA_BLOCK, /* Dwarf_Block */ |
| 467 | DW_DLA_DEBUG, /* Dwarf_Debug */ |
| 468 | DW_DLA_DIE, /* Dwarf_Die */ |
| 469 | DW_DLA_LINE, /* Dwarf_Line */ |
| 470 | DW_DLA_ATTR, /* Dwarf_Attribute */ |
| 471 | DW_DLA_TYPE, /* Dwarf_Type */ |
| 472 | DW_DLA_SUBSCR, /* Dwarf_Subscr */ |
| 473 | DW_DLA_GLOBAL, /* Dwarf_Global */ |
| 474 | DW_DLA_ERROR, /* Dwarf_Error */ |
| 475 | DW_DLA_LIST, /* a list */ |
| 476 | DW_DLA_LINEBUF, /* Dwarf_Line* */ |
| 477 | DW_DLA_ARANGE, /* Dwarf_Arange */ |
| 478 | DW_DLA_ABBREV, /* Dwarf_Abbrev */ |
| 479 | DW_DLA_FRAME_OP, /* Dwarf_Frame_Op */ |
| 480 | DW_DLA_CIE, /* Dwarf_Cie */ |
| 481 | DW_DLA_FDE, /* Dwarf_Fde */ |
| 482 | DW_DLA_LOC_BLOCK, /* Dwarf_Loc Block */ |
| 483 | DW_DLA_FRAME_BLOCK, /* Dwarf_Frame Block */ |
| 484 | DW_DLA_FUNC, /* Dwarf_Func */ |
| 485 | DW_DLA_TYPENAME, /* Dwarf_Type */ |
| 486 | DW_DLA_VAR, /* Dwarf_Var */ |
| 487 | DW_DLA_WEAK, /* Dwarf_Weak */ |
| 488 | DW_DLA_ADDR, /* Dwarf_Addr sized entries */ |
| 489 | }; |
| 490 | |
| 491 | /* Deallocate memory. */ |
| 492 | extern void dwarf_dealloc (Dwarf_Debug dbg, Dwarf_Ptr space, |
| 493 | Dwarf_Unsigned alloc_type); |
| 494 | |
| 495 | |
| 496 | /* Determine size of address of the binary. */ |
| 497 | extern int dwarf_get_address_size (Dwarf_Debug dbg, Dwarf_Half *addr_size, |
| 498 | Dwarf_Error *errdesc); |
| 499 | |
| 500 | |
| 501 | /* Return error number. */ |
| 502 | extern Dwarf_Unsigned dwarf_errno (Dwarf_Error errdesc); |
| 503 | |
| 504 | /* Return string corresponding to error. */ |
| 505 | extern const char *dwarf_errmsg (Dwarf_Error errdesc); |
| 506 | |
| 507 | |
| 508 | /* Set new error handler. */ |
| 509 | extern Dwarf_Handler dwarf_seterrhand (Dwarf_Debug dbg, Dwarf_Handler errhand); |
| 510 | |
| 511 | /* Set new error handler argument. */ |
| 512 | extern Dwarf_Ptr dwarf_seterrarg (Dwarf_Debug dbg, Dwarf_Ptr errarg); |
| 513 | |
| 514 | #endif /* libdwarf.h */ |