@@ -923,6 +923,11 @@ pub fn readElfDebugInfo(allocator: mem.Allocator, elf_file: File) !ModuleDebugIn
923
923
var opt_debug_line : ? []const u8 = null ;
924
924
var opt_debug_line_str : ? []const u8 = null ;
925
925
var opt_debug_ranges : ? []const u8 = null ;
926
+ var opt_debug_loclists : ? []const u8 = null ;
927
+ var opt_debug_rnglists : ? []const u8 = null ;
928
+ var opt_debug_addr : ? []const u8 = null ;
929
+ var opt_debug_names : ? []const u8 = null ;
930
+ var opt_debug_frame : ? []const u8 = null ;
926
931
927
932
for (shdrs ) | * shdr | {
928
933
if (shdr .sh_type == elf .SHT_NULL ) continue ;
@@ -942,6 +947,16 @@ pub fn readElfDebugInfo(allocator: mem.Allocator, elf_file: File) !ModuleDebugIn
942
947
opt_debug_line_str = try chopSlice (mapped_mem , shdr .sh_offset , shdr .sh_size );
943
948
} else if (mem .eql (u8 , name , ".debug_ranges" )) {
944
949
opt_debug_ranges = try chopSlice (mapped_mem , shdr .sh_offset , shdr .sh_size );
950
+ } else if (mem .eql (u8 , name , ".debug_loclists" )) {
951
+ opt_debug_loclists = try chopSlice (mapped_mem , shdr .sh_offset , shdr .sh_size );
952
+ } else if (mem .eql (u8 , name , ".debug_rnglists" )) {
953
+ opt_debug_rnglists = try chopSlice (mapped_mem , shdr .sh_offset , shdr .sh_size );
954
+ } else if (mem .eql (u8 , name , ".debug_addr" )) {
955
+ opt_debug_addr = try chopSlice (mapped_mem , shdr .sh_offset , shdr .sh_size );
956
+ } else if (mem .eql (u8 , name , ".debug_names" )) {
957
+ opt_debug_names = try chopSlice (mapped_mem , shdr .sh_offset , shdr .sh_size );
958
+ } else if (mem .eql (u8 , name , ".debug_frame" )) {
959
+ opt_debug_frame = try chopSlice (mapped_mem , shdr .sh_offset , shdr .sh_size );
945
960
}
946
961
}
947
962
@@ -954,6 +969,11 @@ pub fn readElfDebugInfo(allocator: mem.Allocator, elf_file: File) !ModuleDebugIn
954
969
.debug_line = opt_debug_line orelse return error .MissingDebugInfo ,
955
970
.debug_line_str = opt_debug_line_str ,
956
971
.debug_ranges = opt_debug_ranges ,
972
+ .debug_loclists = opt_debug_loclists ,
973
+ .debug_rnglists = opt_debug_rnglists ,
974
+ .debug_addr = opt_debug_addr ,
975
+ .debug_names = opt_debug_names ,
976
+ .debug_frame = opt_debug_frame ,
957
977
};
958
978
959
979
try DW .openDwarfDebugInfo (& di , allocator );
@@ -1494,6 +1514,11 @@ pub const ModuleDebugInfo = switch (native_os) {
1494
1514
var opt_debug_str : ? macho.section_64 = null ;
1495
1515
var opt_debug_line_str : ? macho.section_64 = null ;
1496
1516
var opt_debug_ranges : ? macho.section_64 = null ;
1517
+ var opt_debug_loclists : ? macho.section_64 = null ;
1518
+ var opt_debug_rnglists : ? macho.section_64 = null ;
1519
+ var opt_debug_addr : ? macho.section_64 = null ;
1520
+ var opt_debug_names : ? macho.section_64 = null ;
1521
+ var opt_debug_frame : ? macho.section_64 = null ;
1497
1522
1498
1523
for (segcmd .? .getSections ()) | sect | {
1499
1524
const name = sect .sectName ();
@@ -1509,6 +1534,16 @@ pub const ModuleDebugInfo = switch (native_os) {
1509
1534
opt_debug_line_str = sect ;
1510
1535
} else if (mem .eql (u8 , name , "__debug_ranges" )) {
1511
1536
opt_debug_ranges = sect ;
1537
+ } else if (mem .eql (u8 , name , "__debug_loclists" )) {
1538
+ opt_debug_loclists = sect ;
1539
+ } else if (mem .eql (u8 , name , "__debug_rnglists" )) {
1540
+ opt_debug_rnglists = sect ;
1541
+ } else if (mem .eql (u8 , name , "__debug_addr" )) {
1542
+ opt_debug_addr = sect ;
1543
+ } else if (mem .eql (u8 , name , "__debug_names" )) {
1544
+ opt_debug_names = sect ;
1545
+ } else if (mem .eql (u8 , name , "__debug_frame" )) {
1546
+ opt_debug_frame = sect ;
1512
1547
}
1513
1548
}
1514
1549
@@ -1536,6 +1571,11 @@ pub const ModuleDebugInfo = switch (native_os) {
1536
1571
try chopSlice (mapped_mem , debug_ranges .offset , debug_ranges .size )
1537
1572
else
1538
1573
null ,
1574
+ .debug_loclists = opt_debug_loclists ,
1575
+ .debug_rnglists = opt_debug_rnglists ,
1576
+ .debug_addr = opt_debug_addr ,
1577
+ .debug_names = opt_debug_names ,
1578
+ .debug_frame = opt_debug_frame ,
1539
1579
};
1540
1580
1541
1581
try DW .openDwarfDebugInfo (& di , allocator );
@@ -1590,7 +1630,7 @@ pub const ModuleDebugInfo = switch (native_os) {
1590
1630
.compile_unit_name = compile_unit .die .getAttrString (
1591
1631
o_file_di ,
1592
1632
DW .AT .name ,
1593
- compile_unit . is_64 ,
1633
+ self . di . debug_str ,
1594
1634
) catch | err | switch (err ) {
1595
1635
error .MissingDebugInfo , error .InvalidDebugInfo = > "???" ,
1596
1636
},
@@ -1712,7 +1752,7 @@ fn getSymbolFromDwarf(allocator: mem.Allocator, address: u64, di: *DW.DwarfInfo)
1712
1752
if (nosuspend di .findCompileUnit (address )) | compile_unit | {
1713
1753
return SymbolInfo {
1714
1754
.symbol_name = nosuspend di .getSymbolName (address ) orelse "???" ,
1715
- .compile_unit_name = compile_unit .die .getAttrString (di , DW .AT .name , compile_unit . is_64 ) catch | err | switch (err ) {
1755
+ .compile_unit_name = compile_unit .die .getAttrString (di , DW .AT .name , di . debug_str ) catch | err | switch (err ) {
1716
1756
error .MissingDebugInfo , error .InvalidDebugInfo = > "???" ,
1717
1757
},
1718
1758
.line_info = nosuspend di .getLineNumberInfo (allocator , compile_unit .* , address ) catch | err | switch (err ) {
0 commit comments