mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-09-22 17:20:05 +00:00
dwarf cleanup checkpoint
This commit is contained in:
@@ -2838,6 +2838,72 @@ str8_deserial_read_block(String8 string, U64 off, U64 size, String8 *block_out)
|
|||||||
return block_out->size;
|
return block_out->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal U64
|
||||||
|
str8_deserial_read_uleb128(String8 string, U64 off, U64 *value_out)
|
||||||
|
{
|
||||||
|
U64 value = 0;
|
||||||
|
U64 shift = 0;
|
||||||
|
U64 cursor = off;
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
U8 byte = 0;
|
||||||
|
U64 bytes_read = str8_deserial_read_struct(string, cursor, &byte);
|
||||||
|
if(bytes_read != sizeof(byte))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
U8 val = byte & 0x7fu;
|
||||||
|
value |= ((U64)val) << shift;
|
||||||
|
cursor += bytes_read;
|
||||||
|
shift += 7u;
|
||||||
|
if((byte & 0x80u) == 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(value_out != 0)
|
||||||
|
{
|
||||||
|
*value_out = value;
|
||||||
|
}
|
||||||
|
U64 bytes_read = cursor - off;
|
||||||
|
return bytes_read;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal U64
|
||||||
|
str8_deserial_read_sleb128(String8 string, U64 off, S64 *value_out)
|
||||||
|
{
|
||||||
|
U64 value = 0;
|
||||||
|
U64 shift = 0;
|
||||||
|
U64 cursor = off;
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
U8 byte = 0;
|
||||||
|
U64 bytes_read = str8_deserial_read_struct(string, cursor, &byte);
|
||||||
|
if(bytes_read != sizeof(byte))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
U8 val = byte & 0x7fu;
|
||||||
|
value |= ((U64)val) << shift;
|
||||||
|
cursor += bytes_read;
|
||||||
|
shift += 7u;
|
||||||
|
if((byte & 0x80u) == 0)
|
||||||
|
{
|
||||||
|
if(shift < sizeof(value) * 8 && (byte & 0x40u) != 0)
|
||||||
|
{
|
||||||
|
value |= -(S64)(1ull << shift);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(value_out != 0)
|
||||||
|
{
|
||||||
|
*value_out = value;
|
||||||
|
}
|
||||||
|
U64 bytes_read = cursor - off;
|
||||||
|
return bytes_read;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
internal int
|
internal int
|
||||||
|
|||||||
@@ -444,6 +444,8 @@ internal U64 str8_deserial_read_windows_utf16_string16(String8 string, U64 of
|
|||||||
internal U64 str8_deserial_read_block(String8 string, U64 off, U64 size, String8 *block_out);
|
internal U64 str8_deserial_read_block(String8 string, U64 off, U64 size, String8 *block_out);
|
||||||
#define str8_deserial_read_array(string, off, ptr, count) str8_deserial_read((string), (off), (ptr), sizeof(*(ptr))*(count), sizeof(*(ptr)))
|
#define str8_deserial_read_array(string, off, ptr, count) str8_deserial_read((string), (off), (ptr), sizeof(*(ptr))*(count), sizeof(*(ptr)))
|
||||||
#define str8_deserial_read_struct(string, off, ptr) str8_deserial_read_array(string, off, ptr, 1)
|
#define str8_deserial_read_struct(string, off, ptr) str8_deserial_read_array(string, off, ptr, 1)
|
||||||
|
internal U64 str8_deserial_read_uleb128(String8 string, U64 off, U64 *value_out);
|
||||||
|
internal U64 str8_deserial_read_sleb128(String8 string, U64 off, S64 *value_out);
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Basic String Hashes
|
//~ rjf: Basic String Hashes
|
||||||
|
|||||||
@@ -648,7 +648,7 @@ coff_print_obj(Arena *arena, String8List *out, String8 indent, String8 raw_data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (opts & RD_Option_Dwarf) {
|
if (opts & RD_Option_Dwarf) {
|
||||||
DW_Input dwarf_input = dw_input_from_coff_section_table(scratch.arena, raw_data, raw_string_table, header->section_count, section_table);
|
DW_Raw dwarf_input = dw_raw_from_coff_section_table(scratch.arena, raw_data, raw_string_table, header->section_count, section_table);
|
||||||
dw_format(arena, out, indent, opts, &dwarf_input, arch, ExecutableImageKind_CoffPe);
|
dw_format(arena, out, indent, opts, &dwarf_input, arch, ExecutableImageKind_CoffPe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1978,7 +1978,7 @@ ctrl_unwind_step__dwarf(CTRL_Handle process_handle, CTRL_Handle module_handle, A
|
|||||||
// compute CIE address
|
// compute CIE address
|
||||||
U64 cie_delta_off = fde_format == DW_Format_32Bit ? 4 : 12;
|
U64 cie_delta_off = fde_format == DW_Format_32Bit ? 4 : 12;
|
||||||
U64 cie_delta = 0;
|
U64 cie_delta = 0;
|
||||||
U64 cie_delta_size = str8_deserial_read_dwarf_uint(fde_data, cie_delta_off, fde_format, &cie_delta);
|
U64 cie_delta_size = dw_str8_deserial_read_fmt_uint(fde_data, cie_delta_off, fde_format, &cie_delta);
|
||||||
if (cie_delta_size == 0) { goto eh_parse_exit; }
|
if (cie_delta_size == 0) { goto eh_parse_exit; }
|
||||||
cie_addr = (fde_addr + cie_delta_off) - cie_delta;
|
cie_addr = (fde_addr + cie_delta_off) - cie_delta;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,14 +23,14 @@ dw_is_dwarf_present_coff_section_table(String8 string_table, U64 section_count,
|
|||||||
return is_dwarf_present;
|
return is_dwarf_present;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal DW_Input
|
internal DW_Raw
|
||||||
dw_input_from_coff_section_table(Arena *arena,
|
dw_raw_from_coff_section_table(Arena *arena,
|
||||||
String8 raw_image,
|
String8 raw_image,
|
||||||
String8 string_table,
|
String8 string_table,
|
||||||
U64 section_count,
|
U64 section_count,
|
||||||
COFF_SectionHeader *section_table)
|
COFF_SectionHeader *section_table)
|
||||||
{
|
{
|
||||||
DW_Input input = {0};
|
DW_Raw input = {0};
|
||||||
B32 sect_status[ArrayCount(input.sec)] = {0};
|
B32 sect_status[ArrayCount(input.sec)] = {0};
|
||||||
|
|
||||||
for (U64 i = 0; i < section_count; ++i) {
|
for (U64 i = 0; i < section_count; ++i) {
|
||||||
@@ -51,7 +51,6 @@ dw_input_from_coff_section_table(Arena *arena,
|
|||||||
} else {
|
} else {
|
||||||
sect_status[s] = 1;
|
sect_status[s] = 1;
|
||||||
DW_Section *d = &input.sec[s];
|
DW_Section *d = &input.sec[s];
|
||||||
d->name = push_str8_copy(arena, name);
|
|
||||||
d->data = str8_substr(raw_image, raw_data_range);
|
d->data = str8_substr(raw_image, raw_data_range);
|
||||||
d->is_dwo = is_dwo;
|
d->is_dwo = is_dwo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
#define DWARF_COFF_H
|
#define DWARF_COFF_H
|
||||||
|
|
||||||
internal B32 dw_is_dwarf_present_coff_section_table(String8 string_table, U64 section_count, COFF_SectionHeader *section_table);
|
internal B32 dw_is_dwarf_present_coff_section_table(String8 string_table, U64 section_count, COFF_SectionHeader *section_table);
|
||||||
internal DW_Input dw_input_from_coff_section_table(Arena *arena, String8 raw_image, String8 string_table, U64 section_count, COFF_SectionHeader *section_table);
|
internal DW_Raw dw_raw_from_coff_section_table(Arena *arena, String8 raw_image, String8 string_table, U64 section_count, COFF_SectionHeader *section_table);
|
||||||
|
|
||||||
#endif // DWARF_COFF_H
|
#endif // DWARF_COFF_H
|
||||||
|
|
||||||
|
|||||||
+18
-19
@@ -211,13 +211,13 @@ dw_string_list_from_expression(Arena *arena, String8 raw_data, U64 cu_base, U64
|
|||||||
} break;
|
} break;
|
||||||
case DW_ExprOp_CallRef: {
|
case DW_ExprOp_CallRef: {
|
||||||
U64 x = 0;
|
U64 x = 0;
|
||||||
cursor += str8_deserial_read_dwarf_uint(raw_data, cursor, format, &x);
|
cursor += dw_str8_deserial_read_fmt_uint(raw_data, cursor, format, &x);
|
||||||
op_value = push_str8f(scratch.arena, "%llu", x);
|
op_value = push_str8f(scratch.arena, "%llu", x);
|
||||||
} break;
|
} break;
|
||||||
case DW_ExprOp_ImplicitPointer:
|
case DW_ExprOp_ImplicitPointer:
|
||||||
case DW_ExprOp_GNU_ImplicitPointer: {
|
case DW_ExprOp_GNU_ImplicitPointer: {
|
||||||
U64 info_off = 0;
|
U64 info_off = 0;
|
||||||
cursor += str8_deserial_read_dwarf_uint(raw_data, cursor, format, &info_off);
|
cursor += dw_str8_deserial_read_fmt_uint(raw_data, cursor, format, &info_off);
|
||||||
S64 ptr = 0;
|
S64 ptr = 0;
|
||||||
cursor += str8_deserial_read_sleb128(raw_data, cursor, &ptr);
|
cursor += str8_deserial_read_sleb128(raw_data, cursor, &ptr);
|
||||||
|
|
||||||
@@ -680,7 +680,7 @@ dw_print_eh_frame(Arena *arena, String8List *out, String8 indent, String8 raw_eh
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
dw_print_debug_loc(Arena *arena, String8List *out, String8 indent, DW_Input *input, Arch arch, ExecutableImageKind image_type, B32 relaxed)
|
dw_print_debug_loc(Arena *arena, String8List *out, String8 indent, DW_Raw *input, Arch arch, ExecutableImageKind image_type, B32 relaxed)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
DW_Section info = input->sec[DW_Section_Info];
|
DW_Section info = input->sec[DW_Section_Info];
|
||||||
@@ -827,7 +827,7 @@ dw_print_debug_loc(Arena *arena, String8List *out, String8 indent, DW_Input *inp
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
dw_print_debug_ranges(Arena *arena, String8List *out, String8 indent, DW_Input *input, Arch arch, ExecutableImageKind image_type, B32 relaxed)
|
dw_print_debug_ranges(Arena *arena, String8List *out, String8 indent, DW_Raw *input, Arch arch, ExecutableImageKind image_type, B32 relaxed)
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
#if 0
|
#if 0
|
||||||
@@ -933,7 +933,7 @@ dw_print_debug_ranges(Arena *arena, String8List *out, String8 indent, DW_Input *
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
dw_print_debug_aranges(Arena *arena, String8List *out, String8 indent, DW_Input *input)
|
dw_print_debug_aranges(Arena *arena, String8List *out, String8 indent, DW_Raw *input)
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
#if 0
|
#if 0
|
||||||
@@ -1022,7 +1022,7 @@ dw_print_debug_aranges(Arena *arena, String8List *out, String8 indent, DW_Input
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
dw_print_debug_addr(Arena *arena, String8List *out, String8 indent, DW_Input *input)
|
dw_print_debug_addr(Arena *arena, String8List *out, String8 indent, DW_Raw *input)
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
#if 0
|
#if 0
|
||||||
@@ -1131,7 +1131,7 @@ dw_based_range_read_address(void *base, Rng1U64 range, U64 offset, Rng1U64Array
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
dw_print_debug_loclists(Arena *arena, String8List *out, String8 indent, DW_Input *input, Rng1U64Array segment_virtual_ranges, Arch arch)
|
dw_print_debug_loclists(Arena *arena, String8List *out, String8 indent, DW_Raw *input, Rng1U64Array segment_virtual_ranges, Arch arch)
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
#if 0
|
#if 0
|
||||||
@@ -1284,7 +1284,7 @@ dw_print_debug_loclists(Arena *arena, String8List *out, String8 indent, DW_Input
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
dw_print_debug_rnglists(Arena *arena, String8List *out, String8 indent, DW_Input *input, Rng1U64Array segment_ranges)
|
dw_print_debug_rnglists(Arena *arena, String8List *out, String8 indent, DW_Raw *input, Rng1U64Array segment_ranges)
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
#if 0
|
#if 0
|
||||||
@@ -1423,7 +1423,7 @@ dw_print_debug_rnglists(Arena *arena, String8List *out, String8 indent, DW_Input
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
dw_format_string_table(Arena *arena, String8List *out, String8 indent, DW_Input *input, DW_SectionKind sec)
|
dw_format_string_table(Arena *arena, String8List *out, String8 indent, DW_Raw *input, DW_SectionKind sec)
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
#if 0
|
#if 0
|
||||||
@@ -1485,19 +1485,19 @@ dw_format_string_table(Arena *arena, String8List *out, String8 indent, DW_Input
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
dw_print_debug_pubnames(Arena *arena, String8List *out, String8 indent, DW_Input *input)
|
dw_print_debug_pubnames(Arena *arena, String8List *out, String8 indent, DW_Raw *input)
|
||||||
{
|
{
|
||||||
dw_format_string_table(arena, out, indent, input, DW_Section_PubNames);
|
dw_format_string_table(arena, out, indent, input, DW_Section_PubNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
dw_print_debug_pubtypes(Arena *arena, String8List *out, String8 indent, DW_Input *input)
|
dw_print_debug_pubtypes(Arena *arena, String8List *out, String8 indent, DW_Raw *input)
|
||||||
{
|
{
|
||||||
dw_format_string_table(arena, out, indent, input, DW_Section_PubTypes);
|
dw_format_string_table(arena, out, indent, input, DW_Section_PubTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
dw_print_debug_line_str(Arena *arena, String8List *out, String8 indent, DW_Input *input)
|
dw_print_debug_line_str(Arena *arena, String8List *out, String8 indent, DW_Raw *input)
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
#if 0
|
#if 0
|
||||||
@@ -1527,7 +1527,7 @@ dw_print_debug_line_str(Arena *arena, String8List *out, String8 indent, DW_Input
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
dw_print_debug_str_offsets(Arena *arena, String8List *out, String8 indent, DW_Input *input)
|
dw_print_debug_str_offsets(Arena *arena, String8List *out, String8 indent, DW_Raw *input)
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
#if 0
|
#if 0
|
||||||
@@ -1598,7 +1598,7 @@ dw_print_debug_str_offsets(Arena *arena, String8List *out, String8 indent, DW_In
|
|||||||
//~ rjf: Dump Entry Point
|
//~ rjf: Dump Entry Point
|
||||||
|
|
||||||
internal String8
|
internal String8
|
||||||
dw_string_from_attrib_value(Arena *arena, DW_Input *input, Arch arch, DW_CompUnit *unit, DW_LineVMHeader *line_vm, DW_Attrib *attrib)
|
dw_string_from_attrib_value(Arena *arena, DW_Raw *input, Arch arch, DW_CompUnit *unit, DW_LineVMHeader *line_vm, DW_Attrib *attrib)
|
||||||
{
|
{
|
||||||
Temp scratch = scratch_begin(&arena, 1);
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
|
|
||||||
@@ -1737,7 +1737,7 @@ dw_string_from_attrib_value(Arena *arena, DW_Input *input, Arch arch, DW_CompUni
|
|||||||
|
|
||||||
internal String8List
|
internal String8List
|
||||||
dw_dump_list_from_sections(Arena *arena,
|
dw_dump_list_from_sections(Arena *arena,
|
||||||
DW_Input *input,
|
DW_Raw *input,
|
||||||
Arch arch,
|
Arch arch,
|
||||||
DW_DumpSubsetFlags subset_flags)
|
DW_DumpSubsetFlags subset_flags)
|
||||||
{
|
{
|
||||||
@@ -1748,18 +1748,17 @@ dw_dump_list_from_sections(Arena *arena,
|
|||||||
#define DumpSubset(name) if(subset_flags & DW_DumpSubsetFlag_##name) DeferLoop(dumpf("// %S\n\n", dw_name_title_from_dump_subset_table[DW_DumpSubset_##name]), dump(str8_lit("\n")))
|
#define DumpSubset(name) if(subset_flags & DW_DumpSubsetFlag_##name) DeferLoop(dumpf("// %S\n\n", dw_name_title_from_dump_subset_table[DW_DumpSubset_##name]), dump(str8_lit("\n")))
|
||||||
Temp scratch = scratch_begin(&arena, 1);
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
Rng1U64Array segment_vranges = {0};
|
Rng1U64Array segment_vranges = {0};
|
||||||
DW_ListUnitInput lu_input = dw_list_unit_input_from_input(scratch.arena, input);
|
DW_ListUnitInput lu_input = dw_list_unit_input_from_raw(scratch.arena, input);
|
||||||
B32 relaxed = 1;
|
|
||||||
|
|
||||||
DW_CompUnit *cu_arr;
|
DW_CompUnit *cu_arr;
|
||||||
{
|
{
|
||||||
DW_ListUnitInput lu_input = dw_list_unit_input_from_input(scratch.arena, input);
|
DW_ListUnitInput lu_input = dw_list_unit_input_from_raw(scratch.arena, input);
|
||||||
Rng1U64List cu_range_list = dw_unit_ranges_from_data(scratch.arena, input->sec[DW_Section_Info].data);
|
Rng1U64List cu_range_list = dw_unit_ranges_from_data(scratch.arena, input->sec[DW_Section_Info].data);
|
||||||
Rng1U64Array cu_ranges = rng1u64_array_from_list(scratch.arena, &cu_range_list);
|
Rng1U64Array cu_ranges = rng1u64_array_from_list(scratch.arena, &cu_range_list);
|
||||||
cu_arr = push_array(scratch.arena, DW_CompUnit, cu_ranges.count);
|
cu_arr = push_array(scratch.arena, DW_CompUnit, cu_ranges.count);
|
||||||
for EachIndex(cu_idx, cu_ranges.count)
|
for EachIndex(cu_idx, cu_ranges.count)
|
||||||
{
|
{
|
||||||
cu_arr[cu_idx] = dw_cu_from_info_off(scratch.arena, input, lu_input, cu_ranges.v[cu_idx].min, relaxed);
|
cu_arr[cu_idx] = dw_cu_from_info_off(scratch.arena, input, lu_input, cu_ranges.v[cu_idx].min);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-11
@@ -70,21 +70,21 @@ internal String8 dw_string_from_cfi_row(Arena *arena, Arch arch, U64 address_siz
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
internal void dw_print_eh_frame (Arena *arena, String8List *out, String8 indent, String8 raw_eh_frame, Arch arch, DW_Version ver, DW_Ext ext, EH_PtrCtx *ptr_ctx);
|
internal void dw_print_eh_frame (Arena *arena, String8List *out, String8 indent, String8 raw_eh_frame, Arch arch, DW_Version ver, DW_Ext ext, EH_PtrCtx *ptr_ctx);
|
||||||
internal void dw_print_debug_loc (Arena *arena, String8List *out, String8 indent, DW_Input *input, Arch arch, ExecutableImageKind image_type, B32 relaxed);
|
internal void dw_print_debug_loc (Arena *arena, String8List *out, String8 indent, DW_Raw *input, Arch arch, ExecutableImageKind image_type, B32 relaxed);
|
||||||
internal void dw_print_debug_ranges (Arena *arena, String8List *out, String8 indent, DW_Input *input, Arch arch, ExecutableImageKind image_type, B32 relaxed);
|
internal void dw_print_debug_ranges (Arena *arena, String8List *out, String8 indent, DW_Raw *input, Arch arch, ExecutableImageKind image_type, B32 relaxed);
|
||||||
internal void dw_print_debug_aranges (Arena *arena, String8List *out, String8 indent, DW_Input *input);
|
internal void dw_print_debug_aranges (Arena *arena, String8List *out, String8 indent, DW_Raw *input);
|
||||||
internal void dw_print_debug_addr (Arena *arena, String8List *out, String8 indent, DW_Input *input);
|
internal void dw_print_debug_addr (Arena *arena, String8List *out, String8 indent, DW_Raw *input);
|
||||||
internal void dw_print_debug_loclists (Arena *arena, String8List *out, String8 indent, DW_Input *input, Rng1U64Array segment_vranges, Arch arch);
|
internal void dw_print_debug_loclists (Arena *arena, String8List *out, String8 indent, DW_Raw *input, Rng1U64Array segment_vranges, Arch arch);
|
||||||
internal void dw_print_debug_rnglists (Arena *arena, String8List *out, String8 indent, DW_Input *input, Rng1U64Array segment_vranges);
|
internal void dw_print_debug_rnglists (Arena *arena, String8List *out, String8 indent, DW_Raw *input, Rng1U64Array segment_vranges);
|
||||||
internal void dw_print_debug_pubnames (Arena *arena, String8List *out, String8 indent, DW_Input *input);
|
internal void dw_print_debug_pubnames (Arena *arena, String8List *out, String8 indent, DW_Raw *input);
|
||||||
internal void dw_print_debug_pubtypes (Arena *arena, String8List *out, String8 indent, DW_Input *input);
|
internal void dw_print_debug_pubtypes (Arena *arena, String8List *out, String8 indent, DW_Raw *input);
|
||||||
internal void dw_print_debug_line_str (Arena *arena, String8List *out, String8 indent, DW_Input *input);
|
internal void dw_print_debug_line_str (Arena *arena, String8List *out, String8 indent, DW_Raw *input);
|
||||||
internal void dw_print_debug_str_offsets(Arena *arena, String8List *out, String8 indent, DW_Input *input);
|
internal void dw_print_debug_str_offsets(Arena *arena, String8List *out, String8 indent, DW_Raw *input);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Dump Entry Point
|
//~ rjf: Dump Entry Point
|
||||||
|
|
||||||
internal String8List dw_dump_list_from_sections(Arena *arena, DW_Input *input, Arch arch, DW_DumpSubsetFlags subset_flags);
|
internal String8List dw_dump_list_from_sections(Arena *arena, DW_Raw *input, Arch arch, DW_DumpSubsetFlags subset_flags);
|
||||||
|
|
||||||
#endif // DWARF_DUMP_H
|
#endif // DWARF_DUMP_H
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ dw_is_dwarf_present_from_elf_bin(String8 data, ELF_Bin *bin)
|
|||||||
#define SINFL_IMPLEMENTATION
|
#define SINFL_IMPLEMENTATION
|
||||||
#include "third_party/sinfl/sinfl.h"
|
#include "third_party/sinfl/sinfl.h"
|
||||||
|
|
||||||
internal DW_Input
|
internal DW_Raw
|
||||||
dw_input_from_elf_bin(Arena *arena, String8 data, ELF_Bin *bin)
|
dw_raw_from_elf_bin(Arena *arena, String8 data, ELF_Bin *bin)
|
||||||
{
|
{
|
||||||
DW_Input result = {0};
|
DW_Raw result = {0};
|
||||||
B32 is_section_present[ArrayCount(result.sec)] = {0};
|
B32 is_section_present[ArrayCount(result.sec)] = {0};
|
||||||
for(U64 section_idx = 1; section_idx < bin->shdrs.count; section_idx += 1)
|
for(U64 section_idx = 1; section_idx < bin->shdrs.count; section_idx += 1)
|
||||||
{
|
{
|
||||||
@@ -106,7 +106,6 @@ dw_input_from_elf_bin(Arena *arena, String8 data, ELF_Bin *bin)
|
|||||||
//- rjf: store
|
//- rjf: store
|
||||||
is_section_present[section_kind] = 1;
|
is_section_present[section_kind] = 1;
|
||||||
DW_Section *d = &result.sec[section_kind];
|
DW_Section *d = &result.sec[section_kind];
|
||||||
d->name = push_str8_copy(arena, section_name);
|
|
||||||
d->data = section_data__uncompressed;
|
d->data = section_data__uncompressed;
|
||||||
d->is_dwo = is_dwo;
|
d->is_dwo = is_dwo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,6 @@
|
|||||||
#define DWARF_ELF_H
|
#define DWARF_ELF_H
|
||||||
|
|
||||||
internal B32 dw_is_dwarf_present_from_elf_bin(String8 raw_image, ELF_Bin *bin);
|
internal B32 dw_is_dwarf_present_from_elf_bin(String8 raw_image, ELF_Bin *bin);
|
||||||
internal DW_Input dw_input_from_elf_bin(Arena *arena, String8 raw_image, ELF_Bin *bin);
|
internal DW_Raw dw_raw_from_elf_bin(Arena *arena, String8 raw_image, ELF_Bin *bin);
|
||||||
|
|
||||||
#endif // DWARF_ELF_H
|
#endif // DWARF_ELF_H
|
||||||
|
|||||||
@@ -15,4 +15,3 @@ typedef struct DW_CallFrameInfo
|
|||||||
internal DW_CallFrameInfo dw_call_frame_info_from_data(Arena *arena, Arch arch, U64 rebase, String8 debug_frame);
|
internal DW_CallFrameInfo dw_call_frame_info_from_data(Arena *arena, Arch arch, U64 rebase, String8 debug_frame);
|
||||||
|
|
||||||
#endif // DWARF_HELP_H
|
#endif // DWARF_HELP_H
|
||||||
|
|
||||||
|
|||||||
+87
-209
@@ -2,7 +2,7 @@
|
|||||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||||
|
|
||||||
internal U64
|
internal U64
|
||||||
str8_deserial_read_dwarf_packed_size(String8 string, U64 off, U64 *size_out)
|
dw_str8_deserial_read_packed_size(String8 string, U64 off, U64 *size_out)
|
||||||
{
|
{
|
||||||
U64 bytes_read = 0;
|
U64 bytes_read = 0;
|
||||||
if(str8_deserial_read(string, off, size_out, sizeof(U32), sizeof(U32)))
|
if(str8_deserial_read(string, off, size_out, sizeof(U32), sizeof(U32)))
|
||||||
@@ -24,7 +24,7 @@ str8_deserial_read_dwarf_packed_size(String8 string, U64 off, U64 *size_out)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal U64
|
internal U64
|
||||||
str8_deserial_read_dwarf_uint(String8 string, U64 off, DW_Format format, U64 *uint_out)
|
dw_str8_deserial_read_fmt_uint(String8 string, U64 off, DW_Format format, U64 *uint_out)
|
||||||
{
|
{
|
||||||
U64 bytes_read = 0;
|
U64 bytes_read = 0;
|
||||||
switch(format)
|
switch(format)
|
||||||
@@ -43,126 +43,6 @@ str8_deserial_read_dwarf_uint(String8 string, U64 off, DW_Format format, U64 *ui
|
|||||||
return bytes_read;
|
return bytes_read;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal U64
|
|
||||||
str8_deserial_read_uleb128(String8 string, U64 off, U64 *value_out)
|
|
||||||
{
|
|
||||||
U64 value = 0;
|
|
||||||
U64 shift = 0;
|
|
||||||
U64 cursor = off;
|
|
||||||
for(;;)
|
|
||||||
{
|
|
||||||
U8 byte = 0;
|
|
||||||
U64 bytes_read = str8_deserial_read_struct(string, cursor, &byte);
|
|
||||||
if(bytes_read != sizeof(byte))
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
U8 val = byte & 0x7fu;
|
|
||||||
value |= ((U64)val) << shift;
|
|
||||||
cursor += bytes_read;
|
|
||||||
shift += 7u;
|
|
||||||
if((byte & 0x80u) == 0)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(value_out != 0)
|
|
||||||
{
|
|
||||||
*value_out = value;
|
|
||||||
}
|
|
||||||
U64 bytes_read = cursor - off;
|
|
||||||
return bytes_read;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal U64
|
|
||||||
str8_deserial_read_sleb128(String8 string, U64 off, S64 *value_out)
|
|
||||||
{
|
|
||||||
U64 value = 0;
|
|
||||||
U64 shift = 0;
|
|
||||||
U64 cursor = off;
|
|
||||||
for(;;)
|
|
||||||
{
|
|
||||||
U8 byte = 0;
|
|
||||||
U64 bytes_read = str8_deserial_read_struct(string, cursor, &byte);
|
|
||||||
if(bytes_read != sizeof(byte))
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
U8 val = byte & 0x7fu;
|
|
||||||
value |= ((U64)val) << shift;
|
|
||||||
cursor += bytes_read;
|
|
||||||
shift += 7u;
|
|
||||||
if((byte & 0x80u) == 0)
|
|
||||||
{
|
|
||||||
if(shift < sizeof(value) * 8 && (byte & 0x40u) != 0)
|
|
||||||
{
|
|
||||||
value |= -(S64)(1ull << shift);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(value_out != 0)
|
|
||||||
{
|
|
||||||
*value_out = value;
|
|
||||||
}
|
|
||||||
U64 bytes_read = cursor - off;
|
|
||||||
return bytes_read;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal U64
|
|
||||||
str8_deserial_read_uleb128_array(Arena *arena, String8 string, U64 off, U64 count, U64 **arr_out)
|
|
||||||
{
|
|
||||||
Temp temp = temp_begin(arena);
|
|
||||||
|
|
||||||
U64 *arr = push_array(arena, U64, count);
|
|
||||||
U64 i, cursor;
|
|
||||||
for (i = 0, cursor = off; i < count; ++i) {
|
|
||||||
U64 read_size = str8_deserial_read_uleb128(string, cursor, &arr[i]);
|
|
||||||
if (read_size == 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
cursor += read_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
U64 bytes_read = 0;
|
|
||||||
if (i == count) {
|
|
||||||
*arr_out = arr;
|
|
||||||
bytes_read = cursor - off;
|
|
||||||
} else {
|
|
||||||
temp_end(temp);
|
|
||||||
*arr_out = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return bytes_read;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal U64
|
|
||||||
str8_deserial_read_sleb128_array(Arena *arena, String8 string, U64 off, U64 count, S64 **arr_out)
|
|
||||||
{
|
|
||||||
Temp temp = temp_begin(arena);
|
|
||||||
|
|
||||||
S64 *arr = push_array(arena, S64, count);
|
|
||||||
U64 i, cursor;
|
|
||||||
for (i = 0, cursor = off; i < count; ++i) {
|
|
||||||
U64 read_size = str8_deserial_read_sleb128(string, cursor, &arr[i]);
|
|
||||||
if (read_size == 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
cursor += read_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
U64 bytes_read = 0;
|
|
||||||
if (i == count) {
|
|
||||||
*arr_out = arr;
|
|
||||||
bytes_read = cursor - off;
|
|
||||||
} else {
|
|
||||||
temp_end(temp);
|
|
||||||
*arr_out = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return bytes_read;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal DW_SectionKind
|
internal DW_SectionKind
|
||||||
dw_section_kind_from_string(String8 string)
|
dw_section_kind_from_string(String8 string)
|
||||||
{
|
{
|
||||||
@@ -194,7 +74,7 @@ dw_unit_ranges_from_data(Arena *arena, String8 data)
|
|||||||
{
|
{
|
||||||
// rjf: read CU size; bad read -> terminate
|
// rjf: read CU size; bad read -> terminate
|
||||||
U64 cu_size = 0;
|
U64 cu_size = 0;
|
||||||
U64 cu_size_size = str8_deserial_read_dwarf_packed_size(data, cursor, &cu_size);
|
U64 cu_size_size = dw_str8_deserial_read_packed_size(data, cursor, &cu_size);
|
||||||
if(cu_size_size == 0)
|
if(cu_size_size == 0)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
@@ -219,7 +99,7 @@ dw_read_list_unit_header_addr(String8 unit_data, DW_ListUnit *lu_out)
|
|||||||
U64 header_size = 0;
|
U64 header_size = 0;
|
||||||
|
|
||||||
U64 unit_length = 0;
|
U64 unit_length = 0;
|
||||||
U64 unit_length_size = str8_deserial_read_dwarf_packed_size(unit_data, 0, &unit_length);
|
U64 unit_length_size = dw_str8_deserial_read_packed_size(unit_data, 0, &unit_length);
|
||||||
|
|
||||||
if (unit_length_size) {
|
if (unit_length_size) {
|
||||||
DW_Version version = DW_Version_Null;
|
DW_Version version = DW_Version_Null;
|
||||||
@@ -260,7 +140,7 @@ dw_read_list_unit_header_str_offsets(String8 unit_data, DW_ListUnit *lu_out)
|
|||||||
U64 header_size = 0;
|
U64 header_size = 0;
|
||||||
|
|
||||||
U64 unit_length = 0;
|
U64 unit_length = 0;
|
||||||
U64 unit_length_size = str8_deserial_read_dwarf_packed_size(unit_data, 0, &unit_length);
|
U64 unit_length_size = dw_str8_deserial_read_packed_size(unit_data, 0, &unit_length);
|
||||||
|
|
||||||
if (unit_length_size) {
|
if (unit_length_size) {
|
||||||
DW_Version version = DW_Version_Null;
|
DW_Version version = DW_Version_Null;
|
||||||
@@ -291,7 +171,7 @@ dw_read_list_unit_header_list(String8 unit_data, DW_ListUnit *lu_out)
|
|||||||
U64 header_size = 0;
|
U64 header_size = 0;
|
||||||
|
|
||||||
U64 unit_length = 0;
|
U64 unit_length = 0;
|
||||||
U64 unit_length_size = str8_deserial_read_dwarf_packed_size(unit_data, 0, &unit_length);
|
U64 unit_length_size = dw_str8_deserial_read_packed_size(unit_data, 0, &unit_length);
|
||||||
|
|
||||||
if (unit_length_size) {
|
if (unit_length_size) {
|
||||||
DW_Version version = DW_Version_Null;
|
DW_Version version = DW_Version_Null;
|
||||||
@@ -327,7 +207,7 @@ dw_read_list_unit_header_list(String8 unit_data, DW_ListUnit *lu_out)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal DW_ListUnitInput
|
internal DW_ListUnitInput
|
||||||
dw_list_unit_input_from_input(Arena *arena, DW_Input *input)
|
dw_list_unit_input_from_raw(Arena *arena, DW_Raw *input)
|
||||||
{
|
{
|
||||||
Temp scratch = scratch_begin(&arena, 1);
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
|
|
||||||
@@ -709,11 +589,11 @@ dw_read_form(String8 data,
|
|||||||
if (version < DW_Version_3) {
|
if (version < DW_Version_3) {
|
||||||
bytes_read = str8_deserial_read(data, off, &form.ref, address_size, address_size);
|
bytes_read = str8_deserial_read(data, off, &form.ref, address_size, address_size);
|
||||||
} else {
|
} else {
|
||||||
bytes_read = str8_deserial_read_dwarf_uint(data, off, unit_format, &form.ref);
|
bytes_read = dw_str8_deserial_read_fmt_uint(data, off, unit_format, &form.ref);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case DW_Form_GNU_RefAlt: {
|
case DW_Form_GNU_RefAlt: {
|
||||||
bytes_read = str8_deserial_read_dwarf_uint(data, off, unit_format, &form.ref);
|
bytes_read = dw_str8_deserial_read_fmt_uint(data, off, unit_format, &form.ref);
|
||||||
} break;
|
} break;
|
||||||
case DW_Form_Ref1: {
|
case DW_Form_Ref1: {
|
||||||
bytes_read = str8_deserial_read(data, off, &form.ref, 1, 1);
|
bytes_read = str8_deserial_read(data, off, &form.ref, 1, 1);
|
||||||
@@ -734,7 +614,7 @@ dw_read_form(String8 data,
|
|||||||
case DW_Form_LineStrp:
|
case DW_Form_LineStrp:
|
||||||
case DW_Form_GNU_StrpAlt:
|
case DW_Form_GNU_StrpAlt:
|
||||||
case DW_Form_Strp: {
|
case DW_Form_Strp: {
|
||||||
bytes_read = str8_deserial_read_dwarf_uint(data, off, unit_format, &form.sec_offset);
|
bytes_read = dw_str8_deserial_read_fmt_uint(data, off, unit_format, &form.sec_offset);
|
||||||
} break;
|
} break;
|
||||||
case DW_Form_ExprLoc: {
|
case DW_Form_ExprLoc: {
|
||||||
U64 expr_size = 0;
|
U64 expr_size = 0;
|
||||||
@@ -764,7 +644,7 @@ dw_read_form(String8 data,
|
|||||||
NotImplemented;
|
NotImplemented;
|
||||||
} break;
|
} break;
|
||||||
case DW_Form_StrpSup: {
|
case DW_Form_StrpSup: {
|
||||||
bytes_read = str8_deserial_read_dwarf_uint(data, off, unit_format, &form.strp_sup);
|
bytes_read = dw_str8_deserial_read_fmt_uint(data, off, unit_format, &form.strp_sup);
|
||||||
} break;
|
} break;
|
||||||
case DW_Form_Data16: {
|
case DW_Form_Data16: {
|
||||||
bytes_read = str8_deserial_read_block(data, off, 16, &form.data);
|
bytes_read = str8_deserial_read_block(data, off, 16, &form.data);
|
||||||
@@ -902,7 +782,7 @@ dw_read_tag(Arena *arena,
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal U64
|
internal U64
|
||||||
dw_read_tag_cu(Arena *arena, DW_Input *input, DW_CompUnit *cu, U64 info_off, DW_Tag *tag_out)
|
dw_read_tag_cu(Arena *arena, DW_Raw *input, DW_CompUnit *cu, U64 info_off, DW_Tag *tag_out)
|
||||||
{
|
{
|
||||||
String8 tag_data = str8_substr(input->sec[DW_Section_Info].data, cu->info_range);
|
String8 tag_data = str8_substr(input->sec[DW_Section_Info].data, cu->info_range);
|
||||||
U64 tag_off = info_off - cu->info_range.min;
|
U64 tag_off = info_off - cu->info_range.min;
|
||||||
@@ -1054,14 +934,14 @@ dw_interp_address(U64 address_size, U64 base_addr, DW_ListUnit *addr_lu, DW_Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal String8
|
internal String8
|
||||||
dw_interp_block(DW_Input *input, DW_CompUnit *cu, DW_FormKind form_kind, DW_Form form)
|
dw_interp_block(DW_Raw *input, DW_CompUnit *cu, DW_FormKind form_kind, DW_Form form)
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
return str8_zero();
|
return str8_zero();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal String8
|
internal String8
|
||||||
dw_interp_string(DW_Input *input,
|
dw_interp_string(DW_Raw *input,
|
||||||
DW_Format unit_format,
|
DW_Format unit_format,
|
||||||
DW_ListUnit *str_offsets,
|
DW_ListUnit *str_offsets,
|
||||||
DW_FormKind form_kind,
|
DW_FormKind form_kind,
|
||||||
@@ -1100,7 +980,7 @@ dw_interp_string(DW_Input *input,
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal String8
|
internal String8
|
||||||
dw_interp_line_ptr(DW_Input *input, DW_FormKind form_kind, DW_Form form)
|
dw_interp_line_ptr(DW_Raw *input, DW_FormKind form_kind, DW_Form form)
|
||||||
{
|
{
|
||||||
String8 result = {0};
|
String8 result = {0};
|
||||||
if (form_kind == DW_Form_SecOffset) {
|
if (form_kind == DW_Form_SecOffset) {
|
||||||
@@ -1125,7 +1005,7 @@ dw_interp_file(DW_LineVMHeader *line_vm, DW_FormKind form_kind, DW_Form form)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal DW_Reference
|
internal DW_Reference
|
||||||
dw_interp_ref(DW_Input *input, DW_CompUnit *cu, DW_FormKind form_kind, DW_Form form)
|
dw_interp_ref(DW_Raw *input, DW_CompUnit *cu, DW_FormKind form_kind, DW_Form form)
|
||||||
{
|
{
|
||||||
DW_Reference ref = {0};
|
DW_Reference ref = {0};
|
||||||
if (form_kind == DW_Form_Ref1 || form_kind == DW_Form_Ref2 ||
|
if (form_kind == DW_Form_Ref1 || form_kind == DW_Form_Ref2 ||
|
||||||
@@ -1146,7 +1026,7 @@ dw_interp_ref(DW_Input *input, DW_CompUnit *cu, DW_FormKind form_kind, DW_Form f
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal DW_LocList
|
internal DW_LocList
|
||||||
dw_interp_loclist(Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_FormKind form_kind, DW_Form form)
|
dw_interp_loclist(Arena *arena, DW_Raw *input, DW_CompUnit *cu, DW_FormKind form_kind, DW_Form form)
|
||||||
{
|
{
|
||||||
DW_LocList loclist = {0};
|
DW_LocList loclist = {0};
|
||||||
|
|
||||||
@@ -1433,7 +1313,7 @@ dw_interp_flag(DW_FormKind form_kind, DW_Form form)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal Rng1U64List
|
internal Rng1U64List
|
||||||
dw_interp_rnglist(Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_FormKind form_kind, DW_Form form)
|
dw_interp_rnglist(Arena *arena, DW_Raw *input, DW_CompUnit *cu, DW_FormKind form_kind, DW_Form form)
|
||||||
{
|
{
|
||||||
Rng1U64List rnglist = {0};
|
Rng1U64List rnglist = {0};
|
||||||
|
|
||||||
@@ -1624,7 +1504,7 @@ dw_interp_rnglist(Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_FormKind fo
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal String8
|
internal String8
|
||||||
dw_interp_secptr(DW_Input *input, DW_SectionKind section, DW_FormKind form_kind, DW_Form form)
|
dw_interp_secptr(DW_Raw *input, DW_SectionKind section, DW_FormKind form_kind, DW_Form form)
|
||||||
{
|
{
|
||||||
String8 secptr = {0};
|
String8 secptr = {0};
|
||||||
if (form_kind == DW_Form_SecOffset) {
|
if (form_kind == DW_Form_SecOffset) {
|
||||||
@@ -1638,25 +1518,25 @@ dw_interp_secptr(DW_Input *input, DW_SectionKind section, DW_FormKind form_kind,
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal String8
|
internal String8
|
||||||
dw_interp_addrptr(DW_Input *input, DW_FormKind form_kind, DW_Form form)
|
dw_interp_addrptr(DW_Raw *input, DW_FormKind form_kind, DW_Form form)
|
||||||
{
|
{
|
||||||
return dw_interp_secptr(input, DW_Section_Addr, form_kind, form);
|
return dw_interp_secptr(input, DW_Section_Addr, form_kind, form);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal String8
|
internal String8
|
||||||
dw_interp_str_offsets_ptr(DW_Input *input, DW_FormKind form_kind, DW_Form form)
|
dw_interp_str_offsets_ptr(DW_Raw *input, DW_FormKind form_kind, DW_Form form)
|
||||||
{
|
{
|
||||||
return dw_interp_secptr(input, DW_Section_StrOffsets, form_kind, form);
|
return dw_interp_secptr(input, DW_Section_StrOffsets, form_kind, form);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal String8
|
internal String8
|
||||||
dw_interp_rnglists_ptr(DW_Input *input, DW_FormKind form_kind, DW_Form form)
|
dw_interp_rnglists_ptr(DW_Raw *input, DW_FormKind form_kind, DW_Form form)
|
||||||
{
|
{
|
||||||
return dw_interp_secptr(input, DW_Section_RngLists, form_kind, form);
|
return dw_interp_secptr(input, DW_Section_RngLists, form_kind, form);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal String8
|
internal String8
|
||||||
dw_interp_loclists_ptr(DW_Input *input, DW_FormKind form_kind, DW_Form form)
|
dw_interp_loclists_ptr(DW_Raw *input, DW_FormKind form_kind, DW_Form form)
|
||||||
{
|
{
|
||||||
return dw_interp_secptr(input, DW_Section_LocLists, form_kind, form);
|
return dw_interp_secptr(input, DW_Section_LocLists, form_kind, form);
|
||||||
}
|
}
|
||||||
@@ -1668,7 +1548,7 @@ dw_value_class_from_attrib(DW_CompUnit *cu, DW_Attrib *attrib)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal String8
|
internal String8
|
||||||
dw_exprloc_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
dw_exprloc_from_attrib(DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||||
{
|
{
|
||||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_ExprLoc || value_class == DW_AttribClass_Block);
|
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_ExprLoc || value_class == DW_AttribClass_Block);
|
||||||
@@ -1676,7 +1556,7 @@ dw_exprloc_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal U128
|
internal U128
|
||||||
dw_const_u128_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
dw_const_u128_from_attrib(DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||||
{
|
{
|
||||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Const);
|
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Const);
|
||||||
@@ -1684,7 +1564,7 @@ dw_const_u128_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal U64
|
internal U64
|
||||||
dw_const_u64_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
dw_const_u64_from_attrib(DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||||
{
|
{
|
||||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Const);
|
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Const);
|
||||||
@@ -1692,7 +1572,7 @@ dw_const_u64_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal U32
|
internal U32
|
||||||
dw_const_u32_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
dw_const_u32_from_attrib(DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||||
{
|
{
|
||||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Const);
|
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Const);
|
||||||
@@ -1700,7 +1580,7 @@ dw_const_u32_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal S64
|
internal S64
|
||||||
dw_const_s64_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
dw_const_s64_from_attrib(DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||||
{
|
{
|
||||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Const);
|
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Const);
|
||||||
@@ -1708,7 +1588,7 @@ dw_const_s64_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal S32
|
internal S32
|
||||||
dw_const_s32_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
dw_const_s32_from_attrib(DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||||
{
|
{
|
||||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Const);
|
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Const);
|
||||||
@@ -1716,7 +1596,7 @@ dw_const_s32_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal B32
|
internal B32
|
||||||
dw_flag_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
dw_flag_from_attrib(DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||||
{
|
{
|
||||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Flag);
|
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Flag);
|
||||||
@@ -1724,7 +1604,7 @@ dw_flag_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal U64
|
internal U64
|
||||||
dw_address_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
dw_address_from_attrib(DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||||
{
|
{
|
||||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||||
AssertAlways(value_class == DW_AttribClass_Null ||
|
AssertAlways(value_class == DW_AttribClass_Null ||
|
||||||
@@ -1749,7 +1629,7 @@ dw_address_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal String8
|
internal String8
|
||||||
dw_block_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
dw_block_from_attrib(DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||||
{
|
{
|
||||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Block);
|
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Block);
|
||||||
@@ -1757,7 +1637,7 @@ dw_block_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal String8
|
internal String8
|
||||||
dw_string_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
dw_string_from_attrib(DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||||
{
|
{
|
||||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_String || value_class == DW_AttribClass_StrOffsetsPtr);
|
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_String || value_class == DW_AttribClass_StrOffsetsPtr);
|
||||||
@@ -1765,7 +1645,7 @@ dw_string_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal String8
|
internal String8
|
||||||
dw_line_ptr_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
dw_line_ptr_from_attrib(DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||||
{
|
{
|
||||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_LinePtr);
|
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_LinePtr);
|
||||||
@@ -1781,7 +1661,7 @@ dw_file_from_attrib(DW_CompUnit *cu, DW_LineVMHeader *line_vm, DW_Attrib *attrib
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal DW_Reference
|
internal DW_Reference
|
||||||
dw_ref_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
dw_ref_from_attrib(DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||||
{
|
{
|
||||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Reference);
|
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Reference);
|
||||||
@@ -1789,7 +1669,7 @@ dw_ref_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal DW_LocList
|
internal DW_LocList
|
||||||
dw_loclist_from_attrib(Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
dw_loclist_from_attrib(Arena *arena, DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||||
{
|
{
|
||||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||||
AssertAlways(value_class == DW_AttribClass_Null ||
|
AssertAlways(value_class == DW_AttribClass_Null ||
|
||||||
@@ -1799,7 +1679,7 @@ dw_loclist_from_attrib(Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Attrib
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal Rng1U64List
|
internal Rng1U64List
|
||||||
dw_rnglist_from_attrib(Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
dw_rnglist_from_attrib(Arena *arena, DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||||
{
|
{
|
||||||
Rng1U64List rnglist = {0};
|
Rng1U64List rnglist = {0};
|
||||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||||
@@ -1826,7 +1706,7 @@ dw_attrib_from_tag_(DW_Tag tag, DW_AttribKind kind)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal DW_Attrib *
|
internal DW_Attrib *
|
||||||
dw_attrib_from_tag(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
dw_attrib_from_tag(DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||||
{
|
{
|
||||||
DW_Attrib *attrib = dw_attrib_from_tag_(tag, kind);
|
DW_Attrib *attrib = dw_attrib_from_tag_(tag, kind);
|
||||||
|
|
||||||
@@ -1845,7 +1725,7 @@ dw_attrib_from_tag(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind k
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal B32
|
internal B32
|
||||||
dw_tag_has_attrib(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
dw_tag_has_attrib(DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||||
{
|
{
|
||||||
DW_Attrib *attrib = dw_attrib_from_tag(input, cu, tag, kind);
|
DW_Attrib *attrib = dw_attrib_from_tag(input, cu, tag, kind);
|
||||||
B32 has_attrib = attrib->attrib_kind != DW_AttribKind_Null;
|
B32 has_attrib = attrib->attrib_kind != DW_AttribKind_Null;
|
||||||
@@ -1853,85 +1733,85 @@ dw_tag_has_attrib(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind ki
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal String8
|
internal String8
|
||||||
dw_exprloc_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
dw_exprloc_from_tag_attrib_kind(DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||||
{
|
{
|
||||||
return dw_exprloc_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
return dw_exprloc_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal String8
|
internal String8
|
||||||
dw_block_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
dw_block_from_tag_attrib_kind(DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||||
{
|
{
|
||||||
return dw_block_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
return dw_block_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal U128
|
internal U128
|
||||||
dw_const_u128_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
dw_const_u128_from_tag_attrib_kind(DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||||
{
|
{
|
||||||
return dw_const_u128_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
return dw_const_u128_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal U64
|
internal U64
|
||||||
dw_const_u64_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
dw_const_u64_from_tag_attrib_kind(DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||||
{
|
{
|
||||||
return dw_const_u64_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
return dw_const_u64_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal U32
|
internal U32
|
||||||
dw_const_u32_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
dw_const_u32_from_tag_attrib_kind(DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||||
{
|
{
|
||||||
return dw_const_u32_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
return dw_const_u32_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal U64
|
internal U64
|
||||||
dw_address_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
dw_address_from_tag_attrib_kind(DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||||
{
|
{
|
||||||
return dw_address_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
return dw_address_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal String8
|
internal String8
|
||||||
dw_string_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
dw_string_from_tag_attrib_kind(DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||||
{
|
{
|
||||||
return dw_string_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
return dw_string_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal String8
|
internal String8
|
||||||
dw_line_ptr_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
dw_line_ptr_from_tag_attrib_kind(DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||||
{
|
{
|
||||||
return dw_line_ptr_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
return dw_line_ptr_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal DW_Reference
|
internal DW_Reference
|
||||||
dw_ref_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
dw_ref_from_tag_attrib_kind(DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||||
{
|
{
|
||||||
return dw_ref_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
return dw_ref_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal DW_LocList
|
internal DW_LocList
|
||||||
dw_loclist_from_tag_attrib_kind(Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
dw_loclist_from_tag_attrib_kind(Arena *arena, DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||||
{
|
{
|
||||||
return dw_loclist_from_attrib(arena, input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
return dw_loclist_from_attrib(arena, input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Rng1U64List
|
internal Rng1U64List
|
||||||
dw_rnglist_from_tag_attrib_kind(Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
dw_rnglist_from_tag_attrib_kind(Arena *arena, DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||||
{
|
{
|
||||||
return dw_rnglist_from_attrib(arena, input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
return dw_rnglist_from_attrib(arena, input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal B32
|
internal B32
|
||||||
dw_flag_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
dw_flag_from_tag_attrib_kind(DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||||
{
|
{
|
||||||
return dw_flag_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
return dw_flag_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal DW_LineFile *
|
internal DW_LineFile *
|
||||||
dw_file_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_LineVMHeader *line_vm, DW_Tag tag, DW_AttribKind kind)
|
dw_file_from_tag_attrib_kind(DW_Raw *input, DW_CompUnit *cu, DW_LineVMHeader *line_vm, DW_Tag tag, DW_AttribKind kind)
|
||||||
{
|
{
|
||||||
return dw_file_from_attrib(cu, line_vm, dw_attrib_from_tag(input, cu, tag, kind));
|
return dw_file_from_attrib(cu, line_vm, dw_attrib_from_tag(input, cu, tag, kind));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal B32
|
internal B32
|
||||||
dw_try_byte_size_from_tag(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, U64 *byte_size_out)
|
dw_try_byte_size_from_tag(DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, U64 *byte_size_out)
|
||||||
{
|
{
|
||||||
B32 has_byte_size = dw_tag_has_attrib(input, cu, tag, DW_AttribKind_ByteSize);
|
B32 has_byte_size = dw_tag_has_attrib(input, cu, tag, DW_AttribKind_ByteSize);
|
||||||
B32 has_bit_size = dw_tag_has_attrib(input, cu, tag, DW_AttribKind_BitSize );
|
B32 has_bit_size = dw_tag_has_attrib(input, cu, tag, DW_AttribKind_BitSize );
|
||||||
@@ -1953,7 +1833,7 @@ dw_try_byte_size_from_tag(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, U64 *byt
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal U64
|
internal U64
|
||||||
dw_byte_size_from_tag(DW_Input *input, DW_CompUnit *cu, DW_Tag tag)
|
dw_byte_size_from_tag(DW_Raw *input, DW_CompUnit *cu, DW_Tag tag)
|
||||||
{
|
{
|
||||||
U64 byte_size = max_U64;
|
U64 byte_size = max_U64;
|
||||||
dw_try_byte_size_from_tag(input, cu, tag, &byte_size);
|
dw_try_byte_size_from_tag(input, cu, tag, &byte_size);
|
||||||
@@ -1961,7 +1841,7 @@ dw_byte_size_from_tag(DW_Input *input, DW_CompUnit *cu, DW_Tag tag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal U32
|
internal U32
|
||||||
dw_byte_size_32_from_tag(DW_Input *input, DW_CompUnit *cu, DW_Tag tag)
|
dw_byte_size_32_from_tag(DW_Raw *input, DW_CompUnit *cu, DW_Tag tag)
|
||||||
{
|
{
|
||||||
U32 byte_size32 = 0;
|
U32 byte_size32 = 0;
|
||||||
U64 byte_size64;
|
U64 byte_size64;
|
||||||
@@ -1972,7 +1852,7 @@ dw_byte_size_32_from_tag(DW_Input *input, DW_CompUnit *cu, DW_Tag tag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal U64
|
internal U64
|
||||||
dw_u64_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
dw_u64_from_attrib(DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||||
{
|
{
|
||||||
U64 result = 0;
|
U64 result = 0;
|
||||||
DW_Attrib *attrib = dw_attrib_from_tag(input, cu, tag, kind);
|
DW_Attrib *attrib = dw_attrib_from_tag(input, cu, tag, kind);
|
||||||
@@ -2003,7 +1883,7 @@ dw_u64_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind k
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal DW_CompUnit
|
internal DW_CompUnit
|
||||||
dw_cu_from_info_off(Arena *arena, DW_Input *input, DW_ListUnitInput lu_input, U64 offset, B32 relaxed)
|
dw_cu_from_info_off(Arena *arena, DW_Raw *input, DW_ListUnitInput lu_input, U64 offset)
|
||||||
{
|
{
|
||||||
DW_CompUnit cu = {0};
|
DW_CompUnit cu = {0};
|
||||||
|
|
||||||
@@ -2011,7 +1891,7 @@ dw_cu_from_info_off(Arena *arena, DW_Input *input, DW_ListUnitInput lu_input, U6
|
|||||||
|
|
||||||
// read unit size in bytes
|
// read unit size in bytes
|
||||||
U64 length = 0;
|
U64 length = 0;
|
||||||
U64 length_size = str8_deserial_read_dwarf_packed_size(info_data, offset, &length);
|
U64 length_size = dw_str8_deserial_read_packed_size(info_data, offset, &length);
|
||||||
|
|
||||||
if (length_size) {
|
if (length_size) {
|
||||||
// compute unit range
|
// compute unit range
|
||||||
@@ -2058,7 +1938,7 @@ dw_cu_from_info_off(Arena *arena, DW_Input *input, DW_ListUnitInput lu_input, U6
|
|||||||
case DW_Version_3:
|
case DW_Version_3:
|
||||||
case DW_Version_4: {
|
case DW_Version_4: {
|
||||||
U64 abbrev_base_off = cursor;
|
U64 abbrev_base_off = cursor;
|
||||||
U64 abbrev_base_size = str8_deserial_read_dwarf_uint(data, abbrev_base_off, format, &abbrev_base);
|
U64 abbrev_base_size = dw_str8_deserial_read_fmt_uint(data, abbrev_base_off, format, &abbrev_base);
|
||||||
if (!abbrev_base_size) {
|
if (!abbrev_base_size) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2086,7 +1966,7 @@ dw_cu_from_info_off(Arena *arena, DW_Input *input, DW_ListUnitInput lu_input, U6
|
|||||||
}
|
}
|
||||||
|
|
||||||
U64 abbrev_base_off = address_size_off + address_size_size;
|
U64 abbrev_base_off = address_size_off + address_size_size;
|
||||||
U64 abbrev_base_size = str8_deserial_read_dwarf_uint(data, abbrev_base_off, format, &abbrev_base);
|
U64 abbrev_base_size = dw_str8_deserial_read_fmt_uint(data, abbrev_base_off, format, &abbrev_base);
|
||||||
if (!abbrev_base_size) {
|
if (!abbrev_base_size) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2209,7 +2089,7 @@ dw_tag_tree_from_data(Arena *arena, String8 info_data, String8 abbrev_data, DW_C
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal DW_TagTree
|
internal DW_TagTree
|
||||||
dw_tag_tree_from_cu(Arena *arena, DW_Input *input, DW_CompUnit *cu)
|
dw_tag_tree_from_cu(Arena *arena, DW_Raw *input, DW_CompUnit *cu)
|
||||||
{
|
{
|
||||||
String8 abbrev_data = input->sec[DW_Section_Abbrev].data;
|
String8 abbrev_data = input->sec[DW_Section_Abbrev].data;
|
||||||
String8 info_data = str8_substr(input->sec[DW_Section_Info].data, cu->info_range);
|
String8 info_data = str8_substr(input->sec[DW_Section_Info].data, cu->info_range);
|
||||||
@@ -2302,7 +2182,7 @@ dw_line_vm_file_array_from_list(Arena *arena, DW_LineVMFileList list)
|
|||||||
internal U64
|
internal U64
|
||||||
dw_read_line_file(String8 data,
|
dw_read_line_file(String8 data,
|
||||||
U64 off,
|
U64 off,
|
||||||
DW_Input *input,
|
DW_Raw *input,
|
||||||
DW_Version version,
|
DW_Version version,
|
||||||
DW_Format format,
|
DW_Format format,
|
||||||
DW_Ext ext,
|
DW_Ext ext,
|
||||||
@@ -2364,7 +2244,7 @@ internal U64
|
|||||||
dw_read_line_file_array(Arena *arena,
|
dw_read_line_file_array(Arena *arena,
|
||||||
String8 data,
|
String8 data,
|
||||||
U64 off,
|
U64 off,
|
||||||
DW_Input *input,
|
DW_Raw *input,
|
||||||
DW_Version version,
|
DW_Version version,
|
||||||
DW_Format format,
|
DW_Format format,
|
||||||
DW_Ext ext,
|
DW_Ext ext,
|
||||||
@@ -2412,7 +2292,7 @@ dw_read_line_file_array(Arena *arena,
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal U64
|
internal U64
|
||||||
dw_read_line_vm_header(Arena *arena, String8 line_data, U64 line_off, DW_Input *input, String8 cu_dir, String8 cu_name, U8 cu_address_size, DW_ListUnit *cu_str_offsets, DW_LineVMHeader *header_out)
|
dw_read_line_vm_header(Arena *arena, String8 line_data, U64 line_off, DW_Raw *input, String8 cu_dir, String8 cu_name, U8 cu_address_size, DW_ListUnit *cu_str_offsets, DW_LineVMHeader *header_out)
|
||||||
{
|
{
|
||||||
Temp scratch = scratch_begin(&arena, 1);
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
|
|
||||||
@@ -2420,7 +2300,7 @@ dw_read_line_vm_header(Arena *arena, String8 line_data, U64 line_off, DW_Input *
|
|||||||
|
|
||||||
// read unit length
|
// read unit length
|
||||||
U64 unit_length = 0;
|
U64 unit_length = 0;
|
||||||
U64 unit_length_size = str8_deserial_read_dwarf_packed_size(line_data, line_off, &unit_length);
|
U64 unit_length_size = dw_str8_deserial_read_packed_size(line_data, line_off, &unit_length);
|
||||||
|
|
||||||
U64 unit_opl = line_off + unit_length_size + unit_length;
|
U64 unit_opl = line_off + unit_length_size + unit_length;
|
||||||
Rng1U64 unit_range = rng_1u64(line_off, unit_opl);
|
Rng1U64 unit_range = rng_1u64(line_off, unit_opl);
|
||||||
@@ -2457,7 +2337,7 @@ dw_read_line_vm_header(Arena *arena, String8 line_data, U64 line_off, DW_Input *
|
|||||||
|
|
||||||
// read header length
|
// read header length
|
||||||
U64 header_length = 0;
|
U64 header_length = 0;
|
||||||
U64 header_length_size = str8_deserial_read_dwarf_uint(unit_data, unit_cursor, format, &header_length);
|
U64 header_length_size = dw_str8_deserial_read_fmt_uint(unit_data, unit_cursor, format, &header_length);
|
||||||
if (header_length_size == 0) {
|
if (header_length_size == 0) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
@@ -2611,12 +2491,11 @@ dw_read_line_vm_header(Arena *arena, String8 line_data, U64 line_off, DW_Input *
|
|||||||
unit_cursor += enc_count_size;
|
unit_cursor += enc_count_size;
|
||||||
|
|
||||||
// read table entry encodings
|
// read table entry encodings
|
||||||
U64 *enc_arr = 0;
|
U64 *enc_arr = push_array(scratch.arena, U64, enc_count*2);
|
||||||
U64 enc_arr_size = str8_deserial_read_uleb128_array(scratch.arena, unit_data, unit_cursor, enc_count*2, &enc_arr);
|
for EachIndex(idx, enc_count)
|
||||||
if (enc_arr_size == 0) {
|
{
|
||||||
goto exit;
|
unit_cursor += str8_deserial_read_uleb128(unit_data, unit_cursor, &enc_arr[idx]);
|
||||||
}
|
}
|
||||||
unit_cursor += enc_arr_size;
|
|
||||||
|
|
||||||
// read table count
|
// read table count
|
||||||
U64 table_count = 0;
|
U64 table_count = 0;
|
||||||
@@ -2657,12 +2536,11 @@ dw_read_line_vm_header(Arena *arena, String8 line_data, U64 line_off, DW_Input *
|
|||||||
unit_cursor += enc_count_size;
|
unit_cursor += enc_count_size;
|
||||||
|
|
||||||
// read table entry encodings
|
// read table entry encodings
|
||||||
U64 *enc_arr = 0;
|
U64 *enc_arr = push_array(scratch.arena, U64, enc_count*2);
|
||||||
U64 enc_arr_size = str8_deserial_read_uleb128_array(scratch.arena, unit_data, unit_cursor, enc_count*2, &enc_arr);
|
for EachIndex(idx, enc_count)
|
||||||
if (enc_arr_size == 0) {
|
{
|
||||||
goto exit;
|
unit_cursor += str8_deserial_read_uleb128(unit_data, unit_cursor, &enc_arr[idx]);
|
||||||
}
|
}
|
||||||
unit_cursor += enc_arr_size;
|
|
||||||
|
|
||||||
// read table count
|
// read table count
|
||||||
U64 table_count = 0;
|
U64 table_count = 0;
|
||||||
@@ -2808,7 +2686,7 @@ dw_path_from_file_idx(Arena *arena, DW_LineVMHeader *vm, U64 file_idx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal DW_LineTableParseResult
|
internal DW_LineTableParseResult
|
||||||
dw_parsed_line_table_from_data(Arena *arena, String8 unit_data, DW_Input *input, String8 cu_dir, String8 cu_name, U8 cu_address_size, DW_ListUnit *cu_str_offsets)
|
dw_parsed_line_table_from_data(Arena *arena, String8 unit_data, DW_Raw *input, String8 cu_dir, String8 cu_name, U8 cu_address_size, DW_ListUnit *cu_str_offsets)
|
||||||
{
|
{
|
||||||
DW_LineVMHeader vm_header = {0};
|
DW_LineVMHeader vm_header = {0};
|
||||||
U64 vm_header_size = dw_read_line_vm_header(arena, unit_data, 0, input, cu_dir, cu_name, cu_address_size, cu_str_offsets, &vm_header);
|
U64 vm_header_size = dw_read_line_vm_header(arena, unit_data, 0, input, cu_dir, cu_name, cu_address_size, cu_str_offsets, &vm_header);
|
||||||
@@ -3031,7 +2909,7 @@ dw_parsed_line_table_from_data(Arena *arena, String8 unit_data, DW_Input *input,
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal DW_PubStringsTable
|
internal DW_PubStringsTable
|
||||||
dw_v4_pub_strings_table_from_section_kind(Arena *arena, DW_Input *input, DW_SectionKind section_kind)
|
dw_v4_pub_strings_table_from_section_kind(Arena *arena, DW_Raw *input, DW_SectionKind section_kind)
|
||||||
{
|
{
|
||||||
Temp scratch = scratch_begin(&arena, 1);
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
|
|
||||||
@@ -3043,7 +2921,7 @@ dw_v4_pub_strings_table_from_section_kind(Arena *arena, DW_Input *input, DW_Sect
|
|||||||
for(U64 cursor = 0; cursor < section_data.size; ) {
|
for(U64 cursor = 0; cursor < section_data.size; ) {
|
||||||
|
|
||||||
U64 unit_length = 0;
|
U64 unit_length = 0;
|
||||||
U64 unit_length_size = str8_deserial_read_dwarf_packed_size(section_data, cursor, &unit_length);
|
U64 unit_length_size = dw_str8_deserial_read_packed_size(section_data, cursor, &unit_length);
|
||||||
if (unit_length_size == 0) {
|
if (unit_length_size == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3063,13 +2941,13 @@ dw_v4_pub_strings_table_from_section_kind(Arena *arena, DW_Input *input, DW_Sect
|
|||||||
DW_Format format = DW_FormatFromSize(unit_length);
|
DW_Format format = DW_FormatFromSize(unit_length);
|
||||||
|
|
||||||
U64 debug_info_off = 0;
|
U64 debug_info_off = 0;
|
||||||
cursor += str8_deserial_read_dwarf_uint(section_data, cursor, format, &debug_info_off);
|
cursor += dw_str8_deserial_read_fmt_uint(section_data, cursor, format, &debug_info_off);
|
||||||
if (cursor >= cursor_opl) {
|
if (cursor >= cursor_opl) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
U64 debug_info_length = 0;
|
U64 debug_info_length = 0;
|
||||||
cursor += str8_deserial_read_dwarf_packed_size(section_data, cursor, &debug_info_length);
|
cursor += dw_str8_deserial_read_packed_size(section_data, cursor, &debug_info_length);
|
||||||
if (cursor >= cursor_opl) {
|
if (cursor >= cursor_opl) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3077,7 +2955,7 @@ dw_v4_pub_strings_table_from_section_kind(Arena *arena, DW_Input *input, DW_Sect
|
|||||||
U64 off_size = dw_size_from_format(format);
|
U64 off_size = dw_size_from_format(format);
|
||||||
for (; (cursor + off_size) <= cursor_opl;) {
|
for (; (cursor + off_size) <= cursor_opl;) {
|
||||||
U64 info_off = 0;
|
U64 info_off = 0;
|
||||||
U64 info_off_size = str8_deserial_read_dwarf_uint(section_data, cursor, format, &info_off);
|
U64 info_off_size = dw_str8_deserial_read_fmt_uint(section_data, cursor, format, &info_off);
|
||||||
cursor += info_off_size;
|
cursor += info_off_size;
|
||||||
|
|
||||||
if (info_off_size == 0 || info_off == 0) {
|
if (info_off_size == 0 || info_off == 0) {
|
||||||
@@ -3213,11 +3091,11 @@ dw_expr_from_data(Arena *arena, DW_Format format, U64 addr_size, String8 data)
|
|||||||
cursor += str8_deserial_read_struct(data, cursor, &operands[0].u32);
|
cursor += str8_deserial_read_struct(data, cursor, &operands[0].u32);
|
||||||
} break;
|
} break;
|
||||||
case DW_ExprOp_CallRef: {
|
case DW_ExprOp_CallRef: {
|
||||||
cursor += str8_deserial_read_dwarf_uint(data, cursor, format, &operands[0].u64);
|
cursor += dw_str8_deserial_read_fmt_uint(data, cursor, format, &operands[0].u64);
|
||||||
} break;
|
} break;
|
||||||
case DW_ExprOp_ImplicitPointer:
|
case DW_ExprOp_ImplicitPointer:
|
||||||
case DW_ExprOp_GNU_ImplicitPointer: {
|
case DW_ExprOp_GNU_ImplicitPointer: {
|
||||||
cursor += str8_deserial_read_dwarf_uint(data, cursor, format, &operands[0].u64);
|
cursor += dw_str8_deserial_read_fmt_uint(data, cursor, format, &operands[0].u64);
|
||||||
cursor += str8_deserial_read_sleb128(data, cursor, &operands[1].s64);
|
cursor += str8_deserial_read_sleb128(data, cursor, &operands[1].s64);
|
||||||
} break;
|
} break;
|
||||||
case DW_ExprOp_Convert:
|
case DW_ExprOp_Convert:
|
||||||
@@ -3350,13 +3228,13 @@ dw_parse_descriptor_entry_header(String8 data, U64 off, DW_DescriptorEntry *desc
|
|||||||
DW_Format format = first_four_bytes == max_U32 ? DW_Format_64Bit : DW_Format_32Bit;
|
DW_Format format = first_four_bytes == max_U32 ? DW_Format_64Bit : DW_Format_32Bit;
|
||||||
|
|
||||||
U64 length = 0;
|
U64 length = 0;
|
||||||
U64 length_size = str8_deserial_read_dwarf_packed_size(data, off, &length);
|
U64 length_size = dw_str8_deserial_read_packed_size(data, off, &length);
|
||||||
if (length_size == 0) { goto exit; }
|
if (length_size == 0) { goto exit; }
|
||||||
|
|
||||||
Rng1U64 entry_range = rng_1u64(off, off + length_size + length);
|
Rng1U64 entry_range = rng_1u64(off, off + length_size + length);
|
||||||
String8 entry_data = str8_substr(data, entry_range);
|
String8 entry_data = str8_substr(data, entry_range);
|
||||||
U64 id = 0;
|
U64 id = 0;
|
||||||
U64 id_size = str8_deserial_read_dwarf_uint(entry_data, length_size, format, &id);
|
U64 id_size = dw_str8_deserial_read_fmt_uint(entry_data, length_size, format, &id);
|
||||||
if (id_size == 0) { goto exit; }
|
if (id_size == 0) { goto exit; }
|
||||||
|
|
||||||
U64 id_type = format == DW_Format_32Bit ? max_U32 : max_U64;
|
U64 id_type = format == DW_Format_32Bit ? max_U32 : max_U64;
|
||||||
@@ -3377,7 +3255,7 @@ dw_parse_cie(String8 data, DW_Format format, Arch arch, DW_CIE *cie_out)
|
|||||||
U64 cursor = format == DW_Format_32Bit ? 4 : 12;
|
U64 cursor = format == DW_Format_32Bit ? 4 : 12;
|
||||||
|
|
||||||
U64 cie_id = 0;
|
U64 cie_id = 0;
|
||||||
U64 cie_id_size = str8_deserial_read_dwarf_uint(data, cursor, format, &cie_id);
|
U64 cie_id_size = dw_str8_deserial_read_fmt_uint(data, cursor, format, &cie_id);
|
||||||
if (cie_id_size == 0) { goto exit; }
|
if (cie_id_size == 0) { goto exit; }
|
||||||
cursor += cie_id_size;
|
cursor += cie_id_size;
|
||||||
|
|
||||||
@@ -3447,7 +3325,7 @@ dw_parse_fde(String8 data, DW_Format format, DW_CIE *cie, DW_FDE *fde_out)
|
|||||||
|
|
||||||
// extract CIE pointer
|
// extract CIE pointer
|
||||||
U64 cie_pointer = 0;
|
U64 cie_pointer = 0;
|
||||||
U64 cie_pointer_size = str8_deserial_read_dwarf_uint(data, cursor, format, &cie_pointer);
|
U64 cie_pointer_size = dw_str8_deserial_read_fmt_uint(data, cursor, format, &cie_pointer);
|
||||||
if (cie_pointer_size == 0) { goto exit; }
|
if (cie_pointer_size == 0) { goto exit; }
|
||||||
cursor += cie_pointer_size;
|
cursor += cie_pointer_size;
|
||||||
|
|
||||||
@@ -3487,7 +3365,7 @@ dw_parse_cfi(String8 data, U64 fde_offset, Arch arch, DW_CIE *cie_out, DW_FDE *f
|
|||||||
if (fde_desc.type == DW_DescriptorEntryType_FDE) {
|
if (fde_desc.type == DW_DescriptorEntryType_FDE) {
|
||||||
U64 cie_pointer_off = fde_desc.format == DW_Format_32Bit ? 4 : 12;
|
U64 cie_pointer_off = fde_desc.format == DW_Format_32Bit ? 4 : 12;
|
||||||
U64 cie_pointer = 0;
|
U64 cie_pointer = 0;
|
||||||
U64 cie_pointer_size = str8_deserial_read_dwarf_uint(data, fde_offset + cie_pointer_off, fde_desc.format, &cie_pointer);
|
U64 cie_pointer_size = dw_str8_deserial_read_fmt_uint(data, fde_offset + cie_pointer_off, fde_desc.format, &cie_pointer);
|
||||||
if (cie_pointer_size) {
|
if (cie_pointer_size) {
|
||||||
DW_DescriptorEntry cie_desc = {0};
|
DW_DescriptorEntry cie_desc = {0};
|
||||||
dw_parse_descriptor_entry_header(data, cie_pointer, &cie_desc);
|
dw_parse_descriptor_entry_header(data, cie_pointer, &cie_desc);
|
||||||
|
|||||||
+49
-52
@@ -4,19 +4,20 @@
|
|||||||
#ifndef DWARF_PARSE_H
|
#ifndef DWARF_PARSE_H
|
||||||
#define DWARF_PARSE_H
|
#define DWARF_PARSE_H
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
//~ rjf: Raw DWARF Info Bundle
|
||||||
|
|
||||||
typedef struct DW_Section DW_Section;
|
typedef struct DW_Section DW_Section;
|
||||||
struct DW_Section
|
struct DW_Section
|
||||||
{
|
{
|
||||||
String8 name;
|
|
||||||
String8 data;
|
String8 data;
|
||||||
B32 is_dwo;
|
B32 is_dwo;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct DW_Input DW_Input;
|
typedef struct DW_Raw DW_Raw;
|
||||||
struct DW_Input
|
struct DW_Raw
|
||||||
{
|
{
|
||||||
DW_Section sec[DW_Section_Count];
|
DW_Section sec[DW_Section_Count];
|
||||||
DW_Section sup[DW_Section_Count];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct DW_ListUnit DW_ListUnit;
|
typedef struct DW_ListUnit DW_ListUnit;
|
||||||
@@ -449,12 +450,8 @@ typedef DW_DECODE_PTR(DW_DecodePtr);
|
|||||||
|
|
||||||
// deserial helpers
|
// deserial helpers
|
||||||
|
|
||||||
internal U64 str8_deserial_read_dwarf_packed_size(String8 string, U64 off, U64 *size_out);
|
internal U64 dw_str8_deserial_read_packed_size(String8 string, U64 off, U64 *size_out);
|
||||||
internal U64 str8_deserial_read_dwarf_uint (String8 string, U64 off, DW_Format format, U64 *uint_out);
|
internal U64 dw_str8_deserial_read_fmt_uint(String8 string, U64 off, DW_Format format, U64 *uint_out);
|
||||||
internal U64 str8_deserial_read_uleb128 (String8 string, U64 off, U64 *value_out);
|
|
||||||
internal U64 str8_deserial_read_sleb128 (String8 string, U64 off, S64 *value_out);
|
|
||||||
internal U64 str8_deserial_read_uleb128_array(Arena *arena, String8 string, U64 off, U64 count, U64 **arr_out);
|
|
||||||
internal U64 str8_deserial_read_sleb128_array(Arena *arena, String8 string, U64 off, U64 count, S64 **arr_out);
|
|
||||||
|
|
||||||
internal Rng1U64List dw_unit_ranges_from_data(Arena *arena, String8 data);
|
internal Rng1U64List dw_unit_ranges_from_data(Arena *arena, String8 data);
|
||||||
|
|
||||||
@@ -464,7 +461,7 @@ internal U64 dw_read_list_unit_header_addr (String8 unit_data, DW_ListUnit
|
|||||||
internal U64 dw_read_list_unit_header_str_offsets(String8 unit_data, DW_ListUnit *lu_out);
|
internal U64 dw_read_list_unit_header_str_offsets(String8 unit_data, DW_ListUnit *lu_out);
|
||||||
internal U64 dw_read_list_unit_header_list (String8 unit_data, DW_ListUnit *lu_out);
|
internal U64 dw_read_list_unit_header_list (String8 unit_data, DW_ListUnit *lu_out);
|
||||||
|
|
||||||
internal DW_ListUnitInput dw_list_unit_input_from_input(Arena *arena, DW_Input *input);
|
internal DW_ListUnitInput dw_list_unit_input_from_raw(Arena *arena, DW_Raw *input);
|
||||||
|
|
||||||
internal U64 dw_offset_from_list_unit(DW_ListUnit *lu, U64 index);
|
internal U64 dw_offset_from_list_unit(DW_ListUnit *lu, U64 index);
|
||||||
internal U64 dw_addr_from_list_unit (DW_ListUnit *lu, U64 index);
|
internal U64 dw_addr_from_list_unit (DW_ListUnit *lu, U64 index);
|
||||||
@@ -480,7 +477,7 @@ internal U64 dw_abbrev_offset_from_abbrev_id(DW_AbbrevTable table, U6
|
|||||||
|
|
||||||
internal U64 dw_read_form(String8 data, U64 off, DW_Version version, DW_Format unit_format, U64 address_size, DW_FormKind form_kind, U64 implicit_const, DW_Form *form_out);
|
internal U64 dw_read_form(String8 data, U64 off, DW_Version version, DW_Format unit_format, U64 address_size, DW_FormKind form_kind, U64 implicit_const, DW_Form *form_out);
|
||||||
internal U64 dw_read_tag (Arena *arena, String8 tag_data, U64 tag_off, U64 tag_base, DW_AbbrevTable abbrev_table, String8 abbrev_data, DW_Version version, DW_Format unit_format, U64 address_size, DW_Tag *tag_out);
|
internal U64 dw_read_tag (Arena *arena, String8 tag_data, U64 tag_off, U64 tag_base, DW_AbbrevTable abbrev_table, String8 abbrev_data, DW_Version version, DW_Format unit_format, U64 address_size, DW_Tag *tag_out);
|
||||||
internal U64 dw_read_tag_cu(Arena *arena, DW_Input *input, DW_CompUnit *cu, U64 info_off, DW_Tag *tag_out);
|
internal U64 dw_read_tag_cu(Arena *arena, DW_Raw *input, DW_CompUnit *cu, U64 info_off, DW_Tag *tag_out);
|
||||||
|
|
||||||
// attrib interp
|
// attrib interp
|
||||||
|
|
||||||
@@ -493,56 +490,56 @@ internal S64 dw_interp_const_s64 (DW_FormKind form_kind, DW_Form form)
|
|||||||
internal S32 dw_interp_const_s32 (DW_FormKind form_kind, DW_Form form);
|
internal S32 dw_interp_const_s32 (DW_FormKind form_kind, DW_Form form);
|
||||||
internal B32 dw_interp_flag (DW_FormKind form_kind, DW_Form form);
|
internal B32 dw_interp_flag (DW_FormKind form_kind, DW_Form form);
|
||||||
internal U64 dw_interp_address (U64 address_size, U64 base_addr, DW_ListUnit *addr_xlist, DW_FormKind form_kind, DW_Form form);
|
internal U64 dw_interp_address (U64 address_size, U64 base_addr, DW_ListUnit *addr_xlist, DW_FormKind form_kind, DW_Form form);
|
||||||
internal String8 dw_interp_block (DW_Input *input, DW_CompUnit *cu, DW_FormKind form_kind, DW_Form form);
|
internal String8 dw_interp_block (DW_Raw *input, DW_CompUnit *cu, DW_FormKind form_kind, DW_Form form);
|
||||||
internal String8 dw_interp_string (DW_Input *input, DW_Format unit_format, DW_ListUnit *str_offsets, DW_FormKind form_kind, DW_Form form);
|
internal String8 dw_interp_string (DW_Raw *input, DW_Format unit_format, DW_ListUnit *str_offsets, DW_FormKind form_kind, DW_Form form);
|
||||||
internal String8 dw_interp_line_ptr (DW_Input *input, DW_FormKind form_kind, DW_Form form);
|
internal String8 dw_interp_line_ptr (DW_Raw *input, DW_FormKind form_kind, DW_Form form);
|
||||||
internal DW_LineFile * dw_interp_file (DW_LineVMHeader *line_vm, DW_FormKind form_kind, DW_Form form);
|
internal DW_LineFile * dw_interp_file (DW_LineVMHeader *line_vm, DW_FormKind form_kind, DW_Form form);
|
||||||
internal DW_Reference dw_interp_ref (DW_Input *input, DW_CompUnit *cu, DW_FormKind form_kind, DW_Form form);
|
internal DW_Reference dw_interp_ref (DW_Raw *input, DW_CompUnit *cu, DW_FormKind form_kind, DW_Form form);
|
||||||
internal DW_LocList dw_interp_loclist (Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_FormKind form_kind, DW_Form form);
|
internal DW_LocList dw_interp_loclist (Arena *arena, DW_Raw *input, DW_CompUnit *cu, DW_FormKind form_kind, DW_Form form);
|
||||||
internal Rng1U64List dw_interp_rnglist (Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_FormKind form_kind, DW_Form form);
|
internal Rng1U64List dw_interp_rnglist (Arena *arena, DW_Raw *input, DW_CompUnit *cu, DW_FormKind form_kind, DW_Form form);
|
||||||
|
|
||||||
internal String8 dw_exprloc_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
internal String8 dw_exprloc_from_attrib (DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||||
internal U128 dw_const_u128_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
internal U128 dw_const_u128_from_attrib(DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||||
internal U64 dw_const_u64_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
internal U64 dw_const_u64_from_attrib (DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||||
internal U32 dw_const_u32_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
internal U32 dw_const_u32_from_attrib (DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||||
internal S64 dw_const_s64_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
internal S64 dw_const_s64_from_attrib (DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||||
internal S32 dw_const_s32_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
internal S32 dw_const_s32_from_attrib (DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||||
internal B32 dw_flag_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
internal B32 dw_flag_from_attrib (DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||||
internal U64 dw_address_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
internal U64 dw_address_from_attrib (DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||||
internal String8 dw_block_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
internal String8 dw_block_from_attrib (DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||||
internal String8 dw_string_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
internal String8 dw_string_from_attrib (DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||||
internal String8 dw_line_ptr_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
internal String8 dw_line_ptr_from_attrib (DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||||
internal DW_LineFile * dw_file_from_attrib (DW_CompUnit *cu, DW_LineVMHeader *line_vm, DW_Attrib *attrib);
|
internal DW_LineFile * dw_file_from_attrib (DW_CompUnit *cu, DW_LineVMHeader *line_vm, DW_Attrib *attrib);
|
||||||
internal DW_Reference dw_ref_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
internal DW_Reference dw_ref_from_attrib (DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||||
internal DW_LocList dw_loclist_from_attrib (Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
internal DW_LocList dw_loclist_from_attrib (Arena *arena, DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||||
internal Rng1U64List dw_rnglist_from_attrib (Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
internal Rng1U64List dw_rnglist_from_attrib (Arena *arena, DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||||
|
|
||||||
internal String8 dw_exprloc_from_tag_attrib_kind (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
internal String8 dw_exprloc_from_tag_attrib_kind (DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||||
internal U128 dw_const_u128_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
internal U128 dw_const_u128_from_tag_attrib_kind(DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||||
internal U64 dw_const_u64_from_tag_attrib_kind (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
internal U64 dw_const_u64_from_tag_attrib_kind (DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||||
internal U32 dw_const_u32_from_tag_attrib_kind (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
internal U32 dw_const_u32_from_tag_attrib_kind (DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||||
internal B32 dw_flag_from_tag_attrib_kind (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
internal B32 dw_flag_from_tag_attrib_kind (DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||||
internal U64 dw_address_from_tag_attrib_kind (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
internal U64 dw_address_from_tag_attrib_kind (DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||||
internal String8 dw_block_from_tag_attrib_kind (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
internal String8 dw_block_from_tag_attrib_kind (DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||||
internal String8 dw_string_from_tag_attrib_kind (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
internal String8 dw_string_from_tag_attrib_kind (DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||||
internal String8 dw_line_ptr_from_tag_attrib_kind (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
internal String8 dw_line_ptr_from_tag_attrib_kind (DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||||
internal String8 dw_line_ptr_from_tag_attrib_kind (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
internal String8 dw_line_ptr_from_tag_attrib_kind (DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||||
internal DW_LineFile * dw_file_from_tag_attrib_kind (DW_Input *input, DW_CompUnit *cu, DW_LineVMHeader *line_vm, DW_Tag tag, DW_AttribKind kind);
|
internal DW_LineFile * dw_file_from_tag_attrib_kind (DW_Raw *input, DW_CompUnit *cu, DW_LineVMHeader *line_vm, DW_Tag tag, DW_AttribKind kind);
|
||||||
internal DW_Reference dw_ref_from_tag_attrib_kind (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
internal DW_Reference dw_ref_from_tag_attrib_kind (DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||||
internal DW_LocList dw_loclist_from_tag_attrib_kind (Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
internal DW_LocList dw_loclist_from_tag_attrib_kind (Arena *arena, DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||||
internal Rng1U64List dw_rnglist_from_tag_attrib_kind (Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
internal Rng1U64List dw_rnglist_from_tag_attrib_kind (Arena *arena, DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||||
|
|
||||||
// compile unit
|
// compile unit
|
||||||
|
|
||||||
internal DW_CompUnit dw_cu_from_info_off(Arena *arena, DW_Input *input, DW_ListUnitInput lu_input, U64 offset, B32 relaxed);
|
internal DW_CompUnit dw_cu_from_info_off(Arena *arena, DW_Raw *input, DW_ListUnitInput lu_input, U64 offset);
|
||||||
internal DW_TagTree dw_tag_tree_from_cu(Arena *arena, DW_Input *input, DW_CompUnit *cu);
|
internal DW_TagTree dw_tag_tree_from_cu(Arena *arena, DW_Raw *input, DW_CompUnit *cu);
|
||||||
internal HashTable * dw_make_tag_hash_table(Arena *arena, DW_TagTree tag_tree);
|
internal HashTable * dw_make_tag_hash_table(Arena *arena, DW_TagTree tag_tree);
|
||||||
internal DW_TagNode * dw_tag_node_from_info_off(DW_CompUnit *cu, U64 info_off);
|
internal DW_TagNode * dw_tag_node_from_info_off(DW_CompUnit *cu, U64 info_off);
|
||||||
|
|
||||||
// line info
|
// line info
|
||||||
|
|
||||||
internal U64 dw_read_line_file(String8 line_data, U64 line_off, DW_Input *input, DW_Version unit_version, DW_Format unit_format, DW_Ext ext, U64 address_size, DW_ListUnit *str_offsets, U64 enc_count, U64 *enc_arr, DW_LineFile *line_file_out);
|
internal U64 dw_read_line_file(String8 line_data, U64 line_off, DW_Raw *input, DW_Version unit_version, DW_Format unit_format, DW_Ext ext, U64 address_size, DW_ListUnit *str_offsets, U64 enc_count, U64 *enc_arr, DW_LineFile *line_file_out);
|
||||||
internal U64 dw_read_line_vm_header(Arena *arena, String8 line_data, U64 line_off, DW_Input *input, String8 cu_dir, String8 cu_name, U8 cu_address_size, DW_ListUnit *cu_str_offsets, DW_LineVMHeader *header_out);
|
internal U64 dw_read_line_vm_header(Arena *arena, String8 line_data, U64 line_off, DW_Raw *input, String8 cu_dir, String8 cu_name, U8 cu_address_size, DW_ListUnit *cu_str_offsets, DW_LineVMHeader *header_out);
|
||||||
internal void dw_line_vm_reset(DW_LineVMState *state, B32 default_is_stmt);
|
internal void dw_line_vm_reset(DW_LineVMState *state, B32 default_is_stmt);
|
||||||
internal void dw_line_vm_advance(DW_LineVMState *state, U64 advance, U64 min_inst_len, U64 max_ops_for_inst);
|
internal void dw_line_vm_advance(DW_LineVMState *state, U64 advance, U64 min_inst_len, U64 max_ops_for_inst);
|
||||||
internal DW_LineSeqNode * dw_push_line_seq(Arena* arena, DW_LineTableParseResult *parsed_tbl);
|
internal DW_LineSeqNode * dw_push_line_seq(Arena* arena, DW_LineTableParseResult *parsed_tbl);
|
||||||
@@ -550,11 +547,11 @@ internal DW_LineNode * dw_push_line(Arena *arena, DW_LineTableParseResult *tb
|
|||||||
internal String8 dw_path_from_file(Arena *arena, DW_LineVMHeader *vm, DW_LineFile *file);
|
internal String8 dw_path_from_file(Arena *arena, DW_LineVMHeader *vm, DW_LineFile *file);
|
||||||
internal String8 dw_path_from_file_idx(Arena *arena, DW_LineVMHeader *vm, U64 file_idx);
|
internal String8 dw_path_from_file_idx(Arena *arena, DW_LineVMHeader *vm, U64 file_idx);
|
||||||
|
|
||||||
internal DW_LineTableParseResult dw_parsed_line_table_from_data(Arena *arena, String8 unit_data, DW_Input *input, String8 cu_dir, String8 cu_name, U8 cu_address_size, DW_ListUnit *cu_str_offsets);
|
internal DW_LineTableParseResult dw_parsed_line_table_from_data(Arena *arena, String8 unit_data, DW_Raw *input, String8 cu_dir, String8 cu_name, U8 cu_address_size, DW_ListUnit *cu_str_offsets);
|
||||||
|
|
||||||
// helper for .debug_pubtypes and .debug_pubnames
|
// helper for .debug_pubtypes and .debug_pubnames
|
||||||
|
|
||||||
internal DW_PubStringsTable dw_v4_pub_strings_table_from_section_kind(Arena *arena, DW_Input *input, DW_SectionKind section_kind);
|
internal DW_PubStringsTable dw_v4_pub_strings_table_from_section_kind(Arena *arena, DW_Raw *input, DW_SectionKind section_kind);
|
||||||
|
|
||||||
// expression
|
// expression
|
||||||
|
|
||||||
|
|||||||
+2
-3
@@ -8,8 +8,8 @@
|
|||||||
//~ Dump Subset Types
|
//~ Dump Subset Types
|
||||||
|
|
||||||
#define EH_DumpSubset_XList \
|
#define EH_DumpSubset_XList \
|
||||||
X(EhFrameHdr, eh_frame_hdr, ".eh_frame_hdr") \
|
X(EhFrameHdr, eh_frame_hdr, ".eh_frame_hdr") \
|
||||||
X(EhFrame, eh_frame, ".eh_frame")
|
X(EhFrame, eh_frame, ".eh_frame")
|
||||||
|
|
||||||
typedef enum EH_DumpSubset {
|
typedef enum EH_DumpSubset {
|
||||||
#define X(name, name_lower, title) EH_DumpSubset_##name,
|
#define X(name, name_lower, title) EH_DumpSubset_##name,
|
||||||
@@ -45,4 +45,3 @@ read_only global String8 eh_name_title_from_dump_subset_table[] =
|
|||||||
internal String8List eh_dump_list_from_data(Arena *arena, Arch arch, U64 eh_frame_hdr_vaddr, U64 eh_frame_vaddr, String8 eh_frame_hdr, String8 eh_frame, EH_DumpSubsetFlags subset_flags);
|
internal String8List eh_dump_list_from_data(Arena *arena, Arch arch, U64 eh_frame_hdr_vaddr, U64 eh_frame_vaddr, String8 eh_frame_hdr, String8 eh_frame, EH_DumpSubsetFlags subset_flags);
|
||||||
|
|
||||||
#endif // EH_FRAME_DUMP_H
|
#endif // EH_FRAME_DUMP_H
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ eh_parse_frame_hdr(String8 data, U64 address_size, EH_PtrCtx *ptr_ctx)
|
|||||||
Assert(0 && "unknown version");
|
Assert(0 && "unknown version");
|
||||||
}
|
}
|
||||||
|
|
||||||
exit:;
|
exit:;
|
||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ eh_parse_aug_data(String8 aug_string, String8 aug_data, U64 pc, EH_PtrCtx *ptr_c
|
|||||||
aug_out->size = aug_data_size;
|
aug_out->size = aug_data_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
exit:;
|
exit:;
|
||||||
U64 parse_size = cursor;
|
U64 parse_size = cursor;
|
||||||
return parse_size;
|
return parse_size;
|
||||||
}
|
}
|
||||||
@@ -187,13 +187,13 @@ eh_parse_descriptor_entry_header(String8 data, U64 off, DW_DescriptorEntry *desc
|
|||||||
DW_Format format = first_four_bytes == max_U32 ? DW_Format_64Bit : DW_Format_32Bit;
|
DW_Format format = first_four_bytes == max_U32 ? DW_Format_64Bit : DW_Format_32Bit;
|
||||||
|
|
||||||
U64 length = 0;
|
U64 length = 0;
|
||||||
U64 length_size = str8_deserial_read_dwarf_packed_size(data, off, &length);
|
U64 length_size = dw_str8_deserial_read_packed_size(data, off, &length);
|
||||||
if (length_size == 0) { goto exit; }
|
if (length_size == 0) { goto exit; }
|
||||||
|
|
||||||
Rng1U64 entry_range = rng_1u64(off, off + length_size + length);
|
Rng1U64 entry_range = rng_1u64(off, off + length_size + length);
|
||||||
String8 entry_data = str8_substr(data, entry_range);
|
String8 entry_data = str8_substr(data, entry_range);
|
||||||
U64 id = 0;
|
U64 id = 0;
|
||||||
U64 id_size = str8_deserial_read_dwarf_uint(entry_data, length_size, format, &id);
|
U64 id_size = dw_str8_deserial_read_fmt_uint(entry_data, length_size, format, &id);
|
||||||
if (id_size == 0) { goto exit; }
|
if (id_size == 0) { goto exit; }
|
||||||
|
|
||||||
desc_out->format = format;
|
desc_out->format = format;
|
||||||
@@ -202,7 +202,7 @@ eh_parse_descriptor_entry_header(String8 data, U64 off, DW_DescriptorEntry *desc
|
|||||||
desc_out->cie_pointer = id;
|
desc_out->cie_pointer = id;
|
||||||
desc_out->cie_pointer_off = off + length_size;
|
desc_out->cie_pointer_off = off + length_size;
|
||||||
|
|
||||||
exit:;
|
exit:;
|
||||||
return length + length_size;
|
return length + length_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,7 +213,7 @@ eh_parse_cie(String8 data, DW_Format format, Arch arch, U64 pc, EH_PtrCtx *ptr_c
|
|||||||
U64 cursor = format == DW_Format_32Bit ? 4 : 12;
|
U64 cursor = format == DW_Format_32Bit ? 4 : 12;
|
||||||
|
|
||||||
U64 cie_id = 0;
|
U64 cie_id = 0;
|
||||||
U64 cie_id_size = str8_deserial_read_dwarf_uint(data, cursor, format, &cie_id);
|
U64 cie_id_size = dw_str8_deserial_read_fmt_uint(data, cursor, format, &cie_id);
|
||||||
if (cie_id_size == 0) { goto exit; }
|
if (cie_id_size == 0) { goto exit; }
|
||||||
cursor += cie_id_size;
|
cursor += cie_id_size;
|
||||||
|
|
||||||
@@ -286,7 +286,7 @@ eh_parse_cie(String8 data, DW_Format format, Arch arch, U64 pc, EH_PtrCtx *ptr_c
|
|||||||
}
|
}
|
||||||
|
|
||||||
is_parsed = 1;
|
is_parsed = 1;
|
||||||
exit:;
|
exit:;
|
||||||
return is_parsed;
|
return is_parsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,7 +317,7 @@ eh_parse_fde(String8 data, DW_Format format, U64 pc, DW_CIE *cie, EH_PtrCtx *ptr
|
|||||||
fde_out->insts = str8_skip(data, cursor);
|
fde_out->insts = str8_skip(data, cursor);
|
||||||
|
|
||||||
is_parsed = 1;
|
is_parsed = 1;
|
||||||
exit:;
|
exit:;
|
||||||
return is_parsed;
|
return is_parsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,7 +371,7 @@ eh_find_nearest_fde(EH_FrameHdr header, EH_PtrCtx *ptr_ctx, U64 pc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exit:;
|
exit:;
|
||||||
if (fde_idx < header.fde_count) {
|
if (fde_idx < header.fde_count) {
|
||||||
U64 fde_addr_off = (fde_idx * header.entry_byte_size) + header.field_byte_size;
|
U64 fde_addr_off = (fde_idx * header.entry_byte_size) + header.field_byte_size;
|
||||||
U64 fde_addr_size = eh_parse_ptr(header.table, fde_addr_off, ptr_ctx->pc_vaddr + fde_addr_off, ptr_ctx, header.table_enc, &fde_addr);
|
U64 fde_addr_size = eh_parse_ptr(header.table, fde_addr_off, ptr_ctx->pc_vaddr + fde_addr_off, ptr_ctx, header.table_enc, &fde_addr);
|
||||||
|
|||||||
@@ -123,4 +123,3 @@ internal String8 eh_string_from_ptr_enc_modifier(EH_PtrEnc modifier);
|
|||||||
internal String8 eh_string_from_ptr_enc(Arena *arena, EH_PtrEnc enc);
|
internal String8 eh_string_from_ptr_enc(Arena *arena, EH_PtrEnc enc);
|
||||||
|
|
||||||
#endif // EH_FRAME_H
|
#endif // EH_FRAME_H
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1099,7 +1099,7 @@ rb_thread_entry_point(void *p)
|
|||||||
Arch arch = Arch_Null;
|
Arch arch = Arch_Null;
|
||||||
PE_BinInfo pe = {0};
|
PE_BinInfo pe = {0};
|
||||||
ELF_Bin elf = {0};
|
ELF_Bin elf = {0};
|
||||||
DW_Input dw = {0};
|
DW_Raw dw = {0};
|
||||||
U64 eh_frame_hdr_vaddr = 0;
|
U64 eh_frame_hdr_vaddr = 0;
|
||||||
U64 eh_frame_vaddr = 0;
|
U64 eh_frame_vaddr = 0;
|
||||||
String8 eh_frame_hdr = {0};
|
String8 eh_frame_hdr = {0};
|
||||||
@@ -1141,12 +1141,12 @@ rb_thread_entry_point(void *p)
|
|||||||
U64 section_count = raw_sections.size / sizeof(COFF_SectionHeader);
|
U64 section_count = raw_sections.size / sizeof(COFF_SectionHeader);
|
||||||
COFF_SectionHeader *section_table = (COFF_SectionHeader *)raw_sections.str;
|
COFF_SectionHeader *section_table = (COFF_SectionHeader *)raw_sections.str;
|
||||||
String8 string_table = str8_substr(f->data, pe.string_table_range);
|
String8 string_table = str8_substr(f->data, pe.string_table_range);
|
||||||
dw = dw_input_from_coff_section_table(arena, f->data, string_table, section_count, section_table);
|
dw = dw_raw_from_coff_section_table(arena, f->data, string_table, section_count, section_table);
|
||||||
}
|
}
|
||||||
else if(f->format == RB_FileFormat_ELF32 ||
|
else if(f->format == RB_FileFormat_ELF32 ||
|
||||||
f->format == RB_FileFormat_ELF64)
|
f->format == RB_FileFormat_ELF64)
|
||||||
{
|
{
|
||||||
dw = dw_input_from_elf_bin(arena, f->data, &elf);
|
dw = dw_raw_from_elf_bin(arena, f->data, &elf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4064,7 +4064,7 @@ pe_print(Arena *arena, String8List *out, String8 indent, String8 raw_data, RD_Op
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (opts & RD_Option_Dwarf) {
|
if (opts & RD_Option_Dwarf) {
|
||||||
DW_Input dwarf_input = dw_input_from_coff_section_table(scratch.arena, raw_data, raw_string_table, file_header->section_count, sections);
|
DW_Raw dwarf_input = dw_raw_from_coff_section_table(scratch.arena, raw_data, raw_string_table, file_header->section_count, sections);
|
||||||
dw_format(arena, out, indent, opts, &dwarf_input, arch, ExecutableImageKind_CoffPe);
|
dw_format(arena, out, indent, opts, &dwarf_input, arch, ExecutableImageKind_CoffPe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4080,12 +4080,12 @@ elf_print_dwarf_expressions(Arena *arena, String8List *out, String8 indent, Stri
|
|||||||
|
|
||||||
ELF_Bin bin = elf_bin_from_data(raw_data);
|
ELF_Bin bin = elf_bin_from_data(raw_data);
|
||||||
Arch arch = arch_from_elf_machine(bin.hdr.e_machine);
|
Arch arch = arch_from_elf_machine(bin.hdr.e_machine);
|
||||||
DW_Input dwarf_input = dw_input_from_elf_bin(scratch.arena, raw_data, &bin);
|
DW_Raw dwarf_input = dw_raw_from_elf_bin(scratch.arena, raw_data, &bin);
|
||||||
ELF_Class elf_class = bin.hdr.e_ident[ELF_Identifier_Class];
|
ELF_Class elf_class = bin.hdr.e_ident[ELF_Identifier_Class];
|
||||||
ExecutableImageKind image_type = elf_class == ELF_Class_32 ? ExecutableImageKind_Elf32 : elf_class == ELF_Class_64 ? ExecutableImageKind_Elf64 : ELF_Class_None;
|
ExecutableImageKind image_type = elf_class == ELF_Class_32 ? ExecutableImageKind_Elf32 : elf_class == ELF_Class_64 ? ExecutableImageKind_Elf64 : ELF_Class_None;
|
||||||
B32 relaxed = 1;
|
B32 relaxed = 1;
|
||||||
Rng1U64List cu_ranges = dw_unit_ranges_from_data(scratch.arena, dwarf_input.sec[DW_Section_Info].data);
|
Rng1U64List cu_ranges = dw_unit_ranges_from_data(scratch.arena, dwarf_input.sec[DW_Section_Info].data);
|
||||||
DW_ListUnitInput lu_input = dw_list_unit_input_from_input(scratch.arena, &dwarf_input);
|
DW_ListUnitInput lu_input = dw_list_unit_input_from_raw(scratch.arena, &dwarf_input);
|
||||||
|
|
||||||
if (bin.hdr.e_type == ELF_Type_Exec || bin.hdr.e_type == ELF_Type_Dyn) {
|
if (bin.hdr.e_type == ELF_Type_Exec || bin.hdr.e_type == ELF_Type_Dyn) {
|
||||||
U64 cu_idx = 0;
|
U64 cu_idx = 0;
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ d2r_type_from_offset(D2R_TypeTable *type_table, U64 info_off)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal RDIM_Type *
|
internal RDIM_Type *
|
||||||
d2r_type_from_attrib(D2R_TypeTable *type_table, DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
d2r_type_from_attrib(D2R_TypeTable *type_table, DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||||
{
|
{
|
||||||
RDIM_Type *type = type_table->builtin_types[RDI_TypeKind_Void];
|
RDIM_Type *type = type_table->builtin_types[RDI_TypeKind_Void];
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ d2r_type_from_attrib(D2R_TypeTable *type_table, DW_Input *input, DW_CompUnit *cu
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal Rng1U64List
|
internal Rng1U64List
|
||||||
d2r_range_list_from_tag(Arena *arena, DW_Input *input, DW_CompUnit *cu, U64 image_base, DW_Tag tag)
|
d2r_range_list_from_tag(Arena *arena, DW_Raw *input, DW_CompUnit *cu, U64 image_base, DW_Tag tag)
|
||||||
{
|
{
|
||||||
// collect non-contiguous range
|
// collect non-contiguous range
|
||||||
Rng1U64List raw_ranges = dw_rnglist_from_tag_attrib_kind(arena, input, cu, tag, DW_AttribKind_Ranges);
|
Rng1U64List raw_ranges = dw_rnglist_from_tag_attrib_kind(arena, input, cu, tag, DW_AttribKind_Ranges);
|
||||||
@@ -223,7 +223,7 @@ d2r_range_list_from_tag(Arena *arena, DW_Input *input, DW_CompUnit *cu, U64 imag
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal RDIM_Type **
|
internal RDIM_Type **
|
||||||
d2r_collect_proc_params(Arena *arena, D2R_TypeTable *type_table, DW_Input *input, DW_CompUnit *cu, DW_TagNode *cur_node, U64 *param_count_out)
|
d2r_collect_proc_params(Arena *arena, D2R_TypeTable *type_table, DW_Raw *input, DW_CompUnit *cu, DW_TagNode *cur_node, U64 *param_count_out)
|
||||||
{
|
{
|
||||||
Temp scratch = scratch_begin(&arena, 1);
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
|
|
||||||
@@ -892,7 +892,7 @@ d2r_push_relational_op(Arena *arena, D2R_ValueTypeStack *stack, RDIM_EvalBytecod
|
|||||||
|
|
||||||
internal RDIM_EvalBytecode
|
internal RDIM_EvalBytecode
|
||||||
d2r_bytecode_from_expression(Arena *arena,
|
d2r_bytecode_from_expression(Arena *arena,
|
||||||
DW_Input *input,
|
DW_Raw *input,
|
||||||
U64 image_base,
|
U64 image_base,
|
||||||
U64 address_size,
|
U64 address_size,
|
||||||
Arch arch,
|
Arch arch,
|
||||||
@@ -1438,7 +1438,7 @@ d2r_bytecode_from_expression(Arena *arena,
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal RDIM_Location *
|
internal RDIM_Location *
|
||||||
d2r_transpile_expression(Arena *arena, RDIM_LocationChunkList *locations, DW_Input *input, U64 image_base, U64 address_size, Arch arch, DW_ListUnit *addr_lu, DW_CompUnit *cu, String8 expr)
|
d2r_transpile_expression(Arena *arena, RDIM_LocationChunkList *locations, DW_Raw *input, U64 image_base, U64 address_size, Arch arch, DW_ListUnit *addr_lu, DW_CompUnit *cu, String8 expr)
|
||||||
{
|
{
|
||||||
RDIM_Location *loc = 0;
|
RDIM_Location *loc = 0;
|
||||||
if (expr.size) {
|
if (expr.size) {
|
||||||
@@ -1459,7 +1459,7 @@ d2r_locset_from_attrib(Arena *arena,
|
|||||||
RDIM_ScopeChunkList *scopes,
|
RDIM_ScopeChunkList *scopes,
|
||||||
RDIM_Scope *curr_scope,
|
RDIM_Scope *curr_scope,
|
||||||
RDIM_LocationChunkList *locations,
|
RDIM_LocationChunkList *locations,
|
||||||
DW_Input *input,
|
DW_Raw *input,
|
||||||
DW_CompUnit *cu,
|
DW_CompUnit *cu,
|
||||||
U64 image_base,
|
U64 image_base,
|
||||||
Arch arch,
|
Arch arch,
|
||||||
@@ -1507,7 +1507,7 @@ d2r_var_locset_from_tag(Arena *arena,
|
|||||||
RDIM_ScopeChunkList *scopes,
|
RDIM_ScopeChunkList *scopes,
|
||||||
RDIM_Scope *curr_scope,
|
RDIM_Scope *curr_scope,
|
||||||
RDIM_LocationChunkList *locations,
|
RDIM_LocationChunkList *locations,
|
||||||
DW_Input *input,
|
DW_Raw *input,
|
||||||
DW_CompUnit *cu,
|
DW_CompUnit *cu,
|
||||||
U64 image_base,
|
U64 image_base,
|
||||||
Arch arch,
|
Arch arch,
|
||||||
@@ -1687,7 +1687,7 @@ d2r_is_tag_converted(DW_TagNode *tag_node)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal RDIM_Type *
|
internal RDIM_Type *
|
||||||
d2r_find_or_convert_type(Arena *arena, D2R_TypeTable *type_table, DW_Input *input, DW_CompUnit *cu, DW_Language cu_lang, U64 arch_addr_size, DW_Tag tag, DW_AttribKind kind)
|
d2r_find_or_convert_type(Arena *arena, D2R_TypeTable *type_table, DW_Raw *input, DW_CompUnit *cu, DW_Language cu_lang, U64 arch_addr_size, DW_Tag tag, DW_AttribKind kind)
|
||||||
{
|
{
|
||||||
RDIM_Type *type = type_table->builtin_types[RDI_TypeKind_Void];
|
RDIM_Type *type = type_table->builtin_types[RDI_TypeKind_Void];
|
||||||
|
|
||||||
@@ -1730,7 +1730,7 @@ d2r_find_or_convert_type(Arena *arena, D2R_TypeTable *type_table, DW_Input *inpu
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
d2r_convert_types(Arena *arena, D2R_TypeTable *type_table, DW_Input *input, DW_CompUnit *cu, DW_Language cu_lang, U64 arch_addr_size, DW_TagNode *root)
|
d2r_convert_types(Arena *arena, D2R_TypeTable *type_table, DW_Raw *input, DW_CompUnit *cu, DW_Language cu_lang, U64 arch_addr_size, DW_TagNode *root)
|
||||||
{
|
{
|
||||||
Temp scratch = scratch_begin(&arena, 1);
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
for(D2R_TagIter *it = d2r_tag_iter_init(scratch.arena, root);
|
for(D2R_TagIter *it = d2r_tag_iter_init(scratch.arena, root);
|
||||||
@@ -2146,7 +2146,7 @@ d2r_convert_types(Arena *arena, D2R_TypeTable *type_table, DW_Input *input, DW_C
|
|||||||
internal void
|
internal void
|
||||||
d2r_convert_udts(Arena *arena,
|
d2r_convert_udts(Arena *arena,
|
||||||
D2R_TypeTable *type_table,
|
D2R_TypeTable *type_table,
|
||||||
DW_Input *input,
|
DW_Raw *input,
|
||||||
DW_CompUnit *cu,
|
DW_CompUnit *cu,
|
||||||
DW_Language cu_lang,
|
DW_Language cu_lang,
|
||||||
U64 arch_addr_size,
|
U64 arch_addr_size,
|
||||||
@@ -2245,7 +2245,7 @@ d2r_convert_udts(Arena *arena,
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
d2r_convert_symbols(Arena *arena, D2R_TypeTable *type_table, DW_Input *input, DW_CompUnit *cu, DW_Language cu_lang, U64 arch_addr_size, U64 image_base, Arch arch, DW_TagNode *root)
|
d2r_convert_symbols(Arena *arena, D2R_TypeTable *type_table, DW_Raw *input, DW_CompUnit *cu, DW_Language cu_lang, U64 arch_addr_size, U64 image_base, Arch arch, DW_TagNode *root)
|
||||||
{
|
{
|
||||||
Temp scratch = scratch_begin(&arena, 1);
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
for(D2R_TagIter *it = d2r_tag_iter_init(scratch.arena, root);
|
for(D2R_TagIter *it = d2r_tag_iter_init(scratch.arena, root);
|
||||||
@@ -2543,7 +2543,7 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
|
|||||||
//
|
//
|
||||||
Arch arch = Arch_Null;
|
Arch arch = Arch_Null;
|
||||||
U64 image_base = 0;
|
U64 image_base = 0;
|
||||||
DW_Input input = {0};
|
DW_Raw input = {0};
|
||||||
PathStyle path_style = PathStyle_Null;
|
PathStyle path_style = PathStyle_Null;
|
||||||
switch(params->exe_kind)
|
switch(params->exe_kind)
|
||||||
{
|
{
|
||||||
@@ -2557,7 +2557,7 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
|
|||||||
arch = pe.arch;
|
arch = pe.arch;
|
||||||
image_base = pe.image_base;
|
image_base = pe.image_base;
|
||||||
binary_sections = c2r_rdi_binary_sections_from_coff_sections(arena, params->exe_data, string_table, pe.section_count, section_table);
|
binary_sections = c2r_rdi_binary_sections_from_coff_sections(arena, params->exe_data, string_table, pe.section_count, section_table);
|
||||||
input = dw_input_from_coff_section_table(scratch.arena, params->exe_data, string_table, pe.section_count, section_table);
|
input = dw_raw_from_coff_section_table(scratch.arena, params->exe_data, string_table, pe.section_count, section_table);
|
||||||
path_style = PathStyle_WindowsAbsolute;
|
path_style = PathStyle_WindowsAbsolute;
|
||||||
}break;
|
}break;
|
||||||
case ExecutableImageKind_Elf32:
|
case ExecutableImageKind_Elf32:
|
||||||
@@ -2567,7 +2567,7 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
|
|||||||
arch = arch_from_elf_machine(bin.hdr.e_machine);
|
arch = arch_from_elf_machine(bin.hdr.e_machine);
|
||||||
image_base = (bin.hdr.e_type == ELF_Type_Dyn ? 0 : elf_base_addr_from_bin(&bin));
|
image_base = (bin.hdr.e_type == ELF_Type_Dyn ? 0 : elf_base_addr_from_bin(&bin));
|
||||||
binary_sections = e2r_rdi_binary_sections_from_elf_section_table(arena, params->dbg_data, &bin, bin.shdrs);
|
binary_sections = e2r_rdi_binary_sections_from_elf_section_table(arena, params->dbg_data, &bin, bin.shdrs);
|
||||||
input = dw_input_from_elf_bin(scratch.arena, params->dbg_data, &bin);
|
input = dw_raw_from_elf_bin(scratch.arena, params->dbg_data, &bin);
|
||||||
path_style = PathStyle_UnixAbsolute;
|
path_style = PathStyle_UnixAbsolute;
|
||||||
}break;
|
}break;
|
||||||
}
|
}
|
||||||
@@ -2593,7 +2593,7 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
//- rjf: unpack input image info
|
//- rjf: convert top-level-info
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
// rjf: base arch -> rdi
|
// rjf: base arch -> rdi
|
||||||
@@ -2655,7 +2655,7 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
|
|||||||
|
|
||||||
//- rjf: read unit data length
|
//- rjf: read unit data length
|
||||||
U64 unit_length = 0;
|
U64 unit_length = 0;
|
||||||
U64 unit_length_size = str8_deserial_read_dwarf_packed_size(unit_data, unit_cursor, &unit_length);
|
U64 unit_length_size = dw_str8_deserial_read_packed_size(unit_data, unit_cursor, &unit_length);
|
||||||
B32 unit_length_good = (unit_length_size != 0);
|
B32 unit_length_good = (unit_length_size != 0);
|
||||||
unit_cursor += unit_length_size;
|
unit_cursor += unit_length_size;
|
||||||
DW_Format unit_format = DW_FormatFromSize(unit_length);
|
DW_Format unit_format = DW_FormatFromSize(unit_length);
|
||||||
@@ -2684,7 +2684,7 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
|
|||||||
U8 unit_segment_selector_size = 0;
|
U8 unit_segment_selector_size = 0;
|
||||||
B32 unit_good = 0;
|
B32 unit_good = 0;
|
||||||
{
|
{
|
||||||
U64 unit_info_off_size = str8_deserial_read_dwarf_uint(unit_data, unit_cursor, unit_format, &unit_info_off);
|
U64 unit_info_off_size = dw_str8_deserial_read_fmt_uint(unit_data, unit_cursor, unit_format, &unit_info_off);
|
||||||
unit_cursor += unit_info_off_size;
|
unit_cursor += unit_info_off_size;
|
||||||
U64 unit_address_size_size = str8_deserial_read_struct(unit_data, unit_cursor, &unit_address_size);
|
U64 unit_address_size_size = str8_deserial_read_struct(unit_data, unit_cursor, &unit_address_size);
|
||||||
unit_cursor += unit_address_size_size;
|
unit_cursor += unit_address_size_size;
|
||||||
@@ -2756,7 +2756,7 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
|
|||||||
DW_ListUnitInput lu_input = {0};
|
DW_ListUnitInput lu_input = {0};
|
||||||
ProfScope("parse list of comp units")
|
ProfScope("parse list of comp units")
|
||||||
{
|
{
|
||||||
lu_input = dw_list_unit_input_from_input(scratch.arena, &input);
|
lu_input = dw_list_unit_input_from_raw(scratch.arena, &input);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
@@ -2775,14 +2775,10 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
|
|||||||
DW_CompUnit *cu_arr = 0;
|
DW_CompUnit *cu_arr = 0;
|
||||||
ProfScope("parse comp unit headers")
|
ProfScope("parse comp unit headers")
|
||||||
{
|
{
|
||||||
// TODO(rjf): parse should always be relaxed. any verification checks we do
|
|
||||||
// should just be logged via log_info(...), and then the caller of this
|
|
||||||
// converter can collect those & display as necessary.
|
|
||||||
B32 is_parse_relaxed = 1;
|
|
||||||
cu_arr = push_array(scratch.arena, DW_CompUnit, cu_ranges.count);
|
cu_arr = push_array(scratch.arena, DW_CompUnit, cu_ranges.count);
|
||||||
for EachIndex(cu_idx, cu_ranges.count)
|
for EachIndex(cu_idx, cu_ranges.count)
|
||||||
{
|
{
|
||||||
cu_arr[cu_idx] = dw_cu_from_info_off(scratch.arena, &input, lu_input, cu_ranges.v[cu_idx].min, is_parse_relaxed);
|
cu_arr[cu_idx] = dw_cu_from_info_off(scratch.arena, &input, lu_input, cu_ranges.v[cu_idx].min);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,9 +113,9 @@ internal RDI_RegCode d2r_rdi_reg_code_from_dw_reg(Arch arch, DW_Reg v);
|
|||||||
internal RDIM_Type * d2r_create_type(Arena *arena, D2R_TypeTable *type_table);
|
internal RDIM_Type * d2r_create_type(Arena *arena, D2R_TypeTable *type_table);
|
||||||
internal RDIM_Type * d2r_create_type_from_offset(Arena *arena, D2R_TypeTable *type_table, U64 info_off);
|
internal RDIM_Type * d2r_create_type_from_offset(Arena *arena, D2R_TypeTable *type_table, U64 info_off);
|
||||||
internal RDIM_Type * d2r_type_from_offset(D2R_TypeTable *type_table, U64 info_off);
|
internal RDIM_Type * d2r_type_from_offset(D2R_TypeTable *type_table, U64 info_off);
|
||||||
internal RDIM_Type * d2r_type_from_attrib(D2R_TypeTable *type_table, DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
internal RDIM_Type * d2r_type_from_attrib(D2R_TypeTable *type_table, DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||||
internal Rng1U64List d2r_range_list_from_tag(Arena *arena, DW_Input *input, DW_CompUnit *cu, U64 image_base, DW_Tag tag);
|
internal Rng1U64List d2r_range_list_from_tag(Arena *arena, DW_Raw *input, DW_CompUnit *cu, U64 image_base, DW_Tag tag);
|
||||||
internal RDIM_Type ** d2r_collect_proc_params(Arena *arena, D2R_TypeTable *type_table, DW_Input *input, DW_CompUnit *cu, DW_TagNode *cur_node, U64 *param_count_out);
|
internal RDIM_Type ** d2r_collect_proc_params(Arena *arena, D2R_TypeTable *type_table, DW_Raw *input, DW_CompUnit *cu, DW_TagNode *cur_node, U64 *param_count_out);
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ RDIM Bytecode Helpers
|
//~ RDIM Bytecode Helpers
|
||||||
@@ -141,10 +141,10 @@ internal D2R_ValueType d2r_apply_usual_arithmetic_conversions(Arena *arena, D2R_
|
|||||||
internal void d2r_push_arithmetic_op(Arena *arena, D2R_ValueTypeStack *stack, RDIM_EvalBytecode *bc, RDI_EvalOp op);
|
internal void d2r_push_arithmetic_op(Arena *arena, D2R_ValueTypeStack *stack, RDIM_EvalBytecode *bc, RDI_EvalOp op);
|
||||||
internal void d2r_push_relational_op(Arena *arena, D2R_ValueTypeStack *stack, RDIM_EvalBytecode *bc, RDI_EvalOp op);
|
internal void d2r_push_relational_op(Arena *arena, D2R_ValueTypeStack *stack, RDIM_EvalBytecode *bc, RDI_EvalOp op);
|
||||||
|
|
||||||
internal RDIM_EvalBytecode d2r_bytecode_from_expression(Arena *arena, DW_Input *input, U64 image_base, U64 address_size, Arch arch, DW_ListUnit *addr_lu, String8 expr, DW_CompUnit *cu, D2R_ValueType *result_type_out);
|
internal RDIM_EvalBytecode d2r_bytecode_from_expression(Arena *arena, DW_Raw *input, U64 image_base, U64 address_size, Arch arch, DW_ListUnit *addr_lu, String8 expr, DW_CompUnit *cu, D2R_ValueType *result_type_out);
|
||||||
internal RDIM_Location * d2r_transpile_expression(Arena *arena, RDIM_LocationChunkList *locations, DW_Input *input, U64 image_base, U64 address_size, Arch arch, DW_ListUnit *addr_lu, DW_CompUnit *cu, String8 expr);
|
internal RDIM_Location * d2r_transpile_expression(Arena *arena, RDIM_LocationChunkList *locations, DW_Raw *input, U64 image_base, U64 address_size, Arch arch, DW_ListUnit *addr_lu, DW_CompUnit *cu, String8 expr);
|
||||||
internal RDIM_LocationCaseList d2r_locset_from_attrib(Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Scope *curr_scope, RDIM_LocationChunkList *locations, DW_Input *input, DW_CompUnit *cu, U64 image_base, Arch arch, DW_Tag tag, DW_AttribKind kind);
|
internal RDIM_LocationCaseList d2r_locset_from_attrib(Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Scope *curr_scope, RDIM_LocationChunkList *locations, DW_Raw *input, DW_CompUnit *cu, U64 image_base, Arch arch, DW_Tag tag, DW_AttribKind kind);
|
||||||
internal RDIM_LocationCaseList d2r_var_locset_from_tag(Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Scope *curr_scope, RDIM_LocationChunkList *locations, DW_Input *input, DW_CompUnit *cu, U64 image_base, Arch arch, DW_Tag tag);
|
internal RDIM_LocationCaseList d2r_var_locset_from_tag(Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Scope *curr_scope, RDIM_LocationChunkList *locations, DW_Raw *input, DW_CompUnit *cu, U64 image_base, Arch arch, DW_Tag tag);
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Compilation Unit / Scope Conversion Helpers
|
//~ rjf: Compilation Unit / Scope Conversion Helpers
|
||||||
@@ -167,11 +167,11 @@ internal DW_Tag d2r_tag_iter_parent_tag(D2R_TagIter *iter);
|
|||||||
internal void d2r_flag_converted_tag(DW_TagNode *tag_node);
|
internal void d2r_flag_converted_tag(DW_TagNode *tag_node);
|
||||||
internal B8 d2r_is_tag_converted(DW_TagNode *tag_node);
|
internal B8 d2r_is_tag_converted(DW_TagNode *tag_node);
|
||||||
|
|
||||||
internal RDIM_Type *d2r_find_or_convert_type(Arena *arena, D2R_TypeTable *type_table, DW_Input *input, DW_CompUnit *cu, DW_Language cu_lang, U64 arch_addr_size, DW_Tag tag, DW_AttribKind kind);
|
internal RDIM_Type *d2r_find_or_convert_type(Arena *arena, D2R_TypeTable *type_table, DW_Raw *input, DW_CompUnit *cu, DW_Language cu_lang, U64 arch_addr_size, DW_Tag tag, DW_AttribKind kind);
|
||||||
|
|
||||||
internal void d2r_convert_types(Arena *arena, D2R_TypeTable *type_table, DW_Input *input, DW_CompUnit *cu, DW_Language cu_lang, U64 arch_addr_size, DW_TagNode *root);
|
internal void d2r_convert_types(Arena *arena, D2R_TypeTable *type_table, DW_Raw *input, DW_CompUnit *cu, DW_Language cu_lang, U64 arch_addr_size, DW_TagNode *root);
|
||||||
internal void d2r_convert_udts(Arena *arena, D2R_TypeTable *type_table, DW_Input *input, DW_CompUnit *cu, DW_Language cu_lang, U64 arch_addr_size, DW_TagNode *root);
|
internal void d2r_convert_udts(Arena *arena, D2R_TypeTable *type_table, DW_Raw *input, DW_CompUnit *cu, DW_Language cu_lang, U64 arch_addr_size, DW_TagNode *root);
|
||||||
internal void d2r_convert_symbols(Arena *arena, D2R_TypeTable *type_table, DW_Input *input, DW_CompUnit *cu, DW_Language cu_lang, U64 arch_addr_size, U64 image_base, Arch arch, DW_TagNode *root);
|
internal void d2r_convert_symbols(Arena *arena, D2R_TypeTable *type_table, DW_Raw *input, DW_CompUnit *cu, DW_Language cu_lang, U64 arch_addr_size, U64 image_base, Arch arch, DW_TagNode *root);
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Main Conversion Entry Point
|
//~ rjf: Main Conversion Entry Point
|
||||||
|
|||||||
Reference in New Issue
Block a user