kernel - Fix some rare pmap races in i386 and x86_64.
[dragonfly.git] / contrib / gcc-4.1 / gcc / dbxout.c
blob9ffced04c9bbd85d4f712538e12dedf0c5d56e08
1 /* Output dbx-format symbol table information from GNU compiler.
2 Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
5 This file is part of GCC.
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.
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.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to the Free
19 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
20 02110-1301, USA. */
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.
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.
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.
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".
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'.
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.
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.
66 If DEBUG_SYMS_TEXT is defined, all debugging symbols must be
67 output while in the text section.
69 For more on data type definitions, see `dbxout_type'. */
71 #include "config.h"
72 #include "system.h"
73 #include "coretypes.h"
74 #include "tm.h"
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"
82 #include "output.h"
83 #include "dbxout.h"
84 #include "toplev.h"
85 #include "tm_p.h"
86 #include "ggc.h"
87 #include "debug.h"
88 #include "function.h"
89 #include "target.h"
90 #include "langhooks.h"
91 #include "obstack.h"
92 #include "expr.h"
94 #ifdef XCOFF_DEBUGGING_INFO
95 #include "xcoffout.h"
96 #endif
98 #define DBXOUT_DECR_NESTING \
99 if (--debug_nesting == 0 && symbol_queue_index > 0) \
100 { emit_pending_bincls_if_required (); debug_flush_symbol_queue (); }
102 #define DBXOUT_DECR_NESTING_AND_RETURN(x) \
103 do {--debug_nesting; return (x);} while (0)
105 #ifndef ASM_STABS_OP
106 # ifdef XCOFF_DEBUGGING_INFO
107 # define ASM_STABS_OP "\t.stabx\t"
108 # else
109 # define ASM_STABS_OP "\t.stabs\t"
110 # endif
111 #endif
113 #ifndef ASM_STABN_OP
114 #define ASM_STABN_OP "\t.stabn\t"
115 #endif
117 #ifndef ASM_STABD_OP
118 #define ASM_STABD_OP "\t.stabd\t"
119 #endif
121 #ifndef DBX_TYPE_DECL_STABS_CODE
122 #define DBX_TYPE_DECL_STABS_CODE N_LSYM
123 #endif
125 #ifndef DBX_STATIC_CONST_VAR_CODE
126 #define DBX_STATIC_CONST_VAR_CODE N_FUN
127 #endif
129 #ifndef DBX_REGPARM_STABS_CODE
130 #define DBX_REGPARM_STABS_CODE N_RSYM
131 #endif
133 #ifndef DBX_REGPARM_STABS_LETTER
134 #define DBX_REGPARM_STABS_LETTER 'P'
135 #endif
137 #ifndef NO_DBX_FUNCTION_END
138 #define NO_DBX_FUNCTION_END 0
139 #endif
141 #ifndef NO_DBX_BNSYM_ENSYM
142 #define NO_DBX_BNSYM_ENSYM 0
143 #endif
145 #ifndef NO_DBX_MAIN_SOURCE_DIRECTORY
146 #define NO_DBX_MAIN_SOURCE_DIRECTORY 0
147 #endif
149 #ifndef DBX_BLOCKS_FUNCTION_RELATIVE
150 #define DBX_BLOCKS_FUNCTION_RELATIVE 0
151 #endif
153 #ifndef DBX_LINES_FUNCTION_RELATIVE
154 #define DBX_LINES_FUNCTION_RELATIVE 0
155 #endif
157 #ifndef DBX_CONTIN_LENGTH
158 #define DBX_CONTIN_LENGTH 80
159 #endif
161 #ifndef DBX_CONTIN_CHAR
162 #define DBX_CONTIN_CHAR '\\'
163 #endif
165 enum typestatus {TYPE_UNSEEN, TYPE_XREF, TYPE_DEFINED};
167 /* Structure recording information about a C data type.
168 The status element says whether we have yet output
169 the definition of the type. TYPE_XREF says we have
170 output it as a cross-reference only.
171 The file_number and type_number elements are used if DBX_USE_BINCL
172 is defined. */
174 struct typeinfo GTY(())
176 enum typestatus status;
177 int file_number;
178 int type_number;
181 /* Vector recording information about C data types.
182 When we first notice a data type (a tree node),
183 we assign it a number using next_type_number.
184 That is its index in this vector. */
186 static GTY ((length ("typevec_len"))) struct typeinfo *typevec;
188 /* Number of elements of space allocated in `typevec'. */
190 static GTY(()) int typevec_len;
192 /* In dbx output, each type gets a unique number.
193 This is the number for the next type output.
194 The number, once assigned, is in the TYPE_SYMTAB_ADDRESS field. */
196 static GTY(()) int next_type_number;
198 /* The C front end may call dbxout_symbol before dbxout_init runs.
199 We save all such decls in this list and output them when we get
200 to dbxout_init. */
202 static GTY(()) tree preinit_symbols;
204 enum binclstatus {BINCL_NOT_REQUIRED, BINCL_PENDING, BINCL_PROCESSED};
206 /* When using N_BINCL in dbx output, each type number is actually a
207 pair of the file number and the type number within the file.
208 This is a stack of input files. */
210 struct dbx_file
212 struct dbx_file *next;
213 int file_number;
214 int next_type_number;
215 enum binclstatus bincl_status; /* Keep track of lazy bincl. */
216 const char *pending_bincl_name; /* Name of bincl. */
217 struct dbx_file *prev; /* Chain to traverse all pending bincls. */
220 /* This is the top of the stack.
222 This is not saved for PCH, because restoring a PCH should not change it.
223 next_file_number does have to be saved, because the PCH may use some
224 file numbers; however, just before restoring a PCH, next_file_number
225 should always be 0 because we should not have needed any file numbers
226 yet. */
228 #if (defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)) \
229 && defined (DBX_USE_BINCL)
230 static struct dbx_file *current_file;
231 #endif
233 /* This is the next file number to use. */
235 static GTY(()) int next_file_number;
237 /* A counter for dbxout_function_end. */
239 static GTY(()) int scope_labelno;
241 /* A counter for dbxout_source_line. */
243 static GTY(()) int dbxout_source_line_counter;
245 /* Number for the next N_SOL filename stabs label. The number 0 is reserved
246 for the N_SO filename stabs label. */
248 static GTY(()) int source_label_number = 1;
250 /* Last source file name mentioned in a NOTE insn. */
252 static GTY(()) const char *lastfile;
254 /* Used by PCH machinery to detect if 'lastfile' should be reset to
255 base_input_file. */
256 static GTY(()) int lastfile_is_base;
258 /* Typical USG systems don't have stab.h, and they also have
259 no use for DBX-format debugging info. */
261 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
263 #ifdef DBX_USE_BINCL
264 /* If zero then there is no pending BINCL. */
265 static int pending_bincls = 0;
266 #endif
268 /* The original input file name. */
269 static const char *base_input_file;
271 #ifdef DEBUG_SYMS_TEXT
272 #define FORCE_TEXT current_function_section (current_function_decl);
273 #else
274 #define FORCE_TEXT
275 #endif
277 #include "gstab.h"
279 #define STAB_CODE_TYPE enum __stab_debug_code
281 /* 1 if PARM is passed to this function in memory. */
283 #define PARM_PASSED_IN_MEMORY(PARM) \
284 (MEM_P (DECL_INCOMING_RTL (PARM)))
286 /* A C expression for the integer offset value of an automatic variable
287 (N_LSYM) having address X (an RTX). */
288 #ifndef DEBUGGER_AUTO_OFFSET
289 #define DEBUGGER_AUTO_OFFSET(X) \
290 (GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0)
291 #endif
293 /* A C expression for the integer offset value of an argument (N_PSYM)
294 having address X (an RTX). The nominal offset is OFFSET. */
295 #ifndef DEBUGGER_ARG_OFFSET
296 #define DEBUGGER_ARG_OFFSET(OFFSET, X) (OFFSET)
297 #endif
299 /* This obstack holds the stab string currently being constructed. We
300 build it up here, then write it out, so we can split long lines up
301 properly (see dbxout_finish_complex_stabs). */
302 static struct obstack stabstr_ob;
303 static size_t stabstr_last_contin_point;
305 #ifdef DBX_USE_BINCL
306 static void emit_bincl_stab (const char *c);
307 static void emit_pending_bincls (void);
308 #endif
309 static inline void emit_pending_bincls_if_required (void);
311 static void dbxout_init (const char *);
313 static void dbxout_finish (const char *);
314 static void dbxout_start_source_file (unsigned, const char *);
315 static void dbxout_end_source_file (unsigned);
316 static void dbxout_typedefs (tree);
317 static void dbxout_type_index (tree);
318 static void dbxout_args (tree);
319 static void dbxout_type_fields (tree);
320 static void dbxout_type_method_1 (tree);
321 static void dbxout_type_methods (tree);
322 static void dbxout_range_type (tree);
323 static void dbxout_type (tree, int);
324 static bool print_int_cst_bounds_in_octal_p (tree);
325 static void dbxout_type_name (tree);
326 static void dbxout_class_name_qualifiers (tree);
327 static int dbxout_symbol_location (tree, tree, const char *, rtx);
328 static void dbxout_symbol_name (tree, const char *, int);
329 static void dbxout_block (tree, int, tree);
330 static void dbxout_global_decl (tree);
331 static void dbxout_type_decl (tree, int);
332 static void dbxout_handle_pch (unsigned);
334 /* The debug hooks structure. */
335 #if defined (DBX_DEBUGGING_INFO)
337 static void dbxout_source_line (unsigned int, const char *);
338 static void dbxout_begin_prologue (unsigned int, const char *);
339 static void dbxout_source_file (const char *);
340 static void dbxout_function_end (tree);
341 static void dbxout_begin_function (tree);
342 static void dbxout_begin_block (unsigned, unsigned);
343 static void dbxout_end_block (unsigned, unsigned);
344 static void dbxout_function_decl (tree);
346 const struct gcc_debug_hooks dbx_debug_hooks =
348 dbxout_init,
349 dbxout_finish,
350 debug_nothing_int_charstar,
351 debug_nothing_int_charstar,
352 dbxout_start_source_file,
353 dbxout_end_source_file,
354 dbxout_begin_block,
355 dbxout_end_block,
356 debug_true_tree, /* ignore_block */
357 dbxout_source_line, /* source_line */
358 dbxout_begin_prologue, /* begin_prologue */
359 debug_nothing_int_charstar, /* end_prologue */
360 debug_nothing_int_charstar, /* end_epilogue */
361 #ifdef DBX_FUNCTION_FIRST
362 dbxout_begin_function,
363 #else
364 debug_nothing_tree, /* begin_function */
365 #endif
366 debug_nothing_int, /* end_function */
367 dbxout_function_decl,
368 dbxout_global_decl, /* global_decl */
369 dbxout_type_decl, /* type_decl */
370 debug_nothing_tree_tree, /* imported_module_or_decl */
371 debug_nothing_tree, /* deferred_inline_function */
372 debug_nothing_tree, /* outlining_inline_function */
373 debug_nothing_rtx, /* label */
374 dbxout_handle_pch, /* handle_pch */
375 debug_nothing_rtx, /* var_location */
376 debug_nothing_void, /* switch_text_section */
377 0 /* start_end_main_source_file */
379 #endif /* DBX_DEBUGGING_INFO */
381 #if defined (XCOFF_DEBUGGING_INFO)
382 const struct gcc_debug_hooks xcoff_debug_hooks =
384 dbxout_init,
385 dbxout_finish,
386 debug_nothing_int_charstar,
387 debug_nothing_int_charstar,
388 dbxout_start_source_file,
389 dbxout_end_source_file,
390 xcoffout_begin_block,
391 xcoffout_end_block,
392 debug_true_tree, /* ignore_block */
393 xcoffout_source_line,
394 xcoffout_begin_prologue, /* begin_prologue */
395 debug_nothing_int_charstar, /* end_prologue */
396 xcoffout_end_epilogue,
397 debug_nothing_tree, /* begin_function */
398 xcoffout_end_function,
399 debug_nothing_tree, /* function_decl */
400 dbxout_global_decl, /* global_decl */
401 dbxout_type_decl, /* type_decl */
402 debug_nothing_tree_tree, /* imported_module_or_decl */
403 debug_nothing_tree, /* deferred_inline_function */
404 debug_nothing_tree, /* outlining_inline_function */
405 debug_nothing_rtx, /* label */
406 dbxout_handle_pch, /* handle_pch */
407 debug_nothing_rtx, /* var_location */
408 debug_nothing_void, /* switch_text_section */
409 0 /* start_end_main_source_file */
411 #endif /* XCOFF_DEBUGGING_INFO */
413 /* Numeric formatting helper macro. Note that this does not handle
414 hexadecimal. */
415 #define NUMBER_FMT_LOOP(P, NUM, BASE) \
416 do \
418 int digit = NUM % BASE; \
419 NUM /= BASE; \
420 *--P = digit + '0'; \
422 while (NUM > 0)
424 /* Utility: write a decimal integer NUM to asm_out_file. */
425 void
426 dbxout_int (int num)
428 char buf[64];
429 char *p = buf + sizeof buf;
430 unsigned int unum;
432 if (num == 0)
434 putc ('0', asm_out_file);
435 return;
437 if (num < 0)
439 putc ('-', asm_out_file);
440 unum = -num;
442 else
443 unum = num;
445 NUMBER_FMT_LOOP (p, unum, 10);
447 while (p < buf + sizeof buf)
449 putc (*p, asm_out_file);
450 p++;
455 /* Primitives for emitting simple stabs directives. All other stabs
456 routines should use these functions instead of directly emitting
457 stabs. They are exported because machine-dependent code may need
458 to invoke them, e.g. in a DBX_OUTPUT_* macro whose definition
459 forwards to code in CPU.c. */
461 /* The following functions should all be called immediately after one
462 of the dbxout_begin_stab* functions (below). They write out
463 various things as the value of a stab. */
465 /* Write out a literal zero as the value of a stab. */
466 void
467 dbxout_stab_value_zero (void)
469 fputs ("0\n", asm_out_file);
472 /* Write out the label LABEL as the value of a stab. */
473 void
474 dbxout_stab_value_label (const char *label)
476 assemble_name (asm_out_file, label);
477 putc ('\n', asm_out_file);
480 /* Write out the difference of two labels, LABEL - BASE, as the value
481 of a stab. */
482 void
483 dbxout_stab_value_label_diff (const char *label, const char *base)
485 assemble_name (asm_out_file, label);
486 putc ('-', asm_out_file);
487 assemble_name (asm_out_file, base);
488 putc ('\n', asm_out_file);
491 /* Write out an internal label as the value of a stab, and immediately
492 emit that internal label. This should be used only when
493 dbxout_stabd will not work. STEM is the name stem of the label,
494 COUNTERP is a pointer to a counter variable which will be used to
495 guarantee label uniqueness. */
496 void
497 dbxout_stab_value_internal_label (const char *stem, int *counterp)
499 char label[100];
500 int counter = counterp ? (*counterp)++ : 0;
502 ASM_GENERATE_INTERNAL_LABEL (label, stem, counter);
503 dbxout_stab_value_label (label);
504 targetm.asm_out.internal_label (asm_out_file, stem, counter);
507 /* Write out the difference between BASE and an internal label as the
508 value of a stab, and immediately emit that internal label. STEM and
509 COUNTERP are as for dbxout_stab_value_internal_label. */
510 void
511 dbxout_stab_value_internal_label_diff (const char *stem, int *counterp,
512 const char *base)
514 char label[100];
515 int counter = counterp ? (*counterp)++ : 0;
517 ASM_GENERATE_INTERNAL_LABEL (label, stem, counter);
518 dbxout_stab_value_label_diff (label, base);
519 targetm.asm_out.internal_label (asm_out_file, stem, counter);
522 /* The following functions produce specific kinds of stab directives. */
524 /* Write a .stabd directive with type STYPE and desc SDESC to asm_out_file. */
525 void
526 dbxout_stabd (int stype, int sdesc)
528 fputs (ASM_STABD_OP, asm_out_file);
529 dbxout_int (stype);
530 fputs (",0,", asm_out_file);
531 dbxout_int (sdesc);
532 putc ('\n', asm_out_file);
535 /* Write a .stabn directive with type STYPE. This function stops
536 short of emitting the value field, which is the responsibility of
537 the caller (normally it will be either a symbol or the difference
538 of two symbols). */
540 void
541 dbxout_begin_stabn (int stype)
543 fputs (ASM_STABN_OP, asm_out_file);
544 dbxout_int (stype);
545 fputs (",0,0,", asm_out_file);
548 /* Write a .stabn directive with type N_SLINE and desc LINE. As above,
549 the value field is the responsibility of the caller. */
550 void
551 dbxout_begin_stabn_sline (int lineno)
553 fputs (ASM_STABN_OP, asm_out_file);
554 dbxout_int (N_SLINE);
555 fputs (",0,", asm_out_file);
556 dbxout_int (lineno);
557 putc (',', asm_out_file);
560 /* Begin a .stabs directive with string "", type STYPE, and desc and
561 other fields 0. The value field is the responsibility of the
562 caller. This function cannot be used for .stabx directives. */
563 void
564 dbxout_begin_empty_stabs (int stype)
566 fputs (ASM_STABS_OP, asm_out_file);
567 fputs ("\"\",", asm_out_file);
568 dbxout_int (stype);
569 fputs (",0,0,", asm_out_file);
572 /* Begin a .stabs directive with string STR, type STYPE, and desc 0.
573 The value field is the responsibility of the caller. */
574 void
575 dbxout_begin_simple_stabs (const char *str, int stype)
577 fputs (ASM_STABS_OP, asm_out_file);
578 output_quoted_string (asm_out_file, str);
579 putc (',', asm_out_file);
580 dbxout_int (stype);
581 fputs (",0,0,", asm_out_file);
584 /* As above but use SDESC for the desc field. */
585 void
586 dbxout_begin_simple_stabs_desc (const char *str, int stype, int sdesc)
588 fputs (ASM_STABS_OP, asm_out_file);
589 output_quoted_string (asm_out_file, str);
590 putc (',', asm_out_file);
591 dbxout_int (stype);
592 fputs (",0,", asm_out_file);
593 dbxout_int (sdesc);
594 putc (',', asm_out_file);
597 /* The next set of functions are entirely concerned with production of
598 "complex" .stabs directives: that is, .stabs directives whose
599 strings have to be constructed piecemeal. dbxout_type,
600 dbxout_symbol, etc. use these routines heavily. The string is queued
601 up in an obstack, then written out by dbxout_finish_complex_stabs, which
602 is also responsible for splitting it up if it exceeds DBX_CONTIN_LENGTH.
603 (You might think it would be more efficient to go straight to stdio
604 when DBX_CONTIN_LENGTH is 0 (i.e. no length limit) but that turns
605 out not to be the case, and anyway this needs fewer #ifdefs.) */
607 /* Begin a complex .stabs directive. If we can, write the initial
608 ASM_STABS_OP to the asm_out_file. */
610 static void
611 dbxout_begin_complex_stabs (void)
613 emit_pending_bincls_if_required ();
614 FORCE_TEXT;
615 fputs (ASM_STABS_OP, asm_out_file);
616 putc ('"', asm_out_file);
617 gcc_assert (stabstr_last_contin_point == 0);
620 /* As above, but do not force text or emit pending bincls. This is
621 used by dbxout_symbol_location, which needs to do something else. */
622 static void
623 dbxout_begin_complex_stabs_noforcetext (void)
625 fputs (ASM_STABS_OP, asm_out_file);
626 putc ('"', asm_out_file);
627 gcc_assert (stabstr_last_contin_point == 0);
630 /* Add CHR, a single character, to the string being built. */
631 #define stabstr_C(chr) obstack_1grow (&stabstr_ob, chr)
633 /* Add STR, a normal C string, to the string being built. */
634 #define stabstr_S(str) obstack_grow (&stabstr_ob, str, strlen(str))
636 /* Add the text of ID, an IDENTIFIER_NODE, to the string being built. */
637 #define stabstr_I(id) obstack_grow (&stabstr_ob, \
638 IDENTIFIER_POINTER (id), \
639 IDENTIFIER_LENGTH (id))
641 /* Add NUM, a signed decimal number, to the string being built. */
642 static void
643 stabstr_D (HOST_WIDE_INT num)
645 char buf[64];
646 char *p = buf + sizeof buf;
647 unsigned int unum;
649 if (num == 0)
651 stabstr_C ('0');
652 return;
654 if (num < 0)
656 stabstr_C ('-');
657 unum = -num;
659 else
660 unum = num;
662 NUMBER_FMT_LOOP (p, unum, 10);
664 obstack_grow (&stabstr_ob, p, (buf + sizeof buf) - p);
667 /* Add NUM, an unsigned decimal number, to the string being built. */
668 static void
669 stabstr_U (unsigned HOST_WIDE_INT num)
671 char buf[64];
672 char *p = buf + sizeof buf;
673 if (num == 0)
675 stabstr_C ('0');
676 return;
678 NUMBER_FMT_LOOP (p, num, 10);
679 obstack_grow (&stabstr_ob, p, (buf + sizeof buf) - p);
682 /* Add CST, an INTEGER_CST tree, to the string being built as an
683 unsigned octal number. This routine handles values which are
684 larger than a single HOST_WIDE_INT. */
685 static void
686 stabstr_O (tree cst)
688 unsigned HOST_WIDE_INT high = TREE_INT_CST_HIGH (cst);
689 unsigned HOST_WIDE_INT low = TREE_INT_CST_LOW (cst);
691 char buf[128];
692 char *p = buf + sizeof buf;
694 /* GDB wants constants with no extra leading "1" bits, so
695 we need to remove any sign-extension that might be
696 present. */
698 const unsigned int width = TYPE_PRECISION (TREE_TYPE (cst));
699 if (width == HOST_BITS_PER_WIDE_INT * 2)
701 else if (width > HOST_BITS_PER_WIDE_INT)
702 high &= (((HOST_WIDE_INT) 1 << (width - HOST_BITS_PER_WIDE_INT)) - 1);
703 else if (width == HOST_BITS_PER_WIDE_INT)
704 high = 0;
705 else
706 high = 0, low &= (((HOST_WIDE_INT) 1 << width) - 1);
709 /* Leading zero for base indicator. */
710 stabstr_C ('0');
712 /* If the value is zero, the base indicator will serve as the value
713 all by itself. */
714 if (high == 0 && low == 0)
715 return;
717 /* If the high half is zero, we need only print the low half normally. */
718 if (high == 0)
719 NUMBER_FMT_LOOP (p, low, 8);
720 else
722 /* When high != 0, we need to print enough zeroes from low to
723 give the digits from high their proper place-values. Hence
724 NUMBER_FMT_LOOP cannot be used. */
725 const int n_digits = HOST_BITS_PER_WIDE_INT / 3;
726 int i;
728 for (i = 1; i <= n_digits; i++)
730 unsigned int digit = low % 8;
731 low /= 8;
732 *--p = '0' + digit;
735 /* Octal digits carry exactly three bits of information. The
736 width of a HOST_WIDE_INT is not normally a multiple of three.
737 Therefore, the next digit printed probably needs to carry
738 information from both low and high. */
739 if (HOST_BITS_PER_WIDE_INT % 3 != 0)
741 const int n_leftover_bits = HOST_BITS_PER_WIDE_INT % 3;
742 const int n_bits_from_high = 3 - n_leftover_bits;
744 const unsigned HOST_WIDE_INT
745 low_mask = (((unsigned HOST_WIDE_INT)1) << n_leftover_bits) - 1;
746 const unsigned HOST_WIDE_INT
747 high_mask = (((unsigned HOST_WIDE_INT)1) << n_bits_from_high) - 1;
749 unsigned int digit;
751 /* At this point, only the bottom n_leftover_bits bits of low
752 should be set. */
753 gcc_assert (!(low & ~low_mask));
755 digit = (low | ((high & high_mask) << n_leftover_bits));
756 high >>= n_bits_from_high;
758 *--p = '0' + digit;
761 /* Now we can format high in the normal manner. However, if
762 the only bits of high that were set were handled by the
763 digit split between low and high, high will now be zero, and
764 we don't want to print extra digits in that case. */
765 if (high)
766 NUMBER_FMT_LOOP (p, high, 8);
769 obstack_grow (&stabstr_ob, p, (buf + sizeof buf) - p);
772 /* Called whenever it is safe to break a stabs string into multiple
773 .stabs directives. If the current string has exceeded the limit
774 set by DBX_CONTIN_LENGTH, mark the current position in the buffer
775 as a continuation point by inserting DBX_CONTIN_CHAR (doubled if
776 it is a backslash) and a null character. */
777 static inline void
778 stabstr_continue (void)
780 if (DBX_CONTIN_LENGTH > 0
781 && obstack_object_size (&stabstr_ob) - stabstr_last_contin_point
782 > DBX_CONTIN_LENGTH)
784 if (DBX_CONTIN_CHAR == '\\')
785 obstack_1grow (&stabstr_ob, '\\');
786 obstack_1grow (&stabstr_ob, DBX_CONTIN_CHAR);
787 obstack_1grow (&stabstr_ob, '\0');
788 stabstr_last_contin_point = obstack_object_size (&stabstr_ob);
791 #define CONTIN stabstr_continue ()
793 /* Macro subroutine of dbxout_finish_complex_stabs, which emits
794 all of the arguments to the .stabs directive after the string.
795 Overridden by xcoffout.h. CODE is the stabs code for this symbol;
796 LINE is the source line to write into the desc field (in extended
797 mode); SYM is the symbol itself.
799 ADDR, LABEL, and NUMBER are three different ways to represent the
800 stabs value field. At most one of these should be nonzero.
802 ADDR is used most of the time; it represents the value as an
803 RTL address constant.
805 LABEL is used (currently) only for N_CATCH stabs; it represents
806 the value as a string suitable for assemble_name.
808 NUMBER is used when the value is an offset from an implicit base
809 pointer (e.g. for a stack variable), or an index (e.g. for a
810 register variable). It represents the value as a decimal integer. */
812 #ifndef DBX_FINISH_STABS
813 #define DBX_FINISH_STABS(SYM, CODE, LINE, ADDR, LABEL, NUMBER) \
814 do { \
815 int line_ = use_gnu_debug_info_extensions ? LINE : 0; \
817 dbxout_int (CODE); \
818 fputs (",0,", asm_out_file); \
819 dbxout_int (line_); \
820 putc (',', asm_out_file); \
821 if (ADDR) \
822 output_addr_const (asm_out_file, ADDR); \
823 else if (LABEL) \
824 assemble_name (asm_out_file, LABEL); \
825 else \
826 dbxout_int (NUMBER); \
827 putc ('\n', asm_out_file); \
828 } while (0)
829 #endif
831 /* Finish the emission of a complex .stabs directive. When DBX_CONTIN_LENGTH
832 is zero, this has only to emit the close quote and the remainder of
833 the arguments. When it is nonzero, the string has been marshalled in
834 stabstr_ob, and this routine is responsible for breaking it up into
835 DBX_CONTIN_LENGTH-sized chunks.
837 SYM is the DECL of the symbol under consideration; it is used only
838 for its DECL_SOURCE_LINE. The other arguments are all passed directly
839 to DBX_FINISH_STABS; see above for details. */
841 static void
842 dbxout_finish_complex_stabs (tree sym, STAB_CODE_TYPE code,
843 rtx addr, const char *label, int number)
845 int line ATTRIBUTE_UNUSED;
846 char *str;
847 size_t len;
849 line = sym ? DECL_SOURCE_LINE (sym) : 0;
850 if (DBX_CONTIN_LENGTH > 0)
852 char *chunk;
853 size_t chunklen;
855 /* Nul-terminate the growing string, then get its size and
856 address. */
857 obstack_1grow (&stabstr_ob, '\0');
859 len = obstack_object_size (&stabstr_ob);
860 chunk = str = XOBFINISH (&stabstr_ob, char *);
862 /* Within the buffer are a sequence of NUL-separated strings,
863 each of which is to be written out as a separate stab
864 directive. */
865 for (;;)
867 chunklen = strlen (chunk);
868 fwrite (chunk, 1, chunklen, asm_out_file);
869 fputs ("\",", asm_out_file);
871 /* Must add an extra byte to account for the NUL separator. */
872 chunk += chunklen + 1;
873 len -= chunklen + 1;
875 /* Only put a line number on the last stab in the sequence. */
876 DBX_FINISH_STABS (sym, code, len == 0 ? line : 0,
877 addr, label, number);
878 if (len == 0)
879 break;
881 fputs (ASM_STABS_OP, asm_out_file);
882 putc ('"', asm_out_file);
884 stabstr_last_contin_point = 0;
886 else
888 /* No continuations - we can put the whole string out at once.
889 It is faster to augment the string with the close quote and
890 comma than to do a two-character fputs. */
891 obstack_grow (&stabstr_ob, "\",", 2);
892 len = obstack_object_size (&stabstr_ob);
893 str = XOBFINISH (&stabstr_ob, char *);
895 fwrite (str, 1, len, asm_out_file);
896 DBX_FINISH_STABS (sym, code, line, addr, label, number);
898 obstack_free (&stabstr_ob, str);
901 #if defined (DBX_DEBUGGING_INFO)
903 static void
904 dbxout_function_end (tree decl)
906 char lscope_label_name[100];
908 /* The Lscope label must be emitted even if we aren't doing anything
909 else; dbxout_block needs it. */
910 function_section (current_function_decl);
912 /* Convert Lscope into the appropriate format for local labels in case
913 the system doesn't insert underscores in front of user generated
914 labels. */
915 ASM_GENERATE_INTERNAL_LABEL (lscope_label_name, "Lscope", scope_labelno);
916 targetm.asm_out.internal_label (asm_out_file, "Lscope", scope_labelno);
917 scope_labelno++;
919 /* The N_FUN tag at the end of the function is a GNU extension,
920 which may be undesirable, and is unnecessary if we do not have
921 named sections. */
922 if (!use_gnu_debug_info_extensions
923 || NO_DBX_FUNCTION_END
924 || !targetm.have_named_sections
925 || DECL_IGNORED_P (decl))
926 return;
928 /* By convention, GCC will mark the end of a function with an N_FUN
929 symbol and an empty string. */
930 #ifdef DBX_OUTPUT_NFUN
931 DBX_OUTPUT_NFUN (asm_out_file, lscope_label_name, current_function_decl);
932 #else
933 if (flag_reorder_blocks_and_partition)
935 dbxout_begin_empty_stabs (N_FUN);
936 dbxout_stab_value_label_diff (cfun->hot_section_end_label,
937 cfun->hot_section_label);
938 dbxout_begin_empty_stabs (N_FUN);
939 dbxout_stab_value_label_diff (cfun->cold_section_end_label,
940 cfun->cold_section_label);
942 else
944 dbxout_begin_empty_stabs (N_FUN);
945 dbxout_stab_value_label_diff (lscope_label_name,
946 XSTR (XEXP (DECL_RTL (current_function_decl),
947 0), 0));
950 #endif
952 if (!NO_DBX_BNSYM_ENSYM && !flag_debug_only_used_symbols)
953 dbxout_stabd (N_ENSYM, 0);
955 #endif /* DBX_DEBUGGING_INFO */
957 /* Get lang description for N_SO stab. */
958 static unsigned int ATTRIBUTE_UNUSED
959 get_lang_number (void)
961 const char *language_string = lang_hooks.name;
963 if (strcmp (language_string, "GNU C") == 0)
964 return N_SO_C;
965 else if (strcmp (language_string, "GNU C++") == 0)
966 return N_SO_CC;
967 else if (strcmp (language_string, "GNU F77") == 0)
968 return N_SO_FORTRAN;
969 else if (strcmp (language_string, "GNU F95") == 0)
970 return N_SO_FORTRAN90; /* CHECKME */
971 else if (strcmp (language_string, "GNU Pascal") == 0)
972 return N_SO_PASCAL;
973 else if (strcmp (language_string, "GNU Objective-C") == 0)
974 return N_SO_OBJC;
975 else if (strcmp (language_string, "GNU Objective-C++") == 0)
976 return N_SO_OBJCPLUS;
977 else
978 return 0;
982 /* At the beginning of compilation, start writing the symbol table.
983 Initialize `typevec' and output the standard data types of C. */
985 static void
986 dbxout_init (const char *input_file_name)
988 char ltext_label_name[100];
989 bool used_ltext_label_name = false;
990 tree syms = lang_hooks.decls.getdecls ();
992 typevec_len = 100;
993 typevec = ggc_calloc (typevec_len, sizeof typevec[0]);
995 /* stabstr_ob contains one string, which will be just fine with
996 1-byte alignment. */
997 obstack_specify_allocation (&stabstr_ob, 0, 1, xmalloc, free);
999 /* Convert Ltext into the appropriate format for local labels in case
1000 the system doesn't insert underscores in front of user generated
1001 labels. */
1002 ASM_GENERATE_INTERNAL_LABEL (ltext_label_name, "Ltext", 0);
1004 /* Put the current working directory in an N_SO symbol. */
1005 if (use_gnu_debug_info_extensions && !NO_DBX_MAIN_SOURCE_DIRECTORY)
1007 static const char *cwd;
1009 if (!cwd)
1011 cwd = get_src_pwd ();
1012 if (cwd[0] == '\0')
1013 cwd = "/";
1014 else if (!IS_DIR_SEPARATOR (cwd[strlen (cwd) - 1]))
1015 cwd = concat (cwd, "/", NULL);
1017 #ifdef DBX_OUTPUT_MAIN_SOURCE_DIRECTORY
1018 DBX_OUTPUT_MAIN_SOURCE_DIRECTORY (asm_out_file, cwd);
1019 #else /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */
1020 dbxout_begin_simple_stabs_desc (cwd, N_SO, get_lang_number ());
1021 dbxout_stab_value_label (ltext_label_name);
1022 used_ltext_label_name = true;
1023 #endif /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */
1026 #ifdef DBX_OUTPUT_MAIN_SOURCE_FILENAME
1027 DBX_OUTPUT_MAIN_SOURCE_FILENAME (asm_out_file, input_file_name);
1028 #else
1029 dbxout_begin_simple_stabs_desc (input_file_name, N_SO, get_lang_number ());
1030 dbxout_stab_value_label (ltext_label_name);
1031 used_ltext_label_name = true;
1032 #endif
1034 if (used_ltext_label_name)
1036 text_section ();
1037 targetm.asm_out.internal_label (asm_out_file, "Ltext", 0);
1040 /* Emit an N_OPT stab to indicate that this file was compiled by GCC.
1041 The string used is historical. */
1042 #ifndef NO_DBX_GCC_MARKER
1043 dbxout_begin_simple_stabs ("gcc2_compiled.", N_OPT);
1044 dbxout_stab_value_zero ();
1045 #endif
1047 base_input_file = lastfile = input_file_name;
1049 next_type_number = 1;
1051 #ifdef DBX_USE_BINCL
1052 current_file = xmalloc (sizeof *current_file);
1053 current_file->next = NULL;
1054 current_file->file_number = 0;
1055 current_file->next_type_number = 1;
1056 next_file_number = 1;
1057 current_file->prev = NULL;
1058 current_file->bincl_status = BINCL_NOT_REQUIRED;
1059 current_file->pending_bincl_name = NULL;
1060 #endif
1062 /* Get all permanent types that have typedef names, and output them
1063 all, except for those already output. Some language front ends
1064 put these declarations in the top-level scope; some do not;
1065 the latter are responsible for calling debug_hooks->type_decl from
1066 their record_builtin_type function. */
1067 dbxout_typedefs (syms);
1069 if (preinit_symbols)
1071 tree t;
1072 for (t = nreverse (preinit_symbols); t; t = TREE_CHAIN (t))
1073 dbxout_symbol (TREE_VALUE (t), 0);
1074 preinit_symbols = 0;
1078 /* Output any typedef names for types described by TYPE_DECLs in SYMS. */
1080 static void
1081 dbxout_typedefs (tree syms)
1083 for (; syms != NULL_TREE; syms = TREE_CHAIN (syms))
1085 if (TREE_CODE (syms) == TYPE_DECL)
1087 tree type = TREE_TYPE (syms);
1088 if (TYPE_NAME (type)
1089 && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
1090 && COMPLETE_OR_VOID_TYPE_P (type)
1091 && ! TREE_ASM_WRITTEN (TYPE_NAME (type)))
1092 dbxout_symbol (TYPE_NAME (type), 0);
1097 #ifdef DBX_USE_BINCL
1098 /* Emit BINCL stab using given name. */
1099 static void
1100 emit_bincl_stab (const char *name)
1102 dbxout_begin_simple_stabs (name, N_BINCL);
1103 dbxout_stab_value_zero ();
1106 /* If there are pending bincls then it is time to emit all of them. */
1108 static inline void
1109 emit_pending_bincls_if_required (void)
1111 if (pending_bincls)
1112 emit_pending_bincls ();
1115 /* Emit all pending bincls. */
1117 static void
1118 emit_pending_bincls (void)
1120 struct dbx_file *f = current_file;
1122 /* Find first pending bincl. */
1123 while (f->bincl_status == BINCL_PENDING)
1124 f = f->next;
1126 /* Now emit all bincls. */
1127 f = f->prev;
1129 while (f)
1131 if (f->bincl_status == BINCL_PENDING)
1133 emit_bincl_stab (f->pending_bincl_name);
1135 /* Update file number and status. */
1136 f->file_number = next_file_number++;
1137 f->bincl_status = BINCL_PROCESSED;
1139 if (f == current_file)
1140 break;
1141 f = f->prev;
1144 /* All pending bincls have been emitted. */
1145 pending_bincls = 0;
1148 #else
1150 static inline void
1151 emit_pending_bincls_if_required (void) {}
1152 #endif
1154 /* Change to reading from a new source file. Generate a N_BINCL stab. */
1156 static void
1157 dbxout_start_source_file (unsigned int line ATTRIBUTE_UNUSED,
1158 const char *filename ATTRIBUTE_UNUSED)
1160 #ifdef DBX_USE_BINCL
1161 struct dbx_file *n = xmalloc (sizeof *n);
1163 n->next = current_file;
1164 n->next_type_number = 1;
1165 /* Do not assign file number now.
1166 Delay it until we actually emit BINCL. */
1167 n->file_number = 0;
1168 n->prev = NULL;
1169 current_file->prev = n;
1170 n->bincl_status = BINCL_PENDING;
1171 n->pending_bincl_name = filename;
1172 pending_bincls = 1;
1173 current_file = n;
1174 #endif
1177 /* Revert to reading a previous source file. Generate a N_EINCL stab. */
1179 static void
1180 dbxout_end_source_file (unsigned int line ATTRIBUTE_UNUSED)
1182 #ifdef DBX_USE_BINCL
1183 /* Emit EINCL stab only if BINCL is not pending. */
1184 if (current_file->bincl_status == BINCL_PROCESSED)
1186 dbxout_begin_stabn (N_EINCL);
1187 dbxout_stab_value_zero ();
1189 current_file->bincl_status = BINCL_NOT_REQUIRED;
1190 current_file = current_file->next;
1191 #endif
1194 /* Handle a few odd cases that occur when trying to make PCH files work. */
1196 static void
1197 dbxout_handle_pch (unsigned at_end)
1199 if (! at_end)
1201 /* When using the PCH, this file will be included, so we need to output
1202 a BINCL. */
1203 dbxout_start_source_file (0, lastfile);
1205 /* The base file when using the PCH won't be the same as
1206 the base file when it's being generated. */
1207 lastfile = NULL;
1209 else
1211 /* ... and an EINCL. */
1212 dbxout_end_source_file (0);
1214 /* Deal with cases where 'lastfile' was never actually changed. */
1215 lastfile_is_base = lastfile == NULL;
1219 #if defined (DBX_DEBUGGING_INFO)
1220 /* Output debugging info to FILE to switch to sourcefile FILENAME. */
1222 static void
1223 dbxout_source_file (const char *filename)
1225 if (lastfile == 0 && lastfile_is_base)
1227 lastfile = base_input_file;
1228 lastfile_is_base = 0;
1231 if (filename && (lastfile == 0 || strcmp (filename, lastfile)))
1233 /* Don't change section amid function. */
1234 if (current_function_decl == NULL_TREE)
1235 text_section ();
1237 dbxout_begin_simple_stabs (filename, N_SOL);
1238 dbxout_stab_value_internal_label ("Ltext", &source_label_number);
1239 lastfile = filename;
1243 /* Output N_BNSYM and line number symbol entry. */
1245 static void
1246 dbxout_begin_prologue (unsigned int lineno, const char *filename)
1248 if (use_gnu_debug_info_extensions
1249 && !NO_DBX_FUNCTION_END
1250 && !NO_DBX_BNSYM_ENSYM
1251 && !flag_debug_only_used_symbols)
1252 dbxout_stabd (N_BNSYM, 0);
1254 dbxout_source_line (lineno, filename);
1257 /* Output a line number symbol entry for source file FILENAME and line
1258 number LINENO. */
1260 static void
1261 dbxout_source_line (unsigned int lineno, const char *filename)
1263 dbxout_source_file (filename);
1265 #ifdef DBX_OUTPUT_SOURCE_LINE
1266 DBX_OUTPUT_SOURCE_LINE (asm_out_file, lineno, dbxout_source_line_counter);
1267 #else
1268 if (DBX_LINES_FUNCTION_RELATIVE)
1270 rtx begin_label = XEXP (DECL_RTL (current_function_decl), 0);
1271 dbxout_begin_stabn_sline (lineno);
1272 dbxout_stab_value_internal_label_diff ("LM", &dbxout_source_line_counter,
1273 XSTR (begin_label, 0));
1276 else
1277 dbxout_stabd (N_SLINE, lineno);
1278 #endif
1281 /* Describe the beginning of an internal block within a function. */
1283 static void
1284 dbxout_begin_block (unsigned int line ATTRIBUTE_UNUSED, unsigned int n)
1286 emit_pending_bincls_if_required ();
1287 targetm.asm_out.internal_label (asm_out_file, "LBB", n);
1290 /* Describe the end line-number of an internal block within a function. */
1292 static void
1293 dbxout_end_block (unsigned int line ATTRIBUTE_UNUSED, unsigned int n)
1295 emit_pending_bincls_if_required ();
1296 targetm.asm_out.internal_label (asm_out_file, "LBE", n);
1299 /* Output dbx data for a function definition.
1300 This includes a definition of the function name itself (a symbol),
1301 definitions of the parameters (locating them in the parameter list)
1302 and then output the block that makes up the function's body
1303 (including all the auto variables of the function). */
1305 static void
1306 dbxout_function_decl (tree decl)
1308 emit_pending_bincls_if_required ();
1309 #ifndef DBX_FUNCTION_FIRST
1310 dbxout_begin_function (decl);
1311 #endif
1312 dbxout_block (DECL_INITIAL (decl), 0, DECL_ARGUMENTS (decl));
1313 dbxout_function_end (decl);
1316 #endif /* DBX_DEBUGGING_INFO */
1318 /* Debug information for a global DECL. Called from toplev.c after
1319 compilation proper has finished. */
1320 static void
1321 dbxout_global_decl (tree decl)
1323 if (TREE_CODE (decl) == VAR_DECL && !DECL_EXTERNAL (decl))
1325 int saved_tree_used = TREE_USED (decl);
1326 TREE_USED (decl) = 1;
1327 dbxout_symbol (decl, 0);
1328 TREE_USED (decl) = saved_tree_used;
1332 /* This is just a function-type adapter; dbxout_symbol does exactly
1333 what we want but returns an int. */
1334 static void
1335 dbxout_type_decl (tree decl, int local)
1337 dbxout_symbol (decl, local);
1340 /* At the end of compilation, finish writing the symbol table.
1341 The default is to call debug_free_queue but do nothing else. */
1343 static void
1344 dbxout_finish (const char *filename ATTRIBUTE_UNUSED)
1346 #ifdef DBX_OUTPUT_MAIN_SOURCE_FILE_END
1347 DBX_OUTPUT_MAIN_SOURCE_FILE_END (asm_out_file, filename);
1348 #elif defined DBX_OUTPUT_NULL_N_SO_AT_MAIN_SOURCE_FILE_END
1350 text_section ();
1351 dbxout_begin_empty_stabs (N_SO);
1352 dbxout_stab_value_internal_label ("Letext", 0);
1354 #endif
1355 debug_free_queue ();
1358 /* Output the index of a type. */
1360 static void
1361 dbxout_type_index (tree type)
1363 #ifndef DBX_USE_BINCL
1364 stabstr_D (TYPE_SYMTAB_ADDRESS (type));
1365 #else
1366 struct typeinfo *t = &typevec[TYPE_SYMTAB_ADDRESS (type)];
1367 stabstr_C ('(');
1368 stabstr_D (t->file_number);
1369 stabstr_C (',');
1370 stabstr_D (t->type_number);
1371 stabstr_C (')');
1372 #endif
1377 /* Used in several places: evaluates to '0' for a private decl,
1378 '1' for a protected decl, '2' for a public decl. */
1379 #define DECL_ACCESSIBILITY_CHAR(DECL) \
1380 (TREE_PRIVATE (DECL) ? '0' : TREE_PROTECTED (DECL) ? '1' : '2')
1382 /* Subroutine of `dbxout_type'. Output the type fields of TYPE.
1383 This must be a separate function because anonymous unions require
1384 recursive calls. */
1386 static void
1387 dbxout_type_fields (tree type)
1389 tree tem;
1391 /* Output the name, type, position (in bits), size (in bits) of each
1392 field that we can support. */
1393 for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
1395 /* If one of the nodes is an error_mark or its type is then
1396 return early. */
1397 if (tem == error_mark_node || TREE_TYPE (tem) == error_mark_node)
1398 return;
1400 /* Omit here local type decls until we know how to support them. */
1401 if (TREE_CODE (tem) == TYPE_DECL
1402 /* Omit here the nameless fields that are used to skip bits. */
1403 || DECL_IGNORED_P (tem)
1404 /* Omit fields whose position or size are variable or too large to
1405 represent. */
1406 || (TREE_CODE (tem) == FIELD_DECL
1407 && (! host_integerp (bit_position (tem), 0)
1408 || ! DECL_SIZE (tem)
1409 || ! host_integerp (DECL_SIZE (tem), 1))))
1410 continue;
1412 else if (TREE_CODE (tem) != CONST_DECL)
1414 /* Continue the line if necessary,
1415 but not before the first field. */
1416 if (tem != TYPE_FIELDS (type))
1417 CONTIN;
1419 if (DECL_NAME (tem))
1420 stabstr_I (DECL_NAME (tem));
1421 stabstr_C (':');
1423 if (use_gnu_debug_info_extensions
1424 && (TREE_PRIVATE (tem) || TREE_PROTECTED (tem)
1425 || TREE_CODE (tem) != FIELD_DECL))
1427 stabstr_C ('/');
1428 stabstr_C (DECL_ACCESSIBILITY_CHAR (tem));
1431 dbxout_type ((TREE_CODE (tem) == FIELD_DECL
1432 && DECL_BIT_FIELD_TYPE (tem))
1433 ? DECL_BIT_FIELD_TYPE (tem) : TREE_TYPE (tem), 0);
1435 if (TREE_CODE (tem) == VAR_DECL)
1437 if (TREE_STATIC (tem) && use_gnu_debug_info_extensions)
1439 tree name = DECL_ASSEMBLER_NAME (tem);
1441 stabstr_C (':');
1442 stabstr_I (name);
1443 stabstr_C (';');
1445 else
1446 /* If TEM is non-static, GDB won't understand it. */
1447 stabstr_S (",0,0;");
1449 else
1451 stabstr_C (',');
1452 stabstr_D (int_bit_position (tem));
1453 stabstr_C (',');
1454 stabstr_D (tree_low_cst (DECL_SIZE (tem), 1));
1455 stabstr_C (';');
1461 /* Subroutine of `dbxout_type_methods'. Output debug info about the
1462 method described DECL. */
1464 static void
1465 dbxout_type_method_1 (tree decl)
1467 char c1 = 'A', c2;
1469 if (TREE_CODE (TREE_TYPE (decl)) == FUNCTION_TYPE)
1470 c2 = '?';
1471 else /* it's a METHOD_TYPE. */
1473 tree firstarg = TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl)));
1474 /* A for normal functions.
1475 B for `const' member functions.
1476 C for `volatile' member functions.
1477 D for `const volatile' member functions. */
1478 if (TYPE_READONLY (TREE_TYPE (firstarg)))
1479 c1 += 1;
1480 if (TYPE_VOLATILE (TREE_TYPE (firstarg)))
1481 c1 += 2;
1483 if (DECL_VINDEX (decl))
1484 c2 = '*';
1485 else
1486 c2 = '.';
1489 /* ??? Output the mangled name, which contains an encoding of the
1490 method's type signature. May not be necessary anymore. */
1491 stabstr_C (':');
1492 stabstr_I (DECL_ASSEMBLER_NAME (decl));
1493 stabstr_C (';');
1494 stabstr_C (DECL_ACCESSIBILITY_CHAR (decl));
1495 stabstr_C (c1);
1496 stabstr_C (c2);
1498 if (DECL_VINDEX (decl) && host_integerp (DECL_VINDEX (decl), 0))
1500 stabstr_D (tree_low_cst (DECL_VINDEX (decl), 0));
1501 stabstr_C (';');
1502 dbxout_type (DECL_CONTEXT (decl), 0);
1503 stabstr_C (';');
1507 /* Subroutine of `dbxout_type'. Output debug info about the methods defined
1508 in TYPE. */
1510 static void
1511 dbxout_type_methods (tree type)
1513 /* C++: put out the method names and their parameter lists */
1514 tree methods = TYPE_METHODS (type);
1515 tree fndecl;
1516 tree last;
1518 if (methods == NULL_TREE)
1519 return;
1521 if (TREE_CODE (methods) != TREE_VEC)
1522 fndecl = methods;
1523 else if (TREE_VEC_ELT (methods, 0) != NULL_TREE)
1524 fndecl = TREE_VEC_ELT (methods, 0);
1525 else
1526 fndecl = TREE_VEC_ELT (methods, 1);
1528 while (fndecl)
1530 int need_prefix = 1;
1532 /* Group together all the methods for the same operation.
1533 These differ in the types of the arguments. */
1534 for (last = NULL_TREE;
1535 fndecl && (last == NULL_TREE || DECL_NAME (fndecl) == DECL_NAME (last));
1536 fndecl = TREE_CHAIN (fndecl))
1537 /* Output the name of the field (after overloading), as
1538 well as the name of the field before overloading, along
1539 with its parameter list */
1541 /* Skip methods that aren't FUNCTION_DECLs. (In C++, these
1542 include TEMPLATE_DECLs.) The debugger doesn't know what
1543 to do with such entities anyhow. */
1544 if (TREE_CODE (fndecl) != FUNCTION_DECL)
1545 continue;
1547 CONTIN;
1549 last = fndecl;
1551 /* Also ignore abstract methods; those are only interesting to
1552 the DWARF backends. */
1553 if (DECL_IGNORED_P (fndecl) || DECL_ABSTRACT (fndecl))
1554 continue;
1556 /* Redundantly output the plain name, since that's what gdb
1557 expects. */
1558 if (need_prefix)
1560 stabstr_I (DECL_NAME (fndecl));
1561 stabstr_S ("::");
1562 need_prefix = 0;
1565 dbxout_type (TREE_TYPE (fndecl), 0);
1566 dbxout_type_method_1 (fndecl);
1568 if (!need_prefix)
1569 stabstr_C (';');
1573 /* Emit a "range" type specification, which has the form:
1574 "r<index type>;<lower bound>;<upper bound>;".
1575 TYPE is an INTEGER_TYPE. */
1577 static void
1578 dbxout_range_type (tree type)
1580 stabstr_C ('r');
1581 if (TREE_TYPE (type))
1582 dbxout_type (TREE_TYPE (type), 0);
1583 else if (TREE_CODE (type) != INTEGER_TYPE)
1584 dbxout_type (type, 0); /* E.g. Pascal's ARRAY [BOOLEAN] of INTEGER */
1585 else
1587 /* Traditionally, we made sure 'int' was type 1, and builtin types
1588 were defined to be sub-ranges of int. Unfortunately, this
1589 does not allow us to distinguish true sub-ranges from integer
1590 types. So, instead we define integer (non-sub-range) types as
1591 sub-ranges of themselves. This matters for Chill. If this isn't
1592 a subrange type, then we want to define it in terms of itself.
1593 However, in C, this may be an anonymous integer type, and we don't
1594 want to emit debug info referring to it. Just calling
1595 dbxout_type_index won't work anyways, because the type hasn't been
1596 defined yet. We make this work for both cases by checked to see
1597 whether this is a defined type, referring to it if it is, and using
1598 'int' otherwise. */
1599 if (TYPE_SYMTAB_ADDRESS (type) != 0)
1600 dbxout_type_index (type);
1601 else
1602 dbxout_type_index (integer_type_node);
1605 stabstr_C (';');
1606 if (TYPE_MIN_VALUE (type) != 0
1607 && host_integerp (TYPE_MIN_VALUE (type), 0))
1609 if (print_int_cst_bounds_in_octal_p (type))
1610 stabstr_O (TYPE_MIN_VALUE (type));
1611 else
1612 stabstr_D (tree_low_cst (TYPE_MIN_VALUE (type), 0));
1614 else
1615 stabstr_C ('0');
1617 stabstr_C (';');
1618 if (TYPE_MAX_VALUE (type) != 0
1619 && host_integerp (TYPE_MAX_VALUE (type), 0))
1621 if (print_int_cst_bounds_in_octal_p (type))
1622 stabstr_O (TYPE_MAX_VALUE (type));
1623 else
1624 stabstr_D (tree_low_cst (TYPE_MAX_VALUE (type), 0));
1625 stabstr_C (';');
1627 else
1628 stabstr_S ("-1;");
1632 /* Output a reference to a type. If the type has not yet been
1633 described in the dbx output, output its definition now.
1634 For a type already defined, just refer to its definition
1635 using the type number.
1637 If FULL is nonzero, and the type has been described only with
1638 a forward-reference, output the definition now.
1639 If FULL is zero in this case, just refer to the forward-reference
1640 using the number previously allocated. */
1642 static void
1643 dbxout_type (tree type, int full)
1645 tree tem;
1646 tree main_variant;
1647 static int anonymous_type_number = 0;
1648 bool vector_type = false;
1650 if (TREE_CODE (type) == VECTOR_TYPE)
1652 /* The frontend feeds us a representation for the vector as a struct
1653 containing an array. Pull out the array type. */
1654 type = TREE_TYPE (TYPE_FIELDS (TYPE_DEBUG_REPRESENTATION_TYPE (type)));
1655 vector_type = true;
1658 /* If there was an input error and we don't really have a type,
1659 avoid crashing and write something that is at least valid
1660 by assuming `int'. */
1661 if (type == error_mark_node)
1662 type = integer_type_node;
1663 else
1665 if (TYPE_NAME (type)
1666 && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
1667 && TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (type)))
1668 full = 0;
1671 /* Try to find the "main variant" with the same name. */
1672 if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
1673 && DECL_ORIGINAL_TYPE (TYPE_NAME (type)))
1674 main_variant = TREE_TYPE (TYPE_NAME (type));
1675 else
1676 main_variant = TYPE_MAIN_VARIANT (type);
1678 /* If we are not using extensions, stabs does not distinguish const and
1679 volatile, so there is no need to make them separate types. */
1680 if (!use_gnu_debug_info_extensions)
1681 type = main_variant;
1683 if (TYPE_SYMTAB_ADDRESS (type) == 0)
1685 /* Type has no dbx number assigned. Assign next available number. */
1686 TYPE_SYMTAB_ADDRESS (type) = next_type_number++;
1688 /* Make sure type vector is long enough to record about this type. */
1690 if (next_type_number == typevec_len)
1692 typevec
1693 = ggc_realloc (typevec, (typevec_len * 2 * sizeof typevec[0]));
1694 memset (typevec + typevec_len, 0, typevec_len * sizeof typevec[0]);
1695 typevec_len *= 2;
1698 #ifdef DBX_USE_BINCL
1699 emit_pending_bincls_if_required ();
1700 typevec[TYPE_SYMTAB_ADDRESS (type)].file_number
1701 = current_file->file_number;
1702 typevec[TYPE_SYMTAB_ADDRESS (type)].type_number
1703 = current_file->next_type_number++;
1704 #endif
1707 if (flag_debug_only_used_symbols)
1709 if ((TREE_CODE (type) == RECORD_TYPE
1710 || TREE_CODE (type) == UNION_TYPE
1711 || TREE_CODE (type) == QUAL_UNION_TYPE
1712 || TREE_CODE (type) == ENUMERAL_TYPE)
1713 && TYPE_STUB_DECL (type)
1714 && DECL_P (TYPE_STUB_DECL (type))
1715 && ! DECL_IGNORED_P (TYPE_STUB_DECL (type)))
1716 debug_queue_symbol (TYPE_STUB_DECL (type));
1717 else if (TYPE_NAME (type)
1718 && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL)
1719 debug_queue_symbol (TYPE_NAME (type));
1722 /* Output the number of this type, to refer to it. */
1723 dbxout_type_index (type);
1725 #ifdef DBX_TYPE_DEFINED
1726 if (DBX_TYPE_DEFINED (type))
1727 return;
1728 #endif
1730 /* If this type's definition has been output or is now being output,
1731 that is all. */
1733 switch (typevec[TYPE_SYMTAB_ADDRESS (type)].status)
1735 case TYPE_UNSEEN:
1736 break;
1737 case TYPE_XREF:
1738 /* If we have already had a cross reference,
1739 and either that's all we want or that's the best we could do,
1740 don't repeat the cross reference.
1741 Sun dbx crashes if we do. */
1742 if (! full || !COMPLETE_TYPE_P (type)
1743 /* No way in DBX fmt to describe a variable size. */
1744 || ! host_integerp (TYPE_SIZE (type), 1))
1745 return;
1746 break;
1747 case TYPE_DEFINED:
1748 return;
1751 #ifdef DBX_NO_XREFS
1752 /* For systems where dbx output does not allow the `=xsNAME:' syntax,
1753 leave the type-number completely undefined rather than output
1754 a cross-reference. If we have already used GNU debug info extensions,
1755 then it is OK to output a cross reference. This is necessary to get
1756 proper C++ debug output. */
1757 if ((TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE
1758 || TREE_CODE (type) == QUAL_UNION_TYPE
1759 || TREE_CODE (type) == ENUMERAL_TYPE)
1760 && ! use_gnu_debug_info_extensions)
1761 /* We must use the same test here as we use twice below when deciding
1762 whether to emit a cross-reference. */
1763 if ((TYPE_NAME (type) != 0
1764 && ! (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
1765 && DECL_IGNORED_P (TYPE_NAME (type)))
1766 && !full)
1767 || !COMPLETE_TYPE_P (type)
1768 /* No way in DBX fmt to describe a variable size. */
1769 || ! host_integerp (TYPE_SIZE (type), 1))
1771 typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_XREF;
1772 return;
1774 #endif
1776 /* Output a definition now. */
1777 stabstr_C ('=');
1779 /* Mark it as defined, so that if it is self-referent
1780 we will not get into an infinite recursion of definitions. */
1782 typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_DEFINED;
1784 /* If this type is a variant of some other, hand off. Types with
1785 different names are usefully distinguished. We only distinguish
1786 cv-qualified types if we're using extensions. */
1787 if (TYPE_READONLY (type) > TYPE_READONLY (main_variant))
1789 stabstr_C ('k');
1790 dbxout_type (build_type_variant (type, 0, TYPE_VOLATILE (type)), 0);
1791 return;
1793 else if (TYPE_VOLATILE (type) > TYPE_VOLATILE (main_variant))
1795 stabstr_C ('B');
1796 dbxout_type (build_type_variant (type, TYPE_READONLY (type), 0), 0);
1797 return;
1799 else if (main_variant != TYPE_MAIN_VARIANT (type))
1801 if (flag_debug_only_used_symbols)
1803 tree orig_type = DECL_ORIGINAL_TYPE (TYPE_NAME (type));
1805 if ((TREE_CODE (orig_type) == RECORD_TYPE
1806 || TREE_CODE (orig_type) == UNION_TYPE
1807 || TREE_CODE (orig_type) == QUAL_UNION_TYPE
1808 || TREE_CODE (orig_type) == ENUMERAL_TYPE)
1809 && TYPE_STUB_DECL (orig_type)
1810 && ! DECL_IGNORED_P (TYPE_STUB_DECL (orig_type)))
1811 debug_queue_symbol (TYPE_STUB_DECL (orig_type));
1813 /* 'type' is a typedef; output the type it refers to. */
1814 dbxout_type (DECL_ORIGINAL_TYPE (TYPE_NAME (type)), 0);
1815 return;
1817 /* else continue. */
1819 switch (TREE_CODE (type))
1821 case VOID_TYPE:
1822 case LANG_TYPE:
1823 /* For a void type, just define it as itself; i.e., "5=5".
1824 This makes us consider it defined
1825 without saying what it is. The debugger will make it
1826 a void type when the reference is seen, and nothing will
1827 ever override that default. */
1828 dbxout_type_index (type);
1829 break;
1831 case INTEGER_TYPE:
1832 if (type == char_type_node && ! TYPE_UNSIGNED (type))
1834 /* Output the type `char' as a subrange of itself!
1835 I don't understand this definition, just copied it
1836 from the output of pcc.
1837 This used to use `r2' explicitly and we used to
1838 take care to make sure that `char' was type number 2. */
1839 stabstr_C ('r');
1840 dbxout_type_index (type);
1841 stabstr_S (";0;127;");
1844 /* If this is a subtype of another integer type, always prefer to
1845 write it as a subtype. */
1846 else if (TREE_TYPE (type) != 0
1847 && TREE_CODE (TREE_TYPE (type)) == INTEGER_TYPE)
1849 /* If the size is non-standard, say what it is if we can use
1850 GDB extensions. */
1852 if (use_gnu_debug_info_extensions
1853 && TYPE_PRECISION (type) != TYPE_PRECISION (integer_type_node))
1855 stabstr_S ("@s");
1856 stabstr_D (TYPE_PRECISION (type));
1857 stabstr_C (';');
1860 dbxout_range_type (type);
1863 else
1865 /* If the size is non-standard, say what it is if we can use
1866 GDB extensions. */
1868 if (use_gnu_debug_info_extensions
1869 && TYPE_PRECISION (type) != TYPE_PRECISION (integer_type_node))
1871 stabstr_S ("@s");
1872 stabstr_D (TYPE_PRECISION (type));
1873 stabstr_C (';');
1876 if (print_int_cst_bounds_in_octal_p (type))
1878 stabstr_C ('r');
1880 /* If this type derives from another type, output type index of
1881 parent type. This is particularly important when parent type
1882 is an enumerated type, because not generating the parent type
1883 index would transform the definition of this enumerated type
1884 into a plain unsigned type. */
1885 if (TREE_TYPE (type) != 0)
1886 dbxout_type_index (TREE_TYPE (type));
1887 else
1888 dbxout_type_index (type);
1890 stabstr_C (';');
1891 stabstr_O (TYPE_MIN_VALUE (type));
1892 stabstr_C (';');
1893 stabstr_O (TYPE_MAX_VALUE (type));
1894 stabstr_C (';');
1897 else
1898 /* Output other integer types as subranges of `int'. */
1899 dbxout_range_type (type);
1902 break;
1904 case REAL_TYPE:
1905 /* This used to say `r1' and we used to take care
1906 to make sure that `int' was type number 1. */
1907 stabstr_C ('r');
1908 dbxout_type_index (integer_type_node);
1909 stabstr_C (';');
1910 stabstr_D (int_size_in_bytes (type));
1911 stabstr_S (";0;");
1912 break;
1914 case CHAR_TYPE:
1915 if (use_gnu_debug_info_extensions)
1917 stabstr_S ("@s");
1918 stabstr_D (BITS_PER_UNIT * int_size_in_bytes (type));
1919 stabstr_S (";-20;");
1921 else
1923 /* Output the type `char' as a subrange of itself.
1924 That is what pcc seems to do. */
1925 stabstr_C ('r');
1926 dbxout_type_index (char_type_node);
1927 stabstr_S (TYPE_UNSIGNED (type) ? ";0;255;" : ";0;127;");
1929 break;
1931 case BOOLEAN_TYPE:
1932 if (use_gnu_debug_info_extensions)
1934 stabstr_S ("@s");
1935 stabstr_D (BITS_PER_UNIT * int_size_in_bytes (type));
1936 stabstr_S (";-16;");
1938 else /* Define as enumeral type (False, True) */
1939 stabstr_S ("eFalse:0,True:1,;");
1940 break;
1942 case COMPLEX_TYPE:
1943 /* Differs from the REAL_TYPE by its new data type number.
1944 R3 is NF_COMPLEX. We don't try to use any of the other NF_*
1945 codes since gdb doesn't care anyway. */
1947 if (TREE_CODE (TREE_TYPE (type)) == REAL_TYPE)
1949 stabstr_S ("R3;");
1950 stabstr_D (2 * int_size_in_bytes (TREE_TYPE (type)));
1951 stabstr_S (";0;");
1953 else
1955 /* Output a complex integer type as a structure,
1956 pending some other way to do it. */
1957 stabstr_C ('s');
1958 stabstr_D (int_size_in_bytes (type));
1960 stabstr_S ("real:");
1961 dbxout_type (TREE_TYPE (type), 0);
1962 stabstr_S (",0,");
1963 stabstr_D (TYPE_PRECISION (TREE_TYPE (type)));
1965 stabstr_S (";imag:");
1966 dbxout_type (TREE_TYPE (type), 0);
1967 stabstr_C (',');
1968 stabstr_D (TYPE_PRECISION (TREE_TYPE (type)));
1969 stabstr_C (',');
1970 stabstr_D (TYPE_PRECISION (TREE_TYPE (type)));
1971 stabstr_S (";;");
1973 break;
1975 case ARRAY_TYPE:
1976 /* Make arrays of packed bits look like bitstrings for chill. */
1977 if (TYPE_PACKED (type) && use_gnu_debug_info_extensions)
1979 stabstr_S ("@s");
1980 stabstr_D (BITS_PER_UNIT * int_size_in_bytes (type));
1981 stabstr_S (";@S;S");
1982 dbxout_type (TYPE_DOMAIN (type), 0);
1983 break;
1986 if (use_gnu_debug_info_extensions && vector_type)
1987 stabstr_S ("@V;");
1989 /* Output "a" followed by a range type definition
1990 for the index type of the array
1991 followed by a reference to the target-type.
1992 ar1;0;N;M for a C array of type M and size N+1. */
1993 /* Check if a character string type, which in Chill is
1994 different from an array of characters. */
1995 if (TYPE_STRING_FLAG (type) && use_gnu_debug_info_extensions)
1997 stabstr_S ("@S;");
1999 tem = TYPE_DOMAIN (type);
2000 if (tem == NULL)
2002 stabstr_S ("ar");
2003 dbxout_type_index (integer_type_node);
2004 stabstr_S (";0;-1;");
2006 else
2008 stabstr_C ('a');
2009 dbxout_range_type (tem);
2012 dbxout_type (TREE_TYPE (type), 0);
2013 break;
2015 case RECORD_TYPE:
2016 case UNION_TYPE:
2017 case QUAL_UNION_TYPE:
2019 tree binfo = TYPE_BINFO (type);
2021 /* Output a structure type. We must use the same test here as we
2022 use in the DBX_NO_XREFS case above. */
2023 if ((TYPE_NAME (type) != 0
2024 && ! (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
2025 && DECL_IGNORED_P (TYPE_NAME (type)))
2026 && !full)
2027 || !COMPLETE_TYPE_P (type)
2028 /* No way in DBX fmt to describe a variable size. */
2029 || ! host_integerp (TYPE_SIZE (type), 1))
2031 /* If the type is just a cross reference, output one
2032 and mark the type as partially described.
2033 If it later becomes defined, we will output
2034 its real definition.
2035 If the type has a name, don't nest its definition within
2036 another type's definition; instead, output an xref
2037 and let the definition come when the name is defined. */
2038 stabstr_S ((TREE_CODE (type) == RECORD_TYPE) ? "xs" : "xu");
2039 if (TYPE_NAME (type) != 0)
2040 dbxout_type_name (type);
2041 else
2043 stabstr_S ("$$");
2044 stabstr_D (anonymous_type_number++);
2047 stabstr_C (':');
2048 typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_XREF;
2049 break;
2052 /* Identify record or union, and print its size. */
2053 stabstr_C ((TREE_CODE (type) == RECORD_TYPE) ? 's' : 'u');
2054 stabstr_D (int_size_in_bytes (type));
2056 if (binfo)
2058 int i;
2059 tree child;
2060 VEC(tree,gc) *accesses = BINFO_BASE_ACCESSES (binfo);
2062 if (use_gnu_debug_info_extensions)
2064 if (BINFO_N_BASE_BINFOS (binfo))
2066 stabstr_C ('!');
2067 stabstr_U (BINFO_N_BASE_BINFOS (binfo));
2068 stabstr_C (',');
2071 for (i = 0; BINFO_BASE_ITERATE (binfo, i, child); i++)
2073 tree access = (accesses ? VEC_index (tree, accesses, i)
2074 : access_public_node);
2076 if (use_gnu_debug_info_extensions)
2078 stabstr_C (BINFO_VIRTUAL_P (child) ? '1' : '0');
2079 stabstr_C (access == access_public_node ? '2' :
2080 access == access_protected_node
2081 ? '1' :'0');
2082 if (BINFO_VIRTUAL_P (child)
2083 && (strcmp (lang_hooks.name, "GNU C++") == 0
2084 || strcmp (lang_hooks.name, "GNU Objective-C++") == 0))
2085 /* For a virtual base, print the (negative)
2086 offset within the vtable where we must look
2087 to find the necessary adjustment. */
2088 stabstr_D
2089 (tree_low_cst (BINFO_VPTR_FIELD (child), 0)
2090 * BITS_PER_UNIT);
2091 else
2092 stabstr_D (tree_low_cst (BINFO_OFFSET (child), 0)
2093 * BITS_PER_UNIT);
2094 stabstr_C (',');
2095 dbxout_type (BINFO_TYPE (child), 0);
2096 stabstr_C (';');
2098 else
2100 /* Print out the base class information with
2101 fields which have the same names at the types
2102 they hold. */
2103 dbxout_type_name (BINFO_TYPE (child));
2104 stabstr_C (':');
2105 dbxout_type (BINFO_TYPE (child), full);
2106 stabstr_C (',');
2107 stabstr_D (tree_low_cst (BINFO_OFFSET (child), 0)
2108 * BITS_PER_UNIT);
2109 stabstr_C (',');
2110 stabstr_D
2111 (tree_low_cst (TYPE_SIZE (BINFO_TYPE (child)), 0)
2112 * BITS_PER_UNIT);
2113 stabstr_C (';');
2119 /* Write out the field declarations. */
2120 dbxout_type_fields (type);
2121 if (use_gnu_debug_info_extensions && TYPE_METHODS (type) != NULL_TREE)
2123 dbxout_type_methods (type);
2126 stabstr_C (';');
2128 if (use_gnu_debug_info_extensions && TREE_CODE (type) == RECORD_TYPE
2129 /* Avoid the ~ if we don't really need it--it confuses dbx. */
2130 && TYPE_VFIELD (type))
2133 /* We need to write out info about what field this class
2134 uses as its "main" vtable pointer field, because if this
2135 field is inherited from a base class, GDB cannot necessarily
2136 figure out which field it's using in time. */
2137 stabstr_S ("~%");
2138 dbxout_type (DECL_FCONTEXT (TYPE_VFIELD (type)), 0);
2139 stabstr_C (';');
2141 break;
2143 case ENUMERAL_TYPE:
2144 /* We must use the same test here as we use in the DBX_NO_XREFS case
2145 above. We simplify it a bit since an enum will never have a variable
2146 size. */
2147 if ((TYPE_NAME (type) != 0
2148 && ! (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
2149 && DECL_IGNORED_P (TYPE_NAME (type)))
2150 && !full)
2151 || !COMPLETE_TYPE_P (type))
2153 stabstr_S ("xe");
2154 dbxout_type_name (type);
2155 typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_XREF;
2156 stabstr_C (':');
2157 return;
2159 if (use_gnu_debug_info_extensions
2160 && TYPE_PRECISION (type) != TYPE_PRECISION (integer_type_node))
2162 stabstr_S ("@s");
2163 stabstr_D (TYPE_PRECISION (type));
2164 stabstr_C (';');
2167 stabstr_C ('e');
2168 for (tem = TYPE_VALUES (type); tem; tem = TREE_CHAIN (tem))
2170 stabstr_I (TREE_PURPOSE (tem));
2171 stabstr_C (':');
2173 if (TREE_INT_CST_HIGH (TREE_VALUE (tem)) == 0)
2174 stabstr_D (TREE_INT_CST_LOW (TREE_VALUE (tem)));
2175 else if (TREE_INT_CST_HIGH (TREE_VALUE (tem)) == -1
2176 && (HOST_WIDE_INT) TREE_INT_CST_LOW (TREE_VALUE (tem)) < 0)
2177 stabstr_D (TREE_INT_CST_LOW (TREE_VALUE (tem)));
2178 else
2179 stabstr_O (TREE_VALUE (tem));
2181 stabstr_C (',');
2182 if (TREE_CHAIN (tem) != 0)
2183 CONTIN;
2186 stabstr_C (';');
2187 break;
2189 case POINTER_TYPE:
2190 stabstr_C ('*');
2191 dbxout_type (TREE_TYPE (type), 0);
2192 break;
2194 case METHOD_TYPE:
2195 if (use_gnu_debug_info_extensions)
2197 stabstr_C ('#');
2199 /* Write the argument types out longhand. */
2200 dbxout_type (TYPE_METHOD_BASETYPE (type), 0);
2201 stabstr_C (',');
2202 dbxout_type (TREE_TYPE (type), 0);
2203 dbxout_args (TYPE_ARG_TYPES (type));
2204 stabstr_C (';');
2206 else
2207 /* Treat it as a function type. */
2208 dbxout_type (TREE_TYPE (type), 0);
2209 break;
2211 case OFFSET_TYPE:
2212 if (use_gnu_debug_info_extensions)
2214 stabstr_C ('@');
2215 dbxout_type (TYPE_OFFSET_BASETYPE (type), 0);
2216 stabstr_C (',');
2217 dbxout_type (TREE_TYPE (type), 0);
2219 else
2220 /* Should print as an int, because it is really just an offset. */
2221 dbxout_type (integer_type_node, 0);
2222 break;
2224 case REFERENCE_TYPE:
2225 if (use_gnu_debug_info_extensions)
2227 stabstr_C ('&');
2229 else
2230 stabstr_C ('*');
2231 dbxout_type (TREE_TYPE (type), 0);
2232 break;
2234 case FUNCTION_TYPE:
2235 stabstr_C ('f');
2236 dbxout_type (TREE_TYPE (type), 0);
2237 break;
2239 default:
2240 gcc_unreachable ();
2244 /* Return nonzero if the given type represents an integer whose bounds
2245 should be printed in octal format. */
2247 static bool
2248 print_int_cst_bounds_in_octal_p (tree type)
2250 /* If we can use GDB extensions and the size is wider than a long
2251 (the size used by GDB to read them) or we may have trouble writing
2252 the bounds the usual way, write them in octal. Note the test is for
2253 the *target's* size of "long", not that of the host. The host test
2254 is just to make sure we can write it out in case the host wide int
2255 is narrower than the target "long".
2257 For unsigned types, we use octal if they are the same size or larger.
2258 This is because we print the bounds as signed decimal, and hence they
2259 can't span same size unsigned types. */
2261 if (use_gnu_debug_info_extensions
2262 && TYPE_MIN_VALUE (type) != 0
2263 && TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST
2264 && TYPE_MAX_VALUE (type) != 0
2265 && TREE_CODE (TYPE_MAX_VALUE (type)) == INTEGER_CST
2266 && (TYPE_PRECISION (type) > TYPE_PRECISION (integer_type_node)
2267 || ((TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node))
2268 && TYPE_UNSIGNED (type))
2269 || TYPE_PRECISION (type) > HOST_BITS_PER_WIDE_INT
2270 || (TYPE_PRECISION (type) == HOST_BITS_PER_WIDE_INT
2271 && TYPE_UNSIGNED (type))))
2272 return TRUE;
2273 else
2274 return FALSE;
2277 /* Output the name of type TYPE, with no punctuation.
2278 Such names can be set up either by typedef declarations
2279 or by struct, enum and union tags. */
2281 static void
2282 dbxout_type_name (tree type)
2284 tree t = TYPE_NAME (type);
2286 gcc_assert (t);
2287 switch (TREE_CODE (t))
2289 case IDENTIFIER_NODE:
2290 break;
2291 case TYPE_DECL:
2292 t = DECL_NAME (t);
2293 break;
2294 default:
2295 gcc_unreachable ();
2298 stabstr_I (t);
2301 /* Output leading leading struct or class names needed for qualifying
2302 type whose scope is limited to a struct or class. */
2304 static void
2305 dbxout_class_name_qualifiers (tree decl)
2307 tree context = decl_type_context (decl);
2309 if (context != NULL_TREE
2310 && TREE_CODE(context) == RECORD_TYPE
2311 && TYPE_NAME (context) != 0
2312 && (TREE_CODE (TYPE_NAME (context)) == IDENTIFIER_NODE
2313 || (DECL_NAME (TYPE_NAME (context)) != 0)))
2315 tree name = TYPE_NAME (context);
2317 if (TREE_CODE (name) == TYPE_DECL)
2319 dbxout_class_name_qualifiers (name);
2320 name = DECL_NAME (name);
2322 stabstr_I (name);
2323 stabstr_S ("::");
2327 /* This is a specialized subset of expand_expr for use by dbxout_symbol in
2328 evaluating DECL_VALUE_EXPR. In particular, we stop if we find decls that
2329 havn't been expanded, or if the expression is getting so complex we won't
2330 be able to represent it in stabs anyway. Returns NULL on failure. */
2332 static rtx
2333 dbxout_expand_expr (tree expr)
2335 switch (TREE_CODE (expr))
2337 case VAR_DECL:
2338 case PARM_DECL:
2339 if (DECL_HAS_VALUE_EXPR_P (expr))
2340 return dbxout_expand_expr (DECL_VALUE_EXPR (expr));
2341 /* FALLTHRU */
2343 case CONST_DECL:
2344 case RESULT_DECL:
2345 return DECL_RTL_IF_SET (expr);
2347 case INTEGER_CST:
2348 return expand_expr (expr, NULL_RTX, VOIDmode, EXPAND_INITIALIZER);
2350 case COMPONENT_REF:
2351 case ARRAY_REF:
2352 case ARRAY_RANGE_REF:
2353 case BIT_FIELD_REF:
2355 enum machine_mode mode;
2356 HOST_WIDE_INT bitsize, bitpos;
2357 tree offset, tem;
2358 int volatilep = 0, unsignedp = 0;
2359 rtx x;
2361 tem = get_inner_reference (expr, &bitsize, &bitpos, &offset,
2362 &mode, &unsignedp, &volatilep, true);
2364 x = dbxout_expand_expr (tem);
2365 if (x == NULL || !MEM_P (x))
2366 return NULL;
2367 if (offset != NULL)
2369 if (!host_integerp (offset, 0))
2370 return NULL;
2371 x = adjust_address_nv (x, mode, tree_low_cst (offset, 0));
2373 if (bitpos != 0)
2374 x = adjust_address_nv (x, mode, bitpos / BITS_PER_UNIT);
2376 return x;
2379 default:
2380 return NULL;
2384 /* Output a .stabs for the symbol defined by DECL,
2385 which must be a ..._DECL node in the normal namespace.
2386 It may be a CONST_DECL, a FUNCTION_DECL, a PARM_DECL or a VAR_DECL.
2387 LOCAL is nonzero if the scope is less than the entire file.
2388 Return 1 if a stabs might have been emitted. */
2391 dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED)
2393 tree type = TREE_TYPE (decl);
2394 tree context = NULL_TREE;
2395 int result = 0;
2396 rtx decl_rtl;
2398 /* "Intercept" dbxout_symbol() calls like we do all debug_hooks. */
2399 ++debug_nesting;
2401 /* Ignore nameless syms, but don't ignore type tags. */
2403 if ((DECL_NAME (decl) == 0 && TREE_CODE (decl) != TYPE_DECL)
2404 || DECL_IGNORED_P (decl))
2405 DBXOUT_DECR_NESTING_AND_RETURN (0);
2407 /* If we are to generate only the symbols actually used then such
2408 symbol nodes are flagged with TREE_USED. Ignore any that
2409 aren't flaged as TREE_USED. */
2411 if (flag_debug_only_used_symbols
2412 && (!TREE_USED (decl)
2413 && (TREE_CODE (decl) != VAR_DECL || !DECL_INITIAL (decl))))
2414 DBXOUT_DECR_NESTING_AND_RETURN (0);
2416 /* If dbxout_init has not yet run, queue this symbol for later. */
2417 if (!typevec)
2419 preinit_symbols = tree_cons (0, decl, preinit_symbols);
2420 DBXOUT_DECR_NESTING_AND_RETURN (0);
2423 if (flag_debug_only_used_symbols)
2425 tree t;
2427 /* We now have a used symbol. We need to generate the info for
2428 the symbol's type in addition to the symbol itself. These
2429 type symbols are queued to be generated after were done with
2430 the symbol itself (otherwise they would fight over the
2431 stabstr obstack).
2433 Note, because the TREE_TYPE(type) might be something like a
2434 pointer to a named type we need to look for the first name
2435 we see following the TREE_TYPE chain. */
2437 t = type;
2438 while (POINTER_TYPE_P (t))
2439 t = TREE_TYPE (t);
2441 /* RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE, and ENUMERAL_TYPE
2442 need special treatment. The TYPE_STUB_DECL field in these
2443 types generally represents the tag name type we want to
2444 output. In addition there could be a typedef type with
2445 a different name. In that case we also want to output
2446 that. */
2448 if (TREE_CODE (t) == RECORD_TYPE
2449 || TREE_CODE (t) == UNION_TYPE
2450 || TREE_CODE (t) == QUAL_UNION_TYPE
2451 || TREE_CODE (t) == ENUMERAL_TYPE)
2453 if (TYPE_STUB_DECL (t)
2454 && TYPE_STUB_DECL (t) != decl
2455 && DECL_P (TYPE_STUB_DECL (t))
2456 && ! DECL_IGNORED_P (TYPE_STUB_DECL (t)))
2458 debug_queue_symbol (TYPE_STUB_DECL (t));
2459 if (TYPE_NAME (t)
2460 && TYPE_NAME (t) != TYPE_STUB_DECL (t)
2461 && TYPE_NAME (t) != decl
2462 && DECL_P (TYPE_NAME (t)))
2463 debug_queue_symbol (TYPE_NAME (t));
2466 else if (TYPE_NAME (t)
2467 && TYPE_NAME (t) != decl
2468 && DECL_P (TYPE_NAME (t)))
2469 debug_queue_symbol (TYPE_NAME (t));
2472 emit_pending_bincls_if_required ();
2474 switch (TREE_CODE (decl))
2476 case CONST_DECL:
2477 /* Enum values are defined by defining the enum type. */
2478 break;
2480 case FUNCTION_DECL:
2481 decl_rtl = DECL_RTL_IF_SET (decl);
2482 if (!decl_rtl)
2483 DBXOUT_DECR_NESTING_AND_RETURN (0);
2484 if (DECL_EXTERNAL (decl))
2485 break;
2486 /* Don't mention a nested function under its parent. */
2487 context = decl_function_context (decl);
2488 if (context == current_function_decl)
2489 break;
2490 /* Don't mention an inline instance of a nested function. */
2491 if (context && DECL_FROM_INLINE (decl))
2492 break;
2493 if (!MEM_P (decl_rtl)
2494 || GET_CODE (XEXP (decl_rtl, 0)) != SYMBOL_REF)
2495 break;
2497 dbxout_begin_complex_stabs ();
2498 stabstr_I (DECL_ASSEMBLER_NAME (decl));
2499 stabstr_S (TREE_PUBLIC (decl) ? ":F" : ":f");
2500 result = 1;
2502 if (TREE_TYPE (type))
2503 dbxout_type (TREE_TYPE (type), 0);
2504 else
2505 dbxout_type (void_type_node, 0);
2507 /* For a nested function, when that function is compiled,
2508 mention the containing function name
2509 as well as (since dbx wants it) our own assembler-name. */
2510 if (context != 0)
2512 stabstr_C (',');
2513 stabstr_I (DECL_ASSEMBLER_NAME (decl));
2514 stabstr_C (',');
2515 stabstr_I (DECL_NAME (context));
2518 dbxout_finish_complex_stabs (decl, N_FUN, XEXP (decl_rtl, 0), 0, 0);
2519 break;
2521 case TYPE_DECL:
2522 /* Don't output the same typedef twice.
2523 And don't output what language-specific stuff doesn't want output. */
2524 if (TREE_ASM_WRITTEN (decl) || TYPE_DECL_SUPPRESS_DEBUG (decl))
2525 DBXOUT_DECR_NESTING_AND_RETURN (0);
2527 /* Don't output typedefs for types with magic type numbers (XCOFF). */
2528 #ifdef DBX_ASSIGN_FUNDAMENTAL_TYPE_NUMBER
2530 int fundamental_type_number =
2531 DBX_ASSIGN_FUNDAMENTAL_TYPE_NUMBER (decl);
2533 if (fundamental_type_number != 0)
2535 TREE_ASM_WRITTEN (decl) = 1;
2536 TYPE_SYMTAB_ADDRESS (TREE_TYPE (decl)) = fundamental_type_number;
2537 DBXOUT_DECR_NESTING_AND_RETURN (0);
2540 #endif
2541 FORCE_TEXT;
2542 result = 1;
2544 int tag_needed = 1;
2545 int did_output = 0;
2547 if (DECL_NAME (decl))
2549 /* Nonzero means we must output a tag as well as a typedef. */
2550 tag_needed = 0;
2552 /* Handle the case of a C++ structure or union
2553 where the TYPE_NAME is a TYPE_DECL
2554 which gives both a typedef name and a tag. */
2555 /* dbx requires the tag first and the typedef second. */
2556 if ((TREE_CODE (type) == RECORD_TYPE
2557 || TREE_CODE (type) == UNION_TYPE
2558 || TREE_CODE (type) == QUAL_UNION_TYPE)
2559 && TYPE_NAME (type) == decl
2560 && !use_gnu_debug_info_extensions
2561 && !TREE_ASM_WRITTEN (TYPE_NAME (type))
2562 /* Distinguish the implicit typedefs of C++
2563 from explicit ones that might be found in C. */
2564 && DECL_ARTIFICIAL (decl)
2565 /* Do not generate a tag for incomplete records. */
2566 && COMPLETE_TYPE_P (type)
2567 /* Do not generate a tag for records of variable size,
2568 since this type can not be properly described in the
2569 DBX format, and it confuses some tools such as objdump. */
2570 && host_integerp (TYPE_SIZE (type), 1))
2572 tree name = TYPE_NAME (type);
2573 if (TREE_CODE (name) == TYPE_DECL)
2574 name = DECL_NAME (name);
2576 dbxout_begin_complex_stabs ();
2577 stabstr_I (name);
2578 stabstr_S (":T");
2579 dbxout_type (type, 1);
2580 dbxout_finish_complex_stabs (0, DBX_TYPE_DECL_STABS_CODE,
2581 0, 0, 0);
2584 dbxout_begin_complex_stabs ();
2586 /* Output leading class/struct qualifiers. */
2587 if (use_gnu_debug_info_extensions)
2588 dbxout_class_name_qualifiers (decl);
2590 /* Output typedef name. */
2591 stabstr_I (DECL_NAME (decl));
2592 stabstr_C (':');
2594 /* Short cut way to output a tag also. */
2595 if ((TREE_CODE (type) == RECORD_TYPE
2596 || TREE_CODE (type) == UNION_TYPE
2597 || TREE_CODE (type) == QUAL_UNION_TYPE)
2598 && TYPE_NAME (type) == decl
2599 /* Distinguish the implicit typedefs of C++
2600 from explicit ones that might be found in C. */
2601 && DECL_ARTIFICIAL (decl))
2603 if (use_gnu_debug_info_extensions)
2605 stabstr_C ('T');
2606 TREE_ASM_WRITTEN (TYPE_NAME (type)) = 1;
2610 stabstr_C ('t');
2611 dbxout_type (type, 1);
2612 dbxout_finish_complex_stabs (decl, DBX_TYPE_DECL_STABS_CODE,
2613 0, 0, 0);
2614 did_output = 1;
2617 /* Don't output a tag if this is an incomplete type. This prevents
2618 the sun4 Sun OS 4.x dbx from crashing. */
2620 if (tag_needed && TYPE_NAME (type) != 0
2621 && (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE
2622 || (DECL_NAME (TYPE_NAME (type)) != 0))
2623 && COMPLETE_TYPE_P (type)
2624 && !TREE_ASM_WRITTEN (TYPE_NAME (type)))
2626 /* For a TYPE_DECL with no name, but the type has a name,
2627 output a tag.
2628 This is what represents `struct foo' with no typedef. */
2629 /* In C++, the name of a type is the corresponding typedef.
2630 In C, it is an IDENTIFIER_NODE. */
2631 tree name = TYPE_NAME (type);
2632 if (TREE_CODE (name) == TYPE_DECL)
2633 name = DECL_NAME (name);
2635 dbxout_begin_complex_stabs ();
2636 stabstr_I (name);
2637 stabstr_S (":T");
2638 dbxout_type (type, 1);
2639 dbxout_finish_complex_stabs (0, DBX_TYPE_DECL_STABS_CODE, 0, 0, 0);
2640 did_output = 1;
2643 /* If an enum type has no name, it cannot be referred to, but
2644 we must output it anyway, to record the enumeration
2645 constants. */
2647 if (!did_output && TREE_CODE (type) == ENUMERAL_TYPE)
2649 dbxout_begin_complex_stabs ();
2650 /* Some debuggers fail when given NULL names, so give this a
2651 harmless name of " " (Why not "(anon)"?). */
2652 stabstr_S (" :T");
2653 dbxout_type (type, 1);
2654 dbxout_finish_complex_stabs (0, DBX_TYPE_DECL_STABS_CODE, 0, 0, 0);
2657 /* Prevent duplicate output of a typedef. */
2658 TREE_ASM_WRITTEN (decl) = 1;
2659 break;
2662 case PARM_DECL:
2663 /* Parm decls go in their own separate chains
2664 and are output by dbxout_reg_parms and dbxout_parms. */
2665 gcc_unreachable ();
2667 case RESULT_DECL:
2668 case VAR_DECL:
2669 /* Don't mention a variable that is external.
2670 Let the file that defines it describe it. */
2671 if (DECL_EXTERNAL (decl))
2672 break;
2674 /* If the variable is really a constant
2675 and not written in memory, inform the debugger.
2677 ??? Why do we skip emitting the type and location in this case? */
2678 if (TREE_STATIC (decl) && TREE_READONLY (decl)
2679 && DECL_INITIAL (decl) != 0
2680 && host_integerp (DECL_INITIAL (decl), 0)
2681 && ! TREE_ASM_WRITTEN (decl)
2682 && (DECL_CONTEXT (decl) == NULL_TREE
2683 || TREE_CODE (DECL_CONTEXT (decl)) == BLOCK
2684 || TREE_CODE (DECL_CONTEXT (decl)) == NAMESPACE_DECL)
2685 && TREE_PUBLIC (decl) == 0)
2687 /* The sun4 assembler does not grok this. */
2689 if (TREE_CODE (TREE_TYPE (decl)) == INTEGER_TYPE
2690 || TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE)
2692 HOST_WIDE_INT ival = TREE_INT_CST_LOW (DECL_INITIAL (decl));
2694 dbxout_begin_complex_stabs ();
2695 dbxout_symbol_name (decl, NULL, 'c');
2696 stabstr_S ("=i");
2697 stabstr_D (ival);
2698 dbxout_finish_complex_stabs (0, N_LSYM, 0, 0, 0);
2699 DBXOUT_DECR_NESTING;
2700 return 1;
2702 else
2703 break;
2705 /* else it is something we handle like a normal variable. */
2707 decl_rtl = dbxout_expand_expr (decl);
2708 if (!decl_rtl)
2709 DBXOUT_DECR_NESTING_AND_RETURN (0);
2711 decl_rtl = eliminate_regs (decl_rtl, 0, NULL_RTX);
2712 #ifdef LEAF_REG_REMAP
2713 if (current_function_uses_only_leaf_regs)
2714 leaf_renumber_regs_insn (decl_rtl);
2715 #endif
2717 result = dbxout_symbol_location (decl, type, 0, decl_rtl);
2718 break;
2720 default:
2721 break;
2723 DBXOUT_DECR_NESTING;
2724 return result;
2727 /* Output the stab for DECL, a VAR_DECL, RESULT_DECL or PARM_DECL.
2728 Add SUFFIX to its name, if SUFFIX is not 0.
2729 Describe the variable as residing in HOME
2730 (usually HOME is DECL_RTL (DECL), but not always).
2731 Returns 1 if the stab was really emitted. */
2733 static int
2734 dbxout_symbol_location (tree decl, tree type, const char *suffix, rtx home)
2736 int letter = 0;
2737 STAB_CODE_TYPE code;
2738 rtx addr = 0;
2739 int number = 0;
2740 int regno = -1;
2742 /* Don't mention a variable at all
2743 if it was completely optimized into nothingness.
2745 If the decl was from an inline function, then its rtl
2746 is not identically the rtl that was used in this
2747 particular compilation. */
2748 if (GET_CODE (home) == SUBREG)
2750 rtx value = home;
2752 while (GET_CODE (value) == SUBREG)
2753 value = SUBREG_REG (value);
2754 if (REG_P (value))
2756 if (REGNO (value) >= FIRST_PSEUDO_REGISTER)
2757 return 0;
2759 home = alter_subreg (&home);
2761 if (REG_P (home))
2763 regno = REGNO (home);
2764 if (regno >= FIRST_PSEUDO_REGISTER)
2765 return 0;
2768 /* The kind-of-variable letter depends on where
2769 the variable is and on the scope of its name:
2770 G and N_GSYM for static storage and global scope,
2771 S for static storage and file scope,
2772 V for static storage and local scope,
2773 for those two, use N_LCSYM if data is in bss segment,
2774 N_STSYM if in data segment, N_FUN otherwise.
2775 (We used N_FUN originally, then changed to N_STSYM
2776 to please GDB. However, it seems that confused ld.
2777 Now GDB has been fixed to like N_FUN, says Kingdon.)
2778 no letter at all, and N_LSYM, for auto variable,
2779 r and N_RSYM for register variable. */
2781 if (MEM_P (home) && GET_CODE (XEXP (home, 0)) == SYMBOL_REF)
2783 if (TREE_PUBLIC (decl))
2785 letter = 'G';
2786 code = N_GSYM;
2788 else
2790 addr = XEXP (home, 0);
2792 letter = decl_function_context (decl) ? 'V' : 'S';
2794 /* Some ports can transform a symbol ref into a label ref,
2795 because the symbol ref is too far away and has to be
2796 dumped into a constant pool. Alternatively, the symbol
2797 in the constant pool might be referenced by a different
2798 symbol. */
2799 if (GET_CODE (addr) == SYMBOL_REF
2800 && CONSTANT_POOL_ADDRESS_P (addr))
2802 bool marked;
2803 rtx tmp = get_pool_constant_mark (addr, &marked);
2805 if (GET_CODE (tmp) == SYMBOL_REF)
2807 addr = tmp;
2808 if (CONSTANT_POOL_ADDRESS_P (addr))
2809 get_pool_constant_mark (addr, &marked);
2810 else
2811 marked = true;
2813 else if (GET_CODE (tmp) == LABEL_REF)
2815 addr = tmp;
2816 marked = true;
2819 /* If all references to the constant pool were optimized
2820 out, we just ignore the symbol. */
2821 if (!marked)
2822 return 0;
2825 /* This should be the same condition as in assemble_variable, but
2826 we don't have access to dont_output_data here. So, instead,
2827 we rely on the fact that error_mark_node initializers always
2828 end up in bss for C++ and never end up in bss for C. */
2829 if (DECL_INITIAL (decl) == 0
2830 || (!strcmp (lang_hooks.name, "GNU C++")
2831 && DECL_INITIAL (decl) == error_mark_node))
2832 code = N_LCSYM;
2833 else if (DECL_IN_TEXT_SECTION (decl))
2834 /* This is not quite right, but it's the closest
2835 of all the codes that Unix defines. */
2836 code = DBX_STATIC_CONST_VAR_CODE;
2837 else
2839 /* Ultrix `as' seems to need this. */
2840 #ifdef DBX_STATIC_STAB_DATA_SECTION
2841 data_section ();
2842 #endif
2843 code = N_STSYM;
2847 else if (regno >= 0)
2849 letter = 'r';
2850 code = N_RSYM;
2851 number = DBX_REGISTER_NUMBER (regno);
2853 else if (MEM_P (home)
2854 && (MEM_P (XEXP (home, 0))
2855 || (REG_P (XEXP (home, 0))
2856 && REGNO (XEXP (home, 0)) != HARD_FRAME_POINTER_REGNUM
2857 && REGNO (XEXP (home, 0)) != STACK_POINTER_REGNUM
2858 #if ARG_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
2859 && REGNO (XEXP (home, 0)) != ARG_POINTER_REGNUM
2860 #endif
2862 /* If the value is indirect by memory or by a register
2863 that isn't the frame pointer
2864 then it means the object is variable-sized and address through
2865 that register or stack slot. DBX has no way to represent this
2866 so all we can do is output the variable as a pointer.
2867 If it's not a parameter, ignore it. */
2869 if (REG_P (XEXP (home, 0)))
2871 letter = 'r';
2872 code = N_RSYM;
2873 if (REGNO (XEXP (home, 0)) >= FIRST_PSEUDO_REGISTER)
2874 return 0;
2875 number = DBX_REGISTER_NUMBER (REGNO (XEXP (home, 0)));
2877 else
2879 code = N_LSYM;
2880 /* RTL looks like (MEM (MEM (PLUS (REG...) (CONST_INT...)))).
2881 We want the value of that CONST_INT. */
2882 number = DEBUGGER_AUTO_OFFSET (XEXP (XEXP (home, 0), 0));
2885 /* Effectively do build_pointer_type, but don't cache this type,
2886 since it might be temporary whereas the type it points to
2887 might have been saved for inlining. */
2888 /* Don't use REFERENCE_TYPE because dbx can't handle that. */
2889 type = make_node (POINTER_TYPE);
2890 TREE_TYPE (type) = TREE_TYPE (decl);
2892 else if (MEM_P (home)
2893 && REG_P (XEXP (home, 0)))
2895 code = N_LSYM;
2896 number = DEBUGGER_AUTO_OFFSET (XEXP (home, 0));
2898 else if (MEM_P (home)
2899 && GET_CODE (XEXP (home, 0)) == PLUS
2900 && GET_CODE (XEXP (XEXP (home, 0), 1)) == CONST_INT)
2902 code = N_LSYM;
2903 /* RTL looks like (MEM (PLUS (REG...) (CONST_INT...)))
2904 We want the value of that CONST_INT. */
2905 number = DEBUGGER_AUTO_OFFSET (XEXP (home, 0));
2907 else if (MEM_P (home)
2908 && GET_CODE (XEXP (home, 0)) == CONST)
2910 /* Handle an obscure case which can arise when optimizing and
2911 when there are few available registers. (This is *always*
2912 the case for i386/i486 targets). The RTL looks like
2913 (MEM (CONST ...)) even though this variable is a local `auto'
2914 or a local `register' variable. In effect, what has happened
2915 is that the reload pass has seen that all assignments and
2916 references for one such a local variable can be replaced by
2917 equivalent assignments and references to some static storage
2918 variable, thereby avoiding the need for a register. In such
2919 cases we're forced to lie to debuggers and tell them that
2920 this variable was itself `static'. */
2921 code = N_LCSYM;
2922 letter = 'V';
2923 addr = XEXP (XEXP (home, 0), 0);
2925 else if (GET_CODE (home) == CONCAT)
2927 tree subtype;
2929 /* If TYPE is not a COMPLEX_TYPE (it might be a RECORD_TYPE,
2930 for example), then there is no easy way to figure out
2931 what SUBTYPE should be. So, we give up. */
2932 if (TREE_CODE (type) != COMPLEX_TYPE)
2933 return 0;
2935 subtype = TREE_TYPE (type);
2937 /* If the variable's storage is in two parts,
2938 output each as a separate stab with a modified name. */
2939 if (WORDS_BIG_ENDIAN)
2940 dbxout_symbol_location (decl, subtype, "$imag", XEXP (home, 0));
2941 else
2942 dbxout_symbol_location (decl, subtype, "$real", XEXP (home, 0));
2944 if (WORDS_BIG_ENDIAN)
2945 dbxout_symbol_location (decl, subtype, "$real", XEXP (home, 1));
2946 else
2947 dbxout_symbol_location (decl, subtype, "$imag", XEXP (home, 1));
2948 return 1;
2950 else
2951 /* Address might be a MEM, when DECL is a variable-sized object.
2952 Or it might be const0_rtx, meaning previous passes
2953 want us to ignore this variable. */
2954 return 0;
2956 /* Ok, start a symtab entry and output the variable name. */
2957 emit_pending_bincls_if_required ();
2958 FORCE_TEXT;
2960 #ifdef DBX_STATIC_BLOCK_START
2961 DBX_STATIC_BLOCK_START (asm_out_file, code);
2962 #endif
2964 dbxout_begin_complex_stabs_noforcetext ();
2965 dbxout_symbol_name (decl, suffix, letter);
2966 dbxout_type (type, 0);
2967 dbxout_finish_complex_stabs (decl, code, addr, 0, number);
2969 #ifdef DBX_STATIC_BLOCK_END
2970 DBX_STATIC_BLOCK_END (asm_out_file, code);
2971 #endif
2972 return 1;
2975 /* Output the symbol name of DECL for a stabs, with suffix SUFFIX.
2976 Then output LETTER to indicate the kind of location the symbol has. */
2978 static void
2979 dbxout_symbol_name (tree decl, const char *suffix, int letter)
2981 tree name;
2983 if (DECL_CONTEXT (decl)
2984 && (TYPE_P (DECL_CONTEXT (decl))
2985 || TREE_CODE (DECL_CONTEXT (decl)) == NAMESPACE_DECL))
2986 /* One slight hitch: if this is a VAR_DECL which is a class member
2987 or a namespace member, we must put out the mangled name instead of the
2988 DECL_NAME. Note also that static member (variable) names DO NOT begin
2989 with underscores in .stabs directives. */
2990 name = DECL_ASSEMBLER_NAME (decl);
2991 else
2992 /* ...but if we're function-local, we don't want to include the junk
2993 added by ASM_FORMAT_PRIVATE_NAME. */
2994 name = DECL_NAME (decl);
2996 if (name)
2997 stabstr_I (name);
2998 else
2999 stabstr_S ("(anon)");
3001 if (suffix)
3002 stabstr_S (suffix);
3003 stabstr_C (':');
3004 if (letter)
3005 stabstr_C (letter);
3008 /* Output definitions of all the decls in a chain. Return nonzero if
3009 anything was output */
3012 dbxout_syms (tree syms)
3014 int result = 0;
3015 while (syms)
3017 result += dbxout_symbol (syms, 1);
3018 syms = TREE_CHAIN (syms);
3020 return result;
3023 /* The following two functions output definitions of function parameters.
3024 Each parameter gets a definition locating it in the parameter list.
3025 Each parameter that is a register variable gets a second definition
3026 locating it in the register.
3028 Printing or argument lists in gdb uses the definitions that
3029 locate in the parameter list. But reference to the variable in
3030 expressions uses preferentially the definition as a register. */
3032 /* Output definitions, referring to storage in the parmlist,
3033 of all the parms in PARMS, which is a chain of PARM_DECL nodes. */
3035 void
3036 dbxout_parms (tree parms)
3038 ++debug_nesting;
3039 emit_pending_bincls_if_required ();
3041 for (; parms; parms = TREE_CHAIN (parms))
3042 if (DECL_NAME (parms)
3043 && TREE_TYPE (parms) != error_mark_node
3044 && DECL_RTL_SET_P (parms)
3045 && DECL_INCOMING_RTL (parms))
3047 tree eff_type;
3048 char letter;
3049 STAB_CODE_TYPE code;
3050 int number;
3052 /* Perform any necessary register eliminations on the parameter's rtl,
3053 so that the debugging output will be accurate. */
3054 DECL_INCOMING_RTL (parms)
3055 = eliminate_regs (DECL_INCOMING_RTL (parms), 0, NULL_RTX);
3056 SET_DECL_RTL (parms, eliminate_regs (DECL_RTL (parms), 0, NULL_RTX));
3057 #ifdef LEAF_REG_REMAP
3058 if (current_function_uses_only_leaf_regs)
3060 leaf_renumber_regs_insn (DECL_INCOMING_RTL (parms));
3061 leaf_renumber_regs_insn (DECL_RTL (parms));
3063 #endif
3065 if (PARM_PASSED_IN_MEMORY (parms))
3067 rtx inrtl = XEXP (DECL_INCOMING_RTL (parms), 0);
3069 /* ??? Here we assume that the parm address is indexed
3070 off the frame pointer or arg pointer.
3071 If that is not true, we produce meaningless results,
3072 but do not crash. */
3073 if (GET_CODE (inrtl) == PLUS
3074 && GET_CODE (XEXP (inrtl, 1)) == CONST_INT)
3075 number = INTVAL (XEXP (inrtl, 1));
3076 else
3077 number = 0;
3079 code = N_PSYM;
3080 number = DEBUGGER_ARG_OFFSET (number, inrtl);
3081 letter = 'p';
3083 /* It is quite tempting to use TREE_TYPE (parms) instead
3084 of DECL_ARG_TYPE (parms) for the eff_type, so that gcc
3085 reports the actual type of the parameter, rather than
3086 the promoted type. This certainly makes GDB's life
3087 easier, at least for some ports. The change is a bad
3088 idea however, since GDB expects to be able access the
3089 type without performing any conversions. So for
3090 example, if we were passing a float to an unprototyped
3091 function, gcc will store a double on the stack, but if
3092 we emit a stab saying the type is a float, then gdb
3093 will only read in a single value, and this will produce
3094 an erroneous value. */
3095 eff_type = DECL_ARG_TYPE (parms);
3097 else if (REG_P (DECL_RTL (parms)))
3099 rtx best_rtl;
3101 /* Parm passed in registers and lives in registers or nowhere. */
3102 code = DBX_REGPARM_STABS_CODE;
3103 letter = DBX_REGPARM_STABS_LETTER;
3105 /* For parms passed in registers, it is better to use the
3106 declared type of the variable, not the type it arrived in. */
3107 eff_type = TREE_TYPE (parms);
3109 /* If parm lives in a register, use that register; pretend
3110 the parm was passed there. It would be more consistent
3111 to describe the register where the parm was passed, but
3112 in practice that register usually holds something else.
3113 If the parm lives nowhere, use the register where it
3114 was passed. */
3115 if (REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
3116 best_rtl = DECL_RTL (parms);
3117 else
3118 best_rtl = DECL_INCOMING_RTL (parms);
3120 number = DBX_REGISTER_NUMBER (REGNO (best_rtl));
3122 else if (MEM_P (DECL_RTL (parms))
3123 && REG_P (XEXP (DECL_RTL (parms), 0))
3124 && REGNO (XEXP (DECL_RTL (parms), 0)) != HARD_FRAME_POINTER_REGNUM
3125 && REGNO (XEXP (DECL_RTL (parms), 0)) != STACK_POINTER_REGNUM
3126 #if ARG_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
3127 && REGNO (XEXP (DECL_RTL (parms), 0)) != ARG_POINTER_REGNUM
3128 #endif
3131 /* Parm was passed via invisible reference.
3132 That is, its address was passed in a register.
3133 Output it as if it lived in that register.
3134 The debugger will know from the type
3135 that it was actually passed by invisible reference. */
3137 code = DBX_REGPARM_STABS_CODE;
3139 /* GDB likes this marked with a special letter. */
3140 letter = (use_gnu_debug_info_extensions
3141 ? 'a' : DBX_REGPARM_STABS_LETTER);
3142 eff_type = TREE_TYPE (parms);
3144 /* DECL_RTL looks like (MEM (REG...). Get the register number.
3145 If it is an unallocated pseudo-reg, then use the register where
3146 it was passed instead.
3147 ??? Why is DBX_REGISTER_NUMBER not used here? */
3149 if (REGNO (XEXP (DECL_RTL (parms), 0)) < FIRST_PSEUDO_REGISTER)
3150 number = REGNO (XEXP (DECL_RTL (parms), 0));
3151 else
3152 number = REGNO (DECL_INCOMING_RTL (parms));
3154 else if (MEM_P (DECL_RTL (parms))
3155 && MEM_P (XEXP (DECL_RTL (parms), 0)))
3157 /* Parm was passed via invisible reference, with the reference
3158 living on the stack. DECL_RTL looks like
3159 (MEM (MEM (PLUS (REG ...) (CONST_INT ...)))) or it
3160 could look like (MEM (MEM (REG))). */
3162 code = N_PSYM;
3163 letter = 'v';
3164 eff_type = TREE_TYPE (parms);
3166 if (!REG_P (XEXP (XEXP (DECL_RTL (parms), 0), 0)))
3167 number = INTVAL (XEXP (XEXP (XEXP (DECL_RTL (parms), 0), 0), 1));
3168 else
3169 number = 0;
3171 number = DEBUGGER_ARG_OFFSET (number,
3172 XEXP (XEXP (DECL_RTL (parms), 0), 0));
3174 else if (MEM_P (DECL_RTL (parms))
3175 && XEXP (DECL_RTL (parms), 0) != const0_rtx
3176 /* ??? A constant address for a parm can happen
3177 when the reg it lives in is equiv to a constant in memory.
3178 Should make this not happen, after 2.4. */
3179 && ! CONSTANT_P (XEXP (DECL_RTL (parms), 0)))
3181 /* Parm was passed in registers but lives on the stack. */
3183 code = N_PSYM;
3184 letter = 'p';
3185 eff_type = TREE_TYPE (parms);
3187 /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))),
3188 in which case we want the value of that CONST_INT,
3189 or (MEM (REG ...)),
3190 in which case we use a value of zero. */
3191 if (!REG_P (XEXP (DECL_RTL (parms), 0)))
3192 number = INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1));
3193 else
3194 number = 0;
3196 /* Make a big endian correction if the mode of the type of the
3197 parameter is not the same as the mode of the rtl. */
3198 if (BYTES_BIG_ENDIAN
3199 && TYPE_MODE (TREE_TYPE (parms)) != GET_MODE (DECL_RTL (parms))
3200 && GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (parms))) < UNITS_PER_WORD)
3201 number += (GET_MODE_SIZE (GET_MODE (DECL_RTL (parms)))
3202 - GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (parms))));
3204 else
3205 /* ??? We don't know how to represent this argument. */
3206 continue;
3208 dbxout_begin_complex_stabs ();
3210 if (DECL_NAME (parms))
3212 stabstr_I (DECL_NAME (parms));
3213 stabstr_C (':');
3215 else
3216 stabstr_S ("(anon):");
3217 stabstr_C (letter);
3218 dbxout_type (eff_type, 0);
3219 dbxout_finish_complex_stabs (parms, code, 0, 0, number);
3221 DBXOUT_DECR_NESTING;
3224 /* Output definitions for the places where parms live during the function,
3225 when different from where they were passed, when the parms were passed
3226 in memory.
3228 It is not useful to do this for parms passed in registers
3229 that live during the function in different registers, because it is
3230 impossible to look in the passed register for the passed value,
3231 so we use the within-the-function register to begin with.
3233 PARMS is a chain of PARM_DECL nodes. */
3235 void
3236 dbxout_reg_parms (tree parms)
3238 ++debug_nesting;
3240 for (; parms; parms = TREE_CHAIN (parms))
3241 if (DECL_NAME (parms) && PARM_PASSED_IN_MEMORY (parms))
3243 /* Report parms that live in registers during the function
3244 but were passed in memory. */
3245 if (REG_P (DECL_RTL (parms))
3246 && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
3247 dbxout_symbol_location (parms, TREE_TYPE (parms),
3248 0, DECL_RTL (parms));
3249 else if (GET_CODE (DECL_RTL (parms)) == CONCAT)
3250 dbxout_symbol_location (parms, TREE_TYPE (parms),
3251 0, DECL_RTL (parms));
3252 /* Report parms that live in memory but not where they were passed. */
3253 else if (MEM_P (DECL_RTL (parms))
3254 && ! rtx_equal_p (DECL_RTL (parms), DECL_INCOMING_RTL (parms)))
3255 dbxout_symbol_location (parms, TREE_TYPE (parms),
3256 0, DECL_RTL (parms));
3258 DBXOUT_DECR_NESTING;
3261 /* Given a chain of ..._TYPE nodes (as come in a parameter list),
3262 output definitions of those names, in raw form */
3264 static void
3265 dbxout_args (tree args)
3267 while (args)
3269 stabstr_C (',');
3270 dbxout_type (TREE_VALUE (args), 0);
3271 args = TREE_CHAIN (args);
3275 /* Subroutine of dbxout_block. Emit an N_LBRAC stab referencing LABEL.
3276 BEGIN_LABEL is the name of the beginning of the function, which may
3277 be required. */
3278 static void
3279 dbx_output_lbrac (const char *label,
3280 const char *begin_label ATTRIBUTE_UNUSED)
3282 #ifdef DBX_OUTPUT_LBRAC
3283 DBX_OUTPUT_LBRAC (asm_out_file, label);
3284 #else
3285 dbxout_begin_stabn (N_LBRAC);
3286 if (DBX_BLOCKS_FUNCTION_RELATIVE)
3287 dbxout_stab_value_label_diff (label, begin_label);
3288 else
3289 dbxout_stab_value_label (label);
3290 #endif
3293 /* Subroutine of dbxout_block. Emit an N_RBRAC stab referencing LABEL.
3294 BEGIN_LABEL is the name of the beginning of the function, which may
3295 be required. */
3296 static void
3297 dbx_output_rbrac (const char *label,
3298 const char *begin_label ATTRIBUTE_UNUSED)
3300 #ifdef DBX_OUTPUT_RBRAC
3301 DBX_OUTPUT_RBRAC (asm_out_file, label);
3302 #else
3303 dbxout_begin_stabn (N_RBRAC);
3304 if (DBX_BLOCKS_FUNCTION_RELATIVE)
3305 dbxout_stab_value_label_diff (label, begin_label);
3306 else
3307 dbxout_stab_value_label (label);
3308 #endif
3311 /* Output everything about a symbol block (a BLOCK node
3312 that represents a scope level),
3313 including recursive output of contained blocks.
3315 BLOCK is the BLOCK node.
3316 DEPTH is its depth within containing symbol blocks.
3317 ARGS is usually zero; but for the outermost block of the
3318 body of a function, it is a chain of PARM_DECLs for the function parameters.
3319 We output definitions of all the register parms
3320 as if they were local variables of that block.
3322 If -g1 was used, we count blocks just the same, but output nothing
3323 except for the outermost block.
3325 Actually, BLOCK may be several blocks chained together.
3326 We handle them all in sequence. */
3328 static void
3329 dbxout_block (tree block, int depth, tree args)
3331 const char *begin_label
3332 = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
3334 while (block)
3336 /* Ignore blocks never expanded or otherwise marked as real. */
3337 if (TREE_USED (block) && TREE_ASM_WRITTEN (block))
3339 int did_output;
3340 int blocknum = BLOCK_NUMBER (block);
3342 /* In dbx format, the syms of a block come before the N_LBRAC.
3343 If nothing is output, we don't need the N_LBRAC, either. */
3344 did_output = 0;
3345 if (debug_info_level != DINFO_LEVEL_TERSE || depth == 0)
3346 did_output = dbxout_syms (BLOCK_VARS (block));
3347 if (args)
3348 dbxout_reg_parms (args);
3350 /* Now output an N_LBRAC symbol to represent the beginning of
3351 the block. Use the block's tree-walk order to generate
3352 the assembler symbols LBBn and LBEn
3353 that final will define around the code in this block. */
3354 if (did_output)
3356 char buf[20];
3357 const char *scope_start;
3359 if (depth == 0)
3360 /* The outermost block doesn't get LBB labels; use
3361 the function symbol. */
3362 scope_start = begin_label;
3363 else
3365 ASM_GENERATE_INTERNAL_LABEL (buf, "LBB", blocknum);
3366 scope_start = buf;
3369 if (BLOCK_HANDLER_BLOCK (block))
3371 /* A catch block. Must precede N_LBRAC. */
3372 tree decl = BLOCK_VARS (block);
3373 while (decl)
3375 dbxout_begin_complex_stabs ();
3376 stabstr_I (DECL_NAME (decl));
3377 stabstr_S (":C1");
3378 dbxout_finish_complex_stabs (0, N_CATCH, 0,
3379 scope_start, 0);
3380 decl = TREE_CHAIN (decl);
3383 dbx_output_lbrac (scope_start, begin_label);
3386 /* Output the subblocks. */
3387 dbxout_block (BLOCK_SUBBLOCKS (block), depth + 1, NULL_TREE);
3389 /* Refer to the marker for the end of the block. */
3390 if (did_output)
3392 char buf[100];
3393 if (depth == 0)
3394 /* The outermost block doesn't get LBE labels;
3395 use the "scope" label which will be emitted
3396 by dbxout_function_end. */
3397 ASM_GENERATE_INTERNAL_LABEL (buf, "Lscope", scope_labelno);
3398 else
3399 ASM_GENERATE_INTERNAL_LABEL (buf, "LBE", blocknum);
3401 dbx_output_rbrac (buf, begin_label);
3404 block = BLOCK_CHAIN (block);
3408 /* Output the information about a function and its arguments and result.
3409 Usually this follows the function's code,
3410 but on some systems, it comes before. */
3412 #if defined (DBX_DEBUGGING_INFO)
3413 static void
3414 dbxout_begin_function (tree decl)
3416 int saved_tree_used1;
3418 if (DECL_IGNORED_P (decl))
3419 return;
3421 saved_tree_used1 = TREE_USED (decl);
3422 TREE_USED (decl) = 1;
3423 if (DECL_NAME (DECL_RESULT (decl)) != 0)
3425 int saved_tree_used2 = TREE_USED (DECL_RESULT (decl));
3426 TREE_USED (DECL_RESULT (decl)) = 1;
3427 dbxout_symbol (decl, 0);
3428 TREE_USED (DECL_RESULT (decl)) = saved_tree_used2;
3430 else
3431 dbxout_symbol (decl, 0);
3432 TREE_USED (decl) = saved_tree_used1;
3434 dbxout_parms (DECL_ARGUMENTS (decl));
3435 if (DECL_NAME (DECL_RESULT (decl)) != 0)
3436 dbxout_symbol (DECL_RESULT (decl), 1);
3438 #endif /* DBX_DEBUGGING_INFO */
3440 #endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */
3442 #include "gt-dbxout.h"