mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-10-14 04:49:41 -07:00
dead code elimination
This commit is contained in:
1 parent
d73ce364b9
commit
ef5fc82e9c
13 files changed
+40
-1953
No files matched your search
@@ -448,327 +448,3 @@ dw_reg_count_from_arch(Arch arch)
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ TODO(rjf): OLD vvvvvvvvvvv
|
||||
|
||||
#if 0
|
||||
internal DW_AttribClass
|
||||
dw_attrib_class_from_form_kind(DW_Version ver, DW_FormKind k)
|
||||
{
|
||||
DW_AttribClass result = 0;
|
||||
switch(k)
|
||||
{
|
||||
default:{}break;
|
||||
#define X(name, code, version, ext, class) case DW_FormKind_##name:{result = (class);}break;
|
||||
DW_FormKind_XList
|
||||
#undef X
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal U64
|
||||
dw_reg_size_from_code(Arch arch, DW_Reg reg_code)
|
||||
{
|
||||
switch (arch) {
|
||||
case Arch_Null: break;
|
||||
case Arch_x64: return dw_reg_size_from_code_x64(reg_code);
|
||||
default: NotImplemented; break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
internal U64
|
||||
dw_reg_pos_from_code(Arch arch, DW_Reg reg_code)
|
||||
{
|
||||
switch (arch) {
|
||||
case Arch_Null: break;
|
||||
case Arch_x64: return dw_reg_pos_from_code_x64(reg_code);
|
||||
default: NotImplemented; break;
|
||||
}
|
||||
return max_U64;
|
||||
}
|
||||
|
||||
internal U64
|
||||
dw_reg_count_from_arch(Arch arch)
|
||||
{
|
||||
switch (arch) {
|
||||
default: { NotImplemented; } // fall-through
|
||||
case Arch_Null: return 0;
|
||||
case Arch_x64: return DW_RegX64_Last;
|
||||
}
|
||||
}
|
||||
|
||||
internal U64
|
||||
dw_reg_max_size_from_arch(Arch arch)
|
||||
{
|
||||
local_persist U64 max_size = 0;
|
||||
if (max_size == 0) {
|
||||
U64 max_idx = dw_reg_count_from_arch(arch);
|
||||
for EachIndex(reg_idx, max_idx) {
|
||||
U64 reg_size = dw_reg_size_from_code(arch, reg_idx);
|
||||
max_size = Max(max_size, reg_size);
|
||||
}
|
||||
}
|
||||
return max_size;
|
||||
}
|
||||
|
||||
internal U64
|
||||
dw_operand_count_from_cfa_opcode(DW_CFA_Opcode opcode)
|
||||
{
|
||||
switch (opcode) {
|
||||
#define X(_N, _ID, ...) case _ID: { local_persist DW_CFA_OperandType t[] = { DW_CFA_OperandType_Null, __VA_ARGS__ }; return ArrayCount(t)-1; }
|
||||
DW_CFA_Kind_XList
|
||||
#undef X
|
||||
default: { NotImplemented; } break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
internal B32
|
||||
dw_is_cfa_expr_opcode_invalid(DW_ExprOp opcode)
|
||||
{
|
||||
B32 is_invalid = 0;
|
||||
switch(opcode)
|
||||
{
|
||||
default:{}break;
|
||||
case DW_ExprOp_Addrx:
|
||||
case DW_ExprOp_Call2:
|
||||
case DW_ExprOp_Call4:
|
||||
case DW_ExprOp_CallRef:
|
||||
case DW_ExprOp_ConstType:
|
||||
case DW_ExprOp_Constx:
|
||||
case DW_ExprOp_Convert:
|
||||
case DW_ExprOp_DerefType:
|
||||
case DW_ExprOp_RegvalType:
|
||||
case DW_ExprOp_Reinterpret:
|
||||
case DW_ExprOp_PushObjectAddress:
|
||||
case DW_ExprOp_CallFrameCfa:
|
||||
{
|
||||
is_invalid = 1;
|
||||
}break;
|
||||
}
|
||||
return is_invalid;
|
||||
}
|
||||
|
||||
internal B32
|
||||
dw_is_new_row_cfa_opcode(DW_CFA_Opcode opcode)
|
||||
{
|
||||
B32 is_new_row_op = 0;
|
||||
switch(opcode)
|
||||
{
|
||||
default:{}break;
|
||||
case DW_CFA_SetLoc:
|
||||
case DW_CFA_AdvanceLoc:
|
||||
case DW_CFA_AdvanceLoc1:
|
||||
case DW_CFA_AdvanceLoc2:
|
||||
case DW_CFA_AdvanceLoc4:
|
||||
{
|
||||
is_new_row_op = 1;
|
||||
}break;
|
||||
}
|
||||
return is_new_row_op;
|
||||
}
|
||||
|
||||
internal DW_CFA_OperandType *
|
||||
dw_operand_types_from_cfa_op(DW_CFA_Opcode opcode)
|
||||
{
|
||||
switch (opcode) {
|
||||
#define X(_N, _ID, ...) case _ID: { local_persist DW_CFA_OperandType t[] = { DW_CFA_OperandType_Null, __VA_ARGS__ }; return &t[0] + 1; }
|
||||
DW_CFA_Kind_XList
|
||||
#undef X
|
||||
default: { NotImplemented; } break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_string_from_language(Arena *arena, DW_Language kind)
|
||||
{
|
||||
switch (kind) {
|
||||
#define X(_N,_ID) case DW_Language_##_N: return str8_lit(Stringify(_N));
|
||||
DW_Language_XList
|
||||
#undef X
|
||||
}
|
||||
return push_str8f(arena, "%x", kind);
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_string_from_comp_unit_kind(Arena *arena, DW_CompUnitKind kind)
|
||||
{
|
||||
switch (kind) {
|
||||
#define X(_N,_ID) case DW_CompUnitKind_##_N: return str8_lit(Stringify(_N));
|
||||
DW_CompUnitKind_XList
|
||||
#undef X
|
||||
}
|
||||
return push_str8f(arena, "%x", kind);
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_string_from_inl(Arena *arena, DW_InlKind kind)
|
||||
{
|
||||
switch (kind) {
|
||||
#define X(_N,_ID) case _ID: return str8_lit(Stringify(_N));
|
||||
DW_Inl_XList
|
||||
#undef X
|
||||
}
|
||||
return push_str8f(arena, "%x", kind);
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_string_from_access_kind(Arena *arena, DW_AccessKind kind)
|
||||
{
|
||||
switch (kind) {
|
||||
#define X(_N,_ID) case _ID: return str8_lit(Stringify(_N));
|
||||
DW_AccessKind_XList
|
||||
#undef X
|
||||
}
|
||||
return push_str8f(arena, "%llx", kind);
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_string_from_calling_convetion(Arena *arena, DW_CallingConventionKind kind)
|
||||
{
|
||||
switch (kind) {
|
||||
#define X(_N,_ID) case _ID: return str8_lit(Stringify(_N));
|
||||
DW_CallingConventionKind_XList
|
||||
#undef X
|
||||
}
|
||||
return push_str8f(arena, "%llx", kind);
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_string_from_attrib_type_encoding(Arena *arena, DW_ATE kind)
|
||||
{
|
||||
switch (kind) {
|
||||
#define X(_N,_ID) case _ID: return str8_lit(Stringify(_N));
|
||||
DW_ATE_XList
|
||||
#undef X
|
||||
}
|
||||
return push_str8f(arena, "%llx", kind);
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_string_from_attrib_visibility(Arena *arena, DW_Vis vis)
|
||||
{
|
||||
switch (vis) {
|
||||
#define X(_N,_ID) case _ID: return str8_lit(Stringify(_N));
|
||||
DW_Vis_XList
|
||||
#undef X
|
||||
}
|
||||
return push_str8f(arena, "%llx", vis);
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_string_from_std_opcode(Arena *arena, DW_StdOpcode kind)
|
||||
{
|
||||
switch (kind) {
|
||||
#define X(_N,_ID) case DW_StdOpcode_##_N: return str8_lit(Stringify(_N));
|
||||
DW_StdOpcode_XList
|
||||
#undef X
|
||||
}
|
||||
return push_str8f(arena, "%x", kind);
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_string_from_ext_opcode(Arena *arena, DW_ExtOpcode kind)
|
||||
{
|
||||
switch (kind) {
|
||||
#define X(_N,_ID) case DW_ExtOpcode_##_N: return str8_lit(Stringify(_N));
|
||||
DW_ExtOpcode_XList
|
||||
#undef X
|
||||
default: InvalidPath; break;
|
||||
}
|
||||
return push_str8f(arena, "%x", kind);
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_string_from_loc_list_entry_kind(Arena *arena, DW_LLE kind)
|
||||
{
|
||||
NotImplemented;
|
||||
return str8_zero();
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_string_from_section_kind(Arena *arena, DW_SectionKind kind)
|
||||
{
|
||||
NotImplemented;
|
||||
return str8_zero();
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_string_from_rng_list_entry_kind(Arena *arena, DW_RLE kind)
|
||||
{
|
||||
NotImplemented;
|
||||
return str8_zero();
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_string_from_register(Arena *arena, Arch arch, U64 reg_id)
|
||||
{
|
||||
String8 reg_str = str8_zero();
|
||||
switch (arch) {
|
||||
case Arch_Null: break;
|
||||
case Arch_x64: {
|
||||
switch (reg_id) {
|
||||
#define X(_N, _ID, ...) case DW_RegX64_##_N: reg_str = str8_lit(Stringify(_N)); break;
|
||||
DW_Regs_X64_XList
|
||||
#undef X
|
||||
}
|
||||
} break;
|
||||
case Arch_arm32: NotImplemented; break;
|
||||
case Arch_arm64: NotImplemented; break;
|
||||
case Arch_x86: NotImplemented; break;
|
||||
default: InvalidPath; break;
|
||||
}
|
||||
if (reg_str.size == 0) {
|
||||
reg_str = push_str8f(arena, "%#llx", reg_id);
|
||||
}
|
||||
return reg_str;
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_string_from_cfa_opcode(DW_CFA_Opcode opcode)
|
||||
{
|
||||
switch (opcode) {
|
||||
#define X(_NAME, _ID, ...) case _ID: return str8_lit(Stringify(_NAME));
|
||||
DW_CFA_Kind_XList
|
||||
#undef X
|
||||
default: InvalidPath; break;
|
||||
}
|
||||
return str8_zero();
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_name_string_from_section_kind(DW_SectionKind k)
|
||||
{
|
||||
switch (k) {
|
||||
#define X(_N,_L,_M,_D) case DW_Section_##_N: return str8_lit(_L);
|
||||
DW_SectionKind_XList
|
||||
#undef X
|
||||
}
|
||||
return str8_zero();
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_mach_name_string_from_section_kind(DW_SectionKind k)
|
||||
{
|
||||
switch (k) {
|
||||
#define X(_N,_L,_M,_D) case DW_Section_##_N: return str8_lit(_M);
|
||||
DW_SectionKind_XList
|
||||
#undef X
|
||||
}
|
||||
return str8_zero();
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_dwo_name_string_from_section_kind(DW_SectionKind k)
|
||||
{
|
||||
switch (k) {
|
||||
#define X(_N,_L,_M,_D) case DW_Section_##_N: return str8_lit(_D);
|
||||
DW_SectionKind_XList
|
||||
#undef X
|
||||
}
|
||||
return str8_zero();
|
||||
}
|
||||
#endif
|
||||
@@ -65,46 +65,4 @@ internal String8 dw_dwo_name_from_section_kind(DW_SectionKind k);
|
||||
//- rjf: architecture info
|
||||
internal U64 dw_reg_count_from_arch(Arch arch);
|
||||
|
||||
////////////////////////////////
|
||||
//~ TODO(rjf): OLD vvvvvvvvvvvvvvvvvvv
|
||||
|
||||
#if 0
|
||||
////////////////////////////////
|
||||
// xlist helpers
|
||||
|
||||
// regs
|
||||
internal U64 dw_reg_size_from_code(Arch arch, DW_Reg reg_code);
|
||||
internal U64 dw_reg_pos_from_code(Arch arch, DW_Reg reg_code);
|
||||
internal U64 dw_reg_count_from_arch(Arch arch);
|
||||
internal U64 dw_reg_max_size_from_arch(Arch arch);
|
||||
internal U64 dw_size_from_format(DW_Format format);
|
||||
|
||||
// CFA
|
||||
internal U64 dw_operand_count_from_cfa_opcode(DW_CFA_Opcode opcode);
|
||||
internal B32 dw_is_cfa_expr_opcode_invalid(DW_ExprOp opcode);
|
||||
internal B32 dw_is_new_row_cfa_opcode(DW_CFA_Opcode opcode);
|
||||
internal DW_CFA_OperandType * dw_operand_types_from_cfa_op(DW_CFA_Opcode opcode);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: String <=> Enum
|
||||
|
||||
internal String8 dw_string_from_language(Arena *arena, DW_Language kind);
|
||||
internal String8 dw_string_from_comp_unit_kind(Arena *arena, DW_CompUnitKind kind);
|
||||
internal String8 dw_string_from_inl(Arena *arena, DW_InlKind kind);
|
||||
internal String8 dw_string_from_access_kind(Arena *arena, DW_AccessKind kind);
|
||||
internal String8 dw_string_from_calling_convetion(Arena *arena, DW_CallingConventionKind kind);
|
||||
internal String8 dw_string_from_attrib_type_encoding(Arena *arena, DW_ATE kind);
|
||||
internal String8 dw_string_from_attrib_visibility(Arena *arena, DW_Vis vis);
|
||||
internal String8 dw_string_from_std_opcode(Arena *arena, DW_StdOpcode kind);
|
||||
internal String8 dw_string_from_ext_opcode(Arena *arena, DW_ExtOpcode kind);
|
||||
internal String8 dw_string_from_loc_list_entry_kind(Arena *arena, DW_LLE kind);
|
||||
internal String8 dw_string_from_section_kind(Arena *arena, DW_SectionKind kind);
|
||||
internal String8 dw_string_from_rng_list_entry_kind(Arena *arena, DW_RLE kind);
|
||||
internal String8 dw_string_from_register(Arena *arena, Arch arch, U64 reg_id);
|
||||
internal String8 dw_string_from_cfa_opcode(DW_CFA_Opcode opcode);
|
||||
internal String8 dw_name_string_from_section_kind(DW_SectionKind k);
|
||||
internal String8 dw_mach_name_string_from_section_kind(DW_SectionKind k);
|
||||
internal String8 dw_dwo_name_string_from_section_kind (DW_SectionKind k);
|
||||
#endif
|
||||
|
||||
#endif // DWARF_H
|
||||
@@ -2,11 +2,7 @@
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
#include "dwarf/dwarf.c"
|
||||
// #include "dwarf/dwarf_parse.c"
|
||||
// #include "dwarf/dwarf_expr.c"
|
||||
#include "dwarf/dwarf_expr_2.c"
|
||||
// #include "dwarf/dwarf_unwind.c"
|
||||
// #include "dwarf/dwarf_dump.c"
|
||||
#include "dwarf/dwarf_parse_2.c"
|
||||
#include "dwarf/dwarf_unwind_2.c"
|
||||
#include "dwarf/dwarf_dump_2.c"
|
||||
@@ -16,7 +12,3 @@
|
||||
#if defined(ELF_H)
|
||||
# include "dwarf/dwarf_parse_elf.c"
|
||||
#endif
|
||||
|
||||
#if 0 // TODO(rjf): this uses concepts from the old parser
|
||||
# include "dwarf/dwarf_writer.c"
|
||||
#endif
|
||||
@@ -5,11 +5,7 @@
|
||||
#define DWARF_INC_H
|
||||
|
||||
#include "dwarf/dwarf.h"
|
||||
// #include "dwarf/dwarf_parse.h"
|
||||
// #include "dwarf/dwarf_expr.h"
|
||||
#include "dwarf/dwarf_expr_2.h"
|
||||
// #include "dwarf/dwarf_unwind.h"
|
||||
// #include "dwarf/dwarf_dump.h"
|
||||
#include "dwarf/dwarf_parse_2.h"
|
||||
#include "dwarf/dwarf_unwind_2.h"
|
||||
#include "dwarf/dwarf_dump_2.h"
|
||||
@@ -20,8 +16,4 @@
|
||||
# include "dwarf/dwarf_parse_elf.h"
|
||||
#endif
|
||||
|
||||
#if 0 // TODO(rjf): this uses concepts from the old parser
|
||||
# include "dwarf/dwarf_writer.h"
|
||||
#endif
|
||||
|
||||
#endif // DWARF_INC_H
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright (c) Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
// TODO(rjf): this uses concepts from the old parser
|
||||
|
||||
internal DW_IntEnc
|
||||
dw_int_enc_from_sint(S64 v)
|
||||
{
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#ifndef DWARF_WRITER_H
|
||||
#define DWARF_WRITER_H
|
||||
|
||||
// TODO(rjf): this uses concepts from the old parser
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
typedef enum
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
#if 0
|
||||
#if 0 // TODO(rjf): this uses concepts from the old parser
|
||||
|
||||
internal U64
|
||||
t_dw_test_uleb128(U64 v, U64 expected_length)
|
||||
|
||||
Reference in new issue
Block a user