| 1 |
/* |
| 2 |
Copyright (C) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. |
| 3 |
Portions Copyright 2002-2010 Sun Microsystems, Inc. All rights reserved. |
| 4 |
Portions Copyright 2011-2020 David Anderson. All Rights Reserved. |
| 5 |
|
| 6 |
This program is free software; you can redistribute it |
| 7 |
and/or modify it under the terms of version 2.1 of the |
| 8 |
GNU Lesser General Public License as published by the Free |
| 9 |
Software Foundation. |
| 10 |
|
| 11 |
This program is distributed in the hope that it would be |
| 12 |
useful, but WITHOUT ANY WARRANTY; without even the implied |
| 13 |
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 |
PURPOSE. |
| 15 |
|
| 16 |
Further, this software is distributed without any warranty |
| 17 |
that it is free of the rightful claim of any third person |
| 18 |
regarding infringement or the like. Any license provided |
| 19 |
herein, whether implied or otherwise, applies only to this |
| 20 |
software file. Patent licenses, if any, provided herein |
| 21 |
do not apply to combinations of this program with other |
| 22 |
software, or any other product whatsoever. |
| 23 |
|
| 24 |
You should have received a copy of the GNU Lesser General |
| 25 |
Public License along with this program; if not, write the |
| 26 |
Free Software Foundation, Inc., 51 Franklin Street - Fifth |
| 27 |
Floor, Boston MA 02110-1301, USA. |
| 28 |
*/ |
| 29 |
|
| 30 |
#ifndef DWARF_PRO_OPAQUE_H |
| 31 |
#define DWARF_PRO_OPAQUE_H |
| 32 |
#include "libdwarf_private.h" |
| 33 |
|
| 34 |
#define TRUE 1 |
| 35 |
#define FALSE 0 |
| 36 |
|
| 37 |
/* The DISTINGUISHED VALUE is 4 byte value defined by DWARF |
| 38 |
since DWARF3. */ |
| 39 |
#define DISTINGUISHED_VALUE_ARRAY(x) unsigned char x[4] = \ |
| 40 |
{ 0xff,0xff,0xff,0xff } |
| 41 |
#define DISTINGUISHED_VALUE 0xffffffff /* 64bit extension flag */ |
| 42 |
|
| 43 |
/* to identify a cie */ |
| 44 |
#define DW_CIE_ID ~(0x0) |
| 45 |
#define DW_CIE_VERSION 1 |
| 46 |
|
| 47 |
#if 0 |
| 48 |
typedef signed char Dwarf_Sbyte; |
| 49 |
typedef unsigned char Dwarf_Ubyte; |
| 50 |
typedef signed short Dwarf_Shalf; |
| 51 |
#endif |
| 52 |
|
| 53 |
/* |
| 54 |
On any change that makes libdwarf producer |
| 55 |
incompatible, increment this number. |
| 56 |
1->2->3 ... */ |
| 57 |
#define PRO_VERSION_MAGIC 0xdead1 |
| 58 |
#define DWARF_HALF_SIZE 2 |
| 59 |
#define DWARF_32BIT_SIZE 4 |
| 60 |
#define DWARF_64BIT_SIZE 8 |
| 61 |
|
| 62 |
/* Safe sizing of encode output buffer (leb bytes). */ |
| 63 |
#define ENCODE_SPACE_NEEDED 16 |
| 64 |
|
| 65 |
/* producer: |
| 66 |
This struct is used to hold information about all |
| 67 |
debug* sections. On creating a new section, section |
| 68 |
names and indices are added to this struct |
| 69 |
definition in pro_section.h */ |
| 70 |
typedef struct Dwarf_P_Section_Data_s *Dwarf_P_Section_Data; |
| 71 |
|
| 72 |
/* |
| 73 |
producer: |
| 74 |
This struct holds file entries or |
| 75 |
include file entries for the statement prologue. |
| 76 |
Defined in pro_line.h |
| 77 |
*/ |
| 78 |
typedef struct Dwarf_P_F_Entry_s *Dwarf_P_F_Entry; |
| 79 |
|
| 80 |
/* |
| 81 |
producer: |
| 82 |
This struct holds information for each cie. Defn in pro_frame.h |
| 83 |
*/ |
| 84 |
typedef struct Dwarf_P_Cie_s *Dwarf_P_Cie; |
| 85 |
|
| 86 |
/* |
| 87 |
producer: |
| 88 |
Struct to hold line number information, different from |
| 89 |
Dwarf_Line opaque type. |
| 90 |
*/ |
| 91 |
typedef struct Dwarf_P_Line_s *Dwarf_P_Line; |
| 92 |
/* For a .debug_sup section creation. */ |
| 93 |
typedef struct Dwarf_P_Debug_Sup_s *Dwarf_P_Debug_Sup; |
| 94 |
|
| 95 |
/* |
| 96 |
producer: |
| 97 |
Struct to hold information about address ranges. |
| 98 |
*/ |
| 99 |
typedef struct Dwarf_P_Simple_nameentry_s *Dwarf_P_Simple_nameentry; |
| 100 |
typedef struct Dwarf_P_Simple_name_header_s * |
| 101 |
Dwarf_P_Simple_name_header; |
| 102 |
typedef struct Dwarf_P_Arange_s *Dwarf_P_Arange; |
| 103 |
typedef struct Dwarf_P_Per_Reloc_Sect_s *Dwarf_P_Per_Reloc_Sect; |
| 104 |
typedef struct Dwarf_P_Per_Sect_String_Attrs_s * |
| 105 |
Dwarf_P_Per_Sect_String_Attrs; |
| 106 |
typedef struct Dwarf_P_Dnames_s *Dwarf_P_Dnames; |
| 107 |
|
| 108 |
/* Defined to get at the elf section numbers and section name |
| 109 |
indices in symtab for the dwarf sections. |
| 110 |
See also dwarfdump/glflags.h which uses the same numbering. |
| 111 |
In glflags.h the number value and sequence is unimportant. |
| 112 |
Here the numbers must match .rel.* names in |
| 113 |
_dwarf_rel_section_names exactly. |
| 114 |
*/ |
| 115 |
#define DEBUG_INFO 0 |
| 116 |
#define DEBUG_LINE 1 |
| 117 |
#define DEBUG_ABBREV 2 |
| 118 |
#define DEBUG_FRAME 3 |
| 119 |
#define DEBUG_ARANGES 4 |
| 120 |
#define DEBUG_PUBNAMES 5 |
| 121 |
#define DEBUG_FUNCNAMES 6 |
| 122 |
#define DEBUG_TYPENAMES 7 |
| 123 |
#define DEBUG_VARNAMES 8 |
| 124 |
#define DEBUG_WEAKNAMES 9 |
| 125 |
#define DEBUG_MACINFO 10 /* DWARF 2,3,4 only */ |
| 126 |
#define DEBUG_LOC 11 |
| 127 |
#define DEBUG_RANGES 12 |
| 128 |
#define DEBUG_TYPES 13 |
| 129 |
#define DEBUG_PUBTYPES 14 |
| 130 |
#define DEBUG_NAMES 15 /* DWARF5. aka dnames */ |
| 131 |
#define DEBUG_STR 16 |
| 132 |
#define DEBUG_LINE_STR 17 |
| 133 |
#define DEBUG_MACRO 18 /* DWARF 5. */ |
| 134 |
#define DEBUG_LOCLISTS 19 /* DWARF 5. */ |
| 135 |
#define DEBUG_RNGLISTS 20 /* DWARF 5. */ |
| 136 |
#define DEBUG_SUP 21 /* DWARF 5. */ |
| 137 |
|
| 138 |
/* Maximum number of debug_* sections not including the relocations */ |
| 139 |
#define NUM_DEBUG_SECTIONS 22 |
| 140 |
|
| 141 |
/* The FORM codes available are defined in DWARF5 |
| 142 |
on page 158, DW_LNCT_path */ |
| 143 |
struct Dwarf_P_Line_format_s { |
| 144 |
/* DW_LNCT_path etc. */ |
| 145 |
unsigned def_content_type; |
| 146 |
|
| 147 |
/* DW_FORM_string or DW_FORM_strp or DW_FORM_strp |
| 148 |
or DW_FORM_strp_sup or for dwo, some others. */ |
| 149 |
unsigned def_form_code; |
| 150 |
}; |
| 151 |
|
| 152 |
#define DW_LINE_FORMATS_MAX 6 |
| 153 |
/* Describes the data needed to generate line table header info |
| 154 |
so we can vary the init at runtime. */ |
| 155 |
struct Dwarf_P_Line_Inits_s { |
| 156 |
unsigned pi_linetable_version; /* line table version number */ |
| 157 |
unsigned pi_default_is_stmt; /* default value for is_stmt */ |
| 158 |
|
| 159 |
/* Size of the smallest instruction, in bytes. */ |
| 160 |
unsigned pi_minimum_instruction_length; |
| 161 |
|
| 162 |
/* Normally opcode_base is determined by pi_version, but we |
| 163 |
allow manual setting here so we can generate data like |
| 164 |
GNU with a DWARF3 opcode base in a DWARF2 section. |
| 165 |
This determines how much of the header_opcode_lengths |
| 166 |
table is emitted in the line table header */ |
| 167 |
unsigned pi_opcode_base; |
| 168 |
|
| 169 |
int pi_line_base; /* For line table header. */ |
| 170 |
int pi_line_range; /* For line table header. */ |
| 171 |
|
| 172 |
/* Make this >1 for VLIW machines. DWARF4,DWARF5 */ |
| 173 |
unsigned pi_maximum_operations_per_instruction; |
| 174 |
|
| 175 |
/* DWARF 5 */ |
| 176 |
unsigned pi_segment_selector_size; |
| 177 |
unsigned pi_address_size; |
| 178 |
unsigned pi_segment_size; |
| 179 |
unsigned pi_directory_entry_format_count; |
| 180 |
struct Dwarf_P_Line_format_s pi_incformats[DW_LINE_FORMATS_MAX]; |
| 181 |
|
| 182 |
unsigned pi_file_entry_format_count; |
| 183 |
struct Dwarf_P_Line_format_s pi_fileformats[DW_LINE_FORMATS_MAX]; |
| 184 |
}; |
| 185 |
|
| 186 |
/* To enable DWARF5 testing. July 2020 */ |
| 187 |
struct Dwarf_P_Debug_Sup_s { |
| 188 |
Dwarf_Half ds_version; /* 2 */ |
| 189 |
Dwarf_Small ds_is_supplementary; /* 0 or 1 */ |
| 190 |
char *ds_filename; |
| 191 |
Dwarf_Unsigned ds_checksum_len; |
| 192 |
Dwarf_Small *ds_checksum; |
| 193 |
Dwarf_P_Debug ds_dbg; |
| 194 |
}; |
| 195 |
|
| 196 |
struct Dwarf_P_Die_s { |
| 197 |
Dwarf_Unsigned di_offset; /* offset in debug info */ |
| 198 |
char *di_abbrev; /* abbreviation */ |
| 199 |
Dwarf_Unsigned di_abbrev_nbytes; /* # of bytes in abbrev */ |
| 200 |
Dwarf_Tag di_tag; |
| 201 |
Dwarf_P_Die di_parent; /* parent of current die */ |
| 202 |
Dwarf_P_Die di_child; /* first child */ |
| 203 |
/* The last child field makes linking up children |
| 204 |
an O(1) operation, See pro_die.c. */ |
| 205 |
Dwarf_P_Die di_last_child; |
| 206 |
Dwarf_P_Die di_left; /* left sibling */ |
| 207 |
Dwarf_P_Die di_right; /* right sibling */ |
| 208 |
Dwarf_P_Attribute di_attrs; /* list of attributes */ |
| 209 |
Dwarf_P_Attribute di_last_attr; /* last attribute */ |
| 210 |
int di_n_attr; /* number of attributes */ |
| 211 |
Dwarf_P_Debug di_dbg; /* For memory management */ |
| 212 |
Dwarf_Unsigned di_marker; /* used to attach symbols to dies */ |
| 213 |
}; |
| 214 |
|
| 215 |
/* producer fields */ |
| 216 |
struct Dwarf_P_Attribute_s { |
| 217 |
Dwarf_Half ar_attribute; /* Attribute Value. */ |
| 218 |
Dwarf_Half ar_attribute_form; /* Attribute Form. */ |
| 219 |
Dwarf_P_Die ar_ref_die; /* die pointer if form ref */ |
| 220 |
char *ar_data; /* data, format given by form */ |
| 221 |
Dwarf_Unsigned ar_nbytes; /* no. of bytes of data */ |
| 222 |
Dwarf_Unsigned ar_rel_symidx; /* when attribute has a |
| 223 |
relocatable value, holds |
| 224 |
index of symbol in SYMTAB */ |
| 225 |
Dwarf_Unsigned ar_debug_str_offset; /* Offset in .debug_str |
| 226 |
if non-zero. Zero offset never assigned a string. */ |
| 227 |
Dwarf_Ubyte ar_rel_type; /* relocation type */ |
| 228 |
Dwarf_Unsigned ar_rel_offset; /* Offset of reloc within block */ |
| 229 |
char ar_reloc_len; /* Number of bytes that relocation |
| 230 |
applies to. 4 or 8. Unused and may |
| 231 |
be 0 if if ar_rel_type is |
| 232 |
R_MIPS_NONE */ |
| 233 |
Dwarf_P_Attribute ar_next; |
| 234 |
/* set if form = DW_FORM_implicit_const; */ |
| 235 |
Dwarf_Signed ar_implicit_const; |
| 236 |
}; |
| 237 |
|
| 238 |
/* A block of .debug_macinfo data: this forms a series of blocks. |
| 239 |
** Each macinfo input is compressed immediately and put into |
| 240 |
** the current block if room, else a newblock allocated. |
| 241 |
** The space allocation is such that the block and the macinfo |
| 242 |
** data are one malloc block: free with a pointer to this and the |
| 243 |
** mb_data is freed automatically. |
| 244 |
** Like the struct hack, but legal ANSI C. |
| 245 |
*/ |
| 246 |
struct dw_macinfo_block_s { |
| 247 |
struct dw_macinfo_block_s *mb_next; |
| 248 |
unsigned long mb_avail_len; |
| 249 |
unsigned long mb_used_len; |
| 250 |
unsigned long mb_macinfo_data_space_len; |
| 251 |
char *mb_data;/* original malloc ptr. */ |
| 252 |
}; |
| 253 |
|
| 254 |
/* dwarf_sn_kind is for the array of similarly-treated |
| 255 |
name -> cu ties |
| 256 |
*/ |
| 257 |
enum dwarf_sn_kind { dwarf_snk_pubname, /* .debug_pubnames */ |
| 258 |
dwarf_snk_funcname, /* SGI extension. */ |
| 259 |
dwarf_snk_weakname, /* SGI extension. */ |
| 260 |
dwarf_snk_typename, /* SGI extension. */ |
| 261 |
dwarf_snk_varname, /* SGI extension. */ |
| 262 |
dwarf_snk_pubtype, /* .debug_pubtypes */ |
| 263 |
dwarf_snk_entrycount /* this one must be last */ |
| 264 |
}; |
| 265 |
|
| 266 |
/* The calls to add a varname etc use a list of |
| 267 |
these as the list. |
| 268 |
*/ |
| 269 |
struct Dwarf_P_Simple_nameentry_s { |
| 270 |
Dwarf_P_Die sne_die; |
| 271 |
char *sne_name; |
| 272 |
int sne_name_len; |
| 273 |
Dwarf_P_Simple_nameentry sne_next; |
| 274 |
}; |
| 275 |
|
| 276 |
/* An array of these, each of which heads a list |
| 277 |
of Dwarf_P_Simple_nameentry |
| 278 |
*/ |
| 279 |
struct Dwarf_P_Simple_name_header_s { |
| 280 |
Dwarf_P_Simple_nameentry sn_head; |
| 281 |
Dwarf_P_Simple_nameentry sn_tail; |
| 282 |
Dwarf_Signed sn_count; |
| 283 |
|
| 284 |
/* Length that will be generated, not counting fixed header or |
| 285 |
trailer */ |
| 286 |
Dwarf_Signed sn_net_len; |
| 287 |
}; |
| 288 |
typedef int (*_dwarf_pro_reloc_name_func_ptr) (Dwarf_P_Debug dbg, |
| 289 |
int sec_index, |
| 290 |
Dwarf_Unsigned offset,/* r_offset */ |
| 291 |
Dwarf_Unsigned symidx, |
| 292 |
enum Dwarf_Rel_Type type, |
| 293 |
int reltarget_length); |
| 294 |
|
| 295 |
typedef int (*_dwarf_pro_reloc_length_func_ptr) (Dwarf_P_Debug dbg, |
| 296 |
int sec_index, Dwarf_Unsigned offset,/* r_offset */ |
| 297 |
Dwarf_Unsigned start_symidx, |
| 298 |
Dwarf_Unsigned end_symidx, |
| 299 |
enum Dwarf_Rel_Type type, |
| 300 |
int reltarget_length); |
| 301 |
typedef int (*_dwarf_pro_transform_relocs_func_ptr) |
| 302 |
(Dwarf_P_Debug dbg, |
| 303 |
Dwarf_Signed * |
| 304 |
new_sec_count); |
| 305 |
|
| 306 |
/* |
| 307 |
Each slot in a block of slots could be: |
| 308 |
a binary stream relocation entry (32 or 64bit relocation data) |
| 309 |
a SYMBOLIC relocation entry. |
| 310 |
During creation sometimes we create multiple chained blocks, |
| 311 |
but sometimes we create a single long block. |
| 312 |
Before returning reloc data to caller, |
| 313 |
we switch to a single, long-enough, |
| 314 |
block. |
| 315 |
|
| 316 |
We make counters here Dwarf_Unsigned so that we |
| 317 |
get sufficient alignment. Since we use space after |
| 318 |
the struct (at malloc time) for user data which |
| 319 |
must have Dwarf_Unsigned alignment, this |
| 320 |
struct must have that alignment too. |
| 321 |
*/ |
| 322 |
struct Dwarf_P_Relocation_Block_s { |
| 323 |
Dwarf_Unsigned rb_slots_in_block; /* slots in block, as created */ |
| 324 |
Dwarf_Unsigned rb_next_slot_to_use; /* counter, start at 0. */ |
| 325 |
struct Dwarf_P_Relocation_Block_s *rb_next; |
| 326 |
char *rb_where_to_add_next; /* pointer to next slot |
| 327 |
(might be past end, depending on |
| 328 |
rb_next_slot_to_use) */ |
| 329 |
char *rb_data; /* data area */ |
| 330 |
}; |
| 331 |
|
| 332 |
/* One of these per potential relocation section |
| 333 |
So one per actual dwarf section. |
| 334 |
Left zeroed when not used (some sections have |
| 335 |
no relocations). |
| 336 |
*/ |
| 337 |
struct Dwarf_P_Per_Reloc_Sect_s { |
| 338 |
unsigned long pr_reloc_total_count; /* total number of entries |
| 339 |
across all blocks */ |
| 340 |
|
| 341 |
unsigned long pr_slots_per_block_to_alloc; /* at Block alloc, this |
| 342 |
is the default number of slots to use */ |
| 343 |
|
| 344 |
int pr_sect_num_of_reloc_sect; /* sect number returned by |
| 345 |
de_callback_func() or de_callback_func_b() or_c() |
| 346 |
call, this is the sect |
| 347 |
number of the relocation section. */ |
| 348 |
|
| 349 |
/* singly-linked list. add at and ('last') with count of blocks */ |
| 350 |
struct Dwarf_P_Relocation_Block_s *pr_first_block; |
| 351 |
struct Dwarf_P_Relocation_Block_s *pr_last_block; |
| 352 |
unsigned long pr_block_count; |
| 353 |
}; |
| 354 |
|
| 355 |
#define DEFAULT_SLOTS_PER_BLOCK 3 |
| 356 |
|
| 357 |
typedef struct memory_list_s { |
| 358 |
struct memory_list_s *prev; |
| 359 |
struct memory_list_s *next; |
| 360 |
} memory_list_t; |
| 361 |
|
| 362 |
struct Dwarf_P_Per_Sect_String_Attrs_s { |
| 363 |
int sect_sa_section_number; |
| 364 |
unsigned sect_sa_n_alloc; |
| 365 |
unsigned sect_sa_n_used; |
| 366 |
Dwarf_P_String_Attr sect_sa_list; |
| 367 |
}; |
| 368 |
|
| 369 |
struct Dwarf_P_debug_str_entry_s { |
| 370 |
Dwarf_P_Debug dse_dbg; |
| 371 |
/* Name used initially with tfind. */ |
| 372 |
char *dse_name; |
| 373 |
|
| 374 |
Dwarf_Unsigned dse_slen; /* includes space for NUL terminator */ |
| 375 |
|
| 376 |
/* See dse_has_table_offset below. */ |
| 377 |
Dwarf_Unsigned dse_table_offset; |
| 378 |
|
| 379 |
/* For tsearch a hash table exists and we have a table offset. |
| 380 |
dse_dbg->de_debug_str->ds_data + dse_table_offset |
| 381 |
points to the string iff dse_has_table_offset != 0. */ |
| 382 |
unsigned char dse_has_table_offset; |
| 383 |
}; |
| 384 |
|
| 385 |
struct Dwarf_P_Str_stats_s { |
| 386 |
Dwarf_Unsigned ps_strp_count_debug_str; |
| 387 |
Dwarf_Unsigned ps_strp_len_debug_str; |
| 388 |
Dwarf_Unsigned ps_strp_len_debug_line_str; |
| 389 |
Dwarf_Unsigned ps_strp_reused_count; |
| 390 |
Dwarf_Unsigned ps_strp_reused_len; |
| 391 |
}; |
| 392 |
|
| 393 |
struct Dwarf_P_Stats_s { |
| 394 |
Dwarf_Unsigned ps_str_count; |
| 395 |
Dwarf_Unsigned ps_str_total_length; |
| 396 |
struct Dwarf_P_Str_stats_s ps_strp; |
| 397 |
struct Dwarf_P_Str_stats_s ps_line_strp; |
| 398 |
}; |
| 399 |
|
| 400 |
/* Fields used by producer */ |
| 401 |
struct Dwarf_P_Debug_s { |
| 402 |
/* Used to catch dso passing dbg to another DSO with |
| 403 |
incompatible version of libdwarf See PRO_VERSION_MAGIC */ |
| 404 |
int de_version_magic_number; |
| 405 |
|
| 406 |
Dwarf_Handler de_errhand; |
| 407 |
/* de_user_data is provided so users can use it to readily tie |
| 408 |
a callback to anything they desire. The contents are not |
| 409 |
used by libdwarf except to pass the data as a callback |
| 410 |
argument. New in June 2011. Available in |
| 411 |
dwarf_pro_init_c() and its callback function. */ |
| 412 |
void * de_user_data; |
| 413 |
Dwarf_Ptr de_errarg; |
| 414 |
|
| 415 |
/* Call back function, used to create .debug* sections. |
| 416 |
Provided by library user. */ |
| 417 |
Dwarf_Callback_Func de_callback_func; |
| 418 |
|
| 419 |
/* Flags from producer_init call */ |
| 420 |
Dwarf_Unsigned de_flags; |
| 421 |
|
| 422 |
/* This holds information on debug info section |
| 423 |
stream output, including the stream data */ |
| 424 |
Dwarf_P_Section_Data de_debug_sects; |
| 425 |
|
| 426 |
/* Defaults set as DW_FORM_string, |
| 427 |
meaning not using .debug_str by default. |
| 428 |
This intended for the .debug_info section. */ |
| 429 |
int de_debug_default_str_form; |
| 430 |
|
| 431 |
/* If form DW_FORM_strp */ |
| 432 |
Dwarf_P_Section_Data de_debug_str; |
| 433 |
void *de_debug_str_hashtab; /* for tsearch */ |
| 434 |
|
| 435 |
/* .debug_line_str section data if form DW_FORM_line_strp */ |
| 436 |
Dwarf_P_Section_Data de_debug_line_str; |
| 437 |
void *de_debug_line_str_hashtab; /* for tsearch */ |
| 438 |
|
| 439 |
/* Pointer to the 'current active' section */ |
| 440 |
Dwarf_P_Section_Data de_current_active_section; |
| 441 |
|
| 442 |
/* Number of debug data streams globs. */ |
| 443 |
Dwarf_Unsigned de_n_debug_sect; |
| 444 |
|
| 445 |
/* File entry information, null terminated singly-linked list */ |
| 446 |
Dwarf_P_F_Entry de_file_entries; |
| 447 |
Dwarf_P_F_Entry de_last_file_entry; |
| 448 |
Dwarf_Unsigned de_n_file_entries; |
| 449 |
|
| 450 |
/* Has the directories used to search for source files */ |
| 451 |
Dwarf_P_F_Entry de_inc_dirs; |
| 452 |
Dwarf_P_F_Entry de_last_inc_dir; |
| 453 |
Dwarf_Unsigned de_n_inc_dirs; |
| 454 |
|
| 455 |
/* Has all the line number info for the stmt program */ |
| 456 |
Dwarf_P_Line de_lines; |
| 457 |
Dwarf_P_Line de_last_line; |
| 458 |
|
| 459 |
/* List of cie's for the debug unit */ |
| 460 |
Dwarf_P_Cie de_frame_cies; |
| 461 |
Dwarf_P_Cie de_last_cie; |
| 462 |
Dwarf_Unsigned de_n_cie; |
| 463 |
|
| 464 |
/* Singly-linked list of fde's for the debug unit */ |
| 465 |
Dwarf_P_Fde de_frame_fdes; |
| 466 |
Dwarf_P_Fde de_last_fde; |
| 467 |
Dwarf_Unsigned de_n_fde; |
| 468 |
|
| 469 |
/* It's just one small record */ |
| 470 |
struct Dwarf_P_Debug_Sup_s de_debug_sup; |
| 471 |
|
| 472 |
/* First die, leads to all others */ |
| 473 |
Dwarf_P_Die de_dies; |
| 474 |
|
| 475 |
/* Pointer to chain of aranges */ |
| 476 |
Dwarf_P_Arange de_arange; |
| 477 |
Dwarf_P_Arange de_last_arange; |
| 478 |
Dwarf_Signed de_arange_count; |
| 479 |
|
| 480 |
/* debug_names de_dnames is base of dnames info |
| 481 |
before disk form */ |
| 482 |
Dwarf_P_Dnames de_dnames; |
| 483 |
Dwarf_P_Section_Data de_dnames_sect; |
| 484 |
Dwarf_Bool de_force_dnames; |
| 485 |
|
| 486 |
/* macinfo controls. */ |
| 487 |
/* first points to beginning of the list during creation */ |
| 488 |
struct dw_macinfo_block_s *de_first_macinfo; |
| 489 |
|
| 490 |
/* current points to the current, unfilled, block */ |
| 491 |
struct dw_macinfo_block_s *de_current_macinfo; |
| 492 |
|
| 493 |
/* Pointer to the first section, to support reset_section_bytes */ |
| 494 |
Dwarf_P_Section_Data de_first_debug_sect; |
| 495 |
|
| 496 |
/* Handles pubnames, weaknames, etc. See dwarf_sn_kind in |
| 497 |
pro_opaque.h */ |
| 498 |
struct Dwarf_P_Simple_name_header_s |
| 499 |
de_simple_name_headers[dwarf_snk_entrycount]; |
| 500 |
|
| 501 |
/* Relocation data. not all sections will actally have |
| 502 |
relocation info, of course. de_reloc_sect, |
| 503 |
de_elf_sects, and de_sect_name_idx |
| 504 |
arrays are exactly in parallel. Not every de_elf_sect has |
| 505 |
any relocations for it, of course. */ |
| 506 |
struct Dwarf_P_Per_Reloc_Sect_s de_reloc_sect[NUM_DEBUG_SECTIONS]; |
| 507 |
int de_reloc_next_to_return; /* iterator on reloc sections |
| 508 |
(SYMBOLIC output) */ |
| 509 |
|
| 510 |
/* Used in remembering sections. See de_reloc_sect above. */ |
| 511 |
int de_elf_sects[NUM_DEBUG_SECTIONS]; /* elf sect number of |
| 512 |
the section itself, DEBUG_LINE for example */ |
| 513 |
|
| 514 |
/* Section name index or handle for the name of the symbol for |
| 515 |
DEBUG_LINE for example */ |
| 516 |
Dwarf_Unsigned de_sect_name_idx[NUM_DEBUG_SECTIONS]; |
| 517 |
|
| 518 |
int de_offset_reloc; /* offset reloc type, R_MIPS_32 for |
| 519 |
example. Specific to the ABI being |
| 520 |
produced. Relocates offset size |
| 521 |
field */ |
| 522 |
int de_exc_reloc; /* reloc type specific to exception |
| 523 |
table relocs. */ |
| 524 |
int de_ptr_reloc; /* standard reloc type, R_MIPS_32 for |
| 525 |
example. Specific to the ABI being |
| 526 |
produced. relocates pointer size |
| 527 |
field */ |
| 528 |
unsigned char de_irix_exc_augmentation; /* If non-zero means |
| 529 |
that producing an IRIX exception-table offset in a CIE header |
| 530 |
is allowed (depending on the augmentation string). */ |
| 531 |
|
| 532 |
unsigned char de_dwarf_offset_size; /* dwarf offset size. */ |
| 533 |
unsigned char de_elf_offset_size; /* object sec offset size. */ |
| 534 |
unsigned char de_pointer_size; /* size of address in target. */ |
| 535 |
|
| 536 |
/* Added April 19, 2017. For DWARF5 */ |
| 537 |
unsigned char de_segment_selector_size; |
| 538 |
|
| 539 |
unsigned char de_relocation_record_size; /* reloc record size |
| 540 |
varies by ABI and |
| 541 |
relocation-output |
| 542 |
method (stream or |
| 543 |
symbolic) */ |
| 544 |
|
| 545 |
unsigned char de_64bit_extension;/* non-zero if creating 64 bit |
| 546 |
offsets using dwarf3 extension, else using SGI pre- |
| 547 |
DWARF3 64bit length (unit_length) */ |
| 548 |
|
| 549 |
unsigned char de_output_version; /* 2,3,4, or 5. The version |
| 550 |
number of the output. (not necessarily that of each section, |
| 551 |
which depends on the base version). */ |
| 552 |
|
| 553 |
/* Defaults will be mostly useless, but such do exist */ |
| 554 |
unsigned de_big_endian; /* if 0 target is little-endian */ |
| 555 |
|
| 556 |
/* data8, data4 abi &version dependent */ |
| 557 |
int de_ar_data_attribute_form; |
| 558 |
|
| 559 |
int de_ar_ref_attr_form; /* ref8 ref4 , abi dependent */ |
| 560 |
|
| 561 |
/* simple name relocations */ |
| 562 |
_dwarf_pro_reloc_name_func_ptr de_relocate_by_name_symbol; |
| 563 |
|
| 564 |
/* relocations for a length, requiring a pair of symbols */ |
| 565 |
_dwarf_pro_reloc_length_func_ptr de_relocate_pair_by_symbol; |
| 566 |
|
| 567 |
_dwarf_pro_transform_relocs_func_ptr de_transform_relocs_to_disk; |
| 568 |
|
| 569 |
/* following used for macro buffers */ |
| 570 |
unsigned long de_compose_avail; |
| 571 |
unsigned long de_compose_used_len; |
| 572 |
|
| 573 |
unsigned char de_same_endian; |
| 574 |
void (*de_copy_word) (void *, const void *, unsigned long); |
| 575 |
|
| 576 |
/* Add new fields at the END of this struct to preserve |
| 577 |
some hope of sensible behavior on dbg passing between |
| 578 |
DSOs linked with mismatched libdwarf producer versions. */ |
| 579 |
Dwarf_P_Marker de_markers; /* pointer to array of markers */ |
| 580 |
unsigned de_marker_n_alloc; |
| 581 |
unsigned de_marker_n_used; |
| 582 |
int de_sect_sa_next_to_return; /* Iterator on sring attrib secs */ |
| 583 |
/* String attributes data of each section. */ |
| 584 |
struct Dwarf_P_Per_Sect_String_Attrs_s |
| 585 |
de_sect_string_attr[NUM_DEBUG_SECTIONS]; |
| 586 |
|
| 587 |
/* Hold data needed to init line output flexibly. */ |
| 588 |
struct Dwarf_P_Line_Inits_s de_line_inits; |
| 589 |
|
| 590 |
struct Dwarf_P_Stats_s de_stats; |
| 591 |
}; |
| 592 |
|
| 593 |
#define VERSION_STAMP2 2 |
| 594 |
|
| 595 |
int _dwarf_add_simple_name_entry(Dwarf_P_Debug dbg, |
| 596 |
Dwarf_P_Die die, |
| 597 |
char *entry_name, |
| 598 |
enum dwarf_sn_kind |
| 599 |
entrykind, |
| 600 |
Dwarf_Error * error); |
| 601 |
|
| 602 |
enum dwarf_which_hash { |
| 603 |
_dwarf_hash_debug_str, |
| 604 |
_dwarf_hash_debug_line_str, |
| 605 |
_dwarf_hash_debug_str_sup |
| 606 |
}; |
| 607 |
|
| 608 |
int |
| 609 |
_dwarf_insert_or_find_in_debug_str(Dwarf_P_Debug dbg, |
| 610 |
char *name, |
| 611 |
enum dwarf_which_hash, |
| 612 |
unsigned slen, /* includes space for trailing NUL */ |
| 613 |
Dwarf_Unsigned *offset_in_debug_str, |
| 614 |
Dwarf_Error *error); |
| 615 |
|
| 616 |
int _dwarf_log_extra_flagstrings(Dwarf_P_Debug dbg, |
| 617 |
const char *extra, |
| 618 |
int *err); |
| 619 |
#endif /*DWARF_PRO_OPAQUE_H */ |