dbxelf.h revision 132718
152284Sobrien/* Definitions needed when using stabs embedded in ELF sections.
252284Sobrien   Copyright (C) 1999 Free Software Foundation, Inc.
352284Sobrien
4132718SkanThis file is part of GCC.
552284Sobrien
6132718SkanGCC 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
11132718SkanGCC 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
17132718Skanalong with GCC; 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
60132718Skan#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE, COUNTER)			\
6152284Sobriendo									\
6252284Sobrien  {									\
6352284Sobrien    char temp[256];							\
64132718Skan    ASM_GENERATE_INTERNAL_LABEL (temp, "LM", COUNTER);			\
6590075Sobrien    fprintf (FILE, "\t.stabn 68,0,%d,", LINE);				\
6652284Sobrien    assemble_name (FILE, temp);						\
6752284Sobrien    putc ('-', FILE);							\
6852284Sobrien    assemble_name (FILE,						\
6952284Sobrien		   XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\
7052284Sobrien    putc ('\n', FILE);							\
71132718Skan    (*targetm.asm_out.internal_label) (FILE, "LM", COUNTER);		\
7252284Sobrien  }									\
7352284Sobrienwhile (0)
7452284Sobrien
7552284Sobrien/* Generate a blank trailing N_SO to mark the end of the .o file, since
7652284Sobrien   we can't depend upon the linker to mark .o file boundaries with
7752284Sobrien   embedded stabs.  */
7852284Sobrien
7952284Sobrien#undef  DBX_OUTPUT_MAIN_SOURCE_FILE_END
8052284Sobrien#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME)			\
8152284Sobrien  asm_fprintf (FILE,							\
8252284Sobrien	       "\t.text\n\t.stabs \"\",%d,0,0,%LLetext\n%LLetext:\n", N_SO)
8352284Sobrien
8490075Sobrien#endif /* ! GCC_DBX_ELF_H */
85