d2r2: .debug_loclists parsing, DWARF expression -> RDI location info; first pass at baking frame base into var locations to match simpler PDB behavior; fixes to high-pc address evaluation (based on form kind)

This commit is contained in:
Ryan Fleury
2026-04-29 12:40:43 -07:00
parent 242f4e9cbd
commit 9a923e9bf9
16 changed files with 1280 additions and 95 deletions
+4 -4
View File
@@ -1007,8 +1007,8 @@ RDI_LocationKindTable:
{NULL 0x0}
{AddrBytecodeStream 0x1}
{ValBytecodeStream 0x2}
{AddrRegPlusU16 0x3}
{AddrAddrRegPlusU16 0x4}
{AddrRegPlusOff 0x3}
{AddrAddrRegPlusOff 0x4}
{ValReg 0x5}
{ModuleOff 0x6}
{TLSOff 0x7}
@@ -1115,8 +1115,8 @@ RDI_LocationSetElementMemberTable:
`#define RDI_Location_RegOffMask 0x0000ffff00000000ull`;
`#define RDI_Location_RegOffShift 32`;
`#define rdi_kind_from_location(l) ((((l) & RDI_Location_KindMask) >> RDI_Location_KindShift))`;
`#define rdi_regcode_from_location(l) ((rdi_kind_from_location(l) == RDI_LocationKind_AddrRegPlusU16 || rdi_kind_from_location(l) == RDI_LocationKind_AddrAddrRegPlusU16 || rdi_kind_from_location(l) == RDI_LocationKind_ValReg) ? (((l) & RDI_Location_RegCodeMask) >> RDI_Location_RegCodeShift) : 0)`;
`#define rdi_regoff_from_location(l) ((rdi_kind_from_location(l) == RDI_LocationKind_AddrRegPlusU16 || rdi_kind_from_location(l) == RDI_LocationKind_AddrAddrRegPlusU16) ? (((l) & RDI_Location_RegOffMask) >> RDI_Location_RegOffShift) : 0)`;
`#define rdi_regcode_from_location(l) ((rdi_kind_from_location(l) == RDI_LocationKind_AddrRegPlusOff || rdi_kind_from_location(l) == RDI_LocationKind_AddrAddrRegPlusOff || rdi_kind_from_location(l) == RDI_LocationKind_ValReg) ? (((l) & RDI_Location_RegCodeMask) >> RDI_Location_RegCodeShift) : 0)`;
`#define rdi_regoff_from_location(l) (RDI_S64)((rdi_kind_from_location(l) == RDI_LocationKind_AddrRegPlusOff || rdi_kind_from_location(l) == RDI_LocationKind_AddrAddrRegPlusOff) ? (((l) & RDI_Location_RegOffMask) >> RDI_Location_RegOffShift) : 0)`;
`#define rdi_voff_from_location(l) (rdi_kind_from_location(l) == RDI_LocationKind_ModuleOff ? (((l) & RDI_Location_OffMask) >> RDI_Location_OffShift) : 0)`;
`#define rdi_toff_from_location(l) (rdi_kind_from_location(l) == RDI_LocationKind_TLSOff ? (((l) & RDI_Location_OffMask) >> RDI_Location_OffShift) : 0)`;
`#define rdi_constant_data_off_from_location(l) (rdi_kind_from_location(l) == RDI_LocationKind_ConstantDataOff ? (((l) & RDI_Location_OffMask) >> RDI_Location_OffShift) : 0)`;
+3 -3
View File
@@ -1066,11 +1066,11 @@ lane_sync(); if(flags & (1ull<<(kind))) ProfScope(rdi_name_title_from_dump_subse
String8 bytecode_stringification = rdi_string_from_bytecode(scratch.arena, tli->arch, bytecode);
dumpf(" bytecode: { %S }\n", bytecode_stringification);
}break;
case RDI_LocationKind_AddrRegPlusU16:
case RDI_LocationKind_AddrAddrRegPlusU16:
case RDI_LocationKind_AddrRegPlusOff:
case RDI_LocationKind_AddrAddrRegPlusOff:
{
RDI_RegCode reg_code = rdi_regcode_from_location(location);
U64 reg_off = rdi_regoff_from_location(location);
S64 reg_off = rdi_regoff_from_location(location);
String8 reg_code_string = rdi_string_from_reg_code(scratch.arena, tli->arch, reg_code);
dumpf(" reg: %S\n", reg_code_string);
dumpf(" reg_off: 0x%I64x\n", reg_off);