mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
std.debug.Dwarf.Unwind: deal with invalid def_cfa_reg by GNU toolchains
This commit is contained in:
parent
97de46dc16
commit
a4f95b1e61
1 changed files with 12 additions and 1 deletions
|
|
@ -256,7 +256,18 @@ fn evalInstructions(
|
|||
.offset = cfa.offset_sf * cie.data_alignment_factor,
|
||||
} },
|
||||
.def_cfa_reg => |register| switch (vm.current_row.cfa) {
|
||||
.none, .expression => return error.InvalidOperation,
|
||||
.none => {
|
||||
// According to the DWARF specification, this is not valid, because this
|
||||
// instruction can only be used to replace the register if the rule is already a
|
||||
// `.reg_off`. However, this is emitted in practice by GNU toolchains for some
|
||||
// targets, and so by convention is interpreted as equivalent to `.def_cfa` with
|
||||
// an offset of 0.
|
||||
vm.current_row.cfa = .{ .reg_off = .{
|
||||
.register = register,
|
||||
.offset = 0,
|
||||
} };
|
||||
},
|
||||
.expression => return error.InvalidOperation,
|
||||
.reg_off => |*ro| ro.register = register,
|
||||
},
|
||||
.def_cfa_offset => |offset| switch (vm.current_row.cfa) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue