https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103510

            Bug ID: 103510
           Summary: _Unwind_GetGR crashed for uninitialized registers
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgcc
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ashimida at linux dot alibaba.com
  Target Milestone: ---

When use _Unwind_Backtrace with a callback funciton for backtrace,
if the reg corresponding to i is not initialized when calling 
_Unwind_GetGR(context, i) in the callback, it will cause a crash
due to 0 address dereference.

Although the register status can be predicted by calling 
_Unwind_GetGRPtr or other methods, these functions are not within
the LSB standard.

Clang works fine for this. Is there any way for me to write a common
backtrace function that uses _Unwind_Backtrace, or is it reasonable 
to initialize all context->reg[x] with the values of all hardware
registers at the beginning of unwind?

Reply via email to