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

            Bug ID: 96948
           Summary: _Unwind_GetIP() and _Unwind_GetIPInfo() empty in
                    _Unwind_Backtrace() with SEH on mingw64
           Product: gcc
           Version: 8.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgcc
          Assignee: unassigned at gcc dot gnu.org
          Reporter: krlmlr+gcc at mailbox dot org
  Target Milestone: ---

Created attachment 49187
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49187&action=edit
Reproducible example

The attached program, modeled after `btest.c` in libbacktrace, produces the
following output in mingw64 (SEH):

0/0[0] (403180)
0/0[0] (4015da)
0/0[0] (4011a0)
0/0[0] (401510)
0/0[0] (7ffb6e4d7bc0)
0/0[0] (7ffb6e90ce30)

The first two numbers are _Unwind_GetIP() and _Unwind_GetIPInfo(). The last
number is _Unwind_GetRegionStart(), which appears to be correct. Note how the
first address is different from the next three -- this seems to be located in
libgcc and should be stripped.

Applying https://github.com/gcc-mirror/gcc/pull/48 gives the following:

4015ff/4015ff[0] (4015da)
4013c5/4013c5[0] (4011a0)
40152b/40152b[0] (401510)
7ffb6e4d7bd4/7ffb6e4d7bd4[0] (7ffb6e4d7bc0)
7ffb6e90ce51/7ffb6e90ce51[0] (7ffb6e90ce30)

Raw patch attached.

Tested on Windows in gcc 8.3.0 in the rtools40 toolchain, a custom msys2
environment: https://cran.r-project.org/bin/windows/Rtools/. The mingw32 (SJLJ)
version is not affected.

Reply via email to