On Wed Oct 19 16:21:50 2022 +0000, Rémi Bernon wrote:
Looking at GDB source I believe my understanding is correct, and so `.cfi_same_value` was right (and as we're using it already elsewhere, probably better):
case DWARF2_FRAME_REG_SAVED_REG: realnum = dwarf_reg_to_regnum_or_error (gdbarch, cache->reg[regnum].loc.reg); return frame_unwind_got_register (this_frame, regnum, realnum); /* ... */ case DWARF2_FRAME_REG_UNSPECIFIED: /* GCC, in its infinite wisdom decided to not provide unwind information for registers that are "same value". Since DWARF2 (3 draft 7) doesn't define such behavior, said registers are actually undefined (which is different to CFI "undefined"). Code above issues a complaint about this. Here just fudge the books, assume GCC, and that the value is more inner on the stack. */ return frame_unwind_got_register (this_frame, regnum, regnum); case DWARF2_FRAME_REG_SAME_VALUE: return frame_unwind_got_register (this_frame, regnum, regnum);
As you can see, it implements `.cfi_same_value x` the same as `.cfi_register x, x` here. It also assumes unspecified registers have a default of `.cfi_same_value` too, so I'd say it's not required to specify that for xmm register at the top of the function.
Thanks. You were right. We discussed this internally. When writing this, I somehow confused the semantic of "previous frame". I also think it is save to assume "undefined" being "same value" for most unwinders, as this seem to be also what clang and gcc are producing.