From: James E Wilson Date: Sun, 29 Oct 2017 22:45:41 +0000 (-0700) Subject: Delete obsolete SDB debug info support. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=180295ed63192b951a6ed9dae07eefc7fd55a3d1;p=gcc.git Delete obsolete SDB debug info support. gcc/ * Makefile.in (OBJS): Delete sdbout.o. (GTFILES): Delete $(srcdir)/sdbout.c. * debug.h: Delete sdb_debug_hooks. * final.c: Delete sdbout.h include. (final_scan_insn): Delete SDB_DEBUG check. (rest_of_clean_state): Likewise. * output.h: Delete sdb_begin_function_line. * sdbout.c: Delete. * sdbout.h: Delete. * toplev.c: Delete sdbout.h include. (process_options): Delete SDB_DEBUG check. * tree-core.h (tree_type_common): Delete pointer field of tree_type_symtab. * tree.c (copy_node): Clear TYPE_SYMTAB_DIE instead of TYPE_SYMTAB_POINTER. * tree.h (TYPE_SYMTAB_POINTER): Delete. (TYPE_SYMTAB_IS_POINTER): Delete. (TYPE_SYMTAB_IS_DIE): Renumber. * xcoffout.c: Refer to former sdbout.c file. (xcoffout_begin_prologue): Use past tense for sdbout.c reference. * doc/install.texi (--with-stabs): Delete COFF and ECOFF info. * doc/invoke.texi (SEEALSO): Delete adb and sdb references. (Debugging Options): Delete -gcoff. (-gstabs): Delete SDB reference. (-gcoff): Delete. (-gcoff@var{level}): Delete. * doc/passes.texi (Debugging information output): Delete SDB and sdbout.c references. * doc/tm.texi: Regenerate. * doc/tm.texi.in (DWARF_CIE_DATA_ALIGNMENT): Delete SDB from xref. (SDB and DWARF): Change node name to DWARF and delete SDB and COFF references. (DEBUGGER_AUTO_OFFSET): Delete COFF and SDB references. (PREFERRED_DEBUGGING_TYPE): Delete SDB_DEBUG and -gcoff references. (SDB_DEBUGGING_INFO): Delete. (PUT_SDB_@dots{}, SDB_DELIM, SDB_ALLOW_UNKNOWN_REFERENCES) SDB_ALLOW_FORWARD_REFERENCES, SDB_OUTPUT_SOURCE_LINE): Delete. * target.def (output_source_filename): Delete COFF reference. * common.opt (gcoff): Delete. (gxcoff+): Update Negative chain. * defaults.h: Delete all references to SDB_DEBUGGING_INFO and SDB_DEBUG. * dwarf2out.c (gen_array_type_die): Change SDB to debuggers. * flag-types.h (enum debug_info_type): Delete SDB_DEBUG. * function.c (number_blocks): Delete SDB_DEBUGGING_INFO, SDB_DEBUG, and SDB references. (expand_function_start): Change sdb reference to past tense. (expand_function_end): Change sdb reference to past tense. * gcc.c (cpp_unique_options): Delete gcoff3 reference. * opts.c (debug_type_names): Delete coff entry. (common_handle_option): Delete OPT_gcoff case. * system.h (SDB_DEBUG, SDB_DEBUGGING_INFO): Poison. * config/dbxcoff.h (PREFERRED_DEBUGGING_TYPE): Set to DBX_DEBUG. * config/cris/cris.h: Delete SDB reference in comment. * config/i386/cygming.h: Don't define SDB_DEBUGGING_INFO. (ASM_DECLARE_FUNCTION_NAME): Delete SDB reference from comment. * config/i386/gas.h: Don't define SDB_DEBUGGING_INFO. * config/i386/i386.c (svr4_dbx_register_map): Change SDB references to past tense. (ix86_expand_prologue): Likewise. * config/i386/winnt.c (i386_pe_start_function): Don't check SDB_DEBUG. * config/ia64/ia64.h: Likewise. * config/m68k/m68kelf.h (DBX_REGISTER_NUMBER): Delete SDB reference. * config/mips/mips.h (SUBTARGET_ASM_DEBUGGING_SPEC): Delete gcoff* support. * config/mmix/mmix.h: Likewise. * config/nds32/nds32.c: Likewise. * config/stormy/storym16.h: Likewise. * config/visium/visium.h: Likewise. * config/vx-common.h (SDB_DEBUGGING_INFO): Delete undef. gcc/fortran/ * invoke.texi: Delete adb and sdb references. gccc/testsuite/ * lib/gcc-dg.exp (gcc-dg-debug-runtest): Delete -gcoff. * lib/gfortran-dg.exp (gfortran-dg-debug-runtest): Delete -gcoff. From-SVN: r254206 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index baa24058a55..0af15fcd7e2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,79 @@ +2017-10-29 Jim Wilson + + * Makefile.in (OBJS): Delete sdbout.o. + (GTFILES): Delete $(srcdir)/sdbout.c. + * debug.h: Delete sdb_debug_hooks. + * final.c: Delete sdbout.h include. + (final_scan_insn): Delete SDB_DEBUG check. + (rest_of_clean_state): Likewise. + * output.h: Delete sdb_begin_function_line. + * sdbout.c: Delete. + * sdbout.h: Delete. + * toplev.c: Delete sdbout.h include. + (process_options): Delete SDB_DEBUG check. + * tree-core.h (tree_type_common): Delete pointer field of + tree_type_symtab. + * tree.c (copy_node): Clear TYPE_SYMTAB_DIE instead of + TYPE_SYMTAB_POINTER. + * tree.h (TYPE_SYMTAB_POINTER): Delete. + (TYPE_SYMTAB_IS_POINTER): Delete. + (TYPE_SYMTAB_IS_DIE): Renumber. + * xcoffout.c: Refer to former sdbout.c file. + (xcoffout_begin_prologue): Use past tense for sdbout.c reference. + + * doc/install.texi (--with-stabs): Delete COFF and ECOFF info. + * doc/invoke.texi (SEEALSO): Delete adb and sdb references. + (Debugging Options): Delete -gcoff. + (-gstabs): Delete SDB reference. + (-gcoff): Delete. + (-gcoff@var{level}): Delete. + * doc/passes.texi (Debugging information output): Delete SDB and + sdbout.c references. + * doc/tm.texi: Regenerate. + * doc/tm.texi.in (DWARF_CIE_DATA_ALIGNMENT): Delete SDB from xref. + (SDB and DWARF): Change node name to DWARF and delete SDB and COFF + references. + (DEBUGGER_AUTO_OFFSET): Delete COFF and SDB references. + (PREFERRED_DEBUGGING_TYPE): Delete SDB_DEBUG and -gcoff references. + (SDB_DEBUGGING_INFO): Delete. + (PUT_SDB_@dots{}, SDB_DELIM, SDB_ALLOW_UNKNOWN_REFERENCES) + SDB_ALLOW_FORWARD_REFERENCES, SDB_OUTPUT_SOURCE_LINE): Delete. + * target.def (output_source_filename): Delete COFF reference. + + * common.opt (gcoff): Delete. + (gxcoff+): Update Negative chain. + * defaults.h: Delete all references to SDB_DEBUGGING_INFO and + SDB_DEBUG. + * dwarf2out.c (gen_array_type_die): Change SDB to debuggers. + * flag-types.h (enum debug_info_type): Delete SDB_DEBUG. + * function.c (number_blocks): Delete SDB_DEBUGGING_INFO, SDB_DEBUG, + and SDB references. + (expand_function_start): Change sdb reference to past tense. + (expand_function_end): Change sdb reference to past tense. + * gcc.c (cpp_unique_options): Delete gcoff3 reference. + * opts.c (debug_type_names): Delete coff entry. + (common_handle_option): Delete OPT_gcoff case. + * system.h (SDB_DEBUG, SDB_DEBUGGING_INFO): Poison. + + * config/dbxcoff.h (PREFERRED_DEBUGGING_TYPE): Set to DBX_DEBUG. + * config/cris/cris.h: Delete SDB reference in comment. + * config/i386/cygming.h: Don't define SDB_DEBUGGING_INFO. + (ASM_DECLARE_FUNCTION_NAME): Delete SDB reference from comment. + * config/i386/gas.h: Don't define SDB_DEBUGGING_INFO. + * config/i386/i386.c (svr4_dbx_register_map): Change SDB references + to past tense. + (ix86_expand_prologue): Likewise. + * config/i386/winnt.c (i386_pe_start_function): Don't check SDB_DEBUG. + * config/ia64/ia64.h: Likewise. + * config/m68k/m68kelf.h (DBX_REGISTER_NUMBER): Delete SDB reference. + * config/mips/mips.h (SUBTARGET_ASM_DEBUGGING_SPEC): Delete gcoff* + support. + * config/mmix/mmix.h: Likewise. + * config/nds32/nds32.c: Likewise. + * config/stormy/storym16.h: Likewise. + * config/visium/visium.h: Likewise. + * config/vx-common.h (SDB_DEBUGGING_INFO): Delete undef. + 2017-10-28 Sandra Loosemore * config/nios2/nios2.h (FRAME_GROWS_DOWNWARD): Define to 1. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 2809619031b..9b4cedf3df4 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1446,7 +1446,6 @@ OBJS = \ sched-deps.o \ sched-ebb.o \ sched-rgn.o \ - sdbout.o \ sel-sched-ir.o \ sel-sched-dump.o \ sel-sched.o \ @@ -2525,7 +2524,7 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \ $(srcdir)/lists.c $(srcdir)/optabs-libfuncs.c \ $(srcdir)/profile.c $(srcdir)/mcf.c \ $(srcdir)/reg-stack.c $(srcdir)/cfgrtl.c \ - $(srcdir)/sdbout.c $(srcdir)/stor-layout.c \ + $(srcdir)/stor-layout.c \ $(srcdir)/stringpool.c $(srcdir)/tree.c $(srcdir)/varasm.c \ $(srcdir)/gimple.h \ $(srcdir)/gimple-ssa.h \ diff --git a/gcc/common.opt b/gcc/common.opt index d5e831d6b4c..5abd32286d9 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -2872,10 +2872,6 @@ g Common Driver RejectNegative JoinedOrMissing Generate debug information in default format. -gcoff -Common Driver JoinedOrMissing Negative(gdwarf) -Generate debug information in COFF format. - gcolumn-info Common Driver Var(debug_column_info,1) Init(1) Record DW_AT_decl_column and DW_AT_call_column in DWARF. @@ -2941,7 +2937,7 @@ Common Driver JoinedOrMissing Negative(gxcoff+) Generate debug information in XCOFF format. gxcoff+ -Common Driver JoinedOrMissing Negative(gcoff) +Common Driver JoinedOrMissing Negative(gdwarf) Generate debug information in extended XCOFF format. Enum diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h index f9149c717a7..892a3724393 100644 --- a/gcc/config/cris/cris.h +++ b/gcc/config/cris/cris.h @@ -998,7 +998,7 @@ enum cris_symbol_type /* (no definitions) */ -/* Node: SDB and DWARF */ +/* Node: DWARF */ /* (no definitions) */ /* Node: Misc */ diff --git a/gcc/config/dbxcoff.h b/gcc/config/dbxcoff.h index e5eef64f60e..c20b4fe77b1 100644 --- a/gcc/config/dbxcoff.h +++ b/gcc/config/dbxcoff.h @@ -25,10 +25,10 @@ along with GCC; see the file COPYING3. If not see #define DBX_DEBUGGING_INFO 1 -/* Generate SDB debugging information by default. */ +/* Generate DBX debugging information by default. */ #ifndef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG #endif /* Be function-relative for block and source line stab directives. */ diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h index a731e2f6c6a..1ed9b170d43 100644 --- a/gcc/config/i386/cygming.h +++ b/gcc/config/i386/cygming.h @@ -19,7 +19,6 @@ along with GCC; see the file COPYING3. If not see . */ #define DBX_DEBUGGING_INFO 1 -#define SDB_DEBUGGING_INFO 1 #if TARGET_64BIT_DEFAULT || defined (HAVE_GAS_PE_SECREL32_RELOC) #define DWARF2_DEBUGGING_INFO 1 #endif @@ -308,8 +307,7 @@ do { \ #define TARGET_SECTION_TYPE_FLAGS i386_pe_section_type_flags /* Write the extra assembler code needed to declare a function - properly. If we are generating SDB debugging information, this - will happen automatically, so we only need to handle other cases. */ + properly. */ #undef ASM_DECLARE_FUNCTION_NAME #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ i386_pe_start_function (FILE, NAME, DECL) diff --git a/gcc/config/i386/gas.h b/gcc/config/i386/gas.h index 9b42787f6b1..862c1c2cb83 100644 --- a/gcc/config/i386/gas.h +++ b/gcc/config/i386/gas.h @@ -40,10 +40,6 @@ along with GCC; see the file COPYING3. If not see #undef DBX_NO_XREFS #undef DBX_CONTIN_LENGTH -/* Ask for COFF symbols. */ - -#define SDB_DEBUGGING_INFO 1 - /* Output #ident as a .ident. */ #undef TARGET_ASM_OUTPUT_IDENT diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 80c8ce7ecb9..a66b433d78d 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -301,7 +301,7 @@ int const dbx64_register_map[FIRST_PSEUDO_REGISTER] = 7 for %edi (gcc regno = 5) The following three DWARF register numbers are never generated by the SVR4 C compiler or by the GNU compilers, but SDB on x86/svr4 - believes these numbers have these meanings. + believed these numbers have these meanings. 8 for %eip (no gcc equivalent) 9 for %eflags (gcc regno = 17) 10 for %trapno (no gcc equivalent) @@ -309,20 +309,20 @@ int const dbx64_register_map[FIRST_PSEUDO_REGISTER] = for the x86 architecture. If the version of SDB on x86/svr4 were a bit less brain dead with respect to floating-point then we would have a precedent to follow with respect to DWARF register numbers - for x86 FP registers, but the SDB on x86/svr4 is so completely + for x86 FP registers, but the SDB on x86/svr4 was so completely broken with respect to FP registers that it is hardly worth thinking of it as something to strive for compatibility with. - The version of x86/svr4 SDB I have at the moment does (partially) + The version of x86/svr4 SDB I had does (partially) seem to believe that DWARF register number 11 is associated with the x86 register %st(0), but that's about all. Higher DWARF register numbers don't seem to be associated with anything in - particular, and even for DWARF regno 11, SDB only seems to under- + particular, and even for DWARF regno 11, SDB only seemed to under- stand that it should say that a variable lives in %st(0) (when asked via an `=' command) if we said it was in DWARF regno 11, - but SDB still prints garbage when asked for the value of the + but SDB still printed garbage when asked for the value of the variable in question (via a `/' command). - (Also note that the labels SDB prints for various FP stack regs - when doing an `x' command are all wrong.) + (Also note that the labels SDB printed for various FP stack regs + when doing an `x' command were all wrong.) Note that these problems generally don't affect the native SVR4 C compiler because it doesn't allow the use of -O with -g and because when it is *not* optimizing, it allocates a memory @@ -13020,7 +13020,7 @@ ix86_expand_prologue (void) if (frame_pointer_needed && !m->fs.fp_valid) { /* Note: AT&T enter does NOT have reversed args. Enter is probably - slower on all targets. Also sdb doesn't like it. */ + slower on all targets. Also sdb didn't like it. */ insn = emit_insn (gen_push (hard_frame_pointer_rtx)); RTX_FRAME_RELATED_P (insn) = 1; diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c index 405f74a7597..61d94d264f0 100644 --- a/gcc/config/i386/winnt.c +++ b/gcc/config/i386/winnt.c @@ -1215,8 +1215,7 @@ void i386_pe_start_function (FILE *f, const char *name, tree decl) { i386_pe_maybe_record_exported_symbol (decl, name, 0); - if (write_symbols != SDB_DEBUG) - i386_pe_declare_function_type (f, name, TREE_PUBLIC (decl)); + i386_pe_declare_function_type (f, name, TREE_PUBLIC (decl)); /* In case section was altered by debugging output. */ if (decl != NULL_TREE) switch_to_section (function_section (decl)); diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h index e7073d1cf20..eceab5f23b6 100644 --- a/gcc/config/ia64/ia64.h +++ b/gcc/config/ia64/ia64.h @@ -1470,7 +1470,7 @@ do { \ /* Likewise. */ -/* Macros for SDB and Dwarf Output. */ +/* Macros for Dwarf Output. */ /* Define this macro if GCC should produce dwarf version 2 format debugging output in response to the `-g' option. */ diff --git a/gcc/config/m68k/m68kelf.h b/gcc/config/m68k/m68kelf.h index fb1a0a4d917..159223f64c7 100644 --- a/gcc/config/m68k/m68kelf.h +++ b/gcc/config/m68k/m68kelf.h @@ -97,7 +97,7 @@ do { \ /* Define how the m68k registers should be numbered for Dwarf output. The numbering provided here should be compatible with the native - SVR4 SDB debugger in the m68k/SVR4 reference port, where d0-d7 + SVR4 debugger in the m68k/SVR4 reference port, where d0-d7 are 0-7, a0-a8 are 8-15, and fp0-fp7 are 16-23. */ #undef DBX_REGISTER_NUMBER diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 550d283158e..f5c28bf70e3 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -1314,9 +1314,7 @@ struct mips_cpu_info { %{g} %{g0} %{g1} %{g2} %{g3} \ %{ggdb:-g} %{ggdb0:-g0} %{ggdb1:-g1} %{ggdb2:-g2} %{ggdb3:-g3} \ %{gstabs:-g} %{gstabs0:-g0} %{gstabs1:-g1} %{gstabs2:-g2} %{gstabs3:-g3} \ -%{gstabs+:-g} %{gstabs+0:-g0} %{gstabs+1:-g1} %{gstabs+2:-g2} %{gstabs+3:-g3} \ -%{gcoff:-g} %{gcoff0:-g0} %{gcoff1:-g1} %{gcoff2:-g2} %{gcoff3:-g3} \ -%{gcoff*:-mdebug} %{!gcoff*:-no-mdebug}" +%{gstabs+:-g} %{gstabs+0:-g0} %{gstabs+1:-g1} %{gstabs+2:-g2} %{gstabs+3:-g3}" #endif /* FP_ASM_SPEC represents the floating-point options that must be passed diff --git a/gcc/config/mmix/mmix.h b/gcc/config/mmix/mmix.h index 5dafe2dbf98..2ee3592f3c8 100644 --- a/gcc/config/mmix/mmix.h +++ b/gcc/config/mmix/mmix.h @@ -761,7 +761,7 @@ typedef struct { int regs; int lib; } CUMULATIVE_ARGS; /* (empty) */ -/* Node: SDB and DWARF */ +/* Node: DWARF */ #define DWARF2_DEBUGGING_INFO 1 #define DWARF2_ASM_LINE_DEBUG_INFO 1 diff --git a/gcc/config/nds32/nds32.c b/gcc/config/nds32/nds32.c index c1eb66abc17..b0d5e48a651 100644 --- a/gcc/config/nds32/nds32.c +++ b/gcc/config/nds32/nds32.c @@ -3763,7 +3763,7 @@ nds32_target_alignment (rtx_insn *label) /* -- File Names in DBX Format. */ -/* -- Macros for SDB and DWARF Output. */ +/* -- Macros for DWARF Output. */ /* -- Macros for VMS Debug Format. */ diff --git a/gcc/config/stormy16/stormy16.h b/gcc/config/stormy16/stormy16.h index 3f8a5355175..1d7045759c5 100644 --- a/gcc/config/stormy16/stormy16.h +++ b/gcc/config/stormy16/stormy16.h @@ -446,7 +446,7 @@ enum reg_class #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG -/* Macros for SDB and Dwarf Output. */ +/* Macros for Dwarf Output. */ /* Define this macro if addresses in Dwarf 2 debugging info should not be the same size as pointers on the target architecture. The diff --git a/gcc/config/visium/visium.h b/gcc/config/visium/visium.h index 3b229f1a1e6..85735953968 100644 --- a/gcc/config/visium/visium.h +++ b/gcc/config/visium/visium.h @@ -1527,9 +1527,8 @@ do \ automatic variable having address X (an RTL expression). The default computation assumes that X is based on the frame-pointer and gives the offset from the frame-pointer. This is required for - targets that produce debugging output for DBX or COFF-style - debugging output for SDB and allow the frame-pointer to be - eliminated when the `-g' options is used. */ + targets that produce debugging output for DBX and allow the frame-pointer + to be eliminated when the `-g' options is used. */ #define DEBUGGER_AUTO_OFFSET(X) \ (GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0) diff --git a/gcc/config/vx-common.h b/gcc/config/vx-common.h index 5cc965cab78..d8f04eced4d 100644 --- a/gcc/config/vx-common.h +++ b/gcc/config/vx-common.h @@ -72,7 +72,6 @@ along with GCC; see the file COPYING3. If not see /* None of these other formats is supported. */ #undef DWARF_DEBUGGING_INFO #undef DBX_DEBUGGING_INFO -#undef SDB_DEBUGGING_INFO #undef XCOFF_DEBUGGING_INFO #undef VMS_DEBUGGING_INFO diff --git a/gcc/debug.h b/gcc/debug.h index 915420baded..19b27848ca8 100644 --- a/gcc/debug.h +++ b/gcc/debug.h @@ -228,7 +228,6 @@ extern void debug_nothing_tree_charstar_uhwi (tree, const char *, /* Hooks for various debug formats. */ extern const struct gcc_debug_hooks do_nothing_debug_hooks; extern const struct gcc_debug_hooks dbx_debug_hooks; -extern const struct gcc_debug_hooks sdb_debug_hooks; extern const struct gcc_debug_hooks xcoff_debug_hooks; extern const struct gcc_debug_hooks dwarf2_debug_hooks; extern const struct gcc_debug_hooks dwarf2_lineno_debug_hooks; diff --git a/gcc/defaults.h b/gcc/defaults.h index 99cd9db5191..768c9879df9 100644 --- a/gcc/defaults.h +++ b/gcc/defaults.h @@ -894,14 +894,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define DEFAULT_GDB_EXTENSIONS 1 #endif -#ifndef SDB_DEBUGGING_INFO -#define SDB_DEBUGGING_INFO 0 -#endif - /* If more than one debugging type is supported, you must define PREFERRED_DEBUGGING_TYPE to choose the default. */ -#if 1 < (defined (DBX_DEBUGGING_INFO) + (SDB_DEBUGGING_INFO) \ +#if 1 < (defined (DBX_DEBUGGING_INFO) \ + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO) \ + defined (VMS_DEBUGGING_INFO)) #ifndef PREFERRED_DEBUGGING_TYPE @@ -913,9 +909,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #elif defined DBX_DEBUGGING_INFO #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG -#elif SDB_DEBUGGING_INFO -#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG - #elif defined DWARF2_DEBUGGING_INFO || defined DWARF2_LINENO_DEBUGGING_INFO #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 34fef377634..49737ad9fc6 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -1007,31 +1007,6 @@ Specify that stabs debugging information should be used instead of whatever format the host normally uses. Normally GCC uses the same debug format as the host system. -On MIPS based systems and on Alphas, you must specify whether you want -GCC to create the normal ECOFF debugging format, or to use BSD-style -stabs passed through the ECOFF symbol table. The normal ECOFF debug -format cannot fully handle languages other than C@. BSD stabs format can -handle other languages, but it only works with the GNU debugger GDB@. - -Normally, GCC uses the ECOFF debugging format by default; if you -prefer BSD stabs, specify @option{--with-stabs} when you configure GCC@. - -No matter which default you choose when you configure GCC, the user -can use the @option{-gcoff} and @option{-gstabs+} options to specify explicitly -the debug format for a particular compilation. - -@option{--with-stabs} is meaningful on the ISC system on the 386, also, if -@option{--with-gas} is used. It selects use of stabs debugging -information embedded in COFF output. This kind of debugging information -supports C++ well; ordinary COFF debugging information does not. - -@option{--with-stabs} is also meaningful on 386 systems running SVR4. It -selects use of stabs debugging information embedded in ELF output. The -C++ compiler currently (2.6.0) does not support the DWARF debugging -information normally used on 386 SVR4 platforms; stabs provide a -workable alternative. This requires gas and gdb, as the normal SVR4 -tools can not generate or interpret stabs. - @item --with-tls=@var{dialect} Specify the default TLS dialect, for systems were there is a choice. For ARM targets, possible values for @var{dialect} are @code{gnu} or diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 0474cee0487..8df09020f14 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -45,7 +45,7 @@ remainder. @command{g++} accepts mostly the same options as @command{gcc}. @c man end @c man begin SEEALSO gpl(7), gfdl(7), fsf-funding(7), -cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1) +cpp(1), gcov(1), as(1), ld(1), gdb(1), dbx(1) and the Info entries for @file{gcc}, @file{cpp}, @file{as}, @file{ld}, @file{binutils} and @file{gdb}. @c man end @@ -342,7 +342,7 @@ Objective-C and Objective-C++ Dialects}. @item Debugging Options @xref{Debugging Options,,Options for Debugging Your Program}. -@gccoptlist{-g -g@var{level} -gcoff -gdwarf -gdwarf-@var{version} @gol +@gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol -gcolumn-info -gno-column-info @gol @@ -6901,7 +6901,7 @@ in their names, but apply to all currently-supported versions of DWARF. Produce debugging information in stabs format (if that is supported), without GDB extensions. This is the format used by DBX on most BSD systems. On MIPS, Alpha and System V Release 4 systems this option -produces stabs debugging output that is not understood by DBX or SDB@. +produces stabs debugging output that is not understood by DBX@. On System V Release 4 systems this option requires the GNU assembler. @item -gstabs+ @@ -6911,12 +6911,6 @@ using GNU extensions understood only by the GNU debugger (GDB)@. The use of these extensions is likely to make other debuggers crash or refuse to read the program. -@item -gcoff -@opindex gcoff -Produce debugging information in COFF format (if that is supported). -This is the format used by SDB on most System V systems prior to -System V Release 4. - @item -gxcoff @opindex gxcoff Produce debugging information in XCOFF format (if that is supported). @@ -6938,7 +6932,6 @@ supported). This is the format used by DEBUG on Alpha/VMS systems. @item -g@var{level} @itemx -ggdb@var{level} @itemx -gstabs@var{level} -@itemx -gcoff@var{level} @itemx -gxcoff@var{level} @itemx -gvms@var{level} Request debugging information and also use @var{level} to specify how diff --git a/gcc/doc/passes.texi b/gcc/doc/passes.texi index 93e70ee6406..2bf786c2568 100644 --- a/gcc/doc/passes.texi +++ b/gcc/doc/passes.texi @@ -981,11 +981,10 @@ these files. This is run after final because it must output the stack slot offsets for pseudo registers that did not get hard registers. Source files -are @file{dbxout.c} for DBX symbol table format, @file{sdbout.c} for -SDB symbol table format, @file{dwarfout.c} for DWARF symbol table -format, files @file{dwarf2out.c} and @file{dwarf2asm.c} for DWARF2 -symbol table format, and @file{vmsdbgout.c} for VMS debug symbol table -format. +are @file{dbxout.c} for DBX symbol table format, @file{dwarfout.c} for +DWARF symbol table format, files @file{dwarf2out.c} and @file{dwarf2asm.c} +for DWARF2 symbol table format, and @file{vmsdbgout.c} for VMS debug +symbol table format. @end itemize diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index c02f4d35116..be8b3620684 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -7699,7 +7699,7 @@ for the file format in use is appropriate. @end defmac @deftypefn {Target Hook} void TARGET_ASM_OUTPUT_SOURCE_FILENAME (FILE *@var{file}, const char *@var{name}) -Output COFF information or DWARF debugging information which indicates that filename @var{name} is the current source file to the stdio stream @var{file}. +Output DWARF debugging information which indicates that filename @var{name} is the current source file to the stdio stream @var{file}. This target hook need not be defined if the standard form of output for the file format in use is appropriate. @end deftypefn @@ -9347,7 +9347,7 @@ This macro need only be defined if the target might save registers in the function prologue at an offset to the stack pointer that is not aligned to @code{UNITS_PER_WORD}. The definition should be the negative minimum alignment if @code{STACK_GROWS_DOWNWARD} is true, and the positive -minimum alignment otherwise. @xref{SDB and DWARF}. Only applicable if +minimum alignment otherwise. @xref{DWARF}. Only applicable if the target supports DWARF 2 frame unwind information. @end defmac @@ -9521,7 +9521,7 @@ This describes how to specify debugging information. * DBX Options:: Macros enabling specific options in DBX format. * DBX Hooks:: Hook macros for varying DBX format. * File Names and DBX:: Macros controlling output of file names in DBX format. -* SDB and DWARF:: Macros for SDB (COFF) and DWARF formats. +* DWARF:: Macros for DWARF format. * VMS Debug:: Macros for VMS debug format. @end menu @@ -9555,9 +9555,8 @@ A C expression that returns the integer offset value for an automatic variable having address @var{x} (an RTL expression). The default computation assumes that @var{x} is based on the frame-pointer and gives the offset from the frame-pointer. This is required for targets -that produce debugging output for DBX or COFF-style debugging output -for SDB and allow the frame-pointer to be eliminated when the -@option{-g} options is used. +that produce debugging output for DBX and allow the frame-pointer to be +eliminated when the @option{-g} option is used. @end defmac @defmac DEBUGGER_ARG_OFFSET (@var{offset}, @var{x}) @@ -9571,7 +9570,7 @@ A C expression that returns the type of debugging output GCC should produce when the user specifies just @option{-g}. Define this if you have arranged for GCC to support more than one format of debugging output. Currently, the allowable values are @code{DBX_DEBUG}, -@code{SDB_DEBUG}, @code{DWARF_DEBUG}, @code{DWARF2_DEBUG}, +@code{DWARF_DEBUG}, @code{DWARF2_DEBUG}, @code{XCOFF_DEBUG}, @code{VMS_DEBUG}, and @code{VMS_AND_DWARF2_DEBUG}. When the user specifies @option{-ggdb}, GCC normally also uses the @@ -9582,7 +9581,7 @@ defined, GCC uses @code{DBX_DEBUG}. The value of this macro only affects the default debugging output; the user can always get a specific type of output by using @option{-gstabs}, -@option{-gcoff}, @option{-gdwarf-2}, @option{-gxcoff}, or @option{-gvms}. +@option{-gdwarf-2}, @option{-gxcoff}, or @option{-gvms}. @end defmac @node DBX Options @@ -9800,16 +9799,11 @@ whose value is the highest absolute text address in the file. @end defmac @need 2000 -@node SDB and DWARF -@subsection Macros for SDB and DWARF Output +@node DWARF +@subsection Macros for DWARF Output @c prevent bad page break with this line -Here are macros for SDB and DWARF output. - -@defmac SDB_DEBUGGING_INFO -Define this macro to 1 if GCC should produce COFF-style debugging output -for SDB in response to the @option{-g} option. -@end defmac +Here are macros for DWARF output. @defmac DWARF2_DEBUGGING_INFO Define this macro if GCC should produce dwarf version 2 format @@ -9915,40 +9909,6 @@ If defined, this target hook is a function which outputs a DTP-relative reference to the given TLS symbol of the specified size. @end deftypefn -@defmac PUT_SDB_@dots{} -Define these macros to override the assembler syntax for the special -SDB assembler directives. See @file{sdbout.c} for a list of these -macros and their arguments. If the standard syntax is used, you need -not define them yourself. -@end defmac - -@defmac SDB_DELIM -Some assemblers do not support a semicolon as a delimiter, even between -SDB assembler directives. In that case, define this macro to be the -delimiter to use (usually @samp{\n}). It is not necessary to define -a new set of @code{PUT_SDB_@var{op}} macros if this is the only change -required. -@end defmac - -@defmac SDB_ALLOW_UNKNOWN_REFERENCES -Define this macro to allow references to unknown structure, -union, or enumeration tags to be emitted. Standard COFF does not -allow handling of unknown references, MIPS ECOFF has support for -it. -@end defmac - -@defmac SDB_ALLOW_FORWARD_REFERENCES -Define this macro to allow references to structure, union, or -enumeration tags that have not yet been seen to be handled. Some -assemblers choke if forward tags are used, while some require it. -@end defmac - -@defmac SDB_OUTPUT_SOURCE_LINE (@var{stream}, @var{line}) -A C statement to output SDB debugging information before code for line -number @var{line} of the current source file to the stdio stream -@var{stream}. The default is to emit an @code{.ln} directive. -@end defmac - @need 2000 @node VMS Debug @subsection Macros for VMS Debug Format diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 37308e1e551..d433e3a9c6b 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -6450,7 +6450,7 @@ This macro need only be defined if the target might save registers in the function prologue at an offset to the stack pointer that is not aligned to @code{UNITS_PER_WORD}. The definition should be the negative minimum alignment if @code{STACK_GROWS_DOWNWARD} is true, and the positive -minimum alignment otherwise. @xref{SDB and DWARF}. Only applicable if +minimum alignment otherwise. @xref{DWARF}. Only applicable if the target supports DWARF 2 frame unwind information. @end defmac @@ -6574,7 +6574,7 @@ This describes how to specify debugging information. * DBX Options:: Macros enabling specific options in DBX format. * DBX Hooks:: Hook macros for varying DBX format. * File Names and DBX:: Macros controlling output of file names in DBX format. -* SDB and DWARF:: Macros for SDB (COFF) and DWARF formats. +* DWARF:: Macros for DWARF format. * VMS Debug:: Macros for VMS debug format. @end menu @@ -6608,9 +6608,8 @@ A C expression that returns the integer offset value for an automatic variable having address @var{x} (an RTL expression). The default computation assumes that @var{x} is based on the frame-pointer and gives the offset from the frame-pointer. This is required for targets -that produce debugging output for DBX or COFF-style debugging output -for SDB and allow the frame-pointer to be eliminated when the -@option{-g} options is used. +that produce debugging output for DBX and allow the frame-pointer to be +eliminated when the @option{-g} option is used. @end defmac @defmac DEBUGGER_ARG_OFFSET (@var{offset}, @var{x}) @@ -6624,7 +6623,7 @@ A C expression that returns the type of debugging output GCC should produce when the user specifies just @option{-g}. Define this if you have arranged for GCC to support more than one format of debugging output. Currently, the allowable values are @code{DBX_DEBUG}, -@code{SDB_DEBUG}, @code{DWARF_DEBUG}, @code{DWARF2_DEBUG}, +@code{DWARF_DEBUG}, @code{DWARF2_DEBUG}, @code{XCOFF_DEBUG}, @code{VMS_DEBUG}, and @code{VMS_AND_DWARF2_DEBUG}. When the user specifies @option{-ggdb}, GCC normally also uses the @@ -6635,7 +6634,7 @@ defined, GCC uses @code{DBX_DEBUG}. The value of this macro only affects the default debugging output; the user can always get a specific type of output by using @option{-gstabs}, -@option{-gcoff}, @option{-gdwarf-2}, @option{-gxcoff}, or @option{-gvms}. +@option{-gdwarf-2}, @option{-gxcoff}, or @option{-gvms}. @end defmac @node DBX Options @@ -6853,16 +6852,11 @@ whose value is the highest absolute text address in the file. @end defmac @need 2000 -@node SDB and DWARF -@subsection Macros for SDB and DWARF Output +@node DWARF +@subsection Macros for DWARF Output @c prevent bad page break with this line -Here are macros for SDB and DWARF output. - -@defmac SDB_DEBUGGING_INFO -Define this macro to 1 if GCC should produce COFF-style debugging output -for SDB in response to the @option{-g} option. -@end defmac +Here are macros for DWARF output. @defmac DWARF2_DEBUGGING_INFO Define this macro if GCC should produce dwarf version 2 format @@ -6938,40 +6932,6 @@ is referenced by a function. @hook TARGET_ASM_OUTPUT_DWARF_DTPREL -@defmac PUT_SDB_@dots{} -Define these macros to override the assembler syntax for the special -SDB assembler directives. See @file{sdbout.c} for a list of these -macros and their arguments. If the standard syntax is used, you need -not define them yourself. -@end defmac - -@defmac SDB_DELIM -Some assemblers do not support a semicolon as a delimiter, even between -SDB assembler directives. In that case, define this macro to be the -delimiter to use (usually @samp{\n}). It is not necessary to define -a new set of @code{PUT_SDB_@var{op}} macros if this is the only change -required. -@end defmac - -@defmac SDB_ALLOW_UNKNOWN_REFERENCES -Define this macro to allow references to unknown structure, -union, or enumeration tags to be emitted. Standard COFF does not -allow handling of unknown references, MIPS ECOFF has support for -it. -@end defmac - -@defmac SDB_ALLOW_FORWARD_REFERENCES -Define this macro to allow references to structure, union, or -enumeration tags that have not yet been seen to be handled. Some -assemblers choke if forward tags are used, while some require it. -@end defmac - -@defmac SDB_OUTPUT_SOURCE_LINE (@var{stream}, @var{line}) -A C statement to output SDB debugging information before code for line -number @var{line} of the current source file to the stdio stream -@var{stream}. The default is to emit an @code{.ln} directive. -@end defmac - @need 2000 @node VMS Debug @subsection Macros for VMS Debug Format diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index dcc624e6fe0..54a47d51618 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -20939,10 +20939,10 @@ gen_array_type_die (tree type, dw_die_ref context_die) add_AT_unsigned (array_die, DW_AT_ordering, DW_ORD_col_major); #if 0 - /* We default the array ordering. SDB will probably do - the right things even if DW_AT_ordering is not present. It's not even - an issue until we start to get into multidimensional arrays anyway. If - SDB is ever caught doing the Wrong Thing for multi-dimensional arrays, + /* We default the array ordering. Debuggers will probably do the right + things even if DW_AT_ordering is not present. It's not even an issue + until we start to get into multidimensional arrays anyway. If a debugger + is ever caught doing the Wrong Thing for multi-dimensional arrays, then we'll have to put the DW_AT_ordering attribute back in. (But if and when we find out that we need to put these in, we will only do so for multidimensional arrays. */ diff --git a/gcc/final.c b/gcc/final.c index 0ddf7793209..840931ba516 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -92,8 +92,6 @@ along with GCC; see the file COPYING3. If not see #include "dbxout.h" #endif -#include "sdbout.h" - /* Most ports that aren't using cc0 don't need to define CC_STATUS_INIT. So define a null default for it to save conditionalization later. */ #ifndef CC_STATUS_INIT @@ -2328,8 +2326,7 @@ final_scan_insn (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, TREE_ASM_WRITTEN (NOTE_BLOCK (insn)) = 1; BLOCK_IN_COLD_SECTION_P (NOTE_BLOCK (insn)) = in_cold_section_p; } - if (write_symbols == DBX_DEBUG - || write_symbols == SDB_DEBUG) + if (write_symbols == DBX_DEBUG) { location_t *locus_ptr = block_nonartificial_location (NOTE_BLOCK (insn)); @@ -2363,8 +2360,7 @@ final_scan_insn (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, gcc_assert (BLOCK_IN_COLD_SECTION_P (NOTE_BLOCK (insn)) == in_cold_section_p); } - if (write_symbols == DBX_DEBUG - || write_symbols == SDB_DEBUG) + if (write_symbols == DBX_DEBUG) { tree outer_block = BLOCK_SUPERCONTEXT (NOTE_BLOCK (insn)); location_t *locus_ptr @@ -4684,12 +4680,6 @@ rest_of_clean_state (void) } } - /* In case the function was not output, - don't leave any temporary anonymous types - queued up for sdb output. */ - if (SDB_DEBUGGING_INFO && write_symbols == SDB_DEBUG) - sdbout_types (NULL_TREE); - flag_rerun_cse_after_global_opts = 0; reload_completed = 0; epilogue_completed = 0; diff --git a/gcc/flag-types.h b/gcc/flag-types.h index 2b2302963f0..591b74457cd 100644 --- a/gcc/flag-types.h +++ b/gcc/flag-types.h @@ -24,7 +24,6 @@ enum debug_info_type { NO_DEBUG, /* Write no debug info. */ DBX_DEBUG, /* Write BSD .stabs for DBX (using dbxout.c). */ - SDB_DEBUG, /* Write COFF for (old) SDB (using sdbout.c). */ DWARF2_DEBUG, /* Write Dwarf v2 debug info (using dwarf2out.c). */ XCOFF_DEBUG, /* Write IBM/Xcoff debug info (using dbxout.c). */ VMS_DEBUG, /* Write VMS debug info (using vmsdbgout.c). */ diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 307abe6ca3d..67ebf7bc2f1 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,7 @@ +2017-10-29 Jim Wilson + + * invoke.texi: Delete adb and sdb references. + 2017-10-28 Andre Vehreschild * check.c (gfc_check_co_reduce): Clarify error message. diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi index 8892d501d58..261f2535bb5 100644 --- a/gcc/fortran/invoke.texi +++ b/gcc/fortran/invoke.texi @@ -41,7 +41,7 @@ remainder. @c man end @c man begin SEEALSO gpl(7), gfdl(7), fsf-funding(7), -cpp(1), gcov(1), gcc(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1) +cpp(1), gcov(1), gcc(1), as(1), ld(1), gdb(1), dbx(1) and the Info entries for @file{gcc}, @file{cpp}, @file{gfortran}, @file{as}, @file{ld}, @file{binutils} and @file{gdb}. @c man end diff --git a/gcc/function.c b/gcc/function.c index 339419ee1da..fe3d9c1bbf3 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -4709,11 +4709,11 @@ number_blocks (tree fn) int n_blocks; tree *block_vector; - /* For SDB and XCOFF debugging output, we start numbering the blocks + /* For XCOFF debugging output, we start numbering the blocks from 1 within each function, rather than keeping a running count. */ -#if SDB_DEBUGGING_INFO || defined (XCOFF_DEBUGGING_INFO) - if (write_symbols == SDB_DEBUG || write_symbols == XCOFF_DEBUG) +#if defined (XCOFF_DEBUGGING_INFO) + if (write_symbols == XCOFF_DEBUG) next_block_index = 1; #endif @@ -5248,7 +5248,7 @@ expand_function_start (tree subr) } /* The following was moved from init_function_start. - The move is supposed to make sdb output more accurate. */ + The move was supposed to make sdb output more accurate. */ /* Indicate the beginning of the function body, as opposed to parm setup. */ emit_note (NOTE_INSN_FUNCTION_BEG); @@ -5439,7 +5439,7 @@ expand_function_end (void) do_pending_stack_adjust (); /* Output a linenumber for the end of the function. - SDB depends on this. */ + SDB depended on this. */ set_curr_insn_location (input_location); /* Before the return label (if any), clobber the return diff --git a/gcc/gcc.c b/gcc/gcc.c index cec3ed5be5f..184f2b321e0 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -1117,7 +1117,7 @@ static const char *cpp_unique_options = %{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}}\ %{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*}\ %{!E:%{!M:%{!MM:%{!MT:%{!MQ:%{MD|MMD:%{o*:-MQ %*}}}}}}}\ - %{remap} %{g3|ggdb3|gstabs3|gcoff3|gxcoff3|gvms3:-dD}\ + %{remap} %{g3|ggdb3|gstabs3|gxcoff3|gvms3:-dD}\ %{!iplugindir*:%{fplugin*:%:find-plugindir()}}\ %{H} %C %{D*&U*&A*} %{i*} %Z %i\ %{E|M|MM:%W{o*}}"; diff --git a/gcc/opts.c b/gcc/opts.c index ee95c84cdef..ac383d48ec1 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -37,7 +37,7 @@ static void set_Wstrict_aliasing (struct gcc_options *opts, int onoff); /* Indexed by enum debug_info_type. */ const char *const debug_type_names[] = { - "none", "stabs", "coff", "dwarf-2", "xcoff", "vms" + "none", "stabs", "dwarf-2", "xcoff", "vms" }; /* Parse the -femit-struct-debug-detailed option value @@ -2351,10 +2351,6 @@ common_handle_option (struct gcc_options *opts, loc); break; - case OPT_gcoff: - set_debug_level (SDB_DEBUG, false, arg, opts, opts_set, loc); - break; - case OPT_gdwarf: if (arg && strlen (arg) != 0) { diff --git a/gcc/output.h b/gcc/output.h index e98a911c647..ede44476a76 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -308,11 +308,6 @@ extern void output_quoted_string (FILE *, const char *); This variable is defined in final.c. */ extern rtx_sequence *final_sequence; -/* The line number of the beginning of the current function. Various - md code needs this so that it can output relative linenumbers. */ - -extern int sdb_begin_function_line; - /* File in which assembler code is being written. */ #ifdef BUFSIZ diff --git a/gcc/sdbout.c b/gcc/sdbout.c deleted file mode 100644 index acd25a3c765..00000000000 --- a/gcc/sdbout.c +++ /dev/null @@ -1,1661 +0,0 @@ -/* Output sdb-format symbol table information from GNU compiler. - Copyright (C) 1988-2017 Free Software Foundation, Inc. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 3, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING3. If not see -. */ - -/* mike@tredysvr.Tredydev.Unisys.COM says: -I modified the struct.c example and have a nm of a .o resulting from the -AT&T C compiler. From the example below I would conclude the following: - -1. All .defs from structures are emitted as scanned. The example below - clearly shows the symbol table entries for BoxRec2 are after the first - function. - -2. All functions and their locals (including statics) are emitted as scanned. - -3. All nested unnamed union and structure .defs must be emitted before - the structure in which they are nested. The AT&T assembler is a - one pass beast as far as symbolics are concerned. - -4. All structure .defs are emitted before the typedefs that refer to them. - -5. All top level static and external variable definitions are moved to the - end of file with all top level statics occurring first before externs. - -6. All undefined references are at the end of the file. -*/ - -#include "config.h" -#include "system.h" -#include "coretypes.h" -#include "gsyms.h" -#include "tm.h" -#include "debug.h" -#include "tree.h" -#include "varasm.h" -#include "stor-layout.h" - -static GTY(()) tree anonymous_types; - -/* Counter to generate unique "names" for nameless struct members. */ - -static GTY(()) int unnamed_struct_number; - -/* Declarations whose debug info was deferred till end of compilation. */ - -static GTY(()) vec *deferred_global_decls; - -/* The C front end may call sdbout_symbol before sdbout_init runs. - We save all such decls in this list and output them when we get - to sdbout_init. */ - -static GTY(()) tree preinit_symbols; -static GTY(()) bool sdbout_initialized; - -#include "rtl.h" -#include "regs.h" -#include "function.h" -#include "memmodel.h" -#include "emit-rtl.h" -#include "flags.h" -#include "insn-config.h" -#include "reload.h" -#include "output.h" -#include "diagnostic-core.h" -#include "tm_p.h" -#include "langhooks.h" -#include "target.h" - -/* 1 if PARM is passed to this function in memory. */ - -#define PARM_PASSED_IN_MEMORY(PARM) \ - (MEM_P (DECL_INCOMING_RTL (PARM))) - -/* A C expression for the integer offset value of an automatic variable - (C_AUTO) having address X (an RTX). */ -#ifndef DEBUGGER_AUTO_OFFSET -#define DEBUGGER_AUTO_OFFSET(X) \ - (GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0) -#endif - -/* A C expression for the integer offset value of an argument (C_ARG) - having address X (an RTX). The nominal offset is OFFSET. */ -#ifndef DEBUGGER_ARG_OFFSET -#define DEBUGGER_ARG_OFFSET(OFFSET, X) (OFFSET) -#endif - -/* Line number of beginning of current function, minus one. - Negative means not in a function or not using sdb. */ - -int sdb_begin_function_line = -1; - - -extern FILE *asm_out_file; - -extern tree current_function_decl; - -#include "sdbout.h" - -static void sdbout_init (const char *); -static void sdbout_finish (const char *); -static void sdbout_start_source_file (unsigned int, const char *); -static void sdbout_end_source_file (unsigned int); -static void sdbout_begin_block (unsigned int, unsigned int); -static void sdbout_end_block (unsigned int, unsigned int); -static void sdbout_source_line (unsigned int, unsigned int, - const char *, int, bool); -static void sdbout_end_epilogue (unsigned int, const char *); -static void sdbout_early_global_decl (tree); -static void sdbout_late_global_decl (tree); -static void sdbout_begin_prologue (unsigned int, unsigned int, - const char *); -static void sdbout_end_prologue (unsigned int, const char *); -static void sdbout_begin_function (tree); -static void sdbout_end_function (unsigned int); -static void sdbout_toplevel_data (tree); -static void sdbout_label (rtx_code_label *); -static char *gen_fake_label (void); -static int plain_type (tree); -static int template_name_p (tree); -static void sdbout_record_type_name (tree); -static int plain_type_1 (tree, int); -static void sdbout_block (tree); -static void sdbout_syms (tree); -#ifdef SDB_ALLOW_FORWARD_REFERENCES -static void sdbout_queue_anonymous_type (tree); -static void sdbout_dequeue_anonymous_types (void); -#endif -static void sdbout_type (tree); -static void sdbout_field_types (tree); -static void sdbout_one_type (tree); -static void sdbout_parms (tree); -static void sdbout_reg_parms (tree); - -/* Random macros describing parts of SDB data. */ - -/* Default value of delimiter is ";". */ -#ifndef SDB_DELIM -#define SDB_DELIM ";" -#endif - -/* Maximum number of dimensions the assembler will allow. */ -#ifndef SDB_MAX_DIM -#define SDB_MAX_DIM 4 -#endif - -#ifndef PUT_SDB_SCL -#define PUT_SDB_SCL(a) fprintf (asm_out_file, "\t.scl\t%d%s", (a), SDB_DELIM) -#endif - -#ifndef PUT_SDB_INT_VAL -#define PUT_SDB_INT_VAL(a) \ - do { \ - fprintf (asm_out_file, "\t.val\t" HOST_WIDE_INT_PRINT_DEC "%s", \ - (HOST_WIDE_INT) (a), SDB_DELIM); \ - } while (0) - -#endif - -#ifndef PUT_SDB_VAL -#define PUT_SDB_VAL(a) \ -( fputs ("\t.val\t", asm_out_file), \ - output_addr_const (asm_out_file, (a)), \ - fprintf (asm_out_file, SDB_DELIM)) -#endif - -#ifndef PUT_SDB_DEF -#define PUT_SDB_DEF(a) \ -do { fprintf (asm_out_file, "\t.def\t"); \ - assemble_name (asm_out_file, a); \ - fprintf (asm_out_file, SDB_DELIM); } while (0) -#endif - -#ifndef PUT_SDB_PLAIN_DEF -#define PUT_SDB_PLAIN_DEF(a) \ - fprintf (asm_out_file, "\t.def\t.%s%s", a, SDB_DELIM) -#endif - -#ifndef PUT_SDB_ENDEF -#define PUT_SDB_ENDEF fputs ("\t.endef\n", asm_out_file) -#endif - -#ifndef PUT_SDB_TYPE -#define PUT_SDB_TYPE(a) fprintf (asm_out_file, "\t.type\t0%o%s", a, SDB_DELIM) -#endif - -#ifndef PUT_SDB_SIZE -#define PUT_SDB_SIZE(a) \ - do { \ - fprintf (asm_out_file, "\t.size\t" HOST_WIDE_INT_PRINT_DEC "%s", \ - (HOST_WIDE_INT) (a), SDB_DELIM); \ - } while (0) -#endif - -#ifndef PUT_SDB_START_DIM -#define PUT_SDB_START_DIM fprintf (asm_out_file, "\t.dim\t") -#endif - -#ifndef PUT_SDB_NEXT_DIM -#define PUT_SDB_NEXT_DIM(a) fprintf (asm_out_file, "%d,", a) -#endif - -#ifndef PUT_SDB_LAST_DIM -#define PUT_SDB_LAST_DIM(a) fprintf (asm_out_file, "%d%s", a, SDB_DELIM) -#endif - -#ifndef PUT_SDB_TAG -#define PUT_SDB_TAG(a) \ -do { fprintf (asm_out_file, "\t.tag\t"); \ - assemble_name (asm_out_file, a); \ - fprintf (asm_out_file, SDB_DELIM); } while (0) -#endif - -#ifndef PUT_SDB_BLOCK_START -#define PUT_SDB_BLOCK_START(LINE) \ - fprintf (asm_out_file, \ - "\t.def\t.bb%s\t.val\t.%s\t.scl\t100%s\t.line\t%d%s\t.endef\n", \ - SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM) -#endif - -#ifndef PUT_SDB_BLOCK_END -#define PUT_SDB_BLOCK_END(LINE) \ - fprintf (asm_out_file, \ - "\t.def\t.eb%s\t.val\t.%s\t.scl\t100%s\t.line\t%d%s\t.endef\n", \ - SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM) -#endif - -#ifndef PUT_SDB_FUNCTION_START -#define PUT_SDB_FUNCTION_START(LINE) \ - fprintf (asm_out_file, \ - "\t.def\t.bf%s\t.val\t.%s\t.scl\t101%s\t.line\t%d%s\t.endef\n", \ - SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM) -#endif - -#ifndef PUT_SDB_FUNCTION_END -#define PUT_SDB_FUNCTION_END(LINE) \ - fprintf (asm_out_file, \ - "\t.def\t.ef%s\t.val\t.%s\t.scl\t101%s\t.line\t%d%s\t.endef\n", \ - SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM) -#endif - -/* Return the sdb tag identifier string for TYPE - if TYPE has already been defined; otherwise return a null pointer. */ - -#define KNOWN_TYPE_TAG(type) TYPE_SYMTAB_POINTER (type) - -/* Set the sdb tag identifier string for TYPE to NAME. */ - -#define SET_KNOWN_TYPE_TAG(TYPE, NAME) \ - TYPE_SYMTAB_POINTER (TYPE) = (const char *)(NAME) - -/* Return the name (a string) of the struct, union or enum tag - described by the TREE_LIST node LINK. This is 0 for an anonymous one. */ - -#define TAG_NAME(link) \ - (((link) && TREE_PURPOSE ((link)) \ - && IDENTIFIER_POINTER (TREE_PURPOSE ((link)))) \ - ? IDENTIFIER_POINTER (TREE_PURPOSE ((link))) : (char *) 0) - -/* Ensure we don't output a negative line number. */ -#define MAKE_LINE_SAFE(line) \ - if ((int) line <= sdb_begin_function_line) \ - line = sdb_begin_function_line + 1 - -/* The debug hooks structure. */ -const struct gcc_debug_hooks sdb_debug_hooks = -{ - sdbout_init, /* init */ - sdbout_finish, /* finish */ - debug_nothing_charstar, /* early_finish */ - debug_nothing_void, /* assembly_start */ - debug_nothing_int_charstar, /* define */ - debug_nothing_int_charstar, /* undef */ - sdbout_start_source_file, /* start_source_file */ - sdbout_end_source_file, /* end_source_file */ - sdbout_begin_block, /* begin_block */ - sdbout_end_block, /* end_block */ - debug_true_const_tree, /* ignore_block */ - sdbout_source_line, /* source_line */ - sdbout_begin_prologue, /* begin_prologue */ - debug_nothing_int_charstar, /* end_prologue */ - debug_nothing_int_charstar, /* begin_epilogue */ - sdbout_end_epilogue, /* end_epilogue */ - sdbout_begin_function, /* begin_function */ - sdbout_end_function, /* end_function */ - debug_nothing_tree, /* register_main_translation_unit */ - debug_nothing_tree, /* function_decl */ - sdbout_early_global_decl, /* early_global_decl */ - sdbout_late_global_decl, /* late_global_decl */ - sdbout_symbol, /* type_decl */ - debug_nothing_tree_tree_tree_bool_bool,/* imported_module_or_decl */ - debug_false_tree_charstarstar_uhwistar,/* die_ref_for_decl */ - debug_nothing_tree_charstar_uhwi, /* register_external_die */ - debug_nothing_tree, /* deferred_inline_function */ - debug_nothing_tree, /* outlining_inline_function */ - sdbout_label, /* label */ - debug_nothing_int, /* handle_pch */ - debug_nothing_rtx_insn, /* var_location */ - debug_nothing_tree, /* size_function */ - debug_nothing_void, /* switch_text_section */ - debug_nothing_tree_tree, /* set_name */ - 0, /* start_end_main_source_file */ - TYPE_SYMTAB_IS_POINTER /* tree_type_symtab_field */ -}; - -/* Return a unique string to name an anonymous type. */ - -static char * -gen_fake_label (void) -{ - char label[10]; - char *labelstr; - sprintf (label, ".%dfake", unnamed_struct_number); - unnamed_struct_number++; - labelstr = xstrdup (label); - return labelstr; -} - -/* Return the number which describes TYPE for SDB. - For pointers, etc., this function is recursive. - Each record, union or enumeral type must already have had a - tag number output. */ - -/* The number is given by d6d5d4d3d2d1bbbb - where bbbb is 4 bit basic type, and di indicate one of notype,ptr,fn,array. - Thus, char *foo () has bbbb=T_CHAR - d1=D_FCN - d2=D_PTR - N_BTMASK= 017 1111 basic type field. - N_TSHIFT= 2 derived type shift - N_BTSHFT= 4 Basic type shift */ - -/* Produce the number that describes a pointer, function or array type. - PREV is the number describing the target, value or element type. - DT_type describes how to transform that type. */ -#define PUSH_DERIVED_LEVEL(DT_type,PREV) \ - ((((PREV) & ~(int) N_BTMASK) << (int) N_TSHIFT) \ - | ((int) DT_type << (int) N_BTSHFT) \ - | ((PREV) & (int) N_BTMASK)) - -/* Number of elements used in sdb_dims. */ -static int sdb_n_dims = 0; - -/* Table of array dimensions of current type. */ -static int sdb_dims[SDB_MAX_DIM]; - -/* Size of outermost array currently being processed. */ -static int sdb_type_size = -1; - -static int -plain_type (tree type) -{ - int val = plain_type_1 (type, 0); - - /* If we have already saved up some array dimensions, print them now. */ - if (sdb_n_dims > 0) - { - int i; - PUT_SDB_START_DIM; - for (i = sdb_n_dims - 1; i > 0; i--) - PUT_SDB_NEXT_DIM (sdb_dims[i]); - PUT_SDB_LAST_DIM (sdb_dims[0]); - sdb_n_dims = 0; - - sdb_type_size = int_size_in_bytes (type); - /* Don't kill sdb if type is not laid out or has variable size. */ - if (sdb_type_size < 0) - sdb_type_size = 0; - } - /* If we have computed the size of an array containing this type, - print it now. */ - if (sdb_type_size >= 0) - { - PUT_SDB_SIZE (sdb_type_size); - sdb_type_size = -1; - } - return val; -} - -static int -template_name_p (tree name) -{ - const char *ptr = IDENTIFIER_POINTER (name); - while (*ptr && *ptr != '<') - ptr++; - - return *ptr != '\0'; -} - -static void -sdbout_record_type_name (tree type) -{ - const char *name = 0; - int no_name; - - if (KNOWN_TYPE_TAG (type)) - return; - - if (TYPE_NAME (type) != 0) - { - tree t = 0; - - /* Find the IDENTIFIER_NODE for the type name. */ - if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE) - t = TYPE_NAME (type); - else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL) - { - t = DECL_NAME (TYPE_NAME (type)); - /* The DECL_NAME for templates includes "<>", which breaks - most assemblers. Use its assembler name instead, which - has been mangled into being safe. */ - if (t && template_name_p (t)) - t = DECL_ASSEMBLER_NAME (TYPE_NAME (type)); - } - - /* Now get the name as a string, or invent one. */ - if (t != NULL_TREE) - name = IDENTIFIER_POINTER (t); - } - - no_name = (name == 0 || *name == 0); - if (no_name) - name = gen_fake_label (); - - SET_KNOWN_TYPE_TAG (type, name); -#ifdef SDB_ALLOW_FORWARD_REFERENCES - if (no_name) - sdbout_queue_anonymous_type (type); -#endif -} - -/* Return the .type value for type TYPE. - - LEVEL indicates how many levels deep we have recursed into the type. - The SDB debug format can only represent 6 derived levels of types. - After that, we must output inaccurate debug info. We deliberately - stop before the 7th level, so that ADA recursive types will not give an - infinite loop. */ - -static int -plain_type_1 (tree type, int level) -{ - if (type == 0) - type = void_type_node; - else if (type == error_mark_node) - type = integer_type_node; - else - type = TYPE_MAIN_VARIANT (type); - - switch (TREE_CODE (type)) - { - case VOID_TYPE: - case NULLPTR_TYPE: - return T_VOID; - case BOOLEAN_TYPE: - case INTEGER_TYPE: - { - int size = int_size_in_bytes (type) * BITS_PER_UNIT; - - /* Carefully distinguish all the standard types of C, - without messing up if the language is not C. - Note that we check only for the names that contain spaces; - other names might occur by coincidence in other languages. */ - if (TYPE_NAME (type) != 0 - && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL - && DECL_NAME (TYPE_NAME (type)) != 0 - && TREE_CODE (DECL_NAME (TYPE_NAME (type))) == IDENTIFIER_NODE) - { - const char *const name - = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))); - - if (!strcmp (name, "char")) - return T_CHAR; - if (!strcmp (name, "unsigned char")) - return T_UCHAR; - if (!strcmp (name, "signed char")) - return T_CHAR; - if (!strcmp (name, "int")) - return T_INT; - if (!strcmp (name, "unsigned int")) - return T_UINT; - if (!strcmp (name, "short int")) - return T_SHORT; - if (!strcmp (name, "short unsigned int")) - return T_USHORT; - if (!strcmp (name, "long int")) - return T_LONG; - if (!strcmp (name, "long unsigned int")) - return T_ULONG; - } - - if (size == INT_TYPE_SIZE) - return (TYPE_UNSIGNED (type) ? T_UINT : T_INT); - if (size == CHAR_TYPE_SIZE) - return (TYPE_UNSIGNED (type) ? T_UCHAR : T_CHAR); - if (size == SHORT_TYPE_SIZE) - return (TYPE_UNSIGNED (type) ? T_USHORT : T_SHORT); - if (size == LONG_TYPE_SIZE) - return (TYPE_UNSIGNED (type) ? T_ULONG : T_LONG); - if (size == LONG_LONG_TYPE_SIZE) /* better than nothing */ - return (TYPE_UNSIGNED (type) ? T_ULONG : T_LONG); - return 0; - } - - case REAL_TYPE: - { - int precision = TYPE_PRECISION (type); - if (precision == FLOAT_TYPE_SIZE) - return T_FLOAT; - if (precision == DOUBLE_TYPE_SIZE) - return T_DOUBLE; - if (precision == LONG_DOUBLE_TYPE_SIZE) - return T_DOUBLE; /* better than nothing */ - - return 0; - } - - case ARRAY_TYPE: - { - int m; - if (level >= 6) - return T_VOID; - else - m = plain_type_1 (TREE_TYPE (type), level+1); - if (sdb_n_dims < SDB_MAX_DIM) - sdb_dims[sdb_n_dims++] - = (TYPE_DOMAIN (type) - && TYPE_MIN_VALUE (TYPE_DOMAIN (type)) != 0 - && TYPE_MAX_VALUE (TYPE_DOMAIN (type)) != 0 - && tree_fits_shwi_p (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) - && tree_fits_shwi_p (TYPE_MIN_VALUE (TYPE_DOMAIN (type))) - ? (tree_to_shwi (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) - - tree_to_shwi (TYPE_MIN_VALUE (TYPE_DOMAIN (type))) + 1) - : 0); - - return PUSH_DERIVED_LEVEL (DT_ARY, m); - } - - case RECORD_TYPE: - case UNION_TYPE: - case QUAL_UNION_TYPE: - case ENUMERAL_TYPE: - { - const char *tag; -#ifdef SDB_ALLOW_FORWARD_REFERENCES - sdbout_record_type_name (type); -#endif -#ifndef SDB_ALLOW_UNKNOWN_REFERENCES - if ((TREE_ASM_WRITTEN (type) && KNOWN_TYPE_TAG (type) != 0) -#ifdef SDB_ALLOW_FORWARD_REFERENCES - || TYPE_MODE (type) != VOIDmode -#endif - ) -#endif - { - /* Output the referenced structure tag name - only if the .def has already been finished. - At least on 386, the Unix assembler - cannot handle forward references to tags. */ - /* But the 88100, it requires them, sigh... */ - /* And the MIPS requires unknown refs as well... */ - tag = KNOWN_TYPE_TAG (type); - PUT_SDB_TAG (tag); - /* These 3 lines used to follow the close brace. - However, a size of 0 without a tag implies a tag of 0, - so if we don't know a tag, we can't mention the size. */ - sdb_type_size = int_size_in_bytes (type); - if (sdb_type_size < 0) - sdb_type_size = 0; - } - return ((TREE_CODE (type) == RECORD_TYPE) ? T_STRUCT - : (TREE_CODE (type) == UNION_TYPE) ? T_UNION - : (TREE_CODE (type) == QUAL_UNION_TYPE) ? T_UNION - : T_ENUM); - } - case POINTER_TYPE: - case REFERENCE_TYPE: - { - int m; - if (level >= 6) - return T_VOID; - else - m = plain_type_1 (TREE_TYPE (type), level+1); - return PUSH_DERIVED_LEVEL (DT_PTR, m); - } - case FUNCTION_TYPE: - case METHOD_TYPE: - { - int m; - if (level >= 6) - return T_VOID; - else - m = plain_type_1 (TREE_TYPE (type), level+1); - return PUSH_DERIVED_LEVEL (DT_FCN, m); - } - default: - return 0; - } -} - -/* Output the symbols defined in block number DO_BLOCK. - - This function works by walking the tree structure of blocks, - counting blocks until it finds the desired block. */ - -static int do_block = 0; - -static void -sdbout_block (tree block) -{ - while (block) - { - /* Ignore blocks never expanded or otherwise marked as real. */ - if (TREE_USED (block)) - { - /* When we reach the specified block, output its symbols. */ - if (BLOCK_NUMBER (block) == do_block) - sdbout_syms (BLOCK_VARS (block)); - - /* If we are past the specified block, stop the scan. */ - if (BLOCK_NUMBER (block) > do_block) - return; - - /* Scan the blocks within this block. */ - sdbout_block (BLOCK_SUBBLOCKS (block)); - } - - block = BLOCK_CHAIN (block); - } -} - -/* Call sdbout_symbol on each decl in the chain SYMS. */ - -static void -sdbout_syms (tree syms) -{ - while (syms) - { - if (TREE_CODE (syms) != LABEL_DECL) - sdbout_symbol (syms, 1); - syms = TREE_CHAIN (syms); - } -} - -/* Output SDB information for a symbol described by DECL. - LOCAL is nonzero if the symbol is not file-scope. */ - -void -sdbout_symbol (tree decl, int local) -{ - tree type = TREE_TYPE (decl); - tree context = NULL_TREE; - rtx value; - int regno = -1; - const char *name; - - /* If we are called before sdbout_init is run, just save the symbol - for later. */ - if (!sdbout_initialized) - { - preinit_symbols = tree_cons (0, decl, preinit_symbols); - return; - } - - sdbout_one_type (type); - - switch (TREE_CODE (decl)) - { - case CONST_DECL: - /* Enum values are defined by defining the enum type. */ - return; - - case FUNCTION_DECL: - /* Don't mention a nested function under its parent. */ - context = decl_function_context (decl); - if (context == current_function_decl) - return; - /* Check DECL_INITIAL to distinguish declarations from definitions. - Don't output debug info here for declarations; they will have - a DECL_INITIAL value of 0. */ - if (! DECL_INITIAL (decl)) - return; - if (!MEM_P (DECL_RTL (decl)) - || GET_CODE (XEXP (DECL_RTL (decl), 0)) != SYMBOL_REF) - return; - PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))); - PUT_SDB_VAL (XEXP (DECL_RTL (decl), 0)); - PUT_SDB_SCL (TREE_PUBLIC (decl) ? C_EXT : C_STAT); - break; - - case TYPE_DECL: - /* Done with tagged types. */ - if (DECL_NAME (decl) == 0) - return; - if (DECL_IGNORED_P (decl)) - return; - /* Don't output intrinsic types. GAS chokes on SDB .def - statements that contain identifiers with embedded spaces - (eg "unsigned long"). */ - if (DECL_IS_BUILTIN (decl)) - return; - - /* Output typedef name. */ - if (template_name_p (DECL_NAME (decl))) - PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))); - else - PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_NAME (decl))); - PUT_SDB_SCL (C_TPDEF); - break; - - case PARM_DECL: - /* Parm decls go in their own separate chains - and are output by sdbout_reg_parms and sdbout_parms. */ - gcc_unreachable (); - - case VAR_DECL: - /* Don't mention a variable that is external. - Let the file that defines it describe it. */ - if (DECL_EXTERNAL (decl)) - return; - - /* Ignore __FUNCTION__, etc. */ - if (DECL_IGNORED_P (decl)) - return; - - /* If there was an error in the declaration, don't dump core - if there is no RTL associated with the variable doesn't - exist. */ - if (!DECL_RTL_SET_P (decl)) - return; - - value = DECL_RTL (decl); - - if (!is_global_var (decl)) - value = eliminate_regs (value, VOIDmode, NULL_RTX); - - SET_DECL_RTL (decl, value); -#ifdef LEAF_REG_REMAP - if (crtl->uses_only_leaf_regs) - leaf_renumber_regs_insn (value); -#endif - - /* Don't mention a variable at all - if it was completely optimized into nothingness. - - If DECL was from an inline function, then its rtl - is not identically the rtl that was used in this - particular compilation. */ - if (REG_P (value)) - { - regno = REGNO (value); - if (regno >= FIRST_PSEUDO_REGISTER) - return; - } - else if (GET_CODE (value) == SUBREG) - { - while (GET_CODE (value) == SUBREG) - value = SUBREG_REG (value); - if (REG_P (value)) - { - if (REGNO (value) >= FIRST_PSEUDO_REGISTER) - return; - } - regno = REGNO (alter_subreg (&value, true)); - SET_DECL_RTL (decl, value); - } - /* Don't output anything if an auto variable - gets RTL that is static. - GAS version 2.2 can't handle such output. */ - else if (MEM_P (value) && CONSTANT_P (XEXP (value, 0)) - && ! TREE_STATIC (decl)) - return; - - /* Emit any structure, union, or enum type that has not been output. - This occurs for tag-less structs (et al) used to declare variables - within functions. */ - if (TREE_CODE (type) == ENUMERAL_TYPE - || TREE_CODE (type) == RECORD_TYPE - || TREE_CODE (type) == UNION_TYPE - || TREE_CODE (type) == QUAL_UNION_TYPE) - { - if (COMPLETE_TYPE_P (type) /* not a forward reference */ - && KNOWN_TYPE_TAG (type) == 0) /* not yet declared */ - sdbout_one_type (type); - } - - /* Defer SDB information for top-level initialized variables! */ - if (! local - && MEM_P (value) - && DECL_INITIAL (decl)) - return; - - /* C++ in 2.3 makes nameless symbols. That will be fixed later. - For now, avoid crashing. */ - if (DECL_NAME (decl) == NULL_TREE) - return; - - /* Record the name for, starting a symtab entry. */ - if (local) - name = IDENTIFIER_POINTER (DECL_NAME (decl)); - else - name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); - - if (MEM_P (value) - && GET_CODE (XEXP (value, 0)) == SYMBOL_REF) - { - PUT_SDB_DEF (name); - if (TREE_PUBLIC (decl)) - { - PUT_SDB_VAL (XEXP (value, 0)); - PUT_SDB_SCL (C_EXT); - } - else - { - PUT_SDB_VAL (XEXP (value, 0)); - PUT_SDB_SCL (C_STAT); - } - } - else if (regno >= 0) - { - PUT_SDB_DEF (name); - PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (regno)); - PUT_SDB_SCL (C_REG); - } - else if (MEM_P (value) - && (MEM_P (XEXP (value, 0)) - || (REG_P (XEXP (value, 0)) - && REGNO (XEXP (value, 0)) != HARD_FRAME_POINTER_REGNUM - && REGNO (XEXP (value, 0)) != STACK_POINTER_REGNUM))) - /* If the value is indirect by memory or by a register - that isn't the frame pointer - then it means the object is variable-sized and address through - that register or stack slot. COFF has no way to represent this - so all we can do is output the variable as a pointer. */ - { - PUT_SDB_DEF (name); - if (REG_P (XEXP (value, 0))) - { - PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (XEXP (value, 0)))); - PUT_SDB_SCL (C_REG); - } - else - { - /* DECL_RTL looks like (MEM (MEM (PLUS (REG...) - (CONST_INT...)))). - We want the value of that CONST_INT. */ - /* Encore compiler hates a newline in a macro arg, it seems. */ - PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET - (XEXP (XEXP (value, 0), 0))); - PUT_SDB_SCL (C_AUTO); - } - - /* Effectively do build_pointer_type, but don't cache this type, - since it might be temporary whereas the type it points to - might have been saved for inlining. */ - /* Don't use REFERENCE_TYPE because dbx can't handle that. */ - type = make_node (POINTER_TYPE); - TREE_TYPE (type) = TREE_TYPE (decl); - } - else if (MEM_P (value) - && ((GET_CODE (XEXP (value, 0)) == PLUS - && REG_P (XEXP (XEXP (value, 0), 0)) - && CONST_INT_P (XEXP (XEXP (value, 0), 1))) - /* This is for variables which are at offset zero from - the frame pointer. This happens on the Alpha. - Non-frame pointer registers are excluded above. */ - || (REG_P (XEXP (value, 0))))) - { - /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))) - or (MEM (REG...)). We want the value of that CONST_INT - or zero. */ - PUT_SDB_DEF (name); - PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET (XEXP (value, 0))); - PUT_SDB_SCL (C_AUTO); - } - else - { - /* It is something we don't know how to represent for SDB. */ - return; - } - break; - - default: - break; - } - PUT_SDB_TYPE (plain_type (type)); - PUT_SDB_ENDEF; -} - -/* Output SDB information for a top-level initialized variable - that has been delayed. */ - -static void -sdbout_toplevel_data (tree decl) -{ - tree type = TREE_TYPE (decl); - - if (DECL_IGNORED_P (decl)) - return; - - gcc_assert (VAR_P (decl)); - gcc_assert (MEM_P (DECL_RTL (decl))); - gcc_assert (DECL_INITIAL (decl)); - - PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))); - PUT_SDB_VAL (XEXP (DECL_RTL (decl), 0)); - if (TREE_PUBLIC (decl)) - { - PUT_SDB_SCL (C_EXT); - } - else - { - PUT_SDB_SCL (C_STAT); - } - PUT_SDB_TYPE (plain_type (type)); - PUT_SDB_ENDEF; -} - -#ifdef SDB_ALLOW_FORWARD_REFERENCES - -/* Machinery to record and output anonymous types. */ - -static void -sdbout_queue_anonymous_type (tree type) -{ - anonymous_types = tree_cons (NULL_TREE, type, anonymous_types); -} - -static void -sdbout_dequeue_anonymous_types (void) -{ - tree types, link; - - while (anonymous_types) - { - types = nreverse (anonymous_types); - anonymous_types = NULL_TREE; - - for (link = types; link; link = TREE_CHAIN (link)) - { - tree type = TREE_VALUE (link); - - if (type && ! TREE_ASM_WRITTEN (type)) - sdbout_one_type (type); - } - } -} - -#endif - -/* Given a chain of ..._TYPE nodes, all of which have names, - output definitions of those names, as typedefs. */ - -void -sdbout_types (tree types) -{ - tree link; - - for (link = types; link; link = TREE_CHAIN (link)) - sdbout_one_type (link); - -#ifdef SDB_ALLOW_FORWARD_REFERENCES - sdbout_dequeue_anonymous_types (); -#endif -} - -static void -sdbout_type (tree type) -{ - if (type == error_mark_node) - type = integer_type_node; - PUT_SDB_TYPE (plain_type (type)); -} - -/* Output types of the fields of type TYPE, if they are structs. - - Formerly did not chase through pointer types, since that could be circular. - They must come before TYPE, since forward refs are not allowed. - Now james@bigtex.cactus.org says to try them. */ - -static void -sdbout_field_types (tree type) -{ - tree tail; - - for (tail = TYPE_FIELDS (type); tail; tail = TREE_CHAIN (tail)) - /* This condition should match the one for emitting the actual - members below. */ - if (TREE_CODE (tail) == FIELD_DECL - && DECL_NAME (tail) - && DECL_SIZE (tail) - && tree_fits_uhwi_p (DECL_SIZE (tail)) - && tree_fits_shwi_p (bit_position (tail))) - { - if (POINTER_TYPE_P (TREE_TYPE (tail))) - sdbout_one_type (TREE_TYPE (TREE_TYPE (tail))); - else - sdbout_one_type (TREE_TYPE (tail)); - } -} - -/* Use this to put out the top level defined record and union types - for later reference. If this is a struct with a name, then put that - name out. Other unnamed structs will have .xxfake labels generated so - that they may be referred to later. - The label will be stored in the KNOWN_TYPE_TAG slot of a type. - It may NOT be called recursively. */ - -static void -sdbout_one_type (tree type) -{ - if (current_function_decl != NULL_TREE - && DECL_SECTION_NAME (current_function_decl) != NULL) - ; /* Don't change section amid function. */ - else - switch_to_section (current_function_section ()); - - switch (TREE_CODE (type)) - { - case RECORD_TYPE: - case UNION_TYPE: - case QUAL_UNION_TYPE: - case ENUMERAL_TYPE: - type = TYPE_MAIN_VARIANT (type); - /* Don't output a type twice. */ - if (TREE_ASM_WRITTEN (type)) - /* James said test TREE_ASM_BEING_WRITTEN here. */ - return; - - /* Output nothing if type is not yet defined. */ - if (!COMPLETE_TYPE_P (type)) - return; - - TREE_ASM_WRITTEN (type) = 1; - - /* This is reputed to cause trouble with the following case, - but perhaps checking TYPE_SIZE above will fix it. */ - - /* Here is a testcase: - - struct foo { - struct badstr *bbb; - } forwardref; - - typedef struct intermediate { - int aaaa; - } intermediate_ref; - - typedef struct badstr { - int ccccc; - } badtype; */ - - /* This change, which ought to make better output, - used to make the COFF assembler unhappy. - Changes involving KNOWN_TYPE_TAG may fix the problem. */ - /* Before really doing anything, output types we want to refer to. */ - /* Note that in version 1 the following two lines - are not used if forward references are in use. */ - if (TREE_CODE (type) != ENUMERAL_TYPE) - sdbout_field_types (type); - - /* Output a structure type. */ - { - int size = int_size_in_bytes (type); - int member_scl = 0; - tree tem; - - /* Record the type tag, but not in its permanent place just yet. */ - sdbout_record_type_name (type); - - PUT_SDB_DEF (KNOWN_TYPE_TAG (type)); - - switch (TREE_CODE (type)) - { - case UNION_TYPE: - case QUAL_UNION_TYPE: - PUT_SDB_SCL (C_UNTAG); - PUT_SDB_TYPE (T_UNION); - member_scl = C_MOU; - break; - - case RECORD_TYPE: - PUT_SDB_SCL (C_STRTAG); - PUT_SDB_TYPE (T_STRUCT); - member_scl = C_MOS; - break; - - case ENUMERAL_TYPE: - PUT_SDB_SCL (C_ENTAG); - PUT_SDB_TYPE (T_ENUM); - member_scl = C_MOE; - break; - - default: - break; - } - - PUT_SDB_SIZE (size); - PUT_SDB_ENDEF; - - /* Print out the base class information with fields - named after the types they hold. */ - /* This is only relevant to aggregate types. TYPE_BINFO is used - for other purposes in an ENUMERAL_TYPE, so we must exclude that - case. */ - if (TREE_CODE (type) != ENUMERAL_TYPE && TYPE_BINFO (type)) - { - int i; - tree binfo, child; - - for (binfo = TYPE_BINFO (type), i = 0; - BINFO_BASE_ITERATE (binfo, i, child); i++) - { - tree child_type = BINFO_TYPE (child); - tree child_type_name; - - if (TYPE_NAME (child_type) == 0) - continue; - if (TREE_CODE (TYPE_NAME (child_type)) == IDENTIFIER_NODE) - child_type_name = TYPE_NAME (child_type); - else if (TREE_CODE (TYPE_NAME (child_type)) == TYPE_DECL) - { - child_type_name = DECL_NAME (TYPE_NAME (child_type)); - if (child_type_name && template_name_p (child_type_name)) - child_type_name - = DECL_ASSEMBLER_NAME (TYPE_NAME (child_type)); - } - else - continue; - - PUT_SDB_DEF (IDENTIFIER_POINTER (child_type_name)); - PUT_SDB_INT_VAL (tree_to_shwi (BINFO_OFFSET (child))); - PUT_SDB_SCL (member_scl); - sdbout_type (BINFO_TYPE (child)); - PUT_SDB_ENDEF; - } - } - - /* Output the individual fields. */ - - if (TREE_CODE (type) == ENUMERAL_TYPE) - { - for (tem = TYPE_VALUES (type); tem; tem = TREE_CHAIN (tem)) - { - tree value = TREE_VALUE (tem); - - if (TREE_CODE (value) == CONST_DECL) - value = DECL_INITIAL (value); - - if (tree_fits_shwi_p (value)) - { - PUT_SDB_DEF (IDENTIFIER_POINTER (TREE_PURPOSE (tem))); - PUT_SDB_INT_VAL (tree_to_shwi (value)); - PUT_SDB_SCL (C_MOE); - PUT_SDB_TYPE (T_MOE); - PUT_SDB_ENDEF; - } - } - } - else /* record or union type */ - for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem)) - /* Output the name, type, position (in bits), size (in bits) - of each field. */ - - /* Omit here the nameless fields that are used to skip bits. - Also omit fields with variable size or position. - Also omit non FIELD_DECL nodes that GNU C++ may put here. */ - if (TREE_CODE (tem) == FIELD_DECL - && DECL_NAME (tem) - && DECL_SIZE (tem) - && tree_fits_uhwi_p (DECL_SIZE (tem)) - && tree_fits_shwi_p (bit_position (tem))) - { - const char *name; - - name = IDENTIFIER_POINTER (DECL_NAME (tem)); - PUT_SDB_DEF (name); - if (DECL_BIT_FIELD_TYPE (tem)) - { - PUT_SDB_INT_VAL (int_bit_position (tem)); - PUT_SDB_SCL (C_FIELD); - sdbout_type (DECL_BIT_FIELD_TYPE (tem)); - PUT_SDB_SIZE (tree_to_uhwi (DECL_SIZE (tem))); - } - else - { - PUT_SDB_INT_VAL (int_bit_position (tem) / BITS_PER_UNIT); - PUT_SDB_SCL (member_scl); - sdbout_type (TREE_TYPE (tem)); - } - PUT_SDB_ENDEF; - } - /* Output end of a structure,union, or enumeral definition. */ - - PUT_SDB_PLAIN_DEF ("eos"); - PUT_SDB_INT_VAL (size); - PUT_SDB_SCL (C_EOS); - PUT_SDB_TAG (KNOWN_TYPE_TAG (type)); - PUT_SDB_SIZE (size); - PUT_SDB_ENDEF; - break; - } - - default: - break; - } -} - -/* The following two functions output definitions of function parameters. - Each parameter gets a definition locating it in the parameter list. - Each parameter that is a register variable gets a second definition - locating it in the register. - - Printing or argument lists in gdb uses the definitions that - locate in the parameter list. But reference to the variable in - expressions uses preferentially the definition as a register. */ - -/* Output definitions, referring to storage in the parmlist, - of all the parms in PARMS, which is a chain of PARM_DECL nodes. */ - -static void -sdbout_parms (tree parms) -{ - for (; parms; parms = TREE_CHAIN (parms)) - if (DECL_NAME (parms) - && TREE_TYPE (parms) != error_mark_node - && DECL_RTL_SET_P (parms) - && DECL_INCOMING_RTL (parms)) - { - int current_sym_value = 0; - const char *name = IDENTIFIER_POINTER (DECL_NAME (parms)); - - if (name == 0 || *name == 0) - name = gen_fake_label (); - - /* Perform any necessary register eliminations on the parameter's rtl, - so that the debugging output will be accurate. */ - DECL_INCOMING_RTL (parms) - = eliminate_regs (DECL_INCOMING_RTL (parms), VOIDmode, NULL_RTX); - SET_DECL_RTL (parms, - eliminate_regs (DECL_RTL (parms), VOIDmode, NULL_RTX)); - - if (PARM_PASSED_IN_MEMORY (parms)) - { - rtx addr = XEXP (DECL_INCOMING_RTL (parms), 0); - tree type; - - /* ??? Here we assume that the parm address is indexed - off the frame pointer or arg pointer. - If that is not true, we produce meaningless results, - but do not crash. */ - if (GET_CODE (addr) == PLUS - && CONST_INT_P (XEXP (addr, 1))) - current_sym_value = INTVAL (XEXP (addr, 1)); - else - current_sym_value = 0; - - if (REG_P (DECL_RTL (parms)) - && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER) - type = DECL_ARG_TYPE (parms); - else - { - int original_sym_value = current_sym_value; - - /* This is the case where the parm is passed as an int or - double and it is converted to a char, short or float - and stored back in the parmlist. In this case, describe - the parm with the variable's declared type, and adjust - the address if the least significant bytes (which we are - using) are not the first ones. */ - scalar_mode from_mode, to_mode; - if (BYTES_BIG_ENDIAN - && TREE_TYPE (parms) != DECL_ARG_TYPE (parms) - && is_a (TYPE_MODE (DECL_ARG_TYPE (parms)), - &from_mode) - && is_a (GET_MODE (DECL_RTL (parms)), - &to_mode)) - current_sym_value += (GET_MODE_SIZE (from_mode) - - GET_MODE_SIZE (to_mode)); - - if (MEM_P (DECL_RTL (parms)) - && GET_CODE (XEXP (DECL_RTL (parms), 0)) == PLUS - && (GET_CODE (XEXP (XEXP (DECL_RTL (parms), 0), 1)) - == CONST_INT) - && (INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1)) - == current_sym_value)) - type = TREE_TYPE (parms); - else - { - current_sym_value = original_sym_value; - type = DECL_ARG_TYPE (parms); - } - } - - PUT_SDB_DEF (name); - PUT_SDB_INT_VAL (DEBUGGER_ARG_OFFSET (current_sym_value, addr)); - PUT_SDB_SCL (C_ARG); - PUT_SDB_TYPE (plain_type (type)); - PUT_SDB_ENDEF; - } - else if (REG_P (DECL_RTL (parms))) - { - rtx best_rtl; - /* Parm passed in registers and lives in registers or nowhere. */ - - /* If parm lives in a register, use that register; - pretend the parm was passed there. It would be more consistent - to describe the register where the parm was passed, - but in practice that register usually holds something else. */ - if (REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER) - best_rtl = DECL_RTL (parms); - /* If the parm lives nowhere, - use the register where it was passed. */ - else - best_rtl = DECL_INCOMING_RTL (parms); - - PUT_SDB_DEF (name); - PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (best_rtl))); - PUT_SDB_SCL (C_REGPARM); - PUT_SDB_TYPE (plain_type (TREE_TYPE (parms))); - PUT_SDB_ENDEF; - } - else if (MEM_P (DECL_RTL (parms)) - && XEXP (DECL_RTL (parms), 0) != const0_rtx) - { - /* Parm was passed in registers but lives on the stack. */ - - /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))), - in which case we want the value of that CONST_INT, - or (MEM (REG ...)) or (MEM (MEM ...)), - in which case we use a value of zero. */ - if (REG_P (XEXP (DECL_RTL (parms), 0)) - || MEM_P (XEXP (DECL_RTL (parms), 0))) - current_sym_value = 0; - else - current_sym_value = INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1)); - - /* Again, this assumes the offset is based on the arg pointer. */ - PUT_SDB_DEF (name); - PUT_SDB_INT_VAL (DEBUGGER_ARG_OFFSET (current_sym_value, - XEXP (DECL_RTL (parms), 0))); - PUT_SDB_SCL (C_ARG); - PUT_SDB_TYPE (plain_type (TREE_TYPE (parms))); - PUT_SDB_ENDEF; - } - } -} - -/* Output definitions for the places where parms live during the function, - when different from where they were passed, when the parms were passed - in memory. - - It is not useful to do this for parms passed in registers - that live during the function in different registers, because it is - impossible to look in the passed register for the passed value, - so we use the within-the-function register to begin with. - - PARMS is a chain of PARM_DECL nodes. */ - -static void -sdbout_reg_parms (tree parms) -{ - for (; parms; parms = TREE_CHAIN (parms)) - if (DECL_NAME (parms) - && TREE_TYPE (parms) != error_mark_node - && DECL_RTL_SET_P (parms) - && DECL_INCOMING_RTL (parms)) - { - const char *name = IDENTIFIER_POINTER (DECL_NAME (parms)); - - /* Report parms that live in registers during the function - but were passed in memory. */ - if (REG_P (DECL_RTL (parms)) - && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER - && PARM_PASSED_IN_MEMORY (parms)) - { - if (name == 0 || *name == 0) - name = gen_fake_label (); - PUT_SDB_DEF (name); - PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (DECL_RTL (parms)))); - PUT_SDB_SCL (C_REG); - PUT_SDB_TYPE (plain_type (TREE_TYPE (parms))); - PUT_SDB_ENDEF; - } - /* Report parms that live in memory but not where they were passed. */ - else if (MEM_P (DECL_RTL (parms)) - && GET_CODE (XEXP (DECL_RTL (parms), 0)) == PLUS - && CONST_INT_P (XEXP (XEXP (DECL_RTL (parms), 0), 1)) - && PARM_PASSED_IN_MEMORY (parms) - && ! rtx_equal_p (DECL_RTL (parms), DECL_INCOMING_RTL (parms))) - { -#if 0 /* ??? It is not clear yet what should replace this. */ - int offset = DECL_OFFSET (parms) / BITS_PER_UNIT; - /* A parm declared char is really passed as an int, - so it occupies the least significant bytes. - On a big-endian machine those are not the low-numbered ones. */ - if (BYTES_BIG_ENDIAN - && offset != -1 - && TREE_TYPE (parms) != DECL_ARG_TYPE (parms)) - offset += (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parms))) - - GET_MODE_SIZE (GET_MODE (DECL_RTL (parms)))); - if (INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1)) != offset) {...} -#endif - { - if (name == 0 || *name == 0) - name = gen_fake_label (); - PUT_SDB_DEF (name); - PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET - (XEXP (DECL_RTL (parms), 0))); - PUT_SDB_SCL (C_AUTO); - PUT_SDB_TYPE (plain_type (TREE_TYPE (parms))); - PUT_SDB_ENDEF; - } - } - } -} - -/* Output early debug information for a global DECL. Called from - rest_of_decl_compilation during parsing. */ - -static void -sdbout_early_global_decl (tree decl ATTRIBUTE_UNUSED) -{ - /* NYI for non-dwarf. */ -} - -/* Output late debug information for a global DECL after location - information is available. */ - -static void -sdbout_late_global_decl (tree decl) -{ - if (VAR_P (decl) && !DECL_EXTERNAL (decl) && DECL_RTL_SET_P (decl)) - { - /* The COFF linker can move initialized global vars to the end. - And that can screw up the symbol ordering. Defer those for - sdbout_finish (). */ - if (!DECL_INITIAL (decl) || !TREE_PUBLIC (decl)) - sdbout_symbol (decl, 0); - else - vec_safe_push (deferred_global_decls, decl); - - /* Output COFF information for non-global file-scope initialized - variables. */ - if (DECL_INITIAL (decl) && MEM_P (DECL_RTL (decl))) - sdbout_toplevel_data (decl); - } -} - -/* Output initialized global vars at the end, in the order of - definition. See comment in sdbout_global_decl. */ - -static void -sdbout_finish (const char *main_filename ATTRIBUTE_UNUSED) -{ - size_t i; - tree decl; - - FOR_EACH_VEC_SAFE_ELT (deferred_global_decls, i, decl) - sdbout_symbol (decl, 0); -} - -/* Describe the beginning of an internal block within a function. - Also output descriptions of variables defined in this block. - - N is the number of the block, by order of beginning, counting from 1, - and not counting the outermost (function top-level) block. - The blocks match the BLOCKs in DECL_INITIAL (current_function_decl), - if the count starts at 0 for the outermost one. */ - -static void -sdbout_begin_block (unsigned int line, unsigned int n) -{ - tree decl = current_function_decl; - MAKE_LINE_SAFE (line); - - /* The SCO compiler does not emit a separate block for the function level - scope, so we avoid it here also. */ - PUT_SDB_BLOCK_START (line - sdb_begin_function_line); - - if (n == 1) - { - /* Include the outermost BLOCK's variables in block 1. */ - do_block = BLOCK_NUMBER (DECL_INITIAL (decl)); - sdbout_block (DECL_INITIAL (decl)); - } - /* If -g1, suppress all the internal symbols of functions - except for arguments. */ - if (debug_info_level != DINFO_LEVEL_TERSE) - { - do_block = n; - sdbout_block (DECL_INITIAL (decl)); - } - -#ifdef SDB_ALLOW_FORWARD_REFERENCES - sdbout_dequeue_anonymous_types (); -#endif -} - -/* Describe the end line-number of an internal block within a function. */ - -static void -sdbout_end_block (unsigned int line, unsigned int n ATTRIBUTE_UNUSED) -{ - MAKE_LINE_SAFE (line); - - /* The SCO compiler does not emit a separate block for the function level - scope, so we avoid it here also. */ - if (n != 1) - PUT_SDB_BLOCK_END (line - sdb_begin_function_line); -} - -/* Output a line number symbol entry for source file FILENAME and line - number LINE. */ - -static void -sdbout_source_line (unsigned int line, unsigned int column ATTRIBUTE_UNUSED, - const char *filename ATTRIBUTE_UNUSED, - int discriminator ATTRIBUTE_UNUSED, - bool is_stmt ATTRIBUTE_UNUSED) -{ - /* COFF relative line numbers must be positive. */ - if ((int) line > sdb_begin_function_line) - { -#ifdef SDB_OUTPUT_SOURCE_LINE - SDB_OUTPUT_SOURCE_LINE (asm_out_file, line); -#else - fprintf (asm_out_file, "\t.ln\t%d\n", - ((sdb_begin_function_line > -1) - ? line - sdb_begin_function_line : 1)); -#endif - } -} - -/* Output sdb info for the current function name. - Called from assemble_start_function. */ - -static void -sdbout_begin_function (tree decl ATTRIBUTE_UNUSED) -{ - sdbout_symbol (current_function_decl, 0); -} - -/* Called at beginning of function body after prologue. Record the - function's starting line number, so we can output relative line numbers - for the other lines. Describe beginning of outermost block. Also - describe the parameter list. */ - -static void -sdbout_begin_prologue (unsigned int line, unsigned int column ATTRIBUTE_UNUSED, - const char *file ATTRIBUTE_UNUSED) -{ - sdbout_end_prologue (line, file); -} - -static void -sdbout_end_prologue (unsigned int line, const char *file ATTRIBUTE_UNUSED) -{ - sdb_begin_function_line = line - 1; - PUT_SDB_FUNCTION_START (line); - sdbout_parms (DECL_ARGUMENTS (current_function_decl)); - sdbout_reg_parms (DECL_ARGUMENTS (current_function_decl)); -} - -/* Called at end of function (before epilogue). - Describe end of outermost block. */ - -static void -sdbout_end_function (unsigned int line) -{ -#ifdef SDB_ALLOW_FORWARD_REFERENCES - sdbout_dequeue_anonymous_types (); -#endif - - MAKE_LINE_SAFE (line); - PUT_SDB_FUNCTION_END (line - sdb_begin_function_line); - - /* Indicate we are between functions, for line-number output. */ - sdb_begin_function_line = -1; -} - -/* Output sdb info for the absolute end of a function. - Called after the epilogue is output. */ - -static void -sdbout_end_epilogue (unsigned int line ATTRIBUTE_UNUSED, - const char *file ATTRIBUTE_UNUSED) -{ - const char *const name ATTRIBUTE_UNUSED - = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl)); - -#ifdef PUT_SDB_EPILOGUE_END - PUT_SDB_EPILOGUE_END (name); -#else - fprintf (asm_out_file, "\t.def\t"); - assemble_name (asm_out_file, name); - fprintf (asm_out_file, "%s\t.val\t.%s\t.scl\t-1%s\t.endef\n", - SDB_DELIM, SDB_DELIM, SDB_DELIM); -#endif -} - -/* Output sdb info for the given label. Called only if LABEL_NAME (insn) - is present. */ - -static void -sdbout_label (rtx_code_label *insn) -{ - PUT_SDB_DEF (LABEL_NAME (insn)); - PUT_SDB_VAL (insn); - PUT_SDB_SCL (C_LABEL); - PUT_SDB_TYPE (T_NULL); - PUT_SDB_ENDEF; -} - -/* Change to reading from a new source file. */ - -static void -sdbout_start_source_file (unsigned int line ATTRIBUTE_UNUSED, - const char *filename ATTRIBUTE_UNUSED) -{ -} - -/* Revert to reading a previous source file. */ - -static void -sdbout_end_source_file (unsigned int line ATTRIBUTE_UNUSED) -{ -} - -/* Set up for SDB output at the start of compilation. */ - -static void -sdbout_init (const char *input_file_name ATTRIBUTE_UNUSED) -{ - tree t; - - vec_alloc (deferred_global_decls, 12); - - /* Emit debug information which was queued by sdbout_symbol before - we got here. */ - sdbout_initialized = true; - - for (t = nreverse (preinit_symbols); t; t = TREE_CHAIN (t)) - sdbout_symbol (TREE_VALUE (t), 0); - preinit_symbols = 0; -} - -#include "gt-sdbout.h" diff --git a/gcc/sdbout.h b/gcc/sdbout.h deleted file mode 100644 index 204b68790ce..00000000000 --- a/gcc/sdbout.h +++ /dev/null @@ -1,26 +0,0 @@ -/* sdbout.h - Various declarations for functions found in sdbout.c - Copyright (C) 1998-2017 Free Software Foundation, Inc. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 3, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING3. If not see -. */ - -#ifndef GCC_SDBOUT_H -#define GCC_SDBOUT_H - -extern void sdbout_symbol (tree, int); -extern void sdbout_types (tree); - -#endif /* GCC_SDBOUT_H */ diff --git a/gcc/system.h b/gcc/system.h index cd464544ff4..187193ff485 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -1018,7 +1018,8 @@ extern void fancy_abort (const char *, int, const char *) ROUND_TOWARDS_ZERO SF_SIZE DF_SIZE XF_SIZE TF_SIZE LIBGCC2_TF_CEXT \ LIBGCC2_LONG_DOUBLE_TYPE_SIZE STRUCT_VALUE \ EH_FRAME_IN_DATA_SECTION TARGET_FLT_EVAL_METHOD_NON_DEFAULT \ - JCR_SECTION_NAME TARGET_USE_JCR_SECTION + JCR_SECTION_NAME TARGET_USE_JCR_SECTION SDB_DEBUGGING_INFO \ + SDB_DEBUG /* Hooks that are no longer used. */ #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE \ diff --git a/gcc/target.def b/gcc/target.def index 6a1cd31f2ac..7bddb8b170a 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -876,9 +876,8 @@ to generate it on the spot.", DEFHOOK (output_source_filename, - "Output COFF information or DWARF debugging information which indicates\ - that filename @var{name} is the current source file to the stdio\ - stream @var{file}.\n\ + "Output DWARF debugging information which indicates that filename\ + @var{name} is the current source file to the stdio stream @var{file}.\n\ \n\ This target hook need not be defined if the standard form of output\ for the file format in use is appropriate.", diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 49693bca887..cd3e7f5b01b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-10-29 Jim Wilson + + * lib/gcc-dg.exp (gcc-dg-debug-runtest): Delete -gcoff. + * lib/gfortran-dg.exp (gfortran-dg-debug-runtest): Delete + -gcoff. + 2017-10-28 Paolo Carlini PR c++/70971 diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index cb5d1843c92..d8f9b7bd2bb 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -560,7 +560,7 @@ proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } { if ![info exists DEBUG_TORTURE_OPTIONS] { set DEBUG_TORTURE_OPTIONS "" - foreach type {-gdwarf-2 -gstabs -gstabs+ -gxcoff -gxcoff+ -gcoff} { + foreach type {-gdwarf-2 -gstabs -gstabs+ -gxcoff -gxcoff+} { set comp_output [$target_compile \ "$srcdir/$subdir/$trivial" "trivial.S" assembly \ "additional_flags=$type"] diff --git a/gcc/testsuite/lib/gfortran-dg.exp b/gcc/testsuite/lib/gfortran-dg.exp index 27b2a69b9e2..6f190092f28 100644 --- a/gcc/testsuite/lib/gfortran-dg.exp +++ b/gcc/testsuite/lib/gfortran-dg.exp @@ -162,7 +162,7 @@ proc gfortran-dg-debug-runtest { target_compile trivial opt_opts testcases } { if ![info exists DEBUG_TORTURE_OPTIONS] { set DEBUG_TORTURE_OPTIONS "" - set type_list [list "-gstabs" "-gstabs+" "-gxcoff" "-gxcoff+" "-gcoff" "-gdwarf-2" ] + set type_list [list "-gstabs" "-gstabs+" "-gxcoff" "-gxcoff+" "-gdwarf-2" ] foreach type $type_list { set comp_output [$target_compile \ "$srcdir/$subdir/$trivial" "trivial.S" assembly \ diff --git a/gcc/toplev.c b/gcc/toplev.c index 8c45e1df2af..81a7cf6b7dc 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -88,8 +88,6 @@ along with GCC; see the file COPYING3. If not see #include "dbxout.h" #endif -#include "sdbout.h" - #ifdef XCOFF_DEBUGGING_INFO #include "xcoffout.h" /* Needed for external data declarations. */ #endif @@ -1467,8 +1465,6 @@ process_options (void) else if (write_symbols == XCOFF_DEBUG) debug_hooks = &xcoff_debug_hooks; #endif - else if (SDB_DEBUGGING_INFO && write_symbols == SDB_DEBUG) - debug_hooks = &sdb_debug_hooks; #ifdef DWARF2_DEBUGGING_INFO else if (write_symbols == DWARF2_DEBUG) debug_hooks = &dwarf2_debug_hooks; diff --git a/gcc/tree-core.h b/gcc/tree-core.h index ed35847dc52..f74f1453de6 100644 --- a/gcc/tree-core.h +++ b/gcc/tree-core.h @@ -1538,7 +1538,6 @@ struct GTY(()) tree_type_common { tree reference_to; union tree_type_symtab { int GTY ((tag ("TYPE_SYMTAB_IS_ADDRESS"))) address; - const char * GTY ((tag ("TYPE_SYMTAB_IS_POINTER"))) pointer; struct die_struct * GTY ((tag ("TYPE_SYMTAB_IS_DIE"))) die; } GTY ((desc ("debug_hooks->tree_type_symtab_field"))) symtab; tree canonical; diff --git a/gcc/tree.c b/gcc/tree.c index fa6fcb1da71..28e157f5fd2 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1206,8 +1206,8 @@ copy_node (tree node MEM_STAT_DECL) The two statements usually duplicate each other (because they clear fields of the same union), but the optimizer should catch that. */ - TYPE_SYMTAB_POINTER (t) = 0; TYPE_SYMTAB_ADDRESS (t) = 0; + TYPE_SYMTAB_DIE (t) = 0; /* Do not copy the values cache. */ if (TYPE_CACHED_VALUES_P (t)) diff --git a/gcc/tree.h b/gcc/tree.h index 7214ae2275c..277aa919780 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2072,11 +2072,6 @@ extern machine_mode vector_type_mode (const_tree); #define TYPE_SYMTAB_ADDRESS(NODE) \ (TYPE_CHECK (NODE)->type_common.symtab.address) -/* Symtab field as a string. Used by COFF generator in sdbout.c to - hold struct/union type tag names. */ -#define TYPE_SYMTAB_POINTER(NODE) \ - (TYPE_CHECK (NODE)->type_common.symtab.pointer) - /* Symtab field as a pointer to a DWARF DIE. Used by DWARF generator in dwarf2out.c to point to the DIE generated for the type. */ #define TYPE_SYMTAB_DIE(NODE) \ @@ -2087,8 +2082,7 @@ extern machine_mode vector_type_mode (const_tree); union. */ #define TYPE_SYMTAB_IS_ADDRESS (0) -#define TYPE_SYMTAB_IS_POINTER (1) -#define TYPE_SYMTAB_IS_DIE (2) +#define TYPE_SYMTAB_IS_DIE (1) #define TYPE_LANG_SPECIFIC(NODE) \ (TYPE_CHECK (NODE)->type_with_lang_specific.lang_specific) diff --git a/gcc/xcoffout.c b/gcc/xcoffout.c index 17b201aced6..cf2064d5ba5 100644 --- a/gcc/xcoffout.c +++ b/gcc/xcoffout.c @@ -20,7 +20,7 @@ along with GCC; see the file COPYING3. If not see /* Output xcoff-format symbol table data. The main functionality is contained in dbxout.c. This file implements the sdbout-like parts of the xcoff interface. Many functions are very similar to their counterparts in - sdbout.c. */ + the former sdbout.c file. */ #include "config.h" #include "system.h" @@ -452,7 +452,7 @@ xcoffout_begin_prologue (unsigned int line, ASM_OUTPUT_LFB (asm_out_file, line); dbxout_parms (DECL_ARGUMENTS (current_function_decl)); - /* Emit the symbols for the outermost BLOCK's variables. sdbout.c does this + /* Emit the symbols for the outermost BLOCK's variables. sdbout.c did this in sdbout_begin_block, but there is no guarantee that there will be any inner block 1, so we must do it here. This gives a result similar to dbxout, so it does make some sense. */