]>
Commit | Line | Data |
---|---|---|
cedcf937 NC |
1 | /* Definitions needed when using stabs embedded in ELF sections. |
2 | Copyright (C) 1999 Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of GNU CC. | |
5 | ||
6 | GNU CC is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2, or (at your option) | |
9 | any later version. | |
10 | ||
11 | GNU CC is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GNU CC; see the file COPYING. If not, write to | |
18 | the Free Software Foundation, 59 Temple Place - Suite 330, | |
19 | Boston, MA 02111-1307, USA. */ | |
20 | ||
21 | /* This file may be included by any ELF target which wishes to | |
22 | support -gstabs generating stabs in sections, as produced by gas | |
23 | and understood by gdb. */ | |
24 | ||
25 | #ifndef __DBX_ELF_H | |
26 | #define __DBX_ELF_H | |
27 | ||
28 | /* Output DBX (stabs) debugging information if doing -gstabs. */ | |
29 | ||
30 | #undef DBX_DEBUGGING_INFO | |
31 | #define DBX_DEBUGGING_INFO | |
32 | ||
33 | /* Make LBRAC and RBRAC addresses relative to the start of the | |
34 | function. The native Solaris stabs debugging format works this | |
35 | way, gdb expects it, and it reduces the number of relocation | |
36 | entries... */ | |
37 | ||
38 | #undef DBX_BLOCKS_FUNCTION_RELATIVE | |
39 | #define DBX_BLOCKS_FUNCTION_RELATIVE 1 | |
40 | ||
41 | /* ... but, to make this work, functions must appear prior to line info. */ | |
42 | ||
43 | #undef DBX_FUNCTION_FIRST | |
44 | #define DBX_FUNCTION_FIRST | |
45 | ||
46 | /* When generating stabs debugging, use N_BINCL entries. */ | |
47 | ||
48 | #undef DBX_USE_BINCL | |
49 | #define DBX_USE_BINCL | |
50 | ||
51 | /* There is no limit to the length of stabs strings. */ | |
52 | ||
53 | #ifndef DBX_CONTIN_LENGTH | |
54 | #define DBX_CONTIN_LENGTH 0 | |
55 | #endif | |
56 | ||
57 | /* When using stabs, gcc2_compiled must be a stabs entry, not an | |
58 | ordinary symbol, or gdb won't see it. Furthermore, since gdb reads | |
59 | the input piecemeal, starting with each N_SO, it's a lot easier if | |
60 | the gcc2 flag symbol is *after* the N_SO rather than before it. So | |
61 | we emit an N_OPT stab there. */ | |
62 | ||
63 | #define ASM_IDENTIFY_GCC(FILE) \ | |
64 | do \ | |
65 | { \ | |
66 | if (write_symbols != DBX_DEBUG) \ | |
67 | fputs ("gcc2_compiled.:\n", FILE); \ | |
68 | } \ | |
69 | while (0) | |
70 | ||
71 | #define ASM_IDENTIFY_GCC_AFTER_SOURCE(FILE) \ | |
72 | do \ | |
73 | { \ | |
74 | if (write_symbols == DBX_DEBUG) \ | |
75 | fputs ("\t.stabs\t\"gcc2_compiled.\", 0x3c, 0, 0, 0\n", FILE); \ | |
76 | } \ | |
77 | while (0) | |
78 | ||
79 | /* Like block addresses, stabs line numbers are relative to the | |
80 | current function. */ | |
81 | ||
82 | #undef ASM_OUTPUT_SOURCE_LINE | |
83 | #define ASM_OUTPUT_SOURCE_LINE(file, line) \ | |
84 | do \ | |
85 | { \ | |
86 | static int sym_lineno = 1; \ | |
87 | fprintf (file, ".stabn 68,0,%d,.LM%d-", \ | |
88 | line, sym_lineno); \ | |
89 | assemble_name (file, \ | |
90 | XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\ | |
91 | fprintf (file, "\n.LM%d:\n", sym_lineno); \ | |
92 | sym_lineno += 1; \ | |
93 | } \ | |
94 | while (0) | |
95 | ||
96 | /* Generate a blank trailing N_SO to mark the end of the .o file, since | |
97 | we can't depend upon the linker to mark .o file boundaries with | |
98 | embedded stabs. */ | |
99 | ||
100 | #undef DBX_OUTPUT_MAIN_SOURCE_FILE_END | |
101 | #define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \ | |
102 | fprintf (FILE, \ | |
103 | "\t.text\n\t.stabs \"\",%d,0,0,Letext\nLetext:\n", N_SO) | |
104 | ||
105 | #endif /* __DBX_ELF_H */ |