diff --git a/src/dwarf/dwarf_dump.c b/src/dwarf/dwarf_dump.c index 9ebeab09..08f586a9 100644 --- a/src/dwarf/dwarf_dump.c +++ b/src/dwarf/dwarf_dump.c @@ -325,7 +325,7 @@ dw_string_from_expression(Arena *arena, String8 expr, U64 cu_base, U64 addr_size { Temp scratch = scratch_begin(&arena, 1); String8List list = dw_string_list_from_expression(scratch.arena, expr, cu_base, addr_size, arch, ver, ext, format); - String8 result = str8_list_join(arena, &list, &(StringJoin){.sep=", "}); + String8 result = str8_list_join(arena, &list, &(StringJoin){.sep=str8_lit(", ")}); return result; } diff --git a/src/dwarf/dwarf_parse.h b/src/dwarf/dwarf_parse.h index d7a6fb65..b22ac96f 100644 --- a/src/dwarf/dwarf_parse.h +++ b/src/dwarf/dwarf_parse.h @@ -521,7 +521,7 @@ internal DW_Expr dw_expr_from_data(Arena *arena, DW_Format format, U64 addr_size // debug frame internal U64 dw_parse_descriptor_entry_header(String8 data, U64 off, DW_DescriptorEntry *desc_out); -internal B32 dw_unpack_cie(String8 data, Arch arch, DW_Format format, DW_UnpackedCIE *cie_out); +internal B32 dw_unpack_cie(String8 data, DW_Format format, Arch arch, DW_UnpackedCIE *cie_out); internal B32 dw_unpack_fde(String8 data, DW_Format format, DW_CIEFromOffsetFunc *cie_from_offset_func, void *cie_from_offset_ud, DW_UnpackedFDE *fde_out); #endif // DWARF_PARSE_H diff --git a/src/dwarf/dwarf_unwind.c b/src/dwarf/dwarf_unwind.c index 168fd52e..5165da1f 100644 --- a/src/dwarf/dwarf_unwind.c +++ b/src/dwarf/dwarf_unwind.c @@ -569,13 +569,15 @@ dw_search_eh_frame_hdr_linear_x64(String8 raw_eh_frame_hdr, EH_PtrCtx *ptr_ctx, cursor += str8_deserial_read_struct(raw_eh_frame_hdr, cursor, &table_enc); U64 eh_frame_ptr = 0, fde_count = 0; - cursor += dw_unwind_parse_pointer_x64(raw_eh_frame_hdr.str, rng_1u64(0, raw_eh_frame_hdr.size), ptr_ctx, eh_frame_ptr_enc, cursor, &eh_frame_ptr); - cursor += dw_unwind_parse_pointer_x64(raw_eh_frame_hdr.str, rng_1u64(0, raw_eh_frame_hdr.size), ptr_ctx, fde_count_enc, cursor, &fde_count); + NotImplemented; + //cursor += dw_unwind_parse_pointer_x64(raw_eh_frame_hdr.str, rng_1u64(0, raw_eh_frame_hdr.size), ptr_ctx, eh_frame_ptr_enc, cursor, &eh_frame_ptr); + //cursor += dw_unwind_parse_pointer_x64(raw_eh_frame_hdr.str, rng_1u64(0, raw_eh_frame_hdr.size), ptr_ctx, fde_count_enc, cursor, &fde_count); for (U64 fde_idx = 0; fde_idx < fde_count; ++fde_idx) { U64 init_location = 0, address = 0; - cursor += dw_unwind_parse_pointer_x64(raw_eh_frame_hdr.str, rng_1u64(0, raw_eh_frame_hdr.size), ptr_ctx, table_enc, cursor, &init_location); - cursor += dw_unwind_parse_pointer_x64(raw_eh_frame_hdr.str, rng_1u64(0, raw_eh_frame_hdr.size), ptr_ctx, table_enc, cursor, &address); + NotImplemented; + //cursor += dw_unwind_parse_pointer_x64(raw_eh_frame_hdr.str, rng_1u64(0, raw_eh_frame_hdr.size), ptr_ctx, table_enc, cursor, &init_location); + //cursor += dw_unwind_parse_pointer_x64(raw_eh_frame_hdr.str, rng_1u64(0, raw_eh_frame_hdr.size), ptr_ctx, table_enc, cursor, &address); S64 current_delta = (S64)(location - init_location); S64 closest_delta = (S64)(location - closest_location); diff --git a/src/eh/eh_frame.c b/src/eh/eh_frame.c index bebc714c..fd56a313 100644 --- a/src/eh/eh_frame.c +++ b/src/eh/eh_frame.c @@ -82,13 +82,7 @@ eh_parse_aug_data(String8 aug_string, String8 aug_data, EH_PtrCtx *ptr_ctx, EH_A EH_PtrEnc handler_encoding = EH_PtrEnc_Omit; U64 handler_ip = 0; if (str8_match(str8_prefix(aug_string, 1), str8_lit("z"), 0)) { - U64 aug_data_off = cursor; - U64 aug_data_size = 0; - cursor += str8_deserial_read_uleb128(aug_string, cursor, &aug_data_size); - cursor += aug_data_size; - - String8 aug_data = str8_substr(aug_data, rng_1u64(aug_data_off, aug_data_off + aug_data_size)); - U64 aug_cursor = 0; + U64 aug_cursor = 0; for (U8 *ptr = aug_string.str; ptr < (aug_string.str+aug_string.size); ptr += 1) { switch (*ptr) { case 'L': { @@ -97,7 +91,7 @@ eh_parse_aug_data(String8 aug_string, String8 aug_data, EH_PtrCtx *ptr_ctx, EH_A } break; case 'P': { aug_cursor += str8_deserial_read_struct(aug_data, aug_cursor, &handler_encoding); - aug_cursor += str8_deserial_read_dwarf_ptr(aug_data, aug_cursor, ptr_ctx, handler_encoding, &handler_ip); + aug_cursor += eh_read_ptr(aug_data, aug_cursor, ptr_ctx, handler_encoding, &handler_ip); aug_flags |= EH_AugFlag_HasHandler; } break; case 'R': {