| 1 |
/* |
| 2 |
Copyright (C) 2000, 2004, 2006 Silicon Graphics, Inc. All Rights Reserved. |
| 3 |
Portions Copyright (C) 2021-2023 David Anderson. All Rights Reserved. |
| 4 |
|
| 5 |
This program is free software; you can redistribute it |
| 6 |
and/or modify it under the terms of version 2.1 of the |
| 7 |
GNU Lesser General Public License as published by the Free |
| 8 |
Software Foundation. |
| 9 |
|
| 10 |
This program is distributed in the hope that it would be |
| 11 |
useful, but WITHOUT ANY WARRANTY; without even the implied |
| 12 |
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 13 |
PURPOSE. |
| 14 |
|
| 15 |
Further, this software is distributed without any warranty |
| 16 |
that it is free of the rightful claim of any third person |
| 17 |
regarding infringement or the like. Any license provided |
| 18 |
herein, whether implied or otherwise, applies only to this |
| 19 |
software file. Patent licenses, if any, provided herein |
| 20 |
do not apply to combinations of this program with other |
| 21 |
software, or any other product whatsoever. |
| 22 |
|
| 23 |
You should have received a copy of the GNU Lesser General |
| 24 |
Public License along with this program; if not, write the |
| 25 |
Free Software Foundation, Inc., 51 Franklin Street - Fifth |
| 26 |
Floor, Boston MA 02110-1301, USA. |
| 27 |
|
| 28 |
*/ |
| 29 |
|
| 30 |
/* The dwarf 2.0 standard dictates that only the following |
| 31 |
fields can be read when an unexpected augmentation string |
| 32 |
(in the cie) is encountered: CIE length, CIE_id, version and |
| 33 |
augmentation; FDE: length, CIE pointer, initial location and |
| 34 |
address range. Unfortunately, with the above restrictions, it |
| 35 |
is impossible to read the instruction table from a CIE or a FDE |
| 36 |
when a new augmentation string is encountered. |
| 37 |
To fix this problem, the following layout is used, if the |
| 38 |
augmentation string starts with the string "z". |
| 39 |
CIE FDE |
| 40 |
length length |
| 41 |
CIE_id CIE_pointer |
| 42 |
version initial_location |
| 43 |
augmentation address_range |
| 44 |
|
| 45 |
- length_of_augmented_fields (*NEW*) |
| 46 |
code_alignment_factor Any new fields as necessary |
| 47 |
data_alignment_factor instruction_table |
| 48 |
return_address |
| 49 |
length_of_augmented fields |
| 50 |
Any new fields as necessary |
| 51 |
initial_instructions |
| 52 |
|
| 53 |
The type of all the old data items are the same as what is |
| 54 |
described in dwarf 2.0 standard. The length_of_augmented_fields |
| 55 |
is an LEB128 data item that denotes the size (in bytes) of |
| 56 |
the augmented fields (not including the size of |
| 57 |
"length_of_augmented_fields" itself). |
| 58 |
|
| 59 |
Handling of cie augmentation strings is necessarily a heuristic. |
| 60 |
See dwarf_frame.c for the currently known augmentation strings. |
| 61 |
|
| 62 |
---START SGI-ONLY COMMENT: |
| 63 |
SGI-IRIX versions of cie or fde were intended |
| 64 |
to use "z1", "z2" as the |
| 65 |
augmenter strings if required for new augmentation. |
| 66 |
However, that never happened (as of March 2005). |
| 67 |
|
| 68 |
The fde's augmented by the string "z" have a new field |
| 69 |
(signed constant, 4 byte field) |
| 70 |
called offset_into_exception_tables, following the |
| 71 |
length_of_augmented field. This field contains an offset |
| 72 |
into the "_MIPS_eh_region", which describes |
| 73 |
the IRIX CC exception handling tables. |
| 74 |
---END SGI-ONLY COMMENT |
| 75 |
|
| 76 |
GNU .eh_frame has an augmentation string of z[RLP]* (gcc 3.4) |
| 77 |
The similarity to IRIX 'z' (and proposed but never |
| 78 |
implemented IRIX z1, z2 etc) was confusing things. |
| 79 |
If the section is .eh_frame then 'z' means GNU exception |
| 80 |
information 'Augmentation Data' not IRIX 'z'. |
| 81 |
See The Linux Standard Base Core Specification version 3.0 |
| 82 |
*/ |
| 83 |
|
| 84 |
#define DW_DEBUG_FRAME_VERSION 1 /* DWARF2 */ |
| 85 |
#define DW_DEBUG_FRAME_VERSION3 3 /* DWARF3 */ |
| 86 |
#define DW_DEBUG_FRAME_VERSION4 4 /* DWARF4 */ |
| 87 |
/* The following is SGI/IRIX specific, and probably no longer |
| 88 |
in use anywhere. */ |
| 89 |
#define DW_DEBUG_FRAME_AUGMENTER_STRING "mti v1" |
| 90 |
|
| 91 |
/* The value of the offset field for Cie's. */ |
| 92 |
#define DW_CIE_OFFSET ~(0x0) |
| 93 |
|
| 94 |
/* The augmentation string may be NULL. */ |
| 95 |
#define DW_EMPTY_STRING "" |
| 96 |
|
| 97 |
#define DW_FRAME_INSTR_OPCODE_SHIFT 6 |
| 98 |
#define DW_FRAME_INSTR_OFFSET_MASK 0x3f |
| 99 |
|
| 100 |
/* Frame description instructions expanded. |
| 101 |
Accessed via a function. |
| 102 |
*/ |
| 103 |
struct Dwarf_Frame_Instr_s { |
| 104 |
/* fp_op, if a base op, has the low 6 bits set zero here */ |
| 105 |
Dwarf_Small fi_op; |
| 106 |
/* fp_instr_offset is within instructions */ |
| 107 |
Dwarf_Unsigned fi_instr_offset; |
| 108 |
Dwarf_Unsigned fi_offset; /* frame offset */ |
| 109 |
/* A string like "u","r", or "rsd" denoting the field |
| 110 |
meanings. See the entire list of possibilities. |
| 111 |
Never free. */ |
| 112 |
const char *fi_fields; |
| 113 |
|
| 114 |
/* letter r and u both use u struct elements. */ |
| 115 |
Dwarf_Unsigned fi_u0; |
| 116 |
Dwarf_Unsigned fi_u1; |
| 117 |
Dwarf_Unsigned fi_u2; /* LLVM extension */ |
| 118 |
Dwarf_Signed fi_s0; |
| 119 |
Dwarf_Signed fi_s1; |
| 120 |
Dwarf_Unsigned fi_code_align_factor; |
| 121 |
Dwarf_Signed fi_data_align_factor; |
| 122 |
|
| 123 |
Dwarf_Block fi_expr; |
| 124 |
/* Used to prepare a list, which |
| 125 |
is then turned into array and this zeroed. */ |
| 126 |
struct Dwarf_Frame_Instr_s *fi_next; |
| 127 |
}; |
| 128 |
typedef struct Dwarf_Frame_Instr_s * Dwarf_Frame_Instr; |
| 129 |
|
| 130 |
struct Dwarf_Frame_Instr_Head_s { |
| 131 |
/* fp_op, if a base op, has the low 6 bits set zero here */ |
| 132 |
Dwarf_Debug fh_dbg; |
| 133 |
Dwarf_Cie fh_cie; |
| 134 |
|
| 135 |
/* array of pointers to Dwarf_Frame_Instr_s */ |
| 136 |
Dwarf_Frame_Instr *fh_array; |
| 137 |
Dwarf_Unsigned fh_array_count; |
| 138 |
}; |
| 139 |
|
| 140 |
/* |
| 141 |
This struct denotes the rule for a register in a row of |
| 142 |
the frame table. In other words, it is one element of |
| 143 |
the table. |
| 144 |
*/ |
| 145 |
struct Dwarf_Reg_Rule_s { |
| 146 |
|
| 147 |
/* Is a flag indicating whether the rule includes the offset |
| 148 |
field, ie whether the ru_soffset field is valid or not. |
| 149 |
Applies only if DW_EXPR_OFFSET or DW_EXPR_VAL_OFFSET. |
| 150 |
It is important, since reg+offset (offset of 0) |
| 151 |
is different from |
| 152 |
just 'register' since the former means 'read memory at address |
| 153 |
given by the sum of register contents plus offset to get the |
| 154 |
value'. whereas the latter |
| 155 |
means 'the value is in the register'. |
| 156 |
*/ |
| 157 |
Dwarf_Sbyte ru_is_offset; |
| 158 |
|
| 159 |
/* This has to do with evaluating register |
| 160 |
instructions, not with printing frame instruction. |
| 161 |
DW_EXPR_OFFSET 0 ( DWARF2) |
| 162 |
DW_EXPR_VAL_OFFSET 1 (dwarf2/3) |
| 163 |
DW_EXPR_EXPRESSION 2 (dwarf2/3) |
| 164 |
DW_EXPR_VAL_EXPRESSION 3 (dwarf2/3) |
| 165 |
DW_EXPR_ARGS_SIZE 4 (GNU) |
| 166 |
*/ |
| 167 |
Dwarf_Sbyte ru_value_type; |
| 168 |
|
| 169 |
/* Register involved in this rule, real or non-real-register. |
| 170 |
ru_value_type is DW_EXPR_OFFSET or DW_EXPR_VAL_OFFSET. |
| 171 |
*/ |
| 172 |
Dwarf_Unsigned ru_register; |
| 173 |
|
| 174 |
/* Offset to add to register, if indicated by ru_is_offset. |
| 175 |
ru_value_type is DW_EXPR_OFFSET */ |
| 176 |
Dwarf_Signed ru_offset; |
| 177 |
Dwarf_Unsigned ru_args_size; /* DW_CFA_GNU_args_size */ |
| 178 |
/* If ru_value_type is DW_EXPR_EXPRESSION |
| 179 |
or DW_EXPR_VAL_EXPRESSION this is filled in. */ |
| 180 |
Dwarf_Block ru_block; |
| 181 |
|
| 182 |
}; |
| 183 |
/* Internal use only */ |
| 184 |
typedef struct Dwarf_Regtable_Entry3_s_i { |
| 185 |
Dwarf_Small dw_offset_relevant; |
| 186 |
Dwarf_Small dw_value_type; |
| 187 |
Dwarf_Unsigned dw_regnum; |
| 188 |
Dwarf_Unsigned dw_offset; |
| 189 |
Dwarf_Unsigned dw_args_size; /* Not dealt with. */ |
| 190 |
Dwarf_Block dw_block; |
| 191 |
} Dwarf_Regtable_Entry3_i; |
| 192 |
/* Internal use only */ |
| 193 |
typedef struct Dwarf_Regtable3_s_i { |
| 194 |
Dwarf_Regtable_Entry3_i rt3_cfa_rule; |
| 195 |
Dwarf_Unsigned rt3_reg_table_size; |
| 196 |
Dwarf_Regtable_Entry3_i *rt3_rules; |
| 197 |
} Dwarf_Regtable3_i; |
| 198 |
|
| 199 |
typedef struct Dwarf_Frame_s *Dwarf_Frame; |
| 200 |
|
| 201 |
/* |
| 202 |
This structure represents a row of the frame table. |
| 203 |
Fr_loc is the pc value for this row, and Fr_reg |
| 204 |
contains the rule for each column. |
| 205 |
|
| 206 |
Entry DW_FRAME_CFA_COL of fr_reg was the traditional MIPS |
| 207 |
way of setting CFA. cfa_rule is the new one. |
| 208 |
*/ |
| 209 |
struct Dwarf_Frame_s { |
| 210 |
|
| 211 |
/* Pc value corresponding to this row of the frame table. */ |
| 212 |
Dwarf_Addr fr_loc; |
| 213 |
|
| 214 |
/* Rules for all the registers in this row. */ |
| 215 |
struct Dwarf_Reg_Rule_s fr_cfa_rule; |
| 216 |
|
| 217 |
/* fr_reg_count is the the number of |
| 218 |
entries of the fr_reg array. */ |
| 219 |
Dwarf_Unsigned fr_reg_count; |
| 220 |
struct Dwarf_Reg_Rule_s *fr_reg; |
| 221 |
|
| 222 |
Dwarf_Frame fr_next; |
| 223 |
}; |
| 224 |
|
| 225 |
/* See dwarf_frame.c for the heuristics used to set the |
| 226 |
Dwarf_Cie ci_augmentation_type. |
| 227 |
|
| 228 |
This succinctly helps interpret the size and |
| 229 |
meaning of .debug_frame |
| 230 |
and (for gcc) .eh_frame. |
| 231 |
|
| 232 |
In the case of gcc .eh_frame (gcc 3.3, 3.4) |
| 233 |
z may be followed by one or more of |
| 234 |
L R P. |
| 235 |
|
| 236 |
*/ |
| 237 |
enum Dwarf_augmentation_type { |
| 238 |
aug_empty_string, /* Default empty augmentation string. */ |
| 239 |
aug_irix_exception_table, /* IRIX plain "z", |
| 240 |
for exception handling, IRIX CC compiler. |
| 241 |
Proposed z1 z2 ... never implemented. */ |
| 242 |
aug_gcc_eh_z, /* gcc z augmentation, (including |
| 243 |
L R P variations). gcc 3.3 3.4 exception |
| 244 |
handling in eh_frame. */ |
| 245 |
aug_irix_mti_v1, /* IRIX "mti v1" augmentation string. Probably |
| 246 |
never in any released SGI-IRIX compiler. */ |
| 247 |
aug_eh, /* For gcc .eh_frame, "eh" is the string., |
| 248 |
gcc 1,2, egcs. Older values. */ |
| 249 |
aug_armcc, /* "armcc+" meaning the cfa calculation |
| 250 |
is corrected to be standard (output by |
| 251 |
Arm C RVCT 3.0 SP1 and later). See |
| 252 |
http://sourceware.org/ml/gdb-patches/2006-12/msg00249.html |
| 253 |
for details. */ |
| 254 |
aug_unknown, /* Unknown augmentation, we cannot do much. */ |
| 255 |
|
| 256 |
/* HC, From http://sourceforge.net/p/elftoolchain/tickets/397/ */ |
| 257 |
aug_metaware, |
| 258 |
|
| 259 |
aug_past_last |
| 260 |
}; |
| 261 |
|
| 262 |
/* |
| 263 |
This structure contains all the pertinent info for a Cie. Most |
| 264 |
of the fields are taken straight from the definition of a Cie. |
| 265 |
Ci_cie_start points to the address (in .debug_frame) where this |
| 266 |
Cie begins. Ci_cie_instr_start points to the first byte of the |
| 267 |
frame instructions for this Cie. Ci_dbg points to the associated |
| 268 |
Dwarf_Debug structure. Ci_initial_table is a pointer to the table |
| 269 |
row generated by the instructions for this Cie. |
| 270 |
*/ |
| 271 |
struct Dwarf_Cie_s { |
| 272 |
Dwarf_Unsigned ci_length; |
| 273 |
char *ci_augmentation; |
| 274 |
Dwarf_Unsigned ci_code_alignment_factor; |
| 275 |
Dwarf_Signed ci_data_alignment_factor; |
| 276 |
Dwarf_Unsigned ci_return_address_register; |
| 277 |
Dwarf_Small *ci_cie_start; |
| 278 |
Dwarf_Small *ci_cie_instr_start; |
| 279 |
Dwarf_Small *ci_cie_end; |
| 280 |
Dwarf_Debug ci_dbg; |
| 281 |
Dwarf_Frame ci_initial_table; |
| 282 |
Dwarf_Cie ci_next; |
| 283 |
Dwarf_Half ci_length_size; |
| 284 |
Dwarf_Half ci_extension_size; |
| 285 |
Dwarf_Half ci_cie_version_number; |
| 286 |
enum Dwarf_augmentation_type ci_augmentation_type; |
| 287 |
|
| 288 |
/* The following 2 for GNU .eh_frame exception handling |
| 289 |
Augmentation Data. Set if ci_augmentation_type |
| 290 |
is aug_gcc_eh_z. Zero if unused. */ |
| 291 |
Dwarf_Unsigned ci_gnu_eh_augmentation_len; |
| 292 |
Dwarf_Ptr ci_gnu_eh_augmentation_bytes; |
| 293 |
|
| 294 |
/* These are extracted from the gnu eh_frame |
| 295 |
augmentation if the |
| 296 |
augmentation begins with 'z'. See Linux LSB documents. |
| 297 |
Otherwize these are zero. */ |
| 298 |
unsigned char ci_gnu_personality_handler_encoding; |
| 299 |
unsigned char ci_gnu_lsda_encoding; |
| 300 |
unsigned char ci_gnu_fde_begin_encoding; |
| 301 |
|
| 302 |
/* If 'P' augmentation present, is handler addr. Else |
| 303 |
is zero. */ |
| 304 |
Dwarf_Addr ci_gnu_personality_handler_addr; |
| 305 |
|
| 306 |
/* In creating list of cie's (which will become an array) |
| 307 |
record the position so fde can get it on fde creation. */ |
| 308 |
Dwarf_Unsigned ci_index; |
| 309 |
Dwarf_Small * ci_section_ptr; |
| 310 |
Dwarf_Unsigned ci_section_length; |
| 311 |
Dwarf_Small * ci_section_end; |
| 312 |
/* DWARF4 adds address size and segment size to the CIE: |
| 313 |
the .debug_info |
| 314 |
section may not always be present to allow libdwarf to |
| 315 |
find address_size from the compilation-unit. */ |
| 316 |
Dwarf_Half ci_address_size; |
| 317 |
Dwarf_Half ci_segment_size; |
| 318 |
|
| 319 |
}; |
| 320 |
|
| 321 |
/* |
| 322 |
This structure contains all the pertinent info for a Fde. |
| 323 |
Most of the fields are taken straight from the definition. |
| 324 |
fd_cie_index is the index of the Cie associated with this |
| 325 |
Fde in the list of Cie's for this debug_frame. Fd_cie |
| 326 |
points to the corresponding Dwarf_Cie structure. Fd_fde_start |
| 327 |
points to the start address of the Fde. Fd_fde_instr_start |
| 328 |
points to the start of the instructions for this Fde. Fd_dbg |
| 329 |
points to the associated Dwarf_Debug structure. |
| 330 |
*/ |
| 331 |
struct Dwarf_Fde_s { |
| 332 |
Dwarf_Unsigned fd_length; |
| 333 |
Dwarf_Addr fd_cie_offset; |
| 334 |
Dwarf_Unsigned fd_cie_index; |
| 335 |
Dwarf_Cie fd_cie; |
| 336 |
Dwarf_Addr fd_initial_location; |
| 337 |
Dwarf_Small *fd_initial_loc_pos; |
| 338 |
Dwarf_Addr fd_address_range; |
| 339 |
Dwarf_Small *fd_fde_start; |
| 340 |
Dwarf_Small *fd_fde_instr_start; |
| 341 |
Dwarf_Small *fd_fde_end; |
| 342 |
Dwarf_Debug fd_dbg; |
| 343 |
|
| 344 |
/* fd_offset_into_exception_tables is SGI/IRIX exception table |
| 345 |
offset. Unused and zero if not IRIX .debug_frame. */ |
| 346 |
Dwarf_Signed fd_offset_into_exception_tables; |
| 347 |
|
| 348 |
Dwarf_Fde fd_next; |
| 349 |
Dwarf_Small fd_length_size; |
| 350 |
Dwarf_Small fd_extension_size; |
| 351 |
/* So we know from an fde which 'count' of fde-s in |
| 352 |
Dwarf_Debug applies: eh or standard. */ |
| 353 |
Dwarf_Small fd_is_eh; |
| 354 |
/* The following 2 for GNU .eh_frame exception handling |
| 355 |
Augmentation Data. Set if CIE ci_augmentation_type |
| 356 |
is aug_gcc_eh_z. Zero if unused. */ |
| 357 |
Dwarf_Unsigned fd_gnu_eh_augmentation_len; |
| 358 |
Dwarf_Bool fd_gnu_eh_aug_present; |
| 359 |
Dwarf_Ptr fd_gnu_eh_augmentation_bytes; |
| 360 |
Dwarf_Addr fd_gnu_eh_lsda; /* If 'L' augmentation letter |
| 361 |
present: is address of the |
| 362 |
Language Specific Data Area (LSDA). If not 'L" is zero. */ |
| 363 |
|
| 364 |
/* The following 3 are about the Elf section the FDEs come from.*/ |
| 365 |
Dwarf_Small *fd_section_ptr; |
| 366 |
Dwarf_Unsigned fd_section_length; |
| 367 |
Dwarf_Unsigned fd_section_index; |
| 368 |
Dwarf_Small *fd_section_end; |
| 369 |
|
| 370 |
/* If fd_eh_table_value_set is true, then fd_eh_table_value is |
| 371 |
meaningful. Never meaningful for .debug_frame, is |
| 372 |
part of .eh_frame. */ |
| 373 |
Dwarf_Unsigned fd_eh_table_value; |
| 374 |
Dwarf_Bool fd_eh_table_value_set; |
| 375 |
|
| 376 |
/* The following are memoization to save recalculation. */ |
| 377 |
struct Dwarf_Frame_s fd_fde_table; |
| 378 |
Dwarf_Addr fd_fde_pc_requested; |
| 379 |
Dwarf_Bool fd_have_fde_tab; |
| 380 |
|
| 381 |
/* Set by dwarf_get_fde_for_die() */ |
| 382 |
Dwarf_Bool fd_fde_owns_cie; |
| 383 |
|
| 384 |
}; |
| 385 |
|
| 386 |
int |
| 387 |
_dwarf_validate_register_numbers(Dwarf_Debug dbg,Dwarf_Error *error); |
| 388 |
|
| 389 |
int |
| 390 |
_dwarf_frame_address_offsets(Dwarf_Debug dbg, Dwarf_Addr ** addrlist, |
| 391 |
Dwarf_Off ** offsetlist, |
| 392 |
Dwarf_Signed * returncount, |
| 393 |
Dwarf_Error * err); |
| 394 |
|
| 395 |
int |
| 396 |
_dwarf_get_fde_list_internal(Dwarf_Debug dbg, |
| 397 |
Dwarf_Cie ** cie_data, |
| 398 |
Dwarf_Signed * cie_element_count, |
| 399 |
Dwarf_Fde ** fde_data, |
| 400 |
Dwarf_Signed * fde_element_count, |
| 401 |
Dwarf_Small * section_ptr, |
| 402 |
Dwarf_Unsigned section_index, |
| 403 |
Dwarf_Unsigned section_length, |
| 404 |
Dwarf_Unsigned cie_id_value, |
| 405 |
int use_gnu_cie_calc, /* If non-zero, |
| 406 |
this is gcc eh_frame. */ |
| 407 |
Dwarf_Error * error); |
| 408 |
|
| 409 |
enum Dwarf_augmentation_type |
| 410 |
_dwarf_get_augmentation_type(Dwarf_Debug dbg, |
| 411 |
Dwarf_Small *augmentation_string, |
| 412 |
int is_gcc_eh_frame); |
| 413 |
int _dwarf_fde_section_offset(Dwarf_Debug /*dbg*/, |
| 414 |
Dwarf_Fde /*in_fde*/, |
| 415 |
Dwarf_Off * /*fde_off*/, |
| 416 |
Dwarf_Off * /*cie_off*/, |
| 417 |
Dwarf_Error * /*err*/); |
| 418 |
int _dwarf_cie_section_offset(Dwarf_Debug /*dbg*/, |
| 419 |
Dwarf_Cie /*in_cie*/, |
| 420 |
Dwarf_Off * /*cie_off */, |
| 421 |
Dwarf_Error * /*err*/); |
| 422 |
|
| 423 |
int _dwarf_get_return_address_reg(Dwarf_Small *frame_ptr, |
| 424 |
int version, |
| 425 |
Dwarf_Debug dbg, |
| 426 |
Dwarf_Byte_Ptr section_end, |
| 427 |
unsigned long *size, |
| 428 |
Dwarf_Unsigned *return_address_register, |
| 429 |
Dwarf_Error *error); |
| 430 |
|
| 431 |
/* Temporary recording of crucial cie/fde prefix data. |
| 432 |
Vastly simplifies some argument lists. */ |
| 433 |
struct cie_fde_prefix_s { |
| 434 |
/* cf_start_addr is a pointer to the first byte |
| 435 |
of this fde/cie (meaning the length field itself) */ |
| 436 |
Dwarf_Small * cf_start_addr; |
| 437 |
/* cf_addr_after_prefix is a pointer |
| 438 |
to the first byte of this fde/cie |
| 439 |
we are reading now, immediately following |
| 440 |
the length field read by READ_AREA_LENGTH. */ |
| 441 |
Dwarf_Small * cf_addr_after_prefix; |
| 442 |
/* cf_length is the length field value from the cie/fde |
| 443 |
header. */ |
| 444 |
Dwarf_Unsigned cf_length; |
| 445 |
int cf_local_length_size; |
| 446 |
int cf_local_extension_size; |
| 447 |
Dwarf_Unsigned cf_cie_id; |
| 448 |
Dwarf_Small * cf_cie_id_addr; /*used for eh_frame calculations.*/ |
| 449 |
|
| 450 |
/* Simplifies passing around these values to create fde having |
| 451 |
these here. */ |
| 452 |
/* cf_section_ptr is a pointer to the first byte |
| 453 |
of the object section the prefix is read from. */ |
| 454 |
Dwarf_Small * cf_section_ptr; |
| 455 |
Dwarf_Unsigned cf_section_index; |
| 456 |
Dwarf_Unsigned cf_section_length; |
| 457 |
}; |
| 458 |
|
| 459 |
int |
| 460 |
_dwarf_exec_frame_instr(Dwarf_Bool make_instr, |
| 461 |
Dwarf_Bool search_pc, |
| 462 |
Dwarf_Addr search_pc_val, |
| 463 |
Dwarf_Addr initial_loc, |
| 464 |
Dwarf_Small * start_instr_ptr, |
| 465 |
Dwarf_Small * final_instr_ptr, |
| 466 |
Dwarf_Frame table, |
| 467 |
Dwarf_Cie cie, |
| 468 |
Dwarf_Debug dbg, |
| 469 |
Dwarf_Unsigned reg_num_of_cfa, |
| 470 |
Dwarf_Bool * has_more_rows, |
| 471 |
Dwarf_Addr * subsequent_pc, |
| 472 |
Dwarf_Frame_Instr_Head *ret_frame_instr_head, |
| 473 |
Dwarf_Unsigned * returned_frame_instr_count, |
| 474 |
Dwarf_Error *error); |
| 475 |
|
| 476 |
int _dwarf_read_cie_fde_prefix(Dwarf_Debug dbg, |
| 477 |
Dwarf_Small *frame_ptr_in, |
| 478 |
Dwarf_Small *section_ptr_in, |
| 479 |
Dwarf_Unsigned section_index_in, |
| 480 |
Dwarf_Unsigned section_length_in, |
| 481 |
struct cie_fde_prefix_s *prefix_out, |
| 482 |
Dwarf_Error *error); |
| 483 |
|
| 484 |
int _dwarf_create_fde_from_after_start(Dwarf_Debug dbg, |
| 485 |
struct cie_fde_prefix_s * prefix, |
| 486 |
Dwarf_Small *section_pointer, |
| 487 |
Dwarf_Unsigned section_length, |
| 488 |
Dwarf_Small *frame_ptr, |
| 489 |
Dwarf_Small *section_ptr_end, |
| 490 |
int use_gnu_cie_calc, |
| 491 |
Dwarf_Cie cie_ptr_in, |
| 492 |
Dwarf_Half address_size_in, |
| 493 |
Dwarf_Fde *fde_ptr_out, |
| 494 |
Dwarf_Error *error); |
| 495 |
|
| 496 |
int _dwarf_create_cie_from_after_start(Dwarf_Debug dbg, |
| 497 |
struct cie_fde_prefix_s *prefix, |
| 498 |
Dwarf_Small* section_pointer, |
| 499 |
Dwarf_Small* frame_ptr, |
| 500 |
Dwarf_Small *section_ptr_end, |
| 501 |
Dwarf_Unsigned cie_count, |
| 502 |
int use_gnu_cie_calc, |
| 503 |
Dwarf_Cie *cie_ptr_out, |
| 504 |
Dwarf_Error *error); |
| 505 |
|
| 506 |
int _dwarf_frame_constructor(Dwarf_Debug dbg,void * ); |
| 507 |
void _dwarf_frame_destructor (void *); |
| 508 |
void _dwarf_fde_destructor (void *); |
| 509 |
void _dwarf_frame_instr_destructor(void *); |