]>
Commit | Line | Data |
---|---|---|
946754ae | 1 | /* Output dbx-format symbol table information from GNU compiler. |
ddca3e9d | 2 | Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, |
cd3034ab | 3 | 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. |
946754ae | 4 | |
f12b58b3 | 5 | This file is part of GCC. |
946754ae | 6 | |
f12b58b3 | 7 | GCC is free software; you can redistribute it and/or modify it under |
8 | the terms of the GNU General Public License as published by the Free | |
9 | Software Foundation; either version 2, or (at your option) any later | |
10 | version. | |
946754ae | 11 | |
f12b58b3 | 12 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
13 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 | for more details. | |
946754ae | 16 | |
17 | You should have received a copy of the GNU General Public License | |
f12b58b3 | 18 | along with GCC; see the file COPYING. If not, write to the Free |
19 | Software Foundation, 59 Temple Place - Suite 330, Boston, MA | |
20 | 02111-1307, USA. */ | |
946754ae | 21 | |
22 | ||
23 | /* Output dbx-format symbol table data. | |
24 | This consists of many symbol table entries, each of them | |
25 | a .stabs assembler pseudo-op with four operands: | |
26 | a "name" which is really a description of one symbol and its type, | |
27 | a "code", which is a symbol defined in stab.h whose name starts with N_, | |
28 | an unused operand always 0, | |
29 | and a "value" which is an address or an offset. | |
30 | The name is enclosed in doublequote characters. | |
31 | ||
32 | Each function, variable, typedef, and structure tag | |
33 | has a symbol table entry to define it. | |
34 | The beginning and end of each level of name scoping within | |
35 | a function are also marked by special symbol table entries. | |
36 | ||
37 | The "name" consists of the symbol name, a colon, a kind-of-symbol letter, | |
38 | and a data type number. The data type number may be followed by | |
39 | "=" and a type definition; normally this will happen the first time | |
40 | the type number is mentioned. The type definition may refer to | |
41 | other types by number, and those type numbers may be followed | |
42 | by "=" and nested definitions. | |
43 | ||
44 | This can make the "name" quite long. | |
45 | When a name is more than 80 characters, we split the .stabs pseudo-op | |
46 | into two .stabs pseudo-ops, both sharing the same "code" and "value". | |
47 | The first one is marked as continued with a double-backslash at the | |
48 | end of its "name". | |
49 | ||
50 | The kind-of-symbol letter distinguished function names from global | |
51 | variables from file-scope variables from parameters from auto | |
52 | variables in memory from typedef names from register variables. | |
53 | See `dbxout_symbol'. | |
54 | ||
55 | The "code" is mostly redundant with the kind-of-symbol letter | |
56 | that goes in the "name", but not entirely: for symbols located | |
57 | in static storage, the "code" says which segment the address is in, | |
58 | which controls how it is relocated. | |
59 | ||
60 | The "value" for a symbol in static storage | |
61 | is the core address of the symbol (actually, the assembler | |
62 | label for the symbol). For a symbol located in a stack slot | |
63 | it is the stack offset; for one in a register, the register number. | |
64 | For a typedef symbol, it is zero. | |
65 | ||
66 | If DEBUG_SYMS_TEXT is defined, all debugging symbols must be | |
67 | output while in the text section. | |
68 | ||
69 | For more on data type definitions, see `dbxout_type'. */ | |
70 | ||
0dbd1c74 | 71 | #include "config.h" |
405711de | 72 | #include "system.h" |
805e22b2 | 73 | #include "coretypes.h" |
74 | #include "tm.h" | |
3ef9782d | 75 | |
946754ae | 76 | #include "tree.h" |
77 | #include "rtl.h" | |
78 | #include "flags.h" | |
79 | #include "regs.h" | |
80 | #include "insn-config.h" | |
81 | #include "reload.h" | |
73af00bf | 82 | #include "output.h" /* ASM_OUTPUT_SOURCE_LINE may refer to sdb functions. */ |
744d3441 | 83 | #include "dbxout.h" |
0e93a6ac | 84 | #include "toplev.h" |
1dd6c958 | 85 | #include "tm_p.h" |
cff53614 | 86 | #include "ggc.h" |
b896d81b | 87 | #include "debug.h" |
0c87a39e | 88 | #include "function.h" |
2cb4ac60 | 89 | #include "target.h" |
d19bd1f0 | 90 | #include "langhooks.h" |
946754ae | 91 | |
439c05a0 | 92 | #ifdef XCOFF_DEBUGGING_INFO |
3d82b777 | 93 | #include "xcoffout.h" |
439c05a0 | 94 | #endif |
95 | ||
262444a6 | 96 | #undef DBXOUT_DECR_NESTING |
97 | #define DBXOUT_DECR_NESTING \ | |
98 | if (--debug_nesting == 0 && symbol_queue_index > 0) \ | |
51cec339 | 99 | { emit_pending_bincls_if_required (); debug_flush_symbol_queue (); } |
262444a6 | 100 | |
101 | #undef DBXOUT_DECR_NESTING_AND_RETURN | |
102 | #define DBXOUT_DECR_NESTING_AND_RETURN(x) \ | |
103 | do {--debug_nesting; return (x);} while (0) | |
104 | ||
946754ae | 105 | #ifndef ASM_STABS_OP |
6ae8577b | 106 | #define ASM_STABS_OP "\t.stabs\t" |
946754ae | 107 | #endif |
108 | ||
109 | #ifndef ASM_STABN_OP | |
6ae8577b | 110 | #define ASM_STABN_OP "\t.stabn\t" |
946754ae | 111 | #endif |
112 | ||
98123cec | 113 | #ifndef DBX_TYPE_DECL_STABS_CODE |
114 | #define DBX_TYPE_DECL_STABS_CODE N_LSYM | |
439c05a0 | 115 | #endif |
116 | ||
117 | #ifndef DBX_STATIC_CONST_VAR_CODE | |
118 | #define DBX_STATIC_CONST_VAR_CODE N_FUN | |
119 | #endif | |
120 | ||
121 | #ifndef DBX_REGPARM_STABS_CODE | |
122 | #define DBX_REGPARM_STABS_CODE N_RSYM | |
123 | #endif | |
124 | ||
125 | #ifndef DBX_REGPARM_STABS_LETTER | |
126 | #define DBX_REGPARM_STABS_LETTER 'P' | |
127 | #endif | |
128 | ||
84f564cc | 129 | /* This is used for parameters passed by invisible reference in a register. */ |
130 | #ifndef GDB_INV_REF_REGPARM_STABS_LETTER | |
131 | #define GDB_INV_REF_REGPARM_STABS_LETTER 'a' | |
132 | #endif | |
133 | ||
98123cec | 134 | #ifndef DBX_MEMPARM_STABS_LETTER |
135 | #define DBX_MEMPARM_STABS_LETTER 'p' | |
136 | #endif | |
137 | ||
cc3c079f | 138 | #ifndef FILE_NAME_JOINER |
139 | #define FILE_NAME_JOINER "/" | |
140 | #endif | |
141 | ||
f006a2e6 | 142 | /* GDB needs to know that the stabs were generated by GCC. We emit an |
143 | N_OPT stab at the beginning of the source file to indicate this. | |
144 | The string is historical, and different on a very few targets. */ | |
145 | #ifndef STABS_GCC_MARKER | |
146 | #define STABS_GCC_MARKER "gcc2_compiled." | |
147 | #endif | |
148 | ||
946754ae | 149 | enum typestatus {TYPE_UNSEEN, TYPE_XREF, TYPE_DEFINED}; |
150 | ||
54ae7e56 | 151 | /* Structure recording information about a C data type. |
152 | The status element says whether we have yet output | |
153 | the definition of the type. TYPE_XREF says we have | |
154 | output it as a cross-reference only. | |
155 | The file_number and type_number elements are used if DBX_USE_BINCL | |
156 | is defined. */ | |
157 | ||
573aba85 | 158 | struct typeinfo GTY(()) |
54ae7e56 | 159 | { |
160 | enum typestatus status; | |
54ae7e56 | 161 | int file_number; |
162 | int type_number; | |
54ae7e56 | 163 | }; |
164 | ||
165 | /* Vector recording information about C data types. | |
946754ae | 166 | When we first notice a data type (a tree node), |
167 | we assign it a number using next_type_number. | |
54ae7e56 | 168 | That is its index in this vector. */ |
946754ae | 169 | |
573aba85 | 170 | static GTY ((length ("typevec_len"))) struct typeinfo *typevec; |
946754ae | 171 | |
172 | /* Number of elements of space allocated in `typevec'. */ | |
173 | ||
573aba85 | 174 | static GTY(()) int typevec_len; |
946754ae | 175 | |
176 | /* In dbx output, each type gets a unique number. | |
177 | This is the number for the next type output. | |
178 | The number, once assigned, is in the TYPE_SYMTAB_ADDRESS field. */ | |
179 | ||
573aba85 | 180 | static GTY(()) int next_type_number; |
54ae7e56 | 181 | |
73ae3ef7 | 182 | /* The C front end may call dbxout_symbol before dbxout_init runs. |
183 | We save all such decls in this list and output them when we get | |
184 | to dbxout_init. */ | |
185 | ||
186 | static GTY(()) tree preinit_symbols; | |
187 | ||
51cec339 | 188 | enum binclstatus {BINCL_NOT_REQUIRED, BINCL_PENDING, BINCL_PROCESSED}; |
189 | ||
54ae7e56 | 190 | /* When using N_BINCL in dbx output, each type number is actually a |
191 | pair of the file number and the type number within the file. | |
192 | This is a stack of input files. */ | |
193 | ||
65f52f4e | 194 | struct dbx_file |
54ae7e56 | 195 | { |
196 | struct dbx_file *next; | |
197 | int file_number; | |
198 | int next_type_number; | |
65f52f4e | 199 | enum binclstatus bincl_status; /* Keep track of lazy bincl. */ |
200 | const char *pending_bincl_name; /* Name of bincl. */ | |
201 | struct dbx_file *prev; /* Chain to traverse all pending bincls. */ | |
54ae7e56 | 202 | }; |
203 | ||
65f52f4e | 204 | /* This is the top of the stack. |
205 | ||
206 | This is not saved for PCH, because restoring a PCH should not change it. | |
207 | next_file_number does have to be saved, because the PCH may use some | |
208 | file numbers; however, just before restoring a PCH, next_file_number | |
209 | should always be 0 because we should not have needed any file numbers | |
210 | yet. */ | |
54ae7e56 | 211 | |
7bff8f28 | 212 | #if (defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)) \ |
213 | && defined (DBX_USE_BINCL) | |
65f52f4e | 214 | static struct dbx_file *current_file; |
14f1f66f | 215 | #endif |
54ae7e56 | 216 | |
217 | /* This is the next file number to use. */ | |
218 | ||
573aba85 | 219 | static GTY(()) int next_file_number; |
220 | ||
cf8e41a4 | 221 | /* A counter for dbxout_function_end. */ |
38ac91bf | 222 | |
cf8e41a4 | 223 | static GTY(()) int scope_labelno; |
38ac91bf | 224 | |
b1bd5ac9 | 225 | /* A counter for dbxout_source_line. */ |
226 | ||
227 | static GTY(()) int dbxout_source_line_counter; | |
228 | ||
573aba85 | 229 | /* Nonzero if we have actually used any of the GDB extensions |
230 | to the debugging format. The idea is that we use them for the | |
231 | first time only if there's a strong reason, but once we have done that, | |
232 | we use them whenever convenient. */ | |
233 | ||
cf8e41a4 | 234 | static GTY(()) int have_used_extensions = 0; |
573aba85 | 235 | |
236 | /* Number for the next N_SOL filename stabs label. The number 0 is reserved | |
237 | for the N_SO filename stabs label. */ | |
238 | ||
cf8e41a4 | 239 | static GTY(()) int source_label_number = 1; |
240 | ||
241 | /* Last source file name mentioned in a NOTE insn. */ | |
242 | ||
243 | static GTY(()) const char *lastfile; | |
244 | ||
245 | /* Used by PCH machinery to detect if 'lastfile' should be reset to | |
246 | base_input_file. */ | |
247 | static GTY(()) int lastfile_is_base; | |
248 | ||
249 | /* Typical USG systems don't have stab.h, and they also have | |
250 | no use for DBX-format debugging info. */ | |
251 | ||
252 | #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO) | |
253 | ||
241af3cc | 254 | #ifdef DBX_USE_BINCL |
255 | /* If zero then there is no pending BINCL. */ | |
256 | static int pending_bincls = 0; | |
257 | #endif | |
258 | ||
cf8e41a4 | 259 | /* The original input file name. */ |
260 | static const char *base_input_file; | |
261 | ||
262 | /* Current working directory. */ | |
263 | ||
264 | static const char *cwd; | |
573aba85 | 265 | |
266 | #ifdef DEBUG_SYMS_TEXT | |
267 | #define FORCE_TEXT function_section (current_function_decl); | |
268 | #else | |
269 | #define FORCE_TEXT | |
270 | #endif | |
271 | ||
272 | #include "gstab.h" | |
273 | ||
274 | #define STAB_CODE_TYPE enum __stab_debug_code | |
275 | ||
276 | /* 1 if PARM is passed to this function in memory. */ | |
277 | ||
278 | #define PARM_PASSED_IN_MEMORY(PARM) \ | |
279 | (GET_CODE (DECL_INCOMING_RTL (PARM)) == MEM) | |
54ae7e56 | 280 | |
573aba85 | 281 | /* A C expression for the integer offset value of an automatic variable |
282 | (N_LSYM) having address X (an RTX). */ | |
283 | #ifndef DEBUGGER_AUTO_OFFSET | |
284 | #define DEBUGGER_AUTO_OFFSET(X) \ | |
285 | (GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0) | |
286 | #endif | |
287 | ||
288 | /* A C expression for the integer offset value of an argument (N_PSYM) | |
289 | having address X (an RTX). The nominal offset is OFFSET. */ | |
290 | #ifndef DEBUGGER_ARG_OFFSET | |
291 | #define DEBUGGER_ARG_OFFSET(OFFSET, X) (OFFSET) | |
292 | #endif | |
293 | ||
294 | /* Stream for writing to assembler file. */ | |
295 | ||
296 | static FILE *asmfile; | |
54ae7e56 | 297 | |
946754ae | 298 | /* These variables are for dbxout_symbol to communicate to |
299 | dbxout_finish_symbol. | |
300 | current_sym_code is the symbol-type-code, a symbol N_... define in stab.h. | |
301 | current_sym_value and current_sym_addr are two ways to address the | |
302 | value to store in the symtab entry. | |
303 | current_sym_addr if nonzero represents the value as an rtx. | |
304 | If that is zero, current_sym_value is used. This is used | |
305 | when the value is an offset (such as for auto variables, | |
306 | register variables and parms). */ | |
307 | ||
308 | static STAB_CODE_TYPE current_sym_code; | |
309 | static int current_sym_value; | |
310 | static rtx current_sym_addr; | |
311 | ||
312 | /* Number of chars of symbol-description generated so far for the | |
313 | current symbol. Used by CHARS and CONTIN. */ | |
314 | ||
315 | static int current_sym_nchars; | |
316 | ||
317 | /* Report having output N chars of the current symbol-description. */ | |
318 | ||
319 | #define CHARS(N) (current_sym_nchars += (N)) | |
320 | ||
321 | /* Break the current symbol-description, generating a continuation, | |
322 | if it has become long. */ | |
323 | ||
324 | #ifndef DBX_CONTIN_LENGTH | |
325 | #define DBX_CONTIN_LENGTH 80 | |
326 | #endif | |
327 | ||
328 | #if DBX_CONTIN_LENGTH > 0 | |
329 | #define CONTIN \ | |
330 | do {if (current_sym_nchars > DBX_CONTIN_LENGTH) dbxout_continue ();} while (0) | |
331 | #else | |
fb09780f | 332 | #define CONTIN do { } while (0) |
946754ae | 333 | #endif |
334 | ||
b0eb97d5 | 335 | #ifdef DBX_USE_BINCL |
51cec339 | 336 | static void emit_bincl_stab (const char *c); |
337 | static void emit_pending_bincls (void); | |
2a3d2f63 | 338 | #endif |
51cec339 | 339 | static inline void emit_pending_bincls_if_required (void); |
340 | ||
8ec3a57b | 341 | static void dbxout_init (const char *); |
342 | static void dbxout_finish (const char *); | |
343 | static void dbxout_start_source_file (unsigned, const char *); | |
344 | static void dbxout_end_source_file (unsigned); | |
345 | static void dbxout_typedefs (tree); | |
8ec3a57b | 346 | static void dbxout_type_index (tree); |
cb264b86 | 347 | #if DBX_CONTIN_LENGTH > 0 |
8ec3a57b | 348 | static void dbxout_continue (void); |
cb264b86 | 349 | #endif |
8ec3a57b | 350 | static void dbxout_args (tree); |
351 | static void dbxout_type_fields (tree); | |
352 | static void dbxout_type_method_1 (tree, const char *); | |
353 | static void dbxout_type_methods (tree); | |
354 | static void dbxout_range_type (tree); | |
355 | static void dbxout_type (tree, int); | |
356 | static bool print_int_cst_bounds_in_octal_p (tree); | |
357 | static void print_int_cst_octal (tree); | |
358 | static void print_octal (unsigned HOST_WIDE_INT, int); | |
359 | static void print_wide_int (HOST_WIDE_INT); | |
360 | static void dbxout_type_name (tree); | |
361 | static void dbxout_class_name_qualifiers (tree); | |
362 | static int dbxout_symbol_location (tree, tree, const char *, rtx); | |
363 | static void dbxout_symbol_name (tree, const char *, int); | |
364 | static void dbxout_prepare_symbol (tree); | |
365 | static void dbxout_finish_symbol (tree); | |
366 | static void dbxout_block (tree, int, tree); | |
367 | static void dbxout_global_decl (tree); | |
fdcda623 | 368 | static void dbxout_type_decl (tree, int); |
8ec3a57b | 369 | static void dbxout_handle_pch (unsigned); |
946754ae | 370 | \f |
c140b944 | 371 | /* The debug hooks structure. */ |
1dff614c | 372 | #if defined (DBX_DEBUGGING_INFO) |
373 | ||
8ec3a57b | 374 | static void dbxout_source_line (unsigned int, const char *); |
375 | static void dbxout_source_file (FILE *, const char *); | |
376 | static void dbxout_function_end (void); | |
377 | static void dbxout_begin_function (tree); | |
378 | static void dbxout_begin_block (unsigned, unsigned); | |
379 | static void dbxout_end_block (unsigned, unsigned); | |
380 | static void dbxout_function_decl (tree); | |
1dff614c | 381 | |
e42f6423 | 382 | const struct gcc_debug_hooks dbx_debug_hooks = |
b896d81b | 383 | { |
384 | dbxout_init, | |
c140b944 | 385 | dbxout_finish, |
386 | debug_nothing_int_charstar, | |
387 | debug_nothing_int_charstar, | |
388 | dbxout_start_source_file, | |
1dff614c | 389 | dbxout_end_source_file, |
390 | dbxout_begin_block, | |
b9b7f8b4 | 391 | dbxout_end_block, |
2b49746a | 392 | debug_true_tree, /* ignore_block */ |
393 | dbxout_source_line, /* source_line */ | |
394 | dbxout_source_line, /* begin_prologue: just output | |
395 | line info */ | |
396 | debug_nothing_int_charstar, /* end_prologue */ | |
397 | debug_nothing_int_charstar, /* end_epilogue */ | |
f76df888 | 398 | #ifdef DBX_FUNCTION_FIRST |
399 | dbxout_begin_function, | |
400 | #else | |
2b49746a | 401 | debug_nothing_tree, /* begin_function */ |
f76df888 | 402 | #endif |
2b49746a | 403 | debug_nothing_int, /* end_function */ |
c37d72e9 | 404 | dbxout_function_decl, |
2b49746a | 405 | dbxout_global_decl, /* global_decl */ |
73ae3ef7 | 406 | dbxout_type_decl, /* type_decl */ |
2b49746a | 407 | debug_nothing_tree_tree, /* imported_module_or_decl */ |
408 | debug_nothing_tree, /* deferred_inline_function */ | |
409 | debug_nothing_tree, /* outlining_inline_function */ | |
410 | debug_nothing_rtx, /* label */ | |
5923a5e7 | 411 | dbxout_handle_pch, /* handle_pch */ |
412 | debug_nothing_rtx /* var_location */ | |
b896d81b | 413 | }; |
1dff614c | 414 | #endif /* DBX_DEBUGGING_INFO */ |
415 | ||
416 | #if defined (XCOFF_DEBUGGING_INFO) | |
e42f6423 | 417 | const struct gcc_debug_hooks xcoff_debug_hooks = |
1dff614c | 418 | { |
419 | dbxout_init, | |
420 | dbxout_finish, | |
421 | debug_nothing_int_charstar, | |
422 | debug_nothing_int_charstar, | |
423 | dbxout_start_source_file, | |
424 | dbxout_end_source_file, | |
425 | xcoffout_begin_block, | |
b9b7f8b4 | 426 | xcoffout_end_block, |
2b49746a | 427 | debug_true_tree, /* ignore_block */ |
b9b7f8b4 | 428 | xcoffout_source_line, |
2b49746a | 429 | xcoffout_begin_prologue, /* begin_prologue */ |
430 | debug_nothing_int_charstar, /* end_prologue */ | |
b9b7f8b4 | 431 | xcoffout_end_epilogue, |
2b49746a | 432 | debug_nothing_tree, /* begin_function */ |
c37d72e9 | 433 | xcoffout_end_function, |
2b49746a | 434 | debug_nothing_tree, /* function_decl */ |
435 | dbxout_global_decl, /* global_decl */ | |
73ae3ef7 | 436 | dbxout_type_decl, /* type_decl */ |
2b49746a | 437 | debug_nothing_tree_tree, /* imported_module_or_decl */ |
438 | debug_nothing_tree, /* deferred_inline_function */ | |
439 | debug_nothing_tree, /* outlining_inline_function */ | |
440 | debug_nothing_rtx, /* label */ | |
5923a5e7 | 441 | dbxout_handle_pch, /* handle_pch */ |
442 | debug_nothing_rtx /* var_location */ | |
1dff614c | 443 | }; |
444 | #endif /* XCOFF_DEBUGGING_INFO */ | |
b896d81b | 445 | \f |
0c87a39e | 446 | #if defined (DBX_DEBUGGING_INFO) |
f6e3ef26 | 447 | static void |
8ec3a57b | 448 | dbxout_function_end (void) |
f6e3ef26 | 449 | { |
450 | char lscope_label_name[100]; | |
4f18499c | 451 | |
452 | function_section (current_function_decl); | |
453 | ||
f6e3ef26 | 454 | /* Convert Ltext into the appropriate format for local labels in case |
455 | the system doesn't insert underscores in front of user generated | |
456 | labels. */ | |
457 | ASM_GENERATE_INTERNAL_LABEL (lscope_label_name, "Lscope", scope_labelno); | |
883b2e73 | 458 | targetm.asm_out.internal_label (asmfile, "Lscope", scope_labelno); |
f6e3ef26 | 459 | scope_labelno++; |
460 | ||
461 | /* By convention, GCC will mark the end of a function with an N_FUN | |
462 | symbol and an empty string. */ | |
12b80435 | 463 | #ifdef DBX_OUTPUT_NFUN |
464 | DBX_OUTPUT_NFUN (asmfile, lscope_label_name, current_function_decl); | |
465 | #else | |
17d8e118 | 466 | fprintf (asmfile, "%s\"\",%d,0,0,", ASM_STABS_OP, N_FUN); |
f6e3ef26 | 467 | assemble_name (asmfile, lscope_label_name); |
d4b87fe5 | 468 | putc ('-', asmfile); |
f6e3ef26 | 469 | assemble_name (asmfile, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); |
4e6802be | 470 | fprintf (asmfile, "\n"); |
12b80435 | 471 | #endif |
f6e3ef26 | 472 | } |
0c87a39e | 473 | #endif /* DBX_DEBUGGING_INFO */ |
f6e3ef26 | 474 | |
946754ae | 475 | /* At the beginning of compilation, start writing the symbol table. |
476 | Initialize `typevec' and output the standard data types of C. */ | |
477 | ||
b896d81b | 478 | static void |
8ec3a57b | 479 | dbxout_init (const char *input_file_name) |
946754ae | 480 | { |
481 | char ltext_label_name[100]; | |
dc24ddbd | 482 | tree syms = lang_hooks.decls.getdecls (); |
946754ae | 483 | |
b9b7f8b4 | 484 | asmfile = asm_out_file; |
946754ae | 485 | |
486 | typevec_len = 100; | |
f0af5a88 | 487 | typevec = ggc_calloc (typevec_len, sizeof typevec[0]); |
946754ae | 488 | |
489 | /* Convert Ltext into the appropriate format for local labels in case | |
490 | the system doesn't insert underscores in front of user generated | |
491 | labels. */ | |
492 | ASM_GENERATE_INTERNAL_LABEL (ltext_label_name, "Ltext", 0); | |
493 | ||
494 | /* Put the current working directory in an N_SO symbol. */ | |
9cdc08c6 | 495 | if (use_gnu_debug_info_extensions) |
439c05a0 | 496 | { |
e7aa92b2 | 497 | if (!cwd && (cwd = get_src_pwd ()) |
498 | && (!*cwd || cwd[strlen (cwd) - 1] != '/')) | |
284a7b54 | 499 | cwd = concat (cwd, FILE_NAME_JOINER, NULL); |
cc3c079f | 500 | if (cwd) |
439c05a0 | 501 | { |
946754ae | 502 | #ifdef DBX_OUTPUT_MAIN_SOURCE_DIRECTORY |
439c05a0 | 503 | DBX_OUTPUT_MAIN_SOURCE_DIRECTORY (asmfile, cwd); |
946754ae | 504 | #else /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */ |
17d8e118 | 505 | fprintf (asmfile, "%s", ASM_STABS_OP); |
cc3c079f | 506 | output_quoted_string (asmfile, cwd); |
aae061fd | 507 | fprintf (asmfile, ",%d,0,0,", N_SO); |
508 | assemble_name (asmfile, ltext_label_name); | |
509 | fputc ('\n', asmfile); | |
946754ae | 510 | #endif /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */ |
439c05a0 | 511 | } |
512 | } | |
946754ae | 513 | |
514 | #ifdef DBX_OUTPUT_MAIN_SOURCE_FILENAME | |
946754ae | 515 | DBX_OUTPUT_MAIN_SOURCE_FILENAME (asmfile, input_file_name); |
516 | #else /* no DBX_OUTPUT_MAIN_SOURCE_FILENAME */ | |
517 | /* We include outputting `Ltext:' here, | |
518 | because that gives you a way to override it. */ | |
519 | /* Used to put `Ltext:' before the reference, but that loses on sun 4. */ | |
17d8e118 | 520 | fprintf (asmfile, "%s", ASM_STABS_OP); |
cc3c079f | 521 | output_quoted_string (asmfile, input_file_name); |
aae061fd | 522 | fprintf (asmfile, ",%d,0,0,", N_SO); |
523 | assemble_name (asmfile, ltext_label_name); | |
524 | fputc ('\n', asmfile); | |
946754ae | 525 | text_section (); |
883b2e73 | 526 | targetm.asm_out.internal_label (asmfile, "Ltext", 0); |
946754ae | 527 | #endif /* no DBX_OUTPUT_MAIN_SOURCE_FILENAME */ |
528 | ||
08c78c16 | 529 | #ifdef DBX_OUTPUT_GCC_MARKER |
530 | DBX_OUTPUT_GCC_MARKER (asmfile); | |
531 | #else | |
f006a2e6 | 532 | /* Emit an N_OPT stab to indicate that this file was compiled by GCC. */ |
533 | fprintf (asmfile, "%s\"%s\",%d,0,0,0\n", | |
534 | ASM_STABS_OP, STABS_GCC_MARKER, N_OPT); | |
08c78c16 | 535 | #endif |
ec6884ea | 536 | |
cf8e41a4 | 537 | base_input_file = lastfile = input_file_name; |
946754ae | 538 | |
539 | next_type_number = 1; | |
946754ae | 540 | |
54ae7e56 | 541 | #ifdef DBX_USE_BINCL |
65f52f4e | 542 | current_file = xmalloc (sizeof *current_file); |
54ae7e56 | 543 | current_file->next = NULL; |
544 | current_file->file_number = 0; | |
545 | current_file->next_type_number = 1; | |
546 | next_file_number = 1; | |
51cec339 | 547 | current_file->prev = NULL; |
548 | current_file->bincl_status = BINCL_NOT_REQUIRED; | |
549 | current_file->pending_bincl_name = NULL; | |
54ae7e56 | 550 | #endif |
551 | ||
54bd1509 | 552 | /* Get all permanent types that have typedef names, and output them |
553 | all, except for those already output. Some language front ends | |
73ae3ef7 | 554 | put these declarations in the top-level scope; some do not; |
555 | the latter are responsible for calling debug_hooks->type_decl from | |
556 | their record_builtin_type function. */ | |
946754ae | 557 | dbxout_typedefs (syms); |
73ae3ef7 | 558 | |
559 | if (preinit_symbols) | |
560 | { | |
561 | tree t; | |
562 | for (t = nreverse (preinit_symbols); t; t = TREE_CHAIN (t)) | |
563 | dbxout_symbol (TREE_VALUE (t), 0); | |
564 | preinit_symbols = 0; | |
565 | } | |
946754ae | 566 | } |
567 | ||
e9efa031 | 568 | /* Output any typedef names for types described by TYPE_DECLs in SYMS. */ |
946754ae | 569 | |
570 | static void | |
8ec3a57b | 571 | dbxout_typedefs (tree syms) |
946754ae | 572 | { |
132cc6f4 | 573 | for (; syms != NULL_TREE; syms = TREE_CHAIN (syms)) |
946754ae | 574 | { |
946754ae | 575 | if (TREE_CODE (syms) == TYPE_DECL) |
576 | { | |
577 | tree type = TREE_TYPE (syms); | |
578 | if (TYPE_NAME (type) | |
579 | && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL | |
14ce540d | 580 | && COMPLETE_OR_VOID_TYPE_P (type) |
946754ae | 581 | && ! TREE_ASM_WRITTEN (TYPE_NAME (type))) |
582 | dbxout_symbol (TYPE_NAME (type), 0); | |
583 | } | |
584 | } | |
585 | } | |
586 | ||
2a3d2f63 | 587 | #ifdef DBX_USE_BINCL |
81d47035 | 588 | /* Emit BINCL stab using given name. */ |
51cec339 | 589 | static void |
590 | emit_bincl_stab (const char *name) | |
591 | { | |
592 | fprintf (asmfile, "%s", ASM_STABS_OP); | |
593 | output_quoted_string (asmfile, name); | |
594 | fprintf (asmfile, ",%d,0,0,0\n", N_BINCL); | |
595 | } | |
596 | ||
597 | /* If there are pending bincls then it is time to emit all of them. */ | |
598 | ||
599 | static inline void | |
a046944b | 600 | emit_pending_bincls_if_required (void) |
51cec339 | 601 | { |
51cec339 | 602 | if (pending_bincls) |
603 | emit_pending_bincls (); | |
51cec339 | 604 | } |
605 | ||
606 | /* Emit all pending bincls. */ | |
607 | ||
608 | static void | |
a046944b | 609 | emit_pending_bincls (void) |
51cec339 | 610 | { |
611 | struct dbx_file *f = current_file; | |
612 | ||
613 | /* Find first pending bincl. */ | |
614 | while (f->bincl_status == BINCL_PENDING) | |
615 | f = f->next; | |
616 | ||
617 | /* Now emit all bincls. */ | |
618 | f = f->prev; | |
619 | ||
620 | while (f) | |
621 | { | |
622 | if (f->bincl_status == BINCL_PENDING) | |
623 | { | |
624 | emit_bincl_stab (f->pending_bincl_name); | |
625 | ||
626 | /* Update file number and status. */ | |
627 | f->file_number = next_file_number++; | |
628 | f->bincl_status = BINCL_PROCESSED; | |
629 | } | |
630 | if (f == current_file) | |
631 | break; | |
632 | f = f->prev; | |
633 | } | |
634 | ||
635 | /* All pending bincls have been emitted. */ | |
636 | pending_bincls = 0; | |
637 | } | |
638 | ||
2a3d2f63 | 639 | #else |
640 | ||
641 | static inline void | |
a046944b | 642 | emit_pending_bincls_if_required (void) {} |
2a3d2f63 | 643 | #endif |
644 | ||
54ae7e56 | 645 | /* Change to reading from a new source file. Generate a N_BINCL stab. */ |
646 | ||
c140b944 | 647 | static void |
8ec3a57b | 648 | dbxout_start_source_file (unsigned int line ATTRIBUTE_UNUSED, |
649 | const char *filename ATTRIBUTE_UNUSED) | |
54ae7e56 | 650 | { |
651 | #ifdef DBX_USE_BINCL | |
65f52f4e | 652 | struct dbx_file *n = xmalloc (sizeof *n); |
54ae7e56 | 653 | |
654 | n->next = current_file; | |
54ae7e56 | 655 | n->next_type_number = 1; |
51cec339 | 656 | /* Do not assign file number now. |
657 | Delay it until we actually emit BINCL. */ | |
658 | n->file_number = 0; | |
659 | n->prev = NULL; | |
660 | current_file->prev = n; | |
661 | n->bincl_status = BINCL_PENDING; | |
662 | n->pending_bincl_name = filename; | |
663 | pending_bincls = 1; | |
54ae7e56 | 664 | current_file = n; |
54ae7e56 | 665 | #endif |
666 | } | |
667 | ||
668 | /* Revert to reading a previous source file. Generate a N_EINCL stab. */ | |
669 | ||
c140b944 | 670 | static void |
8ec3a57b | 671 | dbxout_end_source_file (unsigned int line ATTRIBUTE_UNUSED) |
54ae7e56 | 672 | { |
673 | #ifdef DBX_USE_BINCL | |
51cec339 | 674 | /* Emit EINCL stab only if BINCL is not pending. */ |
675 | if (current_file->bincl_status == BINCL_PROCESSED) | |
676 | fprintf (asmfile, "%s%d,0,0,0\n", ASM_STABN_OP, N_EINCL); | |
677 | current_file->bincl_status = BINCL_NOT_REQUIRED; | |
573aba85 | 678 | current_file = current_file->next; |
54ae7e56 | 679 | #endif |
680 | } | |
681 | ||
cf8e41a4 | 682 | /* Handle a few odd cases that occur when trying to make PCH files work. */ |
683 | ||
684 | static void | |
685 | dbxout_handle_pch (unsigned at_end) | |
686 | { | |
687 | if (! at_end) | |
688 | { | |
689 | /* When using the PCH, this file will be included, so we need to output | |
690 | a BINCL. */ | |
691 | dbxout_start_source_file (0, lastfile); | |
692 | ||
693 | /* The base file when using the PCH won't be the same as | |
694 | the base file when it's being generated. */ | |
695 | lastfile = NULL; | |
696 | } | |
697 | else | |
698 | { | |
6473f3f4 | 699 | /* ... and an EINCL. */ |
cf8e41a4 | 700 | dbxout_end_source_file (0); |
701 | ||
702 | /* Deal with cases where 'lastfile' was never actually changed. */ | |
703 | lastfile_is_base = lastfile == NULL; | |
704 | } | |
705 | } | |
706 | ||
0c87a39e | 707 | #if defined (DBX_DEBUGGING_INFO) |
946754ae | 708 | /* Output debugging info to FILE to switch to sourcefile FILENAME. */ |
709 | ||
b29760a8 | 710 | static void |
8ec3a57b | 711 | dbxout_source_file (FILE *file, const char *filename) |
946754ae | 712 | { |
cf8e41a4 | 713 | if (lastfile == 0 && lastfile_is_base) |
714 | { | |
715 | lastfile = base_input_file; | |
716 | lastfile_is_base = 0; | |
717 | } | |
718 | ||
946754ae | 719 | if (filename && (lastfile == 0 || strcmp (filename, lastfile))) |
720 | { | |
917938fe | 721 | char ltext_label_name[100]; |
722 | ||
244612e7 | 723 | ASM_GENERATE_INTERNAL_LABEL (ltext_label_name, "Ltext", |
724 | source_label_number); | |
17d8e118 | 725 | fprintf (file, "%s", ASM_STABS_OP); |
cc3c079f | 726 | output_quoted_string (file, filename); |
aae061fd | 727 | fprintf (asmfile, ",%d,0,0,", N_SOL); |
728 | assemble_name (asmfile, ltext_label_name); | |
729 | fputc ('\n', asmfile); | |
06cfae35 | 730 | if (current_function_decl != NULL_TREE |
2f339a71 | 731 | && DECL_SECTION_NAME (current_function_decl) != NULL_TREE) |
732 | ; /* Don't change section amid function. */ | |
733 | else | |
4f18499c | 734 | { |
735 | if (!in_text_section () && !in_unlikely_text_section ()) | |
736 | text_section (); | |
737 | } | |
883b2e73 | 738 | targetm.asm_out.internal_label (file, "Ltext", source_label_number); |
15a3d642 | 739 | source_label_number++; |
946754ae | 740 | lastfile = filename; |
741 | } | |
742 | } | |
743 | ||
f76df888 | 744 | /* Output a line number symbol entry for source file FILENAME and line |
745 | number LINENO. */ | |
5e3b69f4 | 746 | |
b9b7f8b4 | 747 | static void |
8ec3a57b | 748 | dbxout_source_line (unsigned int lineno, const char *filename) |
5e3b69f4 | 749 | { |
b9b7f8b4 | 750 | dbxout_source_file (asmfile, filename); |
5e3b69f4 | 751 | |
752 | #ifdef ASM_OUTPUT_SOURCE_LINE | |
b1bd5ac9 | 753 | dbxout_source_line_counter += 1; |
754 | ASM_OUTPUT_SOURCE_LINE (asmfile, lineno, dbxout_source_line_counter); | |
5e3b69f4 | 755 | #else |
b9b7f8b4 | 756 | fprintf (asmfile, "%s%d,0,%d\n", ASM_STABD_OP, N_SLINE, lineno); |
5e3b69f4 | 757 | #endif |
758 | } | |
759 | ||
1dff614c | 760 | /* Describe the beginning of an internal block within a function. */ |
761 | ||
762 | static void | |
8ec3a57b | 763 | dbxout_begin_block (unsigned int line ATTRIBUTE_UNUSED, unsigned int n) |
1dff614c | 764 | { |
51cec339 | 765 | emit_pending_bincls_if_required (); |
883b2e73 | 766 | targetm.asm_out.internal_label (asmfile, "LBB", n); |
1dff614c | 767 | } |
768 | ||
769 | /* Describe the end line-number of an internal block within a function. */ | |
770 | ||
771 | static void | |
8ec3a57b | 772 | dbxout_end_block (unsigned int line ATTRIBUTE_UNUSED, unsigned int n) |
1dff614c | 773 | { |
51cec339 | 774 | emit_pending_bincls_if_required (); |
883b2e73 | 775 | targetm.asm_out.internal_label (asmfile, "LBE", n); |
1dff614c | 776 | } |
777 | ||
c37d72e9 | 778 | /* Output dbx data for a function definition. |
779 | This includes a definition of the function name itself (a symbol), | |
780 | definitions of the parameters (locating them in the parameter list) | |
781 | and then output the block that makes up the function's body | |
782 | (including all the auto variables of the function). */ | |
783 | ||
784 | static void | |
8ec3a57b | 785 | dbxout_function_decl (tree decl) |
c37d72e9 | 786 | { |
51cec339 | 787 | emit_pending_bincls_if_required (); |
c37d72e9 | 788 | #ifndef DBX_FUNCTION_FIRST |
789 | dbxout_begin_function (decl); | |
790 | #endif | |
791 | dbxout_block (DECL_INITIAL (decl), 0, DECL_ARGUMENTS (decl)); | |
792 | #ifdef DBX_OUTPUT_FUNCTION_END | |
793 | DBX_OUTPUT_FUNCTION_END (asmfile, decl); | |
794 | #endif | |
c37d72e9 | 795 | if (use_gnu_debug_info_extensions |
796 | #if defined(NO_DBX_FUNCTION_END) | |
797 | && ! NO_DBX_FUNCTION_END | |
798 | #endif | |
2cb4ac60 | 799 | && targetm.have_named_sections) |
c37d72e9 | 800 | dbxout_function_end (); |
c37d72e9 | 801 | } |
802 | ||
1dff614c | 803 | #endif /* DBX_DEBUGGING_INFO */ |
804 | ||
397c7bc7 | 805 | /* Debug information for a global DECL. Called from toplev.c after |
806 | compilation proper has finished. */ | |
807 | static void | |
8ec3a57b | 808 | dbxout_global_decl (tree decl) |
397c7bc7 | 809 | { |
810 | if (TREE_CODE (decl) == VAR_DECL | |
811 | && ! DECL_EXTERNAL (decl) | |
812 | && DECL_RTL_SET_P (decl)) /* Not necessary? */ | |
262444a6 | 813 | { |
814 | int saved_tree_used = TREE_USED (decl); | |
815 | TREE_USED (decl) = 1; | |
816 | dbxout_symbol (decl, 0); | |
817 | TREE_USED (decl) = saved_tree_used; | |
818 | } | |
1eefe280 | 819 | } |
397c7bc7 | 820 | |
73ae3ef7 | 821 | /* This is just a function-type adapter; dbxout_symbol does exactly |
822 | what we want but returns an int. */ | |
823 | static void | |
824 | dbxout_type_decl (tree decl, int local) | |
825 | { | |
826 | dbxout_symbol (decl, local); | |
827 | } | |
828 | ||
946754ae | 829 | /* At the end of compilation, finish writing the symbol table. |
830 | Unless you define DBX_OUTPUT_MAIN_SOURCE_FILE_END, the default is | |
a92771b8 | 831 | to do nothing. */ |
946754ae | 832 | |
b896d81b | 833 | static void |
8ec3a57b | 834 | dbxout_finish (const char *filename ATTRIBUTE_UNUSED) |
946754ae | 835 | { |
836 | #ifdef DBX_OUTPUT_MAIN_SOURCE_FILE_END | |
b9b7f8b4 | 837 | DBX_OUTPUT_MAIN_SOURCE_FILE_END (asmfile, filename); |
946754ae | 838 | #endif /* DBX_OUTPUT_MAIN_SOURCE_FILE_END */ |
262444a6 | 839 | |
840 | debug_free_queue (); | |
946754ae | 841 | } |
842 | ||
54ae7e56 | 843 | /* Output the index of a type. */ |
844 | ||
845 | static void | |
8ec3a57b | 846 | dbxout_type_index (tree type) |
54ae7e56 | 847 | { |
848 | #ifndef DBX_USE_BINCL | |
849 | fprintf (asmfile, "%d", TYPE_SYMTAB_ADDRESS (type)); | |
850 | CHARS (3); | |
851 | #else | |
852 | struct typeinfo *t = &typevec[TYPE_SYMTAB_ADDRESS (type)]; | |
853 | fprintf (asmfile, "(%d,%d)", t->file_number, t->type_number); | |
d4b87fe5 | 854 | CHARS (9); |
54ae7e56 | 855 | #endif |
856 | } | |
857 | ||
cb264b86 | 858 | #if DBX_CONTIN_LENGTH > 0 |
946754ae | 859 | /* Continue a symbol-description that gets too big. |
860 | End one symbol table entry with a double-backslash | |
861 | and start a new one, eventually producing something like | |
862 | .stabs "start......\\",code,0,value | |
863 | .stabs "...rest",code,0,value */ | |
864 | ||
865 | static void | |
8ec3a57b | 866 | dbxout_continue (void) |
946754ae | 867 | { |
51cec339 | 868 | emit_pending_bincls_if_required (); |
946754ae | 869 | #ifdef DBX_CONTIN_CHAR |
870 | fprintf (asmfile, "%c", DBX_CONTIN_CHAR); | |
871 | #else | |
872 | fprintf (asmfile, "\\\\"); | |
873 | #endif | |
4303221c | 874 | dbxout_finish_symbol (NULL_TREE); |
17d8e118 | 875 | fprintf (asmfile, "%s\"", ASM_STABS_OP); |
946754ae | 876 | current_sym_nchars = 0; |
877 | } | |
cb264b86 | 878 | #endif /* DBX_CONTIN_LENGTH > 0 */ |
946754ae | 879 | \f |
4bbea254 | 880 | /* Subroutine of `dbxout_type'. Output the type fields of TYPE. |
946754ae | 881 | This must be a separate function because anonymous unions require |
882 | recursive calls. */ | |
883 | ||
884 | static void | |
8ec3a57b | 885 | dbxout_type_fields (tree type) |
946754ae | 886 | { |
887 | tree tem; | |
5d844ba2 | 888 | |
b264b33c | 889 | /* Output the name, type, position (in bits), size (in bits) of each |
5d844ba2 | 890 | field that we can support. */ |
946754ae | 891 | for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem)) |
892 | { | |
af6ed417 | 893 | /* If one of the nodes is an error_mark or its type is then |
894 | return early. */ | |
11d99e06 | 895 | if (tem == error_mark_node || TREE_TYPE (tem) == error_mark_node) |
896 | return; | |
897 | ||
946754ae | 898 | /* Omit here local type decls until we know how to support them. */ |
5d844ba2 | 899 | if (TREE_CODE (tem) == TYPE_DECL |
900 | /* Omit fields whose position or size are variable or too large to | |
901 | represent. */ | |
902 | || (TREE_CODE (tem) == FIELD_DECL | |
903 | && (! host_integerp (bit_position (tem), 0) | |
6460676e | 904 | || ! DECL_SIZE (tem) |
5d844ba2 | 905 | || ! host_integerp (DECL_SIZE (tem), 1))) |
906 | /* Omit here the nameless fields that are used to skip bits. */ | |
907 | || DECL_IGNORED_P (tem)) | |
61be0a71 | 908 | continue; |
5d844ba2 | 909 | |
c40b51de | 910 | else if (TREE_CODE (tem) != CONST_DECL) |
946754ae | 911 | { |
912 | /* Continue the line if necessary, | |
913 | but not before the first field. */ | |
914 | if (tem != TYPE_FIELDS (type)) | |
5d844ba2 | 915 | CONTIN; |
946754ae | 916 | |
c40b51de | 917 | if (DECL_NAME (tem)) |
918 | { | |
919 | fprintf (asmfile, "%s:", IDENTIFIER_POINTER (DECL_NAME (tem))); | |
920 | CHARS (2 + IDENTIFIER_LENGTH (DECL_NAME (tem))); | |
921 | } | |
922 | else | |
923 | { | |
924 | fprintf (asmfile, ":"); | |
d4b87fe5 | 925 | CHARS (1); |
c40b51de | 926 | } |
946754ae | 927 | |
9cdc08c6 | 928 | if (use_gnu_debug_info_extensions |
946754ae | 929 | && (TREE_PRIVATE (tem) || TREE_PROTECTED (tem) |
930 | || TREE_CODE (tem) != FIELD_DECL)) | |
931 | { | |
932 | have_used_extensions = 1; | |
933 | putc ('/', asmfile); | |
934 | putc ((TREE_PRIVATE (tem) ? '0' | |
935 | : TREE_PROTECTED (tem) ? '1' : '2'), | |
936 | asmfile); | |
937 | CHARS (2); | |
938 | } | |
939 | ||
940 | dbxout_type ((TREE_CODE (tem) == FIELD_DECL | |
941 | && DECL_BIT_FIELD_TYPE (tem)) | |
9aa97f08 | 942 | ? DECL_BIT_FIELD_TYPE (tem) : TREE_TYPE (tem), 0); |
946754ae | 943 | |
944 | if (TREE_CODE (tem) == VAR_DECL) | |
945 | { | |
9cdc08c6 | 946 | if (TREE_STATIC (tem) && use_gnu_debug_info_extensions) |
946754ae | 947 | { |
d4b87fe5 | 948 | tree name = DECL_ASSEMBLER_NAME (tem); |
949 | ||
946754ae | 950 | have_used_extensions = 1; |
d4b87fe5 | 951 | fprintf (asmfile, ":%s;", IDENTIFIER_POINTER (name)); |
952 | CHARS (IDENTIFIER_LENGTH (name) + 2); | |
946754ae | 953 | } |
954 | else | |
d4b87fe5 | 955 | { |
956 | /* If TEM is non-static, GDB won't understand it. */ | |
957 | fprintf (asmfile, ",0,0;"); | |
958 | CHARS (5); | |
959 | } | |
946754ae | 960 | } |
5d844ba2 | 961 | else |
946754ae | 962 | { |
d4b87fe5 | 963 | putc (',', asmfile); |
964 | print_wide_int (int_bit_position (tem)); | |
965 | putc (',', asmfile); | |
966 | print_wide_int (tree_low_cst (DECL_SIZE (tem), 1)); | |
967 | putc (';', asmfile); | |
968 | CHARS (3); | |
946754ae | 969 | } |
946754ae | 970 | } |
971 | } | |
972 | } | |
973 | \f | |
4bbea254 | 974 | /* Subroutine of `dbxout_type_methods'. Output debug info about the |
946754ae | 975 | method described DECL. DEBUG_NAME is an encoding of the method's |
976 | type signature. ??? We may be able to do without DEBUG_NAME altogether | |
977 | now. */ | |
978 | ||
979 | static void | |
8ec3a57b | 980 | dbxout_type_method_1 (tree decl, const char *debug_name) |
946754ae | 981 | { |
946754ae | 982 | char c1 = 'A', c2; |
983 | ||
984 | if (TREE_CODE (TREE_TYPE (decl)) == FUNCTION_TYPE) | |
985 | c2 = '?'; | |
986 | else /* it's a METHOD_TYPE. */ | |
987 | { | |
96704d5f | 988 | tree firstarg = TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl))); |
946754ae | 989 | /* A for normal functions. |
990 | B for `const' member functions. | |
991 | C for `volatile' member functions. | |
992 | D for `const volatile' member functions. */ | |
993 | if (TYPE_READONLY (TREE_TYPE (firstarg))) | |
994 | c1 += 1; | |
995 | if (TYPE_VOLATILE (TREE_TYPE (firstarg))) | |
996 | c1 += 2; | |
997 | ||
998 | if (DECL_VINDEX (decl)) | |
999 | c2 = '*'; | |
1000 | else | |
1001 | c2 = '.'; | |
1002 | } | |
1003 | ||
1004 | fprintf (asmfile, ":%s;%c%c%c", debug_name, | |
5d844ba2 | 1005 | TREE_PRIVATE (decl) ? '0' |
1006 | : TREE_PROTECTED (decl) ? '1' : '2', c1, c2); | |
946754ae | 1007 | CHARS (IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (decl)) + 6 |
1008 | - (debug_name - IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)))); | |
5d844ba2 | 1009 | |
1010 | if (DECL_VINDEX (decl) && host_integerp (DECL_VINDEX (decl), 0)) | |
946754ae | 1011 | { |
d4b87fe5 | 1012 | print_wide_int (tree_low_cst (DECL_VINDEX (decl), 0)); |
1013 | putc (';', asmfile); | |
1014 | CHARS (1); | |
9aa97f08 | 1015 | dbxout_type (DECL_CONTEXT (decl), 0); |
946754ae | 1016 | fprintf (asmfile, ";"); |
d4b87fe5 | 1017 | CHARS (1); |
946754ae | 1018 | } |
1019 | } | |
1020 | \f | |
1021 | /* Subroutine of `dbxout_type'. Output debug info about the methods defined | |
1022 | in TYPE. */ | |
1023 | ||
1024 | static void | |
8ec3a57b | 1025 | dbxout_type_methods (tree type) |
946754ae | 1026 | { |
1027 | /* C++: put out the method names and their parameter lists */ | |
946754ae | 1028 | tree methods = TYPE_METHODS (type); |
3d82b777 | 1029 | tree type_encoding; |
19cb6b50 | 1030 | tree fndecl; |
1031 | tree last; | |
c5684a1e | 1032 | char formatted_type_identifier_length[16]; |
19cb6b50 | 1033 | int type_identifier_length; |
946754ae | 1034 | |
1035 | if (methods == NULL_TREE) | |
1036 | return; | |
1037 | ||
d0bcb1eb | 1038 | type_encoding = DECL_NAME (TYPE_NAME (type)); |
3d82b777 | 1039 | |
0b987198 | 1040 | #if 0 |
3d82b777 | 1041 | /* C++: Template classes break some assumptions made by this code about |
1042 | the class names, constructor names, and encodings for assembler | |
1043 | label names. For now, disable output of dbx info for them. */ | |
1044 | { | |
12fc9462 | 1045 | const char *ptr = IDENTIFIER_POINTER (type_encoding); |
5a48af4c | 1046 | /* This should use index. (mrs) */ |
3d82b777 | 1047 | while (*ptr && *ptr != '<') ptr++; |
1048 | if (*ptr != 0) | |
1049 | { | |
1050 | static int warned; | |
1051 | if (!warned) | |
3d82b777 | 1052 | warned = 1; |
3d82b777 | 1053 | return; |
1054 | } | |
1055 | } | |
0b987198 | 1056 | #endif |
3d82b777 | 1057 | |
d0bcb1eb | 1058 | type_identifier_length = IDENTIFIER_LENGTH (type_encoding); |
3d82b777 | 1059 | |
9aa97f08 | 1060 | sprintf (formatted_type_identifier_length, "%d", type_identifier_length); |
c5684a1e | 1061 | |
871b7da1 | 1062 | if (TREE_CODE (methods) != TREE_VEC) |
b23cec01 | 1063 | fndecl = methods; |
1064 | else if (TREE_VEC_ELT (methods, 0) != NULL_TREE) | |
946754ae | 1065 | fndecl = TREE_VEC_ELT (methods, 0); |
9cdc08c6 | 1066 | else |
1067 | fndecl = TREE_VEC_ELT (methods, 1); | |
946754ae | 1068 | |
946754ae | 1069 | while (fndecl) |
1070 | { | |
b769415e | 1071 | int need_prefix = 1; |
1072 | ||
d0bcb1eb | 1073 | /* Group together all the methods for the same operation. |
1074 | These differ in the types of the arguments. */ | |
946754ae | 1075 | for (last = NULL_TREE; |
1076 | fndecl && (last == NULL_TREE || DECL_NAME (fndecl) == DECL_NAME (last)); | |
1077 | fndecl = TREE_CHAIN (fndecl)) | |
1078 | /* Output the name of the field (after overloading), as | |
1079 | well as the name of the field before overloading, along | |
1080 | with its parameter list */ | |
1081 | { | |
d0bcb1eb | 1082 | /* This is the "mangled" name of the method. |
1083 | It encodes the argument types. */ | |
7e64c604 | 1084 | const char *debug_name; |
946754ae | 1085 | |
7e64c604 | 1086 | /* Skip methods that aren't FUNCTION_DECLs. (In C++, these |
1087 | include TEMPLATE_DECLs.) The debugger doesn't know what | |
1088 | to do with such entities anyhow. */ | |
1089 | if (TREE_CODE (fndecl) != FUNCTION_DECL) | |
1090 | continue; | |
1091 | ||
d4b87fe5 | 1092 | debug_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fndecl)); |
7e64c604 | 1093 | |
946754ae | 1094 | CONTIN; |
1095 | ||
1096 | last = fndecl; | |
d0bcb1eb | 1097 | |
8f80e66d | 1098 | /* Also ignore abstract methods; those are only interesting to |
1099 | the DWARF backends. */ | |
1100 | if (DECL_IGNORED_P (fndecl) || DECL_ABSTRACT (fndecl)) | |
d0bcb1eb | 1101 | continue; |
1102 | ||
b769415e | 1103 | /* Redundantly output the plain name, since that's what gdb |
1104 | expects. */ | |
1105 | if (need_prefix) | |
1106 | { | |
1107 | tree name = DECL_NAME (fndecl); | |
1108 | fprintf (asmfile, "%s::", IDENTIFIER_POINTER (name)); | |
1109 | CHARS (IDENTIFIER_LENGTH (name) + 2); | |
1110 | need_prefix = 0; | |
1111 | } | |
1112 | ||
9aa97f08 | 1113 | dbxout_type (TREE_TYPE (fndecl), 0); |
d0bcb1eb | 1114 | |
946754ae | 1115 | dbxout_type_method_1 (fndecl, debug_name); |
1116 | } | |
b769415e | 1117 | if (!need_prefix) |
1118 | { | |
1eefe280 | 1119 | putc (';', asmfile); |
b769415e | 1120 | CHARS (1); |
1121 | } | |
946754ae | 1122 | } |
1123 | } | |
bf503a12 | 1124 | |
1125 | /* Emit a "range" type specification, which has the form: | |
1126 | "r<index type>;<lower bound>;<upper bound>;". | |
a92771b8 | 1127 | TYPE is an INTEGER_TYPE. */ |
bf503a12 | 1128 | |
1129 | static void | |
8ec3a57b | 1130 | dbxout_range_type (tree type) |
bf503a12 | 1131 | { |
1132 | fprintf (asmfile, "r"); | |
a774577b | 1133 | if (TREE_TYPE (type)) |
9aa97f08 | 1134 | dbxout_type (TREE_TYPE (type), 0); |
0c688ce9 | 1135 | else if (TREE_CODE (type) != INTEGER_TYPE) |
9aa97f08 | 1136 | dbxout_type (type, 0); /* E.g. Pascal's ARRAY [BOOLEAN] of INTEGER */ |
bf503a12 | 1137 | else |
1138 | { | |
255a4f1f | 1139 | /* Traditionally, we made sure 'int' was type 1, and builtin types |
1140 | were defined to be sub-ranges of int. Unfortunately, this | |
1141 | does not allow us to distinguish true sub-ranges from integer | |
1142 | types. So, instead we define integer (non-sub-range) types as | |
829f57e9 | 1143 | sub-ranges of themselves. This matters for Chill. If this isn't |
1144 | a subrange type, then we want to define it in terms of itself. | |
1145 | However, in C, this may be an anonymous integer type, and we don't | |
1146 | want to emit debug info referring to it. Just calling | |
1147 | dbxout_type_index won't work anyways, because the type hasn't been | |
1148 | defined yet. We make this work for both cases by checked to see | |
1149 | whether this is a defined type, referring to it if it is, and using | |
1150 | 'int' otherwise. */ | |
1151 | if (TYPE_SYMTAB_ADDRESS (type) != 0) | |
1152 | dbxout_type_index (type); | |
1153 | else | |
1154 | dbxout_type_index (integer_type_node); | |
bf503a12 | 1155 | } |
5d844ba2 | 1156 | |
1157 | if (TYPE_MIN_VALUE (type) != 0 | |
1158 | && host_integerp (TYPE_MIN_VALUE (type), 0)) | |
9bf3e679 | 1159 | { |
d4b87fe5 | 1160 | putc (';', asmfile); |
1161 | CHARS (1); | |
0989224f | 1162 | if (print_int_cst_bounds_in_octal_p (type)) |
1163 | print_int_cst_octal (TYPE_MIN_VALUE (type)); | |
1164 | else | |
1165 | print_wide_int (tree_low_cst (TYPE_MIN_VALUE (type), 0)); | |
9bf3e679 | 1166 | } |
bf503a12 | 1167 | else |
d4b87fe5 | 1168 | { |
1169 | fprintf (asmfile, ";0"); | |
1170 | CHARS (2); | |
1171 | } | |
5d844ba2 | 1172 | |
1173 | if (TYPE_MAX_VALUE (type) != 0 | |
1174 | && host_integerp (TYPE_MAX_VALUE (type), 0)) | |
9bf3e679 | 1175 | { |
d4b87fe5 | 1176 | putc (';', asmfile); |
1177 | CHARS (1); | |
0989224f | 1178 | if (print_int_cst_bounds_in_octal_p (type)) |
1179 | print_int_cst_octal (TYPE_MAX_VALUE (type)); | |
1180 | else | |
1181 | print_wide_int (tree_low_cst (TYPE_MAX_VALUE (type), 0)); | |
d4b87fe5 | 1182 | putc (';', asmfile); |
1183 | CHARS (1); | |
9bf3e679 | 1184 | } |
bf503a12 | 1185 | else |
d4b87fe5 | 1186 | { |
1187 | fprintf (asmfile, ";-1;"); | |
1188 | CHARS (4); | |
1189 | } | |
bf503a12 | 1190 | } |
946754ae | 1191 | \f |
262444a6 | 1192 | |
946754ae | 1193 | /* Output a reference to a type. If the type has not yet been |
1194 | described in the dbx output, output its definition now. | |
1195 | For a type already defined, just refer to its definition | |
1196 | using the type number. | |
1197 | ||
1198 | If FULL is nonzero, and the type has been described only with | |
1199 | a forward-reference, output the definition now. | |
1200 | If FULL is zero in this case, just refer to the forward-reference | |
9aa97f08 | 1201 | using the number previously allocated. */ |
946754ae | 1202 | |
1203 | static void | |
8ec3a57b | 1204 | dbxout_type (tree type, int full) |
946754ae | 1205 | { |
19cb6b50 | 1206 | tree tem; |
1d971bfd | 1207 | tree main_variant; |
c61d074f | 1208 | static int anonymous_type_number = 0; |
946754ae | 1209 | |
e2ea7e3a | 1210 | if (TREE_CODE (type) == VECTOR_TYPE) |
5efc251c | 1211 | /* The frontend feeds us a representation for the vector as a struct |
1212 | containing an array. Pull out the array type. */ | |
1213 | type = TREE_TYPE (TYPE_FIELDS (TYPE_DEBUG_REPRESENTATION_TYPE (type))); | |
e2ea7e3a | 1214 | |
946754ae | 1215 | /* If there was an input error and we don't really have a type, |
1216 | avoid crashing and write something that is at least valid | |
1217 | by assuming `int'. */ | |
1218 | if (type == error_mark_node) | |
1219 | type = integer_type_node; | |
c48f961d | 1220 | else |
946754ae | 1221 | { |
946754ae | 1222 | if (TYPE_NAME (type) |
1223 | && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL | |
ac3e80e4 | 1224 | && TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (type))) |
946754ae | 1225 | full = 0; |
1226 | } | |
1227 | ||
1d971bfd | 1228 | /* Try to find the "main variant" with the same name. */ |
1229 | if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL | |
1230 | && DECL_ORIGINAL_TYPE (TYPE_NAME (type))) | |
1231 | main_variant = TREE_TYPE (TYPE_NAME (type)); | |
1232 | else | |
1233 | main_variant = TYPE_MAIN_VARIANT (type); | |
1234 | ||
1235 | /* If we are not using extensions, stabs does not distinguish const and | |
1236 | volatile, so there is no need to make them separate types. */ | |
1237 | if (!use_gnu_debug_info_extensions) | |
1238 | type = main_variant; | |
1239 | ||
946754ae | 1240 | if (TYPE_SYMTAB_ADDRESS (type) == 0) |
1241 | { | |
1242 | /* Type has no dbx number assigned. Assign next available number. */ | |
1243 | TYPE_SYMTAB_ADDRESS (type) = next_type_number++; | |
1244 | ||
1245 | /* Make sure type vector is long enough to record about this type. */ | |
1246 | ||
1247 | if (next_type_number == typevec_len) | |
1248 | { | |
37808e3a | 1249 | typevec |
f0af5a88 | 1250 | = ggc_realloc (typevec, (typevec_len * 2 * sizeof typevec[0])); |
1251 | memset (typevec + typevec_len, 0, typevec_len * sizeof typevec[0]); | |
946754ae | 1252 | typevec_len *= 2; |
1253 | } | |
54ae7e56 | 1254 | |
1255 | #ifdef DBX_USE_BINCL | |
51cec339 | 1256 | emit_pending_bincls_if_required (); |
37808e3a | 1257 | typevec[TYPE_SYMTAB_ADDRESS (type)].file_number |
1258 | = current_file->file_number; | |
1259 | typevec[TYPE_SYMTAB_ADDRESS (type)].type_number | |
1260 | = current_file->next_type_number++; | |
54ae7e56 | 1261 | #endif |
946754ae | 1262 | } |
1263 | ||
262444a6 | 1264 | if (flag_debug_only_used_symbols) |
1265 | { | |
1266 | if ((TREE_CODE (type) == RECORD_TYPE | |
1267 | || TREE_CODE (type) == UNION_TYPE | |
1268 | || TREE_CODE (type) == QUAL_UNION_TYPE | |
1269 | || TREE_CODE (type) == ENUMERAL_TYPE) | |
1270 | && TYPE_STUB_DECL (type) | |
1271 | && TREE_CODE_CLASS (TREE_CODE (TYPE_STUB_DECL (type))) == 'd' | |
1272 | && ! DECL_IGNORED_P (TYPE_STUB_DECL (type))) | |
1273 | debug_queue_symbol (TYPE_STUB_DECL (type)); | |
1274 | else if (TYPE_NAME (type) | |
1275 | && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL) | |
1276 | debug_queue_symbol (TYPE_NAME (type)); | |
1277 | } | |
8ec3a57b | 1278 | |
946754ae | 1279 | /* Output the number of this type, to refer to it. */ |
54ae7e56 | 1280 | dbxout_type_index (type); |
946754ae | 1281 | |
439c05a0 | 1282 | #ifdef DBX_TYPE_DEFINED |
1283 | if (DBX_TYPE_DEFINED (type)) | |
1284 | return; | |
1285 | #endif | |
1286 | ||
946754ae | 1287 | /* If this type's definition has been output or is now being output, |
1288 | that is all. */ | |
1289 | ||
54ae7e56 | 1290 | switch (typevec[TYPE_SYMTAB_ADDRESS (type)].status) |
946754ae | 1291 | { |
1292 | case TYPE_UNSEEN: | |
1293 | break; | |
1294 | case TYPE_XREF: | |
f10caba4 | 1295 | /* If we have already had a cross reference, |
1296 | and either that's all we want or that's the best we could do, | |
1297 | don't repeat the cross reference. | |
1298 | Sun dbx crashes if we do. */ | |
4b72716d | 1299 | if (! full || !COMPLETE_TYPE_P (type) |
f10caba4 | 1300 | /* No way in DBX fmt to describe a variable size. */ |
79433a4c | 1301 | || ! host_integerp (TYPE_SIZE (type), 1)) |
946754ae | 1302 | return; |
1303 | break; | |
1304 | case TYPE_DEFINED: | |
1305 | return; | |
1306 | } | |
1307 | ||
1308 | #ifdef DBX_NO_XREFS | |
1309 | /* For systems where dbx output does not allow the `=xsNAME:' syntax, | |
1310 | leave the type-number completely undefined rather than output | |
7cac4c57 | 1311 | a cross-reference. If we have already used GNU debug info extensions, |
1312 | then it is OK to output a cross reference. This is necessary to get | |
1313 | proper C++ debug output. */ | |
1314 | if ((TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE | |
1315 | || TREE_CODE (type) == QUAL_UNION_TYPE | |
1316 | || TREE_CODE (type) == ENUMERAL_TYPE) | |
1317 | && ! use_gnu_debug_info_extensions) | |
5c579180 | 1318 | /* We must use the same test here as we use twice below when deciding |
1319 | whether to emit a cross-reference. */ | |
1320 | if ((TYPE_NAME (type) != 0 | |
1321 | && ! (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL | |
1322 | && DECL_IGNORED_P (TYPE_NAME (type))) | |
1323 | && !full) | |
4b72716d | 1324 | || !COMPLETE_TYPE_P (type) |
5c579180 | 1325 | /* No way in DBX fmt to describe a variable size. */ |
79433a4c | 1326 | || ! host_integerp (TYPE_SIZE (type), 1)) |
946754ae | 1327 | { |
54ae7e56 | 1328 | typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_XREF; |
946754ae | 1329 | return; |
1330 | } | |
1331 | #endif | |
1332 | ||
1333 | /* Output a definition now. */ | |
1334 | ||
1335 | fprintf (asmfile, "="); | |
1336 | CHARS (1); | |
1337 | ||
1338 | /* Mark it as defined, so that if it is self-referent | |
1339 | we will not get into an infinite recursion of definitions. */ | |
1340 | ||
54ae7e56 | 1341 | typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_DEFINED; |
946754ae | 1342 | |
1d971bfd | 1343 | /* If this type is a variant of some other, hand off. Types with |
1344 | different names are usefully distinguished. We only distinguish | |
1345 | cv-qualified types if we're using extensions. */ | |
1346 | if (TYPE_READONLY (type) > TYPE_READONLY (main_variant)) | |
1347 | { | |
1348 | putc ('k', asmfile); | |
1349 | CHARS (1); | |
1350 | dbxout_type (build_type_variant (type, 0, TYPE_VOLATILE (type)), 0); | |
1351 | return; | |
1352 | } | |
1353 | else if (TYPE_VOLATILE (type) > TYPE_VOLATILE (main_variant)) | |
1354 | { | |
1355 | putc ('B', asmfile); | |
1356 | CHARS (1); | |
1357 | dbxout_type (build_type_variant (type, TYPE_READONLY (type), 0), 0); | |
1358 | return; | |
1359 | } | |
1360 | else if (main_variant != TYPE_MAIN_VARIANT (type)) | |
1361 | { | |
262444a6 | 1362 | if (flag_debug_only_used_symbols) |
1363 | { | |
1364 | tree orig_type = DECL_ORIGINAL_TYPE (TYPE_NAME (type)); | |
1365 | ||
8ec3a57b | 1366 | if ((TREE_CODE (orig_type) == RECORD_TYPE |
262444a6 | 1367 | || TREE_CODE (orig_type) == UNION_TYPE |
1368 | || TREE_CODE (orig_type) == QUAL_UNION_TYPE | |
1369 | || TREE_CODE (orig_type) == ENUMERAL_TYPE) | |
1370 | && TYPE_STUB_DECL (orig_type) | |
1371 | && ! DECL_IGNORED_P (TYPE_STUB_DECL (orig_type))) | |
1372 | debug_queue_symbol (TYPE_STUB_DECL (orig_type)); | |
1373 | } | |
1d971bfd | 1374 | /* 'type' is a typedef; output the type it refers to. */ |
9aa97f08 | 1375 | dbxout_type (DECL_ORIGINAL_TYPE (TYPE_NAME (type)), 0); |
4a4d93c2 | 1376 | return; |
1377 | } | |
1d971bfd | 1378 | /* else continue. */ |
4a4d93c2 | 1379 | |
946754ae | 1380 | switch (TREE_CODE (type)) |
1381 | { | |
1382 | case VOID_TYPE: | |
1383 | case LANG_TYPE: | |
1384 | /* For a void type, just define it as itself; ie, "5=5". | |
1385 | This makes us consider it defined | |
1386 | without saying what it is. The debugger will make it | |
1387 | a void type when the reference is seen, and nothing will | |
1388 | ever override that default. */ | |
54ae7e56 | 1389 | dbxout_type_index (type); |
946754ae | 1390 | break; |
1391 | ||
1392 | case INTEGER_TYPE: | |
78a8ed03 | 1393 | if (type == char_type_node && ! TYPE_UNSIGNED (type)) |
54ae7e56 | 1394 | { |
1395 | /* Output the type `char' as a subrange of itself! | |
1396 | I don't understand this definition, just copied it | |
1397 | from the output of pcc. | |
1398 | This used to use `r2' explicitly and we used to | |
1399 | take care to make sure that `char' was type number 2. */ | |
1400 | fprintf (asmfile, "r"); | |
d4b87fe5 | 1401 | CHARS (1); |
54ae7e56 | 1402 | dbxout_type_index (type); |
1403 | fprintf (asmfile, ";0;127;"); | |
d4b87fe5 | 1404 | CHARS (7); |
54ae7e56 | 1405 | } |
155b05dc | 1406 | |
1407 | /* If this is a subtype of another integer type, always prefer to | |
1408 | write it as a subtype. */ | |
1409 | else if (TREE_TYPE (type) != 0 | |
79433a4c | 1410 | && TREE_CODE (TREE_TYPE (type)) == INTEGER_TYPE) |
1eefe280 | 1411 | { |
153b0682 | 1412 | /* If the size is non-standard, say what it is if we can use |
1413 | GDB extensions. */ | |
1414 | ||
1415 | if (use_gnu_debug_info_extensions | |
1416 | && TYPE_PRECISION (type) != TYPE_PRECISION (integer_type_node)) | |
1417 | { | |
1418 | have_used_extensions = 1; | |
1419 | fprintf (asmfile, "@s%d;", TYPE_PRECISION (type)); | |
1420 | CHARS (5); | |
1421 | } | |
1422 | ||
1423 | dbxout_range_type (type); | |
1eefe280 | 1424 | } |
155b05dc | 1425 | |
1426 | else | |
1eefe280 | 1427 | { |
155b05dc | 1428 | /* If the size is non-standard, say what it is if we can use |
1429 | GDB extensions. */ | |
1430 | ||
1431 | if (use_gnu_debug_info_extensions | |
1432 | && TYPE_PRECISION (type) != TYPE_PRECISION (integer_type_node)) | |
d4b87fe5 | 1433 | { |
1434 | have_used_extensions = 1; | |
1435 | fprintf (asmfile, "@s%d;", TYPE_PRECISION (type)); | |
1436 | CHARS (5); | |
1437 | } | |
155b05dc | 1438 | |
8ec3a57b | 1439 | if (print_int_cst_bounds_in_octal_p (type)) |
155b05dc | 1440 | { |
1441 | fprintf (asmfile, "r"); | |
d4b87fe5 | 1442 | CHARS (1); |
bdeba923 | 1443 | |
1444 | /* If this type derives from another type, output type index of | |
1445 | parent type. This is particularly important when parent type | |
1446 | is an enumerated type, because not generating the parent type | |
1447 | index would transform the definition of this enumerated type | |
1448 | into a plain unsigned type. */ | |
1449 | if (TREE_TYPE (type) != 0) | |
1450 | dbxout_type_index (TREE_TYPE (type)); | |
1451 | else | |
1452 | dbxout_type_index (type); | |
1453 | ||
155b05dc | 1454 | fprintf (asmfile, ";"); |
d4b87fe5 | 1455 | CHARS (1); |
155b05dc | 1456 | print_int_cst_octal (TYPE_MIN_VALUE (type)); |
1457 | fprintf (asmfile, ";"); | |
d4b87fe5 | 1458 | CHARS (1); |
155b05dc | 1459 | print_int_cst_octal (TYPE_MAX_VALUE (type)); |
1460 | fprintf (asmfile, ";"); | |
d4b87fe5 | 1461 | CHARS (1); |
155b05dc | 1462 | } |
1463 | ||
1464 | else | |
1465 | /* Output other integer types as subranges of `int'. */ | |
1466 | dbxout_range_type (type); | |
1eefe280 | 1467 | } |
155b05dc | 1468 | |
946754ae | 1469 | break; |
1470 | ||
1471 | case REAL_TYPE: | |
1472 | /* This used to say `r1' and we used to take care | |
1473 | to make sure that `int' was type number 1. */ | |
54ae7e56 | 1474 | fprintf (asmfile, "r"); |
d4b87fe5 | 1475 | CHARS (1); |
54ae7e56 | 1476 | dbxout_type_index (integer_type_node); |
d4b87fe5 | 1477 | putc (';', asmfile); |
1478 | CHARS (1); | |
1479 | print_wide_int (int_size_in_bytes (type)); | |
4d3a9616 | 1480 | fputs (";0;", asmfile); |
d4b87fe5 | 1481 | CHARS (3); |
946754ae | 1482 | break; |
1483 | ||
b264b33c | 1484 | case CHAR_TYPE: |
f4267b6f | 1485 | if (use_gnu_debug_info_extensions) |
4d3a9616 | 1486 | { |
d4b87fe5 | 1487 | have_used_extensions = 1; |
4d3a9616 | 1488 | fputs ("@s", asmfile); |
d4b87fe5 | 1489 | CHARS (2); |
1490 | print_wide_int (BITS_PER_UNIT * int_size_in_bytes (type)); | |
4d3a9616 | 1491 | fputs (";-20;", asmfile); |
d4b87fe5 | 1492 | CHARS (4); |
4d3a9616 | 1493 | } |
f4267b6f | 1494 | else |
54ae7e56 | 1495 | { |
1496 | /* Output the type `char' as a subrange of itself. | |
1497 | That is what pcc seems to do. */ | |
1498 | fprintf (asmfile, "r"); | |
d4b87fe5 | 1499 | CHARS (1); |
54ae7e56 | 1500 | dbxout_type_index (char_type_node); |
78a8ed03 | 1501 | fprintf (asmfile, ";0;%d;", TYPE_UNSIGNED (type) ? 255 : 127); |
d4b87fe5 | 1502 | CHARS (7); |
54ae7e56 | 1503 | } |
b264b33c | 1504 | break; |
1505 | ||
f4267b6f | 1506 | case BOOLEAN_TYPE: |
1507 | if (use_gnu_debug_info_extensions) | |
4d3a9616 | 1508 | { |
d4b87fe5 | 1509 | have_used_extensions = 1; |
4d3a9616 | 1510 | fputs ("@s", asmfile); |
d4b87fe5 | 1511 | CHARS (2); |
1512 | print_wide_int (BITS_PER_UNIT * int_size_in_bytes (type)); | |
4d3a9616 | 1513 | fputs (";-16;", asmfile); |
d4b87fe5 | 1514 | CHARS (4); |
4d3a9616 | 1515 | } |
f4267b6f | 1516 | else /* Define as enumeral type (False, True) */ |
d4b87fe5 | 1517 | { |
1518 | fprintf (asmfile, "eFalse:0,True:1,;"); | |
1519 | CHARS (17); | |
1520 | } | |
b264b33c | 1521 | break; |
1522 | ||
1523 | case FILE_TYPE: | |
1524 | putc ('d', asmfile); | |
1525 | CHARS (1); | |
9aa97f08 | 1526 | dbxout_type (TREE_TYPE (type), 0); |
b264b33c | 1527 | break; |
1528 | ||
1529 | case COMPLEX_TYPE: | |
6b6cb0d6 | 1530 | /* Differs from the REAL_TYPE by its new data type number. |
1531 | R3 is NF_COMPLEX. We don't try to use any of the other NF_* | |
1532 | codes since gdb doesn't care anyway. */ | |
b264b33c | 1533 | |
1534 | if (TREE_CODE (TREE_TYPE (type)) == REAL_TYPE) | |
1535 | { | |
6b6cb0d6 | 1536 | fputs ("R3;", asmfile); |
1537 | CHARS (3); | |
d4b87fe5 | 1538 | print_wide_int (2 * int_size_in_bytes (TREE_TYPE (type))); |
4d3a9616 | 1539 | fputs (";0;", asmfile); |
d4b87fe5 | 1540 | CHARS (3); |
c99df4b3 | 1541 | } |
1542 | else | |
1543 | { | |
1544 | /* Output a complex integer type as a structure, | |
1545 | pending some other way to do it. */ | |
d4b87fe5 | 1546 | putc ('s', asmfile); |
1547 | CHARS (1); | |
1548 | print_wide_int (int_size_in_bytes (type)); | |
c99df4b3 | 1549 | fprintf (asmfile, "real:"); |
d4b87fe5 | 1550 | CHARS (5); |
1551 | ||
9aa97f08 | 1552 | dbxout_type (TREE_TYPE (type), 0); |
d4b87fe5 | 1553 | fprintf (asmfile, ",0,%d;", TYPE_PRECISION (TREE_TYPE (type))); |
1554 | CHARS (7); | |
c99df4b3 | 1555 | fprintf (asmfile, "imag:"); |
1556 | CHARS (5); | |
9aa97f08 | 1557 | dbxout_type (TREE_TYPE (type), 0); |
d4b87fe5 | 1558 | fprintf (asmfile, ",%d,%d;;", TYPE_PRECISION (TREE_TYPE (type)), |
c99df4b3 | 1559 | TYPE_PRECISION (TREE_TYPE (type))); |
d4b87fe5 | 1560 | CHARS (10); |
c99df4b3 | 1561 | } |
b264b33c | 1562 | break; |
1563 | ||
1564 | case SET_TYPE: | |
11aea978 | 1565 | if (use_gnu_debug_info_extensions) |
1566 | { | |
1567 | have_used_extensions = 1; | |
4d3a9616 | 1568 | fputs ("@s", asmfile); |
d4b87fe5 | 1569 | CHARS (2); |
1570 | print_wide_int (BITS_PER_UNIT * int_size_in_bytes (type)); | |
1571 | putc (';', asmfile); | |
1572 | CHARS (1); | |
1573 | ||
11aea978 | 1574 | /* Check if a bitstring type, which in Chill is |
a92771b8 | 1575 | different from a [power]set. */ |
11aea978 | 1576 | if (TYPE_STRING_FLAG (type)) |
d4b87fe5 | 1577 | { |
1578 | fprintf (asmfile, "@S;"); | |
1579 | CHARS (3); | |
1580 | } | |
11aea978 | 1581 | } |
b264b33c | 1582 | putc ('S', asmfile); |
1583 | CHARS (1); | |
9aa97f08 | 1584 | dbxout_type (TYPE_DOMAIN (type), 0); |
b264b33c | 1585 | break; |
1586 | ||
946754ae | 1587 | case ARRAY_TYPE: |
1020180f | 1588 | /* Make arrays of packed bits look like bitstrings for chill. */ |
1589 | if (TYPE_PACKED (type) && use_gnu_debug_info_extensions) | |
1590 | { | |
1591 | have_used_extensions = 1; | |
1592 | fputs ("@s", asmfile); | |
d4b87fe5 | 1593 | CHARS (2); |
1594 | print_wide_int (BITS_PER_UNIT * int_size_in_bytes (type)); | |
1595 | fprintf (asmfile, ";@S;S"); | |
1596 | CHARS (5); | |
9aa97f08 | 1597 | dbxout_type (TYPE_DOMAIN (type), 0); |
1020180f | 1598 | break; |
1599 | } | |
d4b87fe5 | 1600 | |
946754ae | 1601 | /* Output "a" followed by a range type definition |
1602 | for the index type of the array | |
1603 | followed by a reference to the target-type. | |
bf503a12 | 1604 | ar1;0;N;M for a C array of type M and size N+1. */ |
11aea978 | 1605 | /* Check if a character string type, which in Chill is |
a92771b8 | 1606 | different from an array of characters. */ |
11aea978 | 1607 | if (TYPE_STRING_FLAG (type) && use_gnu_debug_info_extensions) |
1608 | { | |
1609 | have_used_extensions = 1; | |
1610 | fprintf (asmfile, "@S;"); | |
d4b87fe5 | 1611 | CHARS (3); |
11aea978 | 1612 | } |
bf503a12 | 1613 | tem = TYPE_DOMAIN (type); |
1614 | if (tem == NULL) | |
54ae7e56 | 1615 | { |
1616 | fprintf (asmfile, "ar"); | |
d4b87fe5 | 1617 | CHARS (2); |
54ae7e56 | 1618 | dbxout_type_index (integer_type_node); |
1619 | fprintf (asmfile, ";0;-1;"); | |
d4b87fe5 | 1620 | CHARS (6); |
54ae7e56 | 1621 | } |
bf503a12 | 1622 | else |
1623 | { | |
c722f417 | 1624 | fprintf (asmfile, "a"); |
d4b87fe5 | 1625 | CHARS (1); |
bf503a12 | 1626 | dbxout_range_type (tem); |
1627 | } | |
d4b87fe5 | 1628 | |
9aa97f08 | 1629 | dbxout_type (TREE_TYPE (type), 0); |
946754ae | 1630 | break; |
1631 | ||
1632 | case RECORD_TYPE: | |
1633 | case UNION_TYPE: | |
7f8a347a | 1634 | case QUAL_UNION_TYPE: |
946754ae | 1635 | { |
1636 | int i, n_baseclasses = 0; | |
1637 | ||
4f161c52 | 1638 | if (TYPE_BINFO (type) != 0 |
1639 | && TREE_CODE (TYPE_BINFO (type)) == TREE_VEC | |
1640 | && TYPE_BINFO_BASETYPES (type) != 0) | |
946754ae | 1641 | n_baseclasses = TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (type)); |
1642 | ||
5c579180 | 1643 | /* Output a structure type. We must use the same test here as we |
1644 | use in the DBX_NO_XREFS case above. */ | |
439c05a0 | 1645 | if ((TYPE_NAME (type) != 0 |
1646 | && ! (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL | |
1647 | && DECL_IGNORED_P (TYPE_NAME (type))) | |
1648 | && !full) | |
4b72716d | 1649 | || !COMPLETE_TYPE_P (type) |
d0bcb1eb | 1650 | /* No way in DBX fmt to describe a variable size. */ |
79433a4c | 1651 | || ! host_integerp (TYPE_SIZE (type), 1)) |
946754ae | 1652 | { |
1653 | /* If the type is just a cross reference, output one | |
1654 | and mark the type as partially described. | |
1655 | If it later becomes defined, we will output | |
1656 | its real definition. | |
1657 | If the type has a name, don't nest its definition within | |
1658 | another type's definition; instead, output an xref | |
1659 | and let the definition come when the name is defined. */ | |
e4ba8ded | 1660 | fputs ((TREE_CODE (type) == RECORD_TYPE) ? "xs" : "xu", asmfile); |
d4b87fe5 | 1661 | CHARS (2); |
3d82b777 | 1662 | #if 0 /* This assertion is legitimately false in C++. */ |
946754ae | 1663 | /* We shouldn't be outputting a reference to a type before its |
1664 | definition unless the type has a tag name. | |
1665 | A typedef name without a tag name should be impossible. */ | |
1666 | if (TREE_CODE (TYPE_NAME (type)) != IDENTIFIER_NODE) | |
1667 | abort (); | |
1668 | #endif | |
c61d074f | 1669 | if (TYPE_NAME (type) != 0) |
1670 | dbxout_type_name (type); | |
1671 | else | |
d4b87fe5 | 1672 | { |
1673 | fprintf (asmfile, "$$%d", anonymous_type_number++); | |
1674 | CHARS (5); | |
1675 | } | |
1676 | ||
946754ae | 1677 | fprintf (asmfile, ":"); |
d4b87fe5 | 1678 | CHARS (1); |
54ae7e56 | 1679 | typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_XREF; |
946754ae | 1680 | break; |
1681 | } | |
946754ae | 1682 | |
946754ae | 1683 | /* Identify record or union, and print its size. */ |
d4b87fe5 | 1684 | putc (((TREE_CODE (type) == RECORD_TYPE) ? 's' : 'u'), asmfile); |
1685 | CHARS (1); | |
1686 | print_wide_int (int_size_in_bytes (type)); | |
946754ae | 1687 | |
9cdc08c6 | 1688 | if (use_gnu_debug_info_extensions) |
946754ae | 1689 | { |
1690 | if (n_baseclasses) | |
1691 | { | |
1692 | have_used_extensions = 1; | |
1693 | fprintf (asmfile, "!%d,", n_baseclasses); | |
1694 | CHARS (8); | |
1695 | } | |
1696 | } | |
1697 | for (i = 0; i < n_baseclasses; i++) | |
1698 | { | |
95f3173a | 1699 | tree binfo = TYPE_BINFO (type); |
1700 | tree child = BINFO_BASETYPE (binfo, i); | |
1701 | tree access = (BINFO_BASEACCESSES (binfo) | |
1702 | ? BINFO_BASEACCESS (binfo, i) : access_public_node); | |
8ec3a57b | 1703 | |
9cdc08c6 | 1704 | if (use_gnu_debug_info_extensions) |
946754ae | 1705 | { |
1706 | have_used_extensions = 1; | |
e6653de4 | 1707 | putc (TREE_VIA_VIRTUAL (child) ? '1' : '0', asmfile); |
1708 | putc (access == access_public_node ? '2' : | |
1709 | (access == access_protected_node ? '1' :'0'), | |
1710 | asmfile); | |
d4b87fe5 | 1711 | CHARS (2); |
95f3173a | 1712 | if (TREE_VIA_VIRTUAL (child) |
1713 | && strcmp (lang_hooks.name, "GNU C++") == 0) | |
3e14aa38 | 1714 | /* For a virtual base, print the (negative) offset within |
1715 | the vtable where we must look to find the necessary | |
1716 | adjustment. */ | |
1717 | print_wide_int (tree_low_cst (BINFO_VPTR_FIELD (child), 0) | |
1718 | * BITS_PER_UNIT); | |
1719 | else | |
1720 | print_wide_int (tree_low_cst (BINFO_OFFSET (child), 0) | |
1721 | * BITS_PER_UNIT); | |
d4b87fe5 | 1722 | putc (',', asmfile); |
1723 | CHARS (1); | |
9aa97f08 | 1724 | dbxout_type (BINFO_TYPE (child), 0); |
946754ae | 1725 | putc (';', asmfile); |
d4b87fe5 | 1726 | CHARS (1); |
946754ae | 1727 | } |
1728 | else | |
1729 | { | |
1730 | /* Print out the base class information with fields | |
1731 | which have the same names at the types they hold. */ | |
1732 | dbxout_type_name (BINFO_TYPE (child)); | |
1733 | putc (':', asmfile); | |
d4b87fe5 | 1734 | CHARS (1); |
9aa97f08 | 1735 | dbxout_type (BINFO_TYPE (child), full); |
d4b87fe5 | 1736 | putc (',', asmfile); |
1737 | CHARS (1); | |
1738 | print_wide_int (tree_low_cst (BINFO_OFFSET (child), 0) | |
1739 | * BITS_PER_UNIT); | |
1740 | putc (',', asmfile); | |
1741 | CHARS (1); | |
16745cca | 1742 | print_wide_int (tree_low_cst (TYPE_SIZE (BINFO_TYPE (child)), |
d4b87fe5 | 1743 | 0) |
1744 | * BITS_PER_UNIT); | |
1745 | putc (';', asmfile); | |
1746 | CHARS (1); | |
946754ae | 1747 | } |
1748 | } | |
1749 | } | |
1750 | ||
946754ae | 1751 | /* Write out the field declarations. */ |
1752 | dbxout_type_fields (type); | |
9cdc08c6 | 1753 | if (use_gnu_debug_info_extensions && TYPE_METHODS (type) != NULL_TREE) |
946754ae | 1754 | { |
1755 | have_used_extensions = 1; | |
1756 | dbxout_type_methods (type); | |
1757 | } | |
5d844ba2 | 1758 | |
946754ae | 1759 | putc (';', asmfile); |
d4b87fe5 | 1760 | CHARS (1); |
946754ae | 1761 | |
9cdc08c6 | 1762 | if (use_gnu_debug_info_extensions && TREE_CODE (type) == RECORD_TYPE |
946754ae | 1763 | /* Avoid the ~ if we don't really need it--it confuses dbx. */ |
1764 | && TYPE_VFIELD (type)) | |
1765 | { | |
1766 | have_used_extensions = 1; | |
1767 | ||
1768 | /* Tell GDB+ that it may keep reading. */ | |
1769 | putc ('~', asmfile); | |
d4b87fe5 | 1770 | CHARS (1); |
946754ae | 1771 | |
1772 | /* We need to write out info about what field this class | |
1773 | uses as its "main" vtable pointer field, because if this | |
1774 | field is inherited from a base class, GDB cannot necessarily | |
1775 | figure out which field it's using in time. */ | |
1776 | if (TYPE_VFIELD (type)) | |
1777 | { | |
1778 | putc ('%', asmfile); | |
d4b87fe5 | 1779 | CHARS (1); |
9aa97f08 | 1780 | dbxout_type (DECL_FCONTEXT (TYPE_VFIELD (type)), 0); |
946754ae | 1781 | } |
d4b87fe5 | 1782 | |
946754ae | 1783 | putc (';', asmfile); |
d4b87fe5 | 1784 | CHARS (1); |
946754ae | 1785 | } |
1786 | break; | |
1787 | ||
1788 | case ENUMERAL_TYPE: | |
5c579180 | 1789 | /* We must use the same test here as we use in the DBX_NO_XREFS case |
1790 | above. We simplify it a bit since an enum will never have a variable | |
1791 | size. */ | |
1792 | if ((TYPE_NAME (type) != 0 | |
1793 | && ! (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL | |
1794 | && DECL_IGNORED_P (TYPE_NAME (type))) | |
1795 | && !full) | |
4b72716d | 1796 | || !COMPLETE_TYPE_P (type)) |
946754ae | 1797 | { |
1798 | fprintf (asmfile, "xe"); | |
d4b87fe5 | 1799 | CHARS (2); |
946754ae | 1800 | dbxout_type_name (type); |
54ae7e56 | 1801 | typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_XREF; |
d4b87fe5 | 1802 | putc (':', asmfile); |
1803 | CHARS (1); | |
946754ae | 1804 | return; |
1805 | } | |
1b99826f | 1806 | if (use_gnu_debug_info_extensions |
1807 | && TYPE_PRECISION (type) != TYPE_PRECISION (integer_type_node)) | |
d4b87fe5 | 1808 | { |
1809 | fprintf (asmfile, "@s%d;", TYPE_PRECISION (type)); | |
1810 | CHARS (5); | |
1811 | } | |
1812 | ||
946754ae | 1813 | putc ('e', asmfile); |
1814 | CHARS (1); | |
1815 | for (tem = TYPE_VALUES (type); tem; tem = TREE_CHAIN (tem)) | |
1816 | { | |
01f7da0d | 1817 | fprintf (asmfile, "%s:", IDENTIFIER_POINTER (TREE_PURPOSE (tem))); |
d4b87fe5 | 1818 | CHARS (IDENTIFIER_LENGTH (TREE_PURPOSE (tem)) + 1); |
01f7da0d | 1819 | if (TREE_INT_CST_HIGH (TREE_VALUE (tem)) == 0) |
d4b87fe5 | 1820 | print_wide_int (TREE_INT_CST_LOW (TREE_VALUE (tem))); |
fd8acfe0 | 1821 | else if (TREE_INT_CST_HIGH (TREE_VALUE (tem)) == -1 |
a0c2c45b | 1822 | && (HOST_WIDE_INT) TREE_INT_CST_LOW (TREE_VALUE (tem)) < 0) |
d4b87fe5 | 1823 | print_wide_int (TREE_INT_CST_LOW (TREE_VALUE (tem))); |
01f7da0d | 1824 | else |
1825 | print_int_cst_octal (TREE_VALUE (tem)); | |
d4b87fe5 | 1826 | |
1827 | putc (',', asmfile); | |
1828 | CHARS (1); | |
946754ae | 1829 | if (TREE_CHAIN (tem) != 0) |
d4b87fe5 | 1830 | CONTIN; |
946754ae | 1831 | } |
d4b87fe5 | 1832 | |
946754ae | 1833 | putc (';', asmfile); |
1834 | CHARS (1); | |
1835 | break; | |
1836 | ||
1837 | case POINTER_TYPE: | |
1838 | putc ('*', asmfile); | |
1839 | CHARS (1); | |
9aa97f08 | 1840 | dbxout_type (TREE_TYPE (type), 0); |
946754ae | 1841 | break; |
1842 | ||
1843 | case METHOD_TYPE: | |
9cdc08c6 | 1844 | if (use_gnu_debug_info_extensions) |
946754ae | 1845 | { |
1846 | have_used_extensions = 1; | |
1847 | putc ('#', asmfile); | |
1848 | CHARS (1); | |
9aa97f08 | 1849 | |
1850 | /* Write the argument types out longhand. */ | |
1851 | dbxout_type (TYPE_METHOD_BASETYPE (type), 0); | |
1852 | putc (',', asmfile); | |
1853 | CHARS (1); | |
1854 | dbxout_type (TREE_TYPE (type), 0); | |
1855 | dbxout_args (TYPE_ARG_TYPES (type)); | |
1856 | putc (';', asmfile); | |
1857 | CHARS (1); | |
946754ae | 1858 | } |
1859 | else | |
d4b87fe5 | 1860 | /* Treat it as a function type. */ |
1861 | dbxout_type (TREE_TYPE (type), 0); | |
946754ae | 1862 | break; |
1863 | ||
1864 | case OFFSET_TYPE: | |
9cdc08c6 | 1865 | if (use_gnu_debug_info_extensions) |
946754ae | 1866 | { |
1867 | have_used_extensions = 1; | |
1868 | putc ('@', asmfile); | |
1869 | CHARS (1); | |
9aa97f08 | 1870 | dbxout_type (TYPE_OFFSET_BASETYPE (type), 0); |
946754ae | 1871 | putc (',', asmfile); |
1872 | CHARS (1); | |
9aa97f08 | 1873 | dbxout_type (TREE_TYPE (type), 0); |
946754ae | 1874 | } |
1875 | else | |
d4b87fe5 | 1876 | /* Should print as an int, because it is really just an offset. */ |
1877 | dbxout_type (integer_type_node, 0); | |
946754ae | 1878 | break; |
1879 | ||
1880 | case REFERENCE_TYPE: | |
9cdc08c6 | 1881 | if (use_gnu_debug_info_extensions) |
946754ae | 1882 | have_used_extensions = 1; |
9cdc08c6 | 1883 | putc (use_gnu_debug_info_extensions ? '&' : '*', asmfile); |
946754ae | 1884 | CHARS (1); |
9aa97f08 | 1885 | dbxout_type (TREE_TYPE (type), 0); |
946754ae | 1886 | break; |
1887 | ||
1888 | case FUNCTION_TYPE: | |
1889 | putc ('f', asmfile); | |
1890 | CHARS (1); | |
9aa97f08 | 1891 | dbxout_type (TREE_TYPE (type), 0); |
946754ae | 1892 | break; |
1893 | ||
1894 | default: | |
1895 | abort (); | |
1896 | } | |
1897 | } | |
1898 | ||
7ef5b942 | 1899 | /* Return nonzero if the given type represents an integer whose bounds |
0989224f | 1900 | should be printed in octal format. */ |
1901 | ||
1902 | static bool | |
8ec3a57b | 1903 | print_int_cst_bounds_in_octal_p (tree type) |
0989224f | 1904 | { |
1905 | /* If we can use GDB extensions and the size is wider than a long | |
1906 | (the size used by GDB to read them) or we may have trouble writing | |
1907 | the bounds the usual way, write them in octal. Note the test is for | |
1908 | the *target's* size of "long", not that of the host. The host test | |
1909 | is just to make sure we can write it out in case the host wide int | |
1910 | is narrower than the target "long". | |
8ec3a57b | 1911 | |
0989224f | 1912 | For unsigned types, we use octal if they are the same size or larger. |
1913 | This is because we print the bounds as signed decimal, and hence they | |
1914 | can't span same size unsigned types. */ | |
1915 | ||
1916 | if (use_gnu_debug_info_extensions | |
1917 | && TYPE_MIN_VALUE (type) != 0 | |
1918 | && TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST | |
1919 | && TYPE_MAX_VALUE (type) != 0 | |
1920 | && TREE_CODE (TYPE_MAX_VALUE (type)) == INTEGER_CST | |
1921 | && (TYPE_PRECISION (type) > TYPE_PRECISION (integer_type_node) | |
1922 | || ((TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node)) | |
78a8ed03 | 1923 | && TYPE_UNSIGNED (type)) |
0989224f | 1924 | || TYPE_PRECISION (type) > HOST_BITS_PER_WIDE_INT |
1925 | || (TYPE_PRECISION (type) == HOST_BITS_PER_WIDE_INT | |
78a8ed03 | 1926 | && TYPE_UNSIGNED (type)))) |
0989224f | 1927 | return TRUE; |
1928 | else | |
1929 | return FALSE; | |
1930 | } | |
1931 | ||
946754ae | 1932 | /* Print the value of integer constant C, in octal, |
1933 | handling double precision. */ | |
1934 | ||
1935 | static void | |
8ec3a57b | 1936 | print_int_cst_octal (tree c) |
946754ae | 1937 | { |
4303221c | 1938 | unsigned HOST_WIDE_INT high = TREE_INT_CST_HIGH (c); |
1939 | unsigned HOST_WIDE_INT low = TREE_INT_CST_LOW (c); | |
1940 | int excess = (3 - (HOST_BITS_PER_WIDE_INT % 3)); | |
5d844ba2 | 1941 | unsigned int width = TYPE_PRECISION (TREE_TYPE (c)); |
bdbb0781 | 1942 | |
1943 | /* GDB wants constants with no extra leading "1" bits, so | |
1944 | we need to remove any sign-extension that might be | |
1945 | present. */ | |
1946 | if (width == HOST_BITS_PER_WIDE_INT * 2) | |
1947 | ; | |
1948 | else if (width > HOST_BITS_PER_WIDE_INT) | |
1949 | high &= (((HOST_WIDE_INT) 1 << (width - HOST_BITS_PER_WIDE_INT)) - 1); | |
bc766fdc | 1950 | else if (width == HOST_BITS_PER_WIDE_INT) |
1951 | high = 0; | |
1952 | else | |
1953 | high = 0, low &= (((HOST_WIDE_INT) 1 << width) - 1); | |
946754ae | 1954 | |
1955 | fprintf (asmfile, "0"); | |
d4b87fe5 | 1956 | CHARS (1); |
946754ae | 1957 | |
1958 | if (excess == 3) | |
1959 | { | |
4303221c | 1960 | print_octal (high, HOST_BITS_PER_WIDE_INT / 3); |
1961 | print_octal (low, HOST_BITS_PER_WIDE_INT / 3); | |
946754ae | 1962 | } |
1963 | else | |
1964 | { | |
4303221c | 1965 | unsigned HOST_WIDE_INT beg = high >> excess; |
1966 | unsigned HOST_WIDE_INT middle | |
1967 | = ((high & (((HOST_WIDE_INT) 1 << excess) - 1)) << (3 - excess) | |
1968 | | (low >> (HOST_BITS_PER_WIDE_INT / 3 * 3))); | |
1969 | unsigned HOST_WIDE_INT end | |
bdbb0781 | 1970 | = low & (((unsigned HOST_WIDE_INT) 1 |
1971 | << (HOST_BITS_PER_WIDE_INT / 3 * 3)) | |
1972 | - 1); | |
1973 | ||
eca80b04 | 1974 | fprintf (asmfile, "%o%01o", (int) beg, (int) middle); |
d4b87fe5 | 1975 | CHARS (2); |
4303221c | 1976 | print_octal (end, HOST_BITS_PER_WIDE_INT / 3); |
946754ae | 1977 | } |
1978 | } | |
1979 | ||
1980 | static void | |
8ec3a57b | 1981 | print_octal (unsigned HOST_WIDE_INT value, int digits) |
946754ae | 1982 | { |
1983 | int i; | |
1984 | ||
1985 | for (i = digits - 1; i >= 0; i--) | |
eca80b04 | 1986 | fprintf (asmfile, "%01o", (int) ((value >> (3 * i)) & 7)); |
d4b87fe5 | 1987 | |
1988 | CHARS (digits); | |
946754ae | 1989 | } |
1990 | ||
d4b87fe5 | 1991 | /* Output C in decimal while adjusting the number of digits written. */ |
1992 | ||
1993 | static void | |
8ec3a57b | 1994 | print_wide_int (HOST_WIDE_INT c) |
d4b87fe5 | 1995 | { |
1996 | int digs = 0; | |
1997 | ||
1998 | fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC, c); | |
1999 | ||
2000 | if (c < 0) | |
2001 | digs++, c = -c; | |
2002 | ||
2003 | while (c > 0) | |
2004 | c /= 10; digs++; | |
2005 | ||
2006 | CHARS (digs); | |
2007 | } | |
1eefe280 | 2008 | |
946754ae | 2009 | /* Output the name of type TYPE, with no punctuation. |
2010 | Such names can be set up either by typedef declarations | |
2011 | or by struct, enum and union tags. */ | |
2012 | ||
2013 | static void | |
8ec3a57b | 2014 | dbxout_type_name (tree type) |
946754ae | 2015 | { |
2016 | tree t; | |
2017 | if (TYPE_NAME (type) == 0) | |
2018 | abort (); | |
2019 | if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE) | |
2020 | { | |
2021 | t = TYPE_NAME (type); | |
2022 | } | |
2023 | else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL) | |
2024 | { | |
2025 | t = DECL_NAME (TYPE_NAME (type)); | |
2026 | } | |
2027 | else | |
2028 | abort (); | |
2029 | ||
2030 | fprintf (asmfile, "%s", IDENTIFIER_POINTER (t)); | |
2031 | CHARS (IDENTIFIER_LENGTH (t)); | |
2032 | } | |
d251e975 | 2033 | |
2034 | /* Output leading leading struct or class names needed for qualifying | |
2035 | type whose scope is limited to a struct or class. */ | |
2036 | ||
2037 | static void | |
8ec3a57b | 2038 | dbxout_class_name_qualifiers (tree decl) |
d251e975 | 2039 | { |
2040 | tree context = decl_type_context (decl); | |
2041 | ||
8ec3a57b | 2042 | if (context != NULL_TREE |
d251e975 | 2043 | && TREE_CODE(context) == RECORD_TYPE |
8ec3a57b | 2044 | && TYPE_NAME (context) != 0 |
d251e975 | 2045 | && (TREE_CODE (TYPE_NAME (context)) == IDENTIFIER_NODE |
2046 | || (DECL_NAME (TYPE_NAME (context)) != 0))) | |
2047 | { | |
2048 | tree name = TYPE_NAME (context); | |
2049 | ||
51cec339 | 2050 | emit_pending_bincls_if_required (); |
2051 | ||
d251e975 | 2052 | if (TREE_CODE (name) == TYPE_DECL) |
2053 | { | |
2054 | dbxout_class_name_qualifiers (name); | |
2055 | name = DECL_NAME (name); | |
2056 | } | |
2057 | fprintf (asmfile, "%s::", IDENTIFIER_POINTER (name)); | |
2058 | CHARS (IDENTIFIER_LENGTH (name) + 2); | |
2059 | } | |
2060 | } | |
946754ae | 2061 | \f |
2062 | /* Output a .stabs for the symbol defined by DECL, | |
2063 | which must be a ..._DECL node in the normal namespace. | |
2064 | It may be a CONST_DECL, a FUNCTION_DECL, a PARM_DECL or a VAR_DECL. | |
d0309f39 | 2065 | LOCAL is nonzero if the scope is less than the entire file. |
2066 | Return 1 if a stabs might have been emitted. */ | |
946754ae | 2067 | |
d0309f39 | 2068 | int |
8ec3a57b | 2069 | dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED) |
946754ae | 2070 | { |
946754ae | 2071 | tree type = TREE_TYPE (decl); |
2072 | tree context = NULL_TREE; | |
d0309f39 | 2073 | int result = 0; |
946754ae | 2074 | |
262444a6 | 2075 | /* "Intercept" dbxout_symbol() calls like we do all debug_hooks. */ |
2076 | ++debug_nesting; | |
2077 | ||
946754ae | 2078 | /* Ignore nameless syms, but don't ignore type tags. */ |
2079 | ||
2080 | if ((DECL_NAME (decl) == 0 && TREE_CODE (decl) != TYPE_DECL) | |
2081 | || DECL_IGNORED_P (decl)) | |
262444a6 | 2082 | DBXOUT_DECR_NESTING_AND_RETURN (0); |
2083 | ||
d01481af | 2084 | /* If we are to generate only the symbols actually used then such |
262444a6 | 2085 | symbol nodees are flagged with TREE_USED. Ignore any that |
2086 | aren't flaged as TREE_USED. */ | |
8ec3a57b | 2087 | |
73ae3ef7 | 2088 | if (flag_debug_only_used_symbols |
2089 | && (!TREE_USED (decl) | |
2090 | && (TREE_CODE (decl) != VAR_DECL || !DECL_INITIAL (decl)))) | |
2091 | DBXOUT_DECR_NESTING_AND_RETURN (0); | |
2092 | ||
2093 | /* If dbxout_init has not yet run, queue this symbol for later. */ | |
2094 | if (!typevec) | |
2095 | { | |
2096 | preinit_symbols = tree_cons (0, decl, preinit_symbols); | |
2097 | DBXOUT_DECR_NESTING_AND_RETURN (0); | |
2098 | } | |
2099 | ||
262444a6 | 2100 | if (flag_debug_only_used_symbols) |
2101 | { | |
2102 | tree t; | |
2103 | ||
262444a6 | 2104 | /* We now have a used symbol. We need to generate the info for |
2105 | the symbol's type in addition to the symbol itself. These | |
2106 | type symbols are queued to be generated after were done with | |
2107 | the symbol itself (done because the symbol's info is generated | |
2108 | with fprintf's, etc. as it determines what's needed). | |
2109 | ||
2110 | Note, because the TREE_TYPE(type) might be something like a | |
2111 | pointer to a named type we need to look for the first name | |
2112 | we see following the TREE_TYPE chain. */ | |
2113 | ||
8ec3a57b | 2114 | t = type; |
262444a6 | 2115 | while (POINTER_TYPE_P (t)) |
2116 | t = TREE_TYPE (t); | |
2117 | ||
2118 | /* RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE, and ENUMERAL_TYPE | |
2119 | need special treatment. The TYPE_STUB_DECL field in these | |
2120 | types generally represents the tag name type we want to | |
2121 | output. In addition there could be a typedef type with | |
2122 | a different name. In that case we also want to output | |
2123 | that. */ | |
2124 | ||
2125 | if ((TREE_CODE (t) == RECORD_TYPE | |
2126 | || TREE_CODE (t) == UNION_TYPE | |
2127 | || TREE_CODE (t) == QUAL_UNION_TYPE | |
2128 | || TREE_CODE (t) == ENUMERAL_TYPE) | |
2129 | && TYPE_STUB_DECL (t) | |
2130 | && TYPE_STUB_DECL (t) != decl | |
2131 | && TREE_CODE_CLASS (TREE_CODE (TYPE_STUB_DECL (t))) == 'd' | |
2132 | && ! DECL_IGNORED_P (TYPE_STUB_DECL (t))) | |
2133 | { | |
2134 | debug_queue_symbol (TYPE_STUB_DECL (t)); | |
2135 | if (TYPE_NAME (t) | |
2136 | && TYPE_NAME (t) != TYPE_STUB_DECL (t) | |
2137 | && TYPE_NAME (t) != decl | |
2138 | && TREE_CODE_CLASS (TREE_CODE (TYPE_NAME (t))) == 'd') | |
2139 | debug_queue_symbol (TYPE_NAME (t)); | |
2140 | } | |
2141 | else if (TYPE_NAME (t) | |
2142 | && TYPE_NAME (t) != decl | |
2143 | && TREE_CODE_CLASS (TREE_CODE (TYPE_NAME (t))) == 'd') | |
2144 | debug_queue_symbol (TYPE_NAME (t)); | |
2145 | } | |
946754ae | 2146 | |
51cec339 | 2147 | emit_pending_bincls_if_required (); |
2148 | ||
946754ae | 2149 | dbxout_prepare_symbol (decl); |
2150 | ||
2151 | /* The output will always start with the symbol name, | |
2152 | so always count that in the length-output-so-far. */ | |
2153 | ||
2154 | if (DECL_NAME (decl) != 0) | |
2155 | current_sym_nchars = 2 + IDENTIFIER_LENGTH (DECL_NAME (decl)); | |
2156 | ||
2157 | switch (TREE_CODE (decl)) | |
2158 | { | |
2159 | case CONST_DECL: | |
2160 | /* Enum values are defined by defining the enum type. */ | |
2161 | break; | |
2162 | ||
2163 | case FUNCTION_DECL: | |
2164 | if (DECL_RTL (decl) == 0) | |
262444a6 | 2165 | DBXOUT_DECR_NESTING_AND_RETURN (0); |
8fc7a3d0 | 2166 | if (DECL_EXTERNAL (decl)) |
946754ae | 2167 | break; |
2168 | /* Don't mention a nested function under its parent. */ | |
2169 | context = decl_function_context (decl); | |
2170 | if (context == current_function_decl) | |
2171 | break; | |
2172 | if (GET_CODE (DECL_RTL (decl)) != MEM | |
2173 | || GET_CODE (XEXP (DECL_RTL (decl), 0)) != SYMBOL_REF) | |
2174 | break; | |
2175 | FORCE_TEXT; | |
2176 | ||
17d8e118 | 2177 | fprintf (asmfile, "%s\"%s:%c", ASM_STABS_OP, |
946754ae | 2178 | IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)), |
2179 | TREE_PUBLIC (decl) ? 'F' : 'f'); | |
d0309f39 | 2180 | result = 1; |
946754ae | 2181 | |
2182 | current_sym_code = N_FUN; | |
2183 | current_sym_addr = XEXP (DECL_RTL (decl), 0); | |
2184 | ||
2185 | if (TREE_TYPE (type)) | |
9aa97f08 | 2186 | dbxout_type (TREE_TYPE (type), 0); |
946754ae | 2187 | else |
9aa97f08 | 2188 | dbxout_type (void_type_node, 0); |
946754ae | 2189 | |
2190 | /* For a nested function, when that function is compiled, | |
2191 | mention the containing function name | |
2192 | as well as (since dbx wants it) our own assembler-name. */ | |
2193 | if (context != 0) | |
2194 | fprintf (asmfile, ",%s,%s", | |
2195 | IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)), | |
2196 | IDENTIFIER_POINTER (DECL_NAME (context))); | |
2197 | ||
2198 | dbxout_finish_symbol (decl); | |
2199 | break; | |
2200 | ||
2201 | case TYPE_DECL: | |
946754ae | 2202 | /* Don't output the same typedef twice. |
2203 | And don't output what language-specific stuff doesn't want output. */ | |
53aaa4b2 | 2204 | if (TREE_ASM_WRITTEN (decl) || TYPE_DECL_SUPPRESS_DEBUG (decl)) |
262444a6 | 2205 | DBXOUT_DECR_NESTING_AND_RETURN (0); |
946754ae | 2206 | |
73ae3ef7 | 2207 | /* Don't output typedefs for types with magic type numbers (XCOFF). */ |
2208 | #ifdef DBX_ASSIGN_FUNDAMENTAL_TYPE_NUMBER | |
2209 | { | |
2210 | int fundamental_type_number = | |
2211 | DBX_ASSIGN_FUNDAMENTAL_TYPE_NUMBER (decl); | |
2212 | ||
2213 | if (fundamental_type_number != 0) | |
2214 | { | |
2215 | TREE_ASM_WRITTEN (decl) = 1; | |
2216 | TYPE_SYMTAB_ADDRESS (TREE_TYPE (decl)) = fundamental_type_number; | |
2217 | DBXOUT_DECR_NESTING_AND_RETURN (0); | |
2218 | } | |
2219 | } | |
2220 | #endif | |
946754ae | 2221 | FORCE_TEXT; |
d0309f39 | 2222 | result = 1; |
1ecd86ea | 2223 | { |
2224 | int tag_needed = 1; | |
d78a5beb | 2225 | int did_output = 0; |
ef01e856 | 2226 | |
1ecd86ea | 2227 | if (DECL_NAME (decl)) |
2228 | { | |
2229 | /* Nonzero means we must output a tag as well as a typedef. */ | |
2230 | tag_needed = 0; | |
946754ae | 2231 | |
068adc53 | 2232 | /* Handle the case of a C++ structure or union |
2233 | where the TYPE_NAME is a TYPE_DECL | |
2234 | which gives both a typedef name and a tag. */ | |
2be77840 | 2235 | /* dbx requires the tag first and the typedef second. */ |
068adc53 | 2236 | if ((TREE_CODE (type) == RECORD_TYPE |
7f8a347a | 2237 | || TREE_CODE (type) == UNION_TYPE |
2238 | || TREE_CODE (type) == QUAL_UNION_TYPE) | |
068adc53 | 2239 | && TYPE_NAME (type) == decl |
9cdc08c6 | 2240 | && !(use_gnu_debug_info_extensions && have_used_extensions) |
2be77840 | 2241 | && !TREE_ASM_WRITTEN (TYPE_NAME (type)) |
2242 | /* Distinguish the implicit typedefs of C++ | |
2243 | from explicit ones that might be found in C. */ | |
1eefe280 | 2244 | && DECL_ARTIFICIAL (decl) |
262444a6 | 2245 | /* Do not generate a tag for incomplete records. */ |
2246 | && COMPLETE_TYPE_P (type) | |
79433a4c | 2247 | /* Do not generate a tag for records of variable size, |
2248 | since this type can not be properly described in the | |
2249 | DBX format, and it confuses some tools such as objdump. */ | |
dc891f3f | 2250 | && host_integerp (TYPE_SIZE (type), 1)) |
068adc53 | 2251 | { |
2252 | tree name = TYPE_NAME (type); | |
2253 | if (TREE_CODE (name) == TYPE_DECL) | |
2254 | name = DECL_NAME (name); | |
2255 | ||
2256 | current_sym_code = DBX_TYPE_DECL_STABS_CODE; | |
2257 | current_sym_value = 0; | |
2258 | current_sym_addr = 0; | |
2259 | current_sym_nchars = 2 + IDENTIFIER_LENGTH (name); | |
2260 | ||
17d8e118 | 2261 | fprintf (asmfile, "%s\"%s:T", ASM_STABS_OP, |
068adc53 | 2262 | IDENTIFIER_POINTER (name)); |
9aa97f08 | 2263 | dbxout_type (type, 1); |
4303221c | 2264 | dbxout_finish_symbol (NULL_TREE); |
068adc53 | 2265 | } |
2266 | ||
d251e975 | 2267 | /* Output .stabs (or whatever) and leading double quote. */ |
2268 | fprintf (asmfile, "%s\"", ASM_STABS_OP); | |
2269 | ||
2270 | if (use_gnu_debug_info_extensions) | |
2271 | { | |
2272 | /* Output leading class/struct qualifiers. */ | |
2273 | dbxout_class_name_qualifiers (decl); | |
2274 | } | |
2275 | ||
1ecd86ea | 2276 | /* Output typedef name. */ |
d251e975 | 2277 | fprintf (asmfile, "%s:", IDENTIFIER_POINTER (DECL_NAME (decl))); |
ef01e856 | 2278 | |
1ecd86ea | 2279 | /* Short cut way to output a tag also. */ |
2280 | if ((TREE_CODE (type) == RECORD_TYPE | |
7f8a347a | 2281 | || TREE_CODE (type) == UNION_TYPE |
2282 | || TREE_CODE (type) == QUAL_UNION_TYPE) | |
3e5c6b4e | 2283 | && TYPE_NAME (type) == decl |
2284 | /* Distinguish the implicit typedefs of C++ | |
2285 | from explicit ones that might be found in C. */ | |
1eefe280 | 2286 | && DECL_ARTIFICIAL (decl)) |
1ecd86ea | 2287 | { |
9cdc08c6 | 2288 | if (use_gnu_debug_info_extensions && have_used_extensions) |
1ecd86ea | 2289 | { |
2290 | putc ('T', asmfile); | |
2291 | TREE_ASM_WRITTEN (TYPE_NAME (type)) = 1; | |
2292 | } | |
068adc53 | 2293 | #if 0 /* Now we generate the tag for this case up above. */ |
1ecd86ea | 2294 | else |
2295 | tag_needed = 1; | |
068adc53 | 2296 | #endif |
1ecd86ea | 2297 | } |
946754ae | 2298 | |
1ecd86ea | 2299 | putc ('t', asmfile); |
98123cec | 2300 | current_sym_code = DBX_TYPE_DECL_STABS_CODE; |
ef01e856 | 2301 | |
9aa97f08 | 2302 | dbxout_type (type, 1); |
1ecd86ea | 2303 | dbxout_finish_symbol (decl); |
d78a5beb | 2304 | did_output = 1; |
1ecd86ea | 2305 | } |
946754ae | 2306 | |
79433a4c | 2307 | /* Don't output a tag if this is an incomplete type. This prevents |
2308 | the sun4 Sun OS 4.x dbx from crashing. */ | |
dc891f3f | 2309 | |
06ce1380 | 2310 | if (tag_needed && TYPE_NAME (type) != 0 |
2311 | && (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE | |
2312 | || (DECL_NAME (TYPE_NAME (type)) != 0)) | |
4b72716d | 2313 | && COMPLETE_TYPE_P (type) |
1ecd86ea | 2314 | && !TREE_ASM_WRITTEN (TYPE_NAME (type))) |
2315 | { | |
2316 | /* For a TYPE_DECL with no name, but the type has a name, | |
2317 | output a tag. | |
2318 | This is what represents `struct foo' with no typedef. */ | |
2319 | /* In C++, the name of a type is the corresponding typedef. | |
2320 | In C, it is an IDENTIFIER_NODE. */ | |
2321 | tree name = TYPE_NAME (type); | |
2322 | if (TREE_CODE (name) == TYPE_DECL) | |
2323 | name = DECL_NAME (name); | |
2324 | ||
98123cec | 2325 | current_sym_code = DBX_TYPE_DECL_STABS_CODE; |
1ecd86ea | 2326 | current_sym_value = 0; |
2327 | current_sym_addr = 0; | |
2328 | current_sym_nchars = 2 + IDENTIFIER_LENGTH (name); | |
2329 | ||
17d8e118 | 2330 | fprintf (asmfile, "%s\"%s:T", ASM_STABS_OP, |
1ecd86ea | 2331 | IDENTIFIER_POINTER (name)); |
9aa97f08 | 2332 | dbxout_type (type, 1); |
4303221c | 2333 | dbxout_finish_symbol (NULL_TREE); |
d78a5beb | 2334 | did_output = 1; |
2335 | } | |
2336 | ||
2337 | /* If an enum type has no name, it cannot be referred to, | |
2338 | but we must output it anyway, since the enumeration constants | |
2339 | can be referred to. */ | |
2340 | if (!did_output && TREE_CODE (type) == ENUMERAL_TYPE) | |
2341 | { | |
2342 | current_sym_code = DBX_TYPE_DECL_STABS_CODE; | |
2343 | current_sym_value = 0; | |
2344 | current_sym_addr = 0; | |
2345 | current_sym_nchars = 2; | |
2346 | ||
04c6b571 | 2347 | /* Some debuggers fail when given NULL names, so give this a |
2348 | harmless name of ` '. */ | |
17d8e118 | 2349 | fprintf (asmfile, "%s\" :T", ASM_STABS_OP); |
9aa97f08 | 2350 | dbxout_type (type, 1); |
d78a5beb | 2351 | dbxout_finish_symbol (NULL_TREE); |
1ecd86ea | 2352 | } |
2353 | ||
2354 | /* Prevent duplicate output of a typedef. */ | |
2355 | TREE_ASM_WRITTEN (decl) = 1; | |
2356 | break; | |
2357 | } | |
946754ae | 2358 | |
2359 | case PARM_DECL: | |
2360 | /* Parm decls go in their own separate chains | |
2361 | and are output by dbxout_reg_parms and dbxout_parms. */ | |
2362 | abort (); | |
2363 | ||
2364 | case RESULT_DECL: | |
2365 | /* Named return value, treat like a VAR_DECL. */ | |
2366 | case VAR_DECL: | |
634b7df0 | 2367 | if (! DECL_RTL_SET_P (decl)) |
262444a6 | 2368 | DBXOUT_DECR_NESTING_AND_RETURN (0); |
946754ae | 2369 | /* Don't mention a variable that is external. |
2370 | Let the file that defines it describe it. */ | |
8fc7a3d0 | 2371 | if (DECL_EXTERNAL (decl)) |
946754ae | 2372 | break; |
2373 | ||
2374 | /* If the variable is really a constant | |
2375 | and not written in memory, inform the debugger. */ | |
2376 | if (TREE_STATIC (decl) && TREE_READONLY (decl) | |
2377 | && DECL_INITIAL (decl) != 0 | |
5d844ba2 | 2378 | && host_integerp (DECL_INITIAL (decl), 0) |
946754ae | 2379 | && ! TREE_ASM_WRITTEN (decl) |
7e5e198b | 2380 | && (DECL_CONTEXT (decl) == NULL_TREE |
2381 | || TREE_CODE (DECL_CONTEXT (decl)) == BLOCK)) | |
946754ae | 2382 | { |
2383 | if (TREE_PUBLIC (decl) == 0) | |
2384 | { | |
2385 | /* The sun4 assembler does not grok this. */ | |
12fc9462 | 2386 | const char *name = IDENTIFIER_POINTER (DECL_NAME (decl)); |
5d844ba2 | 2387 | |
946754ae | 2388 | if (TREE_CODE (TREE_TYPE (decl)) == INTEGER_TYPE |
2389 | || TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE) | |
2390 | { | |
5d844ba2 | 2391 | HOST_WIDE_INT ival = tree_low_cst (DECL_INITIAL (decl), 0); |
85aa12f7 | 2392 | fprintf (asmfile, "%s\"%s:c=i" HOST_WIDE_INT_PRINT_DEC |
2393 | "\",0x%x,0,0,0\n", | |
2394 | ASM_STABS_OP, name, ival, N_LSYM); | |
262444a6 | 2395 | DBXOUT_DECR_NESTING; |
d0309f39 | 2396 | return 1; |
946754ae | 2397 | } |
2398 | else if (TREE_CODE (TREE_TYPE (decl)) == REAL_TYPE) | |
2399 | { | |
21dda4ee | 2400 | /* Don't know how to do this yet. */ |
946754ae | 2401 | } |
2402 | break; | |
2403 | } | |
2404 | /* else it is something we handle like a normal variable. */ | |
2405 | } | |
2406 | ||
0e8e37b2 | 2407 | SET_DECL_RTL (decl, eliminate_regs (DECL_RTL (decl), 0, NULL_RTX)); |
946754ae | 2408 | #ifdef LEAF_REG_REMAP |
b3b67b7c | 2409 | if (current_function_uses_only_leaf_regs) |
946754ae | 2410 | leaf_renumber_regs_insn (DECL_RTL (decl)); |
2411 | #endif | |
2412 | ||
d0309f39 | 2413 | result = dbxout_symbol_location (decl, type, 0, DECL_RTL (decl)); |
0dbd1c74 | 2414 | break; |
1eefe280 | 2415 | |
0dbd1c74 | 2416 | default: |
2417 | break; | |
3c5d2a1c | 2418 | } |
262444a6 | 2419 | DBXOUT_DECR_NESTING; |
d0309f39 | 2420 | return result; |
3c5d2a1c | 2421 | } |
2422 | \f | |
2423 | /* Output the stab for DECL, a VAR_DECL, RESULT_DECL or PARM_DECL. | |
2424 | Add SUFFIX to its name, if SUFFIX is not 0. | |
2425 | Describe the variable as residing in HOME | |
d0309f39 | 2426 | (usually HOME is DECL_RTL (DECL), but not always). |
2427 | Returns 1 if the stab was really emitted. */ | |
3c5d2a1c | 2428 | |
d0309f39 | 2429 | static int |
8ec3a57b | 2430 | dbxout_symbol_location (tree decl, tree type, const char *suffix, rtx home) |
3c5d2a1c | 2431 | { |
2432 | int letter = 0; | |
2433 | int regno = -1; | |
946754ae | 2434 | |
51cec339 | 2435 | emit_pending_bincls_if_required (); |
2436 | ||
3c5d2a1c | 2437 | /* Don't mention a variable at all |
2438 | if it was completely optimized into nothingness. | |
1eefe280 | 2439 | |
9e042f31 | 2440 | If the decl was from an inline function, then its rtl |
3c5d2a1c | 2441 | is not identically the rtl that was used in this |
2442 | particular compilation. */ | |
aa6a7ab3 | 2443 | if (GET_CODE (home) == SUBREG) |
3c5d2a1c | 2444 | { |
2445 | rtx value = home; | |
701e46d0 | 2446 | |
3c5d2a1c | 2447 | while (GET_CODE (value) == SUBREG) |
701e46d0 | 2448 | value = SUBREG_REG (value); |
3c5d2a1c | 2449 | if (GET_CODE (value) == REG) |
946754ae | 2450 | { |
701e46d0 | 2451 | if (REGNO (value) >= FIRST_PSEUDO_REGISTER) |
d0309f39 | 2452 | return 0; |
946754ae | 2453 | } |
06b3c9f7 | 2454 | home = alter_subreg (&home); |
aa6a7ab3 | 2455 | } |
2456 | if (GET_CODE (home) == REG) | |
2457 | { | |
2458 | regno = REGNO (home); | |
2459 | if (regno >= FIRST_PSEUDO_REGISTER) | |
2460 | return 0; | |
3c5d2a1c | 2461 | } |
2462 | ||
2463 | /* The kind-of-variable letter depends on where | |
2464 | the variable is and on the scope of its name: | |
2465 | G and N_GSYM for static storage and global scope, | |
2466 | S for static storage and file scope, | |
2467 | V for static storage and local scope, | |
2468 | for those two, use N_LCSYM if data is in bss segment, | |
2469 | N_STSYM if in data segment, N_FUN otherwise. | |
2470 | (We used N_FUN originally, then changed to N_STSYM | |
2471 | to please GDB. However, it seems that confused ld. | |
2472 | Now GDB has been fixed to like N_FUN, says Kingdon.) | |
2473 | no letter at all, and N_LSYM, for auto variable, | |
2474 | r and N_RSYM for register variable. */ | |
2475 | ||
2476 | if (GET_CODE (home) == MEM | |
2477 | && GET_CODE (XEXP (home, 0)) == SYMBOL_REF) | |
2478 | { | |
2479 | if (TREE_PUBLIC (decl)) | |
946754ae | 2480 | { |
3c5d2a1c | 2481 | letter = 'G'; |
2482 | current_sym_code = N_GSYM; | |
946754ae | 2483 | } |
3c5d2a1c | 2484 | else |
946754ae | 2485 | { |
3c5d2a1c | 2486 | current_sym_addr = XEXP (home, 0); |
946754ae | 2487 | |
3c5d2a1c | 2488 | letter = decl_function_context (decl) ? 'V' : 'S'; |
946754ae | 2489 | |
2def70a8 | 2490 | /* This should be the same condition as in assemble_variable, but |
2491 | we don't have access to dont_output_data here. So, instead, | |
2492 | we rely on the fact that error_mark_node initializers always | |
2493 | end up in bss for C++ and never end up in bss for C. */ | |
2494 | if (DECL_INITIAL (decl) == 0 | |
d19bd1f0 | 2495 | || (!strcmp (lang_hooks.name, "GNU C++") |
2def70a8 | 2496 | && DECL_INITIAL (decl) == error_mark_node)) |
3c5d2a1c | 2497 | current_sym_code = N_LCSYM; |
bcfbda84 | 2498 | else if (DECL_IN_TEXT_SECTION (decl)) |
3c5d2a1c | 2499 | /* This is not quite right, but it's the closest |
2500 | of all the codes that Unix defines. */ | |
2501 | current_sym_code = DBX_STATIC_CONST_VAR_CODE; | |
2502 | else | |
2503 | { | |
58f036fc | 2504 | /* Some ports can transform a symbol ref into a label ref, |
2505 | because the symbol ref is too far away and has to be | |
2506 | dumped into a constant pool. Alternatively, the symbol | |
2507 | in the constant pool might be referenced by a different | |
2508 | symbol. */ | |
2509 | if (GET_CODE (current_sym_addr) == SYMBOL_REF | |
2510 | && CONSTANT_POOL_ADDRESS_P (current_sym_addr)) | |
2511 | { | |
88816742 | 2512 | bool marked; |
2513 | rtx tmp = get_pool_constant_mark (current_sym_addr, &marked); | |
2514 | ||
2515 | if (GET_CODE (tmp) == SYMBOL_REF) | |
2516 | { | |
2517 | current_sym_addr = tmp; | |
2518 | if (CONSTANT_POOL_ADDRESS_P (current_sym_addr)) | |
2519 | get_pool_constant_mark (current_sym_addr, &marked); | |
2520 | else | |
2521 | marked = true; | |
2522 | } | |
2523 | else if (GET_CODE (tmp) == LABEL_REF) | |
2524 | { | |
2525 | current_sym_addr = tmp; | |
2526 | marked = true; | |
2527 | } | |
2528 | ||
2529 | /* If all references to the constant pool were optimized | |
2530 | out, we just ignore the symbol. */ | |
2531 | if (!marked) | |
2532 | return 0; | |
58f036fc | 2533 | } |
1eefe280 | 2534 | |
3c5d2a1c | 2535 | /* Ultrix `as' seems to need this. */ |
946754ae | 2536 | #ifdef DBX_STATIC_STAB_DATA_SECTION |
3c5d2a1c | 2537 | data_section (); |
946754ae | 2538 | #endif |
3c5d2a1c | 2539 | current_sym_code = N_STSYM; |
946754ae | 2540 | } |
2541 | } | |
3c5d2a1c | 2542 | } |
2543 | else if (regno >= 0) | |
2544 | { | |
2545 | letter = 'r'; | |
2546 | current_sym_code = N_RSYM; | |
2547 | current_sym_value = DBX_REGISTER_NUMBER (regno); | |
2548 | } | |
2549 | else if (GET_CODE (home) == MEM | |
2550 | && (GET_CODE (XEXP (home, 0)) == MEM | |
2551 | || (GET_CODE (XEXP (home, 0)) == REG | |
bca4bea0 | 2552 | && REGNO (XEXP (home, 0)) != HARD_FRAME_POINTER_REGNUM |
2553 | && REGNO (XEXP (home, 0)) != STACK_POINTER_REGNUM | |
2554 | #if ARG_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM | |
2555 | && REGNO (XEXP (home, 0)) != ARG_POINTER_REGNUM | |
2556 | #endif | |
2557 | ))) | |
3c5d2a1c | 2558 | /* If the value is indirect by memory or by a register |
2559 | that isn't the frame pointer | |
2560 | then it means the object is variable-sized and address through | |
2561 | that register or stack slot. DBX has no way to represent this | |
2562 | so all we can do is output the variable as a pointer. | |
4ee9c684 | 2563 | If it's not a parameter, ignore it. */ |
3c5d2a1c | 2564 | { |
2565 | if (GET_CODE (XEXP (home, 0)) == REG) | |
946754ae | 2566 | { |
2567 | letter = 'r'; | |
2568 | current_sym_code = N_RSYM; | |
756ab748 | 2569 | if (REGNO (XEXP (home, 0)) >= FIRST_PSEUDO_REGISTER) |
2570 | return 0; | |
3c5d2a1c | 2571 | current_sym_value = DBX_REGISTER_NUMBER (REGNO (XEXP (home, 0))); |
946754ae | 2572 | } |
3c5d2a1c | 2573 | else |
946754ae | 2574 | { |
2575 | current_sym_code = N_LSYM; | |
3c5d2a1c | 2576 | /* RTL looks like (MEM (MEM (PLUS (REG...) (CONST_INT...)))). |
946754ae | 2577 | We want the value of that CONST_INT. */ |
3c5d2a1c | 2578 | current_sym_value |
2579 | = DEBUGGER_AUTO_OFFSET (XEXP (XEXP (home, 0), 0)); | |
439c05a0 | 2580 | } |
3c5d2a1c | 2581 | |
2582 | /* Effectively do build_pointer_type, but don't cache this type, | |
2583 | since it might be temporary whereas the type it points to | |
2584 | might have been saved for inlining. */ | |
2585 | /* Don't use REFERENCE_TYPE because dbx can't handle that. */ | |
2586 | type = make_node (POINTER_TYPE); | |
2587 | TREE_TYPE (type) = TREE_TYPE (decl); | |
2588 | } | |
2589 | else if (GET_CODE (home) == MEM | |
2590 | && GET_CODE (XEXP (home, 0)) == REG) | |
2591 | { | |
2592 | current_sym_code = N_LSYM; | |
2593 | current_sym_value = DEBUGGER_AUTO_OFFSET (XEXP (home, 0)); | |
2594 | } | |
2595 | else if (GET_CODE (home) == MEM | |
2596 | && GET_CODE (XEXP (home, 0)) == PLUS | |
2597 | && GET_CODE (XEXP (XEXP (home, 0), 1)) == CONST_INT) | |
2598 | { | |
2599 | current_sym_code = N_LSYM; | |
2600 | /* RTL looks like (MEM (PLUS (REG...) (CONST_INT...))) | |
2601 | We want the value of that CONST_INT. */ | |
2602 | current_sym_value = DEBUGGER_AUTO_OFFSET (XEXP (home, 0)); | |
2603 | } | |
2604 | else if (GET_CODE (home) == MEM | |
2605 | && GET_CODE (XEXP (home, 0)) == CONST) | |
2606 | { | |
2607 | /* Handle an obscure case which can arise when optimizing and | |
2608 | when there are few available registers. (This is *always* | |
2609 | the case for i386/i486 targets). The RTL looks like | |
2610 | (MEM (CONST ...)) even though this variable is a local `auto' | |
2611 | or a local `register' variable. In effect, what has happened | |
2612 | is that the reload pass has seen that all assignments and | |
2613 | references for one such a local variable can be replaced by | |
2614 | equivalent assignments and references to some static storage | |
2615 | variable, thereby avoiding the need for a register. In such | |
2616 | cases we're forced to lie to debuggers and tell them that | |
2617 | this variable was itself `static'. */ | |
2618 | current_sym_code = N_LCSYM; | |
2619 | letter = 'V'; | |
2620 | current_sym_addr = XEXP (XEXP (home, 0), 0); | |
2621 | } | |
2622 | else if (GET_CODE (home) == CONCAT) | |
2623 | { | |
1ae99fd2 | 2624 | tree subtype; |
2625 | ||
2626 | /* If TYPE is not a COMPLEX_TYPE (it might be a RECORD_TYPE, | |
2627 | for example), then there is no easy way to figure out | |
2628 | what SUBTYPE should be. So, we give up. */ | |
2629 | if (TREE_CODE (type) != COMPLEX_TYPE) | |
2630 | return 0; | |
2631 | ||
2632 | subtype = TREE_TYPE (type); | |
3c5d2a1c | 2633 | |
2634 | /* If the variable's storage is in two parts, | |
2635 | output each as a separate stab with a modified name. */ | |
2636 | if (WORDS_BIG_ENDIAN) | |
2637 | dbxout_symbol_location (decl, subtype, "$imag", XEXP (home, 0)); | |
946754ae | 2638 | else |
3c5d2a1c | 2639 | dbxout_symbol_location (decl, subtype, "$real", XEXP (home, 0)); |
946754ae | 2640 | |
3c5d2a1c | 2641 | dbxout_prepare_symbol (decl); |
2642 | ||
2643 | if (WORDS_BIG_ENDIAN) | |
2644 | dbxout_symbol_location (decl, subtype, "$real", XEXP (home, 1)); | |
2645 | else | |
2646 | dbxout_symbol_location (decl, subtype, "$imag", XEXP (home, 1)); | |
d0309f39 | 2647 | return 1; |
3c5d2a1c | 2648 | } |
2649 | else | |
2650 | /* Address might be a MEM, when DECL is a variable-sized object. | |
2651 | Or it might be const0_rtx, meaning previous passes | |
2652 | want us to ignore this variable. */ | |
d0309f39 | 2653 | return 0; |
3c5d2a1c | 2654 | |
2655 | /* Ok, start a symtab entry and output the variable name. */ | |
2656 | FORCE_TEXT; | |
439c05a0 | 2657 | |
2658 | #ifdef DBX_STATIC_BLOCK_START | |
3c5d2a1c | 2659 | DBX_STATIC_BLOCK_START (asmfile, current_sym_code); |
439c05a0 | 2660 | #endif |
2661 | ||
3c5d2a1c | 2662 | dbxout_symbol_name (decl, suffix, letter); |
9aa97f08 | 2663 | dbxout_type (type, 0); |
3c5d2a1c | 2664 | dbxout_finish_symbol (decl); |
439c05a0 | 2665 | |
2666 | #ifdef DBX_STATIC_BLOCK_END | |
3c5d2a1c | 2667 | DBX_STATIC_BLOCK_END (asmfile, current_sym_code); |
439c05a0 | 2668 | #endif |
d0309f39 | 2669 | return 1; |
3c5d2a1c | 2670 | } |
2671 | \f | |
2672 | /* Output the symbol name of DECL for a stabs, with suffix SUFFIX. | |
2673 | Then output LETTER to indicate the kind of location the symbol has. */ | |
2674 | ||
2675 | static void | |
8ec3a57b | 2676 | dbxout_symbol_name (tree decl, const char *suffix, int letter) |
3c5d2a1c | 2677 | { |
b82967bc | 2678 | const char *name; |
2679 | ||
cd3034ab | 2680 | if (DECL_CONTEXT (decl) |
2681 | && (TYPE_P (DECL_CONTEXT (decl)) | |
2682 | || TREE_CODE (DECL_CONTEXT (decl)) == NAMESPACE_DECL)) | |
2683 | /* One slight hitch: if this is a VAR_DECL which is a class member | |
2684 | or a namespace member, we must put out the mangled name instead of the | |
b82967bc | 2685 | DECL_NAME. Note also that static member (variable) names DO NOT begin |
2686 | with underscores in .stabs directives. */ | |
2687 | name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); | |
2688 | else | |
2689 | /* ...but if we're function-local, we don't want to include the junk | |
2690 | added by ASM_FORMAT_PRIVATE_NAME. */ | |
2691 | name = IDENTIFIER_POINTER (DECL_NAME (decl)); | |
2692 | ||
3c5d2a1c | 2693 | if (name == 0) |
2694 | name = "(anon)"; | |
17d8e118 | 2695 | fprintf (asmfile, "%s\"%s%s:", ASM_STABS_OP, name, |
3c5d2a1c | 2696 | (suffix ? suffix : "")); |
2697 | ||
d4b87fe5 | 2698 | if (letter) |
2699 | putc (letter, asmfile); | |
946754ae | 2700 | } |
2701 | ||
2702 | static void | |
8ec3a57b | 2703 | dbxout_prepare_symbol (tree decl ATTRIBUTE_UNUSED) |
946754ae | 2704 | { |
2705 | #ifdef WINNING_GDB | |
346064d9 | 2706 | const char *filename = DECL_SOURCE_FILE (decl); |
946754ae | 2707 | |
2708 | dbxout_source_file (asmfile, filename); | |
2709 | #endif | |
d6d30f68 | 2710 | |
2711 | /* Initialize variables used to communicate each symbol's debug | |
2712 | information to dbxout_finish_symbol with zeroes. */ | |
2713 | ||
2714 | /* Cast avoids warning in old compilers. */ | |
2715 | current_sym_code = (STAB_CODE_TYPE) 0; | |
2716 | current_sym_value = 0; | |
2717 | current_sym_addr = 0; | |
946754ae | 2718 | } |
2719 | ||
2720 | static void | |
8ec3a57b | 2721 | dbxout_finish_symbol (tree sym) |
946754ae | 2722 | { |
439c05a0 | 2723 | #ifdef DBX_FINISH_SYMBOL |
2724 | DBX_FINISH_SYMBOL (sym); | |
2725 | #else | |
946754ae | 2726 | int line = 0; |
7e9059b9 | 2727 | if (use_gnu_debug_info_extensions && sym != 0) |
346064d9 | 2728 | line = DECL_SOURCE_LINE (sym); |
439c05a0 | 2729 | |
946754ae | 2730 | fprintf (asmfile, "\",%d,0,%d,", current_sym_code, line); |
2731 | if (current_sym_addr) | |
2732 | output_addr_const (asmfile, current_sym_addr); | |
2733 | else | |
2734 | fprintf (asmfile, "%d", current_sym_value); | |
2735 | putc ('\n', asmfile); | |
439c05a0 | 2736 | #endif |
946754ae | 2737 | } |
2738 | ||
6ef828f9 | 2739 | /* Output definitions of all the decls in a chain. Return nonzero if |
d0309f39 | 2740 | anything was output */ |
946754ae | 2741 | |
d0309f39 | 2742 | int |
8ec3a57b | 2743 | dbxout_syms (tree syms) |
946754ae | 2744 | { |
d0309f39 | 2745 | int result = 0; |
946754ae | 2746 | while (syms) |
2747 | { | |
d0309f39 | 2748 | result += dbxout_symbol (syms, 1); |
946754ae | 2749 | syms = TREE_CHAIN (syms); |
2750 | } | |
d0309f39 | 2751 | return result; |
946754ae | 2752 | } |
2753 | \f | |
2754 | /* The following two functions output definitions of function parameters. | |
2755 | Each parameter gets a definition locating it in the parameter list. | |
2756 | Each parameter that is a register variable gets a second definition | |
2757 | locating it in the register. | |
2758 | ||
2759 | Printing or argument lists in gdb uses the definitions that | |
2760 | locate in the parameter list. But reference to the variable in | |
2761 | expressions uses preferentially the definition as a register. */ | |
2762 | ||
2763 | /* Output definitions, referring to storage in the parmlist, | |
2764 | of all the parms in PARMS, which is a chain of PARM_DECL nodes. */ | |
2765 | ||
439c05a0 | 2766 | void |
8ec3a57b | 2767 | dbxout_parms (tree parms) |
946754ae | 2768 | { |
262444a6 | 2769 | ++debug_nesting; |
2770 | ||
51cec339 | 2771 | emit_pending_bincls_if_required (); |
2772 | ||
946754ae | 2773 | for (; parms; parms = TREE_CHAIN (parms)) |
043dbdf4 | 2774 | if (DECL_NAME (parms) |
2775 | && TREE_TYPE (parms) != error_mark_node | |
2776 | && DECL_RTL_SET_P (parms) | |
2777 | && DECL_INCOMING_RTL (parms)) | |
946754ae | 2778 | { |
2779 | dbxout_prepare_symbol (parms); | |
2780 | ||
2781 | /* Perform any necessary register eliminations on the parameter's rtl, | |
2782 | so that the debugging output will be accurate. */ | |
2783 | DECL_INCOMING_RTL (parms) | |
6182a80f | 2784 | = eliminate_regs (DECL_INCOMING_RTL (parms), 0, NULL_RTX); |
0e8e37b2 | 2785 | SET_DECL_RTL (parms, eliminate_regs (DECL_RTL (parms), 0, NULL_RTX)); |
946754ae | 2786 | #ifdef LEAF_REG_REMAP |
b3b67b7c | 2787 | if (current_function_uses_only_leaf_regs) |
946754ae | 2788 | { |
2789 | leaf_renumber_regs_insn (DECL_INCOMING_RTL (parms)); | |
2790 | leaf_renumber_regs_insn (DECL_RTL (parms)); | |
2791 | } | |
2792 | #endif | |
2793 | ||
2794 | if (PARM_PASSED_IN_MEMORY (parms)) | |
2795 | { | |
2796 | rtx addr = XEXP (DECL_INCOMING_RTL (parms), 0); | |
2797 | ||
2798 | /* ??? Here we assume that the parm address is indexed | |
2799 | off the frame pointer or arg pointer. | |
2800 | If that is not true, we produce meaningless results, | |
2801 | but do not crash. */ | |
2802 | if (GET_CODE (addr) == PLUS | |
2803 | && GET_CODE (XEXP (addr, 1)) == CONST_INT) | |
2804 | current_sym_value = INTVAL (XEXP (addr, 1)); | |
2805 | else | |
2806 | current_sym_value = 0; | |
2807 | ||
2808 | current_sym_code = N_PSYM; | |
2809 | current_sym_addr = 0; | |
2810 | ||
2811 | FORCE_TEXT; | |
2812 | if (DECL_NAME (parms)) | |
2813 | { | |
2814 | current_sym_nchars = 2 + IDENTIFIER_LENGTH (DECL_NAME (parms)); | |
2815 | ||
17d8e118 | 2816 | fprintf (asmfile, "%s\"%s:%c", ASM_STABS_OP, |
98123cec | 2817 | IDENTIFIER_POINTER (DECL_NAME (parms)), |
2818 | DBX_MEMPARM_STABS_LETTER); | |
946754ae | 2819 | } |
2820 | else | |
2821 | { | |
2822 | current_sym_nchars = 8; | |
17d8e118 | 2823 | fprintf (asmfile, "%s\"(anon):%c", ASM_STABS_OP, |
98123cec | 2824 | DBX_MEMPARM_STABS_LETTER); |
946754ae | 2825 | } |
2826 | ||
1d7caf49 | 2827 | /* It is quite tempting to use: |
1eefe280 | 2828 | |
9aa97f08 | 2829 | dbxout_type (TREE_TYPE (parms), 0); |
1d7caf49 | 2830 | |
2831 | as the next statement, rather than using DECL_ARG_TYPE(), so | |
2832 | that gcc reports the actual type of the parameter, rather | |
2833 | than the promoted type. This certainly makes GDB's life | |
2834 | easier, at least for some ports. The change is a bad idea | |
2835 | however, since GDB expects to be able access the type without | |
2836 | performing any conversions. So for example, if we were | |
2837 | passing a float to an unprototyped function, gcc will store a | |
2838 | double on the stack, but if we emit a stab saying the type is a | |
2839 | float, then gdb will only read in a single value, and this will | |
dae39efc | 2840 | produce an erroneous value. */ |
1eefe280 | 2841 | dbxout_type (DECL_ARG_TYPE (parms), 0); |
946754ae | 2842 | current_sym_value = DEBUGGER_ARG_OFFSET (current_sym_value, addr); |
2843 | dbxout_finish_symbol (parms); | |
2844 | } | |
2845 | else if (GET_CODE (DECL_RTL (parms)) == REG) | |
2846 | { | |
2847 | rtx best_rtl; | |
439c05a0 | 2848 | char regparm_letter; |
52eab9d6 | 2849 | tree parm_type; |
946754ae | 2850 | /* Parm passed in registers and lives in registers or nowhere. */ |
2851 | ||
439c05a0 | 2852 | current_sym_code = DBX_REGPARM_STABS_CODE; |
2853 | regparm_letter = DBX_REGPARM_STABS_LETTER; | |
946754ae | 2854 | current_sym_addr = 0; |
2855 | ||
2856 | /* If parm lives in a register, use that register; | |
2857 | pretend the parm was passed there. It would be more consistent | |
2858 | to describe the register where the parm was passed, | |
52eab9d6 | 2859 | but in practice that register usually holds something else. |
2860 | ||
2861 | If we use DECL_RTL, then we must use the declared type of | |
2862 | the variable, not the type that it arrived in. */ | |
02e7a332 | 2863 | if (REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER) |
52eab9d6 | 2864 | { |
2865 | best_rtl = DECL_RTL (parms); | |
2866 | parm_type = TREE_TYPE (parms); | |
2867 | } | |
147cb190 | 2868 | /* If the parm lives nowhere, use the register where it was |
2869 | passed. It is also better to use the declared type here. */ | |
946754ae | 2870 | else |
52eab9d6 | 2871 | { |
2872 | best_rtl = DECL_INCOMING_RTL (parms); | |
147cb190 | 2873 | parm_type = TREE_TYPE (parms); |
52eab9d6 | 2874 | } |
946754ae | 2875 | current_sym_value = DBX_REGISTER_NUMBER (REGNO (best_rtl)); |
2876 | ||
2877 | FORCE_TEXT; | |
2878 | if (DECL_NAME (parms)) | |
2879 | { | |
2880 | current_sym_nchars = 2 + IDENTIFIER_LENGTH (DECL_NAME (parms)); | |
17d8e118 | 2881 | fprintf (asmfile, "%s\"%s:%c", ASM_STABS_OP, |
439c05a0 | 2882 | IDENTIFIER_POINTER (DECL_NAME (parms)), |
2883 | regparm_letter); | |
946754ae | 2884 | } |
2885 | else | |
2886 | { | |
2887 | current_sym_nchars = 8; | |
17d8e118 | 2888 | fprintf (asmfile, "%s\"(anon):%c", ASM_STABS_OP, |
439c05a0 | 2889 | regparm_letter); |
946754ae | 2890 | } |
2891 | ||
9aa97f08 | 2892 | dbxout_type (parm_type, 0); |
946754ae | 2893 | dbxout_finish_symbol (parms); |
2894 | } | |
f10caba4 | 2895 | else if (GET_CODE (DECL_RTL (parms)) == MEM |
27f4b5b8 | 2896 | && GET_CODE (XEXP (DECL_RTL (parms), 0)) == REG |
cb8b8ba0 | 2897 | && REGNO (XEXP (DECL_RTL (parms), 0)) != HARD_FRAME_POINTER_REGNUM |
2898 | && REGNO (XEXP (DECL_RTL (parms), 0)) != STACK_POINTER_REGNUM | |
d13c643a | 2899 | #if ARG_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM |
cb8b8ba0 | 2900 | && REGNO (XEXP (DECL_RTL (parms), 0)) != ARG_POINTER_REGNUM |
2901 | #endif | |
2902 | ) | |
f10caba4 | 2903 | { |
2904 | /* Parm was passed via invisible reference. | |
2905 | That is, its address was passed in a register. | |
2906 | Output it as if it lived in that register. | |
2907 | The debugger will know from the type | |
2908 | that it was actually passed by invisible reference. */ | |
2909 | ||
2910 | char regparm_letter; | |
2911 | /* Parm passed in registers and lives in registers or nowhere. */ | |
2912 | ||
2913 | current_sym_code = DBX_REGPARM_STABS_CODE; | |
84f564cc | 2914 | if (use_gnu_debug_info_extensions) |
2915 | regparm_letter = GDB_INV_REF_REGPARM_STABS_LETTER; | |
2916 | else | |
2917 | regparm_letter = DBX_REGPARM_STABS_LETTER; | |
f10caba4 | 2918 | |
3bf2cac3 | 2919 | /* DECL_RTL looks like (MEM (REG...). Get the register number. |
2920 | If it is an unallocated pseudo-reg, then use the register where | |
2921 | it was passed instead. */ | |
02e7a332 | 2922 | if (REGNO (XEXP (DECL_RTL (parms), 0)) < FIRST_PSEUDO_REGISTER) |
3bf2cac3 | 2923 | current_sym_value = REGNO (XEXP (DECL_RTL (parms), 0)); |
2924 | else | |
2925 | current_sym_value = REGNO (DECL_INCOMING_RTL (parms)); | |
2926 | ||
f10caba4 | 2927 | current_sym_addr = 0; |
2928 | ||
2929 | FORCE_TEXT; | |
2930 | if (DECL_NAME (parms)) | |
2931 | { | |
d4b87fe5 | 2932 | current_sym_nchars |
2933 | = 2 + strlen (IDENTIFIER_POINTER (DECL_NAME (parms))); | |
f10caba4 | 2934 | |
17d8e118 | 2935 | fprintf (asmfile, "%s\"%s:%c", ASM_STABS_OP, |
f10caba4 | 2936 | IDENTIFIER_POINTER (DECL_NAME (parms)), |
84f564cc | 2937 | regparm_letter); |
f10caba4 | 2938 | } |
2939 | else | |
2940 | { | |
2941 | current_sym_nchars = 8; | |
17d8e118 | 2942 | fprintf (asmfile, "%s\"(anon):%c", ASM_STABS_OP, |
84f564cc | 2943 | regparm_letter); |
f10caba4 | 2944 | } |
2945 | ||
9aa97f08 | 2946 | dbxout_type (TREE_TYPE (parms), 0); |
f10caba4 | 2947 | dbxout_finish_symbol (parms); |
2948 | } | |
8c03ddcf | 2949 | else if (GET_CODE (DECL_RTL (parms)) == MEM |
2950 | && GET_CODE (XEXP (DECL_RTL (parms), 0)) == MEM) | |
2951 | { | |
2952 | /* Parm was passed via invisible reference, with the reference | |
2953 | living on the stack. DECL_RTL looks like | |
eed9d2f3 | 2954 | (MEM (MEM (PLUS (REG ...) (CONST_INT ...)))) or it |
2955 | could look like (MEM (MEM (REG))). */ | |
0d95286f | 2956 | const char *const decl_name = (DECL_NAME (parms) |
8c03ddcf | 2957 | ? IDENTIFIER_POINTER (DECL_NAME (parms)) |
2958 | : "(anon)"); | |
1eefe280 | 2959 | if (GET_CODE (XEXP (XEXP (DECL_RTL (parms), 0), 0)) == REG) |
2960 | current_sym_value = 0; | |
eed9d2f3 | 2961 | else |
2962 | current_sym_value | |
2963 | = INTVAL (XEXP (XEXP (XEXP (DECL_RTL (parms), 0), 0), 1)); | |
8c03ddcf | 2964 | current_sym_addr = 0; |
b109f4ea | 2965 | current_sym_code = N_PSYM; |
1eefe280 | 2966 | |
8c03ddcf | 2967 | FORCE_TEXT; |
2968 | fprintf (asmfile, "%s\"%s:v", ASM_STABS_OP, decl_name); | |
08ba4893 | 2969 | |
2970 | current_sym_value | |
2971 | = DEBUGGER_ARG_OFFSET (current_sym_value, | |
2972 | XEXP (XEXP (DECL_RTL (parms), 0), 0)); | |
9aa97f08 | 2973 | dbxout_type (TREE_TYPE (parms), 0); |
8c03ddcf | 2974 | dbxout_finish_symbol (parms); |
2975 | } | |
946754ae | 2976 | else if (GET_CODE (DECL_RTL (parms)) == MEM |
4394fe52 | 2977 | && XEXP (DECL_RTL (parms), 0) != const0_rtx |
2978 | /* ??? A constant address for a parm can happen | |
2979 | when the reg it lives in is equiv to a constant in memory. | |
2980 | Should make this not happen, after 2.4. */ | |
2981 | && ! CONSTANT_P (XEXP (DECL_RTL (parms), 0))) | |
946754ae | 2982 | { |
2983 | /* Parm was passed in registers but lives on the stack. */ | |
2984 | ||
2985 | current_sym_code = N_PSYM; | |
2986 | /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))), | |
2987 | in which case we want the value of that CONST_INT, | |
8c03ddcf | 2988 | or (MEM (REG ...)), |
946754ae | 2989 | in which case we use a value of zero. */ |
155b05dc | 2990 | if (GET_CODE (XEXP (DECL_RTL (parms), 0)) == REG) |
946754ae | 2991 | current_sym_value = 0; |
2992 | else | |
155b05dc | 2993 | current_sym_value |
2994 | = INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1)); | |
2995 | ||
946754ae | 2996 | current_sym_addr = 0; |
2997 | ||
c9452941 | 2998 | /* Make a big endian correction if the mode of the type of the |
2999 | parameter is not the same as the mode of the rtl. */ | |
3000 | if (BYTES_BIG_ENDIAN | |
3001 | && TYPE_MODE (TREE_TYPE (parms)) != GET_MODE (DECL_RTL (parms)) | |
3002 | && GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (parms))) < UNITS_PER_WORD) | |
3003 | { | |
1eefe280 | 3004 | current_sym_value += |
869621c0 | 3005 | GET_MODE_SIZE (GET_MODE (DECL_RTL (parms))) |
3006 | - GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (parms))); | |
c9452941 | 3007 | } |
3008 | ||
946754ae | 3009 | FORCE_TEXT; |
3010 | if (DECL_NAME (parms)) | |
3011 | { | |
155b05dc | 3012 | current_sym_nchars |
3013 | = 2 + strlen (IDENTIFIER_POINTER (DECL_NAME (parms))); | |
946754ae | 3014 | |
17d8e118 | 3015 | fprintf (asmfile, "%s\"%s:%c", ASM_STABS_OP, |
98123cec | 3016 | IDENTIFIER_POINTER (DECL_NAME (parms)), |
3017 | DBX_MEMPARM_STABS_LETTER); | |
946754ae | 3018 | } |
3019 | else | |
3020 | { | |
3021 | current_sym_nchars = 8; | |
17d8e118 | 3022 | fprintf (asmfile, "%s\"(anon):%c", ASM_STABS_OP, |
98123cec | 3023 | DBX_MEMPARM_STABS_LETTER); |
946754ae | 3024 | } |
3025 | ||
3026 | current_sym_value | |
3027 | = DEBUGGER_ARG_OFFSET (current_sym_value, | |
3028 | XEXP (DECL_RTL (parms), 0)); | |
9aa97f08 | 3029 | dbxout_type (TREE_TYPE (parms), 0); |
946754ae | 3030 | dbxout_finish_symbol (parms); |
3031 | } | |
3032 | } | |
262444a6 | 3033 | DBXOUT_DECR_NESTING; |
946754ae | 3034 | } |
3035 | ||
3036 | /* Output definitions for the places where parms live during the function, | |
3037 | when different from where they were passed, when the parms were passed | |
3038 | in memory. | |
3039 | ||
3040 | It is not useful to do this for parms passed in registers | |
3041 | that live during the function in different registers, because it is | |
3042 | impossible to look in the passed register for the passed value, | |
3043 | so we use the within-the-function register to begin with. | |
3044 | ||
3045 | PARMS is a chain of PARM_DECL nodes. */ | |
3046 | ||
439c05a0 | 3047 | void |
8ec3a57b | 3048 | dbxout_reg_parms (tree parms) |
946754ae | 3049 | { |
262444a6 | 3050 | ++debug_nesting; |
3051 | ||
946754ae | 3052 | for (; parms; parms = TREE_CHAIN (parms)) |
ae399944 | 3053 | if (DECL_NAME (parms) && PARM_PASSED_IN_MEMORY (parms)) |
946754ae | 3054 | { |
3055 | dbxout_prepare_symbol (parms); | |
3056 | ||
3057 | /* Report parms that live in registers during the function | |
3058 | but were passed in memory. */ | |
3059 | if (GET_CODE (DECL_RTL (parms)) == REG | |
ae399944 | 3060 | && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER) |
3c5d2a1c | 3061 | dbxout_symbol_location (parms, TREE_TYPE (parms), |
3062 | 0, DECL_RTL (parms)); | |
ae399944 | 3063 | else if (GET_CODE (DECL_RTL (parms)) == CONCAT) |
3c5d2a1c | 3064 | dbxout_symbol_location (parms, TREE_TYPE (parms), |
3065 | 0, DECL_RTL (parms)); | |
946754ae | 3066 | /* Report parms that live in memory but not where they were passed. */ |
3067 | else if (GET_CODE (DECL_RTL (parms)) == MEM | |
946754ae | 3068 | && ! rtx_equal_p (DECL_RTL (parms), DECL_INCOMING_RTL (parms))) |
ae399944 | 3069 | dbxout_symbol_location (parms, TREE_TYPE (parms), |
3070 | 0, DECL_RTL (parms)); | |
946754ae | 3071 | } |
262444a6 | 3072 | DBXOUT_DECR_NESTING; |
946754ae | 3073 | } |
3074 | \f | |
3075 | /* Given a chain of ..._TYPE nodes (as come in a parameter list), | |
3076 | output definitions of those names, in raw form */ | |
3077 | ||
b29760a8 | 3078 | static void |
8ec3a57b | 3079 | dbxout_args (tree args) |
946754ae | 3080 | { |
3081 | while (args) | |
3082 | { | |
3083 | putc (',', asmfile); | |
9aa97f08 | 3084 | dbxout_type (TREE_VALUE (args), 0); |
946754ae | 3085 | CHARS (1); |
3086 | args = TREE_CHAIN (args); | |
3087 | } | |
3088 | } | |
3089 | \f | |
946754ae | 3090 | /* Output everything about a symbol block (a BLOCK node |
3091 | that represents a scope level), | |
3092 | including recursive output of contained blocks. | |
3093 | ||
3094 | BLOCK is the BLOCK node. | |
3095 | DEPTH is its depth within containing symbol blocks. | |
3096 | ARGS is usually zero; but for the outermost block of the | |
3097 | body of a function, it is a chain of PARM_DECLs for the function parameters. | |
3098 | We output definitions of all the register parms | |
3099 | as if they were local variables of that block. | |
3100 | ||
3101 | If -g1 was used, we count blocks just the same, but output nothing | |
3102 | except for the outermost block. | |
3103 | ||
3104 | Actually, BLOCK may be several blocks chained together. | |
3105 | We handle them all in sequence. */ | |
3106 | ||
3107 | static void | |
8ec3a57b | 3108 | dbxout_block (tree block, int depth, tree args) |
946754ae | 3109 | { |
12fc9462 | 3110 | int blocknum = -1; |
d0309f39 | 3111 | |
3112 | #if DBX_BLOCKS_FUNCTION_RELATIVE | |
1eefe280 | 3113 | const char *begin_label; |
d0309f39 | 3114 | if (current_function_func_begin_label != NULL_TREE) |
3115 | begin_label = IDENTIFIER_POINTER (current_function_func_begin_label); | |
3116 | else | |
3117 | begin_label = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0); | |
3118 | #endif | |
946754ae | 3119 | |
3120 | while (block) | |
3121 | { | |
3122 | /* Ignore blocks never expanded or otherwise marked as real. */ | |
5846cb0f | 3123 | if (TREE_USED (block) && TREE_ASM_WRITTEN (block)) |
946754ae | 3124 | { |
a1d829f8 | 3125 | int did_output; |
3126 | ||
d0309f39 | 3127 | /* In dbx format, the syms of a block come before the N_LBRAC. |
6312a35e | 3128 | If nothing is output, we don't need the N_LBRAC, either. */ |
a1d829f8 | 3129 | did_output = 0; |
946754ae | 3130 | if (debug_info_level != DINFO_LEVEL_TERSE || depth == 0) |
a1d829f8 | 3131 | did_output = dbxout_syms (BLOCK_VARS (block)); |
946754ae | 3132 | if (args) |
3133 | dbxout_reg_parms (args); | |
946754ae | 3134 | |
3135 | /* Now output an N_LBRAC symbol to represent the beginning of | |
3136 | the block. Use the block's tree-walk order to generate | |
3137 | the assembler symbols LBBn and LBEn | |
3138 | that final will define around the code in this block. */ | |
a1d829f8 | 3139 | if (depth > 0 && did_output) |
946754ae | 3140 | { |
3141 | char buf[20]; | |
5846cb0f | 3142 | blocknum = BLOCK_NUMBER (block); |
946754ae | 3143 | ASM_GENERATE_INTERNAL_LABEL (buf, "LBB", blocknum); |
3144 | ||
3145 | if (BLOCK_HANDLER_BLOCK (block)) | |
3146 | { | |
3147 | /* A catch block. Must precede N_LBRAC. */ | |
3148 | tree decl = BLOCK_VARS (block); | |
3149 | while (decl) | |
3150 | { | |
17d8e118 | 3151 | fprintf (asmfile, "%s\"%s:C1\",%d,0,0,", ASM_STABS_OP, |
946754ae | 3152 | IDENTIFIER_POINTER (DECL_NAME (decl)), N_CATCH); |
3153 | assemble_name (asmfile, buf); | |
3154 | fprintf (asmfile, "\n"); | |
946754ae | 3155 | decl = TREE_CHAIN (decl); |
3156 | } | |
3157 | } | |
3158 | ||
98123cec | 3159 | #ifdef DBX_OUTPUT_LBRAC |
3160 | DBX_OUTPUT_LBRAC (asmfile, buf); | |
3161 | #else | |
17d8e118 | 3162 | fprintf (asmfile, "%s%d,0,0,", ASM_STABN_OP, N_LBRAC); |
946754ae | 3163 | assemble_name (asmfile, buf); |
ec6884ea | 3164 | #if DBX_BLOCKS_FUNCTION_RELATIVE |
d4b87fe5 | 3165 | putc ('-', asmfile); |
d0309f39 | 3166 | assemble_name (asmfile, begin_label); |
ec6884ea | 3167 | #endif |
946754ae | 3168 | fprintf (asmfile, "\n"); |
98123cec | 3169 | #endif |
946754ae | 3170 | } |
946754ae | 3171 | |
946754ae | 3172 | /* Output the subblocks. */ |
4303221c | 3173 | dbxout_block (BLOCK_SUBBLOCKS (block), depth + 1, NULL_TREE); |
946754ae | 3174 | |
3175 | /* Refer to the marker for the end of the block. */ | |
a1d829f8 | 3176 | if (depth > 0 && did_output) |
946754ae | 3177 | { |
3178 | char buf[20]; | |
3179 | ASM_GENERATE_INTERNAL_LABEL (buf, "LBE", blocknum); | |
98123cec | 3180 | #ifdef DBX_OUTPUT_RBRAC |
3181 | DBX_OUTPUT_RBRAC (asmfile, buf); | |
3182 | #else | |
17d8e118 | 3183 | fprintf (asmfile, "%s%d,0,0,", ASM_STABN_OP, N_RBRAC); |
946754ae | 3184 | assemble_name (asmfile, buf); |
ec6884ea | 3185 | #if DBX_BLOCKS_FUNCTION_RELATIVE |
d4b87fe5 | 3186 | putc ('-', asmfile); |
d0309f39 | 3187 | assemble_name (asmfile, begin_label); |
ec6884ea | 3188 | #endif |
946754ae | 3189 | fprintf (asmfile, "\n"); |
98123cec | 3190 | #endif |
946754ae | 3191 | } |
3192 | } | |
3193 | block = BLOCK_CHAIN (block); | |
3194 | } | |
3195 | } | |
3196 | ||
3197 | /* Output the information about a function and its arguments and result. | |
3198 | Usually this follows the function's code, | |
3199 | but on some systems, it comes before. */ | |
3200 | ||
0c87a39e | 3201 | #if defined (DBX_DEBUGGING_INFO) |
946754ae | 3202 | static void |
8ec3a57b | 3203 | dbxout_begin_function (tree decl) |
946754ae | 3204 | { |
262444a6 | 3205 | int saved_tree_used1 = TREE_USED (decl); |
3206 | TREE_USED (decl) = 1; | |
3207 | if (DECL_NAME (DECL_RESULT (decl)) != 0) | |
3208 | { | |
8ec3a57b | 3209 | int saved_tree_used2 = TREE_USED (DECL_RESULT (decl)); |
262444a6 | 3210 | TREE_USED (DECL_RESULT (decl)) = 1; |
3211 | dbxout_symbol (decl, 0); | |
3212 | TREE_USED (DECL_RESULT (decl)) = saved_tree_used2; | |
3213 | } | |
3214 | else | |
3215 | dbxout_symbol (decl, 0); | |
3216 | TREE_USED (decl) = saved_tree_used1; | |
3217 | ||
946754ae | 3218 | dbxout_parms (DECL_ARGUMENTS (decl)); |
3219 | if (DECL_NAME (DECL_RESULT (decl)) != 0) | |
3220 | dbxout_symbol (DECL_RESULT (decl), 1); | |
3221 | } | |
0c87a39e | 3222 | #endif /* DBX_DEBUGGING_INFO */ |
946754ae | 3223 | |
02da6382 | 3224 | #endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */ |
573aba85 | 3225 | |
3226 | #include "gt-dbxout.h" |