| 1 |
/* |
| 2 |
Copyright (C) 2000-2010 Silicon Graphics, Inc. All Rights Reserved. |
| 3 |
Portions Copyright 2007-2010 Sun Microsystems, Inc. All rights reserved. |
| 4 |
Portions Copyright 2008-2024 David Anderson. All rights reserved. |
| 5 |
Portions Copyright 2008-2010 Arxan Technologies, Inc. All rights reserved. |
| 6 |
Portions Copyright 2010-2012 SN Systems Ltd. All rights reserved. |
| 7 |
|
| 8 |
This program is free software; you can redistribute it |
| 9 |
and/or modify it under the terms of version 2.1 of the |
| 10 |
GNU Lesser General Public License as published by the Free |
| 11 |
Software Foundation. |
| 12 |
|
| 13 |
This program is distributed in the hope that it would be |
| 14 |
useful, but WITHOUT ANY WARRANTY; without even the implied |
| 15 |
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 16 |
PURPOSE. |
| 17 |
|
| 18 |
Further, this software is distributed without any warranty |
| 19 |
that it is free of the rightful claim of any third person |
| 20 |
regarding infringement or the like. Any license provided |
| 21 |
herein, whether implied or otherwise, applies only to this |
| 22 |
software file. Patent licenses, if any, provided herein |
| 23 |
do not apply to combinations of this program with other |
| 24 |
software, or any other product whatsoever. |
| 25 |
|
| 26 |
You should have received a copy of the GNU Lesser General |
| 27 |
Public License along with this program; if not, write the |
| 28 |
Free Software Foundation, Inc., 51 Franklin Street - Fifth |
| 29 |
Floor, Boston MA 02110-1301, USA. |
| 30 |
|
| 31 |
*/ |
| 32 |
/*! @file*/ |
| 33 |
/*! @page libdwarf.h |
| 34 |
@tableofcontents |
| 35 |
libdwarf.h contains all the type declarations |
| 36 |
and function function declarations |
| 37 |
needed to use the library. It is essential |
| 38 |
that coders include dwarf.h before |
| 39 |
including libdwarf.h. |
| 40 |
|
| 41 |
All identifiers here in the public namespace begin with |
| 42 |
DW_ or Dwarf_ or dwarf_ . |
| 43 |
All function argument names declared here begin with dw_ . |
| 44 |
*/ |
| 45 |
|
| 46 |
#ifndef _LIBDWARF_H |
| 47 |
#define _LIBDWARF_H |
| 48 |
|
| 49 |
#ifdef DW_API |
| 50 |
#undef DW_API |
| 51 |
#endif /* DW_API */ |
| 52 |
|
| 53 |
#ifndef LIBDWARF_STATIC |
| 54 |
# if defined(_WIN32) || defined(__CYGWIN__) |
| 55 |
# ifdef LIBDWARF_BUILD |
| 56 |
# define DW_API __declspec(dllexport) |
| 57 |
# else /* !LIBDWARF_BUILD */ |
| 58 |
# define DW_API __declspec(dllimport) |
| 59 |
# endif /* LIBDWARF_BUILD */ |
| 60 |
# elif (defined(__SUNPRO_C) || defined(__SUNPRO_CC)) |
| 61 |
# if defined(PIC) || defined(__PIC__) |
| 62 |
# define DW_API __global |
| 63 |
# endif /* __PIC__ */ |
| 64 |
# elif (defined(__GNUC__) && __GNUC__ >= 4) || \ |
| 65 |
defined(__INTEL_COMPILER) |
| 66 |
# if defined(PIC) || defined(__PIC__) |
| 67 |
# define DW_API __attribute__ ((visibility("default"))) |
| 68 |
# endif /* PIC */ |
| 69 |
# endif /* WIN32 SUNPRO GNUC */ |
| 70 |
#endif /* !LIBDWARF_STATIC */ |
| 71 |
|
| 72 |
#ifndef DW_API |
| 73 |
#define DW_API |
| 74 |
#endif /* DW_API */ |
| 75 |
|
| 76 |
#ifdef __cplusplus |
| 77 |
extern "C" { |
| 78 |
#endif /* __cplusplus */ |
| 79 |
|
| 80 |
/* |
| 81 |
libdwarf.h |
| 82 |
Revision: #9 Date: 2008/01/17 |
| 83 |
|
| 84 |
For libdwarf consumers (reading DWARF2 and later) |
| 85 |
|
| 86 |
The interface is defined as having 8-byte signed and unsigned |
| 87 |
values so it can handle 64-or-32bit target on 64-or-32bit host. |
| 88 |
Dwarf_Ptr is the native size: it represents pointers on |
| 89 |
the host machine (not the target!). |
| 90 |
|
| 91 |
This contains declarations for types and all producer |
| 92 |
and consumer functions. |
| 93 |
|
| 94 |
Function declarations are written on a single line each here |
| 95 |
so one can use grep to each declaration in its entirety. |
| 96 |
The declarations are a little harder to read this way, but... |
| 97 |
*/ |
| 98 |
/*! @section defines Defines and Types |
| 99 |
*/ |
| 100 |
|
| 101 |
/* Semantic Version identity for this libdwarf.h */ |
| 102 |
#define DW_LIBDWARF_VERSION "0.11.1" |
| 103 |
#define DW_LIBDWARF_VERSION_MAJOR 0 |
| 104 |
#define DW_LIBDWARF_VERSION_MINOR 11 |
| 105 |
#define DW_LIBDWARF_VERSION_MICRO 1 |
| 106 |
|
| 107 |
#define DW_PATHSOURCE_unspecified 0 |
| 108 |
#define DW_PATHSOURCE_basic 1 |
| 109 |
#define DW_PATHSOURCE_dsym 2 /* MacOS dSYM */ |
| 110 |
#define DW_PATHSOURCE_debuglink 3 /* GNU debuglink */ |
| 111 |
|
| 112 |
#ifndef DW_FTYPE_UNKNOWN |
| 113 |
#define DW_FTYPE_UNKNOWN 0 |
| 114 |
#define DW_FTYPE_ELF 1 /* Unix/Linux/etc */ |
| 115 |
#define DW_FTYPE_MACH_O 2 /* MacOS. */ |
| 116 |
#define DW_FTYPE_PE 3 /* Windows */ |
| 117 |
#define DW_FTYPE_ARCHIVE 4 /* unix archive */ |
| 118 |
#define DW_FTYPE_APPLEUNIVERSAL 5 |
| 119 |
#endif /* DW_FTYPE_UNKNOWN */ |
| 120 |
/* standard return values for functions */ |
| 121 |
#define DW_DLV_NO_ENTRY -1 |
| 122 |
#define DW_DLV_OK 0 |
| 123 |
#define DW_DLV_ERROR 1 |
| 124 |
/* These support opening DWARF5 split dwarf objects and |
| 125 |
Elf SHT_GROUP blocks of DWARF sections. */ |
| 126 |
#define DW_GROUPNUMBER_ANY 0 |
| 127 |
#define DW_GROUPNUMBER_BASE 1 |
| 128 |
#define DW_GROUPNUMBER_DWO 2 |
| 129 |
|
| 130 |
/* FRAME special values */ |
| 131 |
/* The following 3 are assigned numbers, but |
| 132 |
are only present at run time. |
| 133 |
Must not conflict with DW_FRAME values in dwarf.h */ |
| 134 |
/* Taken as meaning 'undefined value', this is not |
| 135 |
a column or register number. */ |
| 136 |
#ifndef DW_FRAME_UNDEFINED_VAL |
| 137 |
#define DW_FRAME_UNDEFINED_VAL 12288 |
| 138 |
#endif |
| 139 |
/* Taken as meaning 'same value' as caller had, |
| 140 |
not a column or register number */ |
| 141 |
#ifndef DW_FRAME_SAME_VAL |
| 142 |
#define DW_FRAME_SAME_VAL 12289 |
| 143 |
#endif |
| 144 |
/* DW_FRAME_CFA_COL is assigned a virtual table position |
| 145 |
but is accessed via CFA specific calls. */ |
| 146 |
#ifndef DW_FRAME_CFA_COL |
| 147 |
#define DW_FRAME_CFA_COL 12290 |
| 148 |
#endif |
| 149 |
#define DW_FRAME_CFA_COL3 DW_FRAME_CFA_COL /*compatibility name*/ |
| 150 |
/* END FRAME special values */ |
| 151 |
|
| 152 |
/* dwarf_pcline function, slide arguments |
| 153 |
*/ |
| 154 |
#define DW_DLS_BACKWARD -1 /* slide backward to find line */ |
| 155 |
#define DW_DLS_NOSLIDE 0 /* match exactly without sliding */ |
| 156 |
#define DW_DLS_FORWARD 1 /* slide forward to find line */ |
| 157 |
|
| 158 |
/* Defined larger than necessary. |
| 159 |
struct Dwarf_Debug_Fission_Per_CU_s, |
| 160 |
being visible, will be difficult to change: |
| 161 |
binary compatibility. The count is for arrays |
| 162 |
inside the struct, the struct itself is |
| 163 |
a single struct. */ |
| 164 |
#define DW_FISSION_SECT_COUNT 12 |
| 165 |
|
| 166 |
/*! @defgroup basicdatatypes Basic Library Datatypes Group |
| 167 |
@{ |
| 168 |
@typedef Dwarf_Unsigned |
| 169 |
The basic unsigned data type. |
| 170 |
Intended to be an unsigned 64bit value. |
| 171 |
@typedef Dwarf_Signed |
| 172 |
The basic signed data type. |
| 173 |
Intended to be a signed 64bit value. |
| 174 |
@typedef Dwarf_Off |
| 175 |
Used for offsets. It should be same size as Dwarf_Unsigned. |
| 176 |
@typedef Dwarf_Addr |
| 177 |
Used when a data item is a an address represented |
| 178 |
in DWARF. 64 bits. Must be as large as the largest |
| 179 |
object address size. |
| 180 |
@typedef Dwarf_Half |
| 181 |
Many libdwarf values (attribute codes, for example) |
| 182 |
are defined by the standard to be 16 bits, and |
| 183 |
this datatype reflects that (the type must be |
| 184 |
at least 16 bits wide). |
| 185 |
@typedef Dwarf_Bool |
| 186 |
A TRUE(non-zero)/FALSE(zero) data item. |
| 187 |
@typedef Dwarf_Ptr |
| 188 |
A generic pointer type. It uses void * |
| 189 |
so it cannot be added-to or subtracted-from. |
| 190 |
@typedef Dwarf_Small |
| 191 |
Used for small unsigned integers and |
| 192 |
used as Dwarf_Small* for pointers and |
| 193 |
it supports pointer addition and subtraction |
| 194 |
conveniently. |
| 195 |
*/ |
| 196 |
typedef unsigned long long Dwarf_Unsigned; |
| 197 |
typedef signed long long Dwarf_Signed; |
| 198 |
typedef unsigned long long Dwarf_Off; |
| 199 |
typedef unsigned long long Dwarf_Addr; |
| 200 |
/* Dwarf_Bool as int is wasteful, but for compatibility |
| 201 |
it must stay as int, not unsigned char. */ |
| 202 |
typedef int Dwarf_Bool; /* boolean type */ |
| 203 |
typedef unsigned short Dwarf_Half; /* 2 byte unsigned value */ |
| 204 |
typedef unsigned char Dwarf_Small; /* 1 byte unsigned value */ |
| 205 |
/* If sizeof(Dwarf_Half) is greater than 2 |
| 206 |
we believe libdwarf still works properly. */ |
| 207 |
|
| 208 |
typedef void* Dwarf_Ptr; /* host machine pointer */ |
| 209 |
/*! @} endgroup basicdatatypes */ |
| 210 |
|
| 211 |
/*! @defgroup enums Enumerators with various purposes |
| 212 |
@{ |
| 213 |
@enum Dwarf_Ranges_Entry_Type |
| 214 |
The dwr_addr1/addr2 data is either pair of offsets |
| 215 |
of a base pc address (DW_RANGES_ENTRY) |
| 216 |
or a base pc address (dwr_addr2 in DW_RANGES_ADDRESS_SELECTION) or |
| 217 |
both are zero(end of list, DW_RANGES_END) |
| 218 |
or both non-zero but identical |
| 219 |
(means an empty range, DW_RANGES_ENTRY). |
| 220 |
These are for use with DWARF 2,3,4. |
| 221 |
|
| 222 |
DW_RANGES_ADDRESS_SELECTION should have been spelled |
| 223 |
DW_RANGES_BASE_ADDRESS. but it is not worth changing |
| 224 |
as it is widely used. |
| 225 |
|
| 226 |
The DW_RANGES_ENTRY values are raw pc offset data recorded |
| 227 |
in the section, not addresses. |
| 228 |
@see examplev |
| 229 |
|
| 230 |
Dwarf_Ranges* apply to DWARF2,3, and 4. |
| 231 |
Not to DWARF5 (the data is different and |
| 232 |
in a new DWARF5 section). |
| 233 |
*/ |
| 234 |
enum Dwarf_Ranges_Entry_Type { DW_RANGES_ENTRY, |
| 235 |
DW_RANGES_ADDRESS_SELECTION, |
| 236 |
DW_RANGES_END |
| 237 |
}; |
| 238 |
|
| 239 |
/*! @enum Dwarf_Form_Class |
| 240 |
The dwarf specification separates FORMs into |
| 241 |
different classes. To do the separation properly |
| 242 |
requires 4 pieces of data as of DWARF4 (thus the |
| 243 |
function arguments listed here). |
| 244 |
The DWARF4 specification class definition suffices to |
| 245 |
describe all DWARF versions. |
| 246 |
See section 7.5.4, Attribute Encodings. |
| 247 |
A return of DW_FORM_CLASS_UNKNOWN means the library |
| 248 |
could not properly figure |
| 249 |
out what form-class it is. |
| 250 |
|
| 251 |
DW_FORM_CLASS_FRAMEPTR is MIPS/IRIX only, and refers |
| 252 |
to the DW_AT_MIPS_fde attribute (a reference to the |
| 253 |
.debug_frame section). |
| 254 |
|
| 255 |
DWARF5: |
| 256 |
DW_FORM_CLASS_LOCLISTSPTR is like DW_FORM_CLASS_LOCLIST |
| 257 |
except that LOCLISTSPTR is always a section offset, |
| 258 |
never an index, and LOCLISTSPTR is only referenced |
| 259 |
by DW_AT_loclists_base. |
| 260 |
Note DW_FORM_CLASS_LOCLISTSPTR spelling to distinguish |
| 261 |
from DW_FORM_CLASS_LOCLISTPTR. |
| 262 |
|
| 263 |
DWARF5: |
| 264 |
DW_FORM_CLASS_RNGLISTSPTR is like DW_FORM_CLASS_RNGLIST |
| 265 |
except that RNGLISTSPTR is always a section offset, |
| 266 |
never an index. DW_FORM_CLASS_RNGLISTSPTR is only |
| 267 |
referenced by DW_AT_rnglists_base. |
| 268 |
*/ |
| 269 |
enum Dwarf_Form_Class { |
| 270 |
DW_FORM_CLASS_UNKNOWN = 0, |
| 271 |
DW_FORM_CLASS_ADDRESS = 1, |
| 272 |
DW_FORM_CLASS_BLOCK = 2, |
| 273 |
DW_FORM_CLASS_CONSTANT =3, |
| 274 |
DW_FORM_CLASS_EXPRLOC = 4, |
| 275 |
DW_FORM_CLASS_FLAG = 5, |
| 276 |
DW_FORM_CLASS_LINEPTR = 6, |
| 277 |
DW_FORM_CLASS_LOCLISTPTR=7, /* DWARF2,3,4 only */ |
| 278 |
DW_FORM_CLASS_MACPTR = 8, /* DWARF2,3,4 only */ |
| 279 |
DW_FORM_CLASS_RANGELISTPTR=9, /* DWARF2,3,4 only */ |
| 280 |
DW_FORM_CLASS_REFERENCE=10, |
| 281 |
DW_FORM_CLASS_STRING = 11, |
| 282 |
DW_FORM_CLASS_FRAMEPTR= 12, /* MIPS/IRIX DWARF2 only */ |
| 283 |
DW_FORM_CLASS_MACROPTR= 13, /* DWARF5 */ |
| 284 |
DW_FORM_CLASS_ADDRPTR = 14, /* DWARF5 */ |
| 285 |
DW_FORM_CLASS_LOCLIST = 15, /* DWARF5 */ |
| 286 |
DW_FORM_CLASS_LOCLISTSPTR=16, /* DWARF5 */ |
| 287 |
DW_FORM_CLASS_RNGLIST =17, /* DWARF5 */ |
| 288 |
DW_FORM_CLASS_RNGLISTSPTR=18, /* DWARF5 */ |
| 289 |
DW_FORM_CLASS_STROFFSETSPTR=19 /* DWARF5 */ |
| 290 |
}; |
| 291 |
/*! @} endgroupenums*/ |
| 292 |
|
| 293 |
/*! @defgroup allstructs Defined and Opaque Structs |
| 294 |
@{ |
| 295 |
|
| 296 |
@typedef Dwarf_Form_Data16 |
| 297 |
a container for a DW_FORM_data16 data item. |
| 298 |
We have no integer types suitable so this special |
| 299 |
struct is used instead. It is up to consumers/producers |
| 300 |
to deal with the contents. |
| 301 |
*/ |
| 302 |
typedef struct Dwarf_Form_Data16_s { |
| 303 |
unsigned char fd_data[16]; |
| 304 |
} Dwarf_Form_Data16; |
| 305 |
|
| 306 |
/*! @typedef Dwarf_Sig8 |
| 307 |
Used for signatures where ever they appear. |
| 308 |
It is not a string, it |
| 309 |
is 8 bytes of a signature one would use to find |
| 310 |
a type unit. |
| 311 |
@see dwarf_formsig8 |
| 312 |
*/ |
| 313 |
typedef struct Dwarf_Sig8_s { |
| 314 |
char signature[8]; |
| 315 |
} Dwarf_Sig8; |
| 316 |
|
| 317 |
/*! @typedef Dwarf_Block |
| 318 |
|
| 319 |
Used to hold uninterpreted blocks of data. |
| 320 |
bl_data refers to on an uninterpreted block of data |
| 321 |
Used with certain location information functions, |
| 322 |
a frame expression function, expanded |
| 323 |
frame instructions, and |
| 324 |
DW_FORM_block functions. |
| 325 |
|
| 326 |
@see dwarf_formblock |
| 327 |
@see explainformblock |
| 328 |
|
| 329 |
*/ |
| 330 |
typedef struct Dwarf_Block_s { |
| 331 |
Dwarf_Unsigned bl_len; |
| 332 |
Dwarf_Ptr bl_data; |
| 333 |
Dwarf_Small bl_from_loclist; |
| 334 |
Dwarf_Unsigned bl_section_offset; |
| 335 |
} Dwarf_Block; |
| 336 |
|
| 337 |
/*! @typedef Dwarf_Locdesc_c |
| 338 |
Provides access to Dwarf_Locdesc_c, a single |
| 339 |
location description |
| 340 |
*/ |
| 341 |
|
| 342 |
typedef struct Dwarf_Locdesc_c_s * Dwarf_Locdesc_c; |
| 343 |
/*! @typedef Dwarf_Loc_Head_c |
| 344 |
provides access to any sort of location description |
| 345 |
for DWARF2,3,4, or 5. |
| 346 |
*/ |
| 347 |
typedef struct Dwarf_Loc_Head_c_s * Dwarf_Loc_Head_c; |
| 348 |
|
| 349 |
/*! @typedef Dwarf_Gnu_Index_Head |
| 350 |
|
| 351 |
A pointer to a struct Dwarf_Gnu_Index_Head_s |
| 352 |
for sections |
| 353 |
.debug_gnu_pubtypes or .debug_gnu_pubnames. |
| 354 |
These are not standard DWARF, and can appear |
| 355 |
with gcc -gdwarf-5 |
| 356 |
*/ |
| 357 |
typedef struct Dwarf_Gnu_Index_Head_s * Dwarf_Gnu_Index_Head; |
| 358 |
|
| 359 |
/*! @typedef Dwarf_Dsc_Head |
| 360 |
Access to DW_AT_discr_list |
| 361 |
array of discriminant values. |
| 362 |
*/ |
| 363 |
typedef struct Dwarf_Dsc_Head_s * Dwarf_Dsc_Head; |
| 364 |
|
| 365 |
/*! @typedef Dwarf_Frame_Instr_Head |
| 366 |
The basis for access to DWARF frame instructions |
| 367 |
(FDE or CIE) |
| 368 |
in full detail. |
| 369 |
*/ |
| 370 |
typedef struct Dwarf_Frame_Instr_Head_s * Dwarf_Frame_Instr_Head; |
| 371 |
|
| 372 |
/*! @typedef dwarf_printf_callback_function_type |
| 373 |
|
| 374 |
Used as a function pointer to a user-written |
| 375 |
callback function. This provides a detailed |
| 376 |
content of line table data. |
| 377 |
|
| 378 |
The default contents of the callback data |
| 379 |
are all zero bytes. So no callbacks |
| 380 |
involving this data will be done. |
| 381 |
|
| 382 |
See dwarf_register_printf_callback() |
| 383 |
|
| 384 |
@param dw_user_pointer |
| 385 |
Passes your callback a pointer to space you allocated as |
| 386 |
an identifier of some kind in calling |
| 387 |
dwarf_register_printf_callback.. |
| 388 |
@param dw_linecontent |
| 389 |
Passes your callback null-terminated string with |
| 390 |
one line of detailed line table content. |
| 391 |
|
| 392 |
*/ |
| 393 |
typedef void (* dwarf_printf_callback_function_type) |
| 394 |
(void * dw_user_pointer, const char * dw_linecontent); |
| 395 |
|
| 396 |
/*! @struct Dwarf_Printf_Callback_Info_s |
| 397 |
|
| 398 |
If one wishes to print detailed line table |
| 399 |
information one creates an instance of this |
| 400 |
struct and fills in the fields and passes |
| 401 |
the struct to the relevant init, for example, |
| 402 |
dwarf_init_path(). |
| 403 |
|
| 404 |
@var dp_user_pointer |
| 405 |
A pointer to data of use in a call back. |
| 406 |
@var dp_fptr |
| 407 |
@var dp_buffer |
| 408 |
@var dp_buffer_len |
| 409 |
@var dp_buffer_user_provided |
| 410 |
@var dp_reserved. |
| 411 |
Set to zero. |
| 412 |
*/ |
| 413 |
struct Dwarf_Printf_Callback_Info_s { |
| 414 |
void * dp_user_pointer; |
| 415 |
dwarf_printf_callback_function_type dp_fptr; |
| 416 |
char * dp_buffer; |
| 417 |
unsigned int dp_buffer_len; |
| 418 |
int dp_buffer_user_provided; |
| 419 |
void * dp_reserved; |
| 420 |
}; |
| 421 |
|
| 422 |
/*! @struct Dwarf_Cmdline_Options_s |
| 423 |
|
| 424 |
check_verbose_mode defaults to FALSE. |
| 425 |
If a libdwarf-calling program sets |
| 426 |
this TRUE it means some errors in Line Table |
| 427 |
headers get a much more detailed description |
| 428 |
of the error which is reported the caller via |
| 429 |
printf_callback() function (the caller |
| 430 |
can do something with the message). |
| 431 |
Or the libdwarf calling code can call |
| 432 |
dwarf_record_cmdline_options() to set |
| 433 |
the new value. |
| 434 |
|
| 435 |
For convenience the type name for the struct |
| 436 |
is Dwarf_Cmdline_Options. |
| 437 |
|
| 438 |
@var check_verbose_mode |
| 439 |
|
| 440 |
*/ |
| 441 |
struct Dwarf_Cmdline_Options_s { |
| 442 |
Dwarf_Bool check_verbose_mode; |
| 443 |
}; |
| 444 |
/*! @typedef Dwarf_Cmdline_Options |
| 445 |
|
| 446 |
*/ |
| 447 |
typedef struct Dwarf_Cmdline_Options_s Dwarf_Cmdline_Options; |
| 448 |
|
| 449 |
/*! @typedef Dwarf_Str_Offsets_Table |
| 450 |
Provides an access to the .debug_str_offsets |
| 451 |
section independently of other DWARF sections. |
| 452 |
Mainly of use in examining the .debug_str_offsets |
| 453 |
section content for problems. |
| 454 |
*/ |
| 455 |
typedef struct Dwarf_Str_Offsets_Table_s * Dwarf_Str_Offsets_Table; |
| 456 |
|
| 457 |
/*! @typedef Dwarf_Ranges |
| 458 |
Details of of non-contiguous address ranges |
| 459 |
of DIEs for DWARF2, DWARF3, and DWARF4. |
| 460 |
Sufficient for older dwarf. |
| 461 |
|
| 462 |
dwr_addr1 and dwr_addr2 in the struct are |
| 463 |
offsets from a base address in the CU involved. |
| 464 |
To calculate actual range pc addresses see |
| 465 |
the example: |
| 466 |
|
| 467 |
@see examplev |
| 468 |
*/ |
| 469 |
typedef struct Dwarf_Ranges_s { |
| 470 |
Dwarf_Addr dwr_addr1; |
| 471 |
Dwarf_Addr dwr_addr2; |
| 472 |
enum Dwarf_Ranges_Entry_Type dwr_type; |
| 473 |
} Dwarf_Ranges; |
| 474 |
|
| 475 |
/*! @typedef Dwarf_Regtable_Entry3 |
| 476 |
For each index i (naming a hardware register with dwarf number |
| 477 |
i) the following is true and defines the value of that register: |
| 478 |
|
| 479 |
If dw_regnum is Register DW_FRAME_UNDEFINED_VAL |
| 480 |
it is not DWARF register number but |
| 481 |
a place holder indicating the register |
| 482 |
has no defined value. |
| 483 |
If dw_regnum is Register DW_FRAME_SAME_VAL |
| 484 |
it is not DWARF register number but |
| 485 |
a place holder indicating the register has the same |
| 486 |
value in the previous frame. |
| 487 |
|
| 488 |
DW_FRAME_UNDEFINED_VAL, DW_FRAME_SAME_VAL and |
| 489 |
DW_FRAME_CFA_COL are only present at libdwarf runtime. |
| 490 |
Never on disk. |
| 491 |
DW_FRAME_* Values present on disk are in dwarf.h |
| 492 |
Because DW_FRAME_SAME_VAL and DW_FRAME_UNDEFINED_VAL |
| 493 |
and DW_FRAME_CFA_COL are definable at runtime |
| 494 |
consider the names symbolic in this comment, |
| 495 |
not absolute. |
| 496 |
|
| 497 |
Otherwise: the register number is a DWARF register number |
| 498 |
(see ABI documents for how this translates to hardware/ |
| 499 |
software register numbers in the machine hardware) |
| 500 |
and the following applies: |
| 501 |
|
| 502 |
In a cfa-defining entry (rt3_cfa_rule) the regnum is the |
| 503 |
CFA 'register number'. Which is some 'normal' register, |
| 504 |
not DW_FRAME_CFA_COL, nor DW_FRAME_SAME_VAL, nor |
| 505 |
DW_FRAME_UNDEFINED_VAL. |
| 506 |
|
| 507 |
If dw_value_type == DW_EXPR_OFFSET (the only |
| 508 |
possible case for dwarf2): |
| 509 |
If dw_offset_relevant is non-zero, then |
| 510 |
the value is stored at at the address |
| 511 |
CFA+N where N (dw_offset) is a signed offset, |
| 512 |
(not unsigned) and must be cast to Dwarf_Signed |
| 513 |
before use. |
| 514 |
dw_regnum is the cfa register rule which means |
| 515 |
one ignores dw_regnum and uses the CFA appropriately. |
| 516 |
Rule: Offset(N) |
| 517 |
If dw_offset_relevant is zero, then the |
| 518 |
value of the register |
| 519 |
is the value of (DWARF) register number dw_regnum. |
| 520 |
Rule: register(R) |
| 521 |
If dw_value_type == DW_EXPR_VAL_OFFSET |
| 522 |
the value of this register is CFA +N where |
| 523 |
N (dw_offset) is a signed offset (not unsigned) |
| 524 |
and must be cast to Dwarf_Signed before use. |
| 525 |
dw_regnum is the cfa register rule which means |
| 526 |
one ignores dw_regnum and uses the CFA appropriately. |
| 527 |
Rule: val_offset(N) |
| 528 |
If dw_value_type == DW_EXPR_EXPRESSION |
| 529 |
The value of the register is the value at the address |
| 530 |
computed by evaluating the DWARF expression E. |
| 531 |
Rule: expression(E) |
| 532 |
The expression E byte stream is pointed to by |
| 533 |
block.bl_data. |
| 534 |
The expression length in bytes is given by |
| 535 |
block.bl_len. |
| 536 |
If dw_value_type == DW_EXPR_VAL_EXPRESSION |
| 537 |
The value of the register is the value |
| 538 |
computed by evaluating the DWARF expression E. |
| 539 |
Rule: val_expression(E) |
| 540 |
The expression E byte stream is pointed to |
| 541 |
by block.bl_data. |
| 542 |
The expression length in bytes is given by |
| 543 |
block.bl_len. |
| 544 |
Other values of dw_value_type are an error. |
| 545 |
|
| 546 |
Note that this definition can only deal correctly |
| 547 |
with register numbers that fit in a 16 bit |
| 548 |
unsigned value. Removing this |
| 549 |
restriction would force an incompatible |
| 550 |
change to several functions in the libdwarf API. |
| 551 |
*/ |
| 552 |
|
| 553 |
typedef struct Dwarf_Regtable_Entry3_s { |
| 554 |
Dwarf_Small dw_offset_relevant; |
| 555 |
Dwarf_Small dw_value_type; |
| 556 |
Dwarf_Half dw_regnum; |
| 557 |
Dwarf_Unsigned dw_offset; /* Should be Dwarf_Signed */ |
| 558 |
Dwarf_Unsigned dw_args_size; /* Always zero. */ |
| 559 |
Dwarf_Block dw_block; |
| 560 |
} Dwarf_Regtable_Entry3; |
| 561 |
|
| 562 |
/*! @typedef Dwarf_Regtable3 |
| 563 |
This structs provides a way for applications |
| 564 |
to select the number of frame registers |
| 565 |
and to select names for them. |
| 566 |
|
| 567 |
rt3_rules and rt3_reg_table_size must be filled in before |
| 568 |
calling libdwarf. Filled in with a pointer to an array |
| 569 |
(pointer and array set up by the calling application) |
| 570 |
of rt3_reg_table_size Dwarf_Regtable_Entry3_s structs. |
| 571 |
libdwarf does not allocate or deallocate space for the |
| 572 |
rules, you must do so. libdwarf will initialize the |
| 573 |
contents rules array, you do not need to do so (though |
| 574 |
if you choose to initialize the array somehow that is ok: |
| 575 |
libdwarf will overwrite your initializations with its own). |
| 576 |
|
| 577 |
Note that this definition can only deal correctly |
| 578 |
with register table size that fits in a 16 bit |
| 579 |
unsigned value. |
| 580 |
*/ |
| 581 |
typedef struct Dwarf_Regtable3_s { |
| 582 |
struct Dwarf_Regtable_Entry3_s rt3_cfa_rule; |
| 583 |
Dwarf_Half rt3_reg_table_size; |
| 584 |
struct Dwarf_Regtable_Entry3_s * rt3_rules; |
| 585 |
} Dwarf_Regtable3; |
| 586 |
|
| 587 |
/* Opaque types for Consumer Library. */ |
| 588 |
/*! @typedef Dwarf_Error |
| 589 |
|
| 590 |
@code |
| 591 |
Dwarf_Error error = 0; |
| 592 |
dres = dwarf_siblingof_c(in_die,&return_sib, &error); |
| 593 |
@endcode |
| 594 |
&error is used in calls to return error details |
| 595 |
when the call returns DW_DLV_ERROR. |
| 596 |
*/ |
| 597 |
typedef struct Dwarf_Error_s* Dwarf_Error; |
| 598 |
|
| 599 |
/*! @typedef Dwarf_Debug |
| 600 |
An open Dwarf_Debug points to data that libdwarf |
| 601 |
maintains to support libdwarf calls. |
| 602 |
*/ |
| 603 |
typedef struct Dwarf_Debug_s* Dwarf_Debug; |
| 604 |
|
| 605 |
/*! @typedef Dwarf_Die |
| 606 |
Used to reference a DWARF Debugging Information Entry. |
| 607 |
*/ |
| 608 |
typedef struct Dwarf_Die_s* Dwarf_Die; |
| 609 |
|
| 610 |
/*! @typedef Dwarf_Debug_Addr_Table |
| 611 |
Used to reference a table in section .debug_addr |
| 612 |
*/ |
| 613 |
typedef struct Dwarf_Debug_Addr_Table_s* Dwarf_Debug_Addr_Table; |
| 614 |
|
| 615 |
/*! @typedef Dwarf_Line |
| 616 |
Used to reference a line reference from the .debug_line |
| 617 |
section. |
| 618 |
*/ |
| 619 |
typedef struct Dwarf_Line_s* Dwarf_Line; |
| 620 |
|
| 621 |
/*! @typedef Dwarf_Global |
| 622 |
Used to reference a reference to an entry in |
| 623 |
the .debug_pubnames section. |
| 624 |
*/ |
| 625 |
typedef struct Dwarf_Global_s* Dwarf_Global; |
| 626 |
|
| 627 |
/*! @typedef Dwarf_Type |
| 628 |
Before release 0.6.0 used to reference a reference |
| 629 |
to an entry in |
| 630 |
the .debug_pubtypes section (as well as |
| 631 |
the SGI-only extension .debug_types). |
| 632 |
However, we use Dwarf_Global instead now. |
| 633 |
*/ |
| 634 |
typedef struct Dwarf_Type_s* Dwarf_Type; |
| 635 |
|
| 636 |
/*! @typedef Dwarf_Func |
| 637 |
An SGI extension type which is no longer |
| 638 |
used at all. |
| 639 |
As of release 0.6.0 use Dwarf_Global instead. |
| 640 |
*/ |
| 641 |
typedef struct Dwarf_Func_s* Dwarf_Func; |
| 642 |
/*! @typedef Dwarf_Var |
| 643 |
An SGI extension type which is no longer |
| 644 |
used at all. |
| 645 |
As of release 0.6.0 use Dwarf_Global instead. |
| 646 |
*/ |
| 647 |
typedef struct Dwarf_Var_s* Dwarf_Var; |
| 648 |
/*! @typedef Dwarf_Weak |
| 649 |
An SGI extension type which is no longer |
| 650 |
used at all. |
| 651 |
As of release 0.6.0 use Dwarf_Global instead. |
| 652 |
*/ |
| 653 |
typedef struct Dwarf_Weak_s* Dwarf_Weak; |
| 654 |
|
| 655 |
/*! @typedef Dwarf_Attribute |
| 656 |
Used to reference a Dwarf_Die attribute |
| 657 |
*/ |
| 658 |
typedef struct Dwarf_Attribute_s* Dwarf_Attribute; |
| 659 |
|
| 660 |
/*! @typedef Dwarf_Abbrev |
| 661 |
Used to reference a Dwarf_Abbrev. |
| 662 |
Usually Dwarf_Abbrev are fully handled inside the library |
| 663 |
so one rarely needs to declare the type. |
| 664 |
*/ |
| 665 |
typedef struct Dwarf_Abbrev_s* Dwarf_Abbrev; |
| 666 |
|
| 667 |
/*! @typedef Dwarf_Fde |
| 668 |
|
| 669 |
Used to reference .debug_frame or .eh_frame FDE. |
| 670 |
*/ |
| 671 |
typedef struct Dwarf_Fde_s* Dwarf_Fde; |
| 672 |
/*! @typedef Dwarf_Cie |
| 673 |
|
| 674 |
Used to reference .debug_frame or .eh_frame CIE. |
| 675 |
*/ |
| 676 |
typedef struct Dwarf_Cie_s* Dwarf_Cie; |
| 677 |
|
| 678 |
/*! @typedef Dwarf_Arange |
| 679 |
Used to reference a code address range |
| 680 |
in a section such as .debug_info. |
| 681 |
*/ |
| 682 |
typedef struct Dwarf_Arange_s* Dwarf_Arange; |
| 683 |
/*! @typedef Dwarf_Gdbindex |
| 684 |
Used to reference .gdb_index section data |
| 685 |
which is a fast-access section by and for gdb. |
| 686 |
*/ |
| 687 |
typedef struct Dwarf_Gdbindex_s* Dwarf_Gdbindex; |
| 688 |
/*! @typedef Dwarf_Xu_Index_Header |
| 689 |
Used to reference .debug_cu_index or |
| 690 |
.debug_tu_index sections in a split-dwarf |
| 691 |
package file. |
| 692 |
*/ |
| 693 |
typedef struct Dwarf_Xu_Index_Header_s *Dwarf_Xu_Index_Header; |
| 694 |
/*! @typedef Dwarf_Line_Context |
| 695 |
Used as the general reference line data (.debug_line). |
| 696 |
*/ |
| 697 |
typedef struct Dwarf_Line_Context_s *Dwarf_Line_Context; |
| 698 |
|
| 699 |
/*! @typedef Dwarf_Macro_Context |
| 700 |
Used as the general reference to DWARF5 .debug_macro data. |
| 701 |
*/ |
| 702 |
typedef struct Dwarf_Macro_Context_s *Dwarf_Macro_Context; |
| 703 |
|
| 704 |
/*! @typedef Dwarf_Dnames_Head |
| 705 |
|
| 706 |
Used as the general reference to the DWARF5 .debug_names |
| 707 |
section. |
| 708 |
*/ |
| 709 |
typedef struct Dwarf_Dnames_Head_s *Dwarf_Dnames_Head; |
| 710 |
|
| 711 |
/*! @typedef Dwarf_Handler |
| 712 |
|
| 713 |
Used in rare cases (mainly tiny programs) |
| 714 |
with dwarf_init_path() etc |
| 715 |
initialization calls to provide a pointer |
| 716 |
to a generic-error-handler function you write. |
| 717 |
*/ |
| 718 |
typedef void (*Dwarf_Handler)(Dwarf_Error dw_error, |
| 719 |
Dwarf_Ptr dw_errarg); |
| 720 |
|
| 721 |
/*! @struct Dwarf_Macro_Details_s |
| 722 |
|
| 723 |
This applies to DWARF2, DWARF3, and DWARF4 |
| 724 |
compilation units. |
| 725 |
DWARF5 .debug_macro has its own function interface |
| 726 |
which does not use this struct. |
| 727 |
*/ |
| 728 |
struct Dwarf_Macro_Details_s { |
| 729 |
Dwarf_Off dmd_offset; /* offset, in the section, |
| 730 |
of this macro info */ |
| 731 |
Dwarf_Small dmd_type; /* the type, DW_MACINFO_define etc*/ |
| 732 |
Dwarf_Signed dmd_lineno; /* the source line number where |
| 733 |
applicable and vend_def number if |
| 734 |
vendor_extension op */ |
| 735 |
Dwarf_Signed dmd_fileindex;/* the source file index */ |
| 736 |
char * dmd_macro; /* macro name string */ |
| 737 |
}; |
| 738 |
/*! @typedef Dwarf_Macro_Details |
| 739 |
|
| 740 |
A handy short name for a Dwarf_Macro_Details_S struct. |
| 741 |
*/ |
| 742 |
typedef struct Dwarf_Macro_Details_s Dwarf_Macro_Details; |
| 743 |
|
| 744 |
/*! @typedef Dwarf_Debug_Fission_Per_CU |
| 745 |
|
| 746 |
A handy short name for a Dwarf_Debug_Fission_Per_CU_s struct. |
| 747 |
*/ |
| 748 |
typedef struct Dwarf_Debug_Fission_Per_CU_s |
| 749 |
Dwarf_Debug_Fission_Per_CU; |
| 750 |
|
| 751 |
/* ===== BEGIN Obj_Access data ===== */ |
| 752 |
/*! @typedef Dwarf_Obj_Access_Interface_a |
| 753 |
Used for access to and setting up special data |
| 754 |
allowing access to DWARF even with no object |
| 755 |
files present |
| 756 |
*/ |
| 757 |
typedef struct Dwarf_Obj_Access_Interface_a_s |
| 758 |
Dwarf_Obj_Access_Interface_a; |
| 759 |
|
| 760 |
/*! @typedef Dwarf_Obj_Access_Methods_a |
| 761 |
Used for access to and setting up special data |
| 762 |
allowing access to DWARF even with no object |
| 763 |
files present |
| 764 |
*/ |
| 765 |
typedef struct Dwarf_Obj_Access_Methods_a_s |
| 766 |
Dwarf_Obj_Access_Methods_a; |
| 767 |
|
| 768 |
/*! @typedef Dwarf_Obj_Access_Section_a |
| 769 |
Used for access to and setting up special data |
| 770 |
allowing access to DWARF even with no object |
| 771 |
files present. |
| 772 |
The fields match up with Elf section headers, |
| 773 |
but for non-Elf many of the fields can be set |
| 774 |
to zero. |
| 775 |
*/ |
| 776 |
typedef struct Dwarf_Obj_Access_Section_a_s |
| 777 |
Dwarf_Obj_Access_Section_a; |
| 778 |
struct Dwarf_Obj_Access_Section_a_s { |
| 779 |
const char* as_name; |
| 780 |
Dwarf_Unsigned as_type; |
| 781 |
Dwarf_Unsigned as_flags; |
| 782 |
Dwarf_Addr as_addr; |
| 783 |
Dwarf_Unsigned as_offset; |
| 784 |
Dwarf_Unsigned as_size; |
| 785 |
Dwarf_Unsigned as_link; |
| 786 |
Dwarf_Unsigned as_info; |
| 787 |
Dwarf_Unsigned as_addralign; |
| 788 |
Dwarf_Unsigned as_entrysize; |
| 789 |
}; |
| 790 |
|
| 791 |
/*! @struct Dwarf_Obj_Access_Methods_a_s: |
| 792 |
The functions we need to access object data |
| 793 |
from libdwarf are declared here. |
| 794 |
|
| 795 |
*/ |
| 796 |
struct Dwarf_Obj_Access_Methods_a_s { |
| 797 |
int (*om_get_section_info)(void* obj, |
| 798 |
Dwarf_Unsigned section_index, |
| 799 |
Dwarf_Obj_Access_Section_a* return_section, |
| 800 |
int * error); |
| 801 |
Dwarf_Small (*om_get_byte_order)(void* obj); |
| 802 |
Dwarf_Small (*om_get_length_size)(void* obj); |
| 803 |
Dwarf_Small (*om_get_pointer_size)(void* obj); |
| 804 |
Dwarf_Unsigned (*om_get_filesize)(void* obj); |
| 805 |
Dwarf_Unsigned (*om_get_section_count)(void* obj); |
| 806 |
int (*om_load_section)(void* obj, |
| 807 |
Dwarf_Unsigned section_index, |
| 808 |
Dwarf_Small** return_data, |
| 809 |
int * error); |
| 810 |
int (*om_relocate_a_section)(void* obj, |
| 811 |
Dwarf_Unsigned section_index, |
| 812 |
Dwarf_Debug dbg, |
| 813 |
int * error); |
| 814 |
}; |
| 815 |
struct Dwarf_Obj_Access_Interface_a_s { |
| 816 |
void* ai_object; |
| 817 |
const Dwarf_Obj_Access_Methods_a *ai_methods; |
| 818 |
}; |
| 819 |
/* ===== END Obj_Access data ===== */ |
| 820 |
|
| 821 |
/* User code must allocate this struct, zero it, |
| 822 |
and pass a pointer to it |
| 823 |
into dwarf_get_debugfission_for_cu . */ |
| 824 |
struct Dwarf_Debug_Fission_Per_CU_s { |
| 825 |
/* Do not free the string. It contains "cu" or "tu". */ |
| 826 |
/* If this is not set (ie, not a CU/TU in DWP Package File) |
| 827 |
then pcu_type will be NULL. */ |
| 828 |
const char * pcu_type; |
| 829 |
/* pcu_index is the index (range 1 to N ) |
| 830 |
into the tu/cu table of offsets and the table |
| 831 |
of sizes. 1 to N as the zero index is reserved |
| 832 |
for special purposes. Not a value one |
| 833 |
actually needs. */ |
| 834 |
Dwarf_Unsigned pcu_index; |
| 835 |
Dwarf_Sig8 pcu_hash; /* 8 byte */ |
| 836 |
/* [0] has offset and size 0. |
| 837 |
[1]-[8] are DW_SECT_* indexes and the |
| 838 |
values are the offset and size |
| 839 |
of the respective section contribution |
| 840 |
of a single .dwo object. When pcu_size[n] is |
| 841 |
zero the corresponding section is not present. */ |
| 842 |
Dwarf_Unsigned pcu_offset[DW_FISSION_SECT_COUNT]; |
| 843 |
Dwarf_Unsigned pcu_size[DW_FISSION_SECT_COUNT]; |
| 844 |
Dwarf_Unsigned unused1; |
| 845 |
Dwarf_Unsigned unused2; |
| 846 |
}; |
| 847 |
|
| 848 |
/*! @typedef Dwarf_Rnglists_Head |
| 849 |
Used for access to a set of DWARF5 debug_rnglists |
| 850 |
entries. |
| 851 |
*/ |
| 852 |
typedef struct Dwarf_Rnglists_Head_s * Dwarf_Rnglists_Head; |
| 853 |
|
| 854 |
/*! @} endgroup allstructs */ |
| 855 |
|
| 856 |
/*! @defgroup framedefines Default stack frame macros |
| 857 |
@{ |
| 858 |
*/ |
| 859 |
/* Special values for offset_into_exception_table field |
| 860 |
of dwarf fde's |
| 861 |
The following value indicates that there is no |
| 862 |
Exception table offset |
| 863 |
associated with a dwarf frame. |
| 864 |
*/ |
| 865 |
#define DW_DLX_NO_EH_OFFSET (-1LL) |
| 866 |
/* The following value indicates that the producer |
| 867 |
was unable to analyze the |
| 868 |
source file to generate Exception tables for this function. |
| 869 |
*/ |
| 870 |
#define DW_DLX_EH_OFFSET_UNAVAILABLE (-2LL) |
| 871 |
|
| 872 |
/* The augmenter string for CIE */ |
| 873 |
#define DW_CIE_AUGMENTER_STRING_V0 "z" |
| 874 |
|
| 875 |
/* ***IMPORTANT NOTE, TARGET DEPENDENCY **** |
| 876 |
DW_REG_TABLE_SIZE must be at least as large as |
| 877 |
the number of registers |
| 878 |
DW_FRAME_LAST_REG_NUM as defined in dwarf.h |
| 879 |
*/ |
| 880 |
#ifndef DW_REG_TABLE_SIZE |
| 881 |
#define DW_REG_TABLE_SIZE DW_FRAME_LAST_REG_NUM |
| 882 |
#endif |
| 883 |
|
| 884 |
/* For MIPS, DW_FRAME_SAME_VAL is the correct default value |
| 885 |
for a frame register value. For other CPUS another value |
| 886 |
may be better, such as DW_FRAME_UNDEFINED_VAL. |
| 887 |
See dwarf_set_frame_rule_table_size |
| 888 |
*/ |
| 889 |
#ifndef DW_FRAME_REG_INITIAL_VALUE |
| 890 |
#define DW_FRAME_REG_INITIAL_VALUE DW_FRAME_SAME_VAL |
| 891 |
#endif |
| 892 |
|
| 893 |
/* The following are all needed to evaluate DWARF3 register rules. |
| 894 |
These have nothing to do simply printing |
| 895 |
frame instructions. |
| 896 |
*/ |
| 897 |
#define DW_EXPR_OFFSET 0 /* offset is from CFA reg */ |
| 898 |
#define DW_EXPR_VAL_OFFSET 1 |
| 899 |
#define DW_EXPR_EXPRESSION 2 |
| 900 |
#define DW_EXPR_VAL_EXPRESSION 3 |
| 901 |
/*! @} */ |
| 902 |
|
| 903 |
/*! @defgroup dwdla DW_DLA alloc/dealloc typename&number |
| 904 |
@{ |
| 905 |
|
| 906 |
These identify the various allocate/dealloc |
| 907 |
types. The allocation happens within libdwarf, |
| 908 |
and the deallocation is usually done by |
| 909 |
user code. |
| 910 |
*/ |
| 911 |
#define DW_DLA_STRING 0x01 /* char* */ |
| 912 |
#define DW_DLA_LOC 0x02 /* Dwarf_Loc */ |
| 913 |
#define DW_DLA_LOCDESC 0x03 /* Dwarf_Locdesc */ |
| 914 |
#define DW_DLA_ELLIST 0x04 /* Dwarf_Ellist (not used)*/ |
| 915 |
#define DW_DLA_BOUNDS 0x05 /* Dwarf_Bounds (not used) */ |
| 916 |
#define DW_DLA_BLOCK 0x06 /* Dwarf_Block */ |
| 917 |
#define DW_DLA_DEBUG 0x07 /* Dwarf_Debug */ |
| 918 |
#define DW_DLA_DIE 0x08 /* Dwarf_Die */ |
| 919 |
#define DW_DLA_LINE 0x09 /* Dwarf_Line */ |
| 920 |
#define DW_DLA_ATTR 0x0a /* Dwarf_Attribute */ |
| 921 |
#define DW_DLA_TYPE 0x0b /* Dwarf_Type (not used) */ |
| 922 |
#define DW_DLA_SUBSCR 0x0c /* Dwarf_Subscr (not used) */ |
| 923 |
#define DW_DLA_GLOBAL 0x0d /* Dwarf_Global */ |
| 924 |
#define DW_DLA_ERROR 0x0e /* Dwarf_Error */ |
| 925 |
#define DW_DLA_LIST 0x0f /* a list */ |
| 926 |
#define DW_DLA_LINEBUF 0x10 /* Dwarf_Line* (not used) */ |
| 927 |
#define DW_DLA_ARANGE 0x11 /* Dwarf_Arange */ |
| 928 |
#define DW_DLA_ABBREV 0x12 /* Dwarf_Abbrev */ |
| 929 |
#define DW_DLA_FRAME_INSTR_HEAD 0x13 /* Dwarf_Frame_Instr_Head */ |
| 930 |
#define DW_DLA_CIE 0x14 /* Dwarf_Cie */ |
| 931 |
#define DW_DLA_FDE 0x15 /* Dwarf_Fde */ |
| 932 |
#define DW_DLA_LOC_BLOCK 0x16 /* Dwarf_Loc */ |
| 933 |
|
| 934 |
#define DW_DLA_FRAME_OP 0x17 /* Dwarf_Frame_Op (not used) */ |
| 935 |
#define DW_DLA_FUNC 0x18 /* Dwarf_Func */ |
| 936 |
#define DW_DLA_UARRAY 0x19 /* Array of Dwarf_Off:Jan2023 */ |
| 937 |
#define DW_DLA_VAR 0x1a /* Dwarf_Var */ |
| 938 |
#define DW_DLA_WEAK 0x1b /* Dwarf_Weak */ |
| 939 |
#define DW_DLA_ADDR 0x1c /* Dwarf_Addr sized entries */ |
| 940 |
#define DW_DLA_RANGES 0x1d /* Dwarf_Ranges */ |
| 941 |
/* 0x1e (30) to 0x34 (52) reserved for internal to libdwarf types. */ |
| 942 |
/* .debug_gnu_typenames/pubnames, 2020 */ |
| 943 |
#define DW_DLA_GNU_INDEX_HEAD 0x35 |
| 944 |
|
| 945 |
#define DW_DLA_RNGLISTS_HEAD 0x36 /* .debug_rnglists DW5 */ |
| 946 |
#define DW_DLA_GDBINDEX 0x37 /* Dwarf_Gdbindex */ |
| 947 |
#define DW_DLA_XU_INDEX 0x38 /* Dwarf_Xu_Index_Header */ |
| 948 |
#define DW_DLA_LOC_BLOCK_C 0x39 /* Dwarf_Loc_c*/ |
| 949 |
#define DW_DLA_LOCDESC_C 0x3a /* Dwarf_Locdesc_c */ |
| 950 |
#define DW_DLA_LOC_HEAD_C 0x3b /* Dwarf_Loc_Head_c */ |
| 951 |
#define DW_DLA_MACRO_CONTEXT 0x3c /* Dwarf_Macro_Context */ |
| 952 |
/* 0x3d (61) is for libdwarf internal use. */ |
| 953 |
#define DW_DLA_DSC_HEAD 0x3e /* Dwarf_Dsc_Head */ |
| 954 |
#define DW_DLA_DNAMES_HEAD 0x3f /* Dwarf_Dnames_Head */ |
| 955 |
|
| 956 |
/* struct Dwarf_Str_Offsets_Table_s */ |
| 957 |
#define DW_DLA_STR_OFFSETS 0x40 |
| 958 |
/* struct Dwarf_Debug_Addr_Table_s */ |
| 959 |
#define DW_DLA_DEBUG_ADDR 0x41 |
| 960 |
/*! @} */ |
| 961 |
|
| 962 |
/*! @defgroup dwdle DW_DLE Dwarf_Error numbers |
| 963 |
@{ |
| 964 |
|
| 965 |
These identify the various error codes that have been |
| 966 |
used. Not all of them are still use. |
| 967 |
We do not recycle obsolete codes into new uses. |
| 968 |
The codes 1 through 22 are historic and it is |
| 969 |
unlikely they are used anywhere in the library. |
| 970 |
*/ |
| 971 |
/* libdwarf error numbers */ |
| 972 |
#define DW_DLE_NE 0 /* no error */ |
| 973 |
#define DW_DLE_VMM 1 /* dwarf format/library version mismatch */ |
| 974 |
#define DW_DLE_MAP 2 /* memory map failure */ |
| 975 |
#define DW_DLE_LEE 3 /* libelf error */ |
| 976 |
#define DW_DLE_NDS 4 /* no debug section */ |
| 977 |
#define DW_DLE_NLS 5 /* no line section */ |
| 978 |
#define DW_DLE_ID 6 /* invalid descriptor for query */ |
| 979 |
#define DW_DLE_IOF 7 /* I/O failure */ |
| 980 |
#define DW_DLE_MAF 8 /* memory allocation failure */ |
| 981 |
#define DW_DLE_IA 9 /* invalid argument */ |
| 982 |
#define DW_DLE_MDE 10 /* mangled debugging entry */ |
| 983 |
#define DW_DLE_MLE 11 /* mangled line number entry */ |
| 984 |
#define DW_DLE_FNO 12 /* file not open */ |
| 985 |
#define DW_DLE_FNR 13 /* file not a regular file */ |
| 986 |
#define DW_DLE_FWA 14 /* file open with wrong access */ |
| 987 |
#define DW_DLE_NOB 15 /* not an object file */ |
| 988 |
#define DW_DLE_MOF 16 /* mangled object file header */ |
| 989 |
#define DW_DLE_EOLL 17 /* end of location list entries */ |
| 990 |
#define DW_DLE_NOLL 18 /* no location list section */ |
| 991 |
#define DW_DLE_BADOFF 19 /* Invalid offset */ |
| 992 |
#define DW_DLE_EOS 20 /* end of section */ |
| 993 |
#define DW_DLE_ATRUNC 21 /* abbreviations section appears truncated*/ |
| 994 |
#define DW_DLE_BADBITC 22 /* Address size passed to dwarf bad,*/ |
| 995 |
/* It is not an allowed size (64 or 32) */ |
| 996 |
/* Error codes defined by the current Libdwarf Implementation. */ |
| 997 |
#define DW_DLE_DBG_ALLOC 23 |
| 998 |
#define DW_DLE_FSTAT_ERROR 24 |
| 999 |
#define DW_DLE_FSTAT_MODE_ERROR 25 |
| 1000 |
#define DW_DLE_INIT_ACCESS_WRONG 26 |
| 1001 |
#define DW_DLE_ELF_BEGIN_ERROR 27 |
| 1002 |
#define DW_DLE_ELF_GETEHDR_ERROR 28 |
| 1003 |
#define DW_DLE_ELF_GETSHDR_ERROR 29 |
| 1004 |
#define DW_DLE_ELF_STRPTR_ERROR 30 |
| 1005 |
#define DW_DLE_DEBUG_INFO_DUPLICATE 31 |
| 1006 |
#define DW_DLE_DEBUG_INFO_NULL 32 |
| 1007 |
#define DW_DLE_DEBUG_ABBREV_DUPLICATE 33 |
| 1008 |
#define DW_DLE_DEBUG_ABBREV_NULL 34 |
| 1009 |
#define DW_DLE_DEBUG_ARANGES_DUPLICATE 35 |
| 1010 |
#define DW_DLE_DEBUG_ARANGES_NULL 36 |
| 1011 |
#define DW_DLE_DEBUG_LINE_DUPLICATE 37 |
| 1012 |
#define DW_DLE_DEBUG_LINE_NULL 38 |
| 1013 |
#define DW_DLE_DEBUG_LOC_DUPLICATE 39 |
| 1014 |
#define DW_DLE_DEBUG_LOC_NULL 40 |
| 1015 |
#define DW_DLE_DEBUG_MACINFO_DUPLICATE 41 |
| 1016 |
#define DW_DLE_DEBUG_MACINFO_NULL 42 |
| 1017 |
#define DW_DLE_DEBUG_PUBNAMES_DUPLICATE 43 |
| 1018 |
#define DW_DLE_DEBUG_PUBNAMES_NULL 44 |
| 1019 |
#define DW_DLE_DEBUG_STR_DUPLICATE 45 |
| 1020 |
#define DW_DLE_DEBUG_STR_NULL 46 |
| 1021 |
#define DW_DLE_CU_LENGTH_ERROR 47 |
| 1022 |
#define DW_DLE_VERSION_STAMP_ERROR 48 |
| 1023 |
#define DW_DLE_ABBREV_OFFSET_ERROR 49 |
| 1024 |
#define DW_DLE_ADDRESS_SIZE_ERROR 50 |
| 1025 |
#define DW_DLE_DEBUG_INFO_PTR_NULL 51 |
| 1026 |
#define DW_DLE_DIE_NULL 52 |
| 1027 |
#define DW_DLE_STRING_OFFSET_BAD 53 |
| 1028 |
#define DW_DLE_DEBUG_LINE_LENGTH_BAD 54 |
| 1029 |
#define DW_DLE_LINE_PROLOG_LENGTH_BAD 55 |
| 1030 |
#define DW_DLE_LINE_NUM_OPERANDS_BAD 56 |
| 1031 |
#define DW_DLE_LINE_SET_ADDR_ERROR 57 |
| 1032 |
#define DW_DLE_LINE_EXT_OPCODE_BAD 58 |
| 1033 |
#define DW_DLE_DWARF_LINE_NULL 59 |
| 1034 |
#define DW_DLE_INCL_DIR_NUM_BAD 60 |
| 1035 |
#define DW_DLE_LINE_FILE_NUM_BAD 61 |
| 1036 |
#define DW_DLE_ALLOC_FAIL 62 |
| 1037 |
#define DW_DLE_NO_CALLBACK_FUNC 63 |
| 1038 |
#define DW_DLE_SECT_ALLOC 64 |
| 1039 |
#define DW_DLE_FILE_ENTRY_ALLOC 65 |
| 1040 |
#define DW_DLE_LINE_ALLOC 66 |
| 1041 |
#define DW_DLE_FPGM_ALLOC 67 |
| 1042 |
#define DW_DLE_INCDIR_ALLOC 68 |
| 1043 |
#define DW_DLE_STRING_ALLOC 69 |
| 1044 |
#define DW_DLE_CHUNK_ALLOC 70 |
| 1045 |
#define DW_DLE_BYTEOFF_ERR 71 |
| 1046 |
#define DW_DLE_CIE_ALLOC 72 |
| 1047 |
#define DW_DLE_FDE_ALLOC 73 |
| 1048 |
#define DW_DLE_REGNO_OVFL 74 |
| 1049 |
#define DW_DLE_CIE_OFFS_ALLOC 75 |
| 1050 |
#define DW_DLE_WRONG_ADDRESS 76 |
| 1051 |
#define DW_DLE_EXTRA_NEIGHBORS 77 |
| 1052 |
#define DW_DLE_WRONG_TAG 78 |
| 1053 |
#define DW_DLE_DIE_ALLOC 79 |
| 1054 |
#define DW_DLE_PARENT_EXISTS 80 |
| 1055 |
#define DW_DLE_DBG_NULL 81 |
| 1056 |
#define DW_DLE_DEBUGLINE_ERROR 82 |
| 1057 |
#define DW_DLE_DEBUGFRAME_ERROR 83 |
| 1058 |
#define DW_DLE_DEBUGINFO_ERROR 84 |
| 1059 |
#define DW_DLE_ATTR_ALLOC 85 |
| 1060 |
#define DW_DLE_ABBREV_ALLOC 86 |
| 1061 |
#define DW_DLE_OFFSET_UFLW 87 |
| 1062 |
#define DW_DLE_ELF_SECT_ERR 88 |
| 1063 |
#define DW_DLE_DEBUG_FRAME_LENGTH_BAD 89 |
| 1064 |
#define DW_DLE_FRAME_VERSION_BAD 90 |
| 1065 |
#define DW_DLE_CIE_RET_ADDR_REG_ERROR 91 |
| 1066 |
#define DW_DLE_FDE_NULL 92 |
| 1067 |
#define DW_DLE_FDE_DBG_NULL 93 |
| 1068 |
#define DW_DLE_CIE_NULL 94 |
| 1069 |
#define DW_DLE_CIE_DBG_NULL 95 |
| 1070 |
#define DW_DLE_FRAME_TABLE_COL_BAD 96 |
| 1071 |
#define DW_DLE_PC_NOT_IN_FDE_RANGE 97 |
| 1072 |
#define DW_DLE_CIE_INSTR_EXEC_ERROR 98 |
| 1073 |
#define DW_DLE_FRAME_INSTR_EXEC_ERROR 99 |
| 1074 |
#define DW_DLE_FDE_PTR_NULL 100 |
| 1075 |
#define DW_DLE_RET_OP_LIST_NULL 101 |
| 1076 |
#define DW_DLE_LINE_CONTEXT_NULL 102 |
| 1077 |
#define DW_DLE_DBG_NO_CU_CONTEXT 103 |
| 1078 |
#define DW_DLE_DIE_NO_CU_CONTEXT 104 |
| 1079 |
#define DW_DLE_FIRST_DIE_NOT_CU 105 |
| 1080 |
#define DW_DLE_NEXT_DIE_PTR_NULL 106 |
| 1081 |
#define DW_DLE_DEBUG_FRAME_DUPLICATE 107 |
| 1082 |
#define DW_DLE_DEBUG_FRAME_NULL 108 |
| 1083 |
#define DW_DLE_ABBREV_DECODE_ERROR 109 |
| 1084 |
#define DW_DLE_DWARF_ABBREV_NULL 110 |
| 1085 |
#define DW_DLE_ATTR_NULL 111 |
| 1086 |
#define DW_DLE_DIE_BAD 112 |
| 1087 |
#define DW_DLE_DIE_ABBREV_BAD 113 |
| 1088 |
#define DW_DLE_ATTR_FORM_BAD 114 |
| 1089 |
#define DW_DLE_ATTR_NO_CU_CONTEXT 115 |
| 1090 |
#define DW_DLE_ATTR_FORM_SIZE_BAD 116 |
| 1091 |
#define DW_DLE_ATTR_DBG_NULL 117 |
| 1092 |
#define DW_DLE_BAD_REF_FORM 118 |
| 1093 |
#define DW_DLE_ATTR_FORM_OFFSET_BAD 119 |
| 1094 |
#define DW_DLE_LINE_OFFSET_BAD 120 |
| 1095 |
#define DW_DLE_DEBUG_STR_OFFSET_BAD 121 |
| 1096 |
#define DW_DLE_STRING_PTR_NULL 122 |
| 1097 |
#define DW_DLE_PUBNAMES_VERSION_ERROR 123 |
| 1098 |
#define DW_DLE_PUBNAMES_LENGTH_BAD 124 |
| 1099 |
#define DW_DLE_GLOBAL_NULL 125 |
| 1100 |
#define DW_DLE_GLOBAL_CONTEXT_NULL 126 |
| 1101 |
#define DW_DLE_DIR_INDEX_BAD 127 |
| 1102 |
#define DW_DLE_LOC_EXPR_BAD 128 |
| 1103 |
#define DW_DLE_DIE_LOC_EXPR_BAD 129 |
| 1104 |
#define DW_DLE_ADDR_ALLOC 130 |
| 1105 |
#define DW_DLE_OFFSET_BAD 131 |
| 1106 |
#define DW_DLE_MAKE_CU_CONTEXT_FAIL 132 |
| 1107 |
#define DW_DLE_REL_ALLOC 133 |
| 1108 |
#define DW_DLE_ARANGE_OFFSET_BAD 134 |
| 1109 |
#define DW_DLE_SEGMENT_SIZE_BAD 135 |
| 1110 |
#define DW_DLE_ARANGE_LENGTH_BAD 136 |
| 1111 |
#define DW_DLE_ARANGE_DECODE_ERROR 137 |
| 1112 |
#define DW_DLE_ARANGES_NULL 138 |
| 1113 |
#define DW_DLE_ARANGE_NULL 139 |
| 1114 |
#define DW_DLE_NO_FILE_NAME 140 |
| 1115 |
#define DW_DLE_NO_COMP_DIR 141 |
| 1116 |
#define DW_DLE_CU_ADDRESS_SIZE_BAD 142 |
| 1117 |
#define DW_DLE_INPUT_ATTR_BAD 143 |
| 1118 |
#define DW_DLE_EXPR_NULL 144 |
| 1119 |
#define DW_DLE_BAD_EXPR_OPCODE 145 |
| 1120 |
#define DW_DLE_EXPR_LENGTH_BAD 146 |
| 1121 |
#define DW_DLE_MULTIPLE_RELOC_IN_EXPR 147 |
| 1122 |
#define DW_DLE_ELF_GETIDENT_ERROR 148 |
| 1123 |
#define DW_DLE_NO_AT_MIPS_FDE 149 |
| 1124 |
#define DW_DLE_NO_CIE_FOR_FDE 150 |
| 1125 |
#define DW_DLE_DIE_ABBREV_LIST_NULL 151 |
| 1126 |
#define DW_DLE_DEBUG_FUNCNAMES_DUPLICATE 152 |
| 1127 |
#define DW_DLE_DEBUG_FUNCNAMES_NULL 153 |
| 1128 |
#define DW_DLE_DEBUG_FUNCNAMES_VERSION_ERROR 154 |
| 1129 |
#define DW_DLE_DEBUG_FUNCNAMES_LENGTH_BAD 155 |
| 1130 |
#define DW_DLE_FUNC_NULL 156 |
| 1131 |
#define DW_DLE_FUNC_CONTEXT_NULL 157 |
| 1132 |
#define DW_DLE_DEBUG_TYPENAMES_DUPLICATE 158 |
| 1133 |
#define DW_DLE_DEBUG_TYPENAMES_NULL 159 |
| 1134 |
#define DW_DLE_DEBUG_TYPENAMES_VERSION_ERROR 160 |
| 1135 |
#define DW_DLE_DEBUG_TYPENAMES_LENGTH_BAD 161 |
| 1136 |
#define DW_DLE_TYPE_NULL 162 |
| 1137 |
#define DW_DLE_TYPE_CONTEXT_NULL 163 |
| 1138 |
#define DW_DLE_DEBUG_VARNAMES_DUPLICATE 164 |
| 1139 |
#define DW_DLE_DEBUG_VARNAMES_NULL 165 |
| 1140 |
#define DW_DLE_DEBUG_VARNAMES_VERSION_ERROR 166 |
| 1141 |
#define DW_DLE_DEBUG_VARNAMES_LENGTH_BAD 167 |
| 1142 |
#define DW_DLE_VAR_NULL 168 |
| 1143 |
#define DW_DLE_VAR_CONTEXT_NULL 169 |
| 1144 |
#define DW_DLE_DEBUG_WEAKNAMES_DUPLICATE 170 |
| 1145 |
#define DW_DLE_DEBUG_WEAKNAMES_NULL 171 |
| 1146 |
#define DW_DLE_DEBUG_WEAKNAMES_VERSION_ERROR 172 |
| 1147 |
#define DW_DLE_DEBUG_WEAKNAMES_LENGTH_BAD 173 |
| 1148 |
#define DW_DLE_WEAK_NULL 174 |
| 1149 |
#define DW_DLE_WEAK_CONTEXT_NULL 175 |
| 1150 |
#define DW_DLE_LOCDESC_COUNT_WRONG 176 |
| 1151 |
#define DW_DLE_MACINFO_STRING_NULL 177 |
| 1152 |
#define DW_DLE_MACINFO_STRING_EMPTY 178 |
| 1153 |
#define DW_DLE_MACINFO_INTERNAL_ERROR_SPACE 179 |
| 1154 |
#define DW_DLE_MACINFO_MALLOC_FAIL 180 |
| 1155 |
#define DW_DLE_DEBUGMACINFO_ERROR 181 |
| 1156 |
#define DW_DLE_DEBUG_MACRO_LENGTH_BAD 182 |
| 1157 |
#define DW_DLE_DEBUG_MACRO_MAX_BAD 183 |
| 1158 |
#define DW_DLE_DEBUG_MACRO_INTERNAL_ERR 184 |
| 1159 |
#define DW_DLE_DEBUG_MACRO_MALLOC_SPACE 185 |
| 1160 |
#define DW_DLE_DEBUG_MACRO_INCONSISTENT 186 |
| 1161 |
#define DW_DLE_DF_NO_CIE_AUGMENTATION 187 |
| 1162 |
#define DW_DLE_DF_REG_NUM_TOO_HIGH 188 |
| 1163 |
#define DW_DLE_DF_MAKE_INSTR_NO_INIT 189 |
| 1164 |
#define DW_DLE_DF_NEW_LOC_LESS_OLD_LOC 190 |
| 1165 |
#define DW_DLE_DF_POP_EMPTY_STACK 191 |
| 1166 |
#define DW_DLE_DF_ALLOC_FAIL 192 |
| 1167 |
#define DW_DLE_DF_FRAME_DECODING_ERROR 193 |
| 1168 |
#define DW_DLE_DEBUG_LOC_SECTION_SHORT 194 |
| 1169 |
#define DW_DLE_FRAME_AUGMENTATION_UNKNOWN 195 |
| 1170 |
#define DW_DLE_PUBTYPE_CONTEXT 196 /* Unused. */ |
| 1171 |
#define DW_DLE_DEBUG_PUBTYPES_LENGTH_BAD 197 |
| 1172 |
#define DW_DLE_DEBUG_PUBTYPES_VERSION_ERROR 198 |
| 1173 |
#define DW_DLE_DEBUG_PUBTYPES_DUPLICATE 199 |
| 1174 |
#define DW_DLE_FRAME_CIE_DECODE_ERROR 200 |
| 1175 |
#define DW_DLE_FRAME_REGISTER_UNREPRESENTABLE 201 |
| 1176 |
#define DW_DLE_FRAME_REGISTER_COUNT_MISMATCH 202 |
| 1177 |
#define DW_DLE_LINK_LOOP 203 |
| 1178 |
#define DW_DLE_STRP_OFFSET_BAD 204 |
| 1179 |
#define DW_DLE_DEBUG_RANGES_DUPLICATE 205 |
| 1180 |
#define DW_DLE_DEBUG_RANGES_OFFSET_BAD 206 |
| 1181 |
#define DW_DLE_DEBUG_RANGES_MISSING_END 207 |
| 1182 |
#define DW_DLE_DEBUG_RANGES_OUT_OF_MEM 208 |
| 1183 |
#define DW_DLE_DEBUG_SYMTAB_ERR 209 |
| 1184 |
#define DW_DLE_DEBUG_STRTAB_ERR 210 |
| 1185 |
#define DW_DLE_RELOC_MISMATCH_INDEX 211 |
| 1186 |
#define DW_DLE_RELOC_MISMATCH_RELOC_INDEX 212 |
| 1187 |
#define DW_DLE_RELOC_MISMATCH_STRTAB_INDEX 213 |
| 1188 |
#define DW_DLE_RELOC_SECTION_MISMATCH 214 |
| 1189 |
#define DW_DLE_RELOC_SECTION_MISSING_INDEX 215 |
| 1190 |
#define DW_DLE_RELOC_SECTION_LENGTH_ODD 216 |
| 1191 |
#define DW_DLE_RELOC_SECTION_PTR_NULL 217 |
| 1192 |
#define DW_DLE_RELOC_SECTION_MALLOC_FAIL 218 |
| 1193 |
#define DW_DLE_NO_ELF64_SUPPORT 219 |
| 1194 |
#define DW_DLE_MISSING_ELF64_SUPPORT 220 |
| 1195 |
#define DW_DLE_ORPHAN_FDE 221 |
| 1196 |
#define DW_DLE_DUPLICATE_INST_BLOCK 222 |
| 1197 |
#define DW_DLE_BAD_REF_SIG8_FORM 223 |
| 1198 |
#define DW_DLE_ATTR_EXPRLOC_FORM_BAD 224 |
| 1199 |
#define DW_DLE_FORM_SEC_OFFSET_LENGTH_BAD 225 |
| 1200 |
#define DW_DLE_NOT_REF_FORM 226 |
| 1201 |
#define DW_DLE_DEBUG_FRAME_LENGTH_NOT_MULTIPLE 227 |
| 1202 |
#define DW_DLE_REF_SIG8_NOT_HANDLED 228 |
| 1203 |
#define DW_DLE_DEBUG_FRAME_POSSIBLE_ADDRESS_BOTCH 229 |
| 1204 |
#define DW_DLE_LOC_BAD_TERMINATION 230 |
| 1205 |
#define DW_DLE_SYMTAB_SECTION_LENGTH_ODD 231 |
| 1206 |
#define DW_DLE_RELOC_SECTION_SYMBOL_INDEX_BAD 232 |
| 1207 |
#define DW_DLE_RELOC_SECTION_RELOC_TARGET_SIZE_UNKNOWN 233 |
| 1208 |
#define DW_DLE_SYMTAB_SECTION_ENTRYSIZE_ZERO 234 |
| 1209 |
#define DW_DLE_LINE_NUMBER_HEADER_ERROR 235 |
| 1210 |
#define DW_DLE_DEBUG_TYPES_NULL 236 |
| 1211 |
#define DW_DLE_DEBUG_TYPES_DUPLICATE 237 |
| 1212 |
#define DW_DLE_DEBUG_TYPES_ONLY_DWARF4 238 |
| 1213 |
#define DW_DLE_DEBUG_TYPEOFFSET_BAD 239 |
| 1214 |
#define DW_DLE_GNU_OPCODE_ERROR 240 |
| 1215 |
#define DW_DLE_DEBUGPUBTYPES_ERROR 241 |
| 1216 |
#define DW_DLE_AT_FIXUP_NULL 242 |
| 1217 |
#define DW_DLE_AT_FIXUP_DUP 243 |
| 1218 |
#define DW_DLE_BAD_ABINAME 244 |
| 1219 |
#define DW_DLE_TOO_MANY_DEBUG 245 |
| 1220 |
#define DW_DLE_DEBUG_STR_OFFSETS_DUPLICATE 246 |
| 1221 |
#define DW_DLE_SECTION_DUPLICATION 247 |
| 1222 |
#define DW_DLE_SECTION_ERROR 248 |
| 1223 |
#define DW_DLE_DEBUG_ADDR_DUPLICATE 249 |
| 1224 |
#define DW_DLE_DEBUG_CU_UNAVAILABLE_FOR_FORM 250 |
| 1225 |
#define DW_DLE_DEBUG_FORM_HANDLING_INCOMPLETE 251 |
| 1226 |
#define DW_DLE_NEXT_DIE_PAST_END 252 |
| 1227 |
#define DW_DLE_NEXT_DIE_WRONG_FORM 253 |
| 1228 |
#define DW_DLE_NEXT_DIE_NO_ABBREV_LIST 254 |
| 1229 |
#define DW_DLE_NESTED_FORM_INDIRECT_ERROR 255 |
| 1230 |
#define DW_DLE_CU_DIE_NO_ABBREV_LIST 256 |
| 1231 |
#define DW_DLE_MISSING_NEEDED_DEBUG_ADDR_SECTION 257 |
| 1232 |
#define DW_DLE_ATTR_FORM_NOT_ADDR_INDEX 258 |
| 1233 |
#define DW_DLE_ATTR_FORM_NOT_STR_INDEX 259 |
| 1234 |
#define DW_DLE_DUPLICATE_GDB_INDEX 260 |
| 1235 |
#define DW_DLE_ERRONEOUS_GDB_INDEX_SECTION 261 |
| 1236 |
#define DW_DLE_GDB_INDEX_COUNT_ERROR 262 |
| 1237 |
#define DW_DLE_GDB_INDEX_COUNT_ADDR_ERROR 263 |
| 1238 |
#define DW_DLE_GDB_INDEX_INDEX_ERROR 264 |
| 1239 |
#define DW_DLE_GDB_INDEX_CUVEC_ERROR 265 |
| 1240 |
#define DW_DLE_DUPLICATE_CU_INDEX 266 |
| 1241 |
#define DW_DLE_DUPLICATE_TU_INDEX 267 |
| 1242 |
#define DW_DLE_XU_TYPE_ARG_ERROR 268 |
| 1243 |
#define DW_DLE_XU_IMPOSSIBLE_ERROR 269 |
| 1244 |
#define DW_DLE_XU_NAME_COL_ERROR 270 |
| 1245 |
#define DW_DLE_XU_HASH_ROW_ERROR 271 |
| 1246 |
#define DW_DLE_XU_HASH_INDEX_ERROR 272 |
| 1247 |
/* ..._FAILSAFE_ERRVAL is an aid when out of memory. */ |
| 1248 |
#define DW_DLE_FAILSAFE_ERRVAL 273 |
| 1249 |
#define DW_DLE_ARANGE_ERROR 274 |
| 1250 |
#define DW_DLE_PUBNAMES_ERROR 275 |
| 1251 |
#define DW_DLE_FUNCNAMES_ERROR 276 |
| 1252 |
#define DW_DLE_TYPENAMES_ERROR 277 |
| 1253 |
#define DW_DLE_VARNAMES_ERROR 278 |
| 1254 |
#define DW_DLE_WEAKNAMES_ERROR 279 |
| 1255 |
#define DW_DLE_RELOCS_ERROR 280 |
| 1256 |
#define DW_DLE_ATTR_OUTSIDE_SECTION 281 |
| 1257 |
#define DW_DLE_FISSION_INDEX_WRONG 282 |
| 1258 |
#define DW_DLE_FISSION_VERSION_ERROR 283 |
| 1259 |
#define DW_DLE_NEXT_DIE_LOW_ERROR 284 |
| 1260 |
#define DW_DLE_CU_UT_TYPE_ERROR 285 |
| 1261 |
#define DW_DLE_NO_SUCH_SIGNATURE_FOUND 286 |
| 1262 |
#define DW_DLE_SIGNATURE_SECTION_NUMBER_WRONG 287 |
| 1263 |
#define DW_DLE_ATTR_FORM_NOT_DATA8 288 |
| 1264 |
#define DW_DLE_SIG_TYPE_WRONG_STRING 289 |
| 1265 |
#define DW_DLE_MISSING_REQUIRED_TU_OFFSET_HASH 290 |
| 1266 |
#define DW_DLE_MISSING_REQUIRED_CU_OFFSET_HASH 291 |
| 1267 |
#define DW_DLE_DWP_MISSING_DWO_ID 292 |
| 1268 |
#define DW_DLE_DWP_SIBLING_ERROR 293 |
| 1269 |
#define DW_DLE_DEBUG_FISSION_INCOMPLETE 294 |
| 1270 |
#define DW_DLE_FISSION_SECNUM_ERR 295 |
| 1271 |
#define DW_DLE_DEBUG_MACRO_DUPLICATE 296 |
| 1272 |
#define DW_DLE_DEBUG_NAMES_DUPLICATE 297 |
| 1273 |
#define DW_DLE_DEBUG_LINE_STR_DUPLICATE 298 |
| 1274 |
#define DW_DLE_DEBUG_SUP_DUPLICATE 299 |
| 1275 |
#define DW_DLE_NO_SIGNATURE_TO_LOOKUP 300 |
| 1276 |
#define DW_DLE_NO_TIED_ADDR_AVAILABLE 301 |
| 1277 |
#define DW_DLE_NO_TIED_SIG_AVAILABLE 302 |
| 1278 |
#define DW_DLE_STRING_NOT_TERMINATED 303 |
| 1279 |
#define DW_DLE_BAD_LINE_TABLE_OPERATION 304 |
| 1280 |
#define DW_DLE_LINE_CONTEXT_BOTCH 305 |
| 1281 |
#define DW_DLE_LINE_CONTEXT_INDEX_WRONG 306 |
| 1282 |
#define DW_DLE_NO_TIED_STRING_AVAILABLE 307 |
| 1283 |
#define DW_DLE_NO_TIED_FILE_AVAILABLE 308 |
| 1284 |
#define DW_DLE_CU_TYPE_MISSING 309 |
| 1285 |
#define DW_DLE_LLE_CODE_UNKNOWN 310 |
| 1286 |
#define DW_DLE_LOCLIST_INTERFACE_ERROR 311 |
| 1287 |
#define DW_DLE_LOCLIST_INDEX_ERROR 312 |
| 1288 |
#define DW_DLE_INTERFACE_NOT_SUPPORTED 313 |
| 1289 |
#define DW_DLE_ZDEBUG_REQUIRES_ZLIB 314 |
| 1290 |
#define DW_DLE_ZDEBUG_INPUT_FORMAT_ODD 315 |
| 1291 |
#define DW_DLE_ZLIB_BUF_ERROR 316 |
| 1292 |
#define DW_DLE_ZLIB_DATA_ERROR 317 |
| 1293 |
#define DW_DLE_MACRO_OFFSET_BAD 318 |
| 1294 |
#define DW_DLE_MACRO_OPCODE_BAD 319 |
| 1295 |
#define DW_DLE_MACRO_OPCODE_FORM_BAD 320 |
| 1296 |
#define DW_DLE_UNKNOWN_FORM 321 |
| 1297 |
#define DW_DLE_BAD_MACRO_HEADER_POINTER 322 |
| 1298 |
#define DW_DLE_BAD_MACRO_INDEX 323 |
| 1299 |
#define DW_DLE_MACRO_OP_UNHANDLED 324 |
| 1300 |
#define DW_DLE_MACRO_PAST_END 325 |
| 1301 |
#define DW_DLE_LINE_STRP_OFFSET_BAD 326 |
| 1302 |
#define DW_DLE_STRING_FORM_IMPROPER 327 |
| 1303 |
#define DW_DLE_ELF_FLAGS_NOT_AVAILABLE 328 |
| 1304 |
#define DW_DLE_LEB_IMPROPER 329 |
| 1305 |
#define DW_DLE_DEBUG_LINE_RANGE_ZERO 330 |
| 1306 |
#define DW_DLE_READ_LITTLEENDIAN_ERROR 331 |
| 1307 |
#define DW_DLE_READ_BIGENDIAN_ERROR 332 |
| 1308 |
#define DW_DLE_RELOC_INVALID 333 |
| 1309 |
#define DW_DLE_INFO_HEADER_ERROR 334 |
| 1310 |
#define DW_DLE_ARANGES_HEADER_ERROR 335 |
| 1311 |
#define DW_DLE_LINE_OFFSET_WRONG_FORM 336 |
| 1312 |
#define DW_DLE_FORM_BLOCK_LENGTH_ERROR 337 |
| 1313 |
#define DW_DLE_ZLIB_SECTION_SHORT 338 |
| 1314 |
#define DW_DLE_CIE_INSTR_PTR_ERROR 339 |
| 1315 |
#define DW_DLE_FDE_INSTR_PTR_ERROR 340 |
| 1316 |
#define DW_DLE_FISSION_ADDITION_ERROR 341 |
| 1317 |
#define DW_DLE_HEADER_LEN_BIGGER_THAN_SECSIZE 342 |
| 1318 |
#define DW_DLE_LOCEXPR_OFF_SECTION_END 343 |
| 1319 |
#define DW_DLE_POINTER_SECTION_UNKNOWN 344 |
| 1320 |
#define DW_DLE_ERRONEOUS_XU_INDEX_SECTION 345 |
| 1321 |
#define DW_DLE_DIRECTORY_FORMAT_COUNT_VS_DIRECTORIES_MISMATCH 346 |
| 1322 |
#define DW_DLE_COMPRESSED_EMPTY_SECTION 347 |
| 1323 |
#define DW_DLE_SIZE_WRAPAROUND 348 |
| 1324 |
#define DW_DLE_ILLOGICAL_TSEARCH 349 |
| 1325 |
#define DW_DLE_BAD_STRING_FORM 350 |
| 1326 |
#define DW_DLE_DEBUGSTR_ERROR 351 |
| 1327 |
#define DW_DLE_DEBUGSTR_UNEXPECTED_REL 352 |
| 1328 |
#define DW_DLE_DISCR_ARRAY_ERROR 353 |
| 1329 |
#define DW_DLE_LEB_OUT_ERROR 354 |
| 1330 |
#define DW_DLE_SIBLING_LIST_IMPROPER 355 |
| 1331 |
#define DW_DLE_LOCLIST_OFFSET_BAD 356 |
| 1332 |
#define DW_DLE_LINE_TABLE_BAD 357 |
| 1333 |
#define DW_DLE_DEBUG_LOClISTS_DUPLICATE 358 |
| 1334 |
#define DW_DLE_DEBUG_RNGLISTS_DUPLICATE 359 |
| 1335 |
#define DW_DLE_ABBREV_OFF_END 360 |
| 1336 |
#define DW_DLE_FORM_STRING_BAD_STRING 361 |
| 1337 |
#define DW_DLE_AUGMENTATION_STRING_OFF_END 362 |
| 1338 |
#define DW_DLE_STRING_OFF_END_PUBNAMES_LIKE 363 |
| 1339 |
#define DW_DLE_LINE_STRING_BAD 364 |
| 1340 |
#define DW_DLE_DEFINE_FILE_STRING_BAD 365 |
| 1341 |
#define DW_DLE_MACRO_STRING_BAD 366 |
| 1342 |
#define DW_DLE_MACINFO_STRING_BAD 367 |
| 1343 |
#define DW_DLE_ZLIB_UNCOMPRESS_ERROR 368 |
| 1344 |
#define DW_DLE_IMPROPER_DWO_ID 369 |
| 1345 |
#define DW_DLE_GROUPNUMBER_ERROR 370 |
| 1346 |
#define DW_DLE_ADDRESS_SIZE_ZERO 371 |
| 1347 |
#define DW_DLE_DEBUG_NAMES_HEADER_ERROR 372 |
| 1348 |
#define DW_DLE_DEBUG_NAMES_AUG_STRING_ERROR 373 |
| 1349 |
#define DW_DLE_DEBUG_NAMES_PAD_NON_ZERO 374 |
| 1350 |
#define DW_DLE_DEBUG_NAMES_OFF_END 375 |
| 1351 |
#define DW_DLE_DEBUG_NAMES_ABBREV_OVERFLOW 376 |
| 1352 |
#define DW_DLE_DEBUG_NAMES_ABBREV_CORRUPTION 377 |
| 1353 |
#define DW_DLE_DEBUG_NAMES_NULL_POINTER 378 |
| 1354 |
#define DW_DLE_DEBUG_NAMES_BAD_INDEX_ARG 379 |
| 1355 |
#define DW_DLE_DEBUG_NAMES_ENTRYPOOL_OFFSET 380 |
| 1356 |
#define DW_DLE_DEBUG_NAMES_UNHANDLED_FORM 381 |
| 1357 |
#define DW_DLE_LNCT_CODE_UNKNOWN 382 |
| 1358 |
#define DW_DLE_LNCT_FORM_CODE_NOT_HANDLED 383 |
| 1359 |
#define DW_DLE_LINE_HEADER_LENGTH_BOTCH 384 |
| 1360 |
#define DW_DLE_STRING_HASHTAB_IDENTITY_ERROR 385 |
| 1361 |
#define DW_DLE_UNIT_TYPE_NOT_HANDLED 386 |
| 1362 |
#define DW_DLE_GROUP_MAP_ALLOC 387 |
| 1363 |
#define DW_DLE_GROUP_MAP_DUPLICATE 388 |
| 1364 |
#define DW_DLE_GROUP_COUNT_ERROR 389 |
| 1365 |
#define DW_DLE_GROUP_INTERNAL_ERROR 390 |
| 1366 |
#define DW_DLE_GROUP_LOAD_ERROR 391 |
| 1367 |
#define DW_DLE_GROUP_LOAD_READ_ERROR 392 |
| 1368 |
#define DW_DLE_AUG_DATA_LENGTH_BAD 393 |
| 1369 |
#define DW_DLE_ABBREV_MISSING 394 |
| 1370 |
#define DW_DLE_NO_TAG_FOR_DIE 395 |
| 1371 |
#define DW_DLE_LOWPC_WRONG_CLASS 396 |
| 1372 |
#define DW_DLE_HIGHPC_WRONG_FORM 397 |
| 1373 |
#define DW_DLE_STR_OFFSETS_BASE_WRONG_FORM 398 |
| 1374 |
#define DW_DLE_DATA16_OUTSIDE_SECTION 399 |
| 1375 |
#define DW_DLE_LNCT_MD5_WRONG_FORM 400 |
| 1376 |
#define DW_DLE_LINE_HEADER_CORRUPT 401 |
| 1377 |
#define DW_DLE_STR_OFFSETS_NULLARGUMENT 402 |
| 1378 |
#define DW_DLE_STR_OFFSETS_NULL_DBG 403 |
| 1379 |
#define DW_DLE_STR_OFFSETS_NO_MAGIC 404 |
| 1380 |
#define DW_DLE_STR_OFFSETS_ARRAY_SIZE 405 |
| 1381 |
#define DW_DLE_STR_OFFSETS_VERSION_WRONG 406 |
| 1382 |
#define DW_DLE_STR_OFFSETS_ARRAY_INDEX_WRONG 407 |
| 1383 |
#define DW_DLE_STR_OFFSETS_EXTRA_BYTES 408 |
| 1384 |
#define DW_DLE_DUP_ATTR_ON_DIE 409 |
| 1385 |
#define DW_DLE_SECTION_NAME_BIG 410 |
| 1386 |
#define DW_DLE_FILE_UNAVAILABLE 411 |
| 1387 |
#define DW_DLE_FILE_WRONG_TYPE 412 |
| 1388 |
#define DW_DLE_SIBLING_OFFSET_WRONG 413 |
| 1389 |
#define DW_DLE_OPEN_FAIL 414 |
| 1390 |
#define DW_DLE_OFFSET_SIZE 415 |
| 1391 |
#define DW_DLE_MACH_O_SEGOFFSET_BAD 416 |
| 1392 |
#define DW_DLE_FILE_OFFSET_BAD 417 |
| 1393 |
#define DW_DLE_SEEK_ERROR 418 |
| 1394 |
#define DW_DLE_READ_ERROR 419 |
| 1395 |
#define DW_DLE_ELF_CLASS_BAD 420 |
| 1396 |
#define DW_DLE_ELF_ENDIAN_BAD 421 |
| 1397 |
#define DW_DLE_ELF_VERSION_BAD 422 |
| 1398 |
#define DW_DLE_FILE_TOO_SMALL 423 |
| 1399 |
#define DW_DLE_PATH_SIZE_TOO_SMALL 424 |
| 1400 |
#define DW_DLE_BAD_TYPE_SIZE 425 |
| 1401 |
#define DW_DLE_PE_SIZE_SMALL 426 |
| 1402 |
#define DW_DLE_PE_OFFSET_BAD 427 |
| 1403 |
#define DW_DLE_PE_STRING_TOO_LONG 428 |
| 1404 |
#define DW_DLE_IMAGE_FILE_UNKNOWN_TYPE 429 |
| 1405 |
#define DW_DLE_LINE_TABLE_LINENO_ERROR 430 |
| 1406 |
#define DW_DLE_PRODUCER_CODE_NOT_AVAILABLE 431 |
| 1407 |
#define DW_DLE_NO_ELF_SUPPORT 432 |
| 1408 |
#define DW_DLE_NO_STREAM_RELOC_SUPPORT 433 |
| 1409 |
#define DW_DLE_RETURN_EMPTY_PUBNAMES_ERROR 434 |
| 1410 |
#define DW_DLE_SECTION_SIZE_ERROR 435 |
| 1411 |
#define DW_DLE_INTERNAL_NULL_POINTER 436 |
| 1412 |
#define DW_DLE_SECTION_STRING_OFFSET_BAD 437 |
| 1413 |
#define DW_DLE_SECTION_INDEX_BAD 438 |
| 1414 |
#define DW_DLE_INTEGER_TOO_SMALL 439 |
| 1415 |
#define DW_DLE_ELF_SECTION_LINK_ERROR 440 |
| 1416 |
#define DW_DLE_ELF_SECTION_GROUP_ERROR 441 |
| 1417 |
#define DW_DLE_ELF_SECTION_COUNT_MISMATCH 442 |
| 1418 |
#define DW_DLE_ELF_STRING_SECTION_MISSING 443 |
| 1419 |
#define DW_DLE_SEEK_OFF_END 444 |
| 1420 |
#define DW_DLE_READ_OFF_END 445 |
| 1421 |
#define DW_DLE_ELF_SECTION_ERROR 446 |
| 1422 |
#define DW_DLE_ELF_STRING_SECTION_ERROR 447 |
| 1423 |
#define DW_DLE_MIXING_SPLIT_DWARF_VERSIONS 448 |
| 1424 |
#define DW_DLE_TAG_CORRUPT 449 |
| 1425 |
#define DW_DLE_FORM_CORRUPT 450 |
| 1426 |
#define DW_DLE_ATTR_CORRUPT 451 |
| 1427 |
#define DW_DLE_ABBREV_ATTR_DUPLICATION 452 |
| 1428 |
#define DW_DLE_DWP_SIGNATURE_MISMATCH 453 |
| 1429 |
#define DW_DLE_CU_UT_TYPE_VALUE 454 |
| 1430 |
#define DW_DLE_DUPLICATE_GNU_DEBUGLINK 455 |
| 1431 |
#define DW_DLE_CORRUPT_GNU_DEBUGLINK 456 |
| 1432 |
#define DW_DLE_CORRUPT_NOTE_GNU_DEBUGID 457 |
| 1433 |
#define DW_DLE_CORRUPT_GNU_DEBUGID_SIZE 458 |
| 1434 |
#define DW_DLE_CORRUPT_GNU_DEBUGID_STRING 459 |
| 1435 |
#define DW_DLE_HEX_STRING_ERROR 460 |
| 1436 |
#define DW_DLE_DECIMAL_STRING_ERROR 461 |
| 1437 |
#define DW_DLE_PRO_INIT_EXTRAS_UNKNOWN 462 |
| 1438 |
#define DW_DLE_PRO_INIT_EXTRAS_ERR 463 |
| 1439 |
#define DW_DLE_NULL_ARGS_DWARF_ADD_PATH 464 |
| 1440 |
#define DW_DLE_DWARF_INIT_DBG_NULL 465 |
| 1441 |
#define DW_DLE_ELF_RELOC_SECTION_ERROR 466 |
| 1442 |
#define DW_DLE_USER_DECLARED_ERROR 467 |
| 1443 |
#define DW_DLE_RNGLISTS_ERROR 468 |
| 1444 |
#define DW_DLE_LOCLISTS_ERROR 469 |
| 1445 |
#define DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE 470 |
| 1446 |
#define DW_DLE_GDBINDEX_STRING_ERROR 471 |
| 1447 |
#define DW_DLE_GNU_PUBNAMES_ERROR 472 |
| 1448 |
#define DW_DLE_GNU_PUBTYPES_ERROR 473 |
| 1449 |
#define DW_DLE_DUPLICATE_GNU_DEBUG_PUBNAMES 474 |
| 1450 |
#define DW_DLE_DUPLICATE_GNU_DEBUG_PUBTYPES 475 |
| 1451 |
#define DW_DLE_DEBUG_SUP_STRING_ERROR 476 |
| 1452 |
#define DW_DLE_DEBUG_SUP_ERROR 477 |
| 1453 |
#define DW_DLE_LOCATION_ERROR 478 |
| 1454 |
#define DW_DLE_DEBUGLINK_PATH_SHORT 479 |
| 1455 |
#define DW_DLE_SIGNATURE_MISMATCH 480 |
| 1456 |
#define DW_DLE_MACRO_VERSION_ERROR 481 |
| 1457 |
#define DW_DLE_NEGATIVE_SIZE 482 |
| 1458 |
#define DW_DLE_UDATA_VALUE_NEGATIVE 483 |
| 1459 |
#define DW_DLE_DEBUG_NAMES_ERROR 484 |
| 1460 |
#define DW_DLE_CFA_INSTRUCTION_ERROR 485 |
| 1461 |
#define DW_DLE_MACHO_CORRUPT_HEADER 486 |
| 1462 |
#define DW_DLE_MACHO_CORRUPT_COMMAND 487 |
| 1463 |
#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS 488 |
| 1464 |
#define DW_DLE_RELOCATION_SECTION_SIZE_ERROR 489 |
| 1465 |
#define DW_DLE_SYMBOL_SECTION_SIZE_ERROR 490 |
| 1466 |
#define DW_DLE_PE_SECTION_SIZE_ERROR 491 |
| 1467 |
#define DW_DLE_DEBUG_ADDR_ERROR 492 |
| 1468 |
#define DW_DLE_NO_SECT_STRINGS 493 |
| 1469 |
#define DW_DLE_TOO_FEW_SECTIONS 494 |
| 1470 |
#define DW_DLE_BUILD_ID_DESCRIPTION_SIZE 495 |
| 1471 |
#define DW_DLE_BAD_SECTION_FLAGS 496 |
| 1472 |
#define DW_DLE_IMPROPER_SECTION_ZERO 497 |
| 1473 |
#define DW_DLE_INVALID_NULL_ARGUMENT 498 |
| 1474 |
#define DW_DLE_LINE_INDEX_WRONG 499 |
| 1475 |
#define DW_DLE_LINE_COUNT_WRONG 500 |
| 1476 |
#define DW_DLE_ARITHMETIC_OVERFLOW 501 |
| 1477 |
#define DW_DLE_UNIVERSAL_BINARY_ERROR 502 |
| 1478 |
#define DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR 503 |
| 1479 |
#define DW_DLE_PE_SECTION_SIZE_HEURISTIC_FAIL 504 |
| 1480 |
#define DW_DLE_LLE_ERROR 505 |
| 1481 |
#define DW_DLE_RLE_ERROR 506 |
| 1482 |
|
| 1483 |
/*! @note DW_DLE_LAST MUST EQUAL LAST ERROR NUMBER */ |
| 1484 |
#define DW_DLE_LAST 506 |
| 1485 |
#define DW_DLE_LO_USER 0x10000 |
| 1486 |
/*! @} */ |
| 1487 |
|
| 1488 |
/*! @section initfinish Initialization And Finish Operations */ |
| 1489 |
|
| 1490 |
/*! @defgroup initfunctions Libdwarf Initialization Functions |
| 1491 |
|
| 1492 |
@{ |
| 1493 |
Opening and closing libdwarf on object files. |
| 1494 |
|
| 1495 |
*/ |
| 1496 |
|
| 1497 |
/*! @brief Initialization based on path, the most common |
| 1498 |
initialization. |
| 1499 |
|
| 1500 |
On a Mach-O universal binary this function can |
| 1501 |
only return information about the first (zero index) |
| 1502 |
object in the universal binary. |
| 1503 |
|
| 1504 |
@param dw_path |
| 1505 |
Pass in the path to the object file to open. |
| 1506 |
@param dw_true_path_out_buffer |
| 1507 |
Pass in NULL or the name of a string buffer |
| 1508 |
(The buffer should be initialized with an initial NUL byte) |
| 1509 |
The returned string will be null-terminated. |
| 1510 |
The path actually used is copied to true_path_out. |
| 1511 |
If true_path_buffer len is zero or true_path_out_buffer |
| 1512 |
is zero then the Special MacOS processing will not |
| 1513 |
occur, nor will the GNU_debuglink processing occur. |
| 1514 |
In case GNU debuglink data was followed or MacOS |
| 1515 |
dSYM applies the true_path_out |
| 1516 |
will not match path and the initial byte will be |
| 1517 |
non-null. |
| 1518 |
The value put in true_path_out is the actual file name. |
| 1519 |
@param dw_true_path_bufferlen |
| 1520 |
Pass in the length in bytes of the buffer. |
| 1521 |
@param dw_groupnumber |
| 1522 |
The value passed in should be DW_GROUPNUMBER_ANY |
| 1523 |
unless one wishes to other than a standard |
| 1524 |
group. |
| 1525 |
@param dw_errhand |
| 1526 |
Pass in NULL unless one wishes libdwarf to call |
| 1527 |
this error handling function (which you must write) |
| 1528 |
instead of passing meaningful values to the |
| 1529 |
dw_error argument. |
| 1530 |
@param dw_errarg |
| 1531 |
If dw_errorhand is non-null, then this value |
| 1532 |
(a pointer or integer that means something |
| 1533 |
to you) is passed to the dw_errhand function |
| 1534 |
in case that is helpful to you. |
| 1535 |
@param dw_dbg |
| 1536 |
On success, *dw_dbg is set to a pointer to |
| 1537 |
a new Dwarf_Debug structure to be used in |
| 1538 |
calls to libdwarf functions. |
| 1539 |
@param dw_error |
| 1540 |
In case return is DW_DLV_ERROR |
| 1541 |
dw_error is set to point to |
| 1542 |
the error details. |
| 1543 |
@return DW_DLV_OK etc. |
| 1544 |
|
| 1545 |
@link dwsec_separatedebug Details on separate DWARF object access @endlink |
| 1546 |
@see dwarf_init_path_dl dwarf_init_b |
| 1547 |
@see exampleinit |
| 1548 |
*/ |
| 1549 |
|
| 1550 |
DW_API int dwarf_init_path(const char * dw_path, |
| 1551 |
char * dw_true_path_out_buffer, |
| 1552 |
unsigned int dw_true_path_bufferlen, |
| 1553 |
unsigned int dw_groupnumber, |
| 1554 |
Dwarf_Handler dw_errhand, |
| 1555 |
Dwarf_Ptr dw_errarg, |
| 1556 |
Dwarf_Debug* dw_dbg, |
| 1557 |
Dwarf_Error* dw_error); |
| 1558 |
|
| 1559 |
/*! @brief Initialization based on path |
| 1560 |
|
| 1561 |
This identical to dwarf_init_path() except that it |
| 1562 |
adds a new argument, dw_universalnumber, |
| 1563 |
with which you can specify which object in |
| 1564 |
a Mach-O universal binary you wish to open. |
| 1565 |
|
| 1566 |
It is always safe and appropriate to pass |
| 1567 |
zero as the dw_universalnumber. |
| 1568 |
Elf and PE and (non-universal) Mach-O object |
| 1569 |
files ignore the value of dw_universalnumber. |
| 1570 |
*/ |
| 1571 |
DW_API int dwarf_init_path_a(const char * dw_path, |
| 1572 |
char * dw_true_path_out_buffer, |
| 1573 |
unsigned int dw_true_path_bufferlen, |
| 1574 |
unsigned int dw_groupnumber, |
| 1575 |
unsigned int dw_universalnumber, |
| 1576 |
Dwarf_Handler dw_errhand, |
| 1577 |
Dwarf_Ptr dw_errarg, |
| 1578 |
Dwarf_Debug* dw_dbg, |
| 1579 |
Dwarf_Error* dw_error); |
| 1580 |
|
| 1581 |
/*! @brief Initialization following GNU debuglink section data. |
| 1582 |
|
| 1583 |
Sets the true-path with DWARF if there is |
| 1584 |
appropriate debuglink data available. |
| 1585 |
|
| 1586 |
In case DW_DLV_ERROR returned be sure to |
| 1587 |
call dwarf_dealloc_error even though |
| 1588 |
the returned Dwarf_Debug is NULL. |
| 1589 |
|
| 1590 |
@param dw_path |
| 1591 |
Pass in the path to the object file to open. |
| 1592 |
@param dw_true_path_out_buffer |
| 1593 |
Pass in NULL or the name of a string buffer. |
| 1594 |
@param dw_true_path_bufferlen |
| 1595 |
Pass in the length in bytes of the buffer. |
| 1596 |
@param dw_groupnumber |
| 1597 |
The value passed in should be DW_GROUPNUMBER_ANY |
| 1598 |
unless one wishes to other than a standard |
| 1599 |
group. |
| 1600 |
@param dw_errhand |
| 1601 |
Pass in NULL, normally. |
| 1602 |
If non-null one wishes libdwarf to call |
| 1603 |
this error handling function (which you must write) |
| 1604 |
instead of passing meaningful values to the |
| 1605 |
dw_error argument. |
| 1606 |
@param dw_errarg |
| 1607 |
Pass in NULL, normally. |
| 1608 |
If dw_errorhand is non-null, then this value |
| 1609 |
(a pointer or integer that means something |
| 1610 |
to you) is passed to the dw_errhand function |
| 1611 |
in case that is helpful to you. |
| 1612 |
@param dw_dbg |
| 1613 |
On success, *dw_dbg is set to a pointer to |
| 1614 |
a new Dwarf_Debug structure to be used in |
| 1615 |
calls to libdwarf functions. |
| 1616 |
@param dw_dl_path_array |
| 1617 |
debuglink processing allows a user-specified set of file paths |
| 1618 |
and this argument allows one to specify these. |
| 1619 |
Pass in a pointer to array of pointers to strings |
| 1620 |
which you, the caller, have filled in. The strings |
| 1621 |
should be alternate paths (see the GNU debuglink |
| 1622 |
documentation.) |
| 1623 |
@param dw_dl_path_array_size |
| 1624 |
Specify the size of the dw_dl_path_array. |
| 1625 |
@param dw_dl_path_source |
| 1626 |
returns DW_PATHSOURCE_basic or other such value so the caller can |
| 1627 |
know how the true-path was resolved. |
| 1628 |
@param dw_error |
| 1629 |
In case return is DW_DLV_ERROR |
| 1630 |
dw_error is set to point to |
| 1631 |
the error details. |
| 1632 |
@return DW_DLV_OK etc. |
| 1633 |
|
| 1634 |
@link dwsec_separatedebug Details on separate DWARF object access @endlink |
| 1635 |
@see exampleinit_dl |
| 1636 |
*/ |
| 1637 |
DW_API int dwarf_init_path_dl(const char * dw_path, |
| 1638 |
char * dw_true_path_out_buffer, |
| 1639 |
unsigned int dw_true_path_bufferlen, |
| 1640 |
unsigned int dw_groupnumber, |
| 1641 |
Dwarf_Handler dw_errhand, |
| 1642 |
Dwarf_Ptr dw_errarg, |
| 1643 |
Dwarf_Debug* dw_dbg, |
| 1644 |
char ** dw_dl_path_array, |
| 1645 |
unsigned int dw_dl_path_array_size, |
| 1646 |
unsigned char * dw_dl_path_source, |
| 1647 |
Dwarf_Error* dw_error); |
| 1648 |
|
| 1649 |
/*! @brief Initialization based on path with debuglink |
| 1650 |
|
| 1651 |
This identical to dwarf_init_path_dl() except that it |
| 1652 |
adds a new argument, dw_universalnumber, |
| 1653 |
with which you can specify which object in |
| 1654 |
a Mach-O universal binary you wish to open. |
| 1655 |
|
| 1656 |
It is always safe and appropriate to pass |
| 1657 |
zero as the dw_universalnumber. |
| 1658 |
Elf and PE and (non-universal) Mach-O object |
| 1659 |
files ignore the value of dw_universalnumber. |
| 1660 |
|
| 1661 |
Mach-O objects do not contain or use debuglink |
| 1662 |
data. |
| 1663 |
*/ |
| 1664 |
|
| 1665 |
DW_API int dwarf_init_path_dl_a(const char * dw_path, |
| 1666 |
char * dw_true_path_out_buffer, |
| 1667 |
unsigned int dw_true_path_bufferlen, |
| 1668 |
unsigned int dw_groupnumber, |
| 1669 |
unsigned int dw_universalnumber, |
| 1670 |
Dwarf_Handler dw_errhand, |
| 1671 |
Dwarf_Ptr dw_errarg, |
| 1672 |
Dwarf_Debug* dw_dbg, |
| 1673 |
char ** dw_dl_path_array, |
| 1674 |
unsigned int dw_dl_path_array_size, |
| 1675 |
unsigned char * dw_dl_path_source, |
| 1676 |
Dwarf_Error* dw_error); |
| 1677 |
|
| 1678 |
/*! @brief Initialization based on Unix/Linux (etc) fd |
| 1679 |
|
| 1680 |
In case DW_DLV_ERROR returned be sure to |
| 1681 |
call dwarf_dealloc_error even though |
| 1682 |
the returned Dwarf_Debug is NULL. |
| 1683 |
|
| 1684 |
@param dw_fd |
| 1685 |
An open Unix/Linux/etc fd on the object file. |
| 1686 |
@param dw_groupnumber |
| 1687 |
The value passed in should be DW_GROUPNUMBER_ANY |
| 1688 |
unless one wishes to other than a standard |
| 1689 |
group. |
| 1690 |
@param dw_errhand |
| 1691 |
Pass in NULL unless one wishes libdwarf to call |
| 1692 |
this error handling function (which you must write) |
| 1693 |
instead of passing meaningful values to the |
| 1694 |
dw_error argument. |
| 1695 |
@param dw_errarg |
| 1696 |
If dw_errorhand is non-null, then this value |
| 1697 |
(a pointer or integer that means something |
| 1698 |
to you) is passed to the dw_errhand function |
| 1699 |
in case that is helpful to you. |
| 1700 |
@param dw_dbg |
| 1701 |
On success, *dw_dbg is set to a pointer to |
| 1702 |
a new Dwarf_Debug structure to be used in |
| 1703 |
calls to libdwarf functions. |
| 1704 |
@param dw_error |
| 1705 |
In case return is DW_DLV_ERROR |
| 1706 |
dw_error is set to point to |
| 1707 |
the error details. |
| 1708 |
@return |
| 1709 |
DW_DLV_OK etc. |
| 1710 |
*/ |
| 1711 |
DW_API int dwarf_init_b(int dw_fd, |
| 1712 |
unsigned int dw_groupnumber, |
| 1713 |
Dwarf_Handler dw_errhand, |
| 1714 |
Dwarf_Ptr dw_errarg, |
| 1715 |
Dwarf_Debug* dw_dbg, |
| 1716 |
Dwarf_Error* dw_error); |
| 1717 |
|
| 1718 |
/*! @brief Close the initialized dw_dbg and |
| 1719 |
free all data libdwarf has for this dw_dbg. |
| 1720 |
@param dw_dbg |
| 1721 |
Close the dbg. |
| 1722 |
@return |
| 1723 |
May return DW_DLV_ERROR if something |
| 1724 |
is very wrong: no further information is available.. |
| 1725 |
May return DW_DLV_NO_ENTRY |
| 1726 |
but no further information is available. |
| 1727 |
Normally returns DW_DLV_OK. |
| 1728 |
|
| 1729 |
There is nothing the caller can do with the return |
| 1730 |
value except report it somehow. Most callers |
| 1731 |
ignore the return value. |
| 1732 |
*/ |
| 1733 |
DW_API int dwarf_finish(Dwarf_Debug dw_dbg); |
| 1734 |
|
| 1735 |
/*! @brief Used to access DWARF information in memory |
| 1736 |
or in an object format unknown to libdwarf. |
| 1737 |
|
| 1738 |
In case DW_DLV_ERROR returned be sure to |
| 1739 |
call dwarf_dealloc_error even though |
| 1740 |
the returned Dwarf_Debug is NULL. |
| 1741 |
|
| 1742 |
@see jitreader |
| 1743 |
|
| 1744 |
and @see dw_noobject Reading DWARF not in object file |
| 1745 |
|
| 1746 |
@param dw_obj |
| 1747 |
A data structure filled out by the caller so libdwarf |
| 1748 |
can access DWARF data not in a supported object file format. |
| 1749 |
@param dw_errhand |
| 1750 |
Pass in NULL normally. |
| 1751 |
@param dw_errarg |
| 1752 |
Pass in NULL normally. |
| 1753 |
@param dw_groupnumber |
| 1754 |
The value passed in should be DW_GROUPNUMBER_ANY |
| 1755 |
unless one wishes to other than a standard |
| 1756 |
group (quite unlikely for this interface). |
| 1757 |
@param dw_dbg |
| 1758 |
On success, *dw_dbg is set to a pointer to |
| 1759 |
a new Dwarf_Debug structure to be used in |
| 1760 |
calls to libdwarf functions. |
| 1761 |
@param dw_error |
| 1762 |
In case return is DW_DLV_ERROR |
| 1763 |
dw_error is set to point to |
| 1764 |
the error details. |
| 1765 |
@return |
| 1766 |
The usual value: DW_DLV_OK etc. |
| 1767 |
*/ |
| 1768 |
DW_API int dwarf_object_init_b(Dwarf_Obj_Access_Interface_a* dw_obj, |
| 1769 |
Dwarf_Handler dw_errhand, |
| 1770 |
Dwarf_Ptr dw_errarg, |
| 1771 |
unsigned int dw_groupnumber, |
| 1772 |
Dwarf_Debug* dw_dbg, |
| 1773 |
Dwarf_Error* dw_error); |
| 1774 |
|
| 1775 |
/*! @brief Used to close the object_init dw_dbg. |
| 1776 |
|
| 1777 |
Close the dw_dbg opened by dwarf_object_init_b(). |
| 1778 |
|
| 1779 |
@param dw_dbg |
| 1780 |
Must be an open Dwarf_Debug opened by |
| 1781 |
dwarf_object_init_b(). |
| 1782 |
The init call dw_obj data is not freed |
| 1783 |
by the call to dwarf_object_finish. |
| 1784 |
@return |
| 1785 |
The return value DW_DLV_OK etc is useless, |
| 1786 |
one could possibly report it somehow. Callers |
| 1787 |
usually ignore the return value. |
| 1788 |
*/ |
| 1789 |
DW_API int dwarf_object_finish(Dwarf_Debug dw_dbg); |
| 1790 |
|
| 1791 |
/*! @brief Use with split dwarf. |
| 1792 |
|
| 1793 |
In libdwarf usage the object file being reported |
| 1794 |
on [a] is opened with dwarf_init_path() or the like. |
| 1795 |
If that object file [a] is a split-dwarf object |
| 1796 |
then important data needed to report all of what is |
| 1797 |
in the object file [a] needs an open Dwarf_Debug on |
| 1798 |
the base object file [b] (usually the base executable |
| 1799 |
object). Here we call that executable object file [b] |
| 1800 |
the @e tied object. |
| 1801 |
|
| 1802 |
See DWARF5 Appendix F. |
| 1803 |
|
| 1804 |
@param dw_split_dbg |
| 1805 |
Pass in an open dbg, on a split-dwarf object file |
| 1806 |
with (normally) lots of DWARF but no executable code. |
| 1807 |
@param dw_tied_dbg |
| 1808 |
Pass in an open dbg on an executable |
| 1809 |
(we call it a @e tied dbg here) |
| 1810 |
which has minimal DWARF (to save space |
| 1811 |
in the executable). |
| 1812 |
@param dw_error |
| 1813 |
In case return is DW_DLV_ERROR |
| 1814 |
dw_error is set to point to |
| 1815 |
the error details. |
| 1816 |
@return DW_DLV_OK etc. |
| 1817 |
|
| 1818 |
@see example2 |
| 1819 |
@see example3 |
| 1820 |
*/ |
| 1821 |
DW_API int dwarf_set_tied_dbg(Dwarf_Debug dw_split_dbg, |
| 1822 |
Dwarf_Debug dw_tied_dbg, |
| 1823 |
Dwarf_Error* dw_error); |
| 1824 |
|
| 1825 |
/*! @brief Use with split dwarf. |
| 1826 |
|
| 1827 |
Given a main Dwarf_Debug this returns |
| 1828 |
the tied Dwarf_Debug if there is one |
| 1829 |
or else returns null(0). |
| 1830 |
|
| 1831 |
Before v0.11.0 it was not defined what this |
| 1832 |
returned if the tied-Dwarf_Debug |
| 1833 |
was passed in, but it would have returned |
| 1834 |
null(0) in that case. |
| 1835 |
Unlikely anyone uses this call as |
| 1836 |
callers had the tied and base dbg when calling |
| 1837 |
dwarf_set_tied_dbg(). |
| 1838 |
|
| 1839 |
@param dw_dbg |
| 1840 |
Pass in a non-null Dwarf_Debug which is either |
| 1841 |
a main-Dwarf_Debug or a tied-Dwarf_Debug. |
| 1842 |
@param dw_tieddbg_out |
| 1843 |
On success returns the applicable tied-Dwarf_Debug |
| 1844 |
through the pointer. |
| 1845 |
If dw_dbg is a tied-Dwarf_Debug the function returns |
| 1846 |
null(0) through the poiner. |
| 1847 |
If there is no tied-Dwarf_Debug (meaning there is |
| 1848 |
just a main-Dwarf_Debug) the function returns |
| 1849 |
null (0) through the pointer. |
| 1850 |
@param dw_error |
| 1851 |
If the dw_dbg is invalid or damaged then the function |
| 1852 |
returns DW_DLV_ERROR and |
| 1853 |
dw_error is set to point to the error details. |
| 1854 |
@return DW_DLV_OK or DW_DLV_ERROR. |
| 1855 |
Never returns DW_DLV_NO_ENTRY. |
| 1856 |
|
| 1857 |
*/ |
| 1858 |
DW_API int dwarf_get_tied_dbg(Dwarf_Debug dw_dbg, |
| 1859 |
Dwarf_Debug * dw_tieddbg_out, |
| 1860 |
Dwarf_Error * dw_error); |
| 1861 |
/*! @} |
| 1862 |
*/ |
| 1863 |
/*! @defgroup compilationunit Compilation Unit (CU) Access |
| 1864 |
|
| 1865 |
@{ |
| 1866 |
*/ |
| 1867 |
/*! @brief Return information on the next CU header(e). |
| 1868 |
|
| 1869 |
New in v0.9.0 November 2023. |
| 1870 |
|
| 1871 |
The library keeps track of where it is in the object file |
| 1872 |
and it knows where to find 'next'. |
| 1873 |
|
| 1874 |
It returns the CU_DIE pointer through dw_cu_die; |
| 1875 |
|
| 1876 |
dwarf_next_cu_header_e() is preferred over |
| 1877 |
dwarf_next_cu_header_d() as the latter requires |
| 1878 |
a second (immediate) step to access the CU-DIE |
| 1879 |
of the CU. |
| 1880 |
|
| 1881 |
With the CU-DIE returned by dwarf_next_cu_header_e() |
| 1882 |
one calls dwarf_child() first (the CU-DIE has |
| 1883 |
no siblings) and then one calls dwarf_siblingof_c() and |
| 1884 |
dwarf_child() appropriately to descend the tree of |
| 1885 |
DIEs. |
| 1886 |
|
| 1887 |
@param dw_dbg |
| 1888 |
The Dwarf_Debug of interest. |
| 1889 |
@param dw_is_info |
| 1890 |
Pass in TRUE if reading through .debug_info |
| 1891 |
Pass in FALSE if reading through DWARF4 |
| 1892 |
.debug_types. |
| 1893 |
@param dw_cu_die |
| 1894 |
Pass in a pointer to a Dwarf_Die. the call |
| 1895 |
sets the passed-in pointer to be a Compilation |
| 1896 |
Unit Die for use with dwarf_child() or any |
| 1897 |
other call requiring a Dwarf_Die argument. |
| 1898 |
@param dw_cu_header_length |
| 1899 |
Returns the length of the just-read CU header. |
| 1900 |
@param dw_version_stamp |
| 1901 |
Returns the version number (2 to 5) of the CU |
| 1902 |
header just read. |
| 1903 |
@param dw_abbrev_offset |
| 1904 |
Returns the .debug_abbrev offset from the |
| 1905 |
the CU header just read. |
| 1906 |
@param dw_address_size |
| 1907 |
Returns the address size specified for this CU, |
| 1908 |
usually either 4 or 8. |
| 1909 |
@param dw_length_size |
| 1910 |
Returns the offset size (the length |
| 1911 |
of the size field from the header) |
| 1912 |
specified for this CU, either 4 or 4. |
| 1913 |
@param dw_extension_size |
| 1914 |
If the section is standard 64bit DWARF |
| 1915 |
then this value is 4. Else the value is zero. |
| 1916 |
@param dw_type_signature |
| 1917 |
If the CU is DW_UT_skeleton DW_UT_split_compile, |
| 1918 |
DW_UT_split_type or DW_UT_type this is the |
| 1919 |
type signature from the CU_header |
| 1920 |
compiled into this field. |
| 1921 |
@param dw_typeoffset |
| 1922 |
For DW_UT_split_type or DW_UT_type this is the |
| 1923 |
type offset from the CU header. |
| 1924 |
@param dw_next_cu_header_offset |
| 1925 |
The offset in the section of the next CU |
| 1926 |
(unless there is a compiler bug this is rarely |
| 1927 |
of interest). |
| 1928 |
@param dw_header_cu_type |
| 1929 |
Returns DW_UT_compile, or other DW_UT value. |
| 1930 |
@param dw_error |
| 1931 |
In case return is DW_DLV_ERROR |
| 1932 |
dw_error is set to point to |
| 1933 |
the error details. |
| 1934 |
@return |
| 1935 |
Returns DW_DLV_OK on success. |
| 1936 |
Returns DW_DLV_NO_ENTRY if all CUs have been read. |
| 1937 |
|
| 1938 |
@see examplecuhdre |
| 1939 |
|
| 1940 |
*/ |
| 1941 |
DW_API int dwarf_next_cu_header_e(Dwarf_Debug dw_dbg, |
| 1942 |
Dwarf_Bool dw_is_info, |
| 1943 |
Dwarf_Die *dw_cu_die, |
| 1944 |
Dwarf_Unsigned *dw_cu_header_length, |
| 1945 |
Dwarf_Half *dw_version_stamp, |
| 1946 |
Dwarf_Off *dw_abbrev_offset, |
| 1947 |
Dwarf_Half *dw_address_size, |
| 1948 |
Dwarf_Half *dw_length_size, |
| 1949 |
Dwarf_Half *dw_extension_size, |
| 1950 |
Dwarf_Sig8 *dw_type_signature, |
| 1951 |
Dwarf_Unsigned *dw_typeoffset, |
| 1952 |
Dwarf_Unsigned *dw_next_cu_header_offset, |
| 1953 |
Dwarf_Half *dw_header_cu_type, |
| 1954 |
Dwarf_Error *dw_error); |
| 1955 |
|
| 1956 |
/*! @brief Return information on the next CU header(d) |
| 1957 |
|
| 1958 |
This is the version to use for linking against |
| 1959 |
libdwarf v0.8.0 and earlier (and it also works |
| 1960 |
for later versions). |
| 1961 |
|
| 1962 |
This version will eventually be deprecated. |
| 1963 |
|
| 1964 |
The library keeps track of where it is in the object file |
| 1965 |
and it knows where to find 'next'. |
| 1966 |
|
| 1967 |
In order to read the DIE tree of the CU this |
| 1968 |
records information in the dw_dbg data and |
| 1969 |
after a successful call to dwarf_next_cu_header_d() |
| 1970 |
only an immediate call to |
| 1971 |
dwarf_siblingof_b(dw_dbg,NULL,dw_is_info, &cu_die,...) |
| 1972 |
is guaranteed to return the correct DIE (a Compilation |
| 1973 |
Unit DIE). |
| 1974 |
|
| 1975 |
Avoid any call to libdwarf |
| 1976 |
between a successful call to dwarf_next_cu_header_d() and |
| 1977 |
dwarf_siblingof_b(dw_dbg,NULL,dw_is_info, &cu_die,...) |
| 1978 |
to ensure the intended and correct Dwarf_Die is returned. |
| 1979 |
|
| 1980 |
@see examplecuhdrd |
| 1981 |
|
| 1982 |
All arguments are the same as dwarf_next_cu_header_e() |
| 1983 |
except that there is no dw_cu_die argument here. |
| 1984 |
*/ |
| 1985 |
|
| 1986 |
DW_API int dwarf_next_cu_header_d(Dwarf_Debug dw_dbg, |
| 1987 |
Dwarf_Bool dw_is_info, |
| 1988 |
Dwarf_Unsigned *dw_cu_header_length, |
| 1989 |
Dwarf_Half *dw_version_stamp, |
| 1990 |
Dwarf_Off *dw_abbrev_offset, |
| 1991 |
Dwarf_Half *dw_address_size, |
| 1992 |
Dwarf_Half *dw_length_size, |
| 1993 |
Dwarf_Half *dw_extension_size, |
| 1994 |
Dwarf_Sig8 *dw_type_signature, |
| 1995 |
Dwarf_Unsigned *dw_typeoffset, |
| 1996 |
Dwarf_Unsigned *dw_next_cu_header_offset, |
| 1997 |
Dwarf_Half *dw_header_cu_type, |
| 1998 |
Dwarf_Error *dw_error); |
| 1999 |
|
| 2000 |
/*! @brief Return the next sibling DIE. |
| 2001 |
|
| 2002 |
@param dw_die |
| 2003 |
Pass in a known DIE and this will retrieve |
| 2004 |
the next sibling in the chain. |
| 2005 |
@param dw_return_siblingdie |
| 2006 |
The DIE returned through the pointer. |
| 2007 |
@param dw_error |
| 2008 |
The usual error information, if any. |
| 2009 |
@return |
| 2010 |
Returns DW_DLV_OK etc. |
| 2011 |
|
| 2012 |
@see example4 |
| 2013 |
@see dwarf_get_die_infotypes |
| 2014 |
*/ |
| 2015 |
DW_API int dwarf_siblingof_c(Dwarf_Die dw_die, |
| 2016 |
Dwarf_Die *dw_return_siblingdie, |
| 2017 |
Dwarf_Error *dw_error); |
| 2018 |
|
| 2019 |
/*! @brief Return the first DIE or the next sibling DIE. |
| 2020 |
|
| 2021 |
This function follows dwarf_next_cu_header_d() |
| 2022 |
to return the CU-DIE that dwarf_next_cu_header_d() |
| 2023 |
implies but does not reveal. |
| 2024 |
|
| 2025 |
Aside from the special case required use |
| 2026 |
of dwarf_siblingof_b() |
| 2027 |
immediately following |
| 2028 |
dwarf_next_cu_header_d(), dwarf_siblingof_c() |
| 2029 |
is the faster function. |
| 2030 |
|
| 2031 |
This function will eventually be deprecated. |
| 2032 |
|
| 2033 |
@param dw_dbg |
| 2034 |
The Dwarf_Debug one is operating on. |
| 2035 |
@param dw_die |
| 2036 |
Immediately after calling dwarf_next_cu_header_d |
| 2037 |
pass in NULL to retrieve the CU DIE. |
| 2038 |
Or pass in a known DIE and this will retrieve |
| 2039 |
the next sibling in the chain. |
| 2040 |
@param dw_is_info |
| 2041 |
Pass TRUE or FALSE to match the applicable |
| 2042 |
dwarf_next_cu_header_d call. |
| 2043 |
@param dw_return_siblingdie |
| 2044 |
The DIE returned through the pointer. |
| 2045 |
@param dw_error |
| 2046 |
The usual error information, if any. |
| 2047 |
@return |
| 2048 |
Returns DW_DLV_OK etc. |
| 2049 |
|
| 2050 |
@see example4 |
| 2051 |
@see dwarf_get_die_infotypes |
| 2052 |
*/ |
| 2053 |
DW_API int dwarf_siblingof_b(Dwarf_Debug dw_dbg, |
| 2054 |
Dwarf_Die dw_die, |
| 2055 |
Dwarf_Bool dw_is_info, |
| 2056 |
Dwarf_Die *dw_return_siblingdie, |
| 2057 |
Dwarf_Error *dw_error); |
| 2058 |
|
| 2059 |
/*! @brief Return some CU-relative facts. |
| 2060 |
|
| 2061 |
Any Dwarf_Die will work. |
| 2062 |
The values returned through the pointers |
| 2063 |
are about the CU for a DIE |
| 2064 |
|
| 2065 |
@param dw_die |
| 2066 |
Some open Dwarf_Die. |
| 2067 |
@param dw_version |
| 2068 |
Returns the DWARF version: 2,3,4, or 5 |
| 2069 |
@param dw_is_info |
| 2070 |
Returns non-zero if the CU is .debug_info. |
| 2071 |
Returns zero if the CU is .debug_types (DWARF4). |
| 2072 |
@param dw_is_dwo |
| 2073 |
Returns ton-zero if the CU is a dwo/dwp object and |
| 2074 |
zero if it is a standard object. |
| 2075 |
@param dw_offset_size |
| 2076 |
Returns offset size, 4 and 8 are possible. |
| 2077 |
@param dw_address_size |
| 2078 |
Almost always returns 4 or 8. Could be 2 |
| 2079 |
in unusual circumstances. |
| 2080 |
@param dw_extension_size |
| 2081 |
The sum of dw_offset_size and dw_extension_size |
| 2082 |
are the count of the initial bytes of the CU. |
| 2083 |
Standard lengths are 4 and 12. |
| 2084 |
For 1990's SGI objects the length could be 8. |
| 2085 |
@param dw_signature |
| 2086 |
Returns a pointer to an 8 byte signature. |
| 2087 |
@param dw_offset_of_length |
| 2088 |
Returns the section offset of the initial |
| 2089 |
byte of the CU. |
| 2090 |
@param dw_total_byte_length |
| 2091 |
Returns the total length of the CU including |
| 2092 |
the length field and the content of the CU. |
| 2093 |
@param dw_error |
| 2094 |
The usual Dwarf_Error*. |
| 2095 |
@return |
| 2096 |
Returns DW_DLV_OK etc. |
| 2097 |
*/ |
| 2098 |
|
| 2099 |
DW_API int dwarf_cu_header_basics(Dwarf_Die dw_die, |
| 2100 |
Dwarf_Half *dw_version, |
| 2101 |
Dwarf_Bool *dw_is_info, |
| 2102 |
Dwarf_Bool *dw_is_dwo, |
| 2103 |
Dwarf_Half *dw_offset_size, |
| 2104 |
Dwarf_Half *dw_address_size, |
| 2105 |
Dwarf_Half *dw_extension_size, |
| 2106 |
Dwarf_Sig8 **dw_signature, |
| 2107 |
Dwarf_Off *dw_offset_of_length, |
| 2108 |
Dwarf_Unsigned *dw_total_byte_length, |
| 2109 |
Dwarf_Error *dw_error); |
| 2110 |
|
| 2111 |
/*! @brief Return the child DIE, if any. |
| 2112 |
The child may be the first of a list of |
| 2113 |
sibling DIEs. |
| 2114 |
|
| 2115 |
@param dw_die |
| 2116 |
We will return the first child of this DIE. |
| 2117 |
@param dw_return_childdie |
| 2118 |
Returns the first child through the pointer. |
| 2119 |
For subsequent dies siblings of the first, use |
| 2120 |
dwarf_siblingof_c(). |
| 2121 |
@param dw_error |
| 2122 |
The usual Dwarf_Error*. |
| 2123 |
@return |
| 2124 |
Returns DW_DLV_OK etc. Returns DW_DLV_NO_ENTRY |
| 2125 |
if dw_die has no children. |
| 2126 |
|
| 2127 |
@see example5 |
| 2128 |
*/ |
| 2129 |
|
| 2130 |
DW_API int dwarf_child(Dwarf_Die dw_die, |
| 2131 |
Dwarf_Die* dw_return_childdie, |
| 2132 |
Dwarf_Error* dw_error); |
| 2133 |
|
| 2134 |
/*! @brief Deallocate (free) a DIE. |
| 2135 |
@param dw_die |
| 2136 |
Frees (deallocs) memory associated with this Dwarf_Die. |
| 2137 |
|
| 2138 |
DIEs not freed explicitly will be freed by |
| 2139 |
dwarf_finish(). |
| 2140 |
*/ |
| 2141 |
DW_API void dwarf_dealloc_die( Dwarf_Die dw_die); |
| 2142 |
|
| 2143 |
/*! @brief Return a CU DIE given a has signature |
| 2144 |
|
| 2145 |
@param dw_dbg |
| 2146 |
@param dw_hash_sig |
| 2147 |
A pointer to an 8 byte signature to be looked up. |
| 2148 |
in .debug_names. |
| 2149 |
@param dw_sig_type |
| 2150 |
Valid type requests are "cu" and "tu" |
| 2151 |
@param dw_returned_CU_die |
| 2152 |
Returns the found CU DIE if one is found. |
| 2153 |
@param dw_error |
| 2154 |
The usual Dwarf_Error*. |
| 2155 |
@return |
| 2156 |
DW_DLV_OK means dw_returned_CU_die was set. |
| 2157 |
DW_DLV_NO_ENTRY means the signature could |
| 2158 |
not be found. |
| 2159 |
*/ |
| 2160 |
DW_API int dwarf_die_from_hash_signature(Dwarf_Debug dw_dbg, |
| 2161 |
Dwarf_Sig8 * dw_hash_sig, |
| 2162 |
const char * dw_sig_type, |
| 2163 |
Dwarf_Die* dw_returned_CU_die, |
| 2164 |
Dwarf_Error* dw_error); |
| 2165 |
|
| 2166 |
/*! @brief Return DIE given global (not CU-relative) offset. |
| 2167 |
|
| 2168 |
This works whether or not the target section |
| 2169 |
has had dwarf_next_cu_header_d() applied, |
| 2170 |
the CU the offset exists in has |
| 2171 |
been seen at all, or the target offset is one |
| 2172 |
libdwarf has seen before. |
| 2173 |
|
| 2174 |
@param dw_dbg |
| 2175 |
The applicable Dwarf_Debug |
| 2176 |
@param dw_offset |
| 2177 |
The global offset of the DIE in the appropriate |
| 2178 |
section. |
| 2179 |
@param dw_is_info |
| 2180 |
Pass TRUE if the target is .debug_info. |
| 2181 |
Pass FALSE if the target is .debug_types. |
| 2182 |
@param dw_return_die |
| 2183 |
On success this returns a DIE pointer to |
| 2184 |
the found DIE. |
| 2185 |
@param dw_error |
| 2186 |
The usual Dwarf_Error*. |
| 2187 |
@return |
| 2188 |
DW_DLV_OK means dw_returned_die was found |
| 2189 |
DW_DLV_NO_ENTRY is only possible if the offset |
| 2190 |
is to a null DIE, and that is very unusual. |
| 2191 |
Otherwise expect DW_DLV_ERROR. |
| 2192 |
|
| 2193 |
@see example6 |
| 2194 |
|
| 2195 |
*/ |
| 2196 |
DW_API int dwarf_offdie_b(Dwarf_Debug dw_dbg, |
| 2197 |
Dwarf_Off dw_offset, |
| 2198 |
Dwarf_Bool dw_is_info, |
| 2199 |
Dwarf_Die* dw_return_die, |
| 2200 |
Dwarf_Error* dw_error); |
| 2201 |
|
| 2202 |
/*! @brief Return a DIE given a Dwarf_Sig8 hash. |
| 2203 |
|
| 2204 |
Returns DIE and is_info flag if it finds the hash |
| 2205 |
signature of a DIE. Often will be the CU DIE of |
| 2206 |
DW_UT_split_type or DW_UT_type CU. |
| 2207 |
|
| 2208 |
@param dw_dbg |
| 2209 |
The applicable Dwarf_Debug |
| 2210 |
@param dw_ref |
| 2211 |
A pointer to a Dwarf_Sig8 struct whose |
| 2212 |
content defines what is being searched for. |
| 2213 |
@param dw_die_out |
| 2214 |
If found, this returns the found DIE itself. |
| 2215 |
@param dw_is_info |
| 2216 |
If found, this returns section (.debug_is_info |
| 2217 |
or .debug_is_types). |
| 2218 |
@param dw_error |
| 2219 |
The usual error detail return pointer. |
| 2220 |
@return |
| 2221 |
Returns DW_DLV_OK etc. |
| 2222 |
*/ |
| 2223 |
DW_API int dwarf_find_die_given_sig8(Dwarf_Debug dw_dbg, |
| 2224 |
Dwarf_Sig8 *dw_ref, |
| 2225 |
Dwarf_Die *dw_die_out, |
| 2226 |
Dwarf_Bool *dw_is_info, |
| 2227 |
Dwarf_Error *dw_error); |
| 2228 |
|
| 2229 |
/*! @brief Return the is_info flag. |
| 2230 |
|
| 2231 |
So client software knows if a DIE is in debug_info or |
| 2232 |
(DWARF4-only) debug_types. |
| 2233 |
@param dw_die |
| 2234 |
The DIE being queried. |
| 2235 |
@return |
| 2236 |
If non-zero the flag means the DIE is in .debug_info. |
| 2237 |
Otherwise it means the DIE is in .debug_types. |
| 2238 |
*/ |
| 2239 |
DW_API Dwarf_Bool dwarf_get_die_infotypes_flag(Dwarf_Die dw_die); |
| 2240 |
/*! @} */ |
| 2241 |
|
| 2242 |
/*! @defgroup dieentry Debugging Information Entry (DIE) content |
| 2243 |
@{ |
| 2244 |
This is the main interface to attributes of a DIE. |
| 2245 |
*/ |
| 2246 |
|
| 2247 |
/*! @brief Return the abbrev section offset of a DIE's abbrevs. |
| 2248 |
|
| 2249 |
So we can associate a DIE's abbreviations with the contents |
| 2250 |
the abbreviations section. |
| 2251 |
Useful for detailed printing and analysis of |
| 2252 |
abbreviations. |
| 2253 |
|
| 2254 |
@param dw_die |
| 2255 |
The DIE of interest |
| 2256 |
@param dw_abbrev_offset |
| 2257 |
On success is set to the global offset |
| 2258 |
in the .debug_abbrev section of the abbreviations |
| 2259 |
for the DIE. |
| 2260 |
@param dw_abbrev_count |
| 2261 |
On success is set to the count of abbreviations |
| 2262 |
in the .debug_abbrev section of the abbreviations |
| 2263 |
for the DIE. |
| 2264 |
@param dw_error |
| 2265 |
The usual error detail return pointer. |
| 2266 |
@return |
| 2267 |
Returns DW_DLV_OK etc. |
| 2268 |
*/ |
| 2269 |
DW_API int dwarf_die_abbrev_global_offset(Dwarf_Die dw_die, |
| 2270 |
Dwarf_Off * dw_abbrev_offset, |
| 2271 |
Dwarf_Unsigned * dw_abbrev_count, |
| 2272 |
Dwarf_Error* dw_error); |
| 2273 |
|
| 2274 |
/*! @brief Get TAG value of DIE. |
| 2275 |
@param dw_die |
| 2276 |
The DIE of interest |
| 2277 |
@param dw_return_tag |
| 2278 |
On success, set to the DW_TAG value of the DIE. |
| 2279 |
@param dw_error |
| 2280 |
The usual error detail return pointer. |
| 2281 |
@return |
| 2282 |
Returns DW_DLV_OK etc. |
| 2283 |
*/ |
| 2284 |
DW_API int dwarf_tag(Dwarf_Die dw_die, |
| 2285 |
Dwarf_Half* dw_return_tag, |
| 2286 |
Dwarf_Error* dw_error); |
| 2287 |
|
| 2288 |
/*! @brief Return the global section offset of the DIE. |
| 2289 |
|
| 2290 |
@param dw_die |
| 2291 |
The DIE of interest |
| 2292 |
@param dw_return_offset |
| 2293 |
On success the offset refers to the section of the DIE |
| 2294 |
itself, which may be .debug_offset or .debug_types. |
| 2295 |
@param dw_error |
| 2296 |
The usual error detail return pointer. |
| 2297 |
@return |
| 2298 |
Returns DW_DLV_OK etc. |
| 2299 |
*/ |
| 2300 |
DW_API int dwarf_dieoffset(Dwarf_Die dw_die, |
| 2301 |
Dwarf_Off* dw_return_offset, |
| 2302 |
Dwarf_Error* dw_error); |
| 2303 |
|
| 2304 |
/*! @brief Extract address given address index. DWARF5 |
| 2305 |
|
| 2306 |
Useful for checking for compiler/linker errors |
| 2307 |
in the creation of DWARF5. |
| 2308 |
|
| 2309 |
@param dw_die |
| 2310 |
The DIE of interest |
| 2311 |
@param dw_index |
| 2312 |
An index into .debug_addr. This will look first for |
| 2313 |
.debug_addr in the dbg object DIE and if not there |
| 2314 |
will look in the tied object if that is available. |
| 2315 |
@param dw_return_addr |
| 2316 |
On success the address is returned through the pointer. |
| 2317 |
@param dw_error |
| 2318 |
The usual error detail return pointer. |
| 2319 |
@return |
| 2320 |
Returns DW_DLV_OK etc. |
| 2321 |
*/ |
| 2322 |
DW_API int dwarf_debug_addr_index_to_addr(Dwarf_Die dw_die, |
| 2323 |
Dwarf_Unsigned dw_index, |
| 2324 |
Dwarf_Addr * dw_return_addr, |
| 2325 |
Dwarf_Error * dw_error); |
| 2326 |
|
| 2327 |
/*! @brief Informs if a DW_FORM is an indexed form |
| 2328 |
|
| 2329 |
Reading a CU DIE with DW_AT_low_pc an indexed value can |
| 2330 |
be problematic as several different FORMs are indexed. |
| 2331 |
Some in DWARF5 others being extensions to DWARF4 |
| 2332 |
and DWARF5. Indexed forms interact with DW_AT_addr_base |
| 2333 |
in a DIE making this a very relevant distinction. |
| 2334 |
*/ |
| 2335 |
DW_API Dwarf_Bool dwarf_addr_form_is_indexed(int dw_form); |
| 2336 |
|
| 2337 |
/*! @brief Return the CU DIE offset given any DIE |
| 2338 |
|
| 2339 |
Returns |
| 2340 |
the global debug_info section offset of the CU DIE |
| 2341 |
in the CU containing the given_die |
| 2342 |
(the passed in DIE can be any DIE). |
| 2343 |
|
| 2344 |
This does not identify whether the section is |
| 2345 |
.debug_info or .debug_types, use |
| 2346 |
dwarf_get_die_infotypes_flag() to determine the section. |
| 2347 |
|
| 2348 |
@see dwarf_get_cu_die_offset_given_cu_header_offset_b |
| 2349 |
@see example7 |
| 2350 |
|
| 2351 |
@param dw_die |
| 2352 |
The DIE being queried. |
| 2353 |
@param dw_return_offset |
| 2354 |
Returns the section offset of the CU DIE for dw_die. |
| 2355 |
@param dw_error |
| 2356 |
The usual error detail return pointer. |
| 2357 |
@return |
| 2358 |
Returns DW_DLV_OK etc. |
| 2359 |
*/ |
| 2360 |
DW_API int dwarf_CU_dieoffset_given_die(Dwarf_Die dw_die, |
| 2361 |
Dwarf_Off* dw_return_offset, |
| 2362 |
Dwarf_Error* dw_error); |
| 2363 |
|
| 2364 |
/*! @brief Return the CU DIE section offset given CU header offset |
| 2365 |
|
| 2366 |
Returns the CU DIE global offset if one knows the |
| 2367 |
CU header global offset. |
| 2368 |
@see dwarf_CU_dieoffset_given_die |
| 2369 |
|
| 2370 |
@param dw_dbg |
| 2371 |
The Dwarf_Debug of interest. |
| 2372 |
@param dw_in_cu_header_offset |
| 2373 |
The CU header offset. |
| 2374 |
@param dw_is_info |
| 2375 |
If TRUE the CU header offset is in .debug_info. |
| 2376 |
Otherwise the CU header offset is in .debug_types. |
| 2377 |
@param dw_out_cu_die_offset |
| 2378 |
The CU DIE offset returned through this pointer. |
| 2379 |
@param dw_error |
| 2380 |
The usual error detail return pointer. |
| 2381 |
@return |
| 2382 |
Returns DW_DLV_OK etc. |
| 2383 |
*/ |
| 2384 |
DW_API int dwarf_get_cu_die_offset_given_cu_header_offset_b( |
| 2385 |
Dwarf_Debug dw_dbg, |
| 2386 |
Dwarf_Off dw_in_cu_header_offset, |
| 2387 |
Dwarf_Bool dw_is_info, |
| 2388 |
Dwarf_Off * dw_out_cu_die_offset, |
| 2389 |
Dwarf_Error *dw_error); |
| 2390 |
|
| 2391 |
/*! @brief returns the CU relative offset of the DIE. |
| 2392 |
|
| 2393 |
@see dwarf_CU_dieoffset_given_die |
| 2394 |
|
| 2395 |
This does not identify whether the section is |
| 2396 |
.debug_info or .debug_types, use |
| 2397 |
dwarf_get_die_infotypes_flag() to determine the section. |
| 2398 |
|
| 2399 |
@param dw_die |
| 2400 |
The DIE being queried. |
| 2401 |
@param dw_return_offset |
| 2402 |
Returns the CU relative offset of this DIE. |
| 2403 |
@param dw_error |
| 2404 |
The usual error detail return pointer. |
| 2405 |
@return |
| 2406 |
Returns DW_DLV_OK etc. |
| 2407 |
*/ |
| 2408 |
DW_API int dwarf_die_CU_offset(Dwarf_Die dw_die, |
| 2409 |
Dwarf_Off* dw_return_offset, |
| 2410 |
Dwarf_Error* dw_error); |
| 2411 |
|
| 2412 |
/*! @brief Return the offset length of the entire CU of a DIE. |
| 2413 |
|
| 2414 |
This does not identify whether the section is |
| 2415 |
.debug_info or .debug_types, use |
| 2416 |
dwarf_get_die_infotypes_flag() to determine the section. |
| 2417 |
|
| 2418 |
@param dw_die |
| 2419 |
The DIE being queried. |
| 2420 |
@param dw_return_CU_header_offset |
| 2421 |
On success returns the section offset of the CU |
| 2422 |
this DIE is in. |
| 2423 |
@param dw_return_CU_length_bytes |
| 2424 |
On success returns the CU length of the CU |
| 2425 |
this DIE is in, including the CU length, header, |
| 2426 |
and all DIEs. |
| 2427 |
@param dw_error |
| 2428 |
The usual error detail return pointer. |
| 2429 |
@return |
| 2430 |
Returns DW_DLV_OK etc. |
| 2431 |
*/ |
| 2432 |
DW_API int dwarf_die_CU_offset_range(Dwarf_Die dw_die, |
| 2433 |
Dwarf_Off* dw_return_CU_header_offset, |
| 2434 |
Dwarf_Off* dw_return_CU_length_bytes, |
| 2435 |
Dwarf_Error* dw_error); |
| 2436 |
|
| 2437 |
/*! @brief Given DIE and attribute number return a Dwarf_attribute |
| 2438 |
|
| 2439 |
Returns DW_DLV_NO_ENTRY if the DIE has no attribute dw_attrnum. |
| 2440 |
|
| 2441 |
@param dw_die |
| 2442 |
The DIE of interest. |
| 2443 |
@param dw_attrnum |
| 2444 |
An attribute number, for example DW_AT_name. |
| 2445 |
@param dw_returned_attr |
| 2446 |
On success a Dwarf_Attribute pointer is returned |
| 2447 |
and it should eventually be deallocated. |
| 2448 |
@param dw_error |
| 2449 |
The usual error detail return pointer. |
| 2450 |
@return |
| 2451 |
Returns DW_DLV_OK etc. |
| 2452 |
|
| 2453 |
*/ |
| 2454 |
DW_API int dwarf_attr(Dwarf_Die dw_die, |
| 2455 |
Dwarf_Half dw_attrnum, |
| 2456 |
Dwarf_Attribute * dw_returned_attr, |
| 2457 |
Dwarf_Error* dw_error); |
| 2458 |
|
| 2459 |
/*! @brief Given DIE and attribute number return a string |
| 2460 |
|
| 2461 |
Returns DW_DLV_NO_ENTRY if the DIE has no attribute dw_attrnum. |
| 2462 |
|
| 2463 |
@param dw_die |
| 2464 |
The DIE of interest. |
| 2465 |
@param dw_attrnum |
| 2466 |
An attribute number, for example DW_AT_name. |
| 2467 |
@param dw_ret_name |
| 2468 |
On success a pointer to the string |
| 2469 |
is returned. |
| 2470 |
Do not free the string. |
| 2471 |
Many attributes allow various forms that directly or |
| 2472 |
indirectly contain strings and this |
| 2473 |
returns the string. |
| 2474 |
@param dw_error |
| 2475 |
The usual error detail return pointer. |
| 2476 |
@return |
| 2477 |
Returns DW_DLV_OK etc. |
| 2478 |
|
| 2479 |
*/ |
| 2480 |
DW_API int dwarf_die_text(Dwarf_Die dw_die, |
| 2481 |
Dwarf_Half dw_attrnum, |
| 2482 |
char ** dw_ret_name, |
| 2483 |
Dwarf_Error * dw_error); |
| 2484 |
|
| 2485 |
/*! @brief Return the string from a DW_AT_name attribute |
| 2486 |
|
| 2487 |
Returns DW_DLV_NO_ENTRY if the DIE has no attribute |
| 2488 |
DW_AT_name |
| 2489 |
|
| 2490 |
@param dw_die |
| 2491 |
The DIE of interest. |
| 2492 |
@param dw_diename |
| 2493 |
On success a pointer to the string |
| 2494 |
is returned. |
| 2495 |
Do not free the string. |
| 2496 |
Various forms directly or |
| 2497 |
indirectly contain strings and this |
| 2498 |
follows all of them to their string. |
| 2499 |
@param dw_error |
| 2500 |
The usual error detail return pointer. |
| 2501 |
@return |
| 2502 |
Returns DW_DLV_OK etc. |
| 2503 |
*/ |
| 2504 |
DW_API int dwarf_diename(Dwarf_Die dw_die, |
| 2505 |
char ** dw_diename, |
| 2506 |
Dwarf_Error* dw_error); |
| 2507 |
|
| 2508 |
/*! @brief Return the DIE abbrev code |
| 2509 |
|
| 2510 |
The Abbrev code for a DIE is a positive |
| 2511 |
integer assigned by the compiler within a particular CU. |
| 2512 |
For .debug_names abbreviations the |
| 2513 |
situation is conceptually similar. The code values |
| 2514 |
are arbitrary but compilers are motivated to make |
| 2515 |
them small so the object size is as small as |
| 2516 |
possible. |
| 2517 |
|
| 2518 |
Returns the abbrev code of the die. Cannot fail. |
| 2519 |
|
| 2520 |
@param dw_die |
| 2521 |
The DIE of interest. |
| 2522 |
@return |
| 2523 |
The abbrev code. of the DIE. |
| 2524 |
*/ |
| 2525 |
DW_API Dwarf_Unsigned dwarf_die_abbrev_code(Dwarf_Die dw_die); |
| 2526 |
|
| 2527 |
/*! @brief Return TRUE if the DIE has children |
| 2528 |
|
| 2529 |
@param dw_die |
| 2530 |
A valid DIE pointer (not NULL). |
| 2531 |
@param dw_ab_has_child |
| 2532 |
Sets TRUE though the pointer if the DIE |
| 2533 |
has children. |
| 2534 |
Otherwise sets FALSE. |
| 2535 |
@return |
| 2536 |
Returns TRUE if the DIE has a child DIE. |
| 2537 |
Else returns FALSE. |
| 2538 |
|
| 2539 |
*/ |
| 2540 |
DW_API int dwarf_die_abbrev_children_flag(Dwarf_Die dw_die, |
| 2541 |
Dwarf_Half * dw_ab_has_child); |
| 2542 |
|
| 2543 |
/*! @brief Validate a sibling DIE. |
| 2544 |
|
| 2545 |
This is used by dwarfdump (when |
| 2546 |
dwarfdump is checking for valid DWARF) |
| 2547 |
to try to catch a corrupt DIE tree. |
| 2548 |
|
| 2549 |
This does not identify whether the section is |
| 2550 |
.debug_info or .debug_types, use |
| 2551 |
dwarf_get_die_infotypes_flag() to determine the section. |
| 2552 |
|
| 2553 |
@see example_sibvalid |
| 2554 |
|
| 2555 |
@param dw_sibling |
| 2556 |
Pass in a DIE returned by dwarf_siblingof_b(). |
| 2557 |
@param dw_offset |
| 2558 |
Set to zero through the pointer. |
| 2559 |
@return |
| 2560 |
Returns DW_DLV_OK if the sibling is |
| 2561 |
at an appropriate place in the section. |
| 2562 |
Otherwise it returns DW_DLV_ERROR indicating |
| 2563 |
the DIE tree is corrupt. |
| 2564 |
|
| 2565 |
*/ |
| 2566 |
DW_API int dwarf_validate_die_sibling(Dwarf_Die dw_sibling, |
| 2567 |
Dwarf_Off* dw_offset); |
| 2568 |
|
| 2569 |
/* convenience functions, alternative to using dwarf_attrlist */ |
| 2570 |
|
| 2571 |
/*! @brief Tells whether a DIE has a particular attribute. |
| 2572 |
|
| 2573 |
@param dw_die |
| 2574 |
The DIE of interest. |
| 2575 |
@param dw_attrnum |
| 2576 |
The attribute number we are asking about, |
| 2577 |
DW_AT_name for example. |
| 2578 |
@param dw_returned_bool |
| 2579 |
On success is set TRUE if dw_die has |
| 2580 |
dw_attrnum and FALSE otherwise. |
| 2581 |
@param dw_error |
| 2582 |
The usual error detail return pointer. |
| 2583 |
@return |
| 2584 |
Never returns DW_DLV_NO_ENTRY. |
| 2585 |
Returns DW_DLV_OK unless there is an error, |
| 2586 |
in which case it returns DW_DLV_ERROR |
| 2587 |
and sets dw_error to the error details. |
| 2588 |
*/ |
| 2589 |
DW_API int dwarf_hasattr(Dwarf_Die dw_die, |
| 2590 |
Dwarf_Half dw_attrnum, |
| 2591 |
Dwarf_Bool * dw_returned_bool, |
| 2592 |
Dwarf_Error* dw_error); |
| 2593 |
|
| 2594 |
/*! @brief Return an array of DIE children offsets |
| 2595 |
|
| 2596 |
Given a DIE section offset and dw_is_info, |
| 2597 |
returns an array of DIE global [section] |
| 2598 |
offsets of the children of DIE. |
| 2599 |
|
| 2600 |
@param dw_dbg |
| 2601 |
The Dwarf_Debug of interest. |
| 2602 |
@param dw_offset |
| 2603 |
A DIE offset. |
| 2604 |
@param dw_is_info |
| 2605 |
If TRUE says to use the offset in .debug_info. |
| 2606 |
Else use the offset in .debug_types. |
| 2607 |
@param dw_offbuf |
| 2608 |
A pointer to an array of children |
| 2609 |
DIE global [section] offsets is returned |
| 2610 |
through the pointer. |
| 2611 |
@param dw_offcount |
| 2612 |
The number of elements in dw_offbuf. |
| 2613 |
If the DIE has no children it could |
| 2614 |
be zero, in which case dw_offbuf |
| 2615 |
and dw_offcount are not touched. |
| 2616 |
@param dw_error |
| 2617 |
The usual error detail return pointer. |
| 2618 |
@return |
| 2619 |
Returns DW_DLV_OK etc. |
| 2620 |
DW_DLV_NO_ENTRY means there are no children of the DIE, |
| 2621 |
hence no list of child offsets. |
| 2622 |
|
| 2623 |
On successful return, use |
| 2624 |
dwarf_dealloc(dbg, dw_offbuf, DW_DLA_UARRAY); |
| 2625 |
to dealloc the allocated space. |
| 2626 |
|
| 2627 |
@see exampleoffset_list |
| 2628 |
*/ |
| 2629 |
DW_API int dwarf_offset_list(Dwarf_Debug dw_dbg, |
| 2630 |
Dwarf_Off dw_offset, |
| 2631 |
Dwarf_Bool dw_is_info, |
| 2632 |
Dwarf_Off ** dw_offbuf, |
| 2633 |
Dwarf_Unsigned * dw_offcount, |
| 2634 |
Dwarf_Error * dw_error); |
| 2635 |
|
| 2636 |
/*! @brief Get the address size applying to a DIE |
| 2637 |
|
| 2638 |
@param dw_die |
| 2639 |
The DIE of interest. |
| 2640 |
@param dw_addr_size |
| 2641 |
On success, returns the address size that applies |
| 2642 |
to dw_die. Normally 4 or 8. |
| 2643 |
@param dw_error |
| 2644 |
The usual error detail return pointer. |
| 2645 |
@return |
| 2646 |
Returns DW_DLV_OK etc. |
| 2647 |
*/ |
| 2648 |
DW_API int dwarf_get_die_address_size(Dwarf_Die dw_die, |
| 2649 |
Dwarf_Half * dw_addr_size, |
| 2650 |
Dwarf_Error * dw_error); |
| 2651 |
|
| 2652 |
/* Get both offsets (local and global) */ |
| 2653 |
/*! @brief Return section and CU-local offsets of a DIE |
| 2654 |
|
| 2655 |
This does not identify whether the section is |
| 2656 |
.debug_info or .debug_types, use |
| 2657 |
dwarf_get_die_infotypes_flag() to determine the section. |
| 2658 |
|
| 2659 |
@param dw_die |
| 2660 |
The DIE of interest. |
| 2661 |
@param dw_global_offset |
| 2662 |
On success returns the offset of the DIE in |
| 2663 |
its section. |
| 2664 |
@param dw_local_offset |
| 2665 |
On success returns the offset of the DIE within |
| 2666 |
its CU. |
| 2667 |
@param dw_error |
| 2668 |
The usual error detail return pointer. |
| 2669 |
@return |
| 2670 |
Returns DW_DLV_OK etc. |
| 2671 |
*/ |
| 2672 |
DW_API int dwarf_die_offsets(Dwarf_Die dw_die, |
| 2673 |
Dwarf_Off* dw_global_offset, |
| 2674 |
Dwarf_Off* dw_local_offset, |
| 2675 |
Dwarf_Error* dw_error); |
| 2676 |
|
| 2677 |
/*! @brief Get the version and offset size |
| 2678 |
|
| 2679 |
The values returned apply to the CU this DIE |
| 2680 |
belongs to. |
| 2681 |
This is useful as preparation for calling |
| 2682 |
dwarf_get_form_class |
| 2683 |
|
| 2684 |
@param dw_die |
| 2685 |
The DIE of interest. |
| 2686 |
@param dw_version |
| 2687 |
Returns the version of the CU this DIE is contained in. |
| 2688 |
Standard version numbers are 2 through 5. |
| 2689 |
@param dw_offset_size |
| 2690 |
Returns the offset_size (4 or 8) of the CU |
| 2691 |
this DIE is contained in. |
| 2692 |
*/ |
| 2693 |
DW_API int dwarf_get_version_of_die(Dwarf_Die dw_die, |
| 2694 |
Dwarf_Half * dw_version, |
| 2695 |
Dwarf_Half * dw_offset_size); |
| 2696 |
|
| 2697 |
/*! @brief Return the DW_AT_low_pc value |
| 2698 |
|
| 2699 |
@param dw_die |
| 2700 |
The DIE of interest. |
| 2701 |
@param dw_returned_addr |
| 2702 |
On success returns, through the pointer, |
| 2703 |
the address DW_AT_low_pc defines. |
| 2704 |
@param dw_error |
| 2705 |
The usual error detail return pointer. |
| 2706 |
@return |
| 2707 |
Returns DW_DLV_OK etc. |
| 2708 |
|
| 2709 |
*/ |
| 2710 |
DW_API int dwarf_lowpc(Dwarf_Die dw_die, |
| 2711 |
Dwarf_Addr * dw_returned_addr, |
| 2712 |
Dwarf_Error* dw_error); |
| 2713 |
|
| 2714 |
/*! @brief Return the DW_AT_hipc address value |
| 2715 |
|
| 2716 |
This is accessing the DW_AT_high_pc attribute. |
| 2717 |
Calculating the high pc involves elements |
| 2718 |
which we don't describe here, but which |
| 2719 |
are shown in the example. See the DWARF5 standard. |
| 2720 |
|
| 2721 |
@see examplehighpc |
| 2722 |
|
| 2723 |
@param dw_die |
| 2724 |
The DIE of interest. |
| 2725 |
@param dw_return_addr |
| 2726 |
On success returns the high-pc address for this DIE. |
| 2727 |
If the high-pc is a not DW_FORM_addr |
| 2728 |
and is a non-indexed constant form |
| 2729 |
one must add the value of the DW_AT_low_pc to this |
| 2730 |
to get the true high-pc value as the value returned |
| 2731 |
is an unsigned offset of the associated low-pc value. |
| 2732 |
@param dw_return_form |
| 2733 |
On success returns the actual FORM for this attribute. |
| 2734 |
Needed for certain cases to calculate the true |
| 2735 |
dw_return_addr; |
| 2736 |
@param dw_return_class |
| 2737 |
On success returns the FORM CLASS for this attribute. |
| 2738 |
Needed for certain cases to calculate the true |
| 2739 |
dw_return_addr; |
| 2740 |
@param dw_error |
| 2741 |
The usual error detail return pointer. |
| 2742 |
@return |
| 2743 |
Returns DW_DLV_OK etc. |
| 2744 |
*/ |
| 2745 |
DW_API int dwarf_highpc_b(Dwarf_Die dw_die, |
| 2746 |
Dwarf_Addr * dw_return_addr, |
| 2747 |
Dwarf_Half * dw_return_form, |
| 2748 |
enum Dwarf_Form_Class * dw_return_class, |
| 2749 |
Dwarf_Error * dw_error); |
| 2750 |
|
| 2751 |
/*! @brief Return the offset from the DW_AT_type attribute |
| 2752 |
|
| 2753 |
The offset returned is is a global offset from |
| 2754 |
the DW_AT_type of the DIE passed in. |
| 2755 |
If this CU is DWARF4 the offset could be in |
| 2756 |
.debug_types, otherwise it is in .debug_info |
| 2757 |
Check the section of the DIE to know which |
| 2758 |
it is, dwarf_cu_header_basics() will return that. |
| 2759 |
|
| 2760 |
Added pointer argument to return the section |
| 2761 |
the offset applies to. December 2022. |
| 2762 |
|
| 2763 |
@param dw_die |
| 2764 |
The DIE of interest. |
| 2765 |
@param dw_return_offset |
| 2766 |
If successful, returns the offset through the pointer. |
| 2767 |
@param dw_is_info |
| 2768 |
If successful, set to TRUE if the dw_return_offset |
| 2769 |
is in .debug_info and FALSE if the dw_return_offset |
| 2770 |
is in .debug_types. |
| 2771 |
@param dw_error |
| 2772 |
The usual error detail return pointer. |
| 2773 |
@return |
| 2774 |
Returns DW_DLV_OK etc. |
| 2775 |
*/ |
| 2776 |
DW_API int dwarf_dietype_offset(Dwarf_Die dw_die, |
| 2777 |
Dwarf_Off * dw_return_offset, |
| 2778 |
Dwarf_Bool * dw_is_info, |
| 2779 |
Dwarf_Error * dw_error); |
| 2780 |
|
| 2781 |
/*! @brief Return the value of the attribute DW_AT_byte_size |
| 2782 |
|
| 2783 |
@param dw_die |
| 2784 |
The DIE of interest. |
| 2785 |
@param dw_returned_size |
| 2786 |
If successful, returns the size through the pointer. |
| 2787 |
@param dw_error |
| 2788 |
The usual error detail return pointer. |
| 2789 |
@return |
| 2790 |
Returns DW_DLV_OK etc. |
| 2791 |
*/ |
| 2792 |
DW_API int dwarf_bytesize(Dwarf_Die dw_die, |
| 2793 |
Dwarf_Unsigned * dw_returned_size, |
| 2794 |
Dwarf_Error* dw_error); |
| 2795 |
|
| 2796 |
/*! @brief Return the value of the attribute DW_AT_bitsize |
| 2797 |
|
| 2798 |
@param dw_die |
| 2799 |
The DIE of interest. |
| 2800 |
@param dw_returned_size |
| 2801 |
If successful, returns the size through the pointer. |
| 2802 |
@param dw_error |
| 2803 |
The usual error detail return pointer. |
| 2804 |
@return |
| 2805 |
Returns DW_DLV_OK etc. |
| 2806 |
*/ |
| 2807 |
DW_API int dwarf_bitsize(Dwarf_Die dw_die, |
| 2808 |
Dwarf_Unsigned * dw_returned_size, |
| 2809 |
Dwarf_Error* dw_error); |
| 2810 |
|
| 2811 |
/*! @brief Return the bit offset attribute of a DIE |
| 2812 |
|
| 2813 |
If the attribute is DW_AT_data_bit_offset |
| 2814 |
(DWARF4, DWARF5) the returned bit offset |
| 2815 |
has one meaning. |
| 2816 |
If the attribute is DW_AT_bit_offset |
| 2817 |
(DWARF2, DWARF3) the meaning is quite different. |
| 2818 |
|
| 2819 |
@param dw_die |
| 2820 |
The DIE of interest. |
| 2821 |
@param dw_attrnum |
| 2822 |
If successful, returns the number of the attribute |
| 2823 |
(DW_AT_data_bit_offset or DW_AT_bit_offset) |
| 2824 |
@param dw_returned_offset |
| 2825 |
If successful, returns the bit offset value. |
| 2826 |
@param dw_error |
| 2827 |
The usual error detail return pointer. |
| 2828 |
@return |
| 2829 |
Returns DW_DLV_OK etc. |
| 2830 |
*/ |
| 2831 |
DW_API int dwarf_bitoffset(Dwarf_Die dw_die, |
| 2832 |
Dwarf_Half * dw_attrnum, |
| 2833 |
Dwarf_Unsigned * dw_returned_offset, |
| 2834 |
Dwarf_Error* dw_error); |
| 2835 |
|
| 2836 |
/*! @brief Return the value of the DW_AT_language attribute. |
| 2837 |
|
| 2838 |
The DIE should be a CU DIE. |
| 2839 |
@param dw_die |
| 2840 |
The DIE of interest. |
| 2841 |
@param dw_returned_lang |
| 2842 |
On success returns the language code (normally |
| 2843 |
only found on a CU DIE). For example DW_LANG_C |
| 2844 |
@param dw_error |
| 2845 |
The usual error detail return pointer. |
| 2846 |
@return |
| 2847 |
Returns DW_DLV_OK etc. |
| 2848 |
*/ |
| 2849 |
DW_API int dwarf_srclang(Dwarf_Die dw_die, |
| 2850 |
Dwarf_Unsigned * dw_returned_lang, |
| 2851 |
Dwarf_Error * dw_error); |
| 2852 |
|
| 2853 |
/*! @brief Return the value of the DW_AT_ordering attribute. |
| 2854 |
|
| 2855 |
@param dw_die |
| 2856 |
The DIE of interest. |
| 2857 |
@param dw_returned_order |
| 2858 |
On success returns the ordering value. |
| 2859 |
For example DW_ORD_row_major |
| 2860 |
@param dw_error |
| 2861 |
The usual error detail return pointer. |
| 2862 |
@return |
| 2863 |
Returns DW_DLV_OK etc. |
| 2864 |
*/ |
| 2865 |
DW_API int dwarf_arrayorder(Dwarf_Die dw_die, |
| 2866 |
Dwarf_Unsigned * dw_returned_order, |
| 2867 |
Dwarf_Error* dw_error); |
| 2868 |
/*! @} */ |
| 2869 |
|
| 2870 |
/*! @defgroup attrform DIE Attribute and Attribute-Form Details |
| 2871 |
@{ |
| 2872 |
Access to the details of DIEs |
| 2873 |
*/ |
| 2874 |
/*! @brief Gets the full list of attributes |
| 2875 |
|
| 2876 |
@param dw_die |
| 2877 |
The DIE from which to pull attributes. |
| 2878 |
@param dw_attrbuf |
| 2879 |
The pointer is set to point to an array |
| 2880 |
of Dwarf_Attribute (pointers to attribute data). |
| 2881 |
This array must eventually be deallocated. |
| 2882 |
@param dw_attrcount |
| 2883 |
The number of entries in the array of pointers. |
| 2884 |
There is no null-pointer to terminate the list, |
| 2885 |
use this count. |
| 2886 |
@param dw_error |
| 2887 |
A place to return error details. |
| 2888 |
@return |
| 2889 |
If it returns DW_DLV_ERROR and dw_error is non-null |
| 2890 |
it creates an Dwarf_Error and places it in this argument. |
| 2891 |
Usually returns DW_DLV_OK. |
| 2892 |
|
| 2893 |
@see example1 |
| 2894 |
|
| 2895 |
@see example8 |
| 2896 |
*/ |
| 2897 |
DW_API int dwarf_attrlist(Dwarf_Die dw_die, |
| 2898 |
Dwarf_Attribute** dw_attrbuf, |
| 2899 |
Dwarf_Signed * dw_attrcount, |
| 2900 |
Dwarf_Error* dw_error); |
| 2901 |
|
| 2902 |
/*! @brief Sets TRUE if a Dwarf_Attribute has the indicated FORM |
| 2903 |
@param dw_attr |
| 2904 |
The Dwarf_Attribute of interest. |
| 2905 |
@param dw_form |
| 2906 |
The DW_FORM you are asking about, DW_FORM_strp for example. |
| 2907 |
@param dw_returned_bool |
| 2908 |
The pointer passed in must be a valid non-null pointer |
| 2909 |
to a Dwarf_Bool. |
| 2910 |
On success, sets the value to TRUE or FALSE. |
| 2911 |
@param dw_error |
| 2912 |
A place to return error details. |
| 2913 |
@return |
| 2914 |
Returns DW_DLV_OK and sets dw_returned_bool. |
| 2915 |
If attribute is passed in NULL or |
| 2916 |
the attribute is badly broken |
| 2917 |
the call returns DW_DLV_ERROR. |
| 2918 |
Never returns DW_DLV_NO_ENTRY; |
| 2919 |
*/ |
| 2920 |
DW_API int dwarf_hasform(Dwarf_Attribute dw_attr, |
| 2921 |
Dwarf_Half dw_form, |
| 2922 |
Dwarf_Bool * dw_returned_bool, |
| 2923 |
Dwarf_Error* dw_error); |
| 2924 |
|
| 2925 |
/*! @brief Return the form of the Dwarf_Attribute |
| 2926 |
|
| 2927 |
@param dw_attr |
| 2928 |
The Dwarf_Attribute of interest. |
| 2929 |
@param dw_returned_final_form |
| 2930 |
The form of the item is returned |
| 2931 |
through the pointer. If the base form is DW_FORM_indirect |
| 2932 |
the function resolves the final form and |
| 2933 |
returns that final form. |
| 2934 |
@param dw_error |
| 2935 |
A place to return error details. |
| 2936 |
@return |
| 2937 |
Returns DW_DLV_OK and sets dw_returned_final_form |
| 2938 |
If attribute is passed in NULL or |
| 2939 |
the attribute is badly broken |
| 2940 |
the call returns DW_DLV_ERROR. |
| 2941 |
Never returns DW_DLV_NO_ENTRY; |
| 2942 |
*/ |
| 2943 |
DW_API int dwarf_whatform(Dwarf_Attribute dw_attr, |
| 2944 |
Dwarf_Half * dw_returned_final_form, |
| 2945 |
Dwarf_Error* dw_error); |
| 2946 |
|
| 2947 |
/*! @brief Return the initial form of the Dwarf_Attribute |
| 2948 |
@param dw_attr |
| 2949 |
The Dwarf_Attribute of interest. |
| 2950 |
@param dw_returned_initial_form |
| 2951 |
The form of the item is returned |
| 2952 |
through the pointer. If the base form is DW_FORM_indirect |
| 2953 |
the value set is DW_FORM_indirect. |
| 2954 |
@param dw_error |
| 2955 |
A place to return error details. |
| 2956 |
@return |
| 2957 |
Returns DW_DLV_OK and sets dw_returned_initial_form. |
| 2958 |
If attribute is passed in NULL or |
| 2959 |
the attribute is badly broken |
| 2960 |
the call returns DW_DLV_ERROR. |
| 2961 |
Never returns DW_DLV_NO_ENTRY; |
| 2962 |
*/ |
| 2963 |
DW_API int dwarf_whatform_direct(Dwarf_Attribute dw_attr, |
| 2964 |
Dwarf_Half * dw_returned_initial_form, |
| 2965 |
Dwarf_Error* dw_error); |
| 2966 |
|
| 2967 |
/*! @brief Return the attribute number of the Dwarf_Attribute |
| 2968 |
@param dw_attr |
| 2969 |
The Dwarf_Attribute of interest. |
| 2970 |
@param dw_returned_attrnum |
| 2971 |
The attribute number of the attribute is returned |
| 2972 |
through the pointer. For example, DW_AT_name |
| 2973 |
@param dw_error |
| 2974 |
A place to return error details. |
| 2975 |
@return |
| 2976 |
Returns DW_DLV_OK and sets dw_returned_attrnum |
| 2977 |
If attribute is passed in NULL or |
| 2978 |
the attribute is badly broken |
| 2979 |
the call returns DW_DLV_ERROR. |
| 2980 |
Never returns DW_DLV_NO_ENTRY; |
| 2981 |
*/ |
| 2982 |
DW_API int dwarf_whatattr(Dwarf_Attribute dw_attr, |
| 2983 |
Dwarf_Half * dw_returned_attrnum, |
| 2984 |
Dwarf_Error* dw_error); |
| 2985 |
|
| 2986 |
/*! @brief Retrieve the CU-relative offset of a reference |
| 2987 |
|
| 2988 |
The DW_FORM of the attribute must be one of a small set |
| 2989 |
of local reference forms: DW_FORM_ref<n> or |
| 2990 |
DW_FORM_udata. |
| 2991 |
|
| 2992 |
@param dw_attr |
| 2993 |
The Dwarf_Attribute of interest. |
| 2994 |
@param dw_return_offset |
| 2995 |
Returns the CU-relative offset through the pointer. |
| 2996 |
@param dw_is_info |
| 2997 |
Returns a flag through the pointer. TRUE if the |
| 2998 |
offset is in .debug_info, FALSE if it is in .debug_types |
| 2999 |
@param dw_error |
| 3000 |
A place to return error details. |
| 3001 |
@return |
| 3002 |
Returns DW_DLV_OK and sets dw_returned_attrnum |
| 3003 |
If attribute is passed in NULL or |
| 3004 |
the attribute is badly broken or |
| 3005 |
the FORM of this attribute is not one of the small |
| 3006 |
set of local references |
| 3007 |
the call returns DW_DLV_ERROR. |
| 3008 |
Never returns DW_DLV_NO_ENTRY; |
| 3009 |
*/ |
| 3010 |
DW_API int dwarf_formref(Dwarf_Attribute dw_attr, |
| 3011 |
Dwarf_Off* dw_return_offset, |
| 3012 |
Dwarf_Bool *dw_is_info, |
| 3013 |
Dwarf_Error *dw_error); |
| 3014 |
|
| 3015 |
/*! @brief Return the section-relative offset of a Dwarf_Attribute |
| 3016 |
|
| 3017 |
The target section of the returned offset can be in |
| 3018 |
various sections depending on the FORM. |
| 3019 |
Only a DW_FORM_ref_sig8 can change the returned offset of |
| 3020 |
a .debug_info DIE via a lookup into .debug_types |
| 3021 |
by changing dw_offset_is_info to FALSE (DWARF4). |
| 3022 |
|
| 3023 |
The caller must determine the target section from |
| 3024 |
the FORM. |
| 3025 |
|
| 3026 |
@param dw_attr |
| 3027 |
The Dwarf_Attribute of interest. |
| 3028 |
@param dw_return_offset |
| 3029 |
Returns the CU-relative offset through the pointer. |
| 3030 |
@param dw_offset_is_info |
| 3031 |
For references to DIEs this informs whether the target |
| 3032 |
DIE (the target the offset refers to) is in .debug_info |
| 3033 |
or .debug_types. For non-DIE targets this field |
| 3034 |
is not meaningful. Refer to the attribute FORM to determine |
| 3035 |
the target section of the offset. |
| 3036 |
@param dw_error |
| 3037 |
A place to return error details. |
| 3038 |
@return |
| 3039 |
Returns DW_DLV_OK and sets dw_return_offset |
| 3040 |
and dw_offset_is_info. |
| 3041 |
If attribute is passed in NULL or |
| 3042 |
the attribute is badly broken or |
| 3043 |
the FORM of this attribute is not one of the |
| 3044 |
many reference types the call returns DW_DLV_ERROR. |
| 3045 |
Never returns DW_DLV_NO_ENTRY; |
| 3046 |
*/ |
| 3047 |
DW_API int dwarf_global_formref_b(Dwarf_Attribute dw_attr, |
| 3048 |
Dwarf_Off *dw_return_offset, |
| 3049 |
Dwarf_Bool *dw_offset_is_info, |
| 3050 |
Dwarf_Error *dw_error); |
| 3051 |
|
| 3052 |
/*! @brief Same as dwarf_global_formref_b except... |
| 3053 |
|
| 3054 |
@see dwarf_global_formref_b |
| 3055 |
|
| 3056 |
This is the same, except there is no |
| 3057 |
dw_offset_is_info pointer so in the case of |
| 3058 |
DWARF4 and DW_FORM_ref_sig8 it is not |
| 3059 |
possible to determine which section the offset |
| 3060 |
applies to! |
| 3061 |
*/ |
| 3062 |
DW_API int dwarf_global_formref(Dwarf_Attribute dw_attr, |
| 3063 |
Dwarf_Off* dw_return_offset, |
| 3064 |
Dwarf_Error* dw_error); |
| 3065 |
|
| 3066 |
/*! @brief Return an 8 byte reference form for DW_FORM_ref_sig8 |
| 3067 |
|
| 3068 |
@param dw_attr |
| 3069 |
The Dwarf_Attribute of interest. |
| 3070 |
@param dw_returned_sig_bytes |
| 3071 |
On success returns DW_DLV_OK and copies the 8 bytes |
| 3072 |
into dw_returned_sig_bytes. |
| 3073 |
@param dw_error |
| 3074 |
A place to return error details. |
| 3075 |
@return |
| 3076 |
On success returns DW_DLV_OK and copies the 8 bytes |
| 3077 |
into dw_returned_sig_bytes. |
| 3078 |
If attribute is passed in NULL or |
| 3079 |
the attribute is badly broken |
| 3080 |
the call returns DW_DLV_ERROR. |
| 3081 |
If the dw_attr has a form other than DW_FORM_ref_sig8 |
| 3082 |
the function returns DW_DLV_NO_ENTRY |
| 3083 |
*/ |
| 3084 |
DW_API int dwarf_formsig8(Dwarf_Attribute dw_attr, |
| 3085 |
Dwarf_Sig8 * dw_returned_sig_bytes, |
| 3086 |
Dwarf_Error* dw_error); |
| 3087 |
|
| 3088 |
/*! @brief Return an 8 byte reference form for DW_FORM_data8 |
| 3089 |
|
| 3090 |
@param dw_attr |
| 3091 |
The Dwarf_Attribute of interest. |
| 3092 |
@param dw_returned_sig_bytes |
| 3093 |
On success Returns DW_DLV_OK and copies the 8 bytes |
| 3094 |
into dw_returned_sig_bytes. |
| 3095 |
@param dw_error |
| 3096 |
A place to return error details. |
| 3097 |
@return |
| 3098 |
On success returns DW_DLV_OK and copies the 8 bytes |
| 3099 |
into dw_returned_sig_bytes. |
| 3100 |
If attribute is passed in NULL or |
| 3101 |
the attribute is badly broken |
| 3102 |
the call returns DW_DLV_ERROR. |
| 3103 |
If the dw_attr has a form other than DW_FORM_data8 |
| 3104 |
the function returns DW_DLV_NO_ENTRY |
| 3105 |
*/ |
| 3106 |
DW_API int dwarf_formsig8_const(Dwarf_Attribute dw_attr, |
| 3107 |
Dwarf_Sig8 * dw_returned_sig_bytes, |
| 3108 |
Dwarf_Error* dw_error); |
| 3109 |
|
| 3110 |
/*! @brief Return the address when the attribute has form address. |
| 3111 |
|
| 3112 |
There are several address forms, some of them indexed. |
| 3113 |
|
| 3114 |
@param dw_attr |
| 3115 |
The Dwarf_Attribute of interest. |
| 3116 |
@param dw_returned_addr |
| 3117 |
On success this set through the pointer to |
| 3118 |
the address in the attribute. |
| 3119 |
@param dw_error |
| 3120 |
A place to return error details. |
| 3121 |
@return |
| 3122 |
On success returns DW_DLV_OK sets dw_returned_addr . |
| 3123 |
If attribute is passed in NULL or |
| 3124 |
the attribute is badly broken |
| 3125 |
or the address cannot be retrieved |
| 3126 |
the call returns DW_DLV_ERROR. |
| 3127 |
Never returns DW_DLV_NO_ENTRY. |
| 3128 |
*/ |
| 3129 |
DW_API int dwarf_formaddr(Dwarf_Attribute dw_attr, |
| 3130 |
Dwarf_Addr * dw_returned_addr, |
| 3131 |
Dwarf_Error* dw_error); |
| 3132 |
|
| 3133 |
/*! @brief Get the addr index of a Dwarf_Attribute |
| 3134 |
|
| 3135 |
So a consumer can get the index when |
| 3136 |
the object with the actual .debug_addr section is |
| 3137 |
elsewhere (Debug Fission). Or if the caller just wants the index. |
| 3138 |
Only call it when you know it should does have an index |
| 3139 |
address FORM such as DW_FORM_addrx1 or one of the GNU |
| 3140 |
address index forms. |
| 3141 |
|
| 3142 |
@param dw_attr |
| 3143 |
The Dwarf_Attribute of interest. |
| 3144 |
@param dw_return_index |
| 3145 |
If successful it returns the index |
| 3146 |
through the pointer. |
| 3147 |
@param dw_error |
| 3148 |
The usual error pointer. |
| 3149 |
@return |
| 3150 |
DW_DLV_OK if it succeeds. Never returns DW_DLV_NO_ENTRY. |
| 3151 |
*/ |
| 3152 |
DW_API int dwarf_get_debug_addr_index(Dwarf_Attribute dw_attr, |
| 3153 |
Dwarf_Unsigned * dw_return_index, |
| 3154 |
Dwarf_Error * dw_error); |
| 3155 |
|
| 3156 |
/*! @brief Return the flag value of a flag form. |
| 3157 |
|
| 3158 |
It is an error if the FORM is not a flag form. |
| 3159 |
|
| 3160 |
@param dw_attr |
| 3161 |
The Dwarf_Attribute of interest. |
| 3162 |
@param dw_returned_bool |
| 3163 |
Returns either TRUE or FALSE through the pointer. |
| 3164 |
@param dw_error |
| 3165 |
The usual error pointer. |
| 3166 |
@return |
| 3167 |
DW_DLV_OK if it succeeds. Never returns DW_DLV_NO_ENTRY. |
| 3168 |
*/ |
| 3169 |
DW_API int dwarf_formflag(Dwarf_Attribute dw_attr, |
| 3170 |
Dwarf_Bool * dw_returned_bool, |
| 3171 |
Dwarf_Error* dw_error); |
| 3172 |
|
| 3173 |
/*! @brief Return an unsigned value |
| 3174 |
|
| 3175 |
The form can be an unsigned or signed integral type |
| 3176 |
but if it is a signed type the value must be non-negative. |
| 3177 |
It is an error otherwise. |
| 3178 |
|
| 3179 |
@param dw_attr |
| 3180 |
The Dwarf_Attribute of interest. |
| 3181 |
@param dw_returned_val |
| 3182 |
On success returns the unsigned value through the pointer. |
| 3183 |
@param dw_error |
| 3184 |
The usual error pointer. |
| 3185 |
@return |
| 3186 |
DW_DLV_OK if it succeeds. Never returns DW_DLV_NO_ENTRY. |
| 3187 |
*/ |
| 3188 |
DW_API int dwarf_formudata(Dwarf_Attribute dw_attr, |
| 3189 |
Dwarf_Unsigned * dw_returned_val, |
| 3190 |
Dwarf_Error* dw_error); |
| 3191 |
|
| 3192 |
/*! @brief Return a signed value |
| 3193 |
|
| 3194 |
The form must be a signed integral type. |
| 3195 |
It is an error otherwise. |
| 3196 |
|
| 3197 |
@param dw_attr |
| 3198 |
The Dwarf_Attribute of interest. |
| 3199 |
@param dw_returned_val |
| 3200 |
On success returns the signed value through the pointer. |
| 3201 |
@param dw_error |
| 3202 |
The usual error pointer. |
| 3203 |
@return |
| 3204 |
DW_DLV_OK if it succeeds. Never returns DW_DLV_NO_ENTRY. |
| 3205 |
*/ |
| 3206 |
DW_API int dwarf_formsdata(Dwarf_Attribute dw_attr, |
| 3207 |
Dwarf_Signed * dw_returned_val, |
| 3208 |
Dwarf_Error* dw_error); |
| 3209 |
|
| 3210 |
/*! @brief Return a 16 byte Dwarf_Form_Data16 value. |
| 3211 |
|
| 3212 |
We just store the bytes in a struct, we have no |
| 3213 |
16 byte integer type. |
| 3214 |
It is an error if the FORM is not DW_FORM_data16 |
| 3215 |
@see Dwarf_Form_Data16 |
| 3216 |
|
| 3217 |
@param dw_attr |
| 3218 |
The Dwarf_Attribute of interest. |
| 3219 |
@param dw_returned_val |
| 3220 |
Copies the 16 byte value into the pointed |
| 3221 |
to area. |
| 3222 |
@param dw_error |
| 3223 |
The usual error pointer. |
| 3224 |
@return |
| 3225 |
DW_DLV_OK if it succeeds. Never returns DW_DLV_NO_ENTRY. |
| 3226 |
*/ |
| 3227 |
DW_API int dwarf_formdata16(Dwarf_Attribute dw_attr, |
| 3228 |
Dwarf_Form_Data16 * dw_returned_val, |
| 3229 |
Dwarf_Error* dw_error); |
| 3230 |
|
| 3231 |
/*! @brief Return an allocated filled-in Form_Block |
| 3232 |
|
| 3233 |
It is an error if the DW_FORM in the attribute is not a |
| 3234 |
block form. DW_FORM_block2 is an example of a block form. |
| 3235 |
|
| 3236 |
@see Dwarf_Block |
| 3237 |
@see examplediscrlist |
| 3238 |
|
| 3239 |
@param dw_attr |
| 3240 |
The Dwarf_Attribute of interest. |
| 3241 |
@param dw_returned_block |
| 3242 |
Allocates a Dwarf_Block and returns |
| 3243 |
a pointer to the filled-in block. |
| 3244 |
@param dw_error |
| 3245 |
The usual error pointer. |
| 3246 |
@return |
| 3247 |
DW_DLV_OK if it succeeds. Never returns DW_DLV_NO_ENTRY. |
| 3248 |
*/ |
| 3249 |
DW_API int dwarf_formblock(Dwarf_Attribute dw_attr, |
| 3250 |
Dwarf_Block ** dw_returned_block, |
| 3251 |
Dwarf_Error* dw_error); |
| 3252 |
|
| 3253 |
/*! @brief Return a pointer to a string. |
| 3254 |
|
| 3255 |
@param dw_attr |
| 3256 |
The Dwarf_Attribute of interest. |
| 3257 |
@param dw_returned_string |
| 3258 |
Puts a pointer to a string in the DWARF information |
| 3259 |
if the FORM of the attribute is some sort of string FORM. |
| 3260 |
@param dw_error |
| 3261 |
The usual error pointer. |
| 3262 |
@return |
| 3263 |
DW_DLV_OK if it succeeds. |
| 3264 |
*/ |
| 3265 |
DW_API int dwarf_formstring(Dwarf_Attribute dw_attr, |
| 3266 |
char ** dw_returned_string, |
| 3267 |
Dwarf_Error* dw_error); |
| 3268 |
|
| 3269 |
/*! @brief Return a string index |
| 3270 |
@param dw_attr |
| 3271 |
The Dwarf_Attribute of interest. |
| 3272 |
@param dw_return_index |
| 3273 |
If the form is a string index form (for example |
| 3274 |
DW_FORM_strx) the string index value is |
| 3275 |
returned via the pointer. |
| 3276 |
@param dw_error |
| 3277 |
The usual error pointer. |
| 3278 |
@return |
| 3279 |
DW_DLV_OK if it succeeds. |
| 3280 |
If the attribute form is not one of the string index |
| 3281 |
forms it returns DW_DLV_ERROR and sets dw_error to point |
| 3282 |
to the error details. |
| 3283 |
*/ |
| 3284 |
DW_API int dwarf_get_debug_str_index(Dwarf_Attribute dw_attr, |
| 3285 |
Dwarf_Unsigned * dw_return_index, |
| 3286 |
Dwarf_Error * dw_error); |
| 3287 |
|
| 3288 |
/*! @brief Return a pointer-to and length-of a block of data. |
| 3289 |
|
| 3290 |
@param dw_attr |
| 3291 |
The Dwarf_Attribute of interest. |
| 3292 |
@param dw_return_exprlen |
| 3293 |
Returns the length in bytes of the block |
| 3294 |
if it succeeds. |
| 3295 |
@param dw_block_ptr |
| 3296 |
Returns a pointer to the first byte of the block |
| 3297 |
of data if it succeeds. |
| 3298 |
@param dw_error |
| 3299 |
The usual error pointer. |
| 3300 |
@return |
| 3301 |
DW_DLV_OK if it succeeds. |
| 3302 |
If the attribute form is not DW_FORM_exprloc |
| 3303 |
it returns DW_DLV_ERROR and sets dw_error to point |
| 3304 |
to the error details. |
| 3305 |
*/ |
| 3306 |
DW_API int dwarf_formexprloc(Dwarf_Attribute dw_attr, |
| 3307 |
Dwarf_Unsigned * dw_return_exprlen, |
| 3308 |
Dwarf_Ptr * dw_block_ptr, |
| 3309 |
Dwarf_Error * dw_error); |
| 3310 |
|
| 3311 |
/*! @brief Return the FORM_CLASS applicable. |
| 3312 |
Four pieces of information are necessary |
| 3313 |
to get the correct FORM_CLASS. |
| 3314 |
|
| 3315 |
@param dw_version |
| 3316 |
The CU's DWARF version. Standard numbers are 2,3,4, or 5. |
| 3317 |
@param dw_attrnum |
| 3318 |
For example DW_AT_name |
| 3319 |
@param dw_offset_size |
| 3320 |
The offset size applicable to the compilation unit |
| 3321 |
relevant to the attribute and form. |
| 3322 |
@param dw_form |
| 3323 |
The FORM number, for example DW_FORM_data4 |
| 3324 |
@return |
| 3325 |
Returns a form class, for example DW_FORM_CLASS_CONSTANT. |
| 3326 |
The FORM_CLASS names are mentioned (for example |
| 3327 |
as 'address' in Table 2.3 of DWARF5) but |
| 3328 |
are not assigned formal names & numbers in the standard. |
| 3329 |
*/ |
| 3330 |
DW_API enum Dwarf_Form_Class dwarf_get_form_class( |
| 3331 |
Dwarf_Half dw_version, |
| 3332 |
Dwarf_Half dw_attrnum, |
| 3333 |
Dwarf_Half dw_offset_size, |
| 3334 |
Dwarf_Half dw_form); |
| 3335 |
|
| 3336 |
/*! @brief Return the offset of an attribute in its section |
| 3337 |
|
| 3338 |
@param dw_die |
| 3339 |
The DIE of interest. |
| 3340 |
@param dw_attr |
| 3341 |
A Dwarf_Attribute of interest in this DIE |
| 3342 |
@param dw_return_offset |
| 3343 |
The offset is in .debug_info if the DIE is there. |
| 3344 |
The offset is in .debug_types if the DIE is there. |
| 3345 |
@param dw_error |
| 3346 |
The usual error pointer. |
| 3347 |
@return |
| 3348 |
DW_DLV_OK if it succeeds. |
| 3349 |
DW_DLV_NO_ENTRY is impossible. |
| 3350 |
*/ |
| 3351 |
DW_API int dwarf_attr_offset(Dwarf_Die dw_die, |
| 3352 |
Dwarf_Attribute dw_attr, |
| 3353 |
Dwarf_Off * dw_return_offset, |
| 3354 |
Dwarf_Error * dw_error); |
| 3355 |
|
| 3356 |
/*! @brief Uncompress a block of sleb numbers |
| 3357 |
It's not much of a compression so not much |
| 3358 |
of an uncompression. |
| 3359 |
Developed by Sun Microsystems and it is unclear if it |
| 3360 |
was ever used. |
| 3361 |
@see dwarf_dealloc_uncompressed_block |
| 3362 |
*/ |
| 3363 |
DW_API int dwarf_uncompress_integer_block_a(Dwarf_Debug dw_dbg, |
| 3364 |
Dwarf_Unsigned dw_input_length_in_bytes, |
| 3365 |
void * dw_input_block, |
| 3366 |
Dwarf_Unsigned * dw_value_count, |
| 3367 |
Dwarf_Signed ** dw_value_array, |
| 3368 |
Dwarf_Error * dw_error); |
| 3369 |
|
| 3370 |
/*! @brief Dealloc what dwarf_uncompress_integer_block_a allocated |
| 3371 |
@param dw_dbg |
| 3372 |
The Dwarf_Debug of interest |
| 3373 |
@param dw_value_array |
| 3374 |
The array was called an array of Dwarf_Signed. |
| 3375 |
We dealloc all of it without needing dw_value_count. |
| 3376 |
*/ |
| 3377 |
DW_API void dwarf_dealloc_uncompressed_block(Dwarf_Debug dw_dbg, |
| 3378 |
void *dw_value_array); |
| 3379 |
|
| 3380 |
/*! @brief Convert local offset to global offset |
| 3381 |
|
| 3382 |
Uses the DW_FORM of the attribute to determine |
| 3383 |
if the dw_offset is local, and if so, adds |
| 3384 |
the CU base offset to adjust dw_offset. |
| 3385 |
|
| 3386 |
@param dw_attr |
| 3387 |
The attribute the local offset was extracted from. |
| 3388 |
@param dw_offset |
| 3389 |
The global offset of the attribute. |
| 3390 |
@param dw_return_offset |
| 3391 |
The returned section (global) offset. |
| 3392 |
@param dw_error |
| 3393 |
The usual error pointer. |
| 3394 |
@return |
| 3395 |
DW_DLV_OK if it succeeds. |
| 3396 |
Returns DW_DLV_ERROR if the dw_attr form is not |
| 3397 |
an offset form (for example, DW_FORM_ref_udata). |
| 3398 |
*/ |
| 3399 |
DW_API int dwarf_convert_to_global_offset(Dwarf_Attribute dw_attr, |
| 3400 |
Dwarf_Off dw_offset, |
| 3401 |
Dwarf_Off* dw_return_offset, |
| 3402 |
Dwarf_Error* dw_error); |
| 3403 |
|
| 3404 |
/*! @brief Dealloc a Dwarf_Attribute |
| 3405 |
When this call returns the dw_attr is a stale pointer. |
| 3406 |
@param dw_attr |
| 3407 |
The attribute to dealloc. |
| 3408 |
*/ |
| 3409 |
DW_API void dwarf_dealloc_attribute(Dwarf_Attribute dw_attr); |
| 3410 |
|
| 3411 |
/*! @brief Return an array of discriminant values. |
| 3412 |
|
| 3413 |
This applies if a DW_TAG_variant has one of the |
| 3414 |
DW_FORM_block forms. |
| 3415 |
@see dwarf_formblock |
| 3416 |
|
| 3417 |
For an example of use and dealloc: |
| 3418 |
@see examplediscrlist |
| 3419 |
|
| 3420 |
@param dw_dbg |
| 3421 |
The applicable Dwarf_Debug |
| 3422 |
@param dw_blockpointer |
| 3423 |
The bl_data value from a Dwarf_Block. |
| 3424 |
@param dw_blocklen |
| 3425 |
The bl_len value from a Dwarf_Block. |
| 3426 |
@param dw_dsc_head_out |
| 3427 |
On success returns a pointer to an array |
| 3428 |
of discriminant values in an opaque struct. |
| 3429 |
@param dw_dsc_array_length_out |
| 3430 |
On success returns the number of entries |
| 3431 |
in the dw_dsc_head_out array. |
| 3432 |
@param dw_error |
| 3433 |
The usual error pointer. |
| 3434 |
@return |
| 3435 |
DW_DLV_OK if it succeeds. |
| 3436 |
*/ |
| 3437 |
DW_API int dwarf_discr_list(Dwarf_Debug dw_dbg, |
| 3438 |
Dwarf_Small * dw_blockpointer, |
| 3439 |
Dwarf_Unsigned dw_blocklen, |
| 3440 |
Dwarf_Dsc_Head * dw_dsc_head_out, |
| 3441 |
Dwarf_Unsigned * dw_dsc_array_length_out, |
| 3442 |
Dwarf_Error * dw_error); |
| 3443 |
|
| 3444 |
/*! @brief Access a single unsigned discriminant list entry |
| 3445 |
|
| 3446 |
It is up to the caller to know whether the discriminant |
| 3447 |
values are signed or unsigned (therefore to know |
| 3448 |
whether this or dwarf_discr_entry_s. |
| 3449 |
should be called) |
| 3450 |
|
| 3451 |
@param dw_dsc |
| 3452 |
The Dwarf_Dsc_Head applicable. |
| 3453 |
@param dw_entrynum |
| 3454 |
Valid values are zero to dw_dsc_array_length_out-1 |
| 3455 |
@param dw_out_type |
| 3456 |
On success is set to either DW_DSC_label or |
| 3457 |
DW_DSC_range through the pointer. |
| 3458 |
@param dw_out_discr_low |
| 3459 |
On success set to |
| 3460 |
the lowest in this discriminant range |
| 3461 |
@param dw_out_discr_high |
| 3462 |
On success set to |
| 3463 |
the highest in this discriminant range |
| 3464 |
@param dw_error |
| 3465 |
The usual error pointer. |
| 3466 |
@return |
| 3467 |
DW_DLV_OK if it succeeds. |
| 3468 |
*/ |
| 3469 |
DW_API int dwarf_discr_entry_u(Dwarf_Dsc_Head dw_dsc, |
| 3470 |
Dwarf_Unsigned dw_entrynum, |
| 3471 |
Dwarf_Half * dw_out_type, |
| 3472 |
Dwarf_Unsigned * dw_out_discr_low, |
| 3473 |
Dwarf_Unsigned * dw_out_discr_high, |
| 3474 |
Dwarf_Error * dw_error); |
| 3475 |
|
| 3476 |
/*! @brief Access to a single signed discriminant list entry |
| 3477 |
|
| 3478 |
The same as dwarf_discr_entry_u except here the values |
| 3479 |
are signed. |
| 3480 |
*/ |
| 3481 |
DW_API int dwarf_discr_entry_s(Dwarf_Dsc_Head dw_dsc, |
| 3482 |
Dwarf_Unsigned dw_entrynum, |
| 3483 |
Dwarf_Half * dw_out_type, |
| 3484 |
Dwarf_Signed * dw_out_discr_low, |
| 3485 |
Dwarf_Signed * dw_out_discr_high, |
| 3486 |
Dwarf_Error * dw_error); |
| 3487 |
|
| 3488 |
/*! @} */ |
| 3489 |
|
| 3490 |
/*! @defgroup linetable Line Table For a CU |
| 3491 |
@{ |
| 3492 |
Access to all the line table details. |
| 3493 |
*/ |
| 3494 |
|
| 3495 |
/*! @brief The list of source files from the line table header |
| 3496 |
|
| 3497 |
The array returned by this function applies to |
| 3498 |
a single compilation unit (CU). |
| 3499 |
|
| 3500 |
The returned array is indexed from 0 (zero) to |
| 3501 |
dw_filecount-1 when the function returns |
| 3502 |
DW_DLV_OK. |
| 3503 |
|
| 3504 |
In referencing the array via a file-number from |
| 3505 |
a <b>DW_AT_decl_file</b> or |
| 3506 |
<b>DW_AT_call_file</b> attribute one needs |
| 3507 |
to know if the CU is DWARF5 or not. |
| 3508 |
|
| 3509 |
Line Table Version numbers match compilation unit |
| 3510 |
version numbers except that an experimental line table |
| 3511 |
with line table version 0xfe06 has |
| 3512 |
sometimes been used with DWARF4. |
| 3513 |
|
| 3514 |
For DWARF5: |
| 3515 |
|
| 3516 |
The file-number from a <b>DW_AT_decl_file</b> or |
| 3517 |
<b>DW_AT_call_file</b> |
| 3518 |
is the proper index into the array of string pointers. |
| 3519 |
|
| 3520 |
For DWARF2,3,4, including experimental line table |
| 3521 |
version 0xfe06 and a file-number from a |
| 3522 |
<b>DW_AT_decl_file</b> or <b>DW_AT_call_file</b>: |
| 3523 |
|
| 3524 |
-# If the file-number is zero there is no file name to find. |
| 3525 |
-# Otherwise subtract one(1) from the file-number and |
| 3526 |
use the new value as the index into the array |
| 3527 |
of string pointers. |
| 3528 |
|
| 3529 |
The name strings returned are each assembled in the |
| 3530 |
following way by dwarf_srcfiles(): |
| 3531 |
|
| 3532 |
-# The file number denotes a name in the line table header. |
| 3533 |
-# If the name is not a full path (i.e. not starting |
| 3534 |
with / in posix/linux/MacOS) then prepend the appropriate |
| 3535 |
directory string from the line table header. |
| 3536 |
-# If the name is still not a full path then prepend |
| 3537 |
the content of the DW_AT_comp_dir attribute |
| 3538 |
of the CU DIE. |
| 3539 |
|
| 3540 |
To retrieve the line table version call |
| 3541 |
dwarf_srclines_b() and dwarf_srclines_version(). |
| 3542 |
|
| 3543 |
@see examplec |
| 3544 |
|
| 3545 |
@param dw_cu_die |
| 3546 |
The CU DIE in this CU. |
| 3547 |
@param dw_srcfiles |
| 3548 |
On success allocates an array of pointers to strings |
| 3549 |
and for each such, computes the fullest path possible |
| 3550 |
given the CU DIE data for each file name listed |
| 3551 |
in the line table header. |
| 3552 |
@param dw_filecount |
| 3553 |
On success returns the number of entries |
| 3554 |
in the array of pointers to strings. |
| 3555 |
The number returned is non-negative. |
| 3556 |
@param dw_error |
| 3557 |
The usual error pointer. |
| 3558 |
@return |
| 3559 |
DW_DLV_OK if it succeeds. |
| 3560 |
If there is no .debug_line[.dwo] returns DW_DLV_NO_ENTRY. |
| 3561 |
|
| 3562 |
@see examplee |
| 3563 |
|
| 3564 |
*/ |
| 3565 |
DW_API int dwarf_srcfiles(Dwarf_Die dw_cu_die, |
| 3566 |
char *** dw_srcfiles, |
| 3567 |
Dwarf_Signed * dw_filecount, |
| 3568 |
Dwarf_Error * dw_error); |
| 3569 |
|
| 3570 |
/*! @brief Initialize Dwarf_Line_Context for line table access |
| 3571 |
|
| 3572 |
Returns Dwarf_Line_Context pointer, needed for |
| 3573 |
access to line table data. Returns the line table |
| 3574 |
version number (needed to use dwarf_srcfiles() |
| 3575 |
properly). |
| 3576 |
|
| 3577 |
@see examplec |
| 3578 |
@see exampled |
| 3579 |
|
| 3580 |
@param dw_cudie |
| 3581 |
The Compilation Unit (CU) DIE of interest. |
| 3582 |
@param dw_version_out |
| 3583 |
The DWARF Line Table version number (Standard: 2,3,4, or 5) |
| 3584 |
Version 0xf006 is an experimental (two-level) line table. |
| 3585 |
@param dw_table_count |
| 3586 |
Zero or one means this is a normal DWARF line table. |
| 3587 |
Two means this is an experimental two-level line table. |
| 3588 |
@param dw_linecontext |
| 3589 |
On success sets the pointer to point to an opaque structure |
| 3590 |
usable for further queries. |
| 3591 |
@param dw_error |
| 3592 |
The usual error pointer. |
| 3593 |
@return |
| 3594 |
DW_DLV_OK if it succeeds. |
| 3595 |
*/ |
| 3596 |
DW_API int dwarf_srclines_b(Dwarf_Die dw_cudie, |
| 3597 |
Dwarf_Unsigned * dw_version_out, |
| 3598 |
Dwarf_Small * dw_table_count, |
| 3599 |
Dwarf_Line_Context * dw_linecontext, |
| 3600 |
Dwarf_Error * dw_error); |
| 3601 |
|
| 3602 |
/*! @brief Access source lines from line context |
| 3603 |
|
| 3604 |
Provides access to Dwarf_Line data from |
| 3605 |
a Dwarf_Line_Context on a standard line table. |
| 3606 |
|
| 3607 |
@param dw_linecontext |
| 3608 |
The line context of interest. |
| 3609 |
@param dw_linebuf |
| 3610 |
On success returns |
| 3611 |
an array of pointers to Dwarf_Line. |
| 3612 |
@param dw_linecount |
| 3613 |
On success returns the count of entries |
| 3614 |
in dw_linebuf. |
| 3615 |
If dw_linecount is returned as zero this is |
| 3616 |
a line table with no lines. |
| 3617 |
@param dw_error |
| 3618 |
The usual error pointer. |
| 3619 |
@return |
| 3620 |
DW_DLV_OK if it succeeds. |
| 3621 |
*/ |
| 3622 |
DW_API int dwarf_srclines_from_linecontext( |
| 3623 |
Dwarf_Line_Context dw_linecontext, |
| 3624 |
Dwarf_Line ** dw_linebuf, |
| 3625 |
Dwarf_Signed * dw_linecount, |
| 3626 |
Dwarf_Error * dw_error); |
| 3627 |
|
| 3628 |
/*! @brief Returns line table counts and data |
| 3629 |
|
| 3630 |
Works for DWARF2,3,4,5 and for experimental |
| 3631 |
two-level line tables. A single level table will |
| 3632 |
have *linebuf_actuals and *linecount_actuals set |
| 3633 |
to 0. |
| 3634 |
|
| 3635 |
Two-level line tables are non-standard and not |
| 3636 |
documented further. |
| 3637 |
For standard (one-level) tables, it |
| 3638 |
will return the single table through dw_linebuf, and the |
| 3639 |
value returned through dw_linecount_actuals will be 0. |
| 3640 |
|
| 3641 |
People not using these two-level tables |
| 3642 |
should dwarf_srclines_from_linecontext instead. |
| 3643 |
*/ |
| 3644 |
DW_API int dwarf_srclines_two_level_from_linecontext( |
| 3645 |
Dwarf_Line_Context dw_context, |
| 3646 |
Dwarf_Line ** dw_linebuf , |
| 3647 |
Dwarf_Signed * dw_linecount, |
| 3648 |
Dwarf_Line ** dw_linebuf_actuals, |
| 3649 |
Dwarf_Signed * dw_linecount_actuals, |
| 3650 |
Dwarf_Error * dw_error); |
| 3651 |
|
| 3652 |
/*! @brief Dealloc the memory allocated by dwarf_srclines_b |
| 3653 |
|
| 3654 |
The way to deallocate (free) a Dwarf_Line_Context |
| 3655 |
|
| 3656 |
@param dw_context |
| 3657 |
The context to be dealloced (freed). |
| 3658 |
On return the pointer passed in is stale and |
| 3659 |
calling applications should zero the pointer. |
| 3660 |
*/ |
| 3661 |
DW_API void dwarf_srclines_dealloc_b(Dwarf_Line_Context dw_context); |
| 3662 |
|
| 3663 |
/*! @brief Return the srclines table offset |
| 3664 |
|
| 3665 |
The offset is in the relevant .debug_line or .debug_line.dwo |
| 3666 |
section (and in a split dwarf package file includes |
| 3667 |
the base line table offset). |
| 3668 |
|
| 3669 |
@param dw_context |
| 3670 |
@param dw_offset |
| 3671 |
On success returns the section offset of the |
| 3672 |
dw_context. |
| 3673 |
@param dw_error |
| 3674 |
The usual error pointer. |
| 3675 |
@return |
| 3676 |
DW_DLV_OK if it succeeds. |
| 3677 |
*/ |
| 3678 |
DW_API int dwarf_srclines_table_offset(Dwarf_Line_Context dw_context, |
| 3679 |
Dwarf_Unsigned * dw_offset, |
| 3680 |
Dwarf_Error * dw_error); |
| 3681 |
|
| 3682 |
/*! @brief Compilation Directory name for the CU |
| 3683 |
|
| 3684 |
Do not free() or dealloc the string, |
| 3685 |
it is in a dwarf section. |
| 3686 |
|
| 3687 |
@param dw_context |
| 3688 |
The Line Context of interest. |
| 3689 |
@param dw_compilation_directory |
| 3690 |
On success returns a pointer to a string |
| 3691 |
identifying the compilation directory of the CU. |
| 3692 |
@param dw_error |
| 3693 |
The usual error pointer. |
| 3694 |
@return |
| 3695 |
DW_DLV_OK if it succeeds. |
| 3696 |
*/ |
| 3697 |
DW_API int dwarf_srclines_comp_dir(Dwarf_Line_Context dw_context, |
| 3698 |
const char ** dw_compilation_directory, |
| 3699 |
Dwarf_Error * dw_error); |
| 3700 |
|
| 3701 |
/*! @brief Subprog count: Part of the two-level line table extension. |
| 3702 |
|
| 3703 |
A non-standard table. |
| 3704 |
The actual meaning of subprog count left undefined here. |
| 3705 |
|
| 3706 |
@param dw_context |
| 3707 |
The Dwarf_Line_Context of interest. |
| 3708 |
@param dw_count |
| 3709 |
On success returns the two-level line table subprogram |
| 3710 |
array size in this line context. |
| 3711 |
@param dw_error |
| 3712 |
The usual error pointer. |
| 3713 |
@return |
| 3714 |
DW_DLV_OK if it succeeds. |
| 3715 |
*/ |
| 3716 |
DW_API int dwarf_srclines_subprog_count(Dwarf_Line_Context dw_context, |
| 3717 |
Dwarf_Signed * dw_count, |
| 3718 |
Dwarf_Error * dw_error); |
| 3719 |
|
| 3720 |
/*! @brief Retrieve data from the line table subprog array |
| 3721 |
|
| 3722 |
A non-standard table. Not defined here. |
| 3723 |
@param dw_context |
| 3724 |
The Dwarf_Line_Context of interest. |
| 3725 |
@param dw_index |
| 3726 |
The item to retrieve. Valid indexes are 1 through dw_count. |
| 3727 |
@param dw_name |
| 3728 |
On success returns a pointer to the subprog name. |
| 3729 |
@param dw_decl_file |
| 3730 |
On success returns a file number through the pointer. |
| 3731 |
@param dw_decl_line |
| 3732 |
On success returns a line number through the pointer. |
| 3733 |
@param dw_error |
| 3734 |
The usual error pointer. |
| 3735 |
@return |
| 3736 |
DW_DLV_OK if it succeeds. |
| 3737 |
*/ |
| 3738 |
DW_API int dwarf_srclines_subprog_data(Dwarf_Line_Context dw_context, |
| 3739 |
Dwarf_Signed dw_index, |
| 3740 |
const char ** dw_name, |
| 3741 |
Dwarf_Unsigned * dw_decl_file, |
| 3742 |
Dwarf_Unsigned * dw_decl_line, |
| 3743 |
Dwarf_Error * dw_error); |
| 3744 |
|
| 3745 |
/*! @brief Return values easing indexing line table file numbers. |
| 3746 |
Count is the real count of files array entries. |
| 3747 |
Since DWARF 2,3,4 are zero origin indexes and |
| 3748 |
DWARF5 and later are one origin, this function |
| 3749 |
replaces dwarf_srclines_files_count(). |
| 3750 |
@param dw_context |
| 3751 |
The line context of interest. |
| 3752 |
@param dw_baseindex |
| 3753 |
On success returns the base index of valid file indexes. |
| 3754 |
With DWARF2,3,4 the value is 1. With DWARF5 the |
| 3755 |
value is 0. |
| 3756 |
@param dw_count |
| 3757 |
On success returns the real count of entries. |
| 3758 |
@param dw_endindex |
| 3759 |
On success returns value such that |
| 3760 |
callers should index as dw_baseindex through |
| 3761 |
dw_endindex-1. |
| 3762 |
@param dw_error |
| 3763 |
The usual error pointer. |
| 3764 |
@return |
| 3765 |
DW_DLV_OK if it succeeds. |
| 3766 |
|
| 3767 |
@see examplec |
| 3768 |
*/ |
| 3769 |
DW_API int dwarf_srclines_files_indexes( |
| 3770 |
Dwarf_Line_Context dw_context, |
| 3771 |
Dwarf_Signed * dw_baseindex, |
| 3772 |
Dwarf_Signed * dw_count, |
| 3773 |
Dwarf_Signed * dw_endindex, |
| 3774 |
Dwarf_Error * dw_error); |
| 3775 |
|
| 3776 |
/*! @brief Access data for each line table file. |
| 3777 |
|
| 3778 |
Has the md5ptr field so cases where DW_LNCT_MD5 |
| 3779 |
is present can return pointer to the MD5 value. |
| 3780 |
With DWARF 5 index starts with 0. |
| 3781 |
dwarf_srclines_files_indexes() makes |
| 3782 |
indexing through the files easy. |
| 3783 |
|
| 3784 |
@see dwarf_srclines_files_indexes |
| 3785 |
@see examplec |
| 3786 |
|
| 3787 |
@param dw_context |
| 3788 |
The line context of interest. |
| 3789 |
@param dw_index_in |
| 3790 |
The entry of interest. |
| 3791 |
Callers should index as dw_baseindex through |
| 3792 |
dw_endindex-1. |
| 3793 |
@param dw_name |
| 3794 |
If dw_name non-null |
| 3795 |
on success returns |
| 3796 |
The file name in the line table header |
| 3797 |
through the pointer. |
| 3798 |
@param dw_directory_index |
| 3799 |
If dw_directory_index non-null |
| 3800 |
on success returns |
| 3801 |
the directory number in the line table header |
| 3802 |
through the pointer. |
| 3803 |
@param dw_last_mod_time |
| 3804 |
If dw_last_mod_time non-null |
| 3805 |
on success returns |
| 3806 |
the directory last modification date/time |
| 3807 |
through the pointer. |
| 3808 |
@param dw_file_length |
| 3809 |
If dw_file_length non-null |
| 3810 |
on success returns |
| 3811 |
the file length recorded in the line table |
| 3812 |
through the pointer. |
| 3813 |
@param dw_md5ptr |
| 3814 |
If dw_md5ptr non-null |
| 3815 |
on success returns |
| 3816 |
a pointer to the 16byte MD5 hash |
| 3817 |
of the file |
| 3818 |
through the pointer. |
| 3819 |
If there is no md5 value present it returns 0 through |
| 3820 |
the pointer. |
| 3821 |
@param dw_error |
| 3822 |
The usual error pointer. |
| 3823 |
@return |
| 3824 |
DW_DLV_OK if it succeeds. |
| 3825 |
|
| 3826 |
*/ |
| 3827 |
DW_API int dwarf_srclines_files_data_b( |
| 3828 |
Dwarf_Line_Context dw_context, |
| 3829 |
Dwarf_Signed dw_index_in, |
| 3830 |
const char ** dw_name, |
| 3831 |
Dwarf_Unsigned * dw_directory_index, |
| 3832 |
Dwarf_Unsigned * dw_last_mod_time, |
| 3833 |
Dwarf_Unsigned * dw_file_length, |
| 3834 |
Dwarf_Form_Data16 ** dw_md5ptr, |
| 3835 |
Dwarf_Error * dw_error); |
| 3836 |
|
| 3837 |
/*! @brief Return the number of include directories in the Line Table |
| 3838 |
|
| 3839 |
@param dw_line_context |
| 3840 |
The line context of interest. |
| 3841 |
@param dw_count |
| 3842 |
On success returns the count of directories. |
| 3843 |
How to use this depends on the line table version number. |
| 3844 |
@param dw_error |
| 3845 |
The usual error pointer. |
| 3846 |
@return |
| 3847 |
DW_DLV_OK if it succeeds. |
| 3848 |
|
| 3849 |
@see dwarf_srclines_include_dir_data |
| 3850 |
*/ |
| 3851 |
DW_API int dwarf_srclines_include_dir_count( |
| 3852 |
Dwarf_Line_Context dw_line_context, |
| 3853 |
Dwarf_Signed * dw_count, |
| 3854 |
Dwarf_Error * dw_error); |
| 3855 |
|
| 3856 |
/*! @brief Return the include directories in the Line Table |
| 3857 |
|
| 3858 |
@param dw_line_context |
| 3859 |
The line context of interest. |
| 3860 |
@param dw_index |
| 3861 |
Pass in an index to the line context list of include |
| 3862 |
directories. |
| 3863 |
If the line table is version 2,3, or 4, the |
| 3864 |
valid indexes are 1 through dw_count. |
| 3865 |
If the line table is version 5 the |
| 3866 |
valid indexes are 0 through dw_count-1. |
| 3867 |
@param dw_name |
| 3868 |
On success it returns a pointer to a directory name. |
| 3869 |
Do not free/deallocate the string. |
| 3870 |
@param dw_error |
| 3871 |
The usual error pointer. |
| 3872 |
@return |
| 3873 |
DW_DLV_OK if it succeeds. |
| 3874 |
|
| 3875 |
@see dwarf_srclines_include_dir_count |
| 3876 |
*/ |
| 3877 |
|
| 3878 |
DW_API int dwarf_srclines_include_dir_data( |
| 3879 |
Dwarf_Line_Context dw_line_context, |
| 3880 |
Dwarf_Signed dw_index, |
| 3881 |
const char ** dw_name, |
| 3882 |
Dwarf_Error * dw_error); |
| 3883 |
|
| 3884 |
/*! @brief The DWARF version number of this compile-unit |
| 3885 |
|
| 3886 |
The .debug_lines[.dwo] table count informs about |
| 3887 |
the line table version and the |
| 3888 |
type of line table involved. |
| 3889 |
|
| 3890 |
Meaning of the value returned via dw_table_count: |
| 3891 |
- 0 The table is a header with no lines. |
| 3892 |
- 1 The table is a standard line table. |
| 3893 |
- 2 The table is an experimental line table. |
| 3894 |
|
| 3895 |
@param dw_line_context |
| 3896 |
The Line Context of interest. |
| 3897 |
@param dw_version |
| 3898 |
On success, returns |
| 3899 |
the line table version through the pointer. |
| 3900 |
@param dw_table_count |
| 3901 |
On success, returns |
| 3902 |
the tablecount through the pointer. |
| 3903 |
If the table count is zero the line table is a header |
| 3904 |
with no lines. If the table count is 1 this is a standard |
| 3905 |
line table. If the table count is this is an experimental |
| 3906 |
two-level line table. |
| 3907 |
@param dw_error |
| 3908 |
The usual error pointer. |
| 3909 |
@return |
| 3910 |
DW_DLV_OK if it succeeds. |
| 3911 |
*/ |
| 3912 |
DW_API int dwarf_srclines_version(Dwarf_Line_Context dw_line_context, |
| 3913 |
Dwarf_Unsigned * dw_version, |
| 3914 |
Dwarf_Small * dw_table_count, |
| 3915 |
Dwarf_Error * dw_error); |
| 3916 |
|
| 3917 |
/*! @brief Read Line beginstatement register |
| 3918 |
|
| 3919 |
@link dwsec_linetabreg Line Table Registers @endlink |
| 3920 |
|
| 3921 |
@param dw_line |
| 3922 |
The Dwarf_Line of interest. |
| 3923 |
@param dw_returned_bool |
| 3924 |
On success it sets the value TRUE (if the dw_line |
| 3925 |
has the is_stmt register set) and FALSE if is_stmt |
| 3926 |
is not set. |
| 3927 |
@param dw_error |
| 3928 |
The usual error pointer. |
| 3929 |
@return |
| 3930 |
DW_DLV_OK if it succeeds. |
| 3931 |
*/ |
| 3932 |
DW_API int dwarf_linebeginstatement(Dwarf_Line dw_line, |
| 3933 |
Dwarf_Bool * dw_returned_bool, |
| 3934 |
Dwarf_Error * dw_error); |
| 3935 |
|
| 3936 |
/*! @brief Read Line endsequence register flag |
| 3937 |
|
| 3938 |
@link dwsec_linetabreg Line Table Registers @endlink |
| 3939 |
|
| 3940 |
@param dw_line |
| 3941 |
The Dwarf_Line of interest. |
| 3942 |
@param dw_returned_bool |
| 3943 |
On success it sets the value TRUE (if the dw_line |
| 3944 |
has the end_sequence register set) and FALSE if end_sequence |
| 3945 |
is not set. |
| 3946 |
@param dw_error |
| 3947 |
The usual error pointer. |
| 3948 |
@return |
| 3949 |
DW_DLV_OK if it succeeds. |
| 3950 |
*/ |
| 3951 |
DW_API int dwarf_lineendsequence(Dwarf_Line dw_line, |
| 3952 |
Dwarf_Bool * dw_returned_bool, |
| 3953 |
Dwarf_Error * dw_error); |
| 3954 |
|
| 3955 |
/*! @brief Read Line line register |
| 3956 |
|
| 3957 |
@link dwsec_linetabreg Line Table Registers @endlink |
| 3958 |
|
| 3959 |
@param dw_line |
| 3960 |
The Dwarf_Line of interest. |
| 3961 |
@param dw_returned_linenum |
| 3962 |
On success it sets the value to the line number |
| 3963 |
from the Dwarf_Line line register |
| 3964 |
@param dw_error |
| 3965 |
The usual error pointer. |
| 3966 |
@return |
| 3967 |
DW_DLV_OK if it succeeds. |
| 3968 |
*/ |
| 3969 |
DW_API int dwarf_lineno(Dwarf_Line dw_line, |
| 3970 |
Dwarf_Unsigned * dw_returned_linenum, |
| 3971 |
Dwarf_Error * dw_error); |
| 3972 |
|
| 3973 |
/*! @brief Read Line file register |
| 3974 |
|
| 3975 |
@link dwsec_linetabreg Line Table Registers @endlink |
| 3976 |
|
| 3977 |
@param dw_line |
| 3978 |
The Dwarf_Line of interest. |
| 3979 |
@param dw_returned_filenum |
| 3980 |
On success it sets the value to the file number |
| 3981 |
from the Dwarf_Line file register |
| 3982 |
@param dw_error |
| 3983 |
The usual error pointer. |
| 3984 |
@return |
| 3985 |
DW_DLV_OK if it succeeds. |
| 3986 |
*/ |
| 3987 |
DW_API int dwarf_line_srcfileno(Dwarf_Line dw_line, |
| 3988 |
Dwarf_Unsigned * dw_returned_filenum, |
| 3989 |
Dwarf_Error * dw_error); |
| 3990 |
|
| 3991 |
/*! @brief Is the Dwarf_Line address from DW_LNS_set_address? |
| 3992 |
This is not a line register, but it is a flag set |
| 3993 |
by the library in each Dwarf_Line, and it |
| 3994 |
is derived from reading the line table. |
| 3995 |
@param dw_line |
| 3996 |
The Dwarf_Line of interest. |
| 3997 |
@param dw_is_addr_set |
| 3998 |
On success it sets the flag to TRUE or FALSE. |
| 3999 |
@param dw_error |
| 4000 |
The usual error pointer. |
| 4001 |
@return |
| 4002 |
DW_DLV_OK if it succeeds. |
| 4003 |
*/ |
| 4004 |
DW_API int dwarf_line_is_addr_set(Dwarf_Line dw_line, |
| 4005 |
Dwarf_Bool * dw_is_addr_set, |
| 4006 |
Dwarf_Error * dw_error); |
| 4007 |
|
| 4008 |
/*! @brief Return the address of the Dwarf_Line |
| 4009 |
|
| 4010 |
@link dwsec_linetabreg Line Table Registers @endlink |
| 4011 |
|
| 4012 |
@param dw_line |
| 4013 |
The Dwarf_Line of interest. |
| 4014 |
@param dw_returned_addr |
| 4015 |
On success it sets the value to the value of |
| 4016 |
the address register in the Dwarf_Line. |
| 4017 |
@param dw_error |
| 4018 |
The usual error pointer. |
| 4019 |
@return |
| 4020 |
DW_DLV_OK if it succeeds. |
| 4021 |
*/ |
| 4022 |
DW_API int dwarf_lineaddr(Dwarf_Line dw_line, |
| 4023 |
Dwarf_Addr * dw_returned_addr, |
| 4024 |
Dwarf_Error* dw_error); |
| 4025 |
|
| 4026 |
/*! @brief Return a column number through the pointer |
| 4027 |
|
| 4028 |
@link dwsec_linetabreg Line Table Registers @endlink |
| 4029 |
|
| 4030 |
@param dw_line |
| 4031 |
The Dwarf_Line of interest. |
| 4032 |
@param dw_returned_lineoffset |
| 4033 |
On success it sets the value to the column |
| 4034 |
register from the Dwarf_Line. |
| 4035 |
@param dw_error |
| 4036 |
The usual error pointer. |
| 4037 |
@return |
| 4038 |
DW_DLV_OK if it succeeds. |
| 4039 |
*/ |
| 4040 |
DW_API int dwarf_lineoff_b(Dwarf_Line dw_line, |
| 4041 |
Dwarf_Unsigned * dw_returned_lineoffset, |
| 4042 |
Dwarf_Error* dw_error); |
| 4043 |
|
| 4044 |
/*! @brief Return the file name applicable to the Dwarf_Line |
| 4045 |
|
| 4046 |
@link dwsec_linetabreg Line Table Registers @endlink |
| 4047 |
|
| 4048 |
@param dw_line |
| 4049 |
The Dwarf_Line of interest. |
| 4050 |
@param dw_returned_name |
| 4051 |
On success it reads the file register and finds |
| 4052 |
the source file name from the line table header |
| 4053 |
and returns a pointer to that file name string |
| 4054 |
through the pointer. |
| 4055 |
@param dw_error |
| 4056 |
The usual error pointer. |
| 4057 |
Do not dealloc or free the string. |
| 4058 |
@return |
| 4059 |
DW_DLV_OK if it succeeds. |
| 4060 |
*/ |
| 4061 |
DW_API int dwarf_linesrc(Dwarf_Line dw_line, |
| 4062 |
char ** dw_returned_name, |
| 4063 |
Dwarf_Error* dw_error); |
| 4064 |
|
| 4065 |
/*! @brief Return the basic_block line register. |
| 4066 |
|
| 4067 |
@link dwsec_linetabreg Line Table Registers @endlink |
| 4068 |
|
| 4069 |
@param dw_line |
| 4070 |
The Dwarf_Line of interest. |
| 4071 |
@param dw_returned_bool |
| 4072 |
On success it sets the flag to TRUE or FALSE |
| 4073 |
from the basic_block register in the line table. |
| 4074 |
@param dw_error |
| 4075 |
The usual error pointer. |
| 4076 |
@return |
| 4077 |
DW_DLV_OK if it succeeds. |
| 4078 |
*/ |
| 4079 |
DW_API int dwarf_lineblock(Dwarf_Line dw_line, |
| 4080 |
Dwarf_Bool * dw_returned_bool, |
| 4081 |
Dwarf_Error* dw_error); |
| 4082 |
|
| 4083 |
/* We gather these into one call as it's likely one |
| 4084 |
will want all or none of them. */ |
| 4085 |
/*! @brief Return various line table registers in one call |
| 4086 |
|
| 4087 |
@link dwsec_linetabreg Line Table Registers @endlink |
| 4088 |
|
| 4089 |
@param dw_line |
| 4090 |
The Dwarf_Line of interest. |
| 4091 |
@param dw_prologue_end |
| 4092 |
On success it sets the flag to TRUE or FALSE |
| 4093 |
from the prologue_end register in the line table. |
| 4094 |
@param dw_epilogue_begin |
| 4095 |
On success it sets the flag to TRUE or FALSE |
| 4096 |
from the epilogue_begin register in the line table. |
| 4097 |
@param dw_isa |
| 4098 |
On success it sets the value to the value of |
| 4099 |
from the isa register in the line table. |
| 4100 |
@param dw_discriminator |
| 4101 |
On success it sets the value to the value of |
| 4102 |
from the discriminator register in the line table. |
| 4103 |
@param dw_error |
| 4104 |
The usual error pointer. |
| 4105 |
@return |
| 4106 |
DW_DLV_OK if it succeeds. |
| 4107 |
*/ |
| 4108 |
DW_API int dwarf_prologue_end_etc(Dwarf_Line dw_line, |
| 4109 |
Dwarf_Bool * dw_prologue_end, |
| 4110 |
Dwarf_Bool * dw_epilogue_begin, |
| 4111 |
Dwarf_Unsigned * dw_isa, |
| 4112 |
Dwarf_Unsigned * dw_discriminator, |
| 4113 |
Dwarf_Error * dw_error); |
| 4114 |
/* End line table operations */ |
| 4115 |
|
| 4116 |
/*! @brief Experimental Two-level logical Row Number |
| 4117 |
Experimental two level line tables. Not explained here. |
| 4118 |
When reading from an actuals table, dwarf_line_logical() |
| 4119 |
returns the logical row number for the line. |
| 4120 |
*/ |
| 4121 |
DW_API int dwarf_linelogical(Dwarf_Line dw_line, |
| 4122 |
Dwarf_Unsigned * dw_returned_logical, |
| 4123 |
Dwarf_Error* dw_error); |
| 4124 |
|
| 4125 |
/*! @brief Experimental Two-level line tables call contexts |
| 4126 |
Experimental two level line tables. Not explained here. |
| 4127 |
When reading from a logicals table, dwarf_linecontext() |
| 4128 |
returns the logical row number corresponding the the |
| 4129 |
calling context for an inlined call. |
| 4130 |
*/ |
| 4131 |
DW_API int dwarf_linecontext(Dwarf_Line dw_line, |
| 4132 |
Dwarf_Unsigned * dw_returned_context, |
| 4133 |
Dwarf_Error* dw_error); |
| 4134 |
|
| 4135 |
/*! @brief Two-level line tables get subprogram number |
| 4136 |
Experimental two level line tables. Not explained here. |
| 4137 |
When reading from a logicals table, dwarf_line_subprogno() |
| 4138 |
returns the index in the subprograms table of the inlined |
| 4139 |
subprogram. Currently this always returns |
| 4140 |
zero through the pointer as the relevant field |
| 4141 |
is never updated from the default of zero. |
| 4142 |
*/ |
| 4143 |
DW_API int dwarf_line_subprogno(Dwarf_Line /*line*/, |
| 4144 |
Dwarf_Unsigned * /*ret_subprogno*/, |
| 4145 |
Dwarf_Error * /*error*/); |
| 4146 |
|
| 4147 |
/*! @brief Two-level line tables get subprog, file, line |
| 4148 |
Experimental two level line tables. Not explained here. |
| 4149 |
When reading from a logicals table, dwarf_line_subprog() |
| 4150 |
returns the name of the inlined subprogram, its declaration |
| 4151 |
filename, and its declaration line number, if available. |
| 4152 |
*/ |
| 4153 |
DW_API int dwarf_line_subprog(Dwarf_Line /*line*/, |
| 4154 |
char ** /*returned_subprog_name*/, |
| 4155 |
char ** /*returned_filename*/, |
| 4156 |
Dwarf_Unsigned * /*returned_lineno*/, |
| 4157 |
Dwarf_Error * /*error*/); |
| 4158 |
|
| 4159 |
/*! @brief Access to detailed line table header issues. |
| 4160 |
|
| 4161 |
Lets the caller get detailed messages |
| 4162 |
about some compiler errors we detect. |
| 4163 |
Calls back, the caller should do something |
| 4164 |
with the messages (likely just print them). |
| 4165 |
The lines passed back already have newlines. |
| 4166 |
|
| 4167 |
@see dwarf_check_lineheader(b) |
| 4168 |
@see Dwarf_Printf_Callback_Info_s |
| 4169 |
|
| 4170 |
@param dw_cu_die |
| 4171 |
The CU DIE of interest |
| 4172 |
@param dw_error |
| 4173 |
If DW_DLV_ERROR this shows one error encountered. |
| 4174 |
@param dw_errcount_out |
| 4175 |
Returns the count of detected errors through the pointer. |
| 4176 |
@return |
| 4177 |
DW_DLV_OK etc. |
| 4178 |
*/ |
| 4179 |
DW_API int dwarf_check_lineheader_b(Dwarf_Die dw_cu_die, |
| 4180 |
int * dw_errcount_out, |
| 4181 |
Dwarf_Error * dw_error); |
| 4182 |
|
| 4183 |
/*! @brief Print line information in great detail. |
| 4184 |
|
| 4185 |
dwarf_print_lines lets the caller |
| 4186 |
prints line information |
| 4187 |
for a CU in great detail. |
| 4188 |
Does not use printf. |
| 4189 |
Instead it calls back to the application using a function |
| 4190 |
pointer once per line-to-print. The lines passed back |
| 4191 |
already have any needed newlines. |
| 4192 |
|
| 4193 |
dwarfdump uses this function for verbose printing |
| 4194 |
of line table data. |
| 4195 |
|
| 4196 |
Failing to call the dwarf_register_printf_callback() |
| 4197 |
function will prevent the lines from being passed back |
| 4198 |
but such omission is not an error. |
| 4199 |
The same function, but focused on checking for errors |
| 4200 |
is dwarf_check_lineheader_b(). |
| 4201 |
|
| 4202 |
@see Dwarf_Printf_Callback_Info_s |
| 4203 |
|
| 4204 |
@param dw_cu_die |
| 4205 |
The CU DIE of interest |
| 4206 |
@param dw_error |
| 4207 |
@param dw_errorcount_out |
| 4208 |
@return |
| 4209 |
DW_DLV_OK etc. |
| 4210 |
|
| 4211 |
*/ |
| 4212 |
DW_API int dwarf_print_lines(Dwarf_Die dw_cu_die, |
| 4213 |
Dwarf_Error * dw_error, |
| 4214 |
int * dw_errorcount_out); |
| 4215 |
|
| 4216 |
/*! @brief For line details this records callback details |
| 4217 |
|
| 4218 |
Not usually needed. It is a way to check |
| 4219 |
(while using the library) what callback |
| 4220 |
data is in use or to update that callback data. |
| 4221 |
|
| 4222 |
@see Dwarf_Printf_Callback_Info_s |
| 4223 |
|
| 4224 |
@param dw_dbg |
| 4225 |
The Dwarf_Debug of interest. |
| 4226 |
@param dw_callbackinfo |
| 4227 |
If non-NULL pass in a pointer to your |
| 4228 |
instance of struct Dwarf_Printf_Callback_Info_s |
| 4229 |
with all the fields filled in. |
| 4230 |
@return |
| 4231 |
If dw_callbackinfo NULL it returns a copy |
| 4232 |
of the current Dwarf_Printf_Callback_Info_s for dw_dbg. |
| 4233 |
Otherwise it returns the previous contents of the |
| 4234 |
struct. |
| 4235 |
*/ |
| 4236 |
DW_API struct Dwarf_Printf_Callback_Info_s |
| 4237 |
dwarf_register_printf_callback(Dwarf_Debug dw_dbg, |
| 4238 |
struct Dwarf_Printf_Callback_Info_s * dw_callbackinfo); |
| 4239 |
|
| 4240 |
/*! @} */ |
| 4241 |
/*! @defgroup ranges Ranges: code addresses in DWARF3-4 |
| 4242 |
|
| 4243 |
@{ |
| 4244 |
|
| 4245 |
In DWARF3 and DWARF4 the DW_AT_ranges attribute |
| 4246 |
provides an offset into the .debug_ranges section, |
| 4247 |
which contains code address ranges. |
| 4248 |
|
| 4249 |
@see Dwarf_Ranges |
| 4250 |
|
| 4251 |
DWARF3 and DWARF4. |
| 4252 |
DW_AT_ranges with an unsigned constant FORM (DWARF3) |
| 4253 |
or DW_FORM_sec_offset(DWARF4). |
| 4254 |
|
| 4255 |
*/ |
| 4256 |
/*! @brief Access to code ranges from a CU or just |
| 4257 |
reading through the raw .debug_ranges section. |
| 4258 |
|
| 4259 |
Adds return of the dw_realoffset to accommodate |
| 4260 |
DWARF4 GNU split-dwarf, where the ranges could |
| 4261 |
be in the tieddbg (meaning the real executable, a.out, not |
| 4262 |
in a dwp). DWARF4 split-dwarf is an extension, not |
| 4263 |
standard DWARF4. |
| 4264 |
|
| 4265 |
If printing all entries in the section pass |
| 4266 |
in an initial dw_rangesoffset of zero and dw_die of NULL. |
| 4267 |
Then increment dw_rangesoffset by dw_bytecount and call |
| 4268 |
again to get the next batch of ranges. |
| 4269 |
With a specific option dwarfdump can do this. |
| 4270 |
This not a normal thing to do! |
| 4271 |
|
| 4272 |
@see examplev |
| 4273 |
|
| 4274 |
@param dw_dbg |
| 4275 |
The Dwarf_Debug of interest |
| 4276 |
@param dw_rangesoffset |
| 4277 |
The offset to read from in the section. |
| 4278 |
@param dw_die |
| 4279 |
Pass in the DIE whose DW_AT_ranges brought us to ranges. |
| 4280 |
@param dw_return_realoffset |
| 4281 |
The actual offset in the section actually read. |
| 4282 |
In a tieddbg dwp DWARF4 extension object |
| 4283 |
the base offset is added to dw_rangesoffset and returned here. |
| 4284 |
@param dw_rangesbuf |
| 4285 |
A pointer to an array of structs is returned here. |
| 4286 |
The struct contents are the raw values in the |
| 4287 |
section. |
| 4288 |
@param dw_rangecount |
| 4289 |
The count of structs in the array is returned here. |
| 4290 |
@param dw_bytecount |
| 4291 |
The number of bytes in the .debug_ranges section |
| 4292 |
applying to the returned array. This makes possible |
| 4293 |
just marching through the section by offset. |
| 4294 |
@param dw_error |
| 4295 |
The usual error detail return pointer. |
| 4296 |
@return |
| 4297 |
Returns DW_DLV_OK etc. |
| 4298 |
*/ |
| 4299 |
DW_API int dwarf_get_ranges_b(Dwarf_Debug dw_dbg, |
| 4300 |
Dwarf_Off dw_rangesoffset, |
| 4301 |
Dwarf_Die dw_die, |
| 4302 |
Dwarf_Off * dw_return_realoffset, |
| 4303 |
Dwarf_Ranges ** dw_rangesbuf, |
| 4304 |
Dwarf_Signed * dw_rangecount, |
| 4305 |
Dwarf_Unsigned * dw_bytecount, |
| 4306 |
Dwarf_Error * dw_error); |
| 4307 |
|
| 4308 |
/*! @brief Dealloc the array dw_rangesbuf |
| 4309 |
|
| 4310 |
@param dw_dbg |
| 4311 |
The Dwarf_Debug of interest. |
| 4312 |
@param dw_rangesbuf |
| 4313 |
The dw_rangesbuf pointer returned by dwarf_get_ranges_b |
| 4314 |
@param dw_rangecount |
| 4315 |
The dw_rangecount returned by dwarf_get_ranges_b |
| 4316 |
*/ |
| 4317 |
DW_API void dwarf_dealloc_ranges(Dwarf_Debug dw_dbg, |
| 4318 |
Dwarf_Ranges * dw_rangesbuf, |
| 4319 |
Dwarf_Signed dw_rangecount); |
| 4320 |
|
| 4321 |
/*! @brief Find ranges base address |
| 4322 |
|
| 4323 |
The function allows callers to calculate |
| 4324 |
actual address from .debug_ranges data |
| 4325 |
in a simple and efficient way. |
| 4326 |
|
| 4327 |
@param dw_dbg |
| 4328 |
The Dwarf_Debug of interest. |
| 4329 |
@param dw_die |
| 4330 |
Pass in any non-null valid Dwarf_Die |
| 4331 |
to find the applicable .debug_ranges |
| 4332 |
base address. The dw_die need not |
| 4333 |
be a CU-DIE. |
| 4334 |
A null dw_die is allowed. |
| 4335 |
@param dw_known_base |
| 4336 |
if dw_die is non-null and there is a known |
| 4337 |
base address for the CU DIE that |
| 4338 |
(a DW_at_low_pc in the CU DIE) |
| 4339 |
dw_known_base will be set TRUE, |
| 4340 |
Otherwise the value FALSE will be returned through |
| 4341 |
dw_known_base. |
| 4342 |
@param dw_baseaddress |
| 4343 |
if dw_known_base is retured as TRUE then |
| 4344 |
dw_baseaddress will be set with the correct pc value. |
| 4345 |
Otherwise zero will be set through dw_baseaddress. |
| 4346 |
@param dw_at_ranges_offset_present |
| 4347 |
Set to 1 (TRUE) if the dw_die has the attribute |
| 4348 |
DW_AT_ranges, otherwise set to zero (FALSE). |
| 4349 |
@param dw_at_ranges_offset |
| 4350 |
Set to the value of dw_die DW_AT_ranges attribute |
| 4351 |
of dw_die if and only iff |
| 4352 |
dw_at_ranges_offset_present was set to 1. |
| 4353 |
@param dw_error |
| 4354 |
The usual error detail return pointer. |
| 4355 |
@return |
| 4356 |
Returns DW_DLV_OK or DW_DLV_ERROR. |
| 4357 |
Never returns DW_DLV_NO_ENTRY. |
| 4358 |
|
| 4359 |
*/ |
| 4360 |
DW_API int dwarf_get_ranges_baseaddress(Dwarf_Debug dw_dbg, |
| 4361 |
Dwarf_Die dw_die, |
| 4362 |
Dwarf_Bool *dw_known_base, |
| 4363 |
Dwarf_Unsigned *dw_baseaddress, |
| 4364 |
Dwarf_Bool *dw_at_ranges_offset_present, |
| 4365 |
Dwarf_Unsigned *dw_at_ranges_offset, |
| 4366 |
Dwarf_Error *dw_error); |
| 4367 |
|
| 4368 |
/*! @} */ |
| 4369 |
|
| 4370 |
/*! @defgroup rnglists Rnglists: code addresses in DWARF5 |
| 4371 |
|
| 4372 |
@{ |
| 4373 |
|
| 4374 |
Used in DWARF5 to define valid address ranges for |
| 4375 |
code. |
| 4376 |
|
| 4377 |
DW_FORM_rnglistx or |
| 4378 |
DW_AT_ranges with DW_FORM_sec_offset |
| 4379 |
*/ |
| 4380 |
|
| 4381 |
/*! @brief Get Access to DWARF5 rnglists |
| 4382 |
|
| 4383 |
Opens a Dwarf_Rnglists_Head to access a set of |
| 4384 |
DWARF5 rangelists .debug_rnglists |
| 4385 |
DW_FORM_sec_offset DW_FORM_rnglistx |
| 4386 |
(DW_AT_ranges in DWARF5). |
| 4387 |
|
| 4388 |
@see example_rnglist_for_attribute |
| 4389 |
|
| 4390 |
@param dw_attr |
| 4391 |
The attribute referring to .debug_rnglists |
| 4392 |
@param dw_theform |
| 4393 |
The form number, DW_FORM_sec_offset or |
| 4394 |
DW_FORM_rnglistx. |
| 4395 |
@param dw_index_or_offset_value |
| 4396 |
If the form is an index, pass it here. |
| 4397 |
If the form is an offset, pass that here. |
| 4398 |
@param dw_head_out |
| 4399 |
On success creates a record owning the |
| 4400 |
rnglists data for this attribute. |
| 4401 |
@param dw_count_of_entries_in_head |
| 4402 |
On success this is set to the number of |
| 4403 |
entry in the rnglists for this attribute. |
| 4404 |
@param dw_global_offset_of_rle_set |
| 4405 |
On success set to the global offset of the rnglists |
| 4406 |
in the rnglists section. |
| 4407 |
@param dw_error |
| 4408 |
The usual error detail return pointer. |
| 4409 |
@return |
| 4410 |
Returns DW_DLV_OK etc. |
| 4411 |
|
| 4412 |
*/ |
| 4413 |
DW_API int dwarf_rnglists_get_rle_head(Dwarf_Attribute dw_attr, |
| 4414 |
Dwarf_Half dw_theform, |
| 4415 |
Dwarf_Unsigned dw_index_or_offset_value, |
| 4416 |
Dwarf_Rnglists_Head * dw_head_out, |
| 4417 |
Dwarf_Unsigned * dw_count_of_entries_in_head, |
| 4418 |
Dwarf_Unsigned * dw_global_offset_of_rle_set, |
| 4419 |
Dwarf_Error * dw_error); |
| 4420 |
|
| 4421 |
/*! @brief Access rnglist entry details. |
| 4422 |
|
| 4423 |
@see example_rnglist_for_attribute |
| 4424 |
|
| 4425 |
@param dw_head |
| 4426 |
The Dwarf_Rnglists_Head of interest. |
| 4427 |
@param dw_entrynum |
| 4428 |
Valid values are 0 through dw_count_of_entries_in_head-1. |
| 4429 |
@param dw_entrylen |
| 4430 |
On success returns |
| 4431 |
the length in bytes of this individual entry. |
| 4432 |
@param dw_rle_value_out |
| 4433 |
On success returns |
| 4434 |
the RLE value of the entry, such as DW_RLE_startx_endx. |
| 4435 |
This determines which of dw_raw1 and dw_raw2 |
| 4436 |
contain meaningful data. |
| 4437 |
@param dw_raw1 |
| 4438 |
On success returns |
| 4439 |
a value directly recorded in the rangelist entry |
| 4440 |
if that applies to this rle. |
| 4441 |
@param dw_raw2 |
| 4442 |
On success returns |
| 4443 |
a value directly recorded in the rangelist entry |
| 4444 |
if that applies to this rle. |
| 4445 |
@param dw_debug_addr_unavailable |
| 4446 |
On success returns a flag. |
| 4447 |
If the .debug_addr section is required but absent or |
| 4448 |
unavailable the flag is set to TRUE. |
| 4449 |
Otherwise sets the flag FALSE. |
| 4450 |
@param dw_cooked1 |
| 4451 |
On success returns (if appropriate) the |
| 4452 |
dw_raw1 value turned into a valid address. |
| 4453 |
@param dw_cooked2 |
| 4454 |
On success returns (if appropriate) the |
| 4455 |
dw_raw2 value turned into a valid address. |
| 4456 |
Ignore the value if dw_debug_addr_unavailable is set. |
| 4457 |
@param dw_error |
| 4458 |
The usual error detail return pointer. |
| 4459 |
Ignore the value if dw_debug_addr_unavailable is set. |
| 4460 |
@return |
| 4461 |
Returns DW_DLV_OK etc. |
| 4462 |
*/ |
| 4463 |
DW_API int dwarf_get_rnglists_entry_fields_a( |
| 4464 |
Dwarf_Rnglists_Head dw_head, |
| 4465 |
Dwarf_Unsigned dw_entrynum, |
| 4466 |
unsigned int * dw_entrylen, |
| 4467 |
unsigned int * dw_rle_value_out, |
| 4468 |
Dwarf_Unsigned * dw_raw1, |
| 4469 |
Dwarf_Unsigned * dw_raw2, |
| 4470 |
Dwarf_Bool * dw_debug_addr_unavailable, |
| 4471 |
Dwarf_Unsigned * dw_cooked1, |
| 4472 |
Dwarf_Unsigned * dw_cooked2, |
| 4473 |
Dwarf_Error * dw_error); |
| 4474 |
|
| 4475 |
/*! @brief Dealloc a Dwarf_Rnglists_Head |
| 4476 |
|
| 4477 |
@param dw_head |
| 4478 |
dealloc all the memory associated with dw_head. |
| 4479 |
The caller should then immediately set |
| 4480 |
the pointer to zero/NULL as it is stale. |
| 4481 |
*/ |
| 4482 |
DW_API void dwarf_dealloc_rnglists_head(Dwarf_Rnglists_Head dw_head); |
| 4483 |
|
| 4484 |
/*! @brief Loads all .debug_rnglists headers. |
| 4485 |
|
| 4486 |
Loads all the rnglists headers and |
| 4487 |
returns DW_DLV_NO_ENTRY if the section |
| 4488 |
is missing or empty. |
| 4489 |
Intended to be done quite early. |
| 4490 |
It is automatically done if anything |
| 4491 |
needing CU or DIE information is called, |
| 4492 |
so it is not necessary for you to call this |
| 4493 |
in any normal situation. |
| 4494 |
|
| 4495 |
@see example_raw_rnglist |
| 4496 |
|
| 4497 |
Doing it more than once is never necessary |
| 4498 |
or harmful. There is no deallocation call |
| 4499 |
made visible, deallocation happens |
| 4500 |
when dwarf_finish() is called. |
| 4501 |
|
| 4502 |
@param dw_dbg |
| 4503 |
@param dw_rnglists_count |
| 4504 |
On success it returns the number of |
| 4505 |
rnglists headers in the section through |
| 4506 |
dw_rnglists_count. |
| 4507 |
@param dw_error |
| 4508 |
The usual error detail return pointer. |
| 4509 |
@return |
| 4510 |
Returns DW_DLV_OK etc. |
| 4511 |
If the section does not exist the function returns |
| 4512 |
DW_DLV_OK. |
| 4513 |
*/ |
| 4514 |
DW_API int dwarf_load_rnglists(Dwarf_Debug dw_dbg, |
| 4515 |
Dwarf_Unsigned * dw_rnglists_count, |
| 4516 |
Dwarf_Error * dw_error); |
| 4517 |
|
| 4518 |
/*! @brief Retrieve the section offset of a rnglist. |
| 4519 |
|
| 4520 |
Can be used to access raw rnglist data. |
| 4521 |
Not used by most callers. |
| 4522 |
See DWARF5 Section 7.28 Range List Table Page 242 |
| 4523 |
|
| 4524 |
@param dw_dbg |
| 4525 |
The Dwarf_Debug of interest. |
| 4526 |
@param dw_context_index |
| 4527 |
Begin this at zero. |
| 4528 |
@param dw_offsetentry_index |
| 4529 |
Begin this at zero. |
| 4530 |
@param dw_offset_value_out |
| 4531 |
On success returns the rangelist entry |
| 4532 |
offset within the rangelist set. |
| 4533 |
@param dw_global_offset_value_out |
| 4534 |
On success returns the rangelist entry |
| 4535 |
offset within rnglist section. |
| 4536 |
@param dw_error |
| 4537 |
The usual error detail return pointer. |
| 4538 |
@return |
| 4539 |
Returns DW_DLV_OK etc. |
| 4540 |
If there are no rnglists at all, or |
| 4541 |
if one of the above index values is too high |
| 4542 |
to be valid it returns DW_DLV_NO_ENTRY. |
| 4543 |
*/ |
| 4544 |
DW_API int dwarf_get_rnglist_offset_index_value(Dwarf_Debug dw_dbg, |
| 4545 |
Dwarf_Unsigned dw_context_index, |
| 4546 |
Dwarf_Unsigned dw_offsetentry_index, |
| 4547 |
Dwarf_Unsigned * dw_offset_value_out, |
| 4548 |
Dwarf_Unsigned * dw_global_offset_value_out, |
| 4549 |
Dwarf_Error * dw_error); |
| 4550 |
|
| 4551 |
/*! @brief Access to internal data on rangelists. |
| 4552 |
|
| 4553 |
Returns detailed data from a Dwarf_Rnglists_Head |
| 4554 |
Since this is primarily internal data we don't |
| 4555 |
describe the details of the returned fields here. |
| 4556 |
*/ |
| 4557 |
DW_API int dwarf_get_rnglist_head_basics(Dwarf_Rnglists_Head dw_head, |
| 4558 |
Dwarf_Unsigned * dw_rle_count, |
| 4559 |
Dwarf_Unsigned * dw_rnglists_version, |
| 4560 |
Dwarf_Unsigned * dw_rnglists_index_returned, |
| 4561 |
Dwarf_Unsigned * dw_bytes_total_in_rle, |
| 4562 |
Dwarf_Half * dw_offset_size, |
| 4563 |
Dwarf_Half * dw_address_size, |
| 4564 |
Dwarf_Half * dw_segment_selector_size, |
| 4565 |
Dwarf_Unsigned * dw_overall_offset_of_this_context, |
| 4566 |
Dwarf_Unsigned * dw_total_length_of_this_context, |
| 4567 |
Dwarf_Unsigned * dw_offset_table_offset, |
| 4568 |
Dwarf_Unsigned * dw_offset_table_entrycount, |
| 4569 |
Dwarf_Bool * dw_rnglists_base_present, |
| 4570 |
Dwarf_Unsigned * dw_rnglists_base, |
| 4571 |
Dwarf_Bool * dw_rnglists_base_address_present, |
| 4572 |
Dwarf_Unsigned * dw_rnglists_base_address, |
| 4573 |
Dwarf_Bool * dw_rnglists_debug_addr_base_present, |
| 4574 |
Dwarf_Unsigned * dw_rnglists_debug_addr_base, |
| 4575 |
Dwarf_Error * dw_error); |
| 4576 |
|
| 4577 |
/*! @brief Access to rnglists header data |
| 4578 |
|
| 4579 |
This returns, independent of any DIEs or CUs |
| 4580 |
information on the .debug_rnglists headers |
| 4581 |
present in the section. |
| 4582 |
|
| 4583 |
We do not document the details here. |
| 4584 |
See the DWARF5 standard. |
| 4585 |
|
| 4586 |
Enables printing of details about the Range List Table |
| 4587 |
Headers, one header per call. Index starting at 0. |
| 4588 |
Returns DW_DLV_NO_ENTRY if index is too high for the table. |
| 4589 |
A .debug_rnglists section may contain any number |
| 4590 |
of Range List Table Headers with their details. |
| 4591 |
*/ |
| 4592 |
DW_API int dwarf_get_rnglist_context_basics(Dwarf_Debug dw_dbg, |
| 4593 |
Dwarf_Unsigned dw_index, |
| 4594 |
Dwarf_Unsigned * dw_header_offset, |
| 4595 |
Dwarf_Small * dw_offset_size, |
| 4596 |
Dwarf_Small * dw_extension_size, |
| 4597 |
unsigned int * dw_version, |
| 4598 |
Dwarf_Small * dw_address_size, |
| 4599 |
Dwarf_Small * dw_segment_selector_size, |
| 4600 |
Dwarf_Unsigned * dw_offset_entry_count, |
| 4601 |
Dwarf_Unsigned * dw_offset_of_offset_array, |
| 4602 |
Dwarf_Unsigned * dw_offset_of_first_rangeentry, |
| 4603 |
Dwarf_Unsigned * dw_offset_past_last_rangeentry, |
| 4604 |
Dwarf_Error * dw_error); |
| 4605 |
|
| 4606 |
/*! @brief Access to raw rnglists range data |
| 4607 |
|
| 4608 |
Describes the actual raw data recorded in a particular |
| 4609 |
range entry. |
| 4610 |
|
| 4611 |
We do not describe all these fields for now, the |
| 4612 |
raw values are mostly useful for people debugging |
| 4613 |
compiler-generated DWARF. |
| 4614 |
*/ |
| 4615 |
DW_API int dwarf_get_rnglist_rle(Dwarf_Debug dw_dbg, |
| 4616 |
Dwarf_Unsigned dw_contextnumber, |
| 4617 |
Dwarf_Unsigned dw_entry_offset, |
| 4618 |
Dwarf_Unsigned dw_endoffset, |
| 4619 |
unsigned int * dw_entrylen, |
| 4620 |
unsigned int * dw_entry_kind, |
| 4621 |
Dwarf_Unsigned * dw_entry_operand1, |
| 4622 |
Dwarf_Unsigned * dw_entry_operand2, |
| 4623 |
Dwarf_Error * dw_error); |
| 4624 |
/*! @} */ |
| 4625 |
/*! @defgroup locations Locations of data: DWARF2-DWARF5 |
| 4626 |
@{ |
| 4627 |
*/ |
| 4628 |
/*! @brief Location Lists and Expressions |
| 4629 |
|
| 4630 |
This works on DWARF2 through DWARF5. |
| 4631 |
|
| 4632 |
@see example_loclistcv5 |
| 4633 |
|
| 4634 |
@param dw_attr |
| 4635 |
The attribute must refer to a location expression |
| 4636 |
or a location list, so must be DW_FORM_block, |
| 4637 |
DW_FORM_exprloc, or a loclist reference form.. |
| 4638 |
@param dw_loclist_head |
| 4639 |
On success returns a pointer to the created |
| 4640 |
loclist head record. |
| 4641 |
@param dw_locentry_count |
| 4642 |
On success returns the count of records. |
| 4643 |
For an expression it will be one. |
| 4644 |
@param dw_error |
| 4645 |
The usual error detail return pointer. |
| 4646 |
@return |
| 4647 |
Returns DW_DLV_OK etc. |
| 4648 |
*/ |
| 4649 |
DW_API int dwarf_get_loclist_c(Dwarf_Attribute dw_attr, |
| 4650 |
Dwarf_Loc_Head_c * dw_loclist_head, |
| 4651 |
Dwarf_Unsigned * dw_locentry_count, |
| 4652 |
Dwarf_Error * dw_error); |
| 4653 |
|
| 4654 |
#define DW_LKIND_expression 0 /* DWARF2,3,4,5 */ |
| 4655 |
#define DW_LKIND_loclist 1 /* DWARF 2,3,4 */ |
| 4656 |
#define DW_LKIND_GNU_exp_list 2 /* GNU DWARF4 .dwo extension */ |
| 4657 |
#define DW_LKIND_loclists 5 /* DWARF5 loclists */ |
| 4658 |
#define DW_LKIND_unknown 99 |
| 4659 |
|
| 4660 |
/*! @brief Know what kind of location data it is |
| 4661 |
|
| 4662 |
@param dw_loclist_head |
| 4663 |
Pass in a loclist head pointer. |
| 4664 |
@param dw_lkind |
| 4665 |
On success returns the loclist kind |
| 4666 |
through the pointer. For example DW_LKIND_expression. |
| 4667 |
@param dw_error |
| 4668 |
The usual error detail return pointer. |
| 4669 |
@return |
| 4670 |
Returns DW_DLV_OK etc. |
| 4671 |
*/ |
| 4672 |
DW_API int dwarf_get_loclist_head_kind( |
| 4673 |
Dwarf_Loc_Head_c dw_loclist_head, |
| 4674 |
unsigned int * dw_lkind, |
| 4675 |
Dwarf_Error * dw_error); |
| 4676 |
|
| 4677 |
/*! @brief Retrieve the details(_d) of a location expression |
| 4678 |
|
| 4679 |
Cooked value means the addresses from the location |
| 4680 |
description after base values applied, so they |
| 4681 |
are actual addresses. |
| 4682 |
debug_addr_unavailable non-zero means the record from a |
| 4683 |
Split Dwarf skeleton unit could not be accessed from |
| 4684 |
the .dwo section or dwp object so the |
| 4685 |
cooked values could not be calculated. |
| 4686 |
|
| 4687 |
@param dw_loclist_head |
| 4688 |
A loclist head pointer. |
| 4689 |
@param dw_index |
| 4690 |
Pass in an index value less than dw_locentry_count . |
| 4691 |
@param dw_lle_value_out |
| 4692 |
On success returns the DW_LLE value applicable, such |
| 4693 |
as DW_LLE_start_end . |
| 4694 |
@param dw_rawlowpc |
| 4695 |
On success returns the first operand in the expression |
| 4696 |
(if the expression has an operand). |
| 4697 |
@param dw_rawhipc |
| 4698 |
On success returns the second operand in the expression. |
| 4699 |
(if the expression has a second operand). |
| 4700 |
@param dw_debug_addr_unavailable |
| 4701 |
On success returns FALSE if the data required to calculate |
| 4702 |
dw_lowpc_cooked or dw_hipc_cooked was present |
| 4703 |
or TRUE if some required |
| 4704 |
data was missing (for example in split dwarf). |
| 4705 |
@param dw_lowpc_cooked |
| 4706 |
On success and if dw_debug_addr_unavailable FALSE |
| 4707 |
returns the true low address. |
| 4708 |
@param dw_hipc_cooked |
| 4709 |
On success and if dw_debug_addr_unavailable FALSE |
| 4710 |
returns the true high address. |
| 4711 |
@param dw_locexpr_op_count_out |
| 4712 |
On success returns the count of operations |
| 4713 |
in the expression. |
| 4714 |
@param dw_locentry_out |
| 4715 |
On success returns a pointer to a specific location |
| 4716 |
description. |
| 4717 |
@param dw_loclist_source_out |
| 4718 |
On success returns the applicable DW_LKIND value. |
| 4719 |
@param dw_expression_offset_out |
| 4720 |
On success returns the offset of the expression |
| 4721 |
in the applicable section. |
| 4722 |
@param dw_locdesc_offset_out |
| 4723 |
On return sets the offset to the location description |
| 4724 |
offset (if that is meaningful) or zero for |
| 4725 |
simple location expressions. |
| 4726 |
@param dw_error |
| 4727 |
The usual error detail return pointer. |
| 4728 |
@return |
| 4729 |
Returns DW_DLV_OK etc. |
| 4730 |
*/ |
| 4731 |
DW_API int dwarf_get_locdesc_entry_d(Dwarf_Loc_Head_c dw_loclist_head, |
| 4732 |
Dwarf_Unsigned dw_index, |
| 4733 |
Dwarf_Small * dw_lle_value_out, |
| 4734 |
Dwarf_Unsigned * dw_rawlowpc, |
| 4735 |
Dwarf_Unsigned * dw_rawhipc, |
| 4736 |
Dwarf_Bool * dw_debug_addr_unavailable, |
| 4737 |
Dwarf_Addr * dw_lowpc_cooked, |
| 4738 |
Dwarf_Addr * dw_hipc_cooked, |
| 4739 |
Dwarf_Unsigned * dw_locexpr_op_count_out, |
| 4740 |
Dwarf_Locdesc_c * dw_locentry_out, |
| 4741 |
Dwarf_Small * dw_loclist_source_out, |
| 4742 |
Dwarf_Unsigned * dw_expression_offset_out, |
| 4743 |
Dwarf_Unsigned * dw_locdesc_offset_out, |
| 4744 |
Dwarf_Error * dw_error); |
| 4745 |
|
| 4746 |
/*! @brief Retrieve the details(_e) of a location expression |
| 4747 |
|
| 4748 |
Cooked value means the addresses from the location |
| 4749 |
description after base values applied, so they |
| 4750 |
are actual addresses. |
| 4751 |
debug_addr_unavailable non-zero means the record from a |
| 4752 |
Split Dwarf skeleton unit could not be accessed from |
| 4753 |
the .dwo section or dwp object so the |
| 4754 |
cooked values could not be calculated. |
| 4755 |
|
| 4756 |
This is identical to dwarf_get_locdesc_entry_d except |
| 4757 |
that it adds a pointer argument so the caller can know |
| 4758 |
the size, in bytes, of the loclist DW_LLE operation |
| 4759 |
itself. |
| 4760 |
|
| 4761 |
It's used by dwarfdump but it is unlikely to be of interest |
| 4762 |
to most callers.. |
| 4763 |
*/ |
| 4764 |
|
| 4765 |
DW_API int dwarf_get_locdesc_entry_e(Dwarf_Loc_Head_c dw_loclist_head, |
| 4766 |
Dwarf_Unsigned dw_index, |
| 4767 |
Dwarf_Small * dw_lle_value_out, |
| 4768 |
Dwarf_Unsigned * dw_rawlowpc, |
| 4769 |
Dwarf_Unsigned * dw_rawhipc, |
| 4770 |
Dwarf_Bool * dw_debug_addr_unavailable, |
| 4771 |
Dwarf_Addr * dw_lowpc_cooked, |
| 4772 |
Dwarf_Addr * dw_hipc_cooked, |
| 4773 |
Dwarf_Unsigned * dw_locexpr_op_count_out, |
| 4774 |
Dwarf_Unsigned * dw_lle_bytecount, |
| 4775 |
Dwarf_Locdesc_c * dw_locentry_out, |
| 4776 |
Dwarf_Small * dw_loclist_source_out, |
| 4777 |
Dwarf_Unsigned * dw_expression_offset_out, |
| 4778 |
Dwarf_Unsigned * dw_locdesc_offset_out, |
| 4779 |
Dwarf_Error * dw_error); |
| 4780 |
|
| 4781 |
/*! @brief Get the raw values from a single location operation |
| 4782 |
|
| 4783 |
@param dw_locdesc |
| 4784 |
Pass in a valid Dwarf_Locdesc_c. |
| 4785 |
@param dw_index |
| 4786 |
Pass in the operator index. zero through |
| 4787 |
dw_locexpr_op_count_out-1. |
| 4788 |
@param dw_operator_out |
| 4789 |
On success returns the DW_OP operator, such as DW_OP_plus . |
| 4790 |
@param dw_operand1 |
| 4791 |
On success returns the value of the operand or zero. |
| 4792 |
@param dw_operand2 |
| 4793 |
On success returns the value of the operand or zero. |
| 4794 |
@param dw_operand3 |
| 4795 |
On success returns the value of the operand or zero. |
| 4796 |
@param dw_offset_for_branch |
| 4797 |
On success returns |
| 4798 |
The byte offset of the operator within the |
| 4799 |
entire expression. Useful for checking the correctness |
| 4800 |
of operators that branch.. |
| 4801 |
@param dw_error |
| 4802 |
The usual error detail return pointer. |
| 4803 |
@return |
| 4804 |
Returns DW_DLV_OK etc. |
| 4805 |
*/ |
| 4806 |
DW_API int dwarf_get_location_op_value_c(Dwarf_Locdesc_c dw_locdesc, |
| 4807 |
Dwarf_Unsigned dw_index, |
| 4808 |
Dwarf_Small * dw_operator_out, |
| 4809 |
Dwarf_Unsigned * dw_operand1, |
| 4810 |
Dwarf_Unsigned * dw_operand2, |
| 4811 |
Dwarf_Unsigned * dw_operand3, |
| 4812 |
Dwarf_Unsigned * dw_offset_for_branch, |
| 4813 |
Dwarf_Error* dw_error); |
| 4814 |
/*! @brief Generate a Dwarf_Loc_Head_c from an expression block |
| 4815 |
|
| 4816 |
Useful if you have an expression block (from somewhere), |
| 4817 |
do not have a Dwarf_Attribute available, |
| 4818 |
and wish to deal with the expression. |
| 4819 |
|
| 4820 |
@see example_locexprc |
| 4821 |
|
| 4822 |
@param dw_dbg |
| 4823 |
The applicable Dwarf_Debug |
| 4824 |
@param dw_expression_in |
| 4825 |
Pass in a pointer to the expression bytes. |
| 4826 |
@param dw_expression_length |
| 4827 |
Pass in the length, in bytes, of the expression. |
| 4828 |
@param dw_address_size |
| 4829 |
Pass in the applicable address_size. |
| 4830 |
@param dw_offset_size |
| 4831 |
Pass in the applicable offset size. |
| 4832 |
@param dw_dwarf_version |
| 4833 |
Pass in the applicable dwarf version. |
| 4834 |
@param dw_loc_head |
| 4835 |
On success returns a pointer to a dwarf location |
| 4836 |
head record for use in getting to the details |
| 4837 |
of the expression. |
| 4838 |
@param dw_listlen |
| 4839 |
On success, sets the listlen to one. |
| 4840 |
@param dw_error |
| 4841 |
The usual error detail return pointer. |
| 4842 |
@return |
| 4843 |
Returns DW_DLV_OK etc. |
| 4844 |
*/ |
| 4845 |
DW_API int dwarf_loclist_from_expr_c(Dwarf_Debug dw_dbg, |
| 4846 |
Dwarf_Ptr dw_expression_in, |
| 4847 |
Dwarf_Unsigned dw_expression_length, |
| 4848 |
Dwarf_Half dw_address_size, |
| 4849 |
Dwarf_Half dw_offset_size, |
| 4850 |
Dwarf_Half dw_dwarf_version, |
| 4851 |
Dwarf_Loc_Head_c* dw_loc_head, |
| 4852 |
Dwarf_Unsigned * dw_listlen, |
| 4853 |
Dwarf_Error * dw_error); |
| 4854 |
|
| 4855 |
/*! @brief Dealloc (free) all memory allocated for Dwarf_Loc_Head_c |
| 4856 |
@param dw_head |
| 4857 |
A head pointer. |
| 4858 |
|
| 4859 |
The caller should zero the passed-in pointer on return |
| 4860 |
as it is stale at that point. |
| 4861 |
*/ |
| 4862 |
DW_API void dwarf_dealloc_loc_head_c(Dwarf_Loc_Head_c dw_head); |
| 4863 |
|
| 4864 |
/* These interfaces allow reading the .debug_loclists |
| 4865 |
section. Independently of DIEs. |
| 4866 |
Normal use of .debug_loclists uses |
| 4867 |
dwarf_get_loclist_c() to open access to any kind of location |
| 4868 |
or loclist and uses dwarf_loc_head_c_dealloc() to |
| 4869 |
deallocate that memory once one is finished with |
| 4870 |
that data. So for most purposes you do not need |
| 4871 |
to use these functions |
| 4872 |
See dwarf_get_loclist_c() to open a Dwarf_Loc_Head_c |
| 4873 |
on any type of location list or expression. */ |
| 4874 |
|
| 4875 |
/* Loads all the loclists headers and |
| 4876 |
returns DW_DLV_NO_ENTRY if the section |
| 4877 |
is missing or empty. |
| 4878 |
Intended to be done quite early and |
| 4879 |
it is automatically |
| 4880 |
done if .debug_info is loaded. |
| 4881 |
Doing it more than once is never necessary |
| 4882 |
or harmful. There is no deallocation call |
| 4883 |
made visible, deallocation happens |
| 4884 |
when dwarf_finish() is called. |
| 4885 |
With DW_DLV_OK it returns the number of |
| 4886 |
loclists headers in the section through |
| 4887 |
loclists_count. */ |
| 4888 |
/*! @brief Load Loclists |
| 4889 |
|
| 4890 |
This loads raw .debug_loclists (DWARF5). |
| 4891 |
It is unlikely you have a reason to use this function. |
| 4892 |
If CUs or DIES have been referenced in any way |
| 4893 |
loading is already done. A duplicate loading |
| 4894 |
attempt returns DW_DLV_OK immediately, returning |
| 4895 |
dw_loclists_count filled in and does nothing else. |
| 4896 |
|
| 4897 |
Doing it more than once is never necessary |
| 4898 |
or harmful. There is no deallocation call |
| 4899 |
made visible, deallocation happens |
| 4900 |
when dwarf_finish() is called. |
| 4901 |
|
| 4902 |
@param dw_dbg |
| 4903 |
The applicable Dwarf_Debug. |
| 4904 |
@param dw_loclists_count |
| 4905 |
On success, returns the number of |
| 4906 |
DWARF5 loclists contexts in the section, |
| 4907 |
whether this is the first or a duplicate |
| 4908 |
load. |
| 4909 |
@param dw_error |
| 4910 |
The usual error detail return pointer. |
| 4911 |
@return |
| 4912 |
Returns DW_DLV_OK if it loaded successfully |
| 4913 |
or if it is a duplicate load. |
| 4914 |
If no .debug_loclists |
| 4915 |
present returns DW_DLV_NO_ENTRY. |
| 4916 |
*/ |
| 4917 |
DW_API int dwarf_load_loclists(Dwarf_Debug dw_dbg, |
| 4918 |
Dwarf_Unsigned * dw_loclists_count, |
| 4919 |
Dwarf_Error * dw_error); |
| 4920 |
|
| 4921 |
/*! @brief Return certain loclists offsets |
| 4922 |
|
| 4923 |
Useful with the DWARF5 .debug_loclists section. |
| 4924 |
|
| 4925 |
@param dw_dbg |
| 4926 |
The Dwarf_Debug of interest. |
| 4927 |
@param dw_context_index |
| 4928 |
Pass in the loclists context index. |
| 4929 |
@param dw_offsetentry_index |
| 4930 |
Pass in the offset array index. |
| 4931 |
@param dw_offset_value_out |
| 4932 |
On success returns the offset value at |
| 4933 |
offset table[dw_offsetentry_index], |
| 4934 |
an offset local to this context. |
| 4935 |
@param dw_global_offset_value_out |
| 4936 |
On success returns the same offset value |
| 4937 |
but with the offset of the table added in |
| 4938 |
to form a section offset. |
| 4939 |
@param dw_error |
| 4940 |
The usual error detail return pointer. |
| 4941 |
@return |
| 4942 |
Returns DW_DLV_OK etc. |
| 4943 |
If one of the indexes passed in is out of range |
| 4944 |
it returns DW_DLV_NO_ENTRY. |
| 4945 |
*/ |
| 4946 |
DW_API int dwarf_get_loclist_offset_index_value(Dwarf_Debug dw_dbg, |
| 4947 |
Dwarf_Unsigned dw_context_index, |
| 4948 |
Dwarf_Unsigned dw_offsetentry_index, |
| 4949 |
Dwarf_Unsigned * dw_offset_value_out, |
| 4950 |
Dwarf_Unsigned * dw_global_offset_value_out, |
| 4951 |
Dwarf_Error * dw_error); |
| 4952 |
|
| 4953 |
/*! @brief Return basic data about a loclists head |
| 4954 |
|
| 4955 |
Used by dwarfdump to print basic data from the |
| 4956 |
data generated to look at a specific loclist |
| 4957 |
context as returned by |
| 4958 |
dwarf_loclists_index_get_lle_head() |
| 4959 |
or |
| 4960 |
dwarf_loclists_offset_get_lle_head. |
| 4961 |
Here we know there was a Dwarf_Attribute so |
| 4962 |
additional things are known as compared to calling |
| 4963 |
dwarf_get_loclist_context_basics |
| 4964 |
See DWARF5 Section 7.20 Location List Table |
| 4965 |
page 243. |
| 4966 |
*/ |
| 4967 |
DW_API int dwarf_get_loclist_head_basics(Dwarf_Loc_Head_c dw_head, |
| 4968 |
Dwarf_Small * dw_lkind, |
| 4969 |
Dwarf_Unsigned * dw_lle_count, |
| 4970 |
Dwarf_Unsigned * dw_loclists_version, |
| 4971 |
Dwarf_Unsigned * dw_loclists_index_returned, |
| 4972 |
Dwarf_Unsigned * dw_bytes_total_in_rle, |
| 4973 |
Dwarf_Half * dw_offset_size, |
| 4974 |
Dwarf_Half * dw_address_size, |
| 4975 |
Dwarf_Half * dw_segment_selector_size, |
| 4976 |
Dwarf_Unsigned * dw_overall_offset_of_this_context, |
| 4977 |
Dwarf_Unsigned * dw_total_length_of_this_context, |
| 4978 |
Dwarf_Unsigned * dw_offset_table_offset, |
| 4979 |
Dwarf_Unsigned * dw_offset_table_entrycount, |
| 4980 |
Dwarf_Bool * dw_loclists_base_present, |
| 4981 |
Dwarf_Unsigned * dw_loclists_base, |
| 4982 |
Dwarf_Bool * dw_loclists_base_address_present, |
| 4983 |
Dwarf_Unsigned * dw_loclists_base_address, |
| 4984 |
Dwarf_Bool * dw_loclists_debug_addr_base_present, |
| 4985 |
Dwarf_Unsigned * dw_loclists_debug_addr_base, |
| 4986 |
Dwarf_Unsigned * dw_offset_this_lle_area, |
| 4987 |
Dwarf_Error * dw_error); |
| 4988 |
|
| 4989 |
/*! @brief Return basic data about a loclists context |
| 4990 |
|
| 4991 |
Some of the same values as from |
| 4992 |
dwarf_get_loclist_head_basics |
| 4993 |
but here without any dependence on data |
| 4994 |
derived from a CU context. |
| 4995 |
Useful to print raw loclist data. |
| 4996 |
*/ |
| 4997 |
DW_API int dwarf_get_loclist_context_basics(Dwarf_Debug dw_dbg, |
| 4998 |
Dwarf_Unsigned dw_index, |
| 4999 |
Dwarf_Unsigned * dw_header_offset, |
| 5000 |
Dwarf_Small * dw_offset_size, |
| 5001 |
Dwarf_Small * dw_extension_size, |
| 5002 |
unsigned int * dw_version, |
| 5003 |
Dwarf_Small * dw_address_size, |
| 5004 |
Dwarf_Small * dw_segment_selector_size, |
| 5005 |
Dwarf_Unsigned * dw_offset_entry_count, |
| 5006 |
Dwarf_Unsigned * dw_offset_of_offset_array, |
| 5007 |
Dwarf_Unsigned * dw_offset_of_first_locentry, |
| 5008 |
Dwarf_Unsigned * dw_offset_past_last_locentry, |
| 5009 |
Dwarf_Error * dw_error); |
| 5010 |
|
| 5011 |
/*! @brief Return basic data about a loclists context entry |
| 5012 |
|
| 5013 |
Useful to print raw loclist data. |
| 5014 |
*/ |
| 5015 |
DW_API int dwarf_get_loclist_lle( Dwarf_Debug dw_dbg, |
| 5016 |
Dwarf_Unsigned dw_contextnumber, |
| 5017 |
Dwarf_Unsigned dw_entry_offset, |
| 5018 |
Dwarf_Unsigned dw_endoffset, |
| 5019 |
unsigned int * dw_entrylen, |
| 5020 |
unsigned int * dw_entry_kind, |
| 5021 |
Dwarf_Unsigned * dw_entry_operand1, |
| 5022 |
Dwarf_Unsigned * dw_entry_operand2, |
| 5023 |
Dwarf_Unsigned * dw_expr_ops_blocksize, |
| 5024 |
Dwarf_Unsigned * dw_expr_ops_offset, |
| 5025 |
Dwarf_Small ** dw_expr_opsdata, |
| 5026 |
Dwarf_Error * dw_error); |
| 5027 |
/*! @} */ |
| 5028 |
|
| 5029 |
/*! @defgroup debugaddr .debug_addr access: DWARF5 |
| 5030 |
@{ |
| 5031 |
Reading just the .debug_addr section. |
| 5032 |
|
| 5033 |
These functions solely useful for reading |
| 5034 |
that section. It seems unlikely you would |
| 5035 |
have a reason to call these. The functions |
| 5036 |
getting attribute values use the section |
| 5037 |
when appropriate without using these |
| 5038 |
functions. |
| 5039 |
*/ |
| 5040 |
|
| 5041 |
/*! @brief Return a .debug_addr table |
| 5042 |
|
| 5043 |
Allocates and returns a pointer to a |
| 5044 |
Dwarf_Debug_Addr_Table as well as the contents |
| 5045 |
of the record. |
| 5046 |
|
| 5047 |
Other than dw_debug and dw_error and dw_table_header |
| 5048 |
a NULL passed in as a pointer |
| 5049 |
argument means the return value |
| 5050 |
will not be set through the pointer, so a caller |
| 5051 |
can pass NULL for return values of no |
| 5052 |
immediate interest. |
| 5053 |
|
| 5054 |
It is only intended to enable printing of the |
| 5055 |
simple DWARF5 .debug_addr section (by dwarfdump). |
| 5056 |
|
| 5057 |
When emitting DWARF4, gcc may emit a GNU-specified |
| 5058 |
.debug_addr format. If some CU has been opened then |
| 5059 |
this call will work, but the single table |
| 5060 |
will have all the entries for all CUs. |
| 5061 |
|
| 5062 |
@param dw_dbg |
| 5063 |
The Dwarf_Debug of interest. |
| 5064 |
@param dw_section_offset |
| 5065 |
Pass in the section offset of a table header. |
| 5066 |
Start with zero. |
| 5067 |
If the passed-in offset is past the last byte |
| 5068 |
of the table the function returns DW_DLV_NO_ENTRY. |
| 5069 |
@param dw_table_header |
| 5070 |
On success |
| 5071 |
Returns a pointer to a Dwarf_Debug_Addr_Table |
| 5072 |
for use with dwarf_get_attr_by_index(). |
| 5073 |
@param dw_length |
| 5074 |
On success |
| 5075 |
Returns the length in bytes of this |
| 5076 |
contribution to .debug_addr from the table header, |
| 5077 |
including the table length field and the array |
| 5078 |
of addresses. |
| 5079 |
@param dw_version |
| 5080 |
On success returns the version number, which |
| 5081 |
should be 5. |
| 5082 |
@param dw_address_size |
| 5083 |
On success returns the address size of the address |
| 5084 |
entries in this table. |
| 5085 |
@param dw_at_addr_base |
| 5086 |
On success returns the value that will appear |
| 5087 |
in some DW_AT_addr_base attribute. |
| 5088 |
@param dw_entry_count |
| 5089 |
On success returns the number of table entries |
| 5090 |
in this table instance. |
| 5091 |
@param dw_next_table_offset |
| 5092 |
On success returns the offset of the next table |
| 5093 |
in the section. Use the offset returned in the |
| 5094 |
next call to this function. |
| 5095 |
@param dw_error |
| 5096 |
The usual error detail return pointer. |
| 5097 |
@return |
| 5098 |
Returns DW_DLV_OK etc. |
| 5099 |
If the dw_section_offset passed in is out of range |
| 5100 |
it returns DW_DLV_NO_ENTRY. |
| 5101 |
If it returns DW_DLV_ERROR only dw_error is |
| 5102 |
set, none of the other |
| 5103 |
return values are set through the pointers. |
| 5104 |
*/ |
| 5105 |
|
| 5106 |
DW_API int dwarf_debug_addr_table(Dwarf_Debug dw_dbg, |
| 5107 |
Dwarf_Unsigned dw_section_offset, |
| 5108 |
Dwarf_Debug_Addr_Table *dw_table_header, |
| 5109 |
Dwarf_Unsigned *dw_length, |
| 5110 |
Dwarf_Half *dw_version, |
| 5111 |
Dwarf_Small *dw_address_size, |
| 5112 |
Dwarf_Unsigned *dw_at_addr_base, |
| 5113 |
Dwarf_Unsigned *dw_entry_count, |
| 5114 |
Dwarf_Unsigned *dw_next_table_offset, |
| 5115 |
Dwarf_Error *dw_error); |
| 5116 |
|
| 5117 |
/*! @brief Return .debug_addr address given table index |
| 5118 |
|
| 5119 |
@param dw_dat |
| 5120 |
Pass in a Dwarf_Debug_Addr_Table pointer. |
| 5121 |
@param dw_entry_index |
| 5122 |
Pass in a Dwarf_Debug_Addr_Table index to an address. |
| 5123 |
If out of the valid range 0 through |
| 5124 |
dw_entry_count-1 the function returns |
| 5125 |
DW_DLV_NO_ENTRY. |
| 5126 |
@param dw_address |
| 5127 |
Returns an address in the program through |
| 5128 |
the pointer. |
| 5129 |
@param dw_error |
| 5130 |
The usual error detail return pointer. |
| 5131 |
@return |
| 5132 |
Returns DW_DLV_OK etc. |
| 5133 |
If the dw_section_offset passed in is out of range |
| 5134 |
it returns DW_DLV_NO_ENTRY. |
| 5135 |
If it returns DW_DLV_ERROR only dw_error is |
| 5136 |
set, dw_address is not set. |
| 5137 |
*/ |
| 5138 |
|
| 5139 |
DW_API int dwarf_debug_addr_by_index(Dwarf_Debug_Addr_Table dw_dat, |
| 5140 |
Dwarf_Unsigned dw_entry_index, |
| 5141 |
Dwarf_Unsigned *dw_address, |
| 5142 |
Dwarf_Error *dw_error); |
| 5143 |
|
| 5144 |
/*! @brief dealloc (free) a Dwarf_Attr_Table record. |
| 5145 |
|
| 5146 |
@param dw_dat |
| 5147 |
Pass in a valid Dwarf_Debug_Addr_Table pointer. |
| 5148 |
Does nothing if the dw_dat field is NULL. |
| 5149 |
|
| 5150 |
*/ |
| 5151 |
DW_API void dwarf_dealloc_debug_addr_table( |
| 5152 |
Dwarf_Debug_Addr_Table dw_dat); |
| 5153 |
|
| 5154 |
/*! @} */ |
| 5155 |
|
| 5156 |
/*! @defgroup macro Macro Access: DWARF5 |
| 5157 |
|
| 5158 |
@{ |
| 5159 |
Reading the .debug_macro section. |
| 5160 |
|
| 5161 |
@see examplep5 An example reading .debug_macro |
| 5162 |
*/ |
| 5163 |
|
| 5164 |
/*! @brief DWARF5 .debug_macro access via Dwarf_Die |
| 5165 |
|
| 5166 |
@see examplep5 |
| 5167 |
|
| 5168 |
@param dw_die |
| 5169 |
The CU DIE of interest. |
| 5170 |
@param dw_version_out |
| 5171 |
On success returns the macro context version (5) |
| 5172 |
@param dw_macro_context |
| 5173 |
On success returns a pointer to a macro context |
| 5174 |
which allows access to the context content. |
| 5175 |
@param dw_macro_unit_offset_out |
| 5176 |
On success returns the offset of the macro context. |
| 5177 |
@param dw_macro_ops_count_out |
| 5178 |
On success returns the number of macro operations |
| 5179 |
in the context. |
| 5180 |
@param dw_macro_ops_data_length_out |
| 5181 |
On success returns the length in bytes of the |
| 5182 |
operations in the context. |
| 5183 |
@param dw_error |
| 5184 |
The usual error detail return pointer. |
| 5185 |
@return |
| 5186 |
Returns DW_DLV_OK etc. |
| 5187 |
If no .debug_macro section exists for the |
| 5188 |
CU it returns DW_DLV_NO_ENTRY. |
| 5189 |
*/ |
| 5190 |
DW_API int dwarf_get_macro_context(Dwarf_Die dw_die, |
| 5191 |
Dwarf_Unsigned * dw_version_out, |
| 5192 |
Dwarf_Macro_Context * dw_macro_context, |
| 5193 |
Dwarf_Unsigned * dw_macro_unit_offset_out, |
| 5194 |
Dwarf_Unsigned * dw_macro_ops_count_out, |
| 5195 |
Dwarf_Unsigned * dw_macro_ops_data_length_out, |
| 5196 |
Dwarf_Error * dw_error); |
| 5197 |
|
| 5198 |
/*! @brief DWARF5 .debug_macro access via Dwarf_Die and an offset |
| 5199 |
|
| 5200 |
@param dw_die |
| 5201 |
The CU DIE of interest. |
| 5202 |
@param dw_offset |
| 5203 |
The offset in the section to begin reading. |
| 5204 |
@param dw_version_out |
| 5205 |
On success returns the macro context version (5) |
| 5206 |
@param dw_macro_context |
| 5207 |
On success returns a pointer to a macro context |
| 5208 |
which allows access to the context content. |
| 5209 |
@param dw_macro_ops_count_out |
| 5210 |
On success returns the number of macro operations |
| 5211 |
in the context. |
| 5212 |
@param dw_macro_ops_data_length |
| 5213 |
On success returns the length in bytes of the |
| 5214 |
macro context, starting at the offset of the first |
| 5215 |
byte of the context. |
| 5216 |
@param dw_error |
| 5217 |
The usual error detail return pointer. |
| 5218 |
@return |
| 5219 |
Returns DW_DLV_OK etc. |
| 5220 |
If no .debug_macro section exists for the |
| 5221 |
CU it returns DW_DLV_NO_ENTRY. |
| 5222 |
If the dw_offset is outside the section it |
| 5223 |
returns DW_DLV_ERROR. |
| 5224 |
*/ |
| 5225 |
DW_API int dwarf_get_macro_context_by_offset(Dwarf_Die dw_die, |
| 5226 |
Dwarf_Unsigned dw_offset, |
| 5227 |
Dwarf_Unsigned * dw_version_out, |
| 5228 |
Dwarf_Macro_Context * dw_macro_context, |
| 5229 |
Dwarf_Unsigned * dw_macro_ops_count_out, |
| 5230 |
Dwarf_Unsigned * dw_macro_ops_data_length, |
| 5231 |
Dwarf_Error * dw_error); |
| 5232 |
|
| 5233 |
/* New December 2020. libdwarf 0.1.0 |
| 5234 |
Sometimes its necessary to know |
| 5235 |
a context total length including macro 5 header */ |
| 5236 |
/*! @brief Return a macro context total length |
| 5237 |
|
| 5238 |
@param dw_context |
| 5239 |
A pointer to the macro context of interest. |
| 5240 |
@param dw_mac_total_len |
| 5241 |
On success returns the length in bytes of |
| 5242 |
the macro context. |
| 5243 |
@param dw_error |
| 5244 |
The usual error detail return pointer. |
| 5245 |
@return |
| 5246 |
Returns DW_DLV_OK etc. |
| 5247 |
*/ |
| 5248 |
DW_API int dwarf_macro_context_total_length( |
| 5249 |
Dwarf_Macro_Context dw_context, |
| 5250 |
Dwarf_Unsigned * dw_mac_total_len, |
| 5251 |
Dwarf_Error * dw_error); |
| 5252 |
|
| 5253 |
/*! @brief Dealloc a macro context |
| 5254 |
|
| 5255 |
@param dw_mc |
| 5256 |
A pointer to the macro context of interest. |
| 5257 |
On return the caller should zero the pointer |
| 5258 |
as the pointer is then stale. |
| 5259 |
*/ |
| 5260 |
DW_API void dwarf_dealloc_macro_context(Dwarf_Macro_Context dw_mc); |
| 5261 |
|
| 5262 |
/*! @brief Access the internal details of a Dwarf_Macro_Context |
| 5263 |
|
| 5264 |
Not described in detail here. See DWARF5 Standard |
| 5265 |
Section 6.3.1 Macro Information Header page 166. |
| 5266 |
*/ |
| 5267 |
DW_API int dwarf_macro_context_head(Dwarf_Macro_Context dw_mc, |
| 5268 |
Dwarf_Half * dw_version, |
| 5269 |
Dwarf_Unsigned * dw_mac_offset, |
| 5270 |
Dwarf_Unsigned * dw_mac_len, |
| 5271 |
Dwarf_Unsigned * dw_mac_header_len, |
| 5272 |
unsigned int * dw_flags, |
| 5273 |
Dwarf_Bool * dw_has_line_offset, |
| 5274 |
Dwarf_Unsigned * dw_line_offset, |
| 5275 |
Dwarf_Bool * dw_has_offset_size_64, |
| 5276 |
Dwarf_Bool * dw_has_operands_table, |
| 5277 |
Dwarf_Half * dw_opcode_count, |
| 5278 |
Dwarf_Error * dw_error); |
| 5279 |
|
| 5280 |
/*! @brief Access to the details of the opcode operands table |
| 5281 |
|
| 5282 |
Not of much interest to most libdwarf users. |
| 5283 |
|
| 5284 |
@param dw_mc |
| 5285 |
The macro context of interest. |
| 5286 |
@param dw_index |
| 5287 |
The opcode operands table index. 0 through dw_opcode_count-1. |
| 5288 |
@param dw_opcode_number |
| 5289 |
On success returns the opcode number in the table. |
| 5290 |
@param dw_operand_count |
| 5291 |
On success returns the number of forms |
| 5292 |
for that dw_index. |
| 5293 |
@param dw_operand_array |
| 5294 |
On success returns the array of op operand |
| 5295 |
forms |
| 5296 |
@param dw_error |
| 5297 |
The usual error detail return pointer. |
| 5298 |
@return |
| 5299 |
Returns DW_DLV_OK etc. |
| 5300 |
|
| 5301 |
*/ |
| 5302 |
DW_API int dwarf_macro_operands_table(Dwarf_Macro_Context dw_mc, |
| 5303 |
Dwarf_Half dw_index, /* 0 to opcode_count -1 */ |
| 5304 |
Dwarf_Half * dw_opcode_number, |
| 5305 |
Dwarf_Half * dw_operand_count, |
| 5306 |
const Dwarf_Small ** dw_operand_array, |
| 5307 |
Dwarf_Error * dw_error); |
| 5308 |
|
| 5309 |
/*! @brief Access macro operation details of a single operation |
| 5310 |
|
| 5311 |
Useful for printing basic data about the operation. |
| 5312 |
|
| 5313 |
@param dw_macro_context |
| 5314 |
The macro context of interest. |
| 5315 |
@param dw_op_number |
| 5316 |
valid values are 0 through dw_macro_ops_count_out-1. |
| 5317 |
@param dw_op_start_section_offset |
| 5318 |
On success returns the section offset of this |
| 5319 |
operator. |
| 5320 |
@param dw_macro_operator |
| 5321 |
On success returns the the macro operator itself, |
| 5322 |
for example DW_MACRO_define. |
| 5323 |
@param dw_forms_count |
| 5324 |
On success returns the number of forms in the formcode array. |
| 5325 |
@param dw_formcode_array |
| 5326 |
On success returns a pointer to the formcode array |
| 5327 |
of operand forms. |
| 5328 |
@param dw_error |
| 5329 |
The usual error detail return pointer. |
| 5330 |
@return |
| 5331 |
Returns DW_DLV_OK etc. |
| 5332 |
*/ |
| 5333 |
DW_API int dwarf_get_macro_op(Dwarf_Macro_Context dw_macro_context, |
| 5334 |
Dwarf_Unsigned dw_op_number, |
| 5335 |
Dwarf_Unsigned * dw_op_start_section_offset, |
| 5336 |
Dwarf_Half * dw_macro_operator, |
| 5337 |
Dwarf_Half * dw_forms_count, |
| 5338 |
const Dwarf_Small ** dw_formcode_array, |
| 5339 |
Dwarf_Error * dw_error); |
| 5340 |
|
| 5341 |
/*! @brief Get Macro defundef |
| 5342 |
|
| 5343 |
To extract the value portion of a macro define: |
| 5344 |
@see dwarf_find_macro_value_start |
| 5345 |
|
| 5346 |
@param dw_macro_context |
| 5347 |
The macro context of interest. |
| 5348 |
@param dw_op_number |
| 5349 |
valid values are 0 through dw_macro_ops_count_out-1. |
| 5350 |
The op number must be for a def/undef. |
| 5351 |
@param dw_line_number |
| 5352 |
The line number in the user source for this define/undef |
| 5353 |
@param dw_index |
| 5354 |
On success if the macro is an strx form |
| 5355 |
the value returned |
| 5356 |
is the string index in the record, |
| 5357 |
otherwise zero is returned. |
| 5358 |
@param dw_offset |
| 5359 |
On success if the macro is an strp or sup form the value |
| 5360 |
returned is the string offset in the appropriate section, |
| 5361 |
otherwise zero is returned. |
| 5362 |
@param dw_forms_count |
| 5363 |
On success the value 2 is returned. |
| 5364 |
@param dw_macro_string |
| 5365 |
On success a pointer to a null-terminated |
| 5366 |
string is returned. |
| 5367 |
Do not dealloc or free this string. |
| 5368 |
@param dw_error |
| 5369 |
The usual error detail return pointer. |
| 5370 |
@return |
| 5371 |
Returns DW_DLV_OK etc. |
| 5372 |
It is an error if operator dw_op_number is not a |
| 5373 |
DW_MACRO_define, DW_MACRO_undef, DW_MACRO_define_strp |
| 5374 |
DW_MACRO_undef_strp, DW_MACRO_undef_sup, |
| 5375 |
DW_MACRO_undef_sup, |
| 5376 |
DW_MACRO_define_strx, or DW_MACRO_undef_strx, |
| 5377 |
*/ |
| 5378 |
DW_API int dwarf_get_macro_defundef( |
| 5379 |
Dwarf_Macro_Context dw_macro_context, |
| 5380 |
Dwarf_Unsigned dw_op_number, |
| 5381 |
Dwarf_Unsigned * dw_line_number, |
| 5382 |
Dwarf_Unsigned * dw_index, |
| 5383 |
Dwarf_Unsigned * dw_offset, |
| 5384 |
Dwarf_Half * dw_forms_count, |
| 5385 |
const char ** dw_macro_string, |
| 5386 |
Dwarf_Error * dw_error); |
| 5387 |
|
| 5388 |
/*! @brief Get Macro start end |
| 5389 |
|
| 5390 |
@param dw_macro_context |
| 5391 |
The macro context of interest. |
| 5392 |
@param dw_op_number |
| 5393 |
Valid values are 0 through dw_macro_ops_count_out-1. |
| 5394 |
The op number must be for a start/end. |
| 5395 |
@param dw_line_number |
| 5396 |
If end_file nothing is returned here. |
| 5397 |
If start_file on success returns the line number |
| 5398 |
of the source line of the include directive. |
| 5399 |
@param dw_name_index_to_line_tab |
| 5400 |
If end_file nothing is returned here. |
| 5401 |
If start_file on success returns the file name |
| 5402 |
index in the line table file names table. |
| 5403 |
@param dw_src_file_name |
| 5404 |
If end_file nothing is returned here. |
| 5405 |
If start_file on success returns a pointer to |
| 5406 |
the null-terminated source file name. |
| 5407 |
Do not free or dealloc this string. |
| 5408 |
@param dw_error |
| 5409 |
The usual error detail return pointer. |
| 5410 |
@return |
| 5411 |
Returns DW_DLV_OK etc. |
| 5412 |
It is an error if the operator is not |
| 5413 |
DW_MACRO_start_file or DW_MACRO_end_file. |
| 5414 |
*/ |
| 5415 |
DW_API int dwarf_get_macro_startend_file( |
| 5416 |
Dwarf_Macro_Context dw_macro_context, |
| 5417 |
Dwarf_Unsigned dw_op_number, |
| 5418 |
Dwarf_Unsigned * dw_line_number, |
| 5419 |
Dwarf_Unsigned * dw_name_index_to_line_tab, |
| 5420 |
const char ** dw_src_file_name, |
| 5421 |
Dwarf_Error * dw_error); |
| 5422 |
|
| 5423 |
/*! @brief Get Macro import |
| 5424 |
|
| 5425 |
@param dw_macro_context |
| 5426 |
The macro context of interest. |
| 5427 |
@param dw_op_number |
| 5428 |
Valid values are 0 through dw_macro_ops_count_out-1. |
| 5429 |
@param dw_target_offset |
| 5430 |
Returns the offset in the imported section. |
| 5431 |
@param dw_error |
| 5432 |
The usual error detail return pointer. |
| 5433 |
@return |
| 5434 |
Returns DW_DLV_OK etc. |
| 5435 |
It is an error if the operator is not |
| 5436 |
DW_MACRO_import or DW_MACRO_import_sup. |
| 5437 |
*/ |
| 5438 |
DW_API int dwarf_get_macro_import( |
| 5439 |
Dwarf_Macro_Context dw_macro_context, |
| 5440 |
Dwarf_Unsigned dw_op_number, |
| 5441 |
Dwarf_Unsigned * dw_target_offset, |
| 5442 |
Dwarf_Error * dw_error); |
| 5443 |
/*! @} */ |
| 5444 |
|
| 5445 |
/*! @defgroup macinfo Macro Access: DWARF2-4 |
| 5446 |
|
| 5447 |
@{ |
| 5448 |
Reading the .debug_macinfo section. |
| 5449 |
|
| 5450 |
The section is rarely used since it takes a lot |
| 5451 |
of disk space. DWARF5 has much more compact |
| 5452 |
macro data (in section .debug_macro). |
| 5453 |
|
| 5454 |
For an example see |
| 5455 |
@see examplep2 An example reading .debug_macinfo |
| 5456 |
|
| 5457 |
*/ |
| 5458 |
/*! @brief Return a pointer to the value part of a macro |
| 5459 |
|
| 5460 |
This function Works for all versions, DWARF2-DWARF5 |
| 5461 |
|
| 5462 |
@param dw_macro_string |
| 5463 |
The macro string passed in should be properly formatted |
| 5464 |
with a name, a space, and then the value portion (whether |
| 5465 |
a function-like macro or not function-like). |
| 5466 |
@returns |
| 5467 |
On success it returns a pointer to the value portion |
| 5468 |
of the macro. On failure it returns a pointer |
| 5469 |
to a NUL byte (so a zero-length string). |
| 5470 |
*/ |
| 5471 |
DW_API char* dwarf_find_macro_value_start(char * dw_macro_string); |
| 5472 |
|
| 5473 |
/*! @brief Getting .debug_macinfo macro details. |
| 5474 |
|
| 5475 |
@link examplep2 An example calling this function @endlink |
| 5476 |
|
| 5477 |
@see examplep2 |
| 5478 |
|
| 5479 |
@param dw_dbg |
| 5480 |
The Dwarf_Debug of interest. |
| 5481 |
@param dw_macro_offset |
| 5482 |
The offset in the section you wish to start from. |
| 5483 |
@param dw_maximum_count |
| 5484 |
Pass in a count to ensure we will not allocate |
| 5485 |
an excessive amount (guarding against a |
| 5486 |
|
| 5487 |
@param dw_entry_count |
| 5488 |
On success returns a count of the macro operations |
| 5489 |
in a CU macro set. |
| 5490 |
@param dw_details |
| 5491 |
On success returns a pointer to an array of |
| 5492 |
struct DW_Macro_Details_s . |
| 5493 |
@param dw_error |
| 5494 |
The usual error detail return pointer. |
| 5495 |
@return |
| 5496 |
Returns DW_DLV_OK etc. |
| 5497 |
*/ |
| 5498 |
DW_API int dwarf_get_macro_details(Dwarf_Debug dw_dbg, |
| 5499 |
Dwarf_Off dw_macro_offset, |
| 5500 |
Dwarf_Unsigned dw_maximum_count, |
| 5501 |
Dwarf_Signed * dw_entry_count, |
| 5502 |
Dwarf_Macro_Details ** dw_details, |
| 5503 |
Dwarf_Error * dw_error); |
| 5504 |
|
| 5505 |
/*! @} */ |
| 5506 |
|
| 5507 |
/*! @defgroup frame Stack Frame Access |
| 5508 |
|
| 5509 |
@{ |
| 5510 |
Use to access DWARF2-5 .debug_frame and GNU .eh_frame |
| 5511 |
sections. Does not evaluate frame instructions, but |
| 5512 |
provides detailed data so it is possible do that |
| 5513 |
yourself. |
| 5514 |
|
| 5515 |
*/ |
| 5516 |
|
| 5517 |
/*! @brief Get lists of .debug_frame FDEs and CIEs |
| 5518 |
|
| 5519 |
See DWARF5 Section 6.4 Call Frame Information, |
| 5520 |
page 171. |
| 5521 |
|
| 5522 |
@see exampleq |
| 5523 |
|
| 5524 |
The FDE array returned through dw_fde_data |
| 5525 |
is sorted low-to-high by the lowest-pc in each FDE. |
| 5526 |
|
| 5527 |
@param dw_dbg |
| 5528 |
The Dwarf_Debug of interest. |
| 5529 |
@param dw_cie_data |
| 5530 |
On success |
| 5531 |
returns a pointer to an array of pointers to CIE data. |
| 5532 |
@param dw_cie_element_count |
| 5533 |
On success returns a count of the number of elements |
| 5534 |
in the dw_cie_data array. |
| 5535 |
@param dw_fde_data |
| 5536 |
On success |
| 5537 |
returns a pointer to an array of pointers to FDE data. |
| 5538 |
@param dw_fde_element_count |
| 5539 |
On success returns a count of the number of elements |
| 5540 |
in the dw_fde_data array. |
| 5541 |
On success |
| 5542 |
@param dw_error |
| 5543 |
The usual error detail return pointer. |
| 5544 |
@return |
| 5545 |
Returns DW_DLV_OK etc. |
| 5546 |
*/ |
| 5547 |
DW_API int dwarf_get_fde_list(Dwarf_Debug dw_dbg, |
| 5548 |
Dwarf_Cie** dw_cie_data, |
| 5549 |
Dwarf_Signed* dw_cie_element_count, |
| 5550 |
Dwarf_Fde** dw_fde_data, |
| 5551 |
Dwarf_Signed* dw_fde_element_count, |
| 5552 |
Dwarf_Error* dw_error); |
| 5553 |
/*! @brief Get lists of .eh_frame FDEs and CIEs |
| 5554 |
|
| 5555 |
The arguments are identical to the previous |
| 5556 |
function, the difference is the section read. |
| 5557 |
The GNU-defined .eh_frame section is very similar to |
| 5558 |
.debug_frame but has unique features that |
| 5559 |
matter when following a stack trace. |
| 5560 |
@see dwarf_get_fde_list |
| 5561 |
*/ |
| 5562 |
DW_API int dwarf_get_fde_list_eh(Dwarf_Debug dw_dbg, |
| 5563 |
Dwarf_Cie** dw_cie_data, |
| 5564 |
Dwarf_Signed* dw_cie_element_count, |
| 5565 |
Dwarf_Fde** dw_fde_data, |
| 5566 |
Dwarf_Signed* dw_fde_element_count, |
| 5567 |
Dwarf_Error* dw_error); |
| 5568 |
|
| 5569 |
/*! @brief Release storage associated with FDE and CIE arrays |
| 5570 |
|
| 5571 |
Applies to .eh_frame and .debug_frame |
| 5572 |
lists. |
| 5573 |
|
| 5574 |
@param dw_dbg |
| 5575 |
The Dwarf_Debug used in the list setup. |
| 5576 |
@param dw_cie_data |
| 5577 |
As returned from the list setup call. |
| 5578 |
@param dw_cie_element_count |
| 5579 |
@param dw_fde_data |
| 5580 |
As returned from the list setup call. |
| 5581 |
@param dw_fde_element_count |
| 5582 |
As returned from the list setup call. |
| 5583 |
|
| 5584 |
On return the pointers passed in dw_cie_data |
| 5585 |
and dw_fde_data should be zeroed by the |
| 5586 |
caller as they are then stale pointers. |
| 5587 |
*/ |
| 5588 |
DW_API void dwarf_dealloc_fde_cie_list(Dwarf_Debug dw_dbg, |
| 5589 |
Dwarf_Cie * dw_cie_data, |
| 5590 |
Dwarf_Signed dw_cie_element_count, |
| 5591 |
Dwarf_Fde * dw_fde_data, |
| 5592 |
Dwarf_Signed dw_fde_element_count); |
| 5593 |
|
| 5594 |
/*! @brief Return the FDE data for a single FDE |
| 5595 |
|
| 5596 |
@param dw_fde |
| 5597 |
The FDE of interest. |
| 5598 |
@param dw_low_pc |
| 5599 |
On success |
| 5600 |
returns the low pc value for the function involved. |
| 5601 |
@param dw_func_length |
| 5602 |
On success returns the length of the function |
| 5603 |
code in bytes. |
| 5604 |
@param dw_fde_bytes |
| 5605 |
On success |
| 5606 |
returns a pointer to the bytes of the FDE. |
| 5607 |
@param dw_fde_byte_length |
| 5608 |
On success returns the length of the |
| 5609 |
dw_fde_bytes area. |
| 5610 |
@param dw_cie_offset |
| 5611 |
On success returns the section offset of the associated CIE. |
| 5612 |
@param dw_cie_index |
| 5613 |
On success returns the CIE index of the associated CIE. |
| 5614 |
@param dw_fde_offset |
| 5615 |
On success returns the section offset of this FDE. |
| 5616 |
@param dw_error |
| 5617 |
The usual error detail return pointer. |
| 5618 |
@return |
| 5619 |
Returns DW_DLV_OK etc. |
| 5620 |
*/ |
| 5621 |
DW_API int dwarf_get_fde_range(Dwarf_Fde dw_fde, |
| 5622 |
Dwarf_Addr* dw_low_pc, |
| 5623 |
Dwarf_Unsigned* dw_func_length, |
| 5624 |
Dwarf_Small **dw_fde_bytes, |
| 5625 |
Dwarf_Unsigned* dw_fde_byte_length, |
| 5626 |
Dwarf_Off* dw_cie_offset, |
| 5627 |
Dwarf_Signed* dw_cie_index, |
| 5628 |
Dwarf_Off* dw_fde_offset, |
| 5629 |
Dwarf_Error* dw_error); |
| 5630 |
|
| 5631 |
/*! @brief IRIX only access to C++ destructor tables |
| 5632 |
|
| 5633 |
This applies only to IRIX C++ destructor information |
| 5634 |
which was never documented and is unlikely to be of interest. |
| 5635 |
*/ |
| 5636 |
DW_API int dwarf_get_fde_exception_info(Dwarf_Fde dw_fde, |
| 5637 |
Dwarf_Signed* dw_offset_into_exception_tables, |
| 5638 |
Dwarf_Error* dw_error); |
| 5639 |
|
| 5640 |
/*! @brief Given FDE get CIE |
| 5641 |
|
| 5642 |
@param dw_fde |
| 5643 |
The FDE of interest. |
| 5644 |
@param dw_cie_returned |
| 5645 |
On success returns a pointer to the applicable CIE. |
| 5646 |
@param dw_error |
| 5647 |
The usual error detail return pointer. |
| 5648 |
@return |
| 5649 |
Returns DW_DLV_OK etc. |
| 5650 |
*/ |
| 5651 |
DW_API int dwarf_get_cie_of_fde(Dwarf_Fde dw_fde, |
| 5652 |
Dwarf_Cie * dw_cie_returned, |
| 5653 |
Dwarf_Error* dw_error); |
| 5654 |
|
| 5655 |
/*! @brief Given a CIE get access to its content |
| 5656 |
|
| 5657 |
@param dw_cie |
| 5658 |
Pass in the CIE of interest. |
| 5659 |
@param dw_bytes_in_cie |
| 5660 |
On success, returns the length of the CIE in bytes. |
| 5661 |
@param dw_version |
| 5662 |
On success, returns the CIE version number. |
| 5663 |
@param dw_augmenter |
| 5664 |
On success, returns a pointer to the augmentation |
| 5665 |
string (which could be the empty string). |
| 5666 |
@param dw_code_alignment_factor |
| 5667 |
On success, returns a the code_alignment_factor |
| 5668 |
used to interpret CIE/FDE operations. |
| 5669 |
@param dw_data_alignment_factor |
| 5670 |
On success, returns a the data_alignment_factor |
| 5671 |
used to interpret CIE/FDE operations. |
| 5672 |
@param dw_return_address_register_rule |
| 5673 |
On success, returns a register number of the |
| 5674 |
return address register. |
| 5675 |
@param dw_initial_instructions |
| 5676 |
On success, returns a pointer to the bytes |
| 5677 |
of initial_instructions in the CIE. |
| 5678 |
@param dw_initial_instructions_length |
| 5679 |
On success, returns the length in bytes of |
| 5680 |
the initial_instructions. |
| 5681 |
@param dw_offset_size |
| 5682 |
On success, returns the offset_size within this CIE. |
| 5683 |
@param dw_error |
| 5684 |
The usual error detail return pointer. |
| 5685 |
@return |
| 5686 |
Returns DW_DLV_OK etc. |
| 5687 |
*/ |
| 5688 |
DW_API int dwarf_get_cie_info_b(Dwarf_Cie dw_cie, |
| 5689 |
Dwarf_Unsigned * dw_bytes_in_cie, |
| 5690 |
Dwarf_Small* dw_version, |
| 5691 |
char ** dw_augmenter, |
| 5692 |
Dwarf_Unsigned* dw_code_alignment_factor, |
| 5693 |
Dwarf_Signed* dw_data_alignment_factor, |
| 5694 |
Dwarf_Half* dw_return_address_register_rule, |
| 5695 |
Dwarf_Small ** dw_initial_instructions, |
| 5696 |
Dwarf_Unsigned* dw_initial_instructions_length, |
| 5697 |
Dwarf_Half* dw_offset_size, |
| 5698 |
Dwarf_Error* dw_error); |
| 5699 |
|
| 5700 |
/*! @brief Return CIE index given CIE |
| 5701 |
|
| 5702 |
@param dw_cie |
| 5703 |
Pass in the CIE of interest. |
| 5704 |
@param dw_index |
| 5705 |
On success, returns the index (the position |
| 5706 |
of the CIE in the CIE pointer array). |
| 5707 |
@param dw_error |
| 5708 |
The usual error detail return pointer. |
| 5709 |
@return |
| 5710 |
Returns DW_DLV_OK etc. |
| 5711 |
*/ |
| 5712 |
DW_API int dwarf_get_cie_index(Dwarf_Cie dw_cie, |
| 5713 |
Dwarf_Signed* dw_index, |
| 5714 |
Dwarf_Error * dw_error); |
| 5715 |
|
| 5716 |
/*! @brief Return length and pointer to access frame instructions. |
| 5717 |
|
| 5718 |
@see dwarf_expand_frame_instructions |
| 5719 |
@see examples |
| 5720 |
|
| 5721 |
@param dw_fde |
| 5722 |
Pass in the FDE of interest. |
| 5723 |
@param dw_outinstrs |
| 5724 |
On success returns a pointer to the FDE instruction byte |
| 5725 |
stream. |
| 5726 |
@param dw_outlen |
| 5727 |
On success returns the length of the dw_outinstrs byte |
| 5728 |
stream. |
| 5729 |
@param dw_error |
| 5730 |
The usual error detail return pointer. |
| 5731 |
@return |
| 5732 |
Returns DW_DLV_OK etc. |
| 5733 |
*/ |
| 5734 |
DW_API int dwarf_get_fde_instr_bytes(Dwarf_Fde dw_fde, |
| 5735 |
Dwarf_Small ** dw_outinstrs, |
| 5736 |
Dwarf_Unsigned * dw_outlen, |
| 5737 |
Dwarf_Error * dw_error); |
| 5738 |
|
| 5739 |
/*! @brief Return information on frame registers at a given pc value |
| 5740 |
|
| 5741 |
An FDE at a given pc (code address) |
| 5742 |
This function is new in October 2023 version 0.9.0. |
| 5743 |
|
| 5744 |
@param dw_fde |
| 5745 |
Pass in the FDE of interest. |
| 5746 |
@param dw_pc_requested |
| 5747 |
Pass in a pc (code) address inside that FDE. |
| 5748 |
@param dw_reg_table |
| 5749 |
On success, returns a pointer to a struct |
| 5750 |
given the frame state. |
| 5751 |
@param dw_row_pc |
| 5752 |
On success returns the address of the row of |
| 5753 |
frame data which may be a few counts off of |
| 5754 |
the pc requested. |
| 5755 |
@param dw_has_more_rows |
| 5756 |
On success returns FALSE if there are no more rows, |
| 5757 |
otherwise returns TRUE. |
| 5758 |
@param dw_subsequent_pc |
| 5759 |
On success this returns the address of the next pc |
| 5760 |
for which there is a register row, making access |
| 5761 |
to all the rows in sequence much more efficient |
| 5762 |
than just adding 1 to a pc value. |
| 5763 |
@param dw_error |
| 5764 |
The usual error detail return pointer. |
| 5765 |
@return |
| 5766 |
Returns DW_DLV_OK if the dw_pc_requested is in the |
| 5767 |
FDE passed in and there is some applicable row |
| 5768 |
in the table. |
| 5769 |
|
| 5770 |
*/ |
| 5771 |
DW_API int dwarf_get_fde_info_for_all_regs3_b(Dwarf_Fde dw_fde, |
| 5772 |
Dwarf_Addr dw_pc_requested, |
| 5773 |
Dwarf_Regtable3* dw_reg_table, |
| 5774 |
Dwarf_Addr* dw_row_pc, |
| 5775 |
Dwarf_Bool* dw_has_more_rows, |
| 5776 |
Dwarf_Addr* dw_subsequent_pc, |
| 5777 |
Dwarf_Error* dw_error); |
| 5778 |
|
| 5779 |
/*! @brief @brief Return information on frame registers at a given pc value |
| 5780 |
|
| 5781 |
Identical to dwarf_get_fde_info_for_all_regs3_b() except that |
| 5782 |
this doesn't output dw_has_more_rows and dw_subsequent_pc. |
| 5783 |
|
| 5784 |
If you need to iterate through all rows of the FDE, consider |
| 5785 |
switching to dwarf_get_fde_info_for_all_regs3_b() as it is more |
| 5786 |
efficient. |
| 5787 |
*/ |
| 5788 |
DW_API int dwarf_get_fde_info_for_all_regs3(Dwarf_Fde dw_fde, |
| 5789 |
Dwarf_Addr dw_pc_requested, |
| 5790 |
Dwarf_Regtable3* dw_reg_table, |
| 5791 |
Dwarf_Addr* dw_row_pc, |
| 5792 |
Dwarf_Error* dw_error); |
| 5793 |
|
| 5794 |
/* See discussion of dw_value_type, libdwarf.h. */ |
| 5795 |
/*! @brief Return details about a particular pc and register. |
| 5796 |
|
| 5797 |
It is efficient to iterate across all table_columns (registers) |
| 5798 |
using this function (dwarf_get_fde_info_for_reg3_c()). |
| 5799 |
Or one could instead call dwarf_get_fde_info_for_all_regs3() |
| 5800 |
and index into the table it fills in. |
| 5801 |
|
| 5802 |
If dw_value_type == DW_EXPR_EXPRESSION or |
| 5803 |
DW_EXPR_VALUE_EXPRESSION dw_offset |
| 5804 |
is not set and the caller must |
| 5805 |
evaluate the expression, which usually depends |
| 5806 |
on runtime frame data which cannot be calculated |
| 5807 |
without a stack frame including registers (etc). |
| 5808 |
|
| 5809 |
dwarf_get_fde_info_for_reg3_c() is new in libdwarf 0.8.0. |
| 5810 |
It corrects the incorrect type of the dw_offset |
| 5811 |
argument in dwarf_get_fde_info_for_reg3_b(). |
| 5812 |
Both versions operate correctly. |
| 5813 |
|
| 5814 |
@param dw_fde |
| 5815 |
Pass in the FDE of interest. |
| 5816 |
@param dw_table_column |
| 5817 |
Pass in the table_column, column numbers in the table |
| 5818 |
are 0 through the number_of_registers-1. |
| 5819 |
@param dw_pc_requested |
| 5820 |
Pass in the pc of interest within dw_fde. |
| 5821 |
@param dw_value_type |
| 5822 |
On success returns the value type, a DW_EXPR value. |
| 5823 |
For example DW_EXPR_EXPRESSION |
| 5824 |
@param dw_offset_relevant |
| 5825 |
On success returns FALSE if the offset value is |
| 5826 |
irrelevant, otherwise TRUE. |
| 5827 |
@param dw_register |
| 5828 |
On success returns a register number. |
| 5829 |
@param dw_offset |
| 5830 |
On success returns a signed register offset value when |
| 5831 |
dw_value_type is DW_EXPR_OFFSET or DW_EXPER_VAL_OFFSET. |
| 5832 |
@param dw_block_content |
| 5833 |
On success returns a pointer to a block. |
| 5834 |
For example, for DW_EXPR_EXPRESSION the block |
| 5835 |
gives access to the expression bytes. |
| 5836 |
@param dw_row_pc_out |
| 5837 |
On success returns the address of the actual pc |
| 5838 |
for this register at this pc. |
| 5839 |
@param dw_has_more_rows |
| 5840 |
On success returns FALSE if there are no more rows, |
| 5841 |
otherwise returns TRUE. |
| 5842 |
@param dw_subsequent_pc |
| 5843 |
On success this returns the address of the next pc |
| 5844 |
for which there is a register row, making access |
| 5845 |
to all the rows in sequence much more efficient |
| 5846 |
than just adding 1 to a pc value. |
| 5847 |
@param dw_error |
| 5848 |
The usual error detail return pointer. |
| 5849 |
@return |
| 5850 |
Returns DW_DLV_OK if the dw_pc_requested is in the |
| 5851 |
FDE passed in and there is a row for the pc |
| 5852 |
in the table. |
| 5853 |
*/ |
| 5854 |
DW_API int dwarf_get_fde_info_for_reg3_c(Dwarf_Fde dw_fde, |
| 5855 |
Dwarf_Half dw_table_column, |
| 5856 |
Dwarf_Addr dw_pc_requested, |
| 5857 |
Dwarf_Small * dw_value_type, |
| 5858 |
Dwarf_Unsigned * dw_offset_relevant, |
| 5859 |
Dwarf_Unsigned * dw_register, |
| 5860 |
Dwarf_Signed * dw_offset, |
| 5861 |
Dwarf_Block * dw_block_content, |
| 5862 |
Dwarf_Addr * dw_row_pc_out, |
| 5863 |
Dwarf_Bool * dw_has_more_rows, |
| 5864 |
Dwarf_Addr * dw_subsequent_pc, |
| 5865 |
Dwarf_Error * dw_error); |
| 5866 |
|
| 5867 |
/*! @brief Return details about a particular pc and register. |
| 5868 |
|
| 5869 |
Identical to dwarf_get_fde_info_for_reg3_c() except that |
| 5870 |
this returns dw_offset as a Dwarf_Unsigned, which |
| 5871 |
was never appropriate, and required you to |
| 5872 |
cast that value to Dwarf_Signed to use it properly.. |
| 5873 |
|
| 5874 |
Please switch to using dwarf_get_fde_info_for_reg3_c() |
| 5875 |
*/ |
| 5876 |
DW_API int dwarf_get_fde_info_for_reg3_b(Dwarf_Fde dw_fde, |
| 5877 |
Dwarf_Half dw_table_column, |
| 5878 |
Dwarf_Addr dw_pc_requested, |
| 5879 |
Dwarf_Small * dw_value_type, |
| 5880 |
Dwarf_Unsigned * dw_offset_relevant, |
| 5881 |
Dwarf_Unsigned * dw_register, |
| 5882 |
Dwarf_Unsigned * dw_offset, |
| 5883 |
Dwarf_Block * dw_block_content, |
| 5884 |
Dwarf_Addr * dw_row_pc_out, |
| 5885 |
Dwarf_Bool * dw_has_more_rows, |
| 5886 |
Dwarf_Addr * dw_subsequent_pc, |
| 5887 |
Dwarf_Error * dw_error); |
| 5888 |
|
| 5889 |
/*! @brief Get the value of the CFA for a particular pc value |
| 5890 |
|
| 5891 |
@see dwarf_get_fde_info_for_reg3_c() |
| 5892 |
has essentially the same return values as |
| 5893 |
dwarf_get_fde_info_for_reg3_c but |
| 5894 |
it refers to the CFA (which is not part of the register |
| 5895 |
table) so this function has no table column argument. |
| 5896 |
|
| 5897 |
New in September 2023, release 0.8.0. |
| 5898 |
dwarf_get_fde_info_for_cfa_reg3_c() returns dw_offset |
| 5899 |
as a signed type. |
| 5900 |
dwarf_get_fde_info_for_cfa_reg3_b() returns dw_offset |
| 5901 |
as an unsigned type, requiring the caller to cast |
| 5902 |
to Dwarf_Signed before using the value. |
| 5903 |
Both versions exist and operate properly. |
| 5904 |
|
| 5905 |
If dw_value_type == DW_EXPR_EXPRESSION or |
| 5906 |
DW_EXPR_VALUE_EXPRESSION dw_offset |
| 5907 |
is not set and the caller must |
| 5908 |
evaluate the expression, which usually depends |
| 5909 |
on runtime frame data which cannot be calculated |
| 5910 |
without a stack frame including register values (etc). |
| 5911 |
*/ |
| 5912 |
DW_API int dwarf_get_fde_info_for_cfa_reg3_c(Dwarf_Fde dw_fde, |
| 5913 |
Dwarf_Addr dw_pc_requested, |
| 5914 |
Dwarf_Small * dw_value_type, |
| 5915 |
Dwarf_Unsigned* dw_offset_relevant, |
| 5916 |
Dwarf_Unsigned* dw_register, |
| 5917 |
Dwarf_Signed * dw_offset, |
| 5918 |
Dwarf_Block * dw_block, |
| 5919 |
Dwarf_Addr * dw_row_pc_out, |
| 5920 |
Dwarf_Bool * dw_has_more_rows, |
| 5921 |
Dwarf_Addr * dw_subsequent_pc, |
| 5922 |
Dwarf_Error * dw_error); |
| 5923 |
/*! @brief Get the value of the CFA for a particular pc value |
| 5924 |
|
| 5925 |
@see dwarf_get_fde_info_for_cfa_reg3_c |
| 5926 |
|
| 5927 |
This is the earlier version that returns a dw_offset |
| 5928 |
of type Dwarf_Unsigned, requiring you to cast to Dwarf_Signed |
| 5929 |
to work with the value. |
| 5930 |
|
| 5931 |
*/ |
| 5932 |
DW_API int dwarf_get_fde_info_for_cfa_reg3_b(Dwarf_Fde dw_fde, |
| 5933 |
Dwarf_Addr dw_pc_requested, |
| 5934 |
Dwarf_Small * dw_value_type, |
| 5935 |
Dwarf_Unsigned* dw_offset_relevant, |
| 5936 |
Dwarf_Unsigned* dw_register, |
| 5937 |
Dwarf_Unsigned* dw_offset, |
| 5938 |
Dwarf_Block * dw_block, |
| 5939 |
Dwarf_Addr * dw_row_pc_out, |
| 5940 |
Dwarf_Bool * dw_has_more_rows, |
| 5941 |
Dwarf_Addr * dw_subsequent_pc, |
| 5942 |
Dwarf_Error * dw_error); |
| 5943 |
|
| 5944 |
/*! @brief Get the fde given DW_AT_MIPS_fde in a DIE. |
| 5945 |
|
| 5946 |
This is essentially useless as only SGI/MIPS compilers |
| 5947 |
from the 1990's had DW_AT_MIPS_fde in |
| 5948 |
DW_TAG_subprogram DIEs and this relies |
| 5949 |
on that attribute to work. |
| 5950 |
|
| 5951 |
*/ |
| 5952 |
DW_API int dwarf_get_fde_for_die(Dwarf_Debug dw_dbg, |
| 5953 |
Dwarf_Die dw_subr_die, |
| 5954 |
Dwarf_Fde * dw_returned_fde, |
| 5955 |
Dwarf_Error* dw_error); |
| 5956 |
|
| 5957 |
/*! @brief Retrieve an FDE from an FDE table |
| 5958 |
|
| 5959 |
This is just like indexing into the FDE array |
| 5960 |
but with extra checking of the pointer and |
| 5961 |
index. |
| 5962 |
@see dwarf_get_fde_list |
| 5963 |
*/ |
| 5964 |
DW_API int dwarf_get_fde_n(Dwarf_Fde* dw_fde_data, |
| 5965 |
Dwarf_Unsigned dw_fde_index, |
| 5966 |
Dwarf_Fde * dw_returned_fde, |
| 5967 |
Dwarf_Error * dw_error); |
| 5968 |
|
| 5969 |
/*! @brief Retrieve an FDE given a pc |
| 5970 |
|
| 5971 |
Using binary search this finds the FDE |
| 5972 |
that contains this dw_pc_of_interest |
| 5973 |
That works because libdwarf ensures the |
| 5974 |
array of FDEs is sorted by the low-pc |
| 5975 |
@see dwarf_get_fde_list |
| 5976 |
|
| 5977 |
@param dw_fde_data |
| 5978 |
Pass in a pointer an array of fde pointers. |
| 5979 |
@param dw_pc_of_interest |
| 5980 |
The pc value of interest. |
| 5981 |
@param dw_returned_fde |
| 5982 |
On success a pointer to the applicable FDE |
| 5983 |
is set through the pointer. |
| 5984 |
@param dw_lopc |
| 5985 |
On success a pointer to the low pc in dw_returned_fde |
| 5986 |
is set through the pointer. |
| 5987 |
@param dw_hipc |
| 5988 |
On success a pointer to the high pc (one past |
| 5989 |
the actual last byte address) in dw_returned_fde |
| 5990 |
is set through the pointer. |
| 5991 |
@param dw_error |
| 5992 |
The usual error detail return pointer. |
| 5993 |
@return |
| 5994 |
Returns DW_DLV_OK if the dw_pc_of_interest found |
| 5995 |
in some FDE in the array. |
| 5996 |
If no FDE is found containing dw_pc_of_interest |
| 5997 |
DW_DLV_NO_ENTRY is returned. |
| 5998 |
*/ |
| 5999 |
DW_API int dwarf_get_fde_at_pc(Dwarf_Fde* dw_fde_data, |
| 6000 |
Dwarf_Addr dw_pc_of_interest, |
| 6001 |
Dwarf_Fde * dw_returned_fde, |
| 6002 |
Dwarf_Addr * dw_lopc, |
| 6003 |
Dwarf_Addr * dw_hipc, |
| 6004 |
Dwarf_Error* dw_error); |
| 6005 |
|
| 6006 |
/*! @brief Return .eh_frame CIE augmentation data. |
| 6007 |
|
| 6008 |
GNU .eh_frame CIE augmentation information. |
| 6009 |
See Linux Standard Base Core Specification version 3.0 . |
| 6010 |
@see https://gcc.gnu.org/legacy-ml/gcc/2003-12/msg01168.html |
| 6011 |
|
| 6012 |
@param dw_cie |
| 6013 |
The CIE of interest. |
| 6014 |
@param dw_augdata |
| 6015 |
On success returns a pointer to the augmentation data. |
| 6016 |
@param dw_augdata_len |
| 6017 |
On success returns the length in bytes of the augmentation data. |
| 6018 |
@param dw_error |
| 6019 |
The usual error detail return pointer. |
| 6020 |
@return |
| 6021 |
Returns DW_DLV_OK etc. |
| 6022 |
If the augmentation data length is zero it |
| 6023 |
returns DW_DLV_NO_ENTRY. |
| 6024 |
*/ |
| 6025 |
DW_API int dwarf_get_cie_augmentation_data(Dwarf_Cie dw_cie, |
| 6026 |
Dwarf_Small ** dw_augdata, |
| 6027 |
Dwarf_Unsigned * dw_augdata_len, |
| 6028 |
Dwarf_Error* dw_error); |
| 6029 |
|
| 6030 |
/*! @brief Return .eh_frame FDE augmentation data. |
| 6031 |
|
| 6032 |
GNU .eh_frame FDE augmentation information. |
| 6033 |
See Linux Standard Base Core Specification version 3.0 . |
| 6034 |
@see https://gcc.gnu.org/legacy-ml/gcc/2003-12/msg01168.html |
| 6035 |
|
| 6036 |
@param dw_fde |
| 6037 |
The FDE of interest. |
| 6038 |
@param dw_augdata |
| 6039 |
On success returns a pointer to the augmentation data. |
| 6040 |
@param dw_augdata_len |
| 6041 |
On success returns the length in bytes of the augmentation data. |
| 6042 |
@param dw_error |
| 6043 |
The usual error detail return pointer. |
| 6044 |
@return |
| 6045 |
Returns DW_DLV_OK etc. |
| 6046 |
If the augmentation data length is zero it |
| 6047 |
returns DW_DLV_NO_ENTRY. |
| 6048 |
*/ |
| 6049 |
DW_API int dwarf_get_fde_augmentation_data(Dwarf_Fde dw_fde, |
| 6050 |
Dwarf_Small ** dw_augdata, |
| 6051 |
Dwarf_Unsigned * dw_augdata_len, |
| 6052 |
Dwarf_Error* dw_error); |
| 6053 |
|
| 6054 |
/*! @brief Expands CIE or FDE instructions for detailed examination. |
| 6055 |
Called for CIE initial instructions and |
| 6056 |
FDE instructions. |
| 6057 |
Call dwarf_get_fde_instr_bytes() or |
| 6058 |
dwarf_get_cie_info_b() to get the initial instruction bytes |
| 6059 |
and instructions byte count you wish to expand. |
| 6060 |
|
| 6061 |
Combined with dwarf_get_frame_instruction() |
| 6062 |
or dwarf_get_frame_instruction_a() |
| 6063 |
(the second is like the first but adds an argument for LLVM |
| 6064 |
address space numbers) it enables detailed access to |
| 6065 |
frame instruction fields for evaluation or printing. |
| 6066 |
|
| 6067 |
Free allocated memory with |
| 6068 |
dwarf_dealloc_frame_instr_head(). |
| 6069 |
|
| 6070 |
@see examples |
| 6071 |
|
| 6072 |
@param dw_cie |
| 6073 |
The cie relevant to the instructions. |
| 6074 |
@param dw_instructionspointer |
| 6075 |
points to the instructions |
| 6076 |
@param dw_length_in_bytes |
| 6077 |
byte length of the instruction sequence. |
| 6078 |
@param dw_head |
| 6079 |
The address of an allocated dw_head |
| 6080 |
@param dw_instr_count |
| 6081 |
Returns the number of instructions in the byte stream |
| 6082 |
@param dw_error |
| 6083 |
Error return details |
| 6084 |
@return |
| 6085 |
On success returns DW_DLV_OK |
| 6086 |
*/ |
| 6087 |
DW_API int dwarf_expand_frame_instructions(Dwarf_Cie dw_cie, |
| 6088 |
Dwarf_Small * dw_instructionspointer, |
| 6089 |
Dwarf_Unsigned dw_length_in_bytes, |
| 6090 |
Dwarf_Frame_Instr_Head * dw_head, |
| 6091 |
Dwarf_Unsigned * dw_instr_count, |
| 6092 |
Dwarf_Error * dw_error); |
| 6093 |
|
| 6094 |
/*! |
| 6095 |
@brief Return information about a single instruction |
| 6096 |
Fields_description means a sequence of up to three |
| 6097 |
letters including u,s,r,c,d,b, terminated by NUL byte. |
| 6098 |
It is a string but we test individual bytes instead |
| 6099 |
of using string compares. Do not free any of the |
| 6100 |
returned values. |
| 6101 |
|
| 6102 |
@see examples |
| 6103 |
|
| 6104 |
@param dw_head |
| 6105 |
A head record |
| 6106 |
@param dw_instr_index |
| 6107 |
index 0 < i < instr_count |
| 6108 |
@param dw_instr_offset_in_instrs |
| 6109 |
Returns the byte offset of this instruction |
| 6110 |
within instructions. |
| 6111 |
@param dw_cfa_operation |
| 6112 |
Returns a DW_CFA opcode. |
| 6113 |
@param dw_fields_description |
| 6114 |
Returns a string. Do not free. |
| 6115 |
@param dw_u0 |
| 6116 |
May be set to an unsigned value |
| 6117 |
@param dw_u1 |
| 6118 |
May be set to an unsigned value |
| 6119 |
@param dw_s0 |
| 6120 |
May be set to a signed value |
| 6121 |
@param dw_s1 |
| 6122 |
May be set to a signed value |
| 6123 |
@param dw_code_alignment_factor |
| 6124 |
May be set by the call |
| 6125 |
@param dw_data_alignment_factor |
| 6126 |
May be set by the call |
| 6127 |
@param dw_expression_block |
| 6128 |
Pass in a pointer to a block |
| 6129 |
@param dw_error |
| 6130 |
If DW_DLV_ERROR and the argument is non-NULL, returns |
| 6131 |
details about the error. |
| 6132 |
@return On success returns DW_DLV_OK |
| 6133 |
If there is no such instruction with that index |
| 6134 |
it returns DW_DLV_NO_ENTRY |
| 6135 |
On error it returns DW_DLV_ERROR and if dw_error |
| 6136 |
is NULL it pushes back a pointer to a Dwarf_Error |
| 6137 |
to the caller. |
| 6138 |
|
| 6139 |
Frame expressions have a variety of formats |
| 6140 |
and content. The dw_fields parameter is set to |
| 6141 |
a pointer to a short string with some set of the letters |
| 6142 |
s,u,r,d,c,b,a which enables determining exactly |
| 6143 |
which values the call sets. |
| 6144 |
Some examples: |
| 6145 |
A @c s in fields[0] means s0 is a signed number. |
| 6146 |
|
| 6147 |
A @c b somewhere in fields means the expression block |
| 6148 |
passed in has been filled in. |
| 6149 |
|
| 6150 |
A @c r in fields[1] means u1 is set to a register number. |
| 6151 |
|
| 6152 |
A @c d in fields means data_alignment_factor is set |
| 6153 |
|
| 6154 |
A @c c in fields means code_alignment_factor is set |
| 6155 |
|
| 6156 |
An @c a in fields means an LLVM address space value and |
| 6157 |
only exists if calling dwarf_get_frame_instruction_a(). |
| 6158 |
|
| 6159 |
The possible frame instruction formats are: |
| 6160 |
@code |
| 6161 |
"" "b" "r" "rb" "rr" "rsd" "rsda" "ru" "rua" "rud" |
| 6162 |
"sd" "u" "uc" |
| 6163 |
@endcode |
| 6164 |
are the possible frame instruction formats. |
| 6165 |
*/ |
| 6166 |
DW_API int dwarf_get_frame_instruction( |
| 6167 |
Dwarf_Frame_Instr_Head dw_head, |
| 6168 |
Dwarf_Unsigned dw_instr_index, |
| 6169 |
Dwarf_Unsigned * dw_instr_offset_in_instrs, |
| 6170 |
Dwarf_Small * dw_cfa_operation, |
| 6171 |
const char ** dw_fields_description, |
| 6172 |
Dwarf_Unsigned * dw_u0, |
| 6173 |
Dwarf_Unsigned * dw_u1, |
| 6174 |
Dwarf_Signed * dw_s0, |
| 6175 |
Dwarf_Signed * dw_s1, |
| 6176 |
Dwarf_Unsigned * dw_code_alignment_factor, |
| 6177 |
Dwarf_Signed * dw_data_alignment_factor, |
| 6178 |
Dwarf_Block * dw_expression_block, |
| 6179 |
Dwarf_Error * dw_error); |
| 6180 |
|
| 6181 |
/*! @brief Expands CIE or FDE instructions for detailed examination. |
| 6182 |
Called for CIE initial instructions and |
| 6183 |
FDE instructions. This is the same as |
| 6184 |
dwarf_get_frame_instruction() except that it adds a |
| 6185 |
dw_u2 field which contains an address-space identifier |
| 6186 |
if the letter @c a appears in dw_fields_description. |
| 6187 |
The dw_u2 field is non-standard and only applies |
| 6188 |
to Heterogeneous Debugging |
| 6189 |
frame instructions defined by LLVM |
| 6190 |
(DW_CFA_LLVM_def_aspace_cfa and DW_CFA_LLVM_def_aspace_cfa_sf) |
| 6191 |
|
| 6192 |
Where multiplication is called for (via dw_code_alignment_factor |
| 6193 |
or dw_data_alignment_factor) to produce an offset there |
| 6194 |
is no need to check for overflow as libdwarf has already |
| 6195 |
verified there is no overflow. |
| 6196 |
|
| 6197 |
The return values are the same except here we have: |
| 6198 |
an @c a in fields[2] or fields[3] means |
| 6199 |
dw_u2 is an address-space |
| 6200 |
identifier for the LLVM CFA instruction. |
| 6201 |
*/ |
| 6202 |
DW_API int dwarf_get_frame_instruction_a( |
| 6203 |
Dwarf_Frame_Instr_Head dw_/* head*/, |
| 6204 |
Dwarf_Unsigned dw_instr_index, |
| 6205 |
Dwarf_Unsigned * dw_instr_offset_in_instrs, |
| 6206 |
Dwarf_Small * dw_cfa_operation, |
| 6207 |
const char ** dw_fields_description, |
| 6208 |
Dwarf_Unsigned * dw_u0, |
| 6209 |
Dwarf_Unsigned * dw_u1, |
| 6210 |
Dwarf_Unsigned * dw_u2, |
| 6211 |
Dwarf_Signed * dw_s0, |
| 6212 |
Dwarf_Signed * dw_s1, |
| 6213 |
Dwarf_Unsigned * dw_code_alignment_factor, |
| 6214 |
Dwarf_Signed * dw_data_alignment_factor, |
| 6215 |
Dwarf_Block * dw_expression_block, |
| 6216 |
Dwarf_Error * dw_error); |
| 6217 |
|
| 6218 |
/*! |
| 6219 |
@brief Deallocates the frame instruction data in dw_head |
| 6220 |
@param dw_head |
| 6221 |
A head pointer. |
| 6222 |
Frees all data created by dwarf_expand_frame_instructions() |
| 6223 |
and makes the head pointer stale. The caller should |
| 6224 |
set to NULL. |
| 6225 |
*/ |
| 6226 |
DW_API void dwarf_dealloc_frame_instr_head(Dwarf_Frame_Instr_Head |
| 6227 |
dw_head); |
| 6228 |
|
| 6229 |
/*! @brief Return FDE and CIE offsets from debugging info. |
| 6230 |
|
| 6231 |
@param dw_dbg |
| 6232 |
The Dwarf_Debug of interest |
| 6233 |
@param dw_in_fde |
| 6234 |
Pass in the FDE of interest. |
| 6235 |
@param dw_fde_off |
| 6236 |
On success returns the section offset of the FDE. |
| 6237 |
@param dw_cie_off |
| 6238 |
On success returns the section offset of the CIE. |
| 6239 |
@param dw_error |
| 6240 |
Error return details |
| 6241 |
@return |
| 6242 |
Returns DW_DLV_OK etc. |
| 6243 |
|
| 6244 |
*/ |
| 6245 |
DW_API int dwarf_fde_section_offset(Dwarf_Debug dw_dbg, |
| 6246 |
Dwarf_Fde dw_in_fde, |
| 6247 |
Dwarf_Off * dw_fde_off, |
| 6248 |
Dwarf_Off * dw_cie_off, |
| 6249 |
Dwarf_Error * dw_error); |
| 6250 |
|
| 6251 |
/*! @brief Use to print CIE offsets from debugging info. |
| 6252 |
|
| 6253 |
@param dw_dbg |
| 6254 |
The Dwarf_Debug of interest |
| 6255 |
@param dw_in_cie |
| 6256 |
Pass in the CIE of interest. |
| 6257 |
@param dw_cie_off |
| 6258 |
On success returns the section offset of the CIE. |
| 6259 |
@param dw_error |
| 6260 |
Error return details |
| 6261 |
@return |
| 6262 |
Returns DW_DLV_OK etc. |
| 6263 |
|
| 6264 |
*/ |
| 6265 |
DW_API int dwarf_cie_section_offset(Dwarf_Debug dw_dbg, |
| 6266 |
Dwarf_Cie dw_in_cie, |
| 6267 |
Dwarf_Off * dw_cie_off, |
| 6268 |
Dwarf_Error * dw_error); |
| 6269 |
|
| 6270 |
/*! @brief Frame Rule Table Size |
| 6271 |
@link frameregs Invariants for setting frame registers @endlink |
| 6272 |
@param dw_dbg |
| 6273 |
The Dwarf_Debug of interest. |
| 6274 |
@param dw_value |
| 6275 |
Pass in the value to record for the library to use. |
| 6276 |
@return |
| 6277 |
Returns the previous value. |
| 6278 |
*/ |
| 6279 |
DW_API Dwarf_Half dwarf_set_frame_rule_table_size( |
| 6280 |
Dwarf_Debug dw_dbg, |
| 6281 |
Dwarf_Half dw_value); |
| 6282 |
/*! @brief Frame Rule Initial Value |
| 6283 |
|
| 6284 |
@link frameregs Invariants for setting frame registers @endlink |
| 6285 |
|
| 6286 |
@param dw_dbg |
| 6287 |
The Dwarf_Debug of interest. |
| 6288 |
@param dw_value |
| 6289 |
Pass in the value to record for the library to use. |
| 6290 |
@return |
| 6291 |
Returns the previous value. |
| 6292 |
*/ |
| 6293 |
DW_API Dwarf_Half dwarf_set_frame_rule_initial_value( |
| 6294 |
Dwarf_Debug dw_dbg, |
| 6295 |
Dwarf_Half dw_value); |
| 6296 |
/*! @brief Frame CFA Column |
| 6297 |
@link frameregs Invariants for setting frame registers @endlink |
| 6298 |
@param dw_dbg |
| 6299 |
The Dwarf_Debug of interest. |
| 6300 |
@param dw_value |
| 6301 |
Pass in the value to record for the library to use. |
| 6302 |
@return |
| 6303 |
Returns the previous value. |
| 6304 |
*/ |
| 6305 |
DW_API Dwarf_Half dwarf_set_frame_cfa_value( |
| 6306 |
Dwarf_Debug dw_dbg, |
| 6307 |
Dwarf_Half dw_value); |
| 6308 |
|
| 6309 |
/*! @brief Frame Same Value Default |
| 6310 |
@link frameregs Invariants for setting frame registers @endlink |
| 6311 |
@param dw_dbg |
| 6312 |
The Dwarf_Debug of interest. |
| 6313 |
@param dw_value |
| 6314 |
Pass in the value to record for the library to use. |
| 6315 |
@return |
| 6316 |
Returns the previous value. |
| 6317 |
*/ |
| 6318 |
DW_API Dwarf_Half dwarf_set_frame_same_value( |
| 6319 |
Dwarf_Debug dw_dbg, |
| 6320 |
Dwarf_Half dw_value); |
| 6321 |
/*! @brief Frame Undefined Value Default |
| 6322 |
@link frameregs Invariants for setting frame registers @endlink |
| 6323 |
@param dw_dbg |
| 6324 |
The Dwarf_Debug of interest. |
| 6325 |
@param dw_value |
| 6326 |
Pass in the value to record for the library to use. |
| 6327 |
@return |
| 6328 |
Returns the previous value. |
| 6329 |
*/ |
| 6330 |
DW_API Dwarf_Half dwarf_set_frame_undefined_value( |
| 6331 |
Dwarf_Debug dw_dbg, |
| 6332 |
Dwarf_Half dw_value); |
| 6333 |
/*! @} */ |
| 6334 |
|
| 6335 |
/*! @defgroup abbrev Abbreviations Section Details |
| 6336 |
|
| 6337 |
@{ |
| 6338 |
Allows reading section .debug_abbrev independently of |
| 6339 |
CUs or DIEs. Normally not done (libdwarf uses it |
| 6340 |
as necessary to access DWARF DIEs and DWARF attributes) |
| 6341 |
unless one is interested in |
| 6342 |
the content of the section. |
| 6343 |
|
| 6344 |
@link dwsec_independentsec About Reading Independently. @endlink |
| 6345 |
*/ |
| 6346 |
/*! @brief Reading Abbreviation Data |
| 6347 |
|
| 6348 |
Normally you never need to call these functions. |
| 6349 |
Calls that involve DIEs do all this for you |
| 6350 |
behind the scenes in the library. |
| 6351 |
|
| 6352 |
This reads the data for a single abbrev code |
| 6353 |
starting at dw_offset. |
| 6354 |
Essentially, opening access to an abbreviation entry. |
| 6355 |
|
| 6356 |
When libdwarf itself reads abbreviations to |
| 6357 |
access DIEs the offset comes |
| 6358 |
from the Compilation Unit Header debug_abbrev_offset field. |
| 6359 |
@see dwarf_next_cu_header_d |
| 6360 |
|
| 6361 |
@param dw_dbg |
| 6362 |
The Dwarf_Debug of interest. |
| 6363 |
@param dw_offset |
| 6364 |
Pass in the offset where a Debug_Abbrev starts. |
| 6365 |
@param dw_returned_abbrev |
| 6366 |
On success, sets a pointer to a Dwarf_Abbrev |
| 6367 |
through the pointer to allow further access. |
| 6368 |
@param dw_length |
| 6369 |
On success, returns the length of the entire abbreviation |
| 6370 |
block (bytes), useful to calculate the next offset |
| 6371 |
if reading the section independently |
| 6372 |
of any compilation unit. |
| 6373 |
@param dw_attr_count |
| 6374 |
On success, returns the number of attributes in this |
| 6375 |
abbreviation entry. |
| 6376 |
@param dw_error |
| 6377 |
On error dw_error is set to point to the error details. |
| 6378 |
@return |
| 6379 |
The usual value: DW_DLV_OK etc. |
| 6380 |
If the abbreviation is a single zero byte it is |
| 6381 |
a null abbreviation. DW_DLV_OK is returned. |
| 6382 |
|
| 6383 |
Close the abbrev by calling |
| 6384 |
dwarf_dealloc(dbg,*dw_returned_abbrev, DW_DLA_ABBREV) |
| 6385 |
*/ |
| 6386 |
DW_API int dwarf_get_abbrev(Dwarf_Debug dw_dbg, |
| 6387 |
Dwarf_Unsigned dw_offset, |
| 6388 |
Dwarf_Abbrev * dw_returned_abbrev, |
| 6389 |
Dwarf_Unsigned* dw_length, |
| 6390 |
Dwarf_Unsigned* dw_attr_count, |
| 6391 |
Dwarf_Error* dw_error); |
| 6392 |
|
| 6393 |
/*! @brief Get abbreviation tag |
| 6394 |
|
| 6395 |
@param dw_abbrev |
| 6396 |
The Dwarf_Abbrev of interest. |
| 6397 |
@param dw_return_tag_number |
| 6398 |
Returns the tag value, for example DW_TAG_compile_unit. |
| 6399 |
@param dw_error |
| 6400 |
On error dw_error is set to point to the error details. |
| 6401 |
@return |
| 6402 |
The usual value: DW_DLV_OK etc. |
| 6403 |
*/ |
| 6404 |
DW_API int dwarf_get_abbrev_tag(Dwarf_Abbrev dw_abbrev, |
| 6405 |
Dwarf_Half* dw_return_tag_number, |
| 6406 |
Dwarf_Error* dw_error); |
| 6407 |
|
| 6408 |
/*! @brief Get Abbreviation Code |
| 6409 |
|
| 6410 |
@param dw_abbrev |
| 6411 |
The Dwarf_Abbrev of interest. |
| 6412 |
@param dw_return_code_number |
| 6413 |
Returns the code for this abbreviation, a number |
| 6414 |
assigned to the abbreviation and unique within |
| 6415 |
the applicable CU. |
| 6416 |
@param dw_error |
| 6417 |
On error dw_error is set to point to the error details. |
| 6418 |
@return |
| 6419 |
The usual value: DW_DLV_OK etc. |
| 6420 |
*/ |
| 6421 |
DW_API int dwarf_get_abbrev_code(Dwarf_Abbrev dw_abbrev, |
| 6422 |
Dwarf_Unsigned* dw_return_code_number, |
| 6423 |
Dwarf_Error* dw_error); |
| 6424 |
|
| 6425 |
/*! @brief Get Abbrev Children Flag |
| 6426 |
|
| 6427 |
@param dw_abbrev |
| 6428 |
The Dwarf_Abbrev of interest. |
| 6429 |
@param dw_return_flag |
| 6430 |
On success returns the flag TRUE (greater than zero) if the DIE |
| 6431 |
referencing the abbreviation has children, |
| 6432 |
else returns FALSE (zero). |
| 6433 |
@param dw_error |
| 6434 |
On error dw_error is set to point to the error details. |
| 6435 |
@return |
| 6436 |
The usual value: DW_DLV_OK etc. |
| 6437 |
*/ |
| 6438 |
DW_API int dwarf_get_abbrev_children_flag(Dwarf_Abbrev dw_abbrev, |
| 6439 |
Dwarf_Signed* dw_return_flag, |
| 6440 |
Dwarf_Error* dw_error); |
| 6441 |
|
| 6442 |
/*! @brief Get Abbrev Entry Details |
| 6443 |
|
| 6444 |
Most will will call with filter_outliers non-zero. |
| 6445 |
|
| 6446 |
@param dw_abbrev |
| 6447 |
The Dwarf_Abbrev of interest. |
| 6448 |
@param dw_indx |
| 6449 |
Valid dw_index values are 0 through dw_attr_count-1 |
| 6450 |
@param dw_filter_outliers |
| 6451 |
Pass non-zero (TRUE) so the function will check for unreasonable |
| 6452 |
abbreviation content and return DW_DLV_ERROR if such found. |
| 6453 |
If zero (FALSE) passed in |
| 6454 |
even a nonsensical attribute number and/or unknown DW_FORM |
| 6455 |
are allowed (used by dwarfdump to report the issue(s)). |
| 6456 |
@param dw_returned_attr_num |
| 6457 |
On success returns the attribute number, such as DW_AT_name |
| 6458 |
@param dw_returned_form |
| 6459 |
On success returns the attribute FORM, such as DW_FORM_udata |
| 6460 |
@param dw_returned_implicit_const |
| 6461 |
On success, if the dw_returned_form is DW_FORM_implicit_const |
| 6462 |
then dw_returned_implicit_const is the implicit const value, |
| 6463 |
but if not implicit const the return value is zero.. |
| 6464 |
@param dw_offset |
| 6465 |
On success returns the offset of the start of this attr/form |
| 6466 |
pair in the abbreviation section. |
| 6467 |
@param dw_error |
| 6468 |
On error dw_error is set to point to the error details. |
| 6469 |
@return |
| 6470 |
The usual value: DW_DLV_OK etc. |
| 6471 |
If the abbreviation code for this Dwarf_Abbrev is 0 |
| 6472 |
it is a null abbreviation, the dw_indx is ignored, |
| 6473 |
and the function returns DW_DLV_NO_ENTRY. |
| 6474 |
*/ |
| 6475 |
DW_API int dwarf_get_abbrev_entry_b(Dwarf_Abbrev dw_abbrev, |
| 6476 |
Dwarf_Unsigned dw_indx, |
| 6477 |
Dwarf_Bool dw_filter_outliers, |
| 6478 |
Dwarf_Unsigned * dw_returned_attr_num, |
| 6479 |
Dwarf_Unsigned * dw_returned_form, |
| 6480 |
Dwarf_Signed * dw_returned_implicit_const, |
| 6481 |
Dwarf_Off * dw_offset, |
| 6482 |
Dwarf_Error * dw_error); |
| 6483 |
|
| 6484 |
/*! @} */ |
| 6485 |
/*! @defgroup string String Section .debug_str Details |
| 6486 |
|
| 6487 |
@{ |
| 6488 |
Shows just the section content in detail |
| 6489 |
*/ |
| 6490 |
/*! @brief Reading From a String Section |
| 6491 |
|
| 6492 |
@link dwsec_independentsec Reading The String Section @endlink |
| 6493 |
|
| 6494 |
@param dw_dbg |
| 6495 |
The Dwarf_Debug whose .debug_str section we want to access. |
| 6496 |
@param dw_offset |
| 6497 |
Pass in a string offset. Start at 0, and |
| 6498 |
for the next call pass in dw_offset |
| 6499 |
plus dw_strlen_of_string plus 1. |
| 6500 |
@param dw_string |
| 6501 |
The caller must pass in a valid pointer to a char *. |
| 6502 |
On success returns a pointer to a string from offset |
| 6503 |
dw_offset. Never dealloc or free this string. |
| 6504 |
@param dw_strlen_of_string |
| 6505 |
The caller must pass in a valid pointer to a Dwarf_Signed. |
| 6506 |
|
| 6507 |
On success returns the strlen() of the string. |
| 6508 |
@param dw_error |
| 6509 |
On error dw_error is set to point to the error details. |
| 6510 |
@return |
| 6511 |
The usual value: DW_DLV_OK etc. |
| 6512 |
If there is no such section it returns DW_DLV_NO_ENTRY. |
| 6513 |
If the dw_offset is greater than the section size, |
| 6514 |
or dw_string passed in is NULL or dw_strlen_of_string |
| 6515 |
is NULL the function returns DW_DLV_ERROR. |
| 6516 |
*/ |
| 6517 |
DW_API int dwarf_get_str(Dwarf_Debug dw_dbg, |
| 6518 |
Dwarf_Off dw_offset, |
| 6519 |
char** dw_string, |
| 6520 |
Dwarf_Signed * dw_strlen_of_string, |
| 6521 |
Dwarf_Error* dw_error); |
| 6522 |
|
| 6523 |
/*! @} */ |
| 6524 |
/*! @defgroup str_offsets Str_Offsets section details |
| 6525 |
|
| 6526 |
@{ |
| 6527 |
Shows just the section content in detail. |
| 6528 |
Most library users will never call these, |
| 6529 |
as references to this is handled by the code |
| 6530 |
accessing some Dwarf_Attribute. |
| 6531 |
@link dwsec_independentsec Reading The Str_Offsets @endlink |
| 6532 |
*/ |
| 6533 |
/* Allows applications to print the .debug_str_offsets |
| 6534 |
section. |
| 6535 |
Beginning at starting_offset zero, |
| 6536 |
returns data about the first table found. |
| 6537 |
The value *next_table_offset is the value |
| 6538 |
of the next table (if any), one byte past |
| 6539 |
the end of the table whose data is returned.. |
| 6540 |
Returns DW_DLV_NO_ENTRY if the starting offset |
| 6541 |
is past the end of valid data. |
| 6542 |
|
| 6543 |
There is no guarantee that there are no non-0 nonsense |
| 6544 |
bytes in the section outside of useful tables, |
| 6545 |
so this can fail and return nonsense or |
| 6546 |
DW_DLV_ERROR if such garbage exists. |
| 6547 |
*/ |
| 6548 |
|
| 6549 |
/*! @brief Creates access to a .debug_str_offsets table |
| 6550 |
|
| 6551 |
@see examplestrngoffsets |
| 6552 |
|
| 6553 |
@param dw_dbg |
| 6554 |
Pass in the Dwarf_Debug of interest. |
| 6555 |
@param dw_table_data |
| 6556 |
On success returns a pointer to an opaque structure |
| 6557 |
for use in further calls. |
| 6558 |
@param dw_error |
| 6559 |
On error dw_error is set to point to the error details. |
| 6560 |
@return |
| 6561 |
DW_DLV_OK etc. |
| 6562 |
If there is no .debug_str_offsets section it returns |
| 6563 |
DW_DLV_NO_ENTRY |
| 6564 |
*/ |
| 6565 |
DW_API int dwarf_open_str_offsets_table_access(Dwarf_Debug dw_dbg, |
| 6566 |
Dwarf_Str_Offsets_Table * dw_table_data, |
| 6567 |
Dwarf_Error * dw_error); |
| 6568 |
|
| 6569 |
/*! @brief Close str_offsets access, free table_data. |
| 6570 |
|
| 6571 |
@see examplestrngoffsets |
| 6572 |
|
| 6573 |
@param dw_table_data |
| 6574 |
@param dw_error |
| 6575 |
On error dw_error is set to point to the error details. |
| 6576 |
@return |
| 6577 |
DW_DLV_OK etc. |
| 6578 |
If there is no .debug_str_offsets section it returns |
| 6579 |
DW_DLV_NO_ENTRY |
| 6580 |
If it returns DW_DLV_ERROR there is nothing you can do |
| 6581 |
except report the error and, optionally, |
| 6582 |
call dwarf_dealloc_error to dealloc the error content |
| 6583 |
(and then set the dw_error to NULL as after the dealloc |
| 6584 |
the pointer is stale).. |
| 6585 |
*/ |
| 6586 |
DW_API int dwarf_close_str_offsets_table_access( |
| 6587 |
Dwarf_Str_Offsets_Table dw_table_data, |
| 6588 |
Dwarf_Error * dw_error); |
| 6589 |
|
| 6590 |
/*! @brief Iterate through the offsets tables |
| 6591 |
|
| 6592 |
@see examplestrngoffsets |
| 6593 |
|
| 6594 |
Access to the tables starts at offset zero. |
| 6595 |
The library progresses through the next table |
| 6596 |
automatically, keeping track internally to |
| 6597 |
know where it is. |
| 6598 |
|
| 6599 |
@param dw_table_data |
| 6600 |
Pass in an open Dwarf_Str_Offsets_Table. |
| 6601 |
@param dw_unit_length |
| 6602 |
On success returns a table unit_length field |
| 6603 |
@param dw_unit_length_offset |
| 6604 |
On success returns the section offset of the unit_length field. |
| 6605 |
@param dw_table_start_offset |
| 6606 |
On success returns the section offset of the array |
| 6607 |
of table entries. |
| 6608 |
@param dw_entry_size |
| 6609 |
On success returns the entry size (4 or 8) |
| 6610 |
@param dw_version |
| 6611 |
On success returns the value in the version field 5. |
| 6612 |
@param dw_padding |
| 6613 |
On success returns the zero value in the padding field. |
| 6614 |
@param dw_table_value_count |
| 6615 |
On success returns the number of table entries, each |
| 6616 |
of size dw_entry_size, in the table. |
| 6617 |
@param dw_error |
| 6618 |
On error dw_error is set to point to the error details. |
| 6619 |
@return |
| 6620 |
DW_DLV_OK |
| 6621 |
Returns DW_DLV_NO_ENTRY if there are no more entries. |
| 6622 |
*/ |
| 6623 |
DW_API int dwarf_next_str_offsets_table( |
| 6624 |
Dwarf_Str_Offsets_Table dw_table_data, |
| 6625 |
Dwarf_Unsigned * dw_unit_length, |
| 6626 |
Dwarf_Unsigned * dw_unit_length_offset, |
| 6627 |
Dwarf_Unsigned * dw_table_start_offset, |
| 6628 |
Dwarf_Half * dw_entry_size, |
| 6629 |
Dwarf_Half * dw_version, |
| 6630 |
Dwarf_Half * dw_padding, |
| 6631 |
Dwarf_Unsigned * dw_table_value_count, |
| 6632 |
Dwarf_Error * dw_error); |
| 6633 |
|
| 6634 |
/*! @brief Access to an individual str offsets table entry |
| 6635 |
|
| 6636 |
@see examplestrngoffsets |
| 6637 |
|
| 6638 |
@param dw_table_data |
| 6639 |
Pass in the open table pointer. |
| 6640 |
@param dw_index_to_entry |
| 6641 |
Pass in the entry number, 0 through dw_table_value_count-1 |
| 6642 |
for the active table |
| 6643 |
@param dw_entry_value |
| 6644 |
On success returns the value in that table entry, |
| 6645 |
an offset into a string table. |
| 6646 |
@param dw_error |
| 6647 |
On error dw_error is set to point to the error details. |
| 6648 |
@return |
| 6649 |
DW_DLV_OK |
| 6650 |
Returns DW_DLV_ERROR if dw_index_to_entry is |
| 6651 |
out of the correct range. |
| 6652 |
*/ |
| 6653 |
DW_API int dwarf_str_offsets_value_by_index( |
| 6654 |
Dwarf_Str_Offsets_Table dw_table_data, |
| 6655 |
Dwarf_Unsigned dw_index_to_entry, |
| 6656 |
Dwarf_Unsigned * dw_entry_value, |
| 6657 |
Dwarf_Error * dw_error); |
| 6658 |
|
| 6659 |
/*! @brief Reports final wasted-bytes count |
| 6660 |
|
| 6661 |
Reports the number of tables seen so far. |
| 6662 |
Not very interesting. |
| 6663 |
|
| 6664 |
@param dw_table_data |
| 6665 |
Pass in the open table pointer. |
| 6666 |
@param dw_wasted_byte_count |
| 6667 |
Always returns 0 at present. |
| 6668 |
@param dw_table_count |
| 6669 |
On success returns the total number of tables seen |
| 6670 |
so far in the section. |
| 6671 |
@param dw_error |
| 6672 |
On error dw_error is set to point to the error details. |
| 6673 |
@return |
| 6674 |
DW_DLV_OK etc. |
| 6675 |
*/ |
| 6676 |
DW_API int dwarf_str_offsets_statistics( |
| 6677 |
Dwarf_Str_Offsets_Table dw_table_data, |
| 6678 |
Dwarf_Unsigned * dw_wasted_byte_count, |
| 6679 |
Dwarf_Unsigned * dw_table_count, |
| 6680 |
Dwarf_Error * dw_error); |
| 6681 |
|
| 6682 |
/*! @} */ |
| 6683 |
/*! @defgroup dwarferror Dwarf_Error Functions |
| 6684 |
@{ |
| 6685 |
These functions aid in understanding handling. |
| 6686 |
*/ |
| 6687 |
/*! @brief What DW_DLE code does the error have? |
| 6688 |
@param dw_error |
| 6689 |
The dw_error should be non-null and a valid Dwarf_Error. |
| 6690 |
@return |
| 6691 |
A DW_DLE value of some kind. For example: DW_DLE_DIE_NULL. |
| 6692 |
*/ |
| 6693 |
DW_API Dwarf_Unsigned dwarf_errno(Dwarf_Error dw_error); |
| 6694 |
/*! @brief What message string is in the error? |
| 6695 |
@param dw_error |
| 6696 |
The dw_error should be non-null and a valid Dwarf_Error. |
| 6697 |
@return |
| 6698 |
A string with a message related to the error. |
| 6699 |
*/ |
| 6700 |
DW_API char* dwarf_errmsg(Dwarf_Error dw_error); |
| 6701 |
/*! @brief What message string is associated with the error number. |
| 6702 |
@param dw_errornum |
| 6703 |
The dw_error should be an integer from the DW_DLE set. |
| 6704 |
For example, DW_DLE_DIE_NULL. |
| 6705 |
@return |
| 6706 |
The generic string describing that error number. |
| 6707 |
*/ |
| 6708 |
DW_API char* dwarf_errmsg_by_number(Dwarf_Unsigned dw_errornum); |
| 6709 |
|
| 6710 |
/*! @brief Creating an error. |
| 6711 |
This is very rarely helpful. It lets the library |
| 6712 |
user create a Dwarf_Error and associate any string |
| 6713 |
with that error. Your code could then return |
| 6714 |
DW_DLV_ERROR to your caller when your intent |
| 6715 |
is to let your caller clean up whatever seems wrong. |
| 6716 |
@param dw_dbg |
| 6717 |
The relevant Dwarf_Debug. |
| 6718 |
@param dw_error |
| 6719 |
a Dwarf_Error is returned through this pointer. |
| 6720 |
@param dw_errmsg |
| 6721 |
The message string you provide. |
| 6722 |
*/ |
| 6723 |
DW_API void dwarf_error_creation(Dwarf_Debug dw_dbg , |
| 6724 |
Dwarf_Error * dw_error, char * dw_errmsg); |
| 6725 |
|
| 6726 |
/*! @brief Free (dealloc) an Dwarf_Error something created. |
| 6727 |
@param dw_dbg |
| 6728 |
The relevant Dwarf_Debug pointer. |
| 6729 |
@param dw_error |
| 6730 |
A pointer to a Dwarf_Error. The pointer is then stale |
| 6731 |
so you should immediately zero that pointer passed |
| 6732 |
in. |
| 6733 |
*/ |
| 6734 |
DW_API void dwarf_dealloc_error(Dwarf_Debug dw_dbg, |
| 6735 |
Dwarf_Error dw_error); |
| 6736 |
/*! @} */ |
| 6737 |
|
| 6738 |
/*! @defgroup dwarfdealloc Generic dwarf_dealloc Function |
| 6739 |
@{ |
| 6740 |
|
| 6741 |
Works for most dealloc needed. |
| 6742 |
|
| 6743 |
For easier to use versions see the following |
| 6744 |
@see dwarf_dealloc_attribute @see dwarf_dealloc_die |
| 6745 |
@see dwarf_dealloc_dnames @see dwarf_dealloc_error |
| 6746 |
@see dwarf_dealloc_fde_cie_list |
| 6747 |
@see dwarf_dealloc_frame_instr_head |
| 6748 |
@see dwarf_dealloc_macro_context @see dwarf_dealloc_ranges |
| 6749 |
@see dwarf_dealloc_rnglists_head |
| 6750 |
@see dwarf_dealloc_uncompressed_block |
| 6751 |
@see dwarf_globals_dealloc |
| 6752 |
@see dwarf_gnu_index_dealloc @see dwarf_loc_head_c_dealloc |
| 6753 |
@see dwarf_srclines_dealloc_b |
| 6754 |
|
| 6755 |
*/ |
| 6756 |
/*! @brief The generic dealloc (free) function. |
| 6757 |
It requires you know the correct DW_DLA value |
| 6758 |
to pass in, and in a few cases such is |
| 6759 |
not provided. The functions doing allocations |
| 6760 |
tell you which dealloc to use. |
| 6761 |
|
| 6762 |
@param dw_dbg |
| 6763 |
Must be a valid open Dwarf_Debug. |
| 6764 |
and must be the dw_dbg that the error |
| 6765 |
was created on. |
| 6766 |
If it is not the dealloc will do nothing. |
| 6767 |
@param dw_space |
| 6768 |
Must be an address returned directly |
| 6769 |
by a libdwarf call that the |
| 6770 |
call specifies as requiring |
| 6771 |
dealloc/free. If it is not |
| 6772 |
a segfault or address fault is possible. |
| 6773 |
@param dw_type |
| 6774 |
Must be a correct naming of the DW_DLA type. |
| 6775 |
If it is not the dealloc will do nothing. |
| 6776 |
*/ |
| 6777 |
DW_API void dwarf_dealloc(Dwarf_Debug dw_dbg, |
| 6778 |
void* dw_space, Dwarf_Unsigned dw_type); |
| 6779 |
/*! @} */ |
| 6780 |
/*! @defgroup debugsup Access to Section .debug_sup |
| 6781 |
@{ |
| 6782 |
*/ |
| 6783 |
/*! @brief Return basic .debug_sup section header data |
| 6784 |
|
| 6785 |
This returns basic data from the header |
| 6786 |
of a .debug_sup section. |
| 6787 |
See DWARF5 Section 7.3.6, |
| 6788 |
"DWARF Supplementary Object Files" |
| 6789 |
|
| 6790 |
Other sections present should be normal |
| 6791 |
DWARF5, so normal libdwarf calls should work. |
| 6792 |
We have no existing examples on hand, so |
| 6793 |
it is hard to know what really works. |
| 6794 |
|
| 6795 |
If there is no such section it returns |
| 6796 |
DW_DLV_NO_ENTRY. |
| 6797 |
*/ |
| 6798 |
DW_API int dwarf_get_debug_sup(Dwarf_Debug dw_dbg, |
| 6799 |
Dwarf_Half * dw_version, |
| 6800 |
Dwarf_Small * dw_is_supplementary, |
| 6801 |
char ** dw_filename, |
| 6802 |
Dwarf_Unsigned * dw_checksum_len, |
| 6803 |
Dwarf_Small ** dw_checksum, |
| 6804 |
Dwarf_Error * dw_error); |
| 6805 |
/*! @} */ |
| 6806 |
|
| 6807 |
/*! @defgroup debugnames Fast Access to .debug_names DWARF5 |
| 6808 |
@{ |
| 6809 |
|
| 6810 |
The section is new in DWARF5 and supersedes .debug_pubnames |
| 6811 |
and .debug_pubtypes in DWARF2, DWARF3, and DWARF4. |
| 6812 |
|
| 6813 |
The functions provide a detailed reporting |
| 6814 |
of the content and structure of the table (so one |
| 6815 |
can build one's own search table) but they |
| 6816 |
are not particularly helpful for searching. |
| 6817 |
|
| 6818 |
A new function (more than one?) would be needed for convenient |
| 6819 |
searching. |
| 6820 |
*/ |
| 6821 |
/*! @brief Open access to a .debug_names table |
| 6822 |
@param dw_dbg |
| 6823 |
The Dwarf_Debug of interest. |
| 6824 |
@param dw_starting_offset |
| 6825 |
Read this section starting at offset zero. |
| 6826 |
@param dw_dn |
| 6827 |
On success returns a pointer to a set of data |
| 6828 |
allowing access to the table. |
| 6829 |
@param dw_offset_of_next_table |
| 6830 |
On success returns |
| 6831 |
Offset just past the end of the the opened table. |
| 6832 |
@param dw_error |
| 6833 |
On error dw_error is set to point to the error details. |
| 6834 |
@return |
| 6835 |
The usual value: DW_DLV_OK etc. |
| 6836 |
If there is no such table or if dw_starting_offset |
| 6837 |
is past the end of the section it returns |
| 6838 |
DW_DLV_NO_ENTRY. |
| 6839 |
*/ |
| 6840 |
DW_API int dwarf_dnames_header(Dwarf_Debug dw_dbg, |
| 6841 |
Dwarf_Off dw_starting_offset, |
| 6842 |
Dwarf_Dnames_Head * dw_dn, |
| 6843 |
Dwarf_Off * dw_offset_of_next_table, |
| 6844 |
Dwarf_Error * dw_error); |
| 6845 |
|
| 6846 |
/*! @brief Frees all the malloc data associated with dw_dn |
| 6847 |
@param dw_dn |
| 6848 |
A Dwarf_Dnames_Head pointer. |
| 6849 |
Callers should zero the pointer passed in |
| 6850 |
as soon as possible after this returns |
| 6851 |
as the pointer is then stale. |
| 6852 |
*/ |
| 6853 |
DW_API void dwarf_dealloc_dnames(Dwarf_Dnames_Head dw_dn); |
| 6854 |
|
| 6855 |
/*! @brief Access to the abbrevs table content |
| 6856 |
|
| 6857 |
Of interest mainly to debugging issues with compilers |
| 6858 |
or debuggers. |
| 6859 |
|
| 6860 |
@param dw_dn |
| 6861 |
A Dwarf_Dnames_Head pointer. |
| 6862 |
@param dw_index |
| 6863 |
An index (starting at zero) into a table |
| 6864 |
constructed of abbrev data. |
| 6865 |
These indexes are derived from abbrev data and |
| 6866 |
are not in the abbrev data itself. |
| 6867 |
@param dw_abbrev_offset |
| 6868 |
Returns the offset of the abbrev table entry for this names table |
| 6869 |
entry. |
| 6870 |
@param dw_abbrev_code |
| 6871 |
Returns the abbrev code for the abbrev at offset dw_abbrev_offset. |
| 6872 |
@param dw_abbrev_tag |
| 6873 |
Returns the tag for the abbrev at offset dw_abbrev_offset. |
| 6874 |
@param dw_array_size |
| 6875 |
The size you allocated in each of the following two arrays. |
| 6876 |
@param dw_idxattr_array |
| 6877 |
Pass in an array you allocated where the function |
| 6878 |
returns and array of |
| 6879 |
index attributes (DW_IDX) for this dw_abbrev_code. |
| 6880 |
The last attribute code in the array is zero. |
| 6881 |
@param dw_form_array |
| 6882 |
Pass in an array you allocated where the |
| 6883 |
function returns and array of |
| 6884 |
forms for this dw_abbrev_code (paralled to dw_idxattr_array). |
| 6885 |
The last form code in the array is zero. |
| 6886 |
@param dw_idxattr_count |
| 6887 |
Returns the actual idxattribute/form count (including the |
| 6888 |
terminating 0,0 pair. If the array_size passed in is less |
| 6889 |
than this value the array returned is incomplete. |
| 6890 |
Array entries needed. Might be larger than |
| 6891 |
dw_array_size, meaning not all entries could |
| 6892 |
be returned in your arrays. |
| 6893 |
@return |
| 6894 |
Returns DW_DLV_OK on success. |
| 6895 |
If the offset does not refer to a known |
| 6896 |
part of the abbrev table it returns DW_DLV_NO_ENTRY. |
| 6897 |
Never returns DW_DLV_ERROR. |
| 6898 |
*/ |
| 6899 |
DW_API int dwarf_dnames_abbrevtable(Dwarf_Dnames_Head dw_dn, |
| 6900 |
Dwarf_Unsigned dw_index, |
| 6901 |
Dwarf_Unsigned *dw_abbrev_offset, |
| 6902 |
Dwarf_Unsigned *dw_abbrev_code, |
| 6903 |
Dwarf_Unsigned *dw_abbrev_tag, |
| 6904 |
Dwarf_Unsigned dw_array_size, |
| 6905 |
Dwarf_Half *dw_idxattr_array, |
| 6906 |
Dwarf_Half *dw_form_array, |
| 6907 |
Dwarf_Unsigned *dw_idxattr_count); |
| 6908 |
|
| 6909 |
/*! @brief Sizes and counts from the debug names table |
| 6910 |
|
| 6911 |
We do not describe these returned values. |
| 6912 |
Other than for dw_dn and dw_error |
| 6913 |
passing pointers you do not care about as NULL |
| 6914 |
is fine. Of course no value can be |
| 6915 |
returned through those passed as NULL. |
| 6916 |
|
| 6917 |
Any program referencing a names table will |
| 6918 |
need at least a few of these values. |
| 6919 |
|
| 6920 |
See DWARF5 section 6.1.1 "Lookup By Name" |
| 6921 |
particularly the graph page 139. |
| 6922 |
dw_comp_unit_count is K(k), |
| 6923 |
dw_local_type_unit_count is T(t), and |
| 6924 |
dw_foreign_type_unit_count is F(f). |
| 6925 |
*/ |
| 6926 |
DW_API int dwarf_dnames_sizes(Dwarf_Dnames_Head dw_dn, |
| 6927 |
Dwarf_Unsigned * dw_comp_unit_count, |
| 6928 |
Dwarf_Unsigned * dw_local_type_unit_count, |
| 6929 |
Dwarf_Unsigned * dw_foreign_type_unit_count, |
| 6930 |
Dwarf_Unsigned * dw_bucket_count, |
| 6931 |
Dwarf_Unsigned * dw_name_count, |
| 6932 |
/* The following are counted in bytes */ |
| 6933 |
Dwarf_Unsigned * dw_abbrev_table_size, |
| 6934 |
Dwarf_Unsigned * dw_entry_pool_size, |
| 6935 |
Dwarf_Unsigned * dw_augmentation_string_size, |
| 6936 |
char ** dw_augmentation_string, |
| 6937 |
Dwarf_Unsigned * dw_section_size, |
| 6938 |
Dwarf_Half * dw_table_version, |
| 6939 |
Dwarf_Half * dw_offset_size, |
| 6940 |
Dwarf_Error * dw_error); |
| 6941 |
|
| 6942 |
/*! @brief Offsets from the debug names table |
| 6943 |
|
| 6944 |
We do not describe these returned values, which |
| 6945 |
refer to the .debug_names section. |
| 6946 |
|
| 6947 |
The header offset is a section offset. |
| 6948 |
The rest are offsets from the header. |
| 6949 |
|
| 6950 |
See DWARF5 section 6.1.1 "Lookup By Name" |
| 6951 |
*/ |
| 6952 |
DW_API int dwarf_dnames_offsets(Dwarf_Dnames_Head dw_dn, |
| 6953 |
Dwarf_Unsigned * dw_header_offset, |
| 6954 |
Dwarf_Unsigned * dw_cu_table_offset, |
| 6955 |
Dwarf_Unsigned * dw_tu_local_offset, |
| 6956 |
Dwarf_Unsigned * dw_foreign_tu_offset, |
| 6957 |
Dwarf_Unsigned * dw_bucket_offset, |
| 6958 |
Dwarf_Unsigned * dw_hashes_offset, |
| 6959 |
Dwarf_Unsigned * dw_stringoffsets_offset, |
| 6960 |
Dwarf_Unsigned * dw_entryoffsets_offset, |
| 6961 |
Dwarf_Unsigned * dw_abbrev_table_offset, |
| 6962 |
Dwarf_Unsigned * dw_entry_pool_offset, |
| 6963 |
Dwarf_Error * dw_error); |
| 6964 |
|
| 6965 |
/*! @brief Each debug names cu list entry one at a time |
| 6966 |
|
| 6967 |
Indexes to the cu/tu/ tables start at 0. |
| 6968 |
|
| 6969 |
Some values in dw_offset are actually offsets, |
| 6970 |
such as for DW_IDX_die_offset. DW_IDX_compile_unit |
| 6971 |
and DW_IDX_type_unit are indexes into |
| 6972 |
the table specified by dw_type and are returned |
| 6973 |
through dw_offset field; |
| 6974 |
|
| 6975 |
@param dw_dn |
| 6976 |
The table of interest. |
| 6977 |
@param dw_type |
| 6978 |
Pass in the type, "cu" or "tu" |
| 6979 |
@param dw_index_number |
| 6980 |
For "cu" index range is 0 through K-1 |
| 6981 |
For "tu" index range is 0 through T+F-1 |
| 6982 |
@param dw_offset |
| 6983 |
Zero if it cannot be determined. |
| 6984 |
(check the return value!). |
| 6985 |
@param dw_sig |
| 6986 |
the Dwarf_Sig8 is filled in with a signature |
| 6987 |
if the TU index is T through T+F-1 |
| 6988 |
@param dw_error |
| 6989 |
On error dw_error is set to point to the error details. |
| 6990 |
@return |
| 6991 |
The usual value: DW_DLV_OK etc. |
| 6992 |
*/ |
| 6993 |
DW_API int dwarf_dnames_cu_table(Dwarf_Dnames_Head dw_dn, |
| 6994 |
const char * dw_type, |
| 6995 |
Dwarf_Unsigned dw_index_number, |
| 6996 |
Dwarf_Unsigned * dw_offset, |
| 6997 |
Dwarf_Sig8 * dw_sig, |
| 6998 |
Dwarf_Error * dw_error); |
| 6999 |
|
| 7000 |
/*! @brief Access to bucket contents. |
| 7001 |
@param dw_dn |
| 7002 |
The Dwarf_Dnames_Head of interest. |
| 7003 |
@param dw_bucket_number |
| 7004 |
Pass in a bucket number |
| 7005 |
Bucket numbers start at 0. |
| 7006 |
@param dw_index |
| 7007 |
On success returns the index of |
| 7008 |
the appropriate name entry. |
| 7009 |
Name entry indexes start at one, a zero |
| 7010 |
index means the bucket is unused. |
| 7011 |
@param dw_indexcount |
| 7012 |
On success returns the number of |
| 7013 |
name entries in the bucket. |
| 7014 |
@param dw_error |
| 7015 |
On error dw_error is set to point to the error details. |
| 7016 |
@return |
| 7017 |
The usual value: DW_DLV_OK etc. |
| 7018 |
An out of range dw_index_number gets a return |
| 7019 |
if DW_DLV_NO_ENTRY |
| 7020 |
*/ |
| 7021 |
DW_API int dwarf_dnames_bucket(Dwarf_Dnames_Head dw_dn, |
| 7022 |
Dwarf_Unsigned dw_bucket_number, |
| 7023 |
Dwarf_Unsigned * dw_index, |
| 7024 |
Dwarf_Unsigned * dw_indexcount, |
| 7025 |
Dwarf_Error * dw_error); |
| 7026 |
|
| 7027 |
/*! @brief Retrieve a name table entry |
| 7028 |
|
| 7029 |
Retrieve the name and other data |
| 7030 |
from a single name table entry. |
| 7031 |
|
| 7032 |
@param dw_dn |
| 7033 |
The table of interest. |
| 7034 |
@param dw_name_index |
| 7035 |
Pass in the desired index, start at one. |
| 7036 |
@param dw_bucket_number |
| 7037 |
On success returns a bucket number, zero |
| 7038 |
if no buckets present. |
| 7039 |
@param dw_hash_value |
| 7040 |
The hash value, all zeros if no hashes present |
| 7041 |
@param dw_offset_to_debug_str |
| 7042 |
The offset to the .debug_str section string. |
| 7043 |
@param dw_ptrtostr |
| 7044 |
if dw_ptrtostr non-null returns a pointer to |
| 7045 |
the applicable string here. |
| 7046 |
@param dw_offset_in_entrypool |
| 7047 |
Returns the offset in the entrypool |
| 7048 |
@param dw_abbrev_number |
| 7049 |
Returned from entrypool. |
| 7050 |
@param dw_abbrev_tag |
| 7051 |
Returned from entrypool abbrev data. |
| 7052 |
@param dw_array_size |
| 7053 |
Size of array you provide |
| 7054 |
to hold DW_IDX index attribute and |
| 7055 |
form numbers. |
| 7056 |
Possibly 10 suffices for practical purposes. |
| 7057 |
@param dw_idxattr_array |
| 7058 |
Array space you provide, for idx attribute numbers |
| 7059 |
(function will initialize it). |
| 7060 |
The final entry in the array will be 0. |
| 7061 |
@param dw_form_array |
| 7062 |
Array you provide, for form numbers |
| 7063 |
(function will initialize it). |
| 7064 |
The final entry in the array will be 0. |
| 7065 |
@param dw_idxattr_count |
| 7066 |
Array entries needed. Might be larger than |
| 7067 |
dw_array_size, meaning not all entries could |
| 7068 |
be returned in your array. |
| 7069 |
@param dw_error |
| 7070 |
On error dw_error is set to point to the error details. |
| 7071 |
@return |
| 7072 |
The usual value: DW_DLV_OK etc. |
| 7073 |
If the index passed in is outside the valid range |
| 7074 |
returns DW_DLV_NO_ENTRY. |
| 7075 |
*/ |
| 7076 |
DW_API int dwarf_dnames_name(Dwarf_Dnames_Head dw_dn, |
| 7077 |
Dwarf_Unsigned dw_name_index, |
| 7078 |
Dwarf_Unsigned * dw_bucket_number, |
| 7079 |
Dwarf_Unsigned * dw_hash_value, |
| 7080 |
Dwarf_Unsigned * dw_offset_to_debug_str, |
| 7081 |
char * * dw_ptrtostr, |
| 7082 |
Dwarf_Unsigned * dw_offset_in_entrypool, |
| 7083 |
Dwarf_Unsigned * dw_abbrev_number, |
| 7084 |
Dwarf_Half * dw_abbrev_tag, |
| 7085 |
Dwarf_Unsigned dw_array_size, |
| 7086 |
Dwarf_Half * dw_idxattr_array, |
| 7087 |
Dwarf_Half * dw_form_array, |
| 7088 |
Dwarf_Unsigned * dw_idxattr_count, |
| 7089 |
Dwarf_Error * dw_error); |
| 7090 |
|
| 7091 |
/*! @brief Return a the set of values from an entrypool entry |
| 7092 |
|
| 7093 |
Returns the basic data about an entrypool record |
| 7094 |
and enables correct calling of |
| 7095 |
dwarf_dnames_entrypool_values |
| 7096 |
(see below). The two-stage approach makes it |
| 7097 |
simple for callers to prepare for the number of |
| 7098 |
values that will be returned by |
| 7099 |
dwarf_dnames_entrypool_values() |
| 7100 |
|
| 7101 |
@param dw_dn |
| 7102 |
Pass in the debug names table of interest. |
| 7103 |
@param dw_offset_in_entrypool |
| 7104 |
The record offset (in the entry pool table) |
| 7105 |
of the first record of IDX attributes. Starts at zero. |
| 7106 |
@param dw_abbrev_code |
| 7107 |
On success returns the abbrev code of the idx attributes |
| 7108 |
for the pool entry. |
| 7109 |
@param dw_tag |
| 7110 |
On success returns the TAG of the DIE referred to |
| 7111 |
by this entrypool entry. |
| 7112 |
@param dw_value_count |
| 7113 |
On success returns the number of distinct |
| 7114 |
values imply by this entry. |
| 7115 |
@param dw_index_of_abbrev |
| 7116 |
On success returns the index of the abbrev index/form |
| 7117 |
pairs in the abbreviation table. |
| 7118 |
@param dw_offset_of_initial_value |
| 7119 |
On success returns the entry pool offset of the |
| 7120 |
sequence of bytes containing values, such as |
| 7121 |
a CU index or a DIE offset. |
| 7122 |
@param dw_error |
| 7123 |
The usual error detail record |
| 7124 |
@return |
| 7125 |
DW_DLV_OK is returned if the specified name |
| 7126 |
entry exists. |
| 7127 |
DW_DLV_NO_ENTRY is returned if the specified offset |
| 7128 |
is outside the size of the table. |
| 7129 |
DW_DLV_ERROR is returned in case of an internal error |
| 7130 |
or corrupt section content. |
| 7131 |
*/ |
| 7132 |
DW_API int dwarf_dnames_entrypool(Dwarf_Dnames_Head dw_dn, |
| 7133 |
Dwarf_Unsigned dw_offset_in_entrypool, |
| 7134 |
Dwarf_Unsigned * dw_abbrev_code, |
| 7135 |
Dwarf_Half * dw_tag, |
| 7136 |
Dwarf_Unsigned * dw_value_count, |
| 7137 |
Dwarf_Unsigned * dw_index_of_abbrev, |
| 7138 |
Dwarf_Unsigned * dw_offset_of_initial_value, |
| 7139 |
Dwarf_Error * dw_error); |
| 7140 |
|
| 7141 |
/*! @brief Return the value set defined by this entry |
| 7142 |
|
| 7143 |
Call here after calling dwarf_dnames_entrypool |
| 7144 |
to provide data to call this function correctly. |
| 7145 |
|
| 7146 |
This retrieves the index attribute values |
| 7147 |
that identify a names table name. |
| 7148 |
|
| 7149 |
The caller allocates a set of arrays and the function fills |
| 7150 |
them in. If dw_array_idx_number[n] |
| 7151 |
is DW_IDX_type_hash then dw_array_of_signatures[n] |
| 7152 |
contains the hash. For other IDX values |
| 7153 |
dw_array_of_offsets[n] contains the value being returned. |
| 7154 |
|
| 7155 |
@param dw_dn |
| 7156 |
Pass in the debug names table of interest. |
| 7157 |
@param dw_index_of_abbrev |
| 7158 |
Pass in the abbreviation index. |
| 7159 |
@param dw_offset_in_entrypool_of_values |
| 7160 |
Pass in the offset of the values returned |
| 7161 |
by dw_offset_of_initial_value above. |
| 7162 |
@param dw_arrays_length |
| 7163 |
Pass in the array length of each of the following |
| 7164 |
four fields. The dw_value_count returned above |
| 7165 |
is what you need to use. |
| 7166 |
@param dw_array_idx_number |
| 7167 |
Create an array of Dwarf_Half values, dw_arrays_length |
| 7168 |
long, and pass a pointer to the first entry here. |
| 7169 |
@param dw_array_form |
| 7170 |
Create an array of Dwarf_Half values, dw_arrays_length |
| 7171 |
long, and pass a pointer to the first entry here. |
| 7172 |
@param dw_array_of_offsets |
| 7173 |
Create an array of Dwarf_Unsigned values, dw_arrays_length |
| 7174 |
long, and pass a pointer to the first entry here. |
| 7175 |
@param dw_array_of_signatures |
| 7176 |
Create an array of Dwarf_Sig8 structs, dw_arrays_length |
| 7177 |
long, and pass a pointer to the first entry here. |
| 7178 |
@param dw_offset_of_next_entrypool |
| 7179 |
On success returns the offset of the next entrypool. |
| 7180 |
A value here is usable in the next call to |
| 7181 |
dwarf_dnames_entrypool. |
| 7182 |
@param dw_single_cu |
| 7183 |
On success, if it is a single-cu name table there is |
| 7184 |
likely no DW_IDX_compile_unit. So we return TRUE |
| 7185 |
via this flag in such a case. |
| 7186 |
@param dw_cu_offset |
| 7187 |
On success, for a single-cu name table with no |
| 7188 |
DW_IDX_compile_unit this is set |
| 7189 |
to the CU offset from that single CU-table entry. |
| 7190 |
@param dw_error |
| 7191 |
The usual error detail record |
| 7192 |
@return |
| 7193 |
DW_DLV_OK is returned if the specified name |
| 7194 |
entry exists. |
| 7195 |
DW_DLV_NO_ENTRY is returned if the specified offset |
| 7196 |
is outside the size of the table. |
| 7197 |
DW_DLV_ERROR is returned in case of an internal error |
| 7198 |
or corrupt section content. |
| 7199 |
*/ |
| 7200 |
DW_API int dwarf_dnames_entrypool_values(Dwarf_Dnames_Head dw_dn, |
| 7201 |
Dwarf_Unsigned dw_index_of_abbrev, |
| 7202 |
Dwarf_Unsigned dw_offset_in_entrypool_of_values, |
| 7203 |
Dwarf_Unsigned dw_arrays_length, |
| 7204 |
Dwarf_Half *dw_array_idx_number, |
| 7205 |
Dwarf_Half *dw_array_form, |
| 7206 |
Dwarf_Unsigned *dw_array_of_offsets, |
| 7207 |
Dwarf_Sig8 *dw_array_of_signatures, |
| 7208 |
Dwarf_Bool *dw_single_cu, |
| 7209 |
Dwarf_Unsigned *dw_cu_offset, |
| 7210 |
Dwarf_Unsigned *dw_offset_of_next_entrypool, |
| 7211 |
Dwarf_Error *dw_error); |
| 7212 |
|
| 7213 |
/*! @} */ |
| 7214 |
|
| 7215 |
/*! @defgroup aranges Fast Access to a CU given a code address |
| 7216 |
@{ |
| 7217 |
*/ |
| 7218 |
/*! @brief Get access to CUs given code addresses |
| 7219 |
|
| 7220 |
This intended as a fast-access to tie code addresses |
| 7221 |
to CU dies. The data is in the .debug_aranges section. |
| 7222 |
which may appear in DWARF2,3,4, or DWARF5. |
| 7223 |
|
| 7224 |
@see exampleu |
| 7225 |
|
| 7226 |
@param dw_dbg |
| 7227 |
The Dwarf_Debug of interest. |
| 7228 |
@param dw_aranges |
| 7229 |
On success returns a pointer to an array |
| 7230 |
of Dwarf_Arange pointers. |
| 7231 |
@param dw_arange_count |
| 7232 |
On success returns a count of the length of the array. |
| 7233 |
@param dw_error |
| 7234 |
On error dw_error is set to point to the error details. |
| 7235 |
@return |
| 7236 |
The usual value: DW_DLV_OK etc. |
| 7237 |
Returns DW_DLV_NO_ENTRY if there is no such section. |
| 7238 |
*/ |
| 7239 |
DW_API int dwarf_get_aranges(Dwarf_Debug dw_dbg, |
| 7240 |
Dwarf_Arange** dw_aranges, |
| 7241 |
Dwarf_Signed * dw_arange_count, |
| 7242 |
Dwarf_Error* dw_error); |
| 7243 |
|
| 7244 |
/*! @brief Find a range given a code address |
| 7245 |
|
| 7246 |
@param dw_aranges |
| 7247 |
Pass in a pointer to the first entry in the aranges array |
| 7248 |
of pointers. |
| 7249 |
@param dw_arange_count |
| 7250 |
Pass in the dw_arange_count, the count for the array. |
| 7251 |
@param dw_address |
| 7252 |
Pass in the code address of interest. |
| 7253 |
@param dw_returned_arange |
| 7254 |
On success, returns the particular arange that |
| 7255 |
holds that address. |
| 7256 |
@param dw_error |
| 7257 |
On error dw_error is set to point to the error details. |
| 7258 |
@return |
| 7259 |
The usual value: DW_DLV_OK etc. |
| 7260 |
Returns DW_DLV_NO_ENTRY if there is no such code |
| 7261 |
address present in the section. |
| 7262 |
*/ |
| 7263 |
DW_API int dwarf_get_arange(Dwarf_Arange* dw_aranges, |
| 7264 |
Dwarf_Unsigned dw_arange_count, |
| 7265 |
Dwarf_Addr dw_address, |
| 7266 |
Dwarf_Arange * dw_returned_arange, |
| 7267 |
Dwarf_Error* dw_error); |
| 7268 |
|
| 7269 |
/*! @brief Given an arange return its CU DIE offset. |
| 7270 |
|
| 7271 |
@param dw_arange |
| 7272 |
The specific arange of interest. |
| 7273 |
@param dw_return_offset |
| 7274 |
The CU DIE offset (in .debug_info) applicable |
| 7275 |
to this arange.. |
| 7276 |
@param dw_error |
| 7277 |
On error dw_error is set to point to the error details. |
| 7278 |
@return |
| 7279 |
The usual value: DW_DLV_OK etc. |
| 7280 |
*/ |
| 7281 |
DW_API int dwarf_get_cu_die_offset(Dwarf_Arange dw_arange, |
| 7282 |
Dwarf_Off * dw_return_offset, |
| 7283 |
Dwarf_Error* dw_error); |
| 7284 |
|
| 7285 |
/*! @brief Given an arange return its CU header offset. |
| 7286 |
|
| 7287 |
@param dw_arange |
| 7288 |
The specific arange of interest. |
| 7289 |
@param dw_return_cu_header_offset |
| 7290 |
The CU header offset (in .debug_info) applicable |
| 7291 |
to this arange. |
| 7292 |
@param dw_error |
| 7293 |
On error dw_error is set to point to the error details. |
| 7294 |
@return |
| 7295 |
The usual value: DW_DLV_OK etc. |
| 7296 |
*/ |
| 7297 |
DW_API int dwarf_get_arange_cu_header_offset(Dwarf_Arange dw_arange, |
| 7298 |
Dwarf_Off * dw_return_cu_header_offset, |
| 7299 |
Dwarf_Error* dw_error); |
| 7300 |
|
| 7301 |
/*! @brief Get the data in an arange entry. |
| 7302 |
|
| 7303 |
@param dw_arange |
| 7304 |
The specific arange of interest. |
| 7305 |
@param dw_segment |
| 7306 |
On success and if segment_entry_size is non-zero |
| 7307 |
this returns the segment number |
| 7308 |
from the arange. |
| 7309 |
@param dw_segment_entry_size |
| 7310 |
On success returns the segment entry size |
| 7311 |
from the arange. |
| 7312 |
@param dw_start |
| 7313 |
On success returns the low address this arange |
| 7314 |
refers to. |
| 7315 |
@param dw_length |
| 7316 |
On success returns the length, in bytes of the |
| 7317 |
code area this arange refers to. |
| 7318 |
@param dw_cu_die_offset |
| 7319 |
On success returns the .debug_info section offset |
| 7320 |
the arange refers to. |
| 7321 |
@param dw_error |
| 7322 |
On error dw_error is set to point to the error details. |
| 7323 |
@return |
| 7324 |
The usual value: DW_DLV_OK etc. |
| 7325 |
*/ |
| 7326 |
DW_API int dwarf_get_arange_info_b(Dwarf_Arange dw_arange, |
| 7327 |
Dwarf_Unsigned* dw_segment, |
| 7328 |
Dwarf_Unsigned* dw_segment_entry_size, |
| 7329 |
Dwarf_Addr * dw_start, |
| 7330 |
Dwarf_Unsigned* dw_length, |
| 7331 |
Dwarf_Off * dw_cu_die_offset, |
| 7332 |
Dwarf_Error * dw_error ); |
| 7333 |
/*! @} */ |
| 7334 |
|
| 7335 |
/*! @defgroup pubnames Fast Access to .debug_pubnames and more. |
| 7336 |
|
| 7337 |
@{ |
| 7338 |
@link dwsec_pubnames Pubnames and Pubtypes overview @endlink |
| 7339 |
|
| 7340 |
These functions each read one of a set of sections designed |
| 7341 |
for fast access by name, but they are not always emitted as |
| 7342 |
they each have somewhat limited and inflexible |
| 7343 |
capabilities. So you may not see many of these. |
| 7344 |
|
| 7345 |
All have the same set of functions with a name |
| 7346 |
reflecting the specific object section involved. |
| 7347 |
Only the first, of type Dwarf_Global, is documented |
| 7348 |
here in full detail as the others do the same jobs |
| 7349 |
just each for their applicable object section.. |
| 7350 |
|
| 7351 |
*/ |
| 7352 |
|
| 7353 |
/*! @brief Global name space operations, .debug_pubnames access |
| 7354 |
|
| 7355 |
This accesses .debug_pubnames and .debug_names sections. |
| 7356 |
Section .debug_pubnames is defined in DWARF2, DWARF3, |
| 7357 |
and DWARF4. |
| 7358 |
Section .debug_names is defined in DWARF5 and contains |
| 7359 |
lots of information, but only the part of the wealth |
| 7360 |
of information that this interface allows can |
| 7361 |
be retrieved here. See dwarf_dnames_header() for |
| 7362 |
access to all. debug_names data. |
| 7363 |
|
| 7364 |
The code here, as of 0.4.3, September 3 2022, |
| 7365 |
returns data from either section. |
| 7366 |
|
| 7367 |
@see examplef |
| 7368 |
|
| 7369 |
@param dw_dbg |
| 7370 |
The Dwarf_Debug of interest. |
| 7371 |
@param dw_globals |
| 7372 |
On success returns an array of pointers to opaque |
| 7373 |
structs.. |
| 7374 |
@param dw_number_of_globals |
| 7375 |
On success returns the number of entries in the array. |
| 7376 |
@param dw_error |
| 7377 |
On error dw_error is set to point to the error details. |
| 7378 |
@return |
| 7379 |
The usual value: DW_DLV_OK etc. |
| 7380 |
Returns DW_DLV_NO_ENTRY if the section is not present. |
| 7381 |
*/ |
| 7382 |
DW_API int dwarf_get_globals(Dwarf_Debug dw_dbg, |
| 7383 |
Dwarf_Global** dw_globals, |
| 7384 |
Dwarf_Signed * dw_number_of_globals, |
| 7385 |
Dwarf_Error * dw_error); |
| 7386 |
|
| 7387 |
#define DW_GL_GLOBALS 0 /* .debug_pubnames and .debug_names */ |
| 7388 |
#define DW_GL_PUBTYPES 1 /* .debug_pubtypes */ |
| 7389 |
/* the following are IRIX ONLY */ |
| 7390 |
#define DW_GL_FUNCS 2 /* .debug_funcnames */ |
| 7391 |
#define DW_GL_TYPES 3 /* .debug_typenames */ |
| 7392 |
#define DW_GL_VARS 4 /* .debug_varnames */ |
| 7393 |
#define DW_GL_WEAKS 5 /* .debug_weaknames */ |
| 7394 |
/*! @brief Global debug_types access |
| 7395 |
|
| 7396 |
@param dw_dbg |
| 7397 |
The Dwarf_Debug of interest. |
| 7398 |
@param dw_pubtypes |
| 7399 |
On success returns an array of pointers to opaque |
| 7400 |
structs.. |
| 7401 |
@param dw_number_of_pubtypes |
| 7402 |
On success returns the number of entries in the array. |
| 7403 |
@param dw_error |
| 7404 |
On error dw_error is set to point to the error details. |
| 7405 |
@return |
| 7406 |
The usual value: DW_DLV_OK etc. |
| 7407 |
Returns DW_DLV_NO_ENTRY if the section is not present. |
| 7408 |
|
| 7409 |
Same function name as 0.5.0 and earlier, but |
| 7410 |
the data type changes to Dwarf_Global |
| 7411 |
|
| 7412 |
dwarf_get_pubtypes() is an alternate name for |
| 7413 |
dwarf_globals_by_type(..,DW_GL_PUBTYPES,..). |
| 7414 |
|
| 7415 |
*/ |
| 7416 |
DW_API int dwarf_get_pubtypes(Dwarf_Debug dw_dbg, |
| 7417 |
Dwarf_Global** dw_pubtypes, |
| 7418 |
Dwarf_Signed * dw_number_of_pubtypes, |
| 7419 |
Dwarf_Error * dw_error); |
| 7420 |
|
| 7421 |
/*! @brief Allocate Any Fast Access DWARF2-DWARF4 |
| 7422 |
|
| 7423 |
This interface new in 0.6.0. Simplfies access |
| 7424 |
by replace dwarf_get_pubtypes, dwarf_get_funcs, |
| 7425 |
dwarf_get_types, dwarfget_vars, and dwarf_get_weaks |
| 7426 |
with a single set of types. |
| 7427 |
|
| 7428 |
@param dw_dbg |
| 7429 |
The Dwarf_Debug of interest. |
| 7430 |
@param dw_requested_section |
| 7431 |
Pass in one of the values DW_GL_GLOBALS through |
| 7432 |
DW_GL_WEAKS to select the section to extract |
| 7433 |
data from. |
| 7434 |
@param dw_contents |
| 7435 |
On success returns an array of pointers to opaque |
| 7436 |
structs. |
| 7437 |
@param dw_count |
| 7438 |
On success returns the number of entries in the array. |
| 7439 |
@param dw_error |
| 7440 |
On error dw_error is set to point to the error details. |
| 7441 |
@return |
| 7442 |
The usual value: DW_DLV_OK etc. |
| 7443 |
Returns DW_DLV_NO_ENTRY if the section is not present. |
| 7444 |
|
| 7445 |
*/ |
| 7446 |
DW_API int dwarf_globals_by_type(Dwarf_Debug dw_dbg, |
| 7447 |
int dw_requested_section, |
| 7448 |
Dwarf_Global **dw_contents, |
| 7449 |
Dwarf_Signed *dw_count, |
| 7450 |
Dwarf_Error *dw_error); |
| 7451 |
|
| 7452 |
/*! @brief Dealloc the Dwarf_Global data |
| 7453 |
|
| 7454 |
@param dw_dbg |
| 7455 |
The Dwarf_Debug of interest. |
| 7456 |
@param dw_global_like |
| 7457 |
The array of globals/types/etc data to dealloc (free). |
| 7458 |
@param dw_count |
| 7459 |
The number of entries in the array. |
| 7460 |
*/ |
| 7461 |
|
| 7462 |
DW_API void dwarf_globals_dealloc(Dwarf_Debug dw_dbg, |
| 7463 |
Dwarf_Global* dw_global_like, |
| 7464 |
Dwarf_Signed dw_count); |
| 7465 |
|
| 7466 |
/*! @brief Return the name of a global-like data item |
| 7467 |
|
| 7468 |
@param dw_global |
| 7469 |
The Dwarf_Global of interest. |
| 7470 |
@param dw_returned_name |
| 7471 |
On success a pointer to the name (a null-terminated |
| 7472 |
string) is returned. |
| 7473 |
@param dw_error |
| 7474 |
On error dw_error is set to point to the error details. |
| 7475 |
@return |
| 7476 |
The usual value: DW_DLV_OK etc. |
| 7477 |
*/ |
| 7478 |
DW_API int dwarf_globname(Dwarf_Global dw_global, |
| 7479 |
char ** dw_returned_name, |
| 7480 |
Dwarf_Error* dw_error); |
| 7481 |
|
| 7482 |
/*! @brief Return the DIE offset of a global data item |
| 7483 |
|
| 7484 |
@param dw_global |
| 7485 |
The Dwarf_Global of interest. |
| 7486 |
@param dw_die_offset |
| 7487 |
On success a the section-global DIE offset of a |
| 7488 |
data item is returned. |
| 7489 |
@param dw_error |
| 7490 |
On error dw_error is set to point to the error details. |
| 7491 |
@return |
| 7492 |
The usual value: DW_DLV_OK etc. |
| 7493 |
*/ |
| 7494 |
DW_API int dwarf_global_die_offset(Dwarf_Global dw_global, |
| 7495 |
Dwarf_Off * dw_die_offset, |
| 7496 |
Dwarf_Error * dw_error); |
| 7497 |
|
| 7498 |
/*! @brief Return the CU header data of a global data item |
| 7499 |
|
| 7500 |
A CU header offset is rarely useful. |
| 7501 |
|
| 7502 |
@param dw_global |
| 7503 |
The Dwarf_Global of interest. |
| 7504 |
@param dw_cu_header_offset |
| 7505 |
On success a the section-global offset of |
| 7506 |
a CU header is returned. |
| 7507 |
@param dw_error |
| 7508 |
On error dw_error is set to point to the error details. |
| 7509 |
@return |
| 7510 |
The usual value: DW_DLV_OK etc. |
| 7511 |
*/ |
| 7512 |
DW_API int dwarf_global_cu_offset(Dwarf_Global dw_global, |
| 7513 |
Dwarf_Off* dw_cu_header_offset, |
| 7514 |
Dwarf_Error* dw_error); |
| 7515 |
|
| 7516 |
/*! @brief Return the name and offsets of a global entry. |
| 7517 |
|
| 7518 |
@param dw_global |
| 7519 |
The Dwarf_Global of interest. |
| 7520 |
@param dw_returned_name |
| 7521 |
On success a pointer to the name (a null-terminated |
| 7522 |
string) is returned. |
| 7523 |
@param dw_die_offset |
| 7524 |
On success a the section-global DIE offset of |
| 7525 |
the global with the name. |
| 7526 |
@param dw_cu_die_offset |
| 7527 |
On success a the section-global offset of |
| 7528 |
the relevant CU DIE is returned. |
| 7529 |
@param dw_error |
| 7530 |
On error dw_error is set to point to the error details. |
| 7531 |
@return |
| 7532 |
The usual value: DW_DLV_OK etc. |
| 7533 |
*/ |
| 7534 |
DW_API int dwarf_global_name_offsets(Dwarf_Global dw_global, |
| 7535 |
char ** dw_returned_name, |
| 7536 |
Dwarf_Off* dw_die_offset, |
| 7537 |
Dwarf_Off* dw_cu_die_offset, |
| 7538 |
Dwarf_Error* dw_error); |
| 7539 |
|
| 7540 |
/*! @brief Return the DW_TAG number of a global entry. |
| 7541 |
|
| 7542 |
@param dw_global |
| 7543 |
The Dwarf_Global of interest. |
| 7544 |
@return |
| 7545 |
If the Dwarf_Global refers to a global from |
| 7546 |
the .debug_names section the return value is the |
| 7547 |
DW_TAG for the DIE in the global entry, for |
| 7548 |
example DW_TAG_subprogram. |
| 7549 |
In case of error or if the section for this global |
| 7550 |
was not .debug_names zero is returned. |
| 7551 |
*/ |
| 7552 |
DW_API Dwarf_Half dwarf_global_tag_number(Dwarf_Global dw_global); |
| 7553 |
|
| 7554 |
/*! @brief For more complete globals printing. |
| 7555 |
|
| 7556 |
For each CU represented in .debug_pubnames, etc, |
| 7557 |
there is a .debug_pubnames header. For any given |
| 7558 |
Dwarf_Global this returns the content of the applicable |
| 7559 |
header. This does not include header information |
| 7560 |
from any .debug_names headers. |
| 7561 |
|
| 7562 |
The function declaration changed at version 0.6.0. |
| 7563 |
*/ |
| 7564 |
DW_API int dwarf_get_globals_header(Dwarf_Global dw_global, |
| 7565 |
int * dw_category, /* DW_GL_GLOBAL for example */ |
| 7566 |
Dwarf_Off * dw_offset_pub_header, |
| 7567 |
Dwarf_Unsigned * dw_length_size, |
| 7568 |
Dwarf_Unsigned * dw_length_pub, |
| 7569 |
Dwarf_Unsigned * dw_version, |
| 7570 |
Dwarf_Unsigned * dw_header_info_offset, |
| 7571 |
Dwarf_Unsigned * dw_info_length, |
| 7572 |
Dwarf_Error * dw_error); |
| 7573 |
|
| 7574 |
/*! @brief A flag for dwarfdump on pubnames, pubtypes etc. |
| 7575 |
|
| 7576 |
Sets a flag in the dbg. Always returns DW_DLV_OK. |
| 7577 |
Applies to all the sections of this kind: |
| 7578 |
pubnames, pubtypes, funcs, typenames,vars, weaks. |
| 7579 |
Ensures empty content (meaning no |
| 7580 |
offset/name tuples, but with a header) |
| 7581 |
for a CU shows up rather than |
| 7582 |
being suppressed. |
| 7583 |
|
| 7584 |
Primarily useful if one wants to note any pointless |
| 7585 |
header data in the section. |
| 7586 |
|
| 7587 |
@link dwsec_pubnames Pubnames and Pubtypes overview @endlink |
| 7588 |
|
| 7589 |
@param dw_dbg |
| 7590 |
The Dwarf_Debug of interest. |
| 7591 |
@param dw_flag |
| 7592 |
Must be the value one. |
| 7593 |
@return |
| 7594 |
Returns DW_DLV_OK. Always. |
| 7595 |
*/ |
| 7596 |
DW_API int dwarf_return_empty_pubnames(Dwarf_Debug dw_dbg, |
| 7597 |
int dw_flag); |
| 7598 |
|
| 7599 |
/*! @} */ |
| 7600 |
|
| 7601 |
/*! @defgroup gnupubnames Fast Access to GNU .debug_gnu_pubnames |
| 7602 |
@{ |
| 7603 |
Section .debug_gnu_pubnames or .debug_gnu_pubtypes. |
| 7604 |
|
| 7605 |
This is a section created for and used by the GNU gdb |
| 7606 |
debugger to access DWARF information. |
| 7607 |
|
| 7608 |
Not part of standard DWARF. |
| 7609 |
|
| 7610 |
*/ |
| 7611 |
/*! @brief Access to .debug_gnu_pubnames or .debug_gnu_pubtypes |
| 7612 |
|
| 7613 |
Call this to get access. |
| 7614 |
|
| 7615 |
@param dw_dbg |
| 7616 |
Pass in the Dwarf_Debug of interest. |
| 7617 |
@param dw_which_section |
| 7618 |
Pass in TRUE to access .debug_gnu_pubnames. |
| 7619 |
Pass in FALSE to access .debug_gnu_typenames. |
| 7620 |
@param dw_head |
| 7621 |
On success, set to a pointer to a head record |
| 7622 |
allowing access to all the content of the section. |
| 7623 |
@param dw_index_block_count_out |
| 7624 |
On success, set to a count of the number of blocks |
| 7625 |
of data available. |
| 7626 |
@param dw_error |
| 7627 |
@return |
| 7628 |
Returns DW_DLV_OK, DW_DLV_NO_ENTRY (if the section does |
| 7629 |
not exist or is empty), or, in case of |
| 7630 |
an error reading the section, DW_DLV_ERROR. |
| 7631 |
*/ |
| 7632 |
DW_API int dwarf_get_gnu_index_head(Dwarf_Debug dw_dbg, |
| 7633 |
Dwarf_Bool dw_which_section, |
| 7634 |
Dwarf_Gnu_Index_Head *dw_head, |
| 7635 |
Dwarf_Unsigned *dw_index_block_count_out, |
| 7636 |
Dwarf_Error *dw_error); |
| 7637 |
/*! @brief Free resources of .debug_gnu_pubnames .debug_gnu_pubtypes |
| 7638 |
|
| 7639 |
Call this to deallocate all memory used by dw_head. |
| 7640 |
|
| 7641 |
@param dw_head |
| 7642 |
Pass in the Dwarf_Gnu_Index_head whose data is to be deallocated. |
| 7643 |
*/ |
| 7644 |
DW_API void dwarf_gnu_index_dealloc(Dwarf_Gnu_Index_Head dw_head); |
| 7645 |
/*! @brief Access a particular block. |
| 7646 |
@param dw_head |
| 7647 |
Pass in the Dwarf_Gnu_Index_head interest. |
| 7648 |
@param dw_number |
| 7649 |
Pass in the block number of the block of interest. |
| 7650 |
0 through dw_index_block_count_out-1. |
| 7651 |
@param dw_block_length |
| 7652 |
On success set to the length of the data in this block, |
| 7653 |
in bytes. |
| 7654 |
@param dw_version |
| 7655 |
On success set to the version number of the block. |
| 7656 |
@param dw_offset_into_debug_info |
| 7657 |
On success set to the offset, in .debug_info, of |
| 7658 |
the data for this block. |
| 7659 |
The returned offset may be outside the bounds |
| 7660 |
of the actual .debug_info section, such a possibility |
| 7661 |
does not cause the function to return DW_DLV_ERROR. |
| 7662 |
@param dw_size_of_debug_info_area |
| 7663 |
On success set to the size in bytes, in .debug_info, of |
| 7664 |
the area this block refers to. |
| 7665 |
The returned dw_ dw_size_of_debug_info_are |
| 7666 |
plus dw_offset_into_debug_info may be outside the bounds |
| 7667 |
of the actual .debug_info section, such a possibility |
| 7668 |
does not cause the function to return DW_DLV_ERROR. |
| 7669 |
Use dwarf_get_section_max_offsets_d() |
| 7670 |
to learn the size of .debug_info and optionally other |
| 7671 |
sections as well. |
| 7672 |
@param dw_count_of_index_entries |
| 7673 |
On success set to the count of index entries in |
| 7674 |
this particular block number. |
| 7675 |
@param dw_error |
| 7676 |
On error dw_error is set to point to the error details. |
| 7677 |
@return |
| 7678 |
Returns DW_DLV_OK, DW_DLV_NO_ENTRY (if the section does |
| 7679 |
not exist or is empty), or, in case of |
| 7680 |
an error reading the section, DW_DLV_ERROR. |
| 7681 |
*/ |
| 7682 |
|
| 7683 |
DW_API int dwarf_get_gnu_index_block(Dwarf_Gnu_Index_Head dw_head, |
| 7684 |
Dwarf_Unsigned dw_number, |
| 7685 |
Dwarf_Unsigned *dw_block_length, |
| 7686 |
Dwarf_Half *dw_version, |
| 7687 |
Dwarf_Unsigned *dw_offset_into_debug_info, |
| 7688 |
Dwarf_Unsigned *dw_size_of_debug_info_area, |
| 7689 |
Dwarf_Unsigned *dw_count_of_index_entries, |
| 7690 |
Dwarf_Error *dw_error); |
| 7691 |
|
| 7692 |
/*! @brief Access a particular entry of a block. |
| 7693 |
|
| 7694 |
Access to a single entry in a block. |
| 7695 |
|
| 7696 |
@param dw_head |
| 7697 |
Pass in the Dwarf_Gnu_Index_head interest. |
| 7698 |
@param dw_blocknumber |
| 7699 |
Pass in the block number of the block of interest. |
| 7700 |
0 through dw_index_block_count_out-1. |
| 7701 |
@param dw_entrynumber |
| 7702 |
Pass in the entry number of the entry of interest. |
| 7703 |
0 through dw_count_of_index_entries-1. |
| 7704 |
@param dw_offset_in_debug_info |
| 7705 |
On success set to the offset in .debug_info |
| 7706 |
relevant to this entry. |
| 7707 |
@param dw_name_string |
| 7708 |
On success set to the size in bytes, in .debug_info, of |
| 7709 |
the area this block refersto. |
| 7710 |
@param dw_flagbyte |
| 7711 |
On success set to the entry flag byte content. |
| 7712 |
@param dw_staticorglobal |
| 7713 |
On success set to the entry static/global letter. |
| 7714 |
@param dw_typeofentry |
| 7715 |
On success set to the type of entry. |
| 7716 |
@param dw_error |
| 7717 |
On error dw_error is set to point to the error details. |
| 7718 |
@return |
| 7719 |
Returns DW_DLV_OK, DW_DLV_NO_ENTRY (if the section does |
| 7720 |
not exist or is empty), or, in case of |
| 7721 |
an error reading the section, DW_DLV_ERROR. |
| 7722 |
*/ |
| 7723 |
DW_API int dwarf_get_gnu_index_block_entry( |
| 7724 |
Dwarf_Gnu_Index_Head dw_head, |
| 7725 |
Dwarf_Unsigned dw_blocknumber, |
| 7726 |
Dwarf_Unsigned dw_entrynumber, |
| 7727 |
Dwarf_Unsigned *dw_offset_in_debug_info, |
| 7728 |
const char **dw_name_string, |
| 7729 |
unsigned char *dw_flagbyte, |
| 7730 |
unsigned char *dw_staticorglobal, |
| 7731 |
unsigned char *dw_typeofentry, |
| 7732 |
Dwarf_Error *dw_error); |
| 7733 |
|
| 7734 |
/*! @} */ |
| 7735 |
|
| 7736 |
/*! @defgroup gdbindex Fast Access to Gdb Index |
| 7737 |
|
| 7738 |
@{ |
| 7739 |
Section .gdb_index |
| 7740 |
|
| 7741 |
This is a section created for and used by the GNU gdb |
| 7742 |
debugger to access DWARF information. |
| 7743 |
|
| 7744 |
Not part of standard DWARF. |
| 7745 |
|
| 7746 |
@see https://sourceware.org/gdb/onlinedocs/gdb/Index-Section-Format.html#Index-Section-Format |
| 7747 |
|
| 7748 |
Version 8 built by gdb, so type entries are ok as is. |
| 7749 |
Version 7 built by the 'gold' linker and type index |
| 7750 |
entries for a CU must be derived otherwise, the |
| 7751 |
type index is not correct... Earlier versions |
| 7752 |
cannot be read correctly by the functions here. |
| 7753 |
|
| 7754 |
The functions here make it possible to |
| 7755 |
print the section content in detail, there |
| 7756 |
is no search function here. |
| 7757 |
|
| 7758 |
*/ |
| 7759 |
/*! @brief Open access to the .gdb_index section. |
| 7760 |
|
| 7761 |
The section is a single table one thinks. |
| 7762 |
|
| 7763 |
@see examplew |
| 7764 |
|
| 7765 |
@param dw_dbg |
| 7766 |
The Dwarf_Debug of interest. |
| 7767 |
@param dw_gdbindexptr |
| 7768 |
On success returns a pointer to make access |
| 7769 |
to table details possible. |
| 7770 |
@param dw_version |
| 7771 |
On success returns the table version. |
| 7772 |
@param dw_cu_list_offset |
| 7773 |
On success returns the offset of the cu_list |
| 7774 |
in the section. |
| 7775 |
@param dw_types_cu_list_offset |
| 7776 |
On success returns the offset of the types cu_list |
| 7777 |
in the section. |
| 7778 |
@param dw_address_area_offset |
| 7779 |
On success returns the area pool offset. |
| 7780 |
@param dw_symbol_table_offset |
| 7781 |
On success returns the symbol table offset. |
| 7782 |
@param dw_constant_pool_offset |
| 7783 |
On success returns the constant pool offset. |
| 7784 |
@param dw_section_size |
| 7785 |
On success returns section size. |
| 7786 |
@param dw_section_name |
| 7787 |
On success returns section name. |
| 7788 |
@param dw_error |
| 7789 |
The usual pointer to return error details. |
| 7790 |
@return |
| 7791 |
Returns DW_DLV_OK etc. |
| 7792 |
Returns DW_DLV_NO_ENTRY if the section is absent. |
| 7793 |
*/ |
| 7794 |
DW_API int dwarf_gdbindex_header(Dwarf_Debug dw_dbg, |
| 7795 |
Dwarf_Gdbindex * dw_gdbindexptr, |
| 7796 |
Dwarf_Unsigned * dw_version, |
| 7797 |
Dwarf_Unsigned * dw_cu_list_offset, |
| 7798 |
Dwarf_Unsigned * dw_types_cu_list_offset, |
| 7799 |
Dwarf_Unsigned * dw_address_area_offset, |
| 7800 |
Dwarf_Unsigned * dw_symbol_table_offset, |
| 7801 |
Dwarf_Unsigned * dw_constant_pool_offset, |
| 7802 |
Dwarf_Unsigned * dw_section_size, |
| 7803 |
const char ** dw_section_name, |
| 7804 |
Dwarf_Error * dw_error); |
| 7805 |
|
| 7806 |
/*! @brief Free (dealloc) all allocated Dwarf_Gdbindex memory |
| 7807 |
It should named dwarf_dealloc_gdbindex |
| 7808 |
|
| 7809 |
@param dw_gdbindexptr |
| 7810 |
Pass in a valid dw_gdbindexptr and |
| 7811 |
on return assign zero to dw_gdbindexptr as it is stale. |
| 7812 |
*/ |
| 7813 |
DW_API void dwarf_dealloc_gdbindex(Dwarf_Gdbindex dw_gdbindexptr); |
| 7814 |
|
| 7815 |
/*! @brief Return the culist array length |
| 7816 |
@param dw_gdbindexptr |
| 7817 |
Pass in the Dwarf_Gdbindex pointer of interest. |
| 7818 |
@param dw_list_length |
| 7819 |
On success returns the array length of the cu list. |
| 7820 |
@param dw_error |
| 7821 |
The usual pointer to return error details. |
| 7822 |
@return |
| 7823 |
Returns DW_DLV_OK etc. |
| 7824 |
*/ |
| 7825 |
DW_API int dwarf_gdbindex_culist_array( |
| 7826 |
Dwarf_Gdbindex dw_gdbindexptr, |
| 7827 |
Dwarf_Unsigned * dw_list_length, |
| 7828 |
Dwarf_Error * dw_error); |
| 7829 |
|
| 7830 |
/*! @brief For a CU entry in the list return the offset and length |
| 7831 |
@param dw_gdbindexptr |
| 7832 |
Pass in the Dwarf_Gdbindex pointer of interest. |
| 7833 |
@param dw_entryindex |
| 7834 |
Pass in a number from 0 through dw_list_length-1. |
| 7835 |
If dw_entryindex is too large for the array |
| 7836 |
the function returns DW_DLV_NO_ENTRY. |
| 7837 |
@param dw_cu_offset |
| 7838 |
On success returns the CU offset for this list entry. |
| 7839 |
@param dw_cu_length |
| 7840 |
On success returns the CU length(in bytes) |
| 7841 |
for this list entry. |
| 7842 |
@param dw_error |
| 7843 |
The usual pointer to return error details. |
| 7844 |
@return |
| 7845 |
Returns DW_DLV_OK etc. |
| 7846 |
*/ |
| 7847 |
DW_API int dwarf_gdbindex_culist_entry( |
| 7848 |
Dwarf_Gdbindex dw_gdbindexptr, |
| 7849 |
Dwarf_Unsigned dw_entryindex, |
| 7850 |
Dwarf_Unsigned * dw_cu_offset, |
| 7851 |
Dwarf_Unsigned * dw_cu_length, |
| 7852 |
Dwarf_Error * dw_error); |
| 7853 |
|
| 7854 |
/*! @brief Return the types culist array length |
| 7855 |
@param dw_gdbindexptr |
| 7856 |
Pass in the Dwarf_Gdbindex pointer of interest. |
| 7857 |
@param dw_types_list_length |
| 7858 |
On success returns the array length of the |
| 7859 |
types cu list. |
| 7860 |
@param dw_error |
| 7861 |
The usual pointer to return error details. |
| 7862 |
@return |
| 7863 |
Returns DW_DLV_OK etc. |
| 7864 |
*/ |
| 7865 |
DW_API int dwarf_gdbindex_types_culist_array( |
| 7866 |
Dwarf_Gdbindex dw_gdbindexptr, |
| 7867 |
Dwarf_Unsigned * dw_types_list_length, |
| 7868 |
Dwarf_Error * dw_error); |
| 7869 |
|
| 7870 |
/* entryindex: 0 to types_list_length -1 */ |
| 7871 |
/*! @brief For a types CU entry in the list |
| 7872 |
returns the offset and length |
| 7873 |
|
| 7874 |
@param dw_gdbindexptr |
| 7875 |
Pass in the Dwarf_Gdbindex pointer of interest. |
| 7876 |
@param dw_types_entryindex |
| 7877 |
Pass in a number from 0 through dw_list_length-1. |
| 7878 |
If the value is greater than dw_list_length-1 |
| 7879 |
the function returns DW_DLV_NO_ENTRY. |
| 7880 |
@param dw_cu_offset |
| 7881 |
On success returns the types CU offset for this list entry. |
| 7882 |
@param dw_tu_offset |
| 7883 |
On success returns the tu offset for this list entry. |
| 7884 |
@param dw_type_signature |
| 7885 |
On success returns the type unit offset for this |
| 7886 |
entry if the type has a signature. |
| 7887 |
@param dw_error |
| 7888 |
The usual pointer to return error details. |
| 7889 |
@return |
| 7890 |
Returns DW_DLV_OK etc. |
| 7891 |
*/ |
| 7892 |
DW_API int dwarf_gdbindex_types_culist_entry( |
| 7893 |
Dwarf_Gdbindex dw_gdbindexptr, |
| 7894 |
Dwarf_Unsigned dw_types_entryindex, |
| 7895 |
Dwarf_Unsigned * dw_cu_offset, |
| 7896 |
Dwarf_Unsigned * dw_tu_offset, |
| 7897 |
Dwarf_Unsigned * dw_type_signature, |
| 7898 |
Dwarf_Error * dw_error); |
| 7899 |
|
| 7900 |
/*! @brief Get access to gdbindex address area |
| 7901 |
|
| 7902 |
@see examplewgdbindex |
| 7903 |
|
| 7904 |
@param dw_gdbindexptr |
| 7905 |
Pass in the Dwarf_Gdbindex pointer of interest. |
| 7906 |
@param dw_addressarea_list_length |
| 7907 |
On success returns the number of entries in the |
| 7908 |
addressarea. |
| 7909 |
@param dw_error |
| 7910 |
The usual pointer to return error details. |
| 7911 |
@return |
| 7912 |
Returns DW_DLV_OK etc. |
| 7913 |
*/ |
| 7914 |
DW_API int dwarf_gdbindex_addressarea( |
| 7915 |
Dwarf_Gdbindex dw_gdbindexptr, |
| 7916 |
Dwarf_Unsigned * dw_addressarea_list_length, |
| 7917 |
Dwarf_Error * dw_error); |
| 7918 |
|
| 7919 |
/*! @brief Get an address area value |
| 7920 |
|
| 7921 |
@param dw_gdbindexptr |
| 7922 |
Pass in the Dwarf_Gdbindex pointer of interest. |
| 7923 |
@param dw_entryindex |
| 7924 |
Pass in an index, 0 through dw_addressarea_list_length-1. |
| 7925 |
addressarea. |
| 7926 |
@param dw_low_address |
| 7927 |
On success returns the low address for the entry. |
| 7928 |
@param dw_high_address |
| 7929 |
On success returns the high address for the entry. |
| 7930 |
@param dw_cu_index |
| 7931 |
On success returns the index to the cu for the entry. |
| 7932 |
@param dw_error |
| 7933 |
The usual pointer to return error details. |
| 7934 |
@return |
| 7935 |
Returns DW_DLV_OK etc. |
| 7936 |
*/ |
| 7937 |
DW_API int dwarf_gdbindex_addressarea_entry( |
| 7938 |
Dwarf_Gdbindex dw_gdbindexptr, |
| 7939 |
Dwarf_Unsigned dw_entryindex, |
| 7940 |
Dwarf_Unsigned * dw_low_address, |
| 7941 |
Dwarf_Unsigned * dw_high_address, |
| 7942 |
Dwarf_Unsigned * dw_cu_index, |
| 7943 |
Dwarf_Error * dw_error); |
| 7944 |
|
| 7945 |
/*! @brief Get access to the symboltable array |
| 7946 |
|
| 7947 |
@param dw_gdbindexptr |
| 7948 |
Pass in the Dwarf_Gdbindex pointer of interest. |
| 7949 |
@param dw_symtab_list_length |
| 7950 |
On success returns the number of entries in the |
| 7951 |
symbol table |
| 7952 |
@param dw_error |
| 7953 |
The usual pointer to return error details. |
| 7954 |
@return |
| 7955 |
Returns DW_DLV_OK etc. |
| 7956 |
*/ |
| 7957 |
DW_API int dwarf_gdbindex_symboltable_array( |
| 7958 |
Dwarf_Gdbindex dw_gdbindexptr, |
| 7959 |
Dwarf_Unsigned * dw_symtab_list_length, |
| 7960 |
Dwarf_Error * dw_error); |
| 7961 |
|
| 7962 |
/*! @brief Access individual symtab entry |
| 7963 |
|
| 7964 |
@param dw_gdbindexptr |
| 7965 |
Pass in the Dwarf_Gdbindex pointer of interest. |
| 7966 |
@param dw_entryindex |
| 7967 |
Pass in a valid index in the range 0 through |
| 7968 |
dw_symtab_list_length-1 |
| 7969 |
If the value is greater than dw_symtab_list_length-1 |
| 7970 |
the function returns DW_DLV_NO_ENTRY; |
| 7971 |
@param dw_string_offset |
| 7972 |
On success returns the string offset in the |
| 7973 |
appropriate string section. |
| 7974 |
@param dw_cu_vector_offset |
| 7975 |
On success returns the CU vector offset. |
| 7976 |
@param dw_error |
| 7977 |
The usual pointer to return error details. |
| 7978 |
@return |
| 7979 |
Returns DW_DLV_OK etc. |
| 7980 |
*/ |
| 7981 |
DW_API int dwarf_gdbindex_symboltable_entry( |
| 7982 |
Dwarf_Gdbindex dw_gdbindexptr, |
| 7983 |
Dwarf_Unsigned dw_entryindex, |
| 7984 |
Dwarf_Unsigned * dw_string_offset, |
| 7985 |
Dwarf_Unsigned * dw_cu_vector_offset, |
| 7986 |
Dwarf_Error * dw_error); |
| 7987 |
|
| 7988 |
/*! @brief Get access to a cuvector |
| 7989 |
|
| 7990 |
@see examplex |
| 7991 |
|
| 7992 |
@param dw_gdbindexptr |
| 7993 |
Pass in the Dwarf_Gdbindex pointer of interest. |
| 7994 |
@param dw_cuvector_offset |
| 7995 |
Pass in the offset, dw_cu_vector_offset. |
| 7996 |
@param dw_innercount |
| 7997 |
On success returns the number of CUs in |
| 7998 |
the cuvector instance array. |
| 7999 |
@param dw_error |
| 8000 |
The usual pointer to return error details. |
| 8001 |
@return |
| 8002 |
Returns DW_DLV_OK etc. |
| 8003 |
|
| 8004 |
*/ |
| 8005 |
DW_API int dwarf_gdbindex_cuvector_length( |
| 8006 |
Dwarf_Gdbindex dw_gdbindexptr, |
| 8007 |
Dwarf_Unsigned dw_cuvector_offset, |
| 8008 |
Dwarf_Unsigned * dw_innercount, |
| 8009 |
Dwarf_Error * dw_error); |
| 8010 |
|
| 8011 |
/*! @brief Get access to a cuvector |
| 8012 |
@param dw_gdbindexptr |
| 8013 |
Pass in the Dwarf_Gdbindex pointer of interest. |
| 8014 |
@param dw_cuvector_offset_in |
| 8015 |
Pass in the value of dw_cuvector_offset |
| 8016 |
@param dw_innerindex |
| 8017 |
Pass in the index of the CU vector in, from 0 |
| 8018 |
through dw_innercount-1. |
| 8019 |
@param dw_field_value |
| 8020 |
On success returns a field of bits. To expand the bits |
| 8021 |
call dwarf_gdbindex_cuvector_instance_expand_value. |
| 8022 |
@param dw_error |
| 8023 |
The usual pointer to return error details. |
| 8024 |
@return |
| 8025 |
Returns DW_DLV_OK etc. |
| 8026 |
*/ |
| 8027 |
DW_API int dwarf_gdbindex_cuvector_inner_attributes( |
| 8028 |
Dwarf_Gdbindex dw_gdbindexptr, |
| 8029 |
Dwarf_Unsigned dw_cuvector_offset_in, |
| 8030 |
Dwarf_Unsigned dw_innerindex, |
| 8031 |
Dwarf_Unsigned * dw_field_value, |
| 8032 |
Dwarf_Error * dw_error); |
| 8033 |
|
| 8034 |
/*! @brief Expand the bit fields in a cuvector entry |
| 8035 |
|
| 8036 |
@param dw_gdbindexptr |
| 8037 |
Pass in the Dwarf_Gdbindex pointer of interest. |
| 8038 |
@param dw_field_value |
| 8039 |
Pass in the dw_field_value returned by |
| 8040 |
dwarf_gdbindex_cuvector_inner_attributes. |
| 8041 |
@param dw_cu_index |
| 8042 |
On success returns the CU index from the dw_field_value |
| 8043 |
@param dw_symbol_kind |
| 8044 |
On success returns the symbol kind (see |
| 8045 |
the sourceware page. Kinds are TYPE, VARIABLE, |
| 8046 |
or FUNCTION. |
| 8047 |
@param dw_is_static |
| 8048 |
On success returns non-zero if the entry is a static |
| 8049 |
symbol (file-local, as in C or C++), otherwise |
| 8050 |
it returns non-zero and the symbol is global. |
| 8051 |
@param dw_error |
| 8052 |
The usual pointer to return error details. |
| 8053 |
@return |
| 8054 |
Returns DW_DLV_OK etc. |
| 8055 |
*/ |
| 8056 |
DW_API int dwarf_gdbindex_cuvector_instance_expand_value( |
| 8057 |
Dwarf_Gdbindex dw_gdbindexptr, |
| 8058 |
Dwarf_Unsigned dw_field_value, |
| 8059 |
Dwarf_Unsigned * dw_cu_index, |
| 8060 |
Dwarf_Unsigned * dw_symbol_kind, |
| 8061 |
Dwarf_Unsigned * dw_is_static, |
| 8062 |
Dwarf_Error * dw_error); |
| 8063 |
|
| 8064 |
/*! @brief Retrieve a symbol name from the index data. |
| 8065 |
|
| 8066 |
@param dw_gdbindexptr |
| 8067 |
Pass in the Dwarf_Gdbindex pointer of interest. |
| 8068 |
@param dw_stringoffset |
| 8069 |
Pass in the string offset returned by |
| 8070 |
dwarf_gdbindex_symboltable_entry |
| 8071 |
@param dw_string_ptr |
| 8072 |
On success returns a a pointer to the null-terminated |
| 8073 |
string. |
| 8074 |
@param dw_error |
| 8075 |
The usual pointer to return error details. |
| 8076 |
@return |
| 8077 |
Returns DW_DLV_OK etc. |
| 8078 |
*/ |
| 8079 |
DW_API int dwarf_gdbindex_string_by_offset( |
| 8080 |
Dwarf_Gdbindex dw_gdbindexptr, |
| 8081 |
Dwarf_Unsigned dw_stringoffset, |
| 8082 |
const char ** dw_string_ptr, |
| 8083 |
Dwarf_Error * dw_error); |
| 8084 |
/*! @} */ |
| 8085 |
|
| 8086 |
/*! @defgroup splitdwarf Fast Access to Split Dwarf (Debug Fission) |
| 8087 |
@{ |
| 8088 |
*/ |
| 8089 |
/*! @brief Access a .debug_cu_index or dw_tu_index section |
| 8090 |
|
| 8091 |
These sections are in a DWARF5 package file, a file normally |
| 8092 |
named with the .dwo or .dwp extension.. |
| 8093 |
See DWARF5 section 7.3.5.3 Format of the CU and TU |
| 8094 |
Index Sections. |
| 8095 |
|
| 8096 |
@param dw_dbg |
| 8097 |
Pass in the Dwarf_Debug of interest |
| 8098 |
@param dw_section_type |
| 8099 |
Pass in a pointer to either "cu" or "tu". |
| 8100 |
@param dw_xuhdr |
| 8101 |
On success, returns a pointer usable in further |
| 8102 |
calls. |
| 8103 |
@param dw_version_number |
| 8104 |
On success returns five. |
| 8105 |
@param dw_section_count |
| 8106 |
On success returns the number of entries |
| 8107 |
in the table of section counts. Referred to as @b N. |
| 8108 |
@param dw_units_count |
| 8109 |
On success returns the number of compilation units or |
| 8110 |
type units in the index. Referred to as @b U. |
| 8111 |
@param dw_hash_slots_count |
| 8112 |
On success returns the number of slots in the hash table. |
| 8113 |
Referred to as @b S. |
| 8114 |
@param dw_sect_name |
| 8115 |
On success returns a pointer to the name of the section. |
| 8116 |
Do not free/dealloc the returned pointer. |
| 8117 |
@param dw_error |
| 8118 |
The usual pointer to return error details. |
| 8119 |
@return |
| 8120 |
Returns DW_DLV_OK etc. |
| 8121 |
Returns DW_DLV_NO_ENTRY if the section requested |
| 8122 |
is not present. |
| 8123 |
*/ |
| 8124 |
DW_API int dwarf_get_xu_index_header(Dwarf_Debug dw_dbg, |
| 8125 |
const char * dw_section_type, /* "tu" or "cu" */ |
| 8126 |
Dwarf_Xu_Index_Header * dw_xuhdr, |
| 8127 |
Dwarf_Unsigned * dw_version_number, |
| 8128 |
Dwarf_Unsigned * dw_section_count, |
| 8129 |
Dwarf_Unsigned * dw_units_count, |
| 8130 |
Dwarf_Unsigned * dw_hash_slots_count, |
| 8131 |
const char ** dw_sect_name, |
| 8132 |
Dwarf_Error * dw_error); |
| 8133 |
|
| 8134 |
/*! @brief Dealloc (free) memory associated with dw_xuhdr. |
| 8135 |
|
| 8136 |
Should be named dwarf_dealloc_xuhdr instead. |
| 8137 |
@param dw_xuhdr |
| 8138 |
Dealloc (free) all associated memory. |
| 8139 |
The caller should zero the passed in value |
| 8140 |
on return as it is then a stale value. |
| 8141 |
*/ |
| 8142 |
DW_API void dwarf_dealloc_xu_header(Dwarf_Xu_Index_Header dw_xuhdr); |
| 8143 |
|
| 8144 |
/*! @brief Return basic information about a Dwarf_Xu_Index_Header |
| 8145 |
@param dw_xuhdr |
| 8146 |
Pass in an open header pointer. |
| 8147 |
@param dw_typename |
| 8148 |
On success returns a pointer to |
| 8149 |
the immutable string "tu" or "cu". Do not free. |
| 8150 |
@param dw_sectionname |
| 8151 |
On success returns a pointer to the section name |
| 8152 |
in the object file. Do not free. |
| 8153 |
@param dw_error |
| 8154 |
The usual pointer to return error details. |
| 8155 |
@return |
| 8156 |
Returns DW_DLV_OK etc. |
| 8157 |
*/ |
| 8158 |
DW_API int dwarf_get_xu_index_section_type( |
| 8159 |
Dwarf_Xu_Index_Header dw_xuhdr, |
| 8160 |
const char ** dw_typename, |
| 8161 |
const char ** dw_sectionname, |
| 8162 |
Dwarf_Error * dw_error); |
| 8163 |
|
| 8164 |
/*! @brief Get a Hash Entry |
| 8165 |
|
| 8166 |
@see examplez/x |
| 8167 |
|
| 8168 |
@param dw_xuhdr |
| 8169 |
Pass in an open header pointer. |
| 8170 |
@param dw_index |
| 8171 |
Pass in the index of the entry you wish. |
| 8172 |
Valid index values are 0 through @b S-1. |
| 8173 |
If the dw_index passed in is outside the valid range |
| 8174 |
the functionj |
| 8175 |
@param dw_hash_value |
| 8176 |
Pass in a pointer to a Dwarf_Sig8. |
| 8177 |
On success the hash struct is filled in with |
| 8178 |
the 8 byte hash value. |
| 8179 |
@param dw_index_to_sections |
| 8180 |
On success returns the offset/size table |
| 8181 |
index for this hash entry. |
| 8182 |
@param dw_error |
| 8183 |
The usual pointer to return error details. |
| 8184 |
@return |
| 8185 |
Returns DW_DLV_OK on success. |
| 8186 |
If the dw_index passed in is outside the valid range |
| 8187 |
the function it returns DW_DLV_NO_ENTRY |
| 8188 |
(before version 0.7.0 it returned DW_DLV_ERROR, |
| 8189 |
though nothing mentioned that). |
| 8190 |
In case of error it returns DW_DLV_ERROR. |
| 8191 |
If dw_error is non-null returns error details through |
| 8192 |
dw_error (the usual error behavior). |
| 8193 |
|
| 8194 |
*/ |
| 8195 |
DW_API int dwarf_get_xu_hash_entry(Dwarf_Xu_Index_Header dw_xuhdr, |
| 8196 |
Dwarf_Unsigned dw_index, |
| 8197 |
Dwarf_Sig8 * dw_hash_value, |
| 8198 |
Dwarf_Unsigned * dw_index_to_sections, |
| 8199 |
Dwarf_Error * dw_error); |
| 8200 |
|
| 8201 |
/* Columns 0 to L-1, valid. */ |
| 8202 |
/*! @brief get DW_SECT value for a column. |
| 8203 |
|
| 8204 |
@see exampleza |
| 8205 |
|
| 8206 |
@param dw_xuhdr |
| 8207 |
Pass in an open header pointer. |
| 8208 |
@param dw_column_index |
| 8209 |
The section names are in row zero of the |
| 8210 |
table so we do not mention the row number at all. |
| 8211 |
Pass in the column of the entry you wish. |
| 8212 |
Valid dw_column_index values are 0 through @b N-1. |
| 8213 |
@param dw_SECT_number |
| 8214 |
On success returns DW_SECT_INFO or other section |
| 8215 |
id as appears in dw_column_index. |
| 8216 |
@param dw_SECT_name |
| 8217 |
On success returns a pointer to the string for |
| 8218 |
with the section name. |
| 8219 |
@param dw_error |
| 8220 |
The usual pointer to return error details. |
| 8221 |
@return |
| 8222 |
Returns DW_DLV_OK etc. |
| 8223 |
*/ |
| 8224 |
DW_API int dwarf_get_xu_section_names(Dwarf_Xu_Index_Header dw_xuhdr, |
| 8225 |
Dwarf_Unsigned dw_column_index, |
| 8226 |
Dwarf_Unsigned* dw_SECT_number, |
| 8227 |
const char ** dw_SECT_name, |
| 8228 |
Dwarf_Error * dw_error); |
| 8229 |
|
| 8230 |
/*! @brief Get row data (section data) for a row and column |
| 8231 |
|
| 8232 |
@param dw_xuhdr |
| 8233 |
Pass in an open header pointer. |
| 8234 |
@param dw_row_index |
| 8235 |
Pass in a row number , 1 through @b U |
| 8236 |
@param dw_column_index |
| 8237 |
Pass in a column number , 0 through @b N-1 |
| 8238 |
@param dw_sec_offset |
| 8239 |
On success returns the section offset of |
| 8240 |
the section whose name dwarf_get_xu_section_names |
| 8241 |
returns. |
| 8242 |
@param dw_sec_size |
| 8243 |
On success returns the section size of |
| 8244 |
the section whose name dwarf_get_xu_section_names |
| 8245 |
returns. |
| 8246 |
@param dw_error |
| 8247 |
The usual pointer to return error details. |
| 8248 |
@return |
| 8249 |
Returns DW_DLV_OK etc. |
| 8250 |
*/ |
| 8251 |
DW_API int dwarf_get_xu_section_offset( |
| 8252 |
Dwarf_Xu_Index_Header dw_xuhdr, |
| 8253 |
Dwarf_Unsigned dw_row_index, |
| 8254 |
Dwarf_Unsigned dw_column_index, |
| 8255 |
Dwarf_Unsigned* dw_sec_offset, |
| 8256 |
Dwarf_Unsigned* dw_sec_size, |
| 8257 |
Dwarf_Error * dw_error); |
| 8258 |
|
| 8259 |
/*! @brief Get debugfission data for a Dwarf_Die |
| 8260 |
|
| 8261 |
For any Dwarf_Die in a compilation unit, return |
| 8262 |
the debug fission table data through dw_percu_out. |
| 8263 |
Usually applications |
| 8264 |
will pass in the CU die. |
| 8265 |
Calling code should zero all of the |
| 8266 |
struct Dwarf_Debug_Fission_Per_CU_s before calling this. |
| 8267 |
If there is no debugfission data this returns |
| 8268 |
DW_DLV_NO_ENTRY (only .dwp objects have debugfission data) |
| 8269 |
@param dw_die |
| 8270 |
Pass in a Dwarf_Die pointer, Usually pass in a CU DIE |
| 8271 |
pointer. |
| 8272 |
@param dw_percu_out |
| 8273 |
Pass in a pointer to a zeroed structure. |
| 8274 |
On success the function fills in the structure. |
| 8275 |
@param dw_error |
| 8276 |
The usual pointer to return error details. |
| 8277 |
@return |
| 8278 |
Returns DW_DLV_OK etc. |
| 8279 |
*/ |
| 8280 |
DW_API int dwarf_get_debugfission_for_die(Dwarf_Die dw_die, |
| 8281 |
Dwarf_Debug_Fission_Per_CU * dw_percu_out, |
| 8282 |
Dwarf_Error * dw_error); |
| 8283 |
|
| 8284 |
/*! @brief Given a hash signature find per-cu Fission data |
| 8285 |
|
| 8286 |
@param dw_dbg |
| 8287 |
Pass in the Dwarf_Debug of interest. |
| 8288 |
@param dw_hash_sig |
| 8289 |
Pass in a pointer to a Dwarf_Sig8 containing |
| 8290 |
a hash value of interest. |
| 8291 |
@param dw_cu_type |
| 8292 |
Pass in the type, a string. Either "cu" or "tu". |
| 8293 |
@param dw_percu_out |
| 8294 |
Pass in a pointer to a zeroed structure. |
| 8295 |
On success the function fills in the structure. |
| 8296 |
@param dw_error |
| 8297 |
The usual pointer to return error details. |
| 8298 |
@return |
| 8299 |
Returns DW_DLV_OK etc. |
| 8300 |
*/ |
| 8301 |
DW_API int dwarf_get_debugfission_for_key(Dwarf_Debug dw_dbg, |
| 8302 |
Dwarf_Sig8 * dw_hash_sig, |
| 8303 |
const char * dw_cu_type, |
| 8304 |
Dwarf_Debug_Fission_Per_CU * dw_percu_out, |
| 8305 |
Dwarf_Error * dw_error); |
| 8306 |
|
| 8307 |
/* END debugfission dwp .debug_cu_index |
| 8308 |
and .debug_tu_index meaningful operations. */ |
| 8309 |
|
| 8310 |
/*! @} */ |
| 8311 |
|
| 8312 |
/*! @defgroup gnudebuglink Access GNU .gnu_debuglink, build-id. |
| 8313 |
|
| 8314 |
@{ |
| 8315 |
When DWARF sections are in a differenct object |
| 8316 |
than the executable or a normal shared object. |
| 8317 |
The special GNU section provides a way to name |
| 8318 |
the object file with DWARF. |
| 8319 |
|
| 8320 |
libdwarf will attempt to use this data to find |
| 8321 |
the object file with DWARF. |
| 8322 |
|
| 8323 |
Has nothing to do with split-dwarf/debug-fission. |
| 8324 |
*/ |
| 8325 |
|
| 8326 |
/*! @brief Find a separated DWARF object file |
| 8327 |
|
| 8328 |
.gnu_debuglink and/or the section .note.gnu.build-id. |
| 8329 |
|
| 8330 |
Unless something is odd and you want to know details |
| 8331 |
of the two sections you will not need this function. |
| 8332 |
|
| 8333 |
@see https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html |
| 8334 |
|
| 8335 |
@see exampledebuglink |
| 8336 |
|
| 8337 |
If no debuglink then name_returned,crc_returned and |
| 8338 |
debuglink_path_returned will get set 0 through the pointers. |
| 8339 |
|
| 8340 |
If no .note.gnu.build-id then buildid_length_returned, |
| 8341 |
and buildid_returned will be set 0 through the pointers. |
| 8342 |
|
| 8343 |
In most cases output arguments can be passed as zero |
| 8344 |
and the function will simply not return data through |
| 8345 |
such arguments. Useful if you only care about some |
| 8346 |
of the data potentially returned. |
| 8347 |
|
| 8348 |
If dw_debuglink_fullpath returned is set by |
| 8349 |
the call the space allocated must be freed |
| 8350 |
by the caller with free(dw_debuglink_fullpath_returned). |
| 8351 |
|
| 8352 |
if dw_debuglink_paths_returned is set by the call |
| 8353 |
the space allocated must be free by |
| 8354 |
the caller with free(dw_debuglink_paths_returned). |
| 8355 |
|
| 8356 |
dwarf_finish() will not free strings |
| 8357 |
dw_debuglink_fullpath_returned or |
| 8358 |
dw_debuglink_paths_returned. |
| 8359 |
|
| 8360 |
@param dw_dbg |
| 8361 |
The Dwarf_Debug of interest. |
| 8362 |
@param dw_debuglink_path_returned |
| 8363 |
On success returns a pointer to |
| 8364 |
a path in the debuglink section. Do not free! |
| 8365 |
@param dw_crc_returned |
| 8366 |
On success returns a pointer to a 4 byte area |
| 8367 |
through the pointer. |
| 8368 |
@param dw_debuglink_fullpath_returned |
| 8369 |
On success returns a pointer to a full path |
| 8370 |
computed from debuglink data of |
| 8371 |
a correct path to a file with DWARF sections. Free this string |
| 8372 |
when no longer of interest. |
| 8373 |
@param dw_debuglink_path_length_returned |
| 8374 |
On success returns the strlen() of |
| 8375 |
dw_debuglink_fullpath_returned . |
| 8376 |
@param dw_buildid_type_returned |
| 8377 |
On success returns a pointer to integer with |
| 8378 |
a type code. See the buildid definition. |
| 8379 |
@param dw_buildid_owner_name_returned |
| 8380 |
On success returns a pointer to the owner |
| 8381 |
name from the buildid section. Do not free this. |
| 8382 |
@param dw_buildid_returned |
| 8383 |
On success returns a pointer to a sequence of bytes |
| 8384 |
containing the buildid. |
| 8385 |
@param dw_buildid_length_returned |
| 8386 |
On success this is set to the length of the |
| 8387 |
set of bytes pointed to by dw_buildid_returned . |
| 8388 |
@param dw_paths_returned |
| 8389 |
On success sets a pointer to an array of |
| 8390 |
pointers to strings, each with a global path. |
| 8391 |
These strings must be freed by the caller, |
| 8392 |
dwarf_finish() will not free these strings. |
| 8393 |
Call free(dw_paths_returned). |
| 8394 |
|
| 8395 |
@param dw_paths_length_returned |
| 8396 |
On success returns the length of the array of string |
| 8397 |
pointers dw_paths_returned points at. |
| 8398 |
@param dw_error |
| 8399 |
The usual pointer to return error details. |
| 8400 |
@return |
| 8401 |
Returns DW_DLV_OK etc. |
| 8402 |
*/ |
| 8403 |
DW_API int dwarf_gnu_debuglink(Dwarf_Debug dw_dbg, |
| 8404 |
char ** dw_debuglink_path_returned, |
| 8405 |
unsigned char ** dw_crc_returned, |
| 8406 |
char ** dw_debuglink_fullpath_returned, |
| 8407 |
unsigned int * dw_debuglink_path_length_returned, |
| 8408 |
unsigned int * dw_buildid_type_returned, |
| 8409 |
char ** dw_buildid_owner_name_returned, |
| 8410 |
unsigned char ** dw_buildid_returned, |
| 8411 |
unsigned int * dw_buildid_length_returned, |
| 8412 |
char *** dw_paths_returned, |
| 8413 |
unsigned int * dw_paths_length_returned, |
| 8414 |
Dwarf_Error* dw_error); |
| 8415 |
|
| 8416 |
/*! @brief Suppressing crc calculations |
| 8417 |
|
| 8418 |
The .gnu_debuglink section contains a compilation-system |
| 8419 |
created crc (4 byte) value. If dwarf_init_path[_dl]() |
| 8420 |
is called such a section can result in the reader/consumer |
| 8421 |
calculating the crc value of a different object file. |
| 8422 |
Which on a large object file could seem slow. |
| 8423 |
See https://en.wikipedia.org/wiki/Cyclic_redundancy_check |
| 8424 |
|
| 8425 |
When one is confident that any debug_link file found |
| 8426 |
is the appropriate one one can call dwarf_suppress_debuglink_crc |
| 8427 |
with a non-zero argument and any dwarf_init_path[_dl] call |
| 8428 |
will skip debuglink crc calculations and just assume |
| 8429 |
the crc would match whenever it applies. |
| 8430 |
This is a global flag, applies to all Dwarf_Debug opened |
| 8431 |
after the call in the program execution. |
| 8432 |
|
| 8433 |
Does not apply to the .note.gnu.buildid section as |
| 8434 |
that section never implies the reader/consumer needs |
| 8435 |
to do a crc calculation. |
| 8436 |
|
| 8437 |
@param dw_suppress |
| 8438 |
Pass in 1 to suppress future calculation of crc values |
| 8439 |
to verify a debuglink target is correct. So use |
| 8440 |
only when you know this is safe. |
| 8441 |
Pass in 0 to ensure future dwarf_init_path_dl calls |
| 8442 |
compute debuglink CRC values as required. |
| 8443 |
@return |
| 8444 |
Returns the previous value of the global flag. |
| 8445 |
|
| 8446 |
@link dwsec_separatedebug Details on separate DWARF object access @endlink |
| 8447 |
*/ |
| 8448 |
DW_API int dwarf_suppress_debuglink_crc(int dw_suppress); |
| 8449 |
|
| 8450 |
/*! @brief Adding debuglink global paths |
| 8451 |
|
| 8452 |
Used inside src/bin/dwarfexample/dwdebuglink.c |
| 8453 |
so we can show all that is going on. |
| 8454 |
The following has the explanation for how debuglink |
| 8455 |
and global paths interact: |
| 8456 |
@see https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html |
| 8457 |
|
| 8458 |
@param dw_dbg |
| 8459 |
Pass in the Dwarf_Debug of interest. |
| 8460 |
@param dw_pathname |
| 8461 |
Pass in a pathname to add to the list of global paths |
| 8462 |
used by debuglink. |
| 8463 |
@param dw_error |
| 8464 |
The usual pointer to return error details. |
| 8465 |
@return |
| 8466 |
Returns DW_DLV_OK etc. |
| 8467 |
*/ |
| 8468 |
DW_API int dwarf_add_debuglink_global_path(Dwarf_Debug dw_dbg, |
| 8469 |
const char * dw_pathname, |
| 8470 |
Dwarf_Error* dw_error); |
| 8471 |
|
| 8472 |
/*! @brief Crc32 used for debuglink crc calculation. |
| 8473 |
|
| 8474 |
Caller passes pointer to array of 4 unsigned char |
| 8475 |
provided by the caller and if this returns DW_DLV_OK |
| 8476 |
that array is filled in. |
| 8477 |
|
| 8478 |
Callers must guarantee dw_crcbuf points |
| 8479 |
to at least 4 bytes of writable memory. |
| 8480 |
Passing in a null dw_crcbug results in an |
| 8481 |
immediate return of DW_DLV_NO_ENTRY and |
| 8482 |
the pointer is not used. |
| 8483 |
|
| 8484 |
@param dw_dbg |
| 8485 |
Pass in an open dw_dbg. When you attempted |
| 8486 |
to open it, and it succeeded then pass the |
| 8487 |
it via the Dwarf_Debug |
| 8488 |
The function reads the file into memory |
| 8489 |
and performs a crc calculation. |
| 8490 |
@param dw_crcbuf |
| 8491 |
Pass in a pointer to a 4 byte area to hold |
| 8492 |
the returned crc, on success the function |
| 8493 |
puts the 4 bytes there. |
| 8494 |
@param dw_error |
| 8495 |
The usual pointer to return error details. |
| 8496 |
@return |
| 8497 |
Returns DW_DLV_OK etc. |
| 8498 |
*/ |
| 8499 |
DW_API int dwarf_crc32(Dwarf_Debug dw_dbg, |
| 8500 |
unsigned char * dw_crcbuf, |
| 8501 |
Dwarf_Error * dw_error); |
| 8502 |
|
| 8503 |
/*! @brief Public interface to the real crc calculation |
| 8504 |
|
| 8505 |
It is unlikely this is useful. The calculation will |
| 8506 |
not produce a return matching that of Linux/Macos if |
| 8507 |
the compiler implements unsigned int or signed int as |
| 8508 |
16 bits long. |
| 8509 |
|
| 8510 |
The caller must guarantee that dw_buf is non-null |
| 8511 |
and pointing to dw_len bytes of readable memory. |
| 8512 |
If dw_buf is NULL then 0 is immediately returned |
| 8513 |
and there is no indication of error. |
| 8514 |
|
| 8515 |
@param dw_buf |
| 8516 |
Pass in a pointer to some bytes on which the |
| 8517 |
crc calculation as done in debuglink is to be done. |
| 8518 |
@param dw_len |
| 8519 |
Pass in the length in bytes of dw_buf. |
| 8520 |
@param dw_init |
| 8521 |
Pass in the initial 32 bit value, zero is the right choice. |
| 8522 |
@return |
| 8523 |
Returns an int (assumed 32 bits int!) |
| 8524 |
with the calculated crc. |
| 8525 |
*/ |
| 8526 |
DW_API unsigned int dwarf_basic_crc32(const unsigned char * dw_buf, |
| 8527 |
unsigned long dw_len, |
| 8528 |
unsigned int dw_init); |
| 8529 |
/*! @} */ |
| 8530 |
|
| 8531 |
/*! @defgroup harmless Harmless Error recording |
| 8532 |
|
| 8533 |
@{ |
| 8534 |
The harmless error list is a fixed size circular buffer of |
| 8535 |
errors we note but which do not stop us from processing |
| 8536 |
the object. Created so dwarfdump or other tools |
| 8537 |
can report such inconsequential errors without causing |
| 8538 |
anything to stop early. |
| 8539 |
|
| 8540 |
You can change the list size from the default of |
| 8541 |
DW_HARMLESS_ERROR_CIRCULAR_LIST_DEFAULT_SIZE |
| 8542 |
at any time for a Dwarf_Debug dbg. |
| 8543 |
|
| 8544 |
Harmless error data is dealloc'd by dwarf_finish(). |
| 8545 |
*/ |
| 8546 |
/*! @brief Default size of the libdwarf-internal circular list */ |
| 8547 |
#define DW_HARMLESS_ERROR_CIRCULAR_LIST_DEFAULT_SIZE 4 |
| 8548 |
|
| 8549 |
/*! @brief Get the harmless error count and content |
| 8550 |
|
| 8551 |
User code supplies size of array of pointers dw_errmsg_ptrs_array |
| 8552 |
in count and the array of pointers (the pointers themselves |
| 8553 |
need not be initialized). |
| 8554 |
The pointers returned in the array of pointers |
| 8555 |
are invalidated by ANY call to libdwarf. |
| 8556 |
Use them before making another libdwarf call! |
| 8557 |
The array of string pointers passed in always has |
| 8558 |
a final null pointer, so if there are N pointers the |
| 8559 |
and M actual strings, then MIN(M,N-1) pointers are |
| 8560 |
set to point to error strings. The array of pointers |
| 8561 |
to strings always terminates with a NULL pointer. |
| 8562 |
Do not free the strings. Every string is null-terminated. |
| 8563 |
|
| 8564 |
Each call empties the error list (discarding all current entries). |
| 8565 |
and fills in your array |
| 8566 |
|
| 8567 |
@param dw_dbg |
| 8568 |
The applicable Dwarf_Debug. |
| 8569 |
@param dw_count |
| 8570 |
The number of string buffers. |
| 8571 |
If count is passed as zero no elements of the array are touched. |
| 8572 |
@param dw_errmsg_ptrs_array |
| 8573 |
A pointer to a user-created array of |
| 8574 |
pointer to const char. |
| 8575 |
@param dw_newerr_count |
| 8576 |
If non-NULL the count of harmless errors |
| 8577 |
pointers since the last call is returned through the pointer. |
| 8578 |
If dw_count is greater than zero the first dw_count |
| 8579 |
of the pointers in the user-created array point |
| 8580 |
to null-terminated strings. Do not free the strings. |
| 8581 |
print or copy the strings before any other libdwarf call. |
| 8582 |
|
| 8583 |
@return |
| 8584 |
Returns DW_DLV_NO_ENTRY if no harmless errors |
| 8585 |
were noted so far. Returns DW_DLV_OK if there are |
| 8586 |
harmless errors. Never returns DW_DLV_ERROR. |
| 8587 |
|
| 8588 |
If DW_DLV_NO_ENTRY is returned none of the arguments |
| 8589 |
other than dw_dbg are touched or used. |
| 8590 |
*/ |
| 8591 |
DW_API int dwarf_get_harmless_error_list(Dwarf_Debug dw_dbg, |
| 8592 |
unsigned int dw_count, |
| 8593 |
const char ** dw_errmsg_ptrs_array, |
| 8594 |
unsigned int * dw_newerr_count); |
| 8595 |
|
| 8596 |
/*! @brief The size of the circular list of strings |
| 8597 |
libdwarf holds internally may be set |
| 8598 |
and reset as needed. If it is shortened excess |
| 8599 |
messages are simply dropped. It returns the previous |
| 8600 |
size. If zero passed in the size is unchanged |
| 8601 |
and it simply returns the current size. |
| 8602 |
|
| 8603 |
@param dw_dbg |
| 8604 |
The applicable Dwarf_Debug. |
| 8605 |
@param dw_maxcount |
| 8606 |
Set the new internal buffer count to a number greater |
| 8607 |
than zero. |
| 8608 |
@return |
| 8609 |
returns the current size of the internal circular |
| 8610 |
buffer if dw_maxcount is zero. |
| 8611 |
If dw_maxcount is greater than zero the internal |
| 8612 |
array is adjusted to hold that many and the |
| 8613 |
previous number of harmless errors possible in |
| 8614 |
the circular buffer is returned. |
| 8615 |
*/ |
| 8616 |
DW_API unsigned int dwarf_set_harmless_error_list_size( |
| 8617 |
Dwarf_Debug dw_dbg, |
| 8618 |
unsigned int dw_maxcount); |
| 8619 |
|
| 8620 |
/*! @brief Harmless Error Insertion is only for testing |
| 8621 |
|
| 8622 |
Useful for testing the harmless error mechanism. |
| 8623 |
|
| 8624 |
@param dw_dbg |
| 8625 |
Pass in an open Dwarf_Debug |
| 8626 |
@param dw_newerror |
| 8627 |
Pass in a string whose content the function |
| 8628 |
inserts as a harmless error (which |
| 8629 |
dwarf_get_harmless_error_list will retrieve). |
| 8630 |
*/ |
| 8631 |
DW_API void dwarf_insert_harmless_error(Dwarf_Debug dw_dbg, |
| 8632 |
char * dw_newerror); |
| 8633 |
/*! @} */ |
| 8634 |
|
| 8635 |
/*! @defgroup Naming Names DW_TAG_member etc as strings |
| 8636 |
|
| 8637 |
@{ |
| 8638 |
Given a value you know is one of a particular |
| 8639 |
name category in DWARF2 or later, call the |
| 8640 |
appropriate function and on finding the name it |
| 8641 |
returns DW_DLV_OK and sets the |
| 8642 |
identifier for the value through a pointer. |
| 8643 |
On success |
| 8644 |
these functions return the string corresponding |
| 8645 |
to @b dw_val_in passed in |
| 8646 |
through the pointer @b dw_s_out and the value |
| 8647 |
returned is DW_DLV_OK. |
| 8648 |
|
| 8649 |
The strings returned on sucess are in static storage |
| 8650 |
and must not be freed. |
| 8651 |
|
| 8652 |
These functions are generated from information |
| 8653 |
in dwarf.h, not hand coded functions. |
| 8654 |
|
| 8655 |
If DW_DLV_NO_ENTRY is returned the @b dw_val_in is not known and |
| 8656 |
@b *s_out is not set. This is unusual. |
| 8657 |
|
| 8658 |
DW_DLV_ERROR is never returned. |
| 8659 |
|
| 8660 |
The example referred to offers the suggested way |
| 8661 |
to use functions like these. |
| 8662 |
|
| 8663 |
@see examplezb |
| 8664 |
|
| 8665 |
*/ |
| 8666 |
/*! @brief dwarf_get_ACCESS_name |
| 8667 |
*/ |
| 8668 |
DW_API int dwarf_get_ACCESS_name(unsigned int dw_val_in, |
| 8669 |
const char ** dw_s_out); |
| 8670 |
/*! @brief dwarf_get_ADDR_name |
| 8671 |
*/ |
| 8672 |
DW_API int dwarf_get_ADDR_name(unsigned int dw_val_in, |
| 8673 |
const char ** dw_s_out); |
| 8674 |
/*! @brief dwarf_get_AT_name |
| 8675 |
*/ |
| 8676 |
DW_API int dwarf_get_AT_name(unsigned int dw_val_in, |
| 8677 |
const char ** dw_s_out); |
| 8678 |
/*! @brief dwarf_get_AT_name |
| 8679 |
*/ |
| 8680 |
DW_API int dwarf_get_ATCF_name(unsigned int dw_val_in, |
| 8681 |
const char ** dw_s_out); |
| 8682 |
/*! @brief dwarf_get_ATE_name |
| 8683 |
*/ |
| 8684 |
DW_API int dwarf_get_ATE_name(unsigned int dw_val_in, |
| 8685 |
const char ** dw_s_out); |
| 8686 |
/*! @brief dwarf_get_CC_name |
| 8687 |
*/ |
| 8688 |
DW_API int dwarf_get_CC_name(unsigned int dw_val_in, |
| 8689 |
const char ** dw_s_out); |
| 8690 |
/*! @brief dwarf_get_CFA_name |
| 8691 |
*/ |
| 8692 |
DW_API int dwarf_get_CFA_name(unsigned int dw_val_in, |
| 8693 |
const char ** dw_s_out); |
| 8694 |
/*! @brief dwarf_get_children_namea - historic misspelling. |
| 8695 |
*/ |
| 8696 |
DW_API int dwarf_get_children_name(unsigned int dw_val_in, |
| 8697 |
const char ** dw_s_out); |
| 8698 |
/*! @brief dwarf_get_CHILDREN_name |
| 8699 |
*/ |
| 8700 |
DW_API int dwarf_get_CHILDREN_name(unsigned int dw_val_in, |
| 8701 |
const char ** dw_s_out); |
| 8702 |
/*! @brief dwarf_get_DEFAULTED_name |
| 8703 |
*/ |
| 8704 |
DW_API int dwarf_get_DEFAULTED_name(unsigned int dw_val_in, |
| 8705 |
const char ** dw_s_out); |
| 8706 |
/*! @brief dwarf_get_DS_name |
| 8707 |
*/ |
| 8708 |
DW_API int dwarf_get_DS_name(unsigned int dw_val_in, |
| 8709 |
const char ** dw_s_out); |
| 8710 |
/*! @brief dwarf_get_DSC_name |
| 8711 |
*/ |
| 8712 |
DW_API int dwarf_get_DSC_name(unsigned int dw_val_in, |
| 8713 |
const char ** dw_s_out); |
| 8714 |
/*! @brief dwarf_get_GNUIKIND_name - libdwarf invention |
| 8715 |
|
| 8716 |
So we can report things GNU extensions sensibly. |
| 8717 |
*/ |
| 8718 |
DW_API int dwarf_get_GNUIKIND_name(unsigned int dw_val_in, |
| 8719 |
const char ** dw_s_out); |
| 8720 |
/*! @brief dwarf_get_EH_name |
| 8721 |
|
| 8722 |
So we can report this GNU extension sensibly. |
| 8723 |
*/ |
| 8724 |
DW_API int dwarf_get_EH_name(unsigned int dw_val_in, |
| 8725 |
const char ** dw_s_out); |
| 8726 |
/*! @brief dwarf_get_END_name |
| 8727 |
*/ |
| 8728 |
DW_API int dwarf_get_END_name(unsigned int dw_val_in, |
| 8729 |
const char ** dw_s_out); |
| 8730 |
/*! @brief dwarf_get_FORM_name |
| 8731 |
*/ |
| 8732 |
DW_API int dwarf_get_FORM_name(unsigned int dw_val_in, |
| 8733 |
const char ** dw_s_out); |
| 8734 |
/*! @brief This is a set of register names |
| 8735 |
|
| 8736 |
The set of register names is unlikely |
| 8737 |
to match your register set, but perhaps |
| 8738 |
this is better than no name. |
| 8739 |
*/ |
| 8740 |
DW_API int dwarf_get_FRAME_name(unsigned int dw_val_in, |
| 8741 |
const char ** dw_s_out); |
| 8742 |
/*! @brief dwarf_get_GNUIVIS_name - a libdwarf invention |
| 8743 |
|
| 8744 |
So we report a GNU extension sensibly. |
| 8745 |
*/ |
| 8746 |
DW_API int dwarf_get_GNUIVIS_name(unsigned int dw_val_in, |
| 8747 |
const char ** dw_s_out); |
| 8748 |
|
| 8749 |
/*! @brief dwarf_get_ID_name |
| 8750 |
*/ |
| 8751 |
DW_API int dwarf_get_ID_name(unsigned int dw_val_in, |
| 8752 |
const char ** dw_s_out); |
| 8753 |
/*! @brief dwarf_get_IDX_name |
| 8754 |
*/ |
| 8755 |
DW_API int dwarf_get_IDX_name(unsigned int dw_val_in, |
| 8756 |
const char ** dw_s_out); |
| 8757 |
/*! @brief dwarf_get_INL_name |
| 8758 |
*/ |
| 8759 |
DW_API int dwarf_get_INL_name(unsigned int dw_val_in, |
| 8760 |
const char ** dw_s_out); |
| 8761 |
/*! @brief dwarf_get_ISA_name |
| 8762 |
*/ |
| 8763 |
DW_API int dwarf_get_ISA_name(unsigned int dw_val_in, |
| 8764 |
const char ** dw_s_out); |
| 8765 |
/*! @brief dwarf_get_LANG_name |
| 8766 |
*/ |
| 8767 |
DW_API int dwarf_get_LANG_name(unsigned int dw_val_in, |
| 8768 |
const char ** dw_s_out); |
| 8769 |
/*! @brief dwarf_get_LLE_name |
| 8770 |
*/ |
| 8771 |
DW_API int dwarf_get_LLE_name(unsigned int dw_val_in, |
| 8772 |
const char ** dw_s_out); |
| 8773 |
/*! @brief dwarf_get_LLEX_name - a GNU extension. |
| 8774 |
|
| 8775 |
The name is a libdwarf invention for the GNU extension. |
| 8776 |
So we report a GNU extension sensibly. |
| 8777 |
*/ |
| 8778 |
DW_API int dwarf_get_LLEX_name(unsigned int dw_val_in, |
| 8779 |
const char ** dw_s_out ); |
| 8780 |
|
| 8781 |
/*! @brief dwarf_get_LNCT_name |
| 8782 |
*/ |
| 8783 |
DW_API int dwarf_get_LNCT_name(unsigned int dw_val_in, |
| 8784 |
const char ** dw_s_out); |
| 8785 |
/*! @brief dwarf_get_LNE_name |
| 8786 |
*/ |
| 8787 |
DW_API int dwarf_get_LNE_name(unsigned int dw_val_in, |
| 8788 |
const char ** dw_s_out); |
| 8789 |
/*! @brief dwarf_get_LNS_name |
| 8790 |
*/ |
| 8791 |
DW_API int dwarf_get_LNS_name(unsigned int dw_val_in, |
| 8792 |
const char ** dw_s_out); |
| 8793 |
/*! @brief dwarf_get_MACINFO_name |
| 8794 |
|
| 8795 |
Used in DWARF2-DWARF4 |
| 8796 |
*/ |
| 8797 |
DW_API int dwarf_get_MACINFO_name(unsigned int dw_val_in, |
| 8798 |
const char ** dw_s_out); |
| 8799 |
/*! @brief dwarf_get_MACRO_name |
| 8800 |
|
| 8801 |
Used in DWARF5 |
| 8802 |
*/ |
| 8803 |
DW_API int dwarf_get_MACRO_name(unsigned int dw_val_in, |
| 8804 |
const char ** dw_s_out); |
| 8805 |
/*! @brief dwarf_get_OP_name |
| 8806 |
*/ |
| 8807 |
DW_API int dwarf_get_OP_name(unsigned int dw_val_in, |
| 8808 |
const char ** dw_s_out); |
| 8809 |
/*! @brief dwarf_get_ORD_name |
| 8810 |
*/ |
| 8811 |
DW_API int dwarf_get_ORD_name(unsigned int dw_val_in, |
| 8812 |
const char ** dw_s_out); |
| 8813 |
/*! @brief dwarf_get_RLE_name |
| 8814 |
*/ |
| 8815 |
DW_API int dwarf_get_RLE_name(unsigned int dw_val_in, |
| 8816 |
const char ** dw_s_out); |
| 8817 |
/*! @brief dwarf_get_SECT_name |
| 8818 |
*/ |
| 8819 |
DW_API int dwarf_get_SECT_name(unsigned int dw_val_in, |
| 8820 |
const char ** dw_s_out); |
| 8821 |
/*! @brief dwarf_get_TAG_name |
| 8822 |
*/ |
| 8823 |
DW_API int dwarf_get_TAG_name(unsigned int dw_val_in, |
| 8824 |
const char ** dw_s_out); |
| 8825 |
/*! @brief dwarf_get_UT_name |
| 8826 |
*/ |
| 8827 |
DW_API int dwarf_get_UT_name(unsigned int dw_val_in, |
| 8828 |
const char ** dw_s_out); |
| 8829 |
/*! @brief dwarf_get_VIRTUALITY_name |
| 8830 |
*/ |
| 8831 |
DW_API int dwarf_get_VIRTUALITY_name(unsigned int dw_val_in, |
| 8832 |
const char ** dw_s_out); |
| 8833 |
/*! @brief dwarf_get_VIS_name |
| 8834 |
*/ |
| 8835 |
DW_API int dwarf_get_VIS_name(unsigned int dw_val_in, |
| 8836 |
const char ** dw_s_out); |
| 8837 |
|
| 8838 |
/*! @brief dwarf_get_FORM_CLASS_name is for a libdwarf |
| 8839 |
extension. |
| 8840 |
Not defined by the DWARF standard |
| 8841 |
though the concept is defined in the standard. |
| 8842 |
It seemed essential to invent it for libdwarf |
| 8843 |
to report correctly. |
| 8844 |
|
| 8845 |
See DWARF5 Table 2.3, Classes of Attribute Value page 23. |
| 8846 |
Earlier DWARF versions have a similar table. |
| 8847 |
*/ |
| 8848 |
DW_API int dwarf_get_FORM_CLASS_name(enum Dwarf_Form_Class dw_fc, |
| 8849 |
const char ** dw_s_out); |
| 8850 |
/*! @} */ |
| 8851 |
|
| 8852 |
/*! @defgroup objectsections Object Sections Data |
| 8853 |
@{ |
| 8854 |
|
| 8855 |
These functions are not often used. They |
| 8856 |
give access to section- and objectfile-related |
| 8857 |
information, and that sort of information |
| 8858 |
is not generally needed to understand DWARF content.. |
| 8859 |
|
| 8860 |
Section name access. Because names sections |
| 8861 |
such as .debug_info might |
| 8862 |
end with .dwo or be .zdebug or might not. |
| 8863 |
|
| 8864 |
String pointers returned via these functions |
| 8865 |
must not be freed, the strings are statically |
| 8866 |
declared. |
| 8867 |
|
| 8868 |
For non-Elf the name reported will be as if |
| 8869 |
it were Elf sections. For example, not the names |
| 8870 |
MacOS puts in its object sections (which |
| 8871 |
the MacOS reader translates). |
| 8872 |
|
| 8873 |
These calls returning selected object header |
| 8874 |
{machine architecture,flags) |
| 8875 |
and section (offset, flags) data |
| 8876 |
are not of interest to most library callers: |
| 8877 |
dwarf_machine_architecture(), |
| 8878 |
dwarf_get_section_info_by_index_a(), and |
| 8879 |
dwarf_get_section_info_by_name_a(). |
| 8880 |
|
| 8881 |
The simple calls will not be documented in full detail here. |
| 8882 |
|
| 8883 |
*/ |
| 8884 |
/*! @brief Get the real name a DIE section. |
| 8885 |
|
| 8886 |
@b dw_is_info |
| 8887 |
|
| 8888 |
@param dw_dbg |
| 8889 |
The Dwarf_Debug of interest |
| 8890 |
@param dw_is_info |
| 8891 |
We do not pass in a DIE, so we have to |
| 8892 |
pass in TRUE for for .debug_info, or if |
| 8893 |
DWARF4 .debug_types pass in FALSE. |
| 8894 |
@param dw_sec_name |
| 8895 |
On success returns a pointer to the actual |
| 8896 |
section name in the object file. |
| 8897 |
Do not free the string. |
| 8898 |
@param dw_error |
| 8899 |
The usual error argument to report error details. |
| 8900 |
@return |
| 8901 |
DW_DLV_OK etc. |
| 8902 |
*/ |
| 8903 |
DW_API int dwarf_get_die_section_name(Dwarf_Debug dw_dbg, |
| 8904 |
Dwarf_Bool dw_is_info, |
| 8905 |
const char **dw_sec_name, |
| 8906 |
Dwarf_Error *dw_error); |
| 8907 |
|
| 8908 |
/*! @brief Get the real name of a DIE section. |
| 8909 |
|
| 8910 |
The same as @b dwarf_get_die_section_name |
| 8911 |
except we have a DIE so do not need @b dw_is_info |
| 8912 |
as a argument. |
| 8913 |
*/ |
| 8914 |
DW_API int dwarf_get_die_section_name_b(Dwarf_Die dw_die, |
| 8915 |
const char ** dw_sec_name, |
| 8916 |
Dwarf_Error * dw_error); |
| 8917 |
|
| 8918 |
/*! @brief Get the real name of a .debug_macro section. |
| 8919 |
*/ |
| 8920 |
DW_API int dwarf_get_macro_section_name(Dwarf_Debug dw_dbg, |
| 8921 |
const char ** dw_sec_name_out, |
| 8922 |
Dwarf_Error * dw_err); |
| 8923 |
|
| 8924 |
/*! @brief Get the real name of a section. |
| 8925 |
|
| 8926 |
If the object has section groups only the |
| 8927 |
sections in the group in dw_dbg will be |
| 8928 |
found. |
| 8929 |
|
| 8930 |
Whether .zdebug or ZLIB or SHF_COMPRESSED |
| 8931 |
is the marker there is just one uncompress |
| 8932 |
algorithm (zlib) for all three cases. |
| 8933 |
|
| 8934 |
@param dw_dbg |
| 8935 |
The Dwarf_Debug of interest. |
| 8936 |
@param dw_std_section_name |
| 8937 |
Pass in a standard section name, such as |
| 8938 |
.debug_info or .debug_info.dwo . |
| 8939 |
@param dw_actual_sec_name_out |
| 8940 |
On success returns the actual section name |
| 8941 |
from the object file. |
| 8942 |
@param dw_marked_zcompressed |
| 8943 |
On success returns TRUE if the original section name |
| 8944 |
ends in .zdebug |
| 8945 |
@param dw_marked_zlib_compressed |
| 8946 |
On success returns TRUE if the section has the ZLIB |
| 8947 |
string at the front of the section. |
| 8948 |
@param dw_marked_shf_compressed |
| 8949 |
On success returns TRUE if the section flag |
| 8950 |
(Elf SHF_COMPRESSED) is marked as compressed. |
| 8951 |
@param dw_compressed_length |
| 8952 |
On success if the section was compressed |
| 8953 |
it returns the original section length |
| 8954 |
in the object file. |
| 8955 |
@param dw_uncompressed_length |
| 8956 |
On success if the section was compressed this |
| 8957 |
returns the uncompressed length of the object section. |
| 8958 |
@param dw_error |
| 8959 |
On error returns the error usual details. |
| 8960 |
@return |
| 8961 |
The usual DW_DLV_OK etc. |
| 8962 |
If the section is not relevant to this Dwarf_Debug |
| 8963 |
or is not in the object file at all, returns |
| 8964 |
DW_DLV_NO_ENTRY |
| 8965 |
*/ |
| 8966 |
DW_API int dwarf_get_real_section_name(Dwarf_Debug dw_dbg, |
| 8967 |
const char * dw_std_section_name, |
| 8968 |
const char ** dw_actual_sec_name_out, |
| 8969 |
Dwarf_Small * dw_marked_zcompressed, |
| 8970 |
Dwarf_Small * dw_marked_zlib_compressed, |
| 8971 |
Dwarf_Small * dw_marked_shf_compressed, |
| 8972 |
Dwarf_Unsigned * dw_compressed_length, |
| 8973 |
Dwarf_Unsigned * dw_uncompressed_length, |
| 8974 |
Dwarf_Error * dw_error); |
| 8975 |
|
| 8976 |
/*! @brief Get .debug_frame section name |
| 8977 |
@return |
| 8978 |
returns DW_DLV_OK if the .debug_frame exists |
| 8979 |
*/ |
| 8980 |
DW_API int dwarf_get_frame_section_name(Dwarf_Debug dw_dbg, |
| 8981 |
const char ** dw_section_name_out, |
| 8982 |
Dwarf_Error * dw_error); |
| 8983 |
|
| 8984 |
/*! @brief Get GNU .eh_frame section name |
| 8985 |
@return |
| 8986 |
Returns DW_DLV_OK if the .debug_frame is present |
| 8987 |
Returns DW_DLV_NO_ENTRY if it is not present. |
| 8988 |
*/ |
| 8989 |
DW_API int dwarf_get_frame_section_name_eh_gnu(Dwarf_Debug dw_dbg, |
| 8990 |
const char ** dw_section_name_out, |
| 8991 |
Dwarf_Error * dw_error); |
| 8992 |
|
| 8993 |
/*! @brief Get .debug_aranges section name |
| 8994 |
The usual arguments. |
| 8995 |
*/ |
| 8996 |
DW_API int dwarf_get_aranges_section_name(Dwarf_Debug dw_dbg, |
| 8997 |
const char ** dw_section_name_out, |
| 8998 |
Dwarf_Error * dw_error); |
| 8999 |
|
| 9000 |
/*! @brief Get .debug_ranges section name |
| 9001 |
The usual arguments and return values. |
| 9002 |
*/ |
| 9003 |
DW_API int dwarf_get_ranges_section_name(Dwarf_Debug dw_dbg, |
| 9004 |
const char ** dw_section_name_out, |
| 9005 |
Dwarf_Error * dw_error); |
| 9006 |
|
| 9007 |
/* These two get the offset or address size as defined |
| 9008 |
by the object format (not by DWARF). */ |
| 9009 |
/*! @brief Get offset size as defined by the object |
| 9010 |
|
| 9011 |
This is not from DWARF information, it is |
| 9012 |
from object file headers. |
| 9013 |
*/ |
| 9014 |
DW_API int dwarf_get_offset_size(Dwarf_Debug dw_dbg, |
| 9015 |
Dwarf_Half * dw_offset_size, |
| 9016 |
Dwarf_Error * dw_error); |
| 9017 |
|
| 9018 |
/*! @brief Get the address size as defined by the object |
| 9019 |
|
| 9020 |
This is not from DWARF information, it is |
| 9021 |
from object file headers. |
| 9022 |
*/ |
| 9023 |
DW_API int dwarf_get_address_size(Dwarf_Debug dw_dbg, |
| 9024 |
Dwarf_Half * dw_addr_size, |
| 9025 |
Dwarf_Error * dw_error); |
| 9026 |
|
| 9027 |
/*! @brief Get the string table section name |
| 9028 |
The usual arguments and return values. |
| 9029 |
*/ |
| 9030 |
DW_API int dwarf_get_string_section_name(Dwarf_Debug dw_dbg, |
| 9031 |
const char ** dw_section_name_out, |
| 9032 |
Dwarf_Error * dw_error); |
| 9033 |
|
| 9034 |
/*! @brief Get the line table section name |
| 9035 |
The usual arguments and return values. |
| 9036 |
*/ |
| 9037 |
DW_API int dwarf_get_line_section_name(Dwarf_Debug dw_dbg, |
| 9038 |
const char ** dw_section_name_out, |
| 9039 |
Dwarf_Error * dw_error); |
| 9040 |
|
| 9041 |
/*! @brief Get the line table section name |
| 9042 |
|
| 9043 |
@param dw_die |
| 9044 |
Pass in a Dwarf_Die pointer. |
| 9045 |
@param dw_section_name_out |
| 9046 |
On success returns the section name, usually |
| 9047 |
some .debug_info* name but in DWARF4 could be |
| 9048 |
a .debug_types* name. |
| 9049 |
@param dw_error |
| 9050 |
On error returns the usual error pointer. |
| 9051 |
@return |
| 9052 |
Returns DW_DLV_OK etc. |
| 9053 |
*/ |
| 9054 |
DW_API int dwarf_get_line_section_name_from_die(Dwarf_Die dw_die, |
| 9055 |
const char ** dw_section_name_out, |
| 9056 |
Dwarf_Error * dw_error); |
| 9057 |
|
| 9058 |
/*! @brief Given a section name, get its size, address, etc |
| 9059 |
|
| 9060 |
New in v0.9.0 November 2023. |
| 9061 |
|
| 9062 |
This is not often used and is completely |
| 9063 |
unnecessary for most to call. |
| 9064 |
|
| 9065 |
See dwarf_get_section_info_by_name() for the |
| 9066 |
older and still current version. |
| 9067 |
|
| 9068 |
Any of the pointers |
| 9069 |
dw_section_addr, dw_section_size, dw_section_flags, |
| 9070 |
and dw_section_offset may be passed in as zero |
| 9071 |
and those will be ignored by the function. |
| 9072 |
|
| 9073 |
@param dw_dbg |
| 9074 |
The Dwarf_Debug of interest. |
| 9075 |
@param dw_section_name |
| 9076 |
Pass in a pointer to a section name. It |
| 9077 |
must be an exact match to the real section name. |
| 9078 |
@param dw_section_addr |
| 9079 |
On success returns the section address as defined |
| 9080 |
by an object header. |
| 9081 |
@param dw_section_size |
| 9082 |
On success returns the section size as defined |
| 9083 |
by an object header. |
| 9084 |
@param dw_section_flags |
| 9085 |
On success returns the section flags as defined |
| 9086 |
by an object header. |
| 9087 |
The flag meaning depends on which object format |
| 9088 |
is being read and the meaning is defined by |
| 9089 |
the object format. |
| 9090 |
We hope it is of some use. |
| 9091 |
In PE object files this |
| 9092 |
field is called @b Characteristics. |
| 9093 |
@param dw_section_offset |
| 9094 |
On success returns the section offset as defined |
| 9095 |
by an object header. |
| 9096 |
The offset meaning is supposedly an object file offset |
| 9097 |
but the meaning depends on the object file type(!). |
| 9098 |
We hope it is of some use. |
| 9099 |
@param dw_error |
| 9100 |
On error returns the usual error pointer. |
| 9101 |
@return |
| 9102 |
Returns DW_DLV_OK etc. |
| 9103 |
*/ |
| 9104 |
DW_API int dwarf_get_section_info_by_name_a(Dwarf_Debug dw_dbg, |
| 9105 |
const char * dw_section_name, |
| 9106 |
Dwarf_Addr * dw_section_addr, |
| 9107 |
Dwarf_Unsigned* dw_section_size, |
| 9108 |
Dwarf_Unsigned* dw_section_flags, |
| 9109 |
Dwarf_Unsigned* dw_section_offset, |
| 9110 |
Dwarf_Error * dw_error); |
| 9111 |
|
| 9112 |
/*! @brief Given a section name, get its size and address |
| 9113 |
|
| 9114 |
See dwarf_get_section_info_by_name_a() for the |
| 9115 |
newest version which returns additional values. |
| 9116 |
|
| 9117 |
Fields and meanings in dwarf_get_section_info_by_name() |
| 9118 |
are the same as in |
| 9119 |
dwarf_get_section_info_by_name_a() |
| 9120 |
except that the arguments dw_section_flags |
| 9121 |
and dw_section_offset are missing here. |
| 9122 |
*/ |
| 9123 |
|
| 9124 |
DW_API int dwarf_get_section_info_by_name(Dwarf_Debug dw_dbg, |
| 9125 |
const char * dw_section_name, |
| 9126 |
Dwarf_Addr * dw_section_addr, |
| 9127 |
Dwarf_Unsigned* dw_section_size, |
| 9128 |
Dwarf_Error * dw_error); |
| 9129 |
|
| 9130 |
/*! @brief Given a section index, get its size and address, etc |
| 9131 |
|
| 9132 |
See dwarf_get_section_info_by_index() for the |
| 9133 |
older and still current version. |
| 9134 |
|
| 9135 |
Any of the pointers |
| 9136 |
dw_section_addr, dw_section_size, dw_section_flags, |
| 9137 |
and dw_section_offset may be passed in as zero |
| 9138 |
and those will be ignored by the function. |
| 9139 |
|
| 9140 |
@param dw_dbg |
| 9141 |
The Dwarf_Debug of interest. |
| 9142 |
@param dw_section_index |
| 9143 |
Pass in an index, 0 through N-1 where |
| 9144 |
N is the count returned from dwarf_get_section_count . |
| 9145 |
As an index type -int- works in practice, but should |
| 9146 |
really be Dwarf_Unsigned. |
| 9147 |
@param dw_section_name |
| 9148 |
On success returns a pointer to the section name |
| 9149 |
as it appears in the object file. |
| 9150 |
@param dw_section_addr |
| 9151 |
On success returns the section address as defined |
| 9152 |
by an object header. |
| 9153 |
@param dw_section_size |
| 9154 |
On success returns the section size as defined |
| 9155 |
by an object header. |
| 9156 |
@param dw_section_flags |
| 9157 |
On success returns the section flags as defined |
| 9158 |
by an object header. |
| 9159 |
The flag meaning depends on which object format |
| 9160 |
is being read and the meaning is defined by |
| 9161 |
the object format. In PE object files this |
| 9162 |
field is called @b Characteristics. |
| 9163 |
We hope it is of some use. |
| 9164 |
@param dw_section_offset |
| 9165 |
On success returns the section offset as defined |
| 9166 |
by an object header. |
| 9167 |
The offset meaning is supposedly an object file offset |
| 9168 |
but the meaning depends on the object file type(!). |
| 9169 |
We hope it is of some use. |
| 9170 |
@param dw_error |
| 9171 |
On error returns the usual error pointer. |
| 9172 |
@return |
| 9173 |
Returns DW_DLV_OK etc. |
| 9174 |
*/ |
| 9175 |
DW_API int dwarf_get_section_info_by_index_a(Dwarf_Debug dw_dbg, |
| 9176 |
int dw_section_index, |
| 9177 |
const char ** dw_section_name, |
| 9178 |
Dwarf_Addr* dw_section_addr, |
| 9179 |
Dwarf_Unsigned* dw_section_size, |
| 9180 |
Dwarf_Unsigned* dw_section_flags, |
| 9181 |
Dwarf_Unsigned* dw_section_offset, |
| 9182 |
Dwarf_Error* dw_error); |
| 9183 |
|
| 9184 |
/*! @brief Given a section index, get its size and address |
| 9185 |
|
| 9186 |
See dwarf_get_section_info_by_index_a() for the |
| 9187 |
newest version which returns additional values. |
| 9188 |
|
| 9189 |
Fields and meanings in dwarf_get_section_info_by_index() |
| 9190 |
are the same as in |
| 9191 |
dwarf_get_section_info_by_index_a() |
| 9192 |
except that the arguments dw_section_flags |
| 9193 |
and dw_section_offset are missing here. |
| 9194 |
*/ |
| 9195 |
|
| 9196 |
DW_API int dwarf_get_section_info_by_index(Dwarf_Debug dw_dbg, |
| 9197 |
int dw_section_index, |
| 9198 |
const char ** dw_section_name, |
| 9199 |
Dwarf_Addr* dw_section_addr, |
| 9200 |
Dwarf_Unsigned* dw_section_size, |
| 9201 |
Dwarf_Error* dw_error); |
| 9202 |
|
| 9203 |
/*! @brief Get basic object information from Dwarf_Debug |
| 9204 |
|
| 9205 |
Not all the fields here are relevant for all object |
| 9206 |
types, and the dw_obj_machine and dw_obj_flags |
| 9207 |
have ABI-defined values which have nothing to do |
| 9208 |
with DWARF. |
| 9209 |
|
| 9210 |
dwarf_ub_offset, dw_ub_count, dw_ub_index only |
| 9211 |
apply to DW_FTYPE_APPLEUNIVERSAL. |
| 9212 |
|
| 9213 |
dw_comdat_groupnumber only applies to DW_FTYPE_ELF. |
| 9214 |
|
| 9215 |
Other than dw_dbg one can pass in NULL for any |
| 9216 |
pointer parameter whose value is not of interest. |
| 9217 |
|
| 9218 |
@param dw_dbg |
| 9219 |
The Dwarf_Debug of interest. |
| 9220 |
@param dw_ftype |
| 9221 |
Pass in a pointer. On success the value |
| 9222 |
pointed to will be set to the the applicable |
| 9223 |
DW_FTYPE value (see libdwarf.h). |
| 9224 |
@param dw_obj_pointersize |
| 9225 |
Pass in a pointer. On success the value |
| 9226 |
pointed to will be set to the the applicable |
| 9227 |
pointer size, which is almost always either 4 or 8. |
| 9228 |
@param dw_obj_is_big_endian |
| 9229 |
Pass in a pointer. On success the value |
| 9230 |
pointed to will be set to either 1 (the object being |
| 9231 |
read is big-endia) or 0 (the object being read is |
| 9232 |
little-endian. |
| 9233 |
@param dw_obj_machine |
| 9234 |
Pass in a pointer. On success the value |
| 9235 |
pointed to will be set to a value that |
| 9236 |
the specific ABI uses for the machine-architecture |
| 9237 |
the object file says it is for. |
| 9238 |
@param dw_obj_flags |
| 9239 |
Pass in a pointer. On success the value |
| 9240 |
pointed to will be set to a value that |
| 9241 |
the specific ABI uses for a header record |
| 9242 |
flags word (in a PE object the flags word is |
| 9243 |
called @b Characteristics ). |
| 9244 |
@param dw_path_source |
| 9245 |
Pass in a pointer. On success the value |
| 9246 |
pointed to will be set to a value that |
| 9247 |
libdwarf sets to a DW_PATHSOURCE value |
| 9248 |
indicating what caused the file path. |
| 9249 |
@param dw_ub_offset |
| 9250 |
Pass in a pointer. On success |
| 9251 |
if the value of dw_ftype is DW_FTYPE_APPLEUNIVERSAL |
| 9252 |
the returned value will be set to the count |
| 9253 |
(in all other cases, the value is set to 0) |
| 9254 |
@param dw_ub_count |
| 9255 |
Pass in a pointer. On success |
| 9256 |
if the value of dw_ftype is DW_FTYPE_APPLEUNIVERSAL |
| 9257 |
the returned value will be set to the number |
| 9258 |
of object files in the binary |
| 9259 |
(in all other cases, the value is set to 0) |
| 9260 |
@param dw_ub_index |
| 9261 |
Pass in a pointer. On success |
| 9262 |
if the value of dw_ftype is DW_FTYPE_APPLEUNIVERSAL |
| 9263 |
the returned value will be set to the number |
| 9264 |
of the specific object from the universal-binary, |
| 9265 |
usable values are 0 through dw_ub_count-1. |
| 9266 |
(in all other cases, the value is set to 0) |
| 9267 |
@param dw_comdat_groupnumber |
| 9268 |
Pass in a pointer. On success |
| 9269 |
if the value of dw_ftype is DW_FTYPE_ELF |
| 9270 |
the returned value will be the comdat group |
| 9271 |
being referenced. |
| 9272 |
(in all other cases, the value is set to 0) |
| 9273 |
@return |
| 9274 |
Returns DW_DLV_NO_ENTRY if the Dwarf_Debug passed in |
| 9275 |
is null or stale. Otherwise returns DW_DLV_OK |
| 9276 |
and non-null return-value pointers will have |
| 9277 |
meaningful data. |
| 9278 |
|
| 9279 |
*/ |
| 9280 |
DW_API int dwarf_machine_architecture(Dwarf_Debug dw_dbg, |
| 9281 |
Dwarf_Small *dw_ftype, |
| 9282 |
Dwarf_Small *dw_obj_pointersize, |
| 9283 |
Dwarf_Bool *dw_obj_is_big_endian, |
| 9284 |
Dwarf_Unsigned *dw_obj_machine, /*architecture*/ |
| 9285 |
Dwarf_Unsigned *dw_obj_flags, |
| 9286 |
Dwarf_Small *dw_path_source, |
| 9287 |
Dwarf_Unsigned *dw_ub_offset, |
| 9288 |
Dwarf_Unsigned *dw_ub_count, |
| 9289 |
Dwarf_Unsigned *dw_ub_index, |
| 9290 |
Dwarf_Unsigned *dw_comdat_groupnumber); |
| 9291 |
|
| 9292 |
/*! @brief Get section count (of object file sections). |
| 9293 |
|
| 9294 |
Return the section count. Returns 0 if the |
| 9295 |
dw_dbg argument is improper in any way. |
| 9296 |
|
| 9297 |
@param dw_dbg |
| 9298 |
Pass in a valid Dwarf_Debug of interest. |
| 9299 |
@return |
| 9300 |
Returns the count of sections in the object file |
| 9301 |
or zero. |
| 9302 |
*/ |
| 9303 |
DW_API Dwarf_Unsigned dwarf_get_section_count(Dwarf_Debug dw_dbg); |
| 9304 |
|
| 9305 |
/*! @brief Get section sizes for many sections. |
| 9306 |
|
| 9307 |
The list of sections is incomplete and the argument list |
| 9308 |
is ... too long ... making this an unusual function |
| 9309 |
|
| 9310 |
Originally a hack so clients could verify offsets. |
| 9311 |
Added so that one can detect broken offsets |
| 9312 |
(which happened in an IRIX executable larger than 2GB |
| 9313 |
with MIPSpro 7.3.1.3 toolchain.). |
| 9314 |
|
| 9315 |
@param dw_dbg |
| 9316 |
Pass in a valid Dwarf_Debug of interest. |
| 9317 |
|
| 9318 |
@return |
| 9319 |
If the dw_dbg is non-null it returns DW_DLV_OK. |
| 9320 |
If dw_dbg is NULL it returns DW_DLV_NO_ENTRY. |
| 9321 |
|
| 9322 |
*/ |
| 9323 |
DW_API int dwarf_get_section_max_offsets_d(Dwarf_Debug dw_dbg, |
| 9324 |
Dwarf_Unsigned * dw_debug_info_size, |
| 9325 |
Dwarf_Unsigned * dw_debug_abbrev_size, |
| 9326 |
Dwarf_Unsigned * dw_debug_line_size, |
| 9327 |
Dwarf_Unsigned * dw_debug_loc_size, |
| 9328 |
Dwarf_Unsigned * dw_debug_aranges_size, |
| 9329 |
|
| 9330 |
Dwarf_Unsigned * dw_debug_macinfo_size, |
| 9331 |
Dwarf_Unsigned * dw_debug_pubnames_size, |
| 9332 |
Dwarf_Unsigned * dw_debug_str_size, |
| 9333 |
Dwarf_Unsigned * dw_debug_frame_size, |
| 9334 |
Dwarf_Unsigned * dw_debug_ranges_size, |
| 9335 |
|
| 9336 |
Dwarf_Unsigned * dw_debug_pubtypes_size, |
| 9337 |
Dwarf_Unsigned * dw_debug_types_size, |
| 9338 |
Dwarf_Unsigned * dw_debug_macro_size, |
| 9339 |
Dwarf_Unsigned * dw_debug_str_offsets_size, |
| 9340 |
Dwarf_Unsigned * dw_debug_sup_size, |
| 9341 |
|
| 9342 |
Dwarf_Unsigned * dw_debug_cu_index_size, |
| 9343 |
Dwarf_Unsigned * dw_debug_tu_index_size, |
| 9344 |
Dwarf_Unsigned * dw_debug_names_size, |
| 9345 |
Dwarf_Unsigned * dw_debug_loclists_size, |
| 9346 |
Dwarf_Unsigned * dw_debug_rnglists_size); |
| 9347 |
/*! @} */ |
| 9348 |
|
| 9349 |
/*! @defgroup secgroups Section Groups Objectfile Data |
| 9350 |
|
| 9351 |
@{ |
| 9352 |
|
| 9353 |
Section Groups are defined in the extended |
| 9354 |
Elf ABI and are seen in relocatable |
| 9355 |
Elf object files, not executables or shared objects. |
| 9356 |
|
| 9357 |
@link dwsec_sectiongroup Section Groups Overview @endlink |
| 9358 |
|
| 9359 |
*/ |
| 9360 |
/*! @brief Get Section Groups data counts |
| 9361 |
|
| 9362 |
Allows callers to find out what groups (dwo or COMDAT) |
| 9363 |
are in the object and how much to allocate so one can get the |
| 9364 |
group-section map data. |
| 9365 |
|
| 9366 |
This is relevant for Debug Fission. |
| 9367 |
If an object file has both .dwo sections |
| 9368 |
and non-dwo sections or it has Elf COMDAT |
| 9369 |
GROUP sections this becomes important. |
| 9370 |
|
| 9371 |
@link dwsec_sectiongroup Section Groups Overview @endlink |
| 9372 |
|
| 9373 |
@param dw_dbg |
| 9374 |
Pass in the Dwarf_Debug of interest. |
| 9375 |
@param dw_section_count_out |
| 9376 |
On success returns the number of DWARF sections |
| 9377 |
in the object file. Can sometimes be many more |
| 9378 |
than are of interest. |
| 9379 |
@param dw_group_count_out |
| 9380 |
On success returns the number of groups. |
| 9381 |
Though usually one, it can be much larger. |
| 9382 |
@param dw_selected_group_out |
| 9383 |
On success returns the groupnumber that applies |
| 9384 |
to this specific open Dwarf_Debug. |
| 9385 |
@param dw_map_entry_count_out |
| 9386 |
On success returns the count of record allocations needed |
| 9387 |
to call dwarf_sec_group_map successfully. |
| 9388 |
dw_map_entry_count_out will be less than or equal to |
| 9389 |
dw_section_count_out. |
| 9390 |
@param dw_error |
| 9391 |
The usual error details pointer. |
| 9392 |
@return |
| 9393 |
On success returns DW_DLV_OK |
| 9394 |
*/ |
| 9395 |
DW_API int dwarf_sec_group_sizes(Dwarf_Debug dw_dbg, |
| 9396 |
Dwarf_Unsigned *dw_section_count_out, |
| 9397 |
Dwarf_Unsigned *dw_group_count_out, |
| 9398 |
Dwarf_Unsigned *dw_selected_group_out, |
| 9399 |
Dwarf_Unsigned *dw_map_entry_count_out, |
| 9400 |
Dwarf_Error *dw_error); |
| 9401 |
|
| 9402 |
/*! @brief Return a map between group numbers and section numbers |
| 9403 |
|
| 9404 |
This map shows all the groups in the object file |
| 9405 |
and shows which object sections go with which group. |
| 9406 |
|
| 9407 |
@param dw_dbg |
| 9408 |
The Dwarf_Debug of interest. |
| 9409 |
@param dw_map_entry_count |
| 9410 |
Pass in the dw_map_entry_count_out from |
| 9411 |
dwarf_sec_group_sizes |
| 9412 |
@param dw_group_numbers_array |
| 9413 |
Pass in an array of Dwarf_Unsigned |
| 9414 |
with dw_map_entry_count entries. |
| 9415 |
Zero the data before the call here. |
| 9416 |
On success returns a list of group numbers. |
| 9417 |
@param dw_sec_numbers_array |
| 9418 |
Pass in an array of Dwarf_Unsigned |
| 9419 |
with dw_map_entry_count entries. |
| 9420 |
Zero the data before the call here. |
| 9421 |
On success returns a list of section numbers. |
| 9422 |
@param dw_sec_names_array |
| 9423 |
Pass in an array of const char * |
| 9424 |
with dw_map_entry_count entries. |
| 9425 |
Zero the data before the call here. |
| 9426 |
On success returns a list of section names. |
| 9427 |
@param dw_error |
| 9428 |
The usual error details pointer. |
| 9429 |
@return |
| 9430 |
On success returns DW_DLV_OK |
| 9431 |
*/ |
| 9432 |
DW_API int dwarf_sec_group_map(Dwarf_Debug dw_dbg, |
| 9433 |
Dwarf_Unsigned dw_map_entry_count, |
| 9434 |
Dwarf_Unsigned *dw_group_numbers_array, |
| 9435 |
Dwarf_Unsigned *dw_sec_numbers_array, |
| 9436 |
const char **dw_sec_names_array, |
| 9437 |
Dwarf_Error *dw_error); |
| 9438 |
/*! @} */ |
| 9439 |
|
| 9440 |
/*! @defgroup leb LEB Encode and Decode |
| 9441 |
@{ |
| 9442 |
|
| 9443 |
These are LEB/ULEB reading and writing |
| 9444 |
functions heavily used inside libdwarf. |
| 9445 |
|
| 9446 |
While the DWARF Standard does not mention |
| 9447 |
allowing extra insignificant trailing bytes |
| 9448 |
in a ULEB these functions allow a few such |
| 9449 |
for compilers using extras for alignment |
| 9450 |
in DWARF. |
| 9451 |
*/ |
| 9452 |
DW_API int dwarf_encode_leb128(Dwarf_Unsigned dw_val, |
| 9453 |
int *dw_nbytes, |
| 9454 |
char *dw_space, |
| 9455 |
int dw_splen); |
| 9456 |
DW_API int dwarf_encode_signed_leb128(Dwarf_Signed dw_val, |
| 9457 |
int *dw_nbytes, |
| 9458 |
char *dw_space, |
| 9459 |
int dw_splen); |
| 9460 |
/* Same for LEB decoding routines. |
| 9461 |
caller sets endptr to an address one past the last valid |
| 9462 |
address the library should be allowed to |
| 9463 |
access. */ |
| 9464 |
DW_API int dwarf_decode_leb128(char *dw_leb, |
| 9465 |
Dwarf_Unsigned *dw_leblen, |
| 9466 |
Dwarf_Unsigned *dw_outval, |
| 9467 |
char *dw_endptr); |
| 9468 |
DW_API int dwarf_decode_signed_leb128(char *dw_leb, |
| 9469 |
Dwarf_Unsigned *dw_leblen, |
| 9470 |
Dwarf_Signed *dw_outval, |
| 9471 |
char *dw_endptr); |
| 9472 |
/*! @} */ |
| 9473 |
|
| 9474 |
/*! @defgroup miscellaneous Miscellaneous Functions |
| 9475 |
@{ |
| 9476 |
*/ |
| 9477 |
/*! @brief Return the version string in the library. |
| 9478 |
|
| 9479 |
An example: "0.3.0" which is a Semantic Version identifier. |
| 9480 |
Before September 2021 the version string was |
| 9481 |
a date, for example "20210528", |
| 9482 |
which is in ISO date format. |
| 9483 |
See DW_LIBDWARF_VERSION DW_LIBDWARF_VERSION_MAJOR |
| 9484 |
DW_LIBDWARF_VERSION_MINOR DW_LIBDWARF_VERSION_MICRO |
| 9485 |
@return |
| 9486 |
The Package Version built into libdwarf.so or libdwarf.a |
| 9487 |
*/ |
| 9488 |
DW_API const char * dwarf_package_version(void); |
| 9489 |
|
| 9490 |
/*! @brief Turn off libdwarf checks of strings. |
| 9491 |
|
| 9492 |
Zero is the default and means do all |
| 9493 |
string length validity checks. |
| 9494 |
It applies to all Dwarf_Debug open and |
| 9495 |
all opened later in this library instance. |
| 9496 |
|
| 9497 |
@param dw_stringcheck |
| 9498 |
Pass in a small non-zero value to turn off |
| 9499 |
all libdwarf string validity checks. It speeds |
| 9500 |
up libdwarf, but...is dangerous and voids |
| 9501 |
all promises the library will not segfault. |
| 9502 |
@return |
| 9503 |
Returns the previous value of this flag. |
| 9504 |
*/ |
| 9505 |
DW_API int dwarf_set_stringcheck(int dw_stringcheck); |
| 9506 |
|
| 9507 |
/*! @brief Set libdwarf response to *.rela relocations |
| 9508 |
|
| 9509 |
dw_apply defaults to 1 and means apply all |
| 9510 |
'.rela' relocations on reading in a dwarf object |
| 9511 |
section of such relocations. |
| 9512 |
Best to just ignore this function |
| 9513 |
It applies to all Dwarf_Debug open and |
| 9514 |
all opened later in this library instance. |
| 9515 |
|
| 9516 |
@param dw_apply |
| 9517 |
Pass in a zero to turn off reading and applying of |
| 9518 |
*.rela relocations, which will likely break reading |
| 9519 |
of .o object files but probably will not break reading |
| 9520 |
executables or shared objects. |
| 9521 |
Pass in non zero (it is really just an 8 bit value, |
| 9522 |
so use a small value) to turn off inspecting .rela |
| 9523 |
sections. |
| 9524 |
@return |
| 9525 |
Returns the previous value of the apply flag. |
| 9526 |
|
| 9527 |
*/ |
| 9528 |
DW_API int dwarf_set_reloc_application(int dw_apply); |
| 9529 |
|
| 9530 |
/*! @brief Get a pointer to the applicable swap/noswap function |
| 9531 |
|
| 9532 |
the function pointer returned enables libdwarf users |
| 9533 |
to use the same 64bit/32bit/16bit word copy |
| 9534 |
as libdwarf does internally for the Dwarf_Debug |
| 9535 |
passed in. The function makes it possible for |
| 9536 |
libdwarf to read either endianness. |
| 9537 |
|
| 9538 |
@param dw_dbg |
| 9539 |
Pass in a pointer to the applicable Dwarf_Debug. |
| 9540 |
|
| 9541 |
@returns a pointer to a copy function. |
| 9542 |
If the object file referred to and the libdwarf |
| 9543 |
reading that file are the same endianness the function |
| 9544 |
returned will, when called, do a simple memcpy, |
| 9545 |
effectively, while otherwise |
| 9546 |
it would do a byte-swapping copy. It seems unlikely |
| 9547 |
this will be useful to most library users. |
| 9548 |
To call the copy function returned the first argument |
| 9549 |
must be a pointer to the target word and the second |
| 9550 |
must be a pointer to the input word. The third argument |
| 9551 |
is the length to be copied and it must be 2,4,or 8. |
| 9552 |
*/ |
| 9553 |
|
| 9554 |
DW_API void (*dwarf_get_endian_copy_function(Dwarf_Debug dw_dbg)) |
| 9555 |
(void *, const void *, unsigned long); |
| 9556 |
|
| 9557 |
/* A global flag in libdwarf. Applies to all Dwarf_Debug */ |
| 9558 |
DW_API extern Dwarf_Cmdline_Options dwarf_cmdline_options; |
| 9559 |
|
| 9560 |
/*! @brief Tell libdwarf to add verbosity to Line Header errors |
| 9561 |
By default the flag in the struct argument |
| 9562 |
is zero. |
| 9563 |
dwarfdump uses this when -v used on dwarfdump. |
| 9564 |
|
| 9565 |
@see dwarf_register_printf_callback |
| 9566 |
|
| 9567 |
@param dw_dd_options |
| 9568 |
The structure has one flag, and if |
| 9569 |
the flag is nonzero and there is an error |
| 9570 |
in reading a line table header |
| 9571 |
the function passes back detail error messages |
| 9572 |
via dwarf_register_printf_callback. |
| 9573 |
*/ |
| 9574 |
DW_API void dwarf_record_cmdline_options( |
| 9575 |
Dwarf_Cmdline_Options dw_dd_options); |
| 9576 |
|
| 9577 |
/*! @brief Eliminate libdwarf tracking of allocations |
| 9578 |
Independent of any Dwarf_Debug and applicable |
| 9579 |
to all whenever the setting is changed. |
| 9580 |
Defaults to non-zero. |
| 9581 |
|
| 9582 |
@param dw_v |
| 9583 |
If zero passed in libdwarf will run somewhat faster |
| 9584 |
and library memory allocations |
| 9585 |
will not all be tracked and dwarf_finish() will |
| 9586 |
be unable to free/dealloc some things. |
| 9587 |
User code can do the necessary deallocs |
| 9588 |
(as documented), but the normal guarantee |
| 9589 |
that libdwarf will clean up is revoked. |
| 9590 |
If non-zero passed in libdwarf will resume or |
| 9591 |
continue tracking allocations |
| 9592 |
@return |
| 9593 |
Returns the previous version of the flag. |
| 9594 |
*/ |
| 9595 |
DW_API int dwarf_set_de_alloc_flag(int dw_v); |
| 9596 |
|
| 9597 |
/*! @brief Set the address size on a Dwarf_Debug |
| 9598 |
|
| 9599 |
DWARF information CUs and other |
| 9600 |
section DWARF headers define a CU-specific |
| 9601 |
address size, but this Dwarf_Debug value |
| 9602 |
is used when other address size information |
| 9603 |
does not exist, for example in a DWARF2 |
| 9604 |
CIE or FDE. |
| 9605 |
|
| 9606 |
@param dw_dbg |
| 9607 |
The Dwarf_Debug of interest. |
| 9608 |
@param dw_value |
| 9609 |
Sets the address size for the Dwarf_Debug to a |
| 9610 |
non-zero value. The default address size |
| 9611 |
is derived from headers in the object file. |
| 9612 |
Values larger than the size of Dwarf_Addr |
| 9613 |
are not set. |
| 9614 |
If zero passed the default is not changed. |
| 9615 |
@return |
| 9616 |
Returns the last set address size. |
| 9617 |
*/ |
| 9618 |
DW_API Dwarf_Small dwarf_set_default_address_size( |
| 9619 |
Dwarf_Debug dw_dbg, |
| 9620 |
Dwarf_Small dw_value); |
| 9621 |
|
| 9622 |
/*! @brief Retrieve universal binary index |
| 9623 |
|
| 9624 |
For Mach-O universal binaries this returns |
| 9625 |
relevant information. |
| 9626 |
|
| 9627 |
For non-universal binaries (Mach-O, Elf, |
| 9628 |
or PE) the values are not meaningful, so |
| 9629 |
the function returns DW_DLV_NO_ENTRY.. |
| 9630 |
|
| 9631 |
@param dw_dbg |
| 9632 |
The Dwarf_Debug of interest. |
| 9633 |
@param dw_current_index |
| 9634 |
If dw_current_index is passed in non-null the function |
| 9635 |
returns the universal-binary index of the current |
| 9636 |
object (which came from a universal binary). |
| 9637 |
@param dw_available_count |
| 9638 |
If dw_current_index is passed in non-null the function |
| 9639 |
returns the count of binaries in |
| 9640 |
the universal binary. |
| 9641 |
@return |
| 9642 |
Returns DW_DLV_NO_ENTRY if the object file is |
| 9643 |
not from a Mach-O universal binary. |
| 9644 |
Returns DW_DLV_NO_ENTRY if dw_dbg is passed in NULL. |
| 9645 |
Never returns DW_DLV_ERROR. |
| 9646 |
*/ |
| 9647 |
DW_API int dwarf_get_universalbinary_count( |
| 9648 |
Dwarf_Debug dw_dbg, |
| 9649 |
Dwarf_Unsigned *dw_current_index, |
| 9650 |
Dwarf_Unsigned *dw_available_count); |
| 9651 |
|
| 9652 |
/*! @} |
| 9653 |
*/ |
| 9654 |
|
| 9655 |
/*! @defgroup objectdetector Determine Object Type of a File |
| 9656 |
@{ |
| 9657 |
|
| 9658 |
This group of functions are unlikely to be called |
| 9659 |
by your code unless your code needs to know |
| 9660 |
the basic data about an object file without |
| 9661 |
actually opening a Dwarf_Debug. |
| 9662 |
|
| 9663 |
These are crucial for libdwarf itself. |
| 9664 |
The dw_ftype returned is one of |
| 9665 |
DW_FTYPE_ELF, |
| 9666 |
DW_FTYPE_PE, |
| 9667 |
DW_FTYPE_MACH_O, or |
| 9668 |
DW_FTYPE_APPLEUNIVERSAL. |
| 9669 |
*/ |
| 9670 |
DW_API int dwarf_object_detector_path_b(const char * dw_path, |
| 9671 |
char *dw_outpath_buffer, |
| 9672 |
unsigned long dw_outpathlen, |
| 9673 |
char ** dw_gl_pathnames, |
| 9674 |
unsigned int dw_gl_pathcount, |
| 9675 |
unsigned int *dw_ftype, |
| 9676 |
unsigned int *dw_endian, |
| 9677 |
unsigned int *dw_offsetsize, |
| 9678 |
Dwarf_Unsigned *dw_filesize, |
| 9679 |
unsigned char *dw_pathsource, |
| 9680 |
int * dw_errcode); |
| 9681 |
|
| 9682 |
/* Solely looks for dSYM */ |
| 9683 |
DW_API int dwarf_object_detector_path_dSYM(const char * dw_path, |
| 9684 |
char * dw_outpath, |
| 9685 |
unsigned long dw_outpath_len, |
| 9686 |
char ** dw_gl_pathnames, |
| 9687 |
unsigned int dw_gl_pathcount, |
| 9688 |
unsigned int *dw_ftype, |
| 9689 |
unsigned int *dw_endian, |
| 9690 |
unsigned int *dw_offsetsize, |
| 9691 |
Dwarf_Unsigned *dw_filesize, |
| 9692 |
unsigned char *dw_pathsource, |
| 9693 |
int * dw_errcode); |
| 9694 |
|
| 9695 |
DW_API int dwarf_object_detector_fd(int dw_fd, |
| 9696 |
unsigned int *dw_ftype, |
| 9697 |
unsigned int *dw_endian, |
| 9698 |
unsigned int *dw_offsetsize, |
| 9699 |
Dwarf_Unsigned *dw_filesize, |
| 9700 |
int *dw_errcode); |
| 9701 |
|
| 9702 |
/*! @} |
| 9703 |
*/ |
| 9704 |
|
| 9705 |
#ifdef __cplusplus |
| 9706 |
} |
| 9707 |
#endif /* __cplusplus */ |
| 9708 |
#endif /* _LIBDWARF_H */ |