authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-01-29 18:40:52+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-01-30 09:11:02-05:00
loge77a102e24c351a56cdda5bad5a46dcd58101c23
treeea493333a599355f0a1941c0d13a69eae59f2a44
parent7ebc624a15c5a01d6bee8eaf9c7487b30ed1904c

Small DWARF fixups

* Clang doesn't seem to emit a DW_AT_low_pc together with DW_AT_ranges for asm files. * Keep reading the other CUs if the lookup fails.

1 files changed, 6 insertions(+), 4 deletions(-)

lib/std/debug.zig+6-4
...@@ -1390,8 +1390,12 @@ pub const DwarfInfo = struct {...@@ -1390,8 +1390,12 @@ pub const DwarfInfo = struct {
13901390
1391 // All the addresses in the list are relative to the value1391 // All the addresses in the list are relative to the value
1392 // specified by DW_AT_low_pc or to some other value encoded1392 // specified by DW_AT_low_pc or to some other value encoded
1393 // in the list itself1393 // in the list itself.
1394 var base_address = try compile_unit.die.getAttrAddr(DW.AT_low_pc);1394 // If no starting value is specified use zero.
1395 var base_address = compile_unit.die.getAttrAddr(DW.AT_low_pc) catch |err| switch (err) {
1396 error.MissingDebugInfo => 0,
1397 else => return err,
1398 };
13951399
1396 try s.seekable_stream.seekTo(ranges_offset);1400 try s.seekable_stream.seekTo(ranges_offset);
13971401
...@@ -1410,8 +1414,6 @@ pub const DwarfInfo = struct {...@@ -1410,8 +1414,6 @@ pub const DwarfInfo = struct {
1410 return compile_unit;1414 return compile_unit;
1411 }1415 }
1412 }1416 }
1413
1414 return error.InvalidDebugInfo;
1415 } else |err| {1417 } else |err| {
1416 if (err != error.MissingDebugInfo) return err;1418 if (err != error.MissingDebugInfo) return err;
1417 continue;1419 continue;