return err;
}
+/* Translate DW_CFA_undefined into SFrame context.
+
+ DW_CFA_undefined op indicates that from now on, the previous value of
+ register can’t be restored anymore. In SFrame stack trace, we cannot
+ represent such a semantic. So, we skip generating an SFrame FDE for this,
+ when a register of interest is used with DW_CFA_undefined.
+
+ Return SFRAME_XLATE_OK if success. */
+
+static int
+sframe_xlate_do_cfi_undefined (const struct sframe_xlate_ctx *xlate_ctx ATTRIBUTE_UNUSED,
+ const struct cfi_insn_data *cfi_insn)
+{
+ if (cfi_insn->u.r == SFRAME_CFA_FP_REG
+ || cfi_insn->u.r == SFRAME_CFA_RA_REG
+ || cfi_insn->u.r == SFRAME_CFA_SP_REG)
+ {
+ as_warn (_("no SFrame FDE emitted; %s reg %u in .cfi_undefined"),
+ sframe_register_name (cfi_insn->u.r), cfi_insn->u.r);
+ return SFRAME_XLATE_ERR_NOTREPRESENTED; /* Not represented. */
+ }
+
+ /* Safe to skip. */
+ return SFRAME_XLATE_OK;
+}
+
/* Returns the DWARF call frame instruction name or fake CFI name for the
specified CFI opcode, or NULL if the value is not recognized. */
These do not impact the coverage of the basic stack tracing
information as conveyed in the SFrame format. */
case DW_CFA_undefined:
+ err = sframe_xlate_do_cfi_undefined (xlate_ctx, cfi_insn);
+ break;
case DW_CFA_same_value:
break;
default:
--- /dev/null
+#as: --gsframe
+#objdump: --sframe=.sframe
+#name: SFrame cfi_undefined test
+#...
+Contents of the SFrame section .sframe:
+
+ Header :
+
+ Version: SFRAME_VERSION_2
+ Flags: NONE
+#? CFA fixed FP offset: \-?\d+
+#? CFA fixed RA offset: \-?\d+
+ Num FDEs: 1
+ Num FREs: 2
+
+ Function Index :
+ func idx \[0\]: pc = 0x0, size = 8 bytes
+ STARTPC + CFA + FP + RA +
+#...
+ 0+0004 +sp\+16 +u +[uf] +
+
+#pass
--- /dev/null
+## cfi_undefined when used with "not interesting" registers (from the
+## perspective of SFrame section, non SP/FP/RA registers are not
+## interesting) does not affect the asynchronicity of the SFrame
+## stack trace information. Such CFI directives can be skipped for SFrame
+## stack trace info generation.
+ .cfi_startproc
+ .long 0
+ .cfi_def_cfa_offset 16
+ .cfi_undefined 1
+ .cfi_undefined 2
+ .long 0
+ .cfi_endproc
--- /dev/null
+#as: --gsframe
+#warning: SP reg 7 in \.cfi\_undefined
+#objdump: --sframe=.sframe
+#name: DW_CFA_undefined with register SP
+#...
+Contents of the SFrame section .sframe:
+
+ Header :
+
+ Version: SFRAME_VERSION_2
+ Flags: NONE
+#? CFA fixed FP offset: \-?\d+
+#? CFA fixed RA offset: \-?\d+
+ Num FDEs: 0
+ Num FREs: 0
+
+#pass
--- /dev/null
+ .cfi_startproc
+ .long 0
+ .cfi_def_cfa_offset 16
+ .cfi_undefined 7
+ .long 0
+ .cfi_endproc
run_dump_test "cfi-sframe-common-7"
run_dump_test "cfi-sframe-common-8"
run_dump_test "cfi-sframe-common-9"
+ run_dump_test "cfi-sframe-common-10"
run_dump_test "common-empty-1"
run_dump_test "common-empty-2"
run_dump_test "cfi-sframe-x86_64-empty-1"
run_dump_test "cfi-sframe-x86_64-empty-2"
run_dump_test "cfi-sframe-x86_64-empty-3"
+ run_dump_test "cfi-sframe-x86_64-empty-4"
set ASFLAGS "$old_ASFLAGS"
}
}