Incorrect unwind when throwing exceptions - possible cause?

Juraj Oršulić juraj.orsulic@fer.hr
Thu Feb 3 02:15:31 GMT 2022


One additional detail: when I build in debug (-O0), it doesn't crash.
In that case, gcc decides to use an unwind table based on offsets
against the cfa instead of against rbp, which works fine:

     >_ULx86_64_fetch_frame: fetch frame ip=0x55555589afb7
cfa=0x7fffffff94d0 format=0
               >run_cfi_program: CFA_def_cfa r7+0x8
               >run_cfi_program: CFA_offset r16 at cfa+0xfffffffffffffff8
               >run_cfi_program: CFA_advance_loc to 0x5555558855b3
               >run_cfi_program: CFA_def_cfa_offset 0x10
               >run_cfi_program: CFA_offset r6 at cfa+0xfffffffffffffff0
               >run_cfi_program: CFA_advance_loc to 0x5555558855b6
               >run_cfi_program: CFA_def_cfa_register r6
               >run_cfi_program: CFA_advance_loc to 0x5555558855e6
               >run_cfi_program: CFA_offset r13 at cfa+0xffffffffffffffe8
               >run_cfi_program: CFA_offset r12 at cfa+0xffffffffffffffe0
               >run_cfi_program: CFA_offset r3 at cfa+0xffffffffffffffd8




On Thu, Feb 3, 2022 at 2:36 AM Juraj Oršulić <juraj.orsulic@fer.hr> wrote:
>
> Hi Sam, thanks for replying. The example wasn't meant to be compile
> (sure, I missed the class closing brace and omitted storing argc).
> That's not the point.
> To reproduce it I would need to include a bunch of other code from the
> codebase and put it inside ::process().
> The point is that the mere presence of this code causes it to crash
> if I throw right at the beginning -- I don't even execute any of that code.
> I'm trying to figure out why the DWARF unwinding code becomes incorrect,
> as I described in detail.
>
>
>
> Sam Varshavchik wrote:
>
> > This was slimmed down too much. I don't see how this would compile.


More information about the Gcc-help mailing list