dbxelf.h revision 117395
152284Sobrien/* Definitions needed when using stabs embedded in ELF sections.
252284Sobrien   Copyright (C) 1999 Free Software Foundation, Inc.
352284Sobrien
452284SobrienThis file is part of GNU CC.
552284Sobrien
652284SobrienGNU CC is free software; you can redistribute it and/or modify
752284Sobrienit under the terms of the GNU General Public License as published by
852284Sobrienthe Free Software Foundation; either version 2, or (at your option)
952284Sobrienany later version.
1052284Sobrien
1152284SobrienGNU CC is distributed in the hope that it will be useful,
1252284Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of
1352284SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1452284SobrienGNU General Public License for more details.
1552284Sobrien
1652284SobrienYou should have received a copy of the GNU General Public License
1752284Sobrienalong with GNU CC; see the file COPYING.  If not, write to
1852284Sobrienthe Free Software Foundation, 59 Temple Place - Suite 330,
1952284SobrienBoston, MA 02111-1307, USA.  */
2052284Sobrien
2152284Sobrien/* This file may be included by any ELF target which wishes to
2252284Sobrien   support -gstabs generating stabs in sections, as produced by gas
2352284Sobrien   and understood by gdb.  */
2452284Sobrien
2590075Sobrien#ifndef GCC_DBX_ELF_H
2690075Sobrien#define GCC_DBX_ELF_H
2752284Sobrien
2852284Sobrien/* Output DBX (stabs) debugging information if doing -gstabs.  */
2952284Sobrien
30117395Skan#define DBX_DEBUGGING_INFO 1
3152284Sobrien
3252284Sobrien/* Make LBRAC and RBRAC addresses relative to the start of the
3352284Sobrien   function.  The native Solaris stabs debugging format works this
3452284Sobrien   way, gdb expects it, and it reduces the number of relocation
3552284Sobrien   entries...  */
3652284Sobrien
3752284Sobrien#undef  DBX_BLOCKS_FUNCTION_RELATIVE
3852284Sobrien#define DBX_BLOCKS_FUNCTION_RELATIVE 1
3952284Sobrien
4052284Sobrien/* ... but, to make this work, functions must appear prior to line info.  */
4152284Sobrien
4252284Sobrien#undef  DBX_FUNCTION_FIRST
4352284Sobrien#define DBX_FUNCTION_FIRST
4452284Sobrien
4552284Sobrien/* When generating stabs debugging, use N_BINCL entries.  */
4652284Sobrien
4752284Sobrien#undef  DBX_USE_BINCL
4852284Sobrien#define DBX_USE_BINCL
4952284Sobrien
5052284Sobrien/* There is no limit to the length of stabs strings.  */
5152284Sobrien
5252284Sobrien#ifndef DBX_CONTIN_LENGTH
5352284Sobrien#define DBX_CONTIN_LENGTH 0
5452284Sobrien#endif
5552284Sobrien
5652284Sobrien/* Like block addresses, stabs line numbers are relative to the
5752284Sobrien   current function.  */
5852284Sobrien
5952284Sobrien#undef  ASM_OUTPUT_SOURCE_LINE
6052284Sobrien#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE)				\
6152284Sobriendo									\
6252284Sobrien  {									\
6352284Sobrien    static int sym_lineno = 1;						\
6452284Sobrien    char temp[256];							\
6552284Sobrien    ASM_GENERATE_INTERNAL_LABEL (temp, "LM", sym_lineno);		\
6690075Sobrien    fprintf (FILE, "\t.stabn 68,0,%d,", LINE);				\
6752284Sobrien    assemble_name (FILE, temp);						\
6852284Sobrien    putc ('-', FILE);							\
6952284Sobrien    assemble_name (FILE,						\
7052284Sobrien		   XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\
7152284Sobrien    putc ('\n', FILE);							\
7252284Sobrien    ASM_OUTPUT_INTERNAL_LABEL (FILE, "LM", sym_lineno);			\
7352284Sobrien    sym_lineno += 1;							\
7452284Sobrien  }									\
7552284Sobrienwhile (0)
7652284Sobrien
7752284Sobrien/* Generate a blank trailing N_SO to mark the end of the .o file, since
7852284Sobrien   we can't depend upon the linker to mark .o file boundaries with
7952284Sobrien   embedded stabs.  */
8052284Sobrien
8152284Sobrien#undef  DBX_OUTPUT_MAIN_SOURCE_FILE_END
8252284Sobrien#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME)			\
8352284Sobrien  asm_fprintf (FILE,							\
8452284Sobrien	       "\t.text\n\t.stabs \"\",%d,0,0,%LLetext\n%LLetext:\n", N_SO)
8552284Sobrien
8690075Sobrien#endif /* ! GCC_DBX_ELF_H */
87