mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-10-06 16:05:42 +00:00
pass over DWARF dumper
This commit is contained in:
+1014
-1156
File diff suppressed because it is too large
Load Diff
+39
-56
@@ -4,69 +4,52 @@
|
||||
#ifndef DWARF_DUMP_H
|
||||
#define DWARF_DUMP_H
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DW_DumperCacheFlag_InfoRanges = (1 << 0),
|
||||
DW_DumperCacheFlag_CuArr = (1 << 1),
|
||||
DW_DumperCacheFlag_LineVmMap = (1 << 2),
|
||||
DW_DumperCacheFlag_TagTrees = (1 << 3),
|
||||
} DW_DumperCacheFlags;
|
||||
|
||||
typedef struct DW_Dumper
|
||||
{
|
||||
Arena *arena;
|
||||
Arch arch;
|
||||
B32 is_relaxed;
|
||||
B32 is_verbose;
|
||||
DW_Input *input;
|
||||
DW_DumperCacheFlags cache_flags;
|
||||
struct {
|
||||
Rng1U64Array info_ranges;
|
||||
DW_CompUnit *cu_arr;
|
||||
HashTable *line_vm_map;
|
||||
DW_TagTree *tag_trees;
|
||||
} cache;
|
||||
} DW_Dumper;
|
||||
|
||||
#define DW_PRINTER(name) void name(Arena *arena, String8List *strings, int indent, DW_Dumper *dumper)
|
||||
typedef DW_PRINTER(DW_Printer);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Dump Subset Types
|
||||
|
||||
#define DW_DumpSubset_XList \
|
||||
X(DebugInfo, debug_info, "DEBUG INFO") \
|
||||
X(DebugAbbrev, debug_abbrev, "DEBUG ABBREV") \
|
||||
X(DebugLine, debug_line, "DEBUG LINE") \
|
||||
X(DebugStr, debug_str, "DEBUG STR") \
|
||||
X(DebugLoc, debug_loc, "DEBUG LOC") \
|
||||
X(DebugRanges, debug_ranges, "DEBUG RANGES") \
|
||||
X(DebugARanges, debug_aranges, "DEBUG ARANGES") \
|
||||
X(DebugAddr, debug_addr, "DEBUG ADDR") \
|
||||
X(DebugLocLists, debug_loclists, "DEBUG LOCLISTS") \
|
||||
X(DebugRngLists, debug_rnglists, "DEBUG RNGLISTS") \
|
||||
X(DebugPubNames, debug_pubnames, "DEBUG PUBNAMES") \
|
||||
X(DebugPubTypes, debug_pubtypes, "DEBUG PUBTYPES") \
|
||||
X(DebugLineStr, debug_linestr, "DEBUG LINESTR") \
|
||||
X(DebugStrOffsets, debug_stroff, "DEBUG STROFF") \
|
||||
X(DebugFrame, debug_frame, "DEBUG FRAME") \
|
||||
|
||||
typedef enum DW_DumpSubset
|
||||
{
|
||||
#define X(name, name_lower, title) DW_DumpSubset_##name,
|
||||
DW_DumpSubset_XList
|
||||
#undef X
|
||||
}
|
||||
DW_DumpSubset;
|
||||
|
||||
typedef U32 DW_DumpSubsetFlags;
|
||||
enum
|
||||
{
|
||||
#define X(name, name_lower, title) DW_DumpSubsetFlag_##name = (1<<DW_DumpSubset_##name),
|
||||
DW_DumpSubset_XList
|
||||
#undef X
|
||||
DW_DumpSubsetFlag_All = 0xffffffffu,
|
||||
};
|
||||
|
||||
read_only global String8 dw_name_lowercase_from_dump_subset_table[] =
|
||||
{
|
||||
#define X(name, name_lower, title) str8_lit_comp(#name_lower),
|
||||
DW_DumpSubset_XList
|
||||
#undef X
|
||||
};
|
||||
|
||||
read_only global String8 dw_name_title_from_dump_subset_table[] =
|
||||
{
|
||||
#define X(name, name_lower, title) str8_lit_comp(title),
|
||||
DW_DumpSubset_XList
|
||||
#undef X
|
||||
};
|
||||
// cache
|
||||
internal Rng1U64Array dw_get_info_ranges(DW_Dumper *dumper);
|
||||
internal DW_CompUnit * dw_get_cu_arr(DW_Dumper *dumper);
|
||||
internal HashTable * dw_get_line_vm_map(DW_Dumper *dumper);
|
||||
internal DW_TagTree * dw_get_tag_trees(DW_Dumper *dumper);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Stringification Helpers
|
||||
|
||||
internal String8 dw_string_from_reg_off(Arena *arena, Arch arch, DW_Reg reg_idx, S64 reg_off);
|
||||
internal String8 dw_string_from_reg(Arena *arena, Arch arch, DW_Reg reg_idx);
|
||||
internal String8List dw_string_list_from_expression(Arena *arena, String8 raw_data, U64 cu_base, U64 addr_size, Arch arch, DW_Version ver, DW_Ext ext, DW_Format format);
|
||||
internal String8 dw_string_from_expression(Arena *arena, String8 expr, U64 cu_base, U64 addr_size, Arch arch, DW_Version ver, DW_Ext ext, DW_Format format);
|
||||
|
||||
internal String8List dw_string_list_from_cfi_program(Arena *arena, U64 cu_base, Arch arch, DW_Version ver, DW_Ext ext, DW_Format format, U64 pc_begin, DW_CIE *cie, DW_DecodePtr *decode_ptr_func, void *deocde_ptr_ud, String8 program);
|
||||
internal String8List dw_string_list_from_expression (Arena *arena, String8 raw_data, U64 cu_base, U64 addr_size, Arch arch, DW_Version ver, DW_Ext ext, DW_Format format);
|
||||
|
||||
internal String8 dw_string_from_cfa(Arena *arena, Arch arch, U64 address_size, DW_Version version, DW_Ext ext, DW_Format format, DW_CFA cfa);
|
||||
internal String8 dw_string_from_cfi_row(Arena *arena, Arch arch, U64 address_size, DW_Version version, DW_Ext ext, DW_Format format, DW_CFI_Row *row);
|
||||
internal String8 dw_string_from_reg_off (Arena *arena, Arch arch, DW_Reg reg_idx, S64 reg_off);
|
||||
internal String8 dw_string_from_attrib_value(Arena *arena, DW_Input *input, Arch arch, DW_CompUnit *cu, DW_LineVM *line_vm, DW_Attrib *attrib);
|
||||
internal String8 dw_string_from_expression (Arena *arena, String8 expr, U64 cu_base, U64 addr_size, Arch arch, DW_Version ver, DW_Ext ext, DW_Format format);
|
||||
internal String8 dw_string_from_cfa (Arena *arena, Arch arch, U64 address_size, DW_Version version, DW_Ext ext, DW_Format format, DW_CFA cfa);
|
||||
internal String8 dw_string_from_cfi_row (Arena *arena, Arch arch, U64 address_size, DW_Version version, DW_Ext ext, DW_Format format, DW_CFI_Row *row);
|
||||
|
||||
#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);
|
||||
@@ -85,6 +68,6 @@ internal void dw_print_debug_str_offsets(Arena *arena, String8List *out, String8
|
||||
////////////////////////////////
|
||||
//~ rjf: Dump Entry Point
|
||||
|
||||
internal String8List dw_dump_list_from_sections(Arena *arena, DW_Input *input, Arch arch, DW_DumpSubsetFlags subset_flags, B32 verbose);
|
||||
internal String8List dw_dump_list_from_sections(Arena *arena, DW_Input *input, Arch arch, DW_SectionFlags dump_sections, B32 is_verbose);
|
||||
|
||||
#endif // DWARF_DUMP_H
|
||||
|
||||
Reference in New Issue
Block a user