This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA, PATCH] Deprecate stabs if dwarf2 support available.


This is based on an idea from Richard Biener that was mentioned here
    https://gcc.gnu.org/ml/gcc-patches/2017-11/msg02376.html

If we are interested in doing this, it would be accompanied by documentation
changes to state that stabs is now deprecated in favor of dwarf2, release
notes to announce the change, and a configure patch to deprecate --with-stabs.
We will also need a patch for the debug torture testing in the testsuite to
check for the new error.  There may also be other things we need that I haven't
noticed yet.

I tried testing a number of targets that use stabs to see what would happen
with this change.

There are 3 targets that default to stabs, and -g continues to emit stabs
with this patch: m68k-openbsd, pdp11, vax-openbsd.

There are 3 targets that default to stabs, and -g now gives an error: avr-elf,
i386-lynxos, powerpc-lynxos.  avr includes elfos.h which defines
DWARF2_DEBUGGING_INFO.  We can temporarily fix avr by adding a #undef for that.
I think i386-lynxos and powerpc-lynxos should switch to dwarf2, as both i386
and powerpc support dwarf2.  But if necessary, we can temporarily fix them
with the same change.

There are 2 targets that emit dwarf2 by default, but emit stabs when
the --with-stabs configure option is used: mn10300-elf, v850-elf.  They
continue to work fine by default, but -g fails if you use --with-stabs.  The
solution here is to add a configure patch to give an error when --with-stabs
is used.

And of course for the vast majority of targets, which support dwarf2 by
default, -g works fine, and -gstabs now gives an error.

There is also a configuration for cygwin, with an old non-dwarf assembler,
that defaults to stabs, but that probably doesn't even build anymore.  And
there is also a configuration for pre-darwin9 that defaults to stabs, but that
may not be buildable anymore either.

This doesn't break AIX/XCOFF, as we aren't trying to remove any code at this
time.

It is possible that there might also be other targets affected by the change
that I haven't noticed yet.  I tried searching for all targets using stabs,
but might have missed a few.

Jim

	gcc/
	* toplev.c (process_options): If DWARF2_DEBUGGING_INFO defined, and
	write_symbols set to DBX_DEBUG, give an error.
---
 gcc/toplev.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/toplev.c b/gcc/toplev.c
index 2f154960a17..f5cee35234e 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1482,6 +1482,12 @@ process_options (void)
 	      "target system does not support the %qs debug format",
 	      debug_type_names[write_symbols]);
 
+#if defined(DWARF2_DEBUGGING_INFO)
+  if (write_symbols == DBX_DEBUG)
+    error_at (UNKNOWN_LOCATION,
+	      "DBX/stabs debugging info format is deprecated, use DWARF2 instead.");
+#endif
+
   /* We know which debug output will be used so we can set flag_var_tracking
      and flag_var_tracking_uninit if the user has not specified them.  */
   if (debug_info_level < DINFO_LEVEL_NORMAL
-- 
2.14.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]