Add support for -gstabs on SVR4 configurations.

From-SVN: r8017
This commit is contained in:
Ian Lance Taylor 1994-09-02 18:25:11 +00:00
parent a89b2cc458
commit 136bfcb334
3 changed files with 60 additions and 28 deletions

View 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
/* 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++ */

View 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

View 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). */