Currently in config/i386/cygming.h we have this:

#undef DBX_REGISTER_NUMBER
#define DBX_REGISTER_NUMBER(n) (write_symbols == DWARF2_DEBUG   \
                                ? svr4_dbx_register_map[n]      \
                                : dbx_register_map[n])

This is fine as long as we assume that cygwin and mingw32 will always
use only SjLj EH model. However, once we move to Dwarf 2 unwind, it will
cause serious problems with exception handling when we mix objects with
DW2_DEBUG with objects with other or no debug info: The register mapping
for unwind frames (and in particular for SP and BP) will not be
consistent across objects.

A testcase for this is already present in g++.dg/eh/spbp.C

One 'easy' solution to the EH problem is to simply use the default i386
dbx_register_map regardless of the type of debug info. Or since a change
to DW2 unwind is a pretty major ABI change anyway, we could make the
svr4 dwarf2 mapping the new standard if DWARF_UNWIND_INFO.

Finally, we could do what x86-darwin does and do a remapping back from
the svr4 dwarf debug map to a default EH frame map, like so:

/* Unfortunately, the 32-bit EH information also doesn't use the
standard
   DWARF register numbers.  */
#define DWARF2_FRAME_REG_OUT(n, for_eh)
\
  (! (for_eh) || write_symbols != DWARF2_DEBUG || TARGET_64BIT ? (n)
\
   : (n) == 5 ? 4
\
   : (n) == 4 ? 5
\
   : (n) >= 11 && (n) <= 18 ? (n) + 1
\
   : (n))


Any other ideas?  What is likely GDB fallout?

Danny

Reply via email to