From 2218649801248553ebdf72dacffa3812a13b3ac9 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Thu, 19 Mar 2026 22:45:05 -0700 Subject: [PATCH] fix busted section codes --- src/lib_rdi/rdi.h | 18 +++++++++--------- src/raddbg/raddbg_main.c | 6 +++--- src/rdi/rdi.mdesk | 18 +++++++++--------- src/rdi_from_pdb/rdi_from_pdb.c | 4 ++-- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/lib_rdi/rdi.h b/src/lib_rdi/rdi.h index bc51dfdb..c676bb89 100644 --- a/src/lib_rdi/rdi.h +++ b/src/lib_rdi/rdi.h @@ -103,14 +103,14 @@ RDI_SectionKind_ThreadVariables = 0x0018, RDI_SectionKind_Constants = 0x0019, RDI_SectionKind_Procedures = 0x001A, RDI_SectionKind_Locals = 0x001B, -RDI_SectionKind_Scopes = 0x001D, -RDI_SectionKind_ScopeVOffData = 0x001E, -RDI_SectionKind_ScopeVMap = 0x001F, -RDI_SectionKind_InlineSites = 0x0020, -RDI_SectionKind_LocationBlocks = 0x0021, -RDI_SectionKind_LocationData = 0x0022, -RDI_SectionKind_GlobalVariableSymbols = 0x0023, -RDI_SectionKind_GlobalVMap = 0x001C, +RDI_SectionKind_Scopes = 0x001C, +RDI_SectionKind_ScopeVOffData = 0x001D, +RDI_SectionKind_ScopeVMap = 0x001E, +RDI_SectionKind_InlineSites = 0x001F, +RDI_SectionKind_LocationBlocks = 0x0020, +RDI_SectionKind_LocationData = 0x0021, +RDI_SectionKind_GlobalVariableSymbols = 0x0022, +RDI_SectionKind_GlobalVMap = 0x0023, RDI_SectionKind_ThreadVariableSymbols = 0x0024, RDI_SectionKind_ConstantSymbols = 0x0025, RDI_SectionKind_ProcedureSymbols = 0x0026, @@ -387,7 +387,7 @@ RDI_MemberKind_NestedType = 0x0300, typedef RDI_U8 RDI_ContainerKind; typedef enum RDI_ContainerKindEnum { -RDI_ContainerKind_Unit = 0x0, +RDI_ContainerKind_NULL = 0x0, RDI_ContainerKind_Type = 0x1, RDI_ContainerKind_Scope = 0x2, RDI_ContainerKind_Namespace = 0x3, diff --git a/src/raddbg/raddbg_main.c b/src/raddbg/raddbg_main.c index 49c8ba04..3fc9e08e 100644 --- a/src/raddbg/raddbg_main.c +++ b/src/raddbg/raddbg_main.c @@ -35,9 +35,9 @@ // [x] Referring to many locations, based on scope offsets -> kind = BlockList; BlockList encodes a first/opl pair into Block table, each Block has scope_off_first/opl, location_kind, location_idx - but a block's location kind CANNOT BE BlockList // [x] RDI_Variable has location_kind, location_idx // -// [ ] we keep flat tables of symbols, *but*, "sort" by containing unit. unit -> [f, opl) of procedures, globals, threadvars, constants, etc. -// [ ] container can also be a unit, so you can also go from procedure/global/tvar -> unit -// [ ] *OR*, because we can guarantee that the units themselves will be sorted from lowest -> highest in all symbol tables, we can simply binary search the unit table (small) with a symbol's index to find its corresponding unit. that way, no need to duplicate e.g. namespaces and so on across units. and actually, we have to do this, because containers can be types, and those cannot be unit-locked. +// [x] we keep flat tables of symbols, *but*, "sort" by containing unit. unit -> [f, opl) of procedures, globals, threadvars, constants, etc. +// [x] container can also be a unit, so you can also go from procedure/global/tvar -> unit +// [x] *OR*, because we can guarantee that the units themselves will be sorted from lowest -> highest in all symbol tables, we can simply binary search the unit table (small) with a symbol's index to find its corresponding unit. that way, no need to duplicate e.g. namespaces and so on across units. and actually, we have to do this, because containers can be types, and those cannot be unit-locked. // // [ ] symbols only store their *partly-qualified name*, e.g. `x` for A::B::C::x // [ ] default name maps look up *partly-qualified names* diff --git a/src/rdi/rdi.mdesk b/src/rdi/rdi.mdesk index 2f5775a1..abce6094 100644 --- a/src/rdi/rdi.mdesk +++ b/src/rdi/rdi.mdesk @@ -188,18 +188,18 @@ RDI_SectionTable: //- rjf: scope info - {Scopes scopes RDI_Scope 0x001D U32 ""} - {ScopeVOffData scope_voff_data RDI_U64 0x001E U32 ""} - {ScopeVMap scope_vmap RDI_VMapEntry 0x001F - ""} - {InlineSites inline_sites RDI_InlineSite 0x0020 U32 ""} + {Scopes scopes RDI_Scope 0x001C U32 ""} + {ScopeVOffData scope_voff_data RDI_U64 0x001D U32 ""} + {ScopeVMap scope_vmap RDI_VMapEntry 0x001E - ""} + {InlineSites inline_sites RDI_InlineSite 0x001F U32 ""} //- TODO(rjf): vvv old story for locations - {LocationBlocks location_blocks RDI_LocationBlock 0x0021 U32 ""} - {LocationData location_data RDI_U8 0x0022 U32 ""} + {LocationBlocks location_blocks RDI_LocationBlock 0x0020 U32 ""} + {LocationData location_data RDI_U8 0x0021 U32 ""} //- NOTE(rjf): vvv new story for symbols - {GlobalVariableSymbols global_variable_symbols RDI_Symbol 0x0023 U32 ""} - {GlobalVMap global_vmap RDI_VMapEntry 0x001C - ""} + {GlobalVariableSymbols global_variable_symbols RDI_Symbol 0x0022 U32 ""} + {GlobalVMap global_vmap RDI_VMapEntry 0x0023 - ""} {ThreadVariableSymbols thread_variable_symbols RDI_Symbol 0x0024 U32 ""} {ConstantSymbols constant_symbols RDI_Symbol 0x0025 U32 ""} {ProcedureSymbols procedure_symbols RDI_Symbol 0x0026 U32 ""} @@ -1000,7 +1000,7 @@ RDI_EnumMemberTable: @table(name value) RDI_ContainerKindTable: { - {Unit 0x0} + {NULL 0x0} {Type 0x1} {Scope 0x2} {Namespace 0x3} diff --git a/src/rdi_from_pdb/rdi_from_pdb.c b/src/rdi_from_pdb/rdi_from_pdb.c index 1dc27823..39d2e5ec 100644 --- a/src/rdi_from_pdb/rdi_from_pdb.c +++ b/src/rdi_from_pdb/rdi_from_pdb.c @@ -3688,8 +3688,8 @@ p2r_convert(Arena *arena, P2R_ConvertParams *params) RDIM_Scope *scope = top_scope_node->scope; RDIM_Symbol *local = rdim_symbol_chunk_list_push(arena, &scope->locals, 8); local->is_param = is_param; - local->name = name; - local->type = type; + local->name = name; + local->type = type; // rjf: equip location info {