Add support for -gstabs on SVR4 configurations.
authorIan Lance Taylor <ian@gcc.gnu.org>
Fri, 2 Sep 1994 18:25:11 +0000 (18:25 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Fri, 2 Sep 1994 18:25:11 +0000 (18:25 +0000)
From-SVN: r8017

gcc/config/sparc/sol2.h
gcc/config/sparc/sysv4.h
gcc/config/svr4.h

index 558c4fbea6bad77e7e296713e16003208ebbf612..c37901531ef401dee48df3cf2585306be4da5e2e 100644 (file)
@@ -51,21 +51,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 /* We use stabs-in-elf for debugging, because that is what the native
    toolchain uses.  */
-#define DBX_DEBUGGING_INFO
+#undef PREFERRED_DEBUGGING_TYPE
 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
 
-#define DBX_BLOCKS_FUNCTION_RELATIVE 1
-
-/* "gcc2_compiled." must be a .stabs, not an ordinary symbol, or GDB won't
-   see it.  Furthermore, since GDB reads the input piecemeal, starting
-   with each N_SO, it's a lot easier if the gcc2 flag symbol is *after*
-   the N_SO rather than before it.  So we emit an N_OPT stab here.  */
-
-#define ASM_IDENTIFY_GCC(FILE) /* Do nothing */
-
-#define ASM_IDENTIFY_GCC_AFTER_SOURCE(FILE)    \
- fputs ("\t.stabs\t\"gcc2_compiled.\", 0x3c, 0, 0, 0\n", FILE)
-
 /* The Solaris 2 assembler uses .skip, not .zero, so put this back. */
 #undef ASM_OUTPUT_SKIP
 #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
@@ -106,20 +94,6 @@ do {                                                                        \
 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)  \
   sprintf (LABEL, "*.L%s%d", PREFIX, NUM)
 
-/* in Solaris 2.0, linenos are relative to the current fn. */
-#undef  ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(file, line)             \
-  { static int sym_lineno = 1;                         \
-    fprintf (file, ".stabn 68,0,%d,.LM%d-%s\n.LM%d:\n",        \
-            line, sym_lineno,                          \
-            XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0), \
-            sym_lineno);                               \
-    sym_lineno += 1; }
-
-/* But, to make this work, we have to output the stabs for the function
-   name *first*...  */
-#define        DBX_FUNCTION_FIRST
-
 \f
 /* We don't use the standard svr4 STARTFILE_SPEC because it's wrong for us.
    We don't use the standard LIB_SPEC only because we don't yet support c++ */
index 64568e5bcca741f372c36e9589b8876fbfef3dd8..066fa1813e7ae9cde37097c4a28b621d3c1a3429 100644 (file)
@@ -24,8 +24,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 /* Undefine some symbols which are defined in "sparc.h" but which are
    appropriate only for SunOS 4.x, and not for svr4.  */
 
-#undef DBX_DEBUGGING_INFO
 #undef WORD_SWITCH_TAKES_ARG
+#undef ASM_OUTPUT_SOURCE_LINE
 #undef SELECT_SECTION
 #undef ASM_DECLARE_FUNCTION_NAME
 #undef TEXT_SECTION_ASM_OP
index 48aca3cd2543caa368df6a67ceae55a011ac4052..d4124919e30246207d1515cf54f9b280059b9ead 100644 (file)
@@ -244,6 +244,64 @@ do {                                                               \
 
 #undef DBX_REGISTER_NUMBER
 
+/* gas on SVR4 supports the use of .stabs.  Permit -gstabs to be used
+   in general, although it will only work when using gas.  */
+
+#define DBX_DEBUGGING_INFO
+
+/* Use DWARF debugging info by default.  */
+
+#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
+
+/* Make LBRAC and RBRAC addresses relative to the start of the
+   function.  The native Solaris stabs debugging format works this
+   way, gdb expects it, and it reduces the number of relocation
+   entries.  */
+
+#define DBX_BLOCKS_FUNCTION_RELATIVE 1
+
+/* When using stabs, gcc2_compiled must be a stabs entry, not an
+   ordinary symbol, or gdb won't see it.  Furthermore, since gdb reads
+   the input piecemeal, starting with each N_SO, it's a lot easier if
+   the gcc2 flag symbol is *after* the N_SO rather than before it.  So
+   we emit an N_OPT stab there.  */
+
+#define ASM_IDENTIFY_GCC(FILE)                                         \
+do                                                                     \
+  {                                                                    \
+    if (write_symbols != DBX_DEBUG)                                    \
+      fputs ("gcc2_compiled.:\n", FILE);                               \
+  }                                                                    \
+while (0)
+
+#define ASM_IDENTIFY_GCC_AFTER_SOURCE(FILE)                            \
+do                                                                     \
+  {                                                                    \
+    if (write_symbols == DBX_DEBUG)                                    \
+      fputs ("\t.stabs\t\"gcc2_compiled.\", 0x3c, 0, 0, 0\n", FILE);   \
+  }                                                                    \
+while (0)
+
+/* Like block addresses, stabs line numbers are relative to the
+   current function.  */
+
+#define ASM_OUTPUT_SOURCE_LINE(file, line)                             \
+do                                                                     \
+  {                                                                    \
+    static int sym_lineno = 1;                                         \
+    fprintf (file, ".stabn 68,0,%d,.LM%d-%s\n.LM%d:\n",                        \
+            line, sym_lineno,                                          \
+            XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0),      \
+            sym_lineno);                                               \
+    sym_lineno += 1;                                                   \
+  }                                                                    \
+while (0)
+
+/* In order for relative line numbers to work, we must output the
+   stabs entry for the function name first.  */
+
+#define DBX_FUNCTION_FIRST
+
 /* Define the actual types of some ANSI-mandated types.  (These
    definitions should work for most SVR4 systems).  */