Mark ChangeLog
[official-gcc.git] / gcc / dbxout.c
blobe55780351051f2d26dce6e4dbcc45b74160b739d
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, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, 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 /* Nonzero if we have actually used any of the GDB extensions
246 to the debugging format. The idea is that we use them for the
247 first time only if there's a strong reason, but once we have done that,
248 we use them whenever convenient. */
250 static GTY(()) int have_used_extensions = 0;
252 /* Number for the next N_SOL filename stabs label. The number 0 is reserved
253 for the N_SO filename stabs label. */
255 static GTY(()) int source_label_number = 1;
257 /* Last source file name mentioned in a NOTE insn. */
259 static GTY(()) const char *lastfile;
261 /* Used by PCH machinery to detect if 'lastfile' should be reset to
262 base_input_file. */
263 static GTY(()) int lastfile_is_base;
265 /* Typical USG systems don't have stab.h, and they also have
266 no use for DBX-format debugging info. */
268 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
270 #ifdef DBX_USE_BINCL
271 /* If zero then there is no pending BINCL. */
272 static int pending_bincls = 0;
273 #endif
275 /* The original input file name. */
276 static const char *base_input_file;
278 #ifdef DEBUG_SYMS_TEXT
279 #define FORCE_TEXT function_section (current_function_decl);
280 #else
281 #define FORCE_TEXT
282 #endif
284 #include "gstab.h"
286 #define STAB_CODE_TYPE enum __stab_debug_code
288 /* 1 if PARM is passed to this function in memory. */
290 #define PARM_PASSED_IN_MEMORY(PARM) \
291 (MEM_P (DECL_INCOMING_RTL (PARM)))
293 /* A C expression for the integer offset value of an automatic variable
294 (N_LSYM) having address X (an RTX). */
295 #ifndef DEBUGGER_AUTO_OFFSET
296 #define DEBUGGER_AUTO_OFFSET(X) \
297 (GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0)
298 #endif
300 /* A C expression for the integer offset value of an argument (N_PSYM)
301 having address X (an RTX). The nominal offset is OFFSET. */
302 #ifndef DEBUGGER_ARG_OFFSET
303 #define DEBUGGER_ARG_OFFSET(OFFSET, X) (OFFSET)
304 #endif
306 /* This obstack holds the stab string currently being constructed. We
307 build it up here, then write it out, so we can split long lines up
308 properly (see dbxout_finish_complex_stabs). */
309 static struct obstack stabstr_ob;
310 static size_t stabstr_last_contin_point;
312 #ifdef DBX_USE_BINCL
313 static void emit_bincl_stab (const char *c);
314 static void emit_pending_bincls (void);
315 #endif
316 static inline void emit_pending_bincls_if_required (void);
318 static void dbxout_init (const char *);
320 static void dbxout_finish (const char *);
321 static void dbxout_start_source_file (unsigned, const char *);
322 static void dbxout_end_source_file (unsigned);
323 static void dbxout_typedefs (tree);
324 static void dbxout_type_index (tree);
325 static void dbxout_args (tree);
326 static void dbxout_type_fields (tree);
327 static void dbxout_type_method_1 (tree);
328 static void dbxout_type_methods (tree);
329 static void dbxout_range_type (tree);
330 static void dbxout_type (tree, int);
331 static bool print_int_cst_bounds_in_octal_p (tree);
332 static void dbxout_type_name (tree);
333 static void dbxout_class_name_qualifiers (tree);
334 static int dbxout_symbol_location (tree, tree, const char *, rtx);
335 static void dbxout_symbol_name (tree, const char *, int);
336 static void dbxout_block (tree, int, tree);
337 static void dbxout_global_decl (tree);
338 static void dbxout_type_decl (tree, int);
339 static void dbxout_handle_pch (unsigned);
341 /* The debug hooks structure. */
342 #if defined (DBX_DEBUGGING_INFO)
344 static void dbxout_source_line (unsigned int, const char *);
345 static void dbxout_begin_prologue (unsigned int, const char *);
346 static void dbxout_source_file (const char *);
347 static void dbxout_function_end (tree);
348 static void dbxout_begin_function (tree);
349 static void dbxout_begin_block (unsigned, unsigned);
350 static void dbxout_end_block (unsigned, unsigned);
351 static void dbxout_function_decl (tree);
353 const struct gcc_debug_hooks dbx_debug_hooks =
355 dbxout_init,
356 dbxout_finish,
357 debug_nothing_int_charstar,
358 debug_nothing_int_charstar,
359 dbxout_start_source_file,
360 dbxout_end_source_file,
361 dbxout_begin_block,
362 dbxout_end_block,
363 debug_true_tree, /* ignore_block */
364 dbxout_source_line, /* source_line */
365 dbxout_begin_prologue, /* begin_prologue */
366 debug_nothing_int_charstar, /* end_prologue */
367 debug_nothing_int_charstar, /* end_epilogue */
368 #ifdef DBX_FUNCTION_FIRST
369 dbxout_begin_function,
370 #else
371 debug_nothing_tree, /* begin_function */
372 #endif
373 debug_nothing_int, /* end_function */
374 dbxout_function_decl,
375 dbxout_global_decl, /* global_decl */
376 dbxout_type_decl, /* type_decl */
377 debug_nothing_tree_tree, /* imported_module_or_decl */
378 debug_nothing_tree, /* deferred_inline_function */
379 debug_nothing_tree, /* outlining_inline_function */
380 debug_nothing_rtx, /* label */
381 dbxout_handle_pch, /* handle_pch */
382 debug_nothing_rtx, /* var_location */
383 0 /* start_end_main_source_file */
385 #endif /* DBX_DEBUGGING_INFO */
387 #if defined (XCOFF_DEBUGGING_INFO)
388 const struct gcc_debug_hooks xcoff_debug_hooks =
390 dbxout_init,
391 dbxout_finish,
392 debug_nothing_int_charstar,
393 debug_nothing_int_charstar,
394 dbxout_start_source_file,
395 dbxout_end_source_file,
396 xcoffout_begin_block,
397 xcoffout_end_block,
398 debug_true_tree, /* ignore_block */
399 xcoffout_source_line,
400 xcoffout_begin_prologue, /* begin_prologue */
401 debug_nothing_int_charstar, /* end_prologue */
402 xcoffout_end_epilogue,
403 debug_nothing_tree, /* begin_function */
404 xcoffout_end_function,
405 debug_nothing_tree, /* function_decl */
406 dbxout_global_decl, /* global_decl */
407 dbxout_type_decl, /* type_decl */
408 debug_nothing_tree_tree, /* imported_module_or_decl */
409 debug_nothing_tree, /* deferred_inline_function */
410 debug_nothing_tree, /* outlining_inline_function */
411 debug_nothing_rtx, /* label */
412 dbxout_handle_pch, /* handle_pch */
413 debug_nothing_rtx, /* var_location */
414 0 /* start_end_main_source_file */
416 #endif /* XCOFF_DEBUGGING_INFO */
418 /* Numeric formatting helper macro. Note that this does not handle
419 hexadecimal. */
420 #define NUMBER_FMT_LOOP(P, NUM, BASE) \
421 do \
423 int digit = NUM % BASE; \
424 NUM /= BASE; \
425 *--P = digit + '0'; \
427 while (NUM > 0)
429 /* Utility: write a decimal integer NUM to asm_out_file. */
430 void
431 dbxout_int (int num)
433 char buf[64];
434 char *p = buf + sizeof buf;
435 unsigned int unum;
437 if (num == 0)
439 putc ('0', asm_out_file);
440 return;
442 if (num < 0)
444 putc ('-', asm_out_file);
445 unum = -num;
447 else
448 unum = num;
450 NUMBER_FMT_LOOP (p, unum, 10);
452 while (p < buf + sizeof buf)
454 putc (*p, asm_out_file);
455 p++;
460 /* Primitives for emitting simple stabs directives. All other stabs
461 routines should use these functions instead of directly emitting
462 stabs. They are exported because machine-dependent code may need
463 to invoke them, e.g. in a DBX_OUTPUT_* macro whose definition
464 forwards to code in CPU.c. */
466 /* The following functions should all be called immediately after one
467 of the dbxout_begin_stab* functions (below). They write out
468 various things as the value of a stab. */
470 /* Write out a literal zero as the value of a stab. */
471 void
472 dbxout_stab_value_zero (void)
474 fputs ("0\n", asm_out_file);
477 /* Write out the label LABEL as the value of a stab. */
478 void
479 dbxout_stab_value_label (const char *label)
481 assemble_name (asm_out_file, label);
482 putc ('\n', asm_out_file);
485 /* Write out the difference of two labels, LABEL - BASE, as the value
486 of a stab. */
487 void
488 dbxout_stab_value_label_diff (const char *label, const char *base)
490 assemble_name (asm_out_file, label);
491 putc ('-', asm_out_file);
492 assemble_name (asm_out_file, base);
493 putc ('\n', asm_out_file);
496 /* Write out an internal label as the value of a stab, and immediately
497 emit that internal label. This should be used only when
498 dbxout_stabd will not work. STEM is the name stem of the label,
499 COUNTERP is a pointer to a counter variable which will be used to
500 guarantee label uniqueness. */
501 void
502 dbxout_stab_value_internal_label (const char *stem, int *counterp)
504 char label[100];
505 int counter = counterp ? (*counterp)++ : 0;
507 ASM_GENERATE_INTERNAL_LABEL (label, stem, counter);
508 dbxout_stab_value_label (label);
509 targetm.asm_out.internal_label (asm_out_file, stem, counter);
512 /* Write out the difference between BASE and an internal label as the
513 value of a stab, and immediately emit that internal label. STEM and
514 COUNTERP are as for dbxout_stab_value_internal_label. */
515 void
516 dbxout_stab_value_internal_label_diff (const char *stem, int *counterp,
517 const char *base)
519 char label[100];
520 int counter = counterp ? (*counterp)++ : 0;
522 ASM_GENERATE_INTERNAL_LABEL (label, stem, counter);
523 dbxout_stab_value_label_diff (label, base);
524 targetm.asm_out.internal_label (asm_out_file, stem, counter);
527 /* The following functions produce specific kinds of stab directives. */
529 /* Write a .stabd directive with type STYPE and desc SDESC to asm_out_file. */
530 void
531 dbxout_stabd (int stype, int sdesc)
533 fputs (ASM_STABD_OP, asm_out_file);
534 dbxout_int (stype);
535 fputs (",0,", asm_out_file);
536 dbxout_int (sdesc);
537 putc ('\n', asm_out_file);
540 /* Write a .stabn directive with type STYPE. This function stops
541 short of emitting the value field, which is the responsibility of
542 the caller (normally it will be either a symbol or the difference
543 of two symbols). */
545 void
546 dbxout_begin_stabn (int stype)
548 fputs (ASM_STABN_OP, asm_out_file);
549 dbxout_int (stype);
550 fputs (",0,0,", asm_out_file);
553 /* Write a .stabn directive with type N_SLINE and desc LINE. As above,
554 the value field is the responsibility of the caller. */
555 void
556 dbxout_begin_stabn_sline (int lineno)
558 fputs (ASM_STABN_OP, asm_out_file);
559 dbxout_int (N_SLINE);
560 fputs (",0,", asm_out_file);
561 dbxout_int (lineno);
562 putc (',', asm_out_file);
565 /* Begin a .stabs directive with string "", type STYPE, and desc and
566 other fields 0. The value field is the responsibility of the
567 caller. This function cannot be used for .stabx directives. */
568 void
569 dbxout_begin_empty_stabs (int stype)
571 fputs (ASM_STABS_OP, asm_out_file);
572 fputs ("\"\",", asm_out_file);
573 dbxout_int (stype);
574 fputs (",0,0,", asm_out_file);
577 /* Begin a .stabs directive with string STR, type STYPE, and desc 0.
578 The value field is the responsibility of the caller. */
579 void
580 dbxout_begin_simple_stabs (const char *str, int stype)
582 fputs (ASM_STABS_OP, asm_out_file);
583 output_quoted_string (asm_out_file, str);
584 putc (',', asm_out_file);
585 dbxout_int (stype);
586 fputs (",0,0,", asm_out_file);
589 /* As above but use SDESC for the desc field. */
590 void
591 dbxout_begin_simple_stabs_desc (const char *str, int stype, int sdesc)
593 fputs (ASM_STABS_OP, asm_out_file);
594 output_quoted_string (asm_out_file, str);
595 putc (',', asm_out_file);
596 dbxout_int (stype);
597 fputs (",0,", asm_out_file);
598 dbxout_int (sdesc);
599 putc (',', asm_out_file);
602 /* The next set of functions are entirely concerned with production of
603 "complex" .stabs directives: that is, .stabs directives whose
604 strings have to be constructed piecemeal. dbxout_type,
605 dbxout_symbol, etc. use these routines heavily. The string is queued
606 up in an obstack, then written out by dbxout_finish_complex_stabs, which
607 is also responsible for splitting it up if it exceeds DBX_CONTIN_LENGTH.
608 (You might think it would be more efficient to go straight to stdio
609 when DBX_CONTIN_LENGTH is 0 (i.e. no length limit) but that turns
610 out not to be the case, and anyway this needs fewer #ifdefs.) */
612 /* Begin a complex .stabs directive. If we can, write the initial
613 ASM_STABS_OP to the asm_out_file. */
615 static void
616 dbxout_begin_complex_stabs (void)
618 emit_pending_bincls_if_required ();
619 FORCE_TEXT;
620 fputs (ASM_STABS_OP, asm_out_file);
621 putc ('"', asm_out_file);
622 gcc_assert (stabstr_last_contin_point == 0);
625 /* As above, but do not force text or emit pending bincls. This is
626 used by dbxout_symbol_location, which needs to do something else. */
627 static void
628 dbxout_begin_complex_stabs_noforcetext (void)
630 fputs (ASM_STABS_OP, asm_out_file);
631 putc ('"', asm_out_file);
632 gcc_assert (stabstr_last_contin_point == 0);
635 /* Add CHR, a single character, to the string being built. */
636 #define stabstr_C(chr) obstack_1grow (&stabstr_ob, chr)
638 /* Add STR, a normal C string, to the string being built. */
639 #define stabstr_S(str) obstack_grow (&stabstr_ob, str, strlen(str))
641 /* Add the text of ID, an IDENTIFIER_NODE, to the string being built. */
642 #define stabstr_I(id) obstack_grow (&stabstr_ob, \
643 IDENTIFIER_POINTER (id), \
644 IDENTIFIER_LENGTH (id))
646 /* Add NUM, a signed decimal number, to the string being built. */
647 static void
648 stabstr_D (HOST_WIDE_INT num)
650 char buf[64];
651 char *p = buf + sizeof buf;
652 unsigned int unum;
654 if (num == 0)
656 stabstr_C ('0');
657 return;
659 if (num < 0)
661 stabstr_C ('-');
662 unum = -num;
664 else
665 unum = num;
667 NUMBER_FMT_LOOP (p, unum, 10);
669 obstack_grow (&stabstr_ob, p, (buf + sizeof buf) - p);
672 /* Add NUM, an unsigned decimal number, to the string being built. */
673 static void
674 stabstr_U (unsigned HOST_WIDE_INT num)
676 char buf[64];
677 char *p = buf + sizeof buf;
678 if (num == 0)
680 stabstr_C ('0');
681 return;
683 NUMBER_FMT_LOOP (p, num, 10);
684 obstack_grow (&stabstr_ob, p, (buf + sizeof buf) - p);
687 /* Add CST, an INTEGER_CST tree, to the string being built as an
688 unsigned octal number. This routine handles values which are
689 larger than a single HOST_WIDE_INT. */
690 static void
691 stabstr_O (tree cst)
693 unsigned HOST_WIDE_INT high = TREE_INT_CST_HIGH (cst);
694 unsigned HOST_WIDE_INT low = TREE_INT_CST_LOW (cst);
696 char buf[128];
697 char *p = buf + sizeof buf;
699 /* GDB wants constants with no extra leading "1" bits, so
700 we need to remove any sign-extension that might be
701 present. */
703 const unsigned int width = TYPE_PRECISION (TREE_TYPE (cst));
704 if (width == HOST_BITS_PER_WIDE_INT * 2)
706 else if (width > HOST_BITS_PER_WIDE_INT)
707 high &= (((HOST_WIDE_INT) 1 << (width - HOST_BITS_PER_WIDE_INT)) - 1);
708 else if (width == HOST_BITS_PER_WIDE_INT)
709 high = 0;
710 else
711 high = 0, low &= (((HOST_WIDE_INT) 1 << width) - 1);
714 /* Leading zero for base indicator. */
715 stabstr_C ('0');
717 /* If the value is zero, the base indicator will serve as the value
718 all by itself. */
719 if (high == 0 && low == 0)
720 return;
722 /* If the high half is zero, we need only print the low half normally. */
723 if (high == 0)
724 NUMBER_FMT_LOOP (p, low, 8);
725 else
727 /* When high != 0, we need to print enough zeroes from low to
728 give the digits from high their proper place-values. Hence
729 NUMBER_FMT_LOOP cannot be used. */
730 const int n_digits = HOST_BITS_PER_WIDE_INT / 3;
731 int i;
733 for (i = 1; i <= n_digits; i++)
735 unsigned int digit = low % 8;
736 low /= 8;
737 *--p = '0' + digit;
740 /* Octal digits carry exactly three bits of information. The
741 width of a HOST_WIDE_INT is not normally a multiple of three.
742 Therefore, the next digit printed probably needs to carry
743 information from both low and high. */
744 if (HOST_BITS_PER_WIDE_INT % 3 != 0)
746 const int n_leftover_bits = HOST_BITS_PER_WIDE_INT % 3;
747 const int n_bits_from_high = 3 - n_leftover_bits;
749 const unsigned HOST_WIDE_INT
750 low_mask = (((unsigned HOST_WIDE_INT)1) << n_leftover_bits) - 1;
751 const unsigned HOST_WIDE_INT
752 high_mask = (((unsigned HOST_WIDE_INT)1) << n_bits_from_high) - 1;
754 unsigned int digit;
756 /* At this point, only the bottom n_leftover_bits bits of low
757 should be set. */
758 gcc_assert (!(low & ~low_mask));
760 digit = (low | ((high & high_mask) << n_leftover_bits));
761 high >>= n_bits_from_high;
763 *--p = '0' + digit;
766 /* Now we can format high in the normal manner. However, if
767 the only bits of high that were set were handled by the
768 digit split between low and high, high will now be zero, and
769 we don't want to print extra digits in that case. */
770 if (high)
771 NUMBER_FMT_LOOP (p, high, 8);
774 obstack_grow (&stabstr_ob, p, (buf + sizeof buf) - p);
777 /* Called whenever it is safe to break a stabs string into multiple
778 .stabs directives. If the current string has exceeded the limit
779 set by DBX_CONTIN_LENGTH, mark the current position in the buffer
780 as a continuation point by inserting DBX_CONTIN_CHAR (doubled if
781 it is a backslash) and a null character. */
782 static inline void
783 stabstr_continue (void)
785 if (DBX_CONTIN_LENGTH > 0
786 && obstack_object_size (&stabstr_ob) - stabstr_last_contin_point
787 > DBX_CONTIN_LENGTH)
789 if (DBX_CONTIN_CHAR == '\\')
790 obstack_1grow (&stabstr_ob, '\\');
791 obstack_1grow (&stabstr_ob, DBX_CONTIN_CHAR);
792 obstack_1grow (&stabstr_ob, '\0');
793 stabstr_last_contin_point = obstack_object_size (&stabstr_ob);
796 #define CONTIN stabstr_continue ()
798 /* Macro subroutine of dbxout_finish_complex_stabs, which emits
799 all of the arguments to the .stabs directive after the string.
800 Overridden by xcoffout.h. CODE is the stabs code for this symbol;
801 LINE is the source line to write into the desc field (in extended
802 mode); SYM is the symbol itself.
804 ADDR, LABEL, and NUMBER are three different ways to represent the
805 stabs value field. At most one of these should be nonzero.
807 ADDR is used most of the time; it represents the value as an
808 RTL address constant.
810 LABEL is used (currently) only for N_CATCH stabs; it represents
811 the value as a string suitable for assemble_name.
813 NUMBER is used when the value is an offset from an implicit base
814 pointer (e.g. for a stack variable), or an index (e.g. for a
815 register variable). It represents the value as a decimal integer. */
817 #ifndef DBX_FINISH_STABS
818 #define DBX_FINISH_STABS(SYM, CODE, LINE, ADDR, LABEL, NUMBER) \
819 do { \
820 int line_ = use_gnu_debug_info_extensions ? LINE : 0; \
822 dbxout_int (CODE); \
823 fputs (",0,", asm_out_file); \
824 dbxout_int (line_); \
825 putc (',', asm_out_file); \
826 if (ADDR) \
827 output_addr_const (asm_out_file, ADDR); \
828 else if (LABEL) \
829 assemble_name (asm_out_file, LABEL); \
830 else \
831 dbxout_int (NUMBER); \
832 putc ('\n', asm_out_file); \
833 } while (0)
834 #endif
836 /* Finish the emission of a complex .stabs directive. When DBX_CONTIN_LENGTH
837 is zero, this has only to emit the close quote and the remainder of
838 the arguments. When it is nonzero, the string has been marshalled in
839 stabstr_ob, and this routine is responsible for breaking it up into
840 DBX_CONTIN_LENGTH-sized chunks.
842 SYM is the DECL of the symbol under consideration; it is used only
843 for its DECL_SOURCE_LINE. The other arguments are all passed directly
844 to DBX_FINISH_STABS; see above for details. */
846 static void
847 dbxout_finish_complex_stabs (tree sym, STAB_CODE_TYPE code,
848 rtx addr, const char *label, int number)
850 int line ATTRIBUTE_UNUSED;
851 char *str;
852 size_t len;
854 line = sym ? DECL_SOURCE_LINE (sym) : 0;
855 if (DBX_CONTIN_LENGTH > 0)
857 char *chunk;
858 size_t chunklen;
860 /* Nul-terminate the growing string, then get its size and
861 address. */
862 obstack_1grow (&stabstr_ob, '\0');
864 len = obstack_object_size (&stabstr_ob);
865 chunk = str = obstack_finish (&stabstr_ob);
867 /* Within the buffer are a sequence of NUL-separated strings,
868 each of which is to be written out as a separate stab
869 directive. */
870 for (;;)
872 chunklen = strlen (chunk);
873 fwrite (chunk, 1, chunklen, asm_out_file);
874 fputs ("\",", asm_out_file);
876 /* Must add an extra byte to account for the NUL separator. */
877 chunk += chunklen + 1;
878 len -= chunklen + 1;
880 /* Only put a line number on the last stab in the sequence. */
881 DBX_FINISH_STABS (sym, code, len == 0 ? line : 0,
882 addr, label, number);
883 if (len == 0)
884 break;
886 fputs (ASM_STABS_OP, asm_out_file);
887 putc ('"', asm_out_file);
889 stabstr_last_contin_point = 0;
891 else
893 /* No continuations - we can put the whole string out at once.
894 It is faster to augment the string with the close quote and
895 comma than to do a two-character fputs. */
896 obstack_grow (&stabstr_ob, "\",", 2);
897 len = obstack_object_size (&stabstr_ob);
898 str = obstack_finish (&stabstr_ob);
900 fwrite (str, 1, len, asm_out_file);
901 DBX_FINISH_STABS (sym, code, line, addr, label, number);
903 obstack_free (&stabstr_ob, str);
906 #if defined (DBX_DEBUGGING_INFO)
908 static void
909 dbxout_function_end (tree decl)
911 char lscope_label_name[100];
913 /* The Lscope label must be emitted even if we aren't doing anything
914 else; dbxout_block needs it. */
915 function_section (current_function_decl);
917 /* Convert Lscope into the appropriate format for local labels in case
918 the system doesn't insert underscores in front of user generated
919 labels. */
920 ASM_GENERATE_INTERNAL_LABEL (lscope_label_name, "Lscope", scope_labelno);
921 targetm.asm_out.internal_label (asm_out_file, "Lscope", scope_labelno);
922 scope_labelno++;
924 /* The N_FUN tag at the end of the function is a GNU extension,
925 which may be undesirable, and is unnecessary if we do not have
926 named sections. */
927 if (!use_gnu_debug_info_extensions
928 || NO_DBX_FUNCTION_END
929 || !targetm.have_named_sections
930 || DECL_IGNORED_P (decl))
931 return;
933 /* By convention, GCC will mark the end of a function with an N_FUN
934 symbol and an empty string. */
935 #ifdef DBX_OUTPUT_NFUN
936 DBX_OUTPUT_NFUN (asm_out_file, lscope_label_name, current_function_decl);
937 #else
938 dbxout_begin_empty_stabs (N_FUN);
939 dbxout_stab_value_label_diff (lscope_label_name,
940 XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));
942 #endif
944 if (!NO_DBX_BNSYM_ENSYM && !flag_debug_only_used_symbols)
945 dbxout_stabd (N_ENSYM, 0);
947 #endif /* DBX_DEBUGGING_INFO */
949 /* Get lang description for N_SO stab. */
950 static unsigned int ATTRIBUTE_UNUSED
951 get_lang_number (void)
953 const char *language_string = lang_hooks.name;
955 if (strcmp (language_string, "GNU C") == 0)
956 return N_SO_C;
957 else if (strcmp (language_string, "GNU C++") == 0)
958 return N_SO_CC;
959 else if (strcmp (language_string, "GNU F77") == 0)
960 return N_SO_FORTRAN;
961 else if (strcmp (language_string, "GNU F95") == 0)
962 return N_SO_FORTRAN90; /* CHECKME */
963 else if (strcmp (language_string, "GNU Pascal") == 0)
964 return N_SO_PASCAL;
965 else if (strcmp (language_string, "GNU Objective-C") == 0)
966 return N_SO_OBJC;
967 else
968 return 0;
972 /* At the beginning of compilation, start writing the symbol table.
973 Initialize `typevec' and output the standard data types of C. */
975 static void
976 dbxout_init (const char *input_file_name)
978 char ltext_label_name[100];
979 bool used_ltext_label_name = false;
980 tree syms = lang_hooks.decls.getdecls ();
982 typevec_len = 100;
983 typevec = ggc_calloc (typevec_len, sizeof typevec[0]);
985 /* stabstr_ob contains one string, which will be just fine with
986 1-byte alignment. */
987 obstack_specify_allocation (&stabstr_ob, 0, 1, xmalloc, free);
989 /* Convert Ltext into the appropriate format for local labels in case
990 the system doesn't insert underscores in front of user generated
991 labels. */
992 ASM_GENERATE_INTERNAL_LABEL (ltext_label_name, "Ltext", 0);
994 /* Put the current working directory in an N_SO symbol. */
995 if (use_gnu_debug_info_extensions && !NO_DBX_MAIN_SOURCE_DIRECTORY)
997 static const char *cwd;
999 if (!cwd)
1001 cwd = get_src_pwd ();
1002 if (cwd[0] == '\0')
1003 cwd = "/";
1004 else if (!IS_DIR_SEPARATOR (cwd[strlen (cwd) - 1]))
1005 cwd = concat (cwd, "/", NULL);
1007 #ifdef DBX_OUTPUT_MAIN_SOURCE_DIRECTORY
1008 DBX_OUTPUT_MAIN_SOURCE_DIRECTORY (asm_out_file, cwd);
1009 #else /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */
1010 dbxout_begin_simple_stabs_desc (cwd, N_SO, get_lang_number ());
1011 dbxout_stab_value_label (ltext_label_name);
1012 used_ltext_label_name = true;
1013 #endif /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */
1016 #ifdef DBX_OUTPUT_MAIN_SOURCE_FILENAME
1017 DBX_OUTPUT_MAIN_SOURCE_FILENAME (asm_out_file, input_file_name);
1018 #else
1019 dbxout_begin_simple_stabs_desc (input_file_name, N_SO, get_lang_number ());
1020 dbxout_stab_value_label (ltext_label_name);
1021 used_ltext_label_name = true;
1022 #endif
1024 if (used_ltext_label_name)
1026 text_section ();
1027 targetm.asm_out.internal_label (asm_out_file, "Ltext", 0);
1030 /* Emit an N_OPT stab to indicate that this file was compiled by GCC.
1031 The string used is historical. */
1032 #ifndef NO_DBX_GCC_MARKER
1033 dbxout_begin_simple_stabs ("gcc2_compiled.", N_OPT);
1034 dbxout_stab_value_zero ();
1035 #endif
1037 base_input_file = lastfile = input_file_name;
1039 next_type_number = 1;
1041 #ifdef DBX_USE_BINCL
1042 current_file = xmalloc (sizeof *current_file);
1043 current_file->next = NULL;
1044 current_file->file_number = 0;
1045 current_file->next_type_number = 1;
1046 next_file_number = 1;
1047 current_file->prev = NULL;
1048 current_file->bincl_status = BINCL_NOT_REQUIRED;
1049 current_file->pending_bincl_name = NULL;
1050 #endif
1052 /* Get all permanent types that have typedef names, and output them
1053 all, except for those already output. Some language front ends
1054 put these declarations in the top-level scope; some do not;
1055 the latter are responsible for calling debug_hooks->type_decl from
1056 their record_builtin_type function. */
1057 dbxout_typedefs (syms);
1059 if (preinit_symbols)
1061 tree t;
1062 for (t = nreverse (preinit_symbols); t; t = TREE_CHAIN (t))
1063 dbxout_symbol (TREE_VALUE (t), 0);
1064 preinit_symbols = 0;
1068 /* Output any typedef names for types described by TYPE_DECLs in SYMS. */
1070 static void
1071 dbxout_typedefs (tree syms)
1073 for (; syms != NULL_TREE; syms = TREE_CHAIN (syms))
1075 if (TREE_CODE (syms) == TYPE_DECL)
1077 tree type = TREE_TYPE (syms);
1078 if (TYPE_NAME (type)
1079 && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
1080 && COMPLETE_OR_VOID_TYPE_P (type)
1081 && ! TREE_ASM_WRITTEN (TYPE_NAME (type)))
1082 dbxout_symbol (TYPE_NAME (type), 0);
1087 #ifdef DBX_USE_BINCL
1088 /* Emit BINCL stab using given name. */
1089 static void
1090 emit_bincl_stab (const char *name)
1092 dbxout_begin_simple_stabs (name, N_BINCL);
1093 dbxout_stab_value_zero ();
1096 /* If there are pending bincls then it is time to emit all of them. */
1098 static inline void
1099 emit_pending_bincls_if_required (void)
1101 if (pending_bincls)
1102 emit_pending_bincls ();
1105 /* Emit all pending bincls. */
1107 static void
1108 emit_pending_bincls (void)
1110 struct dbx_file *f = current_file;
1112 /* Find first pending bincl. */
1113 while (f->bincl_status == BINCL_PENDING)
1114 f = f->next;
1116 /* Now emit all bincls. */
1117 f = f->prev;
1119 while (f)
1121 if (f->bincl_status == BINCL_PENDING)
1123 emit_bincl_stab (f->pending_bincl_name);
1125 /* Update file number and status. */
1126 f->file_number = next_file_number++;
1127 f->bincl_status = BINCL_PROCESSED;
1129 if (f == current_file)
1130 break;
1131 f = f->prev;
1134 /* All pending bincls have been emitted. */
1135 pending_bincls = 0;
1138 #else
1140 static inline void
1141 emit_pending_bincls_if_required (void) {}
1142 #endif
1144 /* Change to reading from a new source file. Generate a N_BINCL stab. */
1146 static void
1147 dbxout_start_source_file (unsigned int line ATTRIBUTE_UNUSED,
1148 const char *filename ATTRIBUTE_UNUSED)
1150 #ifdef DBX_USE_BINCL
1151 struct dbx_file *n = xmalloc (sizeof *n);
1153 n->next = current_file;
1154 n->next_type_number = 1;
1155 /* Do not assign file number now.
1156 Delay it until we actually emit BINCL. */
1157 n->file_number = 0;
1158 n->prev = NULL;
1159 current_file->prev = n;
1160 n->bincl_status = BINCL_PENDING;
1161 n->pending_bincl_name = filename;
1162 pending_bincls = 1;
1163 current_file = n;
1164 #endif
1167 /* Revert to reading a previous source file. Generate a N_EINCL stab. */
1169 static void
1170 dbxout_end_source_file (unsigned int line ATTRIBUTE_UNUSED)
1172 #ifdef DBX_USE_BINCL
1173 /* Emit EINCL stab only if BINCL is not pending. */
1174 if (current_file->bincl_status == BINCL_PROCESSED)
1176 dbxout_begin_stabn (N_EINCL);
1177 dbxout_stab_value_zero ();
1179 current_file->bincl_status = BINCL_NOT_REQUIRED;
1180 current_file = current_file->next;
1181 #endif
1184 /* Handle a few odd cases that occur when trying to make PCH files work. */
1186 static void
1187 dbxout_handle_pch (unsigned at_end)
1189 if (! at_end)
1191 /* When using the PCH, this file will be included, so we need to output
1192 a BINCL. */
1193 dbxout_start_source_file (0, lastfile);
1195 /* The base file when using the PCH won't be the same as
1196 the base file when it's being generated. */
1197 lastfile = NULL;
1199 else
1201 /* ... and an EINCL. */
1202 dbxout_end_source_file (0);
1204 /* Deal with cases where 'lastfile' was never actually changed. */
1205 lastfile_is_base = lastfile == NULL;
1209 #if defined (DBX_DEBUGGING_INFO)
1210 /* Output debugging info to FILE to switch to sourcefile FILENAME. */
1212 static void
1213 dbxout_source_file (const char *filename)
1215 if (lastfile == 0 && lastfile_is_base)
1217 lastfile = base_input_file;
1218 lastfile_is_base = 0;
1221 if (filename && (lastfile == 0 || strcmp (filename, lastfile)))
1223 /* Don't change section amid function. */
1224 if (current_function_decl == NULL_TREE)
1225 text_section ();
1227 dbxout_begin_simple_stabs (filename, N_SOL);
1228 dbxout_stab_value_internal_label ("Ltext", &source_label_number);
1229 lastfile = filename;
1233 /* Output N_BNSYM and line number symbol entry. */
1235 static void
1236 dbxout_begin_prologue (unsigned int lineno, const char *filename)
1238 if (use_gnu_debug_info_extensions
1239 && !NO_DBX_FUNCTION_END
1240 && !NO_DBX_BNSYM_ENSYM
1241 && !flag_debug_only_used_symbols)
1242 dbxout_stabd (N_BNSYM, 0);
1244 dbxout_source_line (lineno, filename);
1247 /* Output a line number symbol entry for source file FILENAME and line
1248 number LINENO. */
1250 static void
1251 dbxout_source_line (unsigned int lineno, const char *filename)
1253 dbxout_source_file (filename);
1255 #ifdef DBX_OUTPUT_SOURCE_LINE
1256 DBX_OUTPUT_SOURCE_LINE (asm_out_file, lineno, dbxout_source_line_counter);
1257 #else
1258 if (DBX_LINES_FUNCTION_RELATIVE)
1260 rtx begin_label = XEXP (DECL_RTL (current_function_decl), 0);
1261 dbxout_begin_stabn_sline (lineno);
1262 dbxout_stab_value_internal_label_diff ("LM", &dbxout_source_line_counter,
1263 XSTR (begin_label, 0));
1266 else
1267 dbxout_stabd (N_SLINE, lineno);
1268 #endif
1271 /* Describe the beginning of an internal block within a function. */
1273 static void
1274 dbxout_begin_block (unsigned int line ATTRIBUTE_UNUSED, unsigned int n)
1276 emit_pending_bincls_if_required ();
1277 targetm.asm_out.internal_label (asm_out_file, "LBB", n);
1280 /* Describe the end line-number of an internal block within a function. */
1282 static void
1283 dbxout_end_block (unsigned int line ATTRIBUTE_UNUSED, unsigned int n)
1285 emit_pending_bincls_if_required ();
1286 targetm.asm_out.internal_label (asm_out_file, "LBE", n);
1289 /* Output dbx data for a function definition.
1290 This includes a definition of the function name itself (a symbol),
1291 definitions of the parameters (locating them in the parameter list)
1292 and then output the block that makes up the function's body
1293 (including all the auto variables of the function). */
1295 static void
1296 dbxout_function_decl (tree decl)
1298 emit_pending_bincls_if_required ();
1299 #ifndef DBX_FUNCTION_FIRST
1300 dbxout_begin_function (decl);
1301 #endif
1302 dbxout_block (DECL_INITIAL (decl), 0, DECL_ARGUMENTS (decl));
1303 dbxout_function_end (decl);
1306 #endif /* DBX_DEBUGGING_INFO */
1308 /* Debug information for a global DECL. Called from toplev.c after
1309 compilation proper has finished. */
1310 static void
1311 dbxout_global_decl (tree decl)
1313 if (TREE_CODE (decl) == VAR_DECL && !DECL_EXTERNAL (decl))
1315 int saved_tree_used = TREE_USED (decl);
1316 TREE_USED (decl) = 1;
1317 dbxout_symbol (decl, 0);
1318 TREE_USED (decl) = saved_tree_used;
1322 /* This is just a function-type adapter; dbxout_symbol does exactly
1323 what we want but returns an int. */
1324 static void
1325 dbxout_type_decl (tree decl, int local)
1327 dbxout_symbol (decl, local);
1330 /* At the end of compilation, finish writing the symbol table.
1331 The default is to call debug_free_queue but do nothing else. */
1333 static void
1334 dbxout_finish (const char *filename ATTRIBUTE_UNUSED)
1336 #ifdef DBX_OUTPUT_MAIN_SOURCE_FILE_END
1337 DBX_OUTPUT_MAIN_SOURCE_FILE_END (asm_out_file, filename);
1338 #elif defined DBX_OUTPUT_NULL_N_SO_AT_MAIN_SOURCE_FILE_END
1340 text_section ();
1341 dbxout_begin_empty_stabs (N_SO);
1342 dbxout_stab_value_internal_label ("Letext", 0);
1344 #endif
1345 debug_free_queue ();
1348 /* Output the index of a type. */
1350 static void
1351 dbxout_type_index (tree type)
1353 #ifndef DBX_USE_BINCL
1354 stabstr_D (TYPE_SYMTAB_ADDRESS (type));
1355 #else
1356 struct typeinfo *t = &typevec[TYPE_SYMTAB_ADDRESS (type)];
1357 stabstr_C ('(');
1358 stabstr_D (t->file_number);
1359 stabstr_C (',');
1360 stabstr_D (t->type_number);
1361 stabstr_C (')');
1362 #endif
1367 /* Used in several places: evaluates to '0' for a private decl,
1368 '1' for a protected decl, '2' for a public decl. */
1369 #define DECL_ACCESSIBILITY_CHAR(DECL) \
1370 (TREE_PRIVATE (DECL) ? '0' : TREE_PROTECTED (DECL) ? '1' : '2')
1372 /* Subroutine of `dbxout_type'. Output the type fields of TYPE.
1373 This must be a separate function because anonymous unions require
1374 recursive calls. */
1376 static void
1377 dbxout_type_fields (tree type)
1379 tree tem;
1381 /* Output the name, type, position (in bits), size (in bits) of each
1382 field that we can support. */
1383 for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
1385 /* If one of the nodes is an error_mark or its type is then
1386 return early. */
1387 if (tem == error_mark_node || TREE_TYPE (tem) == error_mark_node)
1388 return;
1390 /* Omit here local type decls until we know how to support them. */
1391 if (TREE_CODE (tem) == TYPE_DECL
1392 /* Omit here the nameless fields that are used to skip bits. */
1393 || DECL_IGNORED_P (tem)
1394 /* Omit fields whose position or size are variable or too large to
1395 represent. */
1396 || (TREE_CODE (tem) == FIELD_DECL
1397 && (! host_integerp (bit_position (tem), 0)
1398 || ! DECL_SIZE (tem)
1399 || ! host_integerp (DECL_SIZE (tem), 1))))
1400 continue;
1402 else if (TREE_CODE (tem) != CONST_DECL)
1404 /* Continue the line if necessary,
1405 but not before the first field. */
1406 if (tem != TYPE_FIELDS (type))
1407 CONTIN;
1409 if (DECL_NAME (tem))
1410 stabstr_I (DECL_NAME (tem));
1411 stabstr_C (':');
1413 if (use_gnu_debug_info_extensions
1414 && (TREE_PRIVATE (tem) || TREE_PROTECTED (tem)
1415 || TREE_CODE (tem) != FIELD_DECL))
1417 have_used_extensions = 1;
1418 stabstr_C ('/');
1419 stabstr_C (DECL_ACCESSIBILITY_CHAR (tem));
1422 dbxout_type ((TREE_CODE (tem) == FIELD_DECL
1423 && DECL_BIT_FIELD_TYPE (tem))
1424 ? DECL_BIT_FIELD_TYPE (tem) : TREE_TYPE (tem), 0);
1426 if (TREE_CODE (tem) == VAR_DECL)
1428 if (TREE_STATIC (tem) && use_gnu_debug_info_extensions)
1430 tree name = DECL_ASSEMBLER_NAME (tem);
1432 have_used_extensions = 1;
1433 stabstr_C (':');
1434 stabstr_I (name);
1435 stabstr_C (';');
1437 else
1438 /* If TEM is non-static, GDB won't understand it. */
1439 stabstr_S (",0,0;");
1441 else
1443 stabstr_C (',');
1444 stabstr_D (int_bit_position (tem));
1445 stabstr_C (',');
1446 stabstr_D (tree_low_cst (DECL_SIZE (tem), 1));
1447 stabstr_C (';');
1453 /* Subroutine of `dbxout_type_methods'. Output debug info about the
1454 method described DECL. */
1456 static void
1457 dbxout_type_method_1 (tree decl)
1459 char c1 = 'A', c2;
1461 if (TREE_CODE (TREE_TYPE (decl)) == FUNCTION_TYPE)
1462 c2 = '?';
1463 else /* it's a METHOD_TYPE. */
1465 tree firstarg = TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl)));
1466 /* A for normal functions.
1467 B for `const' member functions.
1468 C for `volatile' member functions.
1469 D for `const volatile' member functions. */
1470 if (TYPE_READONLY (TREE_TYPE (firstarg)))
1471 c1 += 1;
1472 if (TYPE_VOLATILE (TREE_TYPE (firstarg)))
1473 c1 += 2;
1475 if (DECL_VINDEX (decl))
1476 c2 = '*';
1477 else
1478 c2 = '.';
1481 /* ??? Output the mangled name, which contains an encoding of the
1482 method's type signature. May not be necessary anymore. */
1483 stabstr_C (':');
1484 stabstr_I (DECL_ASSEMBLER_NAME (decl));
1485 stabstr_C (';');
1486 stabstr_C (DECL_ACCESSIBILITY_CHAR (decl));
1487 stabstr_C (c1);
1488 stabstr_C (c2);
1490 if (DECL_VINDEX (decl) && host_integerp (DECL_VINDEX (decl), 0))
1492 stabstr_D (tree_low_cst (DECL_VINDEX (decl), 0));
1493 stabstr_C (';');
1494 dbxout_type (DECL_CONTEXT (decl), 0);
1495 stabstr_C (';');
1499 /* Subroutine of `dbxout_type'. Output debug info about the methods defined
1500 in TYPE. */
1502 static void
1503 dbxout_type_methods (tree type)
1505 /* C++: put out the method names and their parameter lists */
1506 tree methods = TYPE_METHODS (type);
1507 tree fndecl;
1508 tree last;
1510 if (methods == NULL_TREE)
1511 return;
1513 if (TREE_CODE (methods) != TREE_VEC)
1514 fndecl = methods;
1515 else if (TREE_VEC_ELT (methods, 0) != NULL_TREE)
1516 fndecl = TREE_VEC_ELT (methods, 0);
1517 else
1518 fndecl = TREE_VEC_ELT (methods, 1);
1520 while (fndecl)
1522 int need_prefix = 1;
1524 /* Group together all the methods for the same operation.
1525 These differ in the types of the arguments. */
1526 for (last = NULL_TREE;
1527 fndecl && (last == NULL_TREE || DECL_NAME (fndecl) == DECL_NAME (last));
1528 fndecl = TREE_CHAIN (fndecl))
1529 /* Output the name of the field (after overloading), as
1530 well as the name of the field before overloading, along
1531 with its parameter list */
1533 /* Skip methods that aren't FUNCTION_DECLs. (In C++, these
1534 include TEMPLATE_DECLs.) The debugger doesn't know what
1535 to do with such entities anyhow. */
1536 if (TREE_CODE (fndecl) != FUNCTION_DECL)
1537 continue;
1539 CONTIN;
1541 last = fndecl;
1543 /* Also ignore abstract methods; those are only interesting to
1544 the DWARF backends. */
1545 if (DECL_IGNORED_P (fndecl) || DECL_ABSTRACT (fndecl))
1546 continue;
1548 /* Redundantly output the plain name, since that's what gdb
1549 expects. */
1550 if (need_prefix)
1552 stabstr_I (DECL_NAME (fndecl));
1553 stabstr_S ("::");
1554 need_prefix = 0;
1557 dbxout_type (TREE_TYPE (fndecl), 0);
1558 dbxout_type_method_1 (fndecl);
1560 if (!need_prefix)
1561 stabstr_C (';');
1565 /* Emit a "range" type specification, which has the form:
1566 "r<index type>;<lower bound>;<upper bound>;".
1567 TYPE is an INTEGER_TYPE. */
1569 static void
1570 dbxout_range_type (tree type)
1572 stabstr_C ('r');
1573 if (TREE_TYPE (type))
1574 dbxout_type (TREE_TYPE (type), 0);
1575 else if (TREE_CODE (type) != INTEGER_TYPE)
1576 dbxout_type (type, 0); /* E.g. Pascal's ARRAY [BOOLEAN] of INTEGER */
1577 else
1579 /* Traditionally, we made sure 'int' was type 1, and builtin types
1580 were defined to be sub-ranges of int. Unfortunately, this
1581 does not allow us to distinguish true sub-ranges from integer
1582 types. So, instead we define integer (non-sub-range) types as
1583 sub-ranges of themselves. This matters for Chill. If this isn't
1584 a subrange type, then we want to define it in terms of itself.
1585 However, in C, this may be an anonymous integer type, and we don't
1586 want to emit debug info referring to it. Just calling
1587 dbxout_type_index won't work anyways, because the type hasn't been
1588 defined yet. We make this work for both cases by checked to see
1589 whether this is a defined type, referring to it if it is, and using
1590 'int' otherwise. */
1591 if (TYPE_SYMTAB_ADDRESS (type) != 0)
1592 dbxout_type_index (type);
1593 else
1594 dbxout_type_index (integer_type_node);
1597 stabstr_C (';');
1598 if (TYPE_MIN_VALUE (type) != 0
1599 && host_integerp (TYPE_MIN_VALUE (type), 0))
1601 if (print_int_cst_bounds_in_octal_p (type))
1602 stabstr_O (TYPE_MIN_VALUE (type));
1603 else
1604 stabstr_D (tree_low_cst (TYPE_MIN_VALUE (type), 0));
1606 else
1607 stabstr_C ('0');
1609 stabstr_C (';');
1610 if (TYPE_MAX_VALUE (type) != 0
1611 && host_integerp (TYPE_MAX_VALUE (type), 0))
1613 if (print_int_cst_bounds_in_octal_p (type))
1614 stabstr_O (TYPE_MAX_VALUE (type));
1615 else
1616 stabstr_D (tree_low_cst (TYPE_MAX_VALUE (type), 0));
1617 stabstr_C (';');
1619 else
1620 stabstr_S ("-1;");
1624 /* Output a reference to a type. If the type has not yet been
1625 described in the dbx output, output its definition now.
1626 For a type already defined, just refer to its definition
1627 using the type number.
1629 If FULL is nonzero, and the type has been described only with
1630 a forward-reference, output the definition now.
1631 If FULL is zero in this case, just refer to the forward-reference
1632 using the number previously allocated. */
1634 static void
1635 dbxout_type (tree type, int full)
1637 tree tem;
1638 tree main_variant;
1639 static int anonymous_type_number = 0;
1641 if (TREE_CODE (type) == VECTOR_TYPE)
1642 /* The frontend feeds us a representation for the vector as a struct
1643 containing an array. Pull out the array type. */
1644 type = TREE_TYPE (TYPE_FIELDS (TYPE_DEBUG_REPRESENTATION_TYPE (type)));
1646 /* If there was an input error and we don't really have a type,
1647 avoid crashing and write something that is at least valid
1648 by assuming `int'. */
1649 if (type == error_mark_node)
1650 type = integer_type_node;
1651 else
1653 if (TYPE_NAME (type)
1654 && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
1655 && TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (type)))
1656 full = 0;
1659 /* Try to find the "main variant" with the same name. */
1660 if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
1661 && DECL_ORIGINAL_TYPE (TYPE_NAME (type)))
1662 main_variant = TREE_TYPE (TYPE_NAME (type));
1663 else
1664 main_variant = TYPE_MAIN_VARIANT (type);
1666 /* If we are not using extensions, stabs does not distinguish const and
1667 volatile, so there is no need to make them separate types. */
1668 if (!use_gnu_debug_info_extensions)
1669 type = main_variant;
1671 if (TYPE_SYMTAB_ADDRESS (type) == 0)
1673 /* Type has no dbx number assigned. Assign next available number. */
1674 TYPE_SYMTAB_ADDRESS (type) = next_type_number++;
1676 /* Make sure type vector is long enough to record about this type. */
1678 if (next_type_number == typevec_len)
1680 typevec
1681 = ggc_realloc (typevec, (typevec_len * 2 * sizeof typevec[0]));
1682 memset (typevec + typevec_len, 0, typevec_len * sizeof typevec[0]);
1683 typevec_len *= 2;
1686 #ifdef DBX_USE_BINCL
1687 emit_pending_bincls_if_required ();
1688 typevec[TYPE_SYMTAB_ADDRESS (type)].file_number
1689 = current_file->file_number;
1690 typevec[TYPE_SYMTAB_ADDRESS (type)].type_number
1691 = current_file->next_type_number++;
1692 #endif
1695 if (flag_debug_only_used_symbols)
1697 if ((TREE_CODE (type) == RECORD_TYPE
1698 || TREE_CODE (type) == UNION_TYPE
1699 || TREE_CODE (type) == QUAL_UNION_TYPE
1700 || TREE_CODE (type) == ENUMERAL_TYPE)
1701 && TYPE_STUB_DECL (type)
1702 && DECL_P (TYPE_STUB_DECL (type))
1703 && ! DECL_IGNORED_P (TYPE_STUB_DECL (type)))
1704 debug_queue_symbol (TYPE_STUB_DECL (type));
1705 else if (TYPE_NAME (type)
1706 && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL)
1707 debug_queue_symbol (TYPE_NAME (type));
1710 /* Output the number of this type, to refer to it. */
1711 dbxout_type_index (type);
1713 #ifdef DBX_TYPE_DEFINED
1714 if (DBX_TYPE_DEFINED (type))
1715 return;
1716 #endif
1718 /* If this type's definition has been output or is now being output,
1719 that is all. */
1721 switch (typevec[TYPE_SYMTAB_ADDRESS (type)].status)
1723 case TYPE_UNSEEN:
1724 break;
1725 case TYPE_XREF:
1726 /* If we have already had a cross reference,
1727 and either that's all we want or that's the best we could do,
1728 don't repeat the cross reference.
1729 Sun dbx crashes if we do. */
1730 if (! full || !COMPLETE_TYPE_P (type)
1731 /* No way in DBX fmt to describe a variable size. */
1732 || ! host_integerp (TYPE_SIZE (type), 1))
1733 return;
1734 break;
1735 case TYPE_DEFINED:
1736 return;
1739 #ifdef DBX_NO_XREFS
1740 /* For systems where dbx output does not allow the `=xsNAME:' syntax,
1741 leave the type-number completely undefined rather than output
1742 a cross-reference. If we have already used GNU debug info extensions,
1743 then it is OK to output a cross reference. This is necessary to get
1744 proper C++ debug output. */
1745 if ((TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE
1746 || TREE_CODE (type) == QUAL_UNION_TYPE
1747 || TREE_CODE (type) == ENUMERAL_TYPE)
1748 && ! use_gnu_debug_info_extensions)
1749 /* We must use the same test here as we use twice below when deciding
1750 whether to emit a cross-reference. */
1751 if ((TYPE_NAME (type) != 0
1752 && ! (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
1753 && DECL_IGNORED_P (TYPE_NAME (type)))
1754 && !full)
1755 || !COMPLETE_TYPE_P (type)
1756 /* No way in DBX fmt to describe a variable size. */
1757 || ! host_integerp (TYPE_SIZE (type), 1))
1759 typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_XREF;
1760 return;
1762 #endif
1764 /* Output a definition now. */
1765 stabstr_C ('=');
1767 /* Mark it as defined, so that if it is self-referent
1768 we will not get into an infinite recursion of definitions. */
1770 typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_DEFINED;
1772 /* If this type is a variant of some other, hand off. Types with
1773 different names are usefully distinguished. We only distinguish
1774 cv-qualified types if we're using extensions. */
1775 if (TYPE_READONLY (type) > TYPE_READONLY (main_variant))
1777 stabstr_C ('k');
1778 dbxout_type (build_type_variant (type, 0, TYPE_VOLATILE (type)), 0);
1779 return;
1781 else if (TYPE_VOLATILE (type) > TYPE_VOLATILE (main_variant))
1783 stabstr_C ('B');
1784 dbxout_type (build_type_variant (type, TYPE_READONLY (type), 0), 0);
1785 return;
1787 else if (main_variant != TYPE_MAIN_VARIANT (type))
1789 if (flag_debug_only_used_symbols)
1791 tree orig_type = DECL_ORIGINAL_TYPE (TYPE_NAME (type));
1793 if ((TREE_CODE (orig_type) == RECORD_TYPE
1794 || TREE_CODE (orig_type) == UNION_TYPE
1795 || TREE_CODE (orig_type) == QUAL_UNION_TYPE
1796 || TREE_CODE (orig_type) == ENUMERAL_TYPE)
1797 && TYPE_STUB_DECL (orig_type)
1798 && ! DECL_IGNORED_P (TYPE_STUB_DECL (orig_type)))
1799 debug_queue_symbol (TYPE_STUB_DECL (orig_type));
1801 /* 'type' is a typedef; output the type it refers to. */
1802 dbxout_type (DECL_ORIGINAL_TYPE (TYPE_NAME (type)), 0);
1803 return;
1805 /* else continue. */
1807 switch (TREE_CODE (type))
1809 case VOID_TYPE:
1810 case LANG_TYPE:
1811 /* For a void type, just define it as itself; i.e., "5=5".
1812 This makes us consider it defined
1813 without saying what it is. The debugger will make it
1814 a void type when the reference is seen, and nothing will
1815 ever override that default. */
1816 dbxout_type_index (type);
1817 break;
1819 case INTEGER_TYPE:
1820 if (type == char_type_node && ! TYPE_UNSIGNED (type))
1822 /* Output the type `char' as a subrange of itself!
1823 I don't understand this definition, just copied it
1824 from the output of pcc.
1825 This used to use `r2' explicitly and we used to
1826 take care to make sure that `char' was type number 2. */
1827 stabstr_C ('r');
1828 dbxout_type_index (type);
1829 stabstr_S (";0;127;");
1832 /* If this is a subtype of another integer type, always prefer to
1833 write it as a subtype. */
1834 else if (TREE_TYPE (type) != 0
1835 && TREE_CODE (TREE_TYPE (type)) == INTEGER_TYPE)
1837 /* If the size is non-standard, say what it is if we can use
1838 GDB extensions. */
1840 if (use_gnu_debug_info_extensions
1841 && TYPE_PRECISION (type) != TYPE_PRECISION (integer_type_node))
1843 have_used_extensions = 1;
1844 stabstr_S ("@s");
1845 stabstr_D (TYPE_PRECISION (type));
1846 stabstr_C (';');
1849 dbxout_range_type (type);
1852 else
1854 /* If the size is non-standard, say what it is if we can use
1855 GDB extensions. */
1857 if (use_gnu_debug_info_extensions
1858 && TYPE_PRECISION (type) != TYPE_PRECISION (integer_type_node))
1860 have_used_extensions = 1;
1861 stabstr_S ("@s");
1862 stabstr_D (TYPE_PRECISION (type));
1863 stabstr_C (';');
1866 if (print_int_cst_bounds_in_octal_p (type))
1868 stabstr_C ('r');
1870 /* If this type derives from another type, output type index of
1871 parent type. This is particularly important when parent type
1872 is an enumerated type, because not generating the parent type
1873 index would transform the definition of this enumerated type
1874 into a plain unsigned type. */
1875 if (TREE_TYPE (type) != 0)
1876 dbxout_type_index (TREE_TYPE (type));
1877 else
1878 dbxout_type_index (type);
1880 stabstr_C (';');
1881 stabstr_O (TYPE_MIN_VALUE (type));
1882 stabstr_C (';');
1883 stabstr_O (TYPE_MAX_VALUE (type));
1884 stabstr_C (';');
1887 else
1888 /* Output other integer types as subranges of `int'. */
1889 dbxout_range_type (type);
1892 break;
1894 case REAL_TYPE:
1895 /* This used to say `r1' and we used to take care
1896 to make sure that `int' was type number 1. */
1897 stabstr_C ('r');
1898 dbxout_type_index (integer_type_node);
1899 stabstr_C (';');
1900 stabstr_D (int_size_in_bytes (type));
1901 stabstr_S (";0;");
1902 break;
1904 case CHAR_TYPE:
1905 if (use_gnu_debug_info_extensions)
1907 have_used_extensions = 1;
1908 stabstr_S ("@s");
1909 stabstr_D (BITS_PER_UNIT * int_size_in_bytes (type));
1910 stabstr_S (";-20;");
1912 else
1914 /* Output the type `char' as a subrange of itself.
1915 That is what pcc seems to do. */
1916 stabstr_C ('r');
1917 dbxout_type_index (char_type_node);
1918 stabstr_S (TYPE_UNSIGNED (type) ? ";0;255;" : ";0;127;");
1920 break;
1922 case BOOLEAN_TYPE:
1923 if (use_gnu_debug_info_extensions)
1925 have_used_extensions = 1;
1926 stabstr_S ("@s");
1927 stabstr_D (BITS_PER_UNIT * int_size_in_bytes (type));
1928 stabstr_S (";-16;");
1930 else /* Define as enumeral type (False, True) */
1931 stabstr_S ("eFalse:0,True:1,;");
1932 break;
1934 case FILE_TYPE:
1935 stabstr_C ('d');
1936 dbxout_type (TREE_TYPE (type), 0);
1937 break;
1939 case COMPLEX_TYPE:
1940 /* Differs from the REAL_TYPE by its new data type number.
1941 R3 is NF_COMPLEX. We don't try to use any of the other NF_*
1942 codes since gdb doesn't care anyway. */
1944 if (TREE_CODE (TREE_TYPE (type)) == REAL_TYPE)
1946 stabstr_S ("R3;");
1947 stabstr_D (2 * int_size_in_bytes (TREE_TYPE (type)));
1948 stabstr_S (";0;");
1950 else
1952 /* Output a complex integer type as a structure,
1953 pending some other way to do it. */
1954 stabstr_C ('s');
1955 stabstr_D (int_size_in_bytes (type));
1957 stabstr_S ("real:");
1958 dbxout_type (TREE_TYPE (type), 0);
1959 stabstr_S (",0,");
1960 stabstr_D (TYPE_PRECISION (TREE_TYPE (type)));
1962 stabstr_S (";imag:");
1963 dbxout_type (TREE_TYPE (type), 0);
1964 stabstr_C (',');
1965 stabstr_D (TYPE_PRECISION (TREE_TYPE (type)));
1966 stabstr_C (',');
1967 stabstr_D (TYPE_PRECISION (TREE_TYPE (type)));
1968 stabstr_S (";;");
1970 break;
1972 case ARRAY_TYPE:
1973 /* Make arrays of packed bits look like bitstrings for chill. */
1974 if (TYPE_PACKED (type) && use_gnu_debug_info_extensions)
1976 have_used_extensions = 1;
1977 stabstr_S ("@s");
1978 stabstr_D (BITS_PER_UNIT * int_size_in_bytes (type));
1979 stabstr_S (";@S;S");
1980 dbxout_type (TYPE_DOMAIN (type), 0);
1981 break;
1984 /* Output "a" followed by a range type definition
1985 for the index type of the array
1986 followed by a reference to the target-type.
1987 ar1;0;N;M for a C array of type M and size N+1. */
1988 /* Check if a character string type, which in Chill is
1989 different from an array of characters. */
1990 if (TYPE_STRING_FLAG (type) && use_gnu_debug_info_extensions)
1992 have_used_extensions = 1;
1993 stabstr_S ("@S;");
1995 tem = TYPE_DOMAIN (type);
1996 if (tem == NULL)
1998 stabstr_S ("ar");
1999 dbxout_type_index (integer_type_node);
2000 stabstr_S (";0;-1;");
2002 else
2004 stabstr_C ('a');
2005 dbxout_range_type (tem);
2008 dbxout_type (TREE_TYPE (type), 0);
2009 break;
2011 case RECORD_TYPE:
2012 case UNION_TYPE:
2013 case QUAL_UNION_TYPE:
2015 tree binfo = TYPE_BINFO (type);
2017 /* Output a structure type. We must use the same test here as we
2018 use in the DBX_NO_XREFS case above. */
2019 if ((TYPE_NAME (type) != 0
2020 && ! (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
2021 && DECL_IGNORED_P (TYPE_NAME (type)))
2022 && !full)
2023 || !COMPLETE_TYPE_P (type)
2024 /* No way in DBX fmt to describe a variable size. */
2025 || ! host_integerp (TYPE_SIZE (type), 1))
2027 /* If the type is just a cross reference, output one
2028 and mark the type as partially described.
2029 If it later becomes defined, we will output
2030 its real definition.
2031 If the type has a name, don't nest its definition within
2032 another type's definition; instead, output an xref
2033 and let the definition come when the name is defined. */
2034 stabstr_S ((TREE_CODE (type) == RECORD_TYPE) ? "xs" : "xu");
2035 if (TYPE_NAME (type) != 0)
2036 dbxout_type_name (type);
2037 else
2039 stabstr_S ("$$");
2040 stabstr_D (anonymous_type_number++);
2043 stabstr_C (':');
2044 typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_XREF;
2045 break;
2048 /* Identify record or union, and print its size. */
2049 stabstr_C ((TREE_CODE (type) == RECORD_TYPE) ? 's' : 'u');
2050 stabstr_D (int_size_in_bytes (type));
2052 if (binfo)
2054 int i;
2055 tree child;
2056 VEC (tree) *accesses = BINFO_BASE_ACCESSES (binfo);
2058 if (use_gnu_debug_info_extensions)
2060 if (BINFO_N_BASE_BINFOS (binfo))
2062 have_used_extensions = 1;
2063 stabstr_C ('!');
2064 stabstr_U (BINFO_N_BASE_BINFOS (binfo));
2065 stabstr_C (',');
2068 for (i = 0; BINFO_BASE_ITERATE (binfo, i, child); i++)
2070 tree access = (accesses ? VEC_index (tree, accesses, i)
2071 : access_public_node);
2073 if (use_gnu_debug_info_extensions)
2075 have_used_extensions = 1;
2076 stabstr_C (BINFO_VIRTUAL_P (child) ? '1' : '0');
2077 stabstr_C (access == access_public_node ? '2' :
2078 access == access_protected_node
2079 ? '1' :'0');
2080 if (BINFO_VIRTUAL_P (child)
2081 && strcmp (lang_hooks.name, "GNU C++") == 0)
2082 /* For a virtual base, print the (negative)
2083 offset within the vtable where we must look
2084 to find the necessary adjustment. */
2085 stabstr_D
2086 (tree_low_cst (BINFO_VPTR_FIELD (child), 0)
2087 * BITS_PER_UNIT);
2088 else
2089 stabstr_D (tree_low_cst (BINFO_OFFSET (child), 0)
2090 * BITS_PER_UNIT);
2091 stabstr_C (',');
2092 dbxout_type (BINFO_TYPE (child), 0);
2093 stabstr_C (';');
2095 else
2097 /* Print out the base class information with
2098 fields which have the same names at the types
2099 they hold. */
2100 dbxout_type_name (BINFO_TYPE (child));
2101 stabstr_C (':');
2102 dbxout_type (BINFO_TYPE (child), full);
2103 stabstr_C (',');
2104 stabstr_D (tree_low_cst (BINFO_OFFSET (child), 0)
2105 * BITS_PER_UNIT);
2106 stabstr_C (',');
2107 stabstr_D
2108 (tree_low_cst (TYPE_SIZE (BINFO_TYPE (child)), 0)
2109 * BITS_PER_UNIT);
2110 stabstr_C (';');
2116 /* Write out the field declarations. */
2117 dbxout_type_fields (type);
2118 if (use_gnu_debug_info_extensions && TYPE_METHODS (type) != NULL_TREE)
2120 have_used_extensions = 1;
2121 dbxout_type_methods (type);
2124 stabstr_C (';');
2126 if (use_gnu_debug_info_extensions && TREE_CODE (type) == RECORD_TYPE
2127 /* Avoid the ~ if we don't really need it--it confuses dbx. */
2128 && TYPE_VFIELD (type))
2130 have_used_extensions = 1;
2132 /* We need to write out info about what field this class
2133 uses as its "main" vtable pointer field, because if this
2134 field is inherited from a base class, GDB cannot necessarily
2135 figure out which field it's using in time. */
2136 stabstr_S ("~%");
2137 dbxout_type (DECL_FCONTEXT (TYPE_VFIELD (type)), 0);
2138 stabstr_C (';');
2140 break;
2142 case ENUMERAL_TYPE:
2143 /* We must use the same test here as we use in the DBX_NO_XREFS case
2144 above. We simplify it a bit since an enum will never have a variable
2145 size. */
2146 if ((TYPE_NAME (type) != 0
2147 && ! (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
2148 && DECL_IGNORED_P (TYPE_NAME (type)))
2149 && !full)
2150 || !COMPLETE_TYPE_P (type))
2152 stabstr_S ("xe");
2153 dbxout_type_name (type);
2154 typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_XREF;
2155 stabstr_C (':');
2156 return;
2158 if (use_gnu_debug_info_extensions
2159 && TYPE_PRECISION (type) != TYPE_PRECISION (integer_type_node))
2161 have_used_extensions = 1;
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 have_used_extensions = 1;
2198 stabstr_C ('#');
2200 /* Write the argument types out longhand. */
2201 dbxout_type (TYPE_METHOD_BASETYPE (type), 0);
2202 stabstr_C (',');
2203 dbxout_type (TREE_TYPE (type), 0);
2204 dbxout_args (TYPE_ARG_TYPES (type));
2205 stabstr_C (';');
2207 else
2208 /* Treat it as a function type. */
2209 dbxout_type (TREE_TYPE (type), 0);
2210 break;
2212 case OFFSET_TYPE:
2213 if (use_gnu_debug_info_extensions)
2215 have_used_extensions = 1;
2216 stabstr_C ('@');
2217 dbxout_type (TYPE_OFFSET_BASETYPE (type), 0);
2218 stabstr_C (',');
2219 dbxout_type (TREE_TYPE (type), 0);
2221 else
2222 /* Should print as an int, because it is really just an offset. */
2223 dbxout_type (integer_type_node, 0);
2224 break;
2226 case REFERENCE_TYPE:
2227 if (use_gnu_debug_info_extensions)
2229 have_used_extensions = 1;
2230 stabstr_C ('&');
2232 else
2233 stabstr_C ('*');
2234 dbxout_type (TREE_TYPE (type), 0);
2235 break;
2237 case FUNCTION_TYPE:
2238 stabstr_C ('f');
2239 dbxout_type (TREE_TYPE (type), 0);
2240 break;
2242 default:
2243 gcc_unreachable ();
2247 /* Return nonzero if the given type represents an integer whose bounds
2248 should be printed in octal format. */
2250 static bool
2251 print_int_cst_bounds_in_octal_p (tree type)
2253 /* If we can use GDB extensions and the size is wider than a long
2254 (the size used by GDB to read them) or we may have trouble writing
2255 the bounds the usual way, write them in octal. Note the test is for
2256 the *target's* size of "long", not that of the host. The host test
2257 is just to make sure we can write it out in case the host wide int
2258 is narrower than the target "long".
2260 For unsigned types, we use octal if they are the same size or larger.
2261 This is because we print the bounds as signed decimal, and hence they
2262 can't span same size unsigned types. */
2264 if (use_gnu_debug_info_extensions
2265 && TYPE_MIN_VALUE (type) != 0
2266 && TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST
2267 && TYPE_MAX_VALUE (type) != 0
2268 && TREE_CODE (TYPE_MAX_VALUE (type)) == INTEGER_CST
2269 && (TYPE_PRECISION (type) > TYPE_PRECISION (integer_type_node)
2270 || ((TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node))
2271 && TYPE_UNSIGNED (type))
2272 || TYPE_PRECISION (type) > HOST_BITS_PER_WIDE_INT
2273 || (TYPE_PRECISION (type) == HOST_BITS_PER_WIDE_INT
2274 && TYPE_UNSIGNED (type))))
2275 return TRUE;
2276 else
2277 return FALSE;
2280 /* Output the name of type TYPE, with no punctuation.
2281 Such names can be set up either by typedef declarations
2282 or by struct, enum and union tags. */
2284 static void
2285 dbxout_type_name (tree type)
2287 tree t = TYPE_NAME (type);
2289 gcc_assert (t);
2290 switch (TREE_CODE (t))
2292 case IDENTIFIER_NODE:
2293 break;
2294 case TYPE_DECL:
2295 t = DECL_NAME (t);
2296 break;
2297 default:
2298 gcc_unreachable ();
2301 stabstr_I (t);
2304 /* Output leading leading struct or class names needed for qualifying
2305 type whose scope is limited to a struct or class. */
2307 static void
2308 dbxout_class_name_qualifiers (tree decl)
2310 tree context = decl_type_context (decl);
2312 if (context != NULL_TREE
2313 && TREE_CODE(context) == RECORD_TYPE
2314 && TYPE_NAME (context) != 0
2315 && (TREE_CODE (TYPE_NAME (context)) == IDENTIFIER_NODE
2316 || (DECL_NAME (TYPE_NAME (context)) != 0)))
2318 tree name = TYPE_NAME (context);
2320 if (TREE_CODE (name) == TYPE_DECL)
2322 dbxout_class_name_qualifiers (name);
2323 name = DECL_NAME (name);
2325 stabstr_I (name);
2326 stabstr_S ("::");
2330 /* This is a specialized subset of expand_expr for use by dbxout_symbol in
2331 evaluating DECL_VALUE_EXPR. In particular, we stop if we find decls that
2332 havn't been expanded, or if the expression is getting so complex we won't
2333 be able to represent it in stabs anyway. Returns NULL on failure. */
2335 static rtx
2336 dbxout_expand_expr (tree expr)
2338 switch (TREE_CODE (expr))
2340 case VAR_DECL:
2341 case PARM_DECL:
2342 if (DECL_VALUE_EXPR (expr))
2343 return dbxout_expand_expr (DECL_VALUE_EXPR (expr));
2344 /* FALLTHRU */
2346 case CONST_DECL:
2347 case RESULT_DECL:
2348 return DECL_RTL_IF_SET (expr);
2350 case INTEGER_CST:
2351 return expand_expr (expr, NULL_RTX, VOIDmode, EXPAND_INITIALIZER);
2353 case COMPONENT_REF:
2354 case ARRAY_REF:
2355 case ARRAY_RANGE_REF:
2356 case BIT_FIELD_REF:
2358 enum machine_mode mode;
2359 HOST_WIDE_INT bitsize, bitpos;
2360 tree offset, tem;
2361 int volatilep = 0, unsignedp = 0;
2362 rtx x;
2364 tem = get_inner_reference (expr, &bitsize, &bitpos, &offset,
2365 &mode, &unsignedp, &volatilep, true);
2367 x = dbxout_expand_expr (tem);
2368 if (x == NULL || !MEM_P (x))
2369 return NULL;
2370 if (offset != NULL)
2372 if (!host_integerp (offset, 0))
2373 return NULL;
2374 x = adjust_address_nv (x, mode, tree_low_cst (offset, 0));
2376 if (bitpos != 0)
2377 x = adjust_address_nv (x, mode, bitpos / BITS_PER_UNIT);
2379 return x;
2382 default:
2383 return NULL;
2387 /* Output a .stabs for the symbol defined by DECL,
2388 which must be a ..._DECL node in the normal namespace.
2389 It may be a CONST_DECL, a FUNCTION_DECL, a PARM_DECL or a VAR_DECL.
2390 LOCAL is nonzero if the scope is less than the entire file.
2391 Return 1 if a stabs might have been emitted. */
2394 dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED)
2396 tree type = TREE_TYPE (decl);
2397 tree context = NULL_TREE;
2398 int result = 0;
2399 rtx decl_rtl;
2401 /* "Intercept" dbxout_symbol() calls like we do all debug_hooks. */
2402 ++debug_nesting;
2404 /* Ignore nameless syms, but don't ignore type tags. */
2406 if ((DECL_NAME (decl) == 0 && TREE_CODE (decl) != TYPE_DECL)
2407 || DECL_IGNORED_P (decl))
2408 DBXOUT_DECR_NESTING_AND_RETURN (0);
2410 /* If we are to generate only the symbols actually used then such
2411 symbol nodees are flagged with TREE_USED. Ignore any that
2412 aren't flaged as TREE_USED. */
2414 if (flag_debug_only_used_symbols
2415 && (!TREE_USED (decl)
2416 && (TREE_CODE (decl) != VAR_DECL || !DECL_INITIAL (decl))))
2417 DBXOUT_DECR_NESTING_AND_RETURN (0);
2419 /* If dbxout_init has not yet run, queue this symbol for later. */
2420 if (!typevec)
2422 preinit_symbols = tree_cons (0, decl, preinit_symbols);
2423 DBXOUT_DECR_NESTING_AND_RETURN (0);
2426 if (flag_debug_only_used_symbols)
2428 tree t;
2430 /* We now have a used symbol. We need to generate the info for
2431 the symbol's type in addition to the symbol itself. These
2432 type symbols are queued to be generated after were done with
2433 the symbol itself (otherwise they would fight over the
2434 stabstr obstack).
2436 Note, because the TREE_TYPE(type) might be something like a
2437 pointer to a named type we need to look for the first name
2438 we see following the TREE_TYPE chain. */
2440 t = type;
2441 while (POINTER_TYPE_P (t))
2442 t = TREE_TYPE (t);
2444 /* RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE, and ENUMERAL_TYPE
2445 need special treatment. The TYPE_STUB_DECL field in these
2446 types generally represents the tag name type we want to
2447 output. In addition there could be a typedef type with
2448 a different name. In that case we also want to output
2449 that. */
2451 if (TREE_CODE (t) == RECORD_TYPE
2452 || TREE_CODE (t) == UNION_TYPE
2453 || TREE_CODE (t) == QUAL_UNION_TYPE
2454 || TREE_CODE (t) == ENUMERAL_TYPE)
2456 if (TYPE_STUB_DECL (t)
2457 && TYPE_STUB_DECL (t) != decl
2458 && DECL_P (TYPE_STUB_DECL (t))
2459 && ! DECL_IGNORED_P (TYPE_STUB_DECL (t)))
2461 debug_queue_symbol (TYPE_STUB_DECL (t));
2462 if (TYPE_NAME (t)
2463 && TYPE_NAME (t) != TYPE_STUB_DECL (t)
2464 && TYPE_NAME (t) != decl
2465 && DECL_P (TYPE_NAME (t)))
2466 debug_queue_symbol (TYPE_NAME (t));
2469 else if (TYPE_NAME (t)
2470 && TYPE_NAME (t) != decl
2471 && DECL_P (TYPE_NAME (t)))
2472 debug_queue_symbol (TYPE_NAME (t));
2475 emit_pending_bincls_if_required ();
2477 switch (TREE_CODE (decl))
2479 case CONST_DECL:
2480 /* Enum values are defined by defining the enum type. */
2481 break;
2483 case FUNCTION_DECL:
2484 decl_rtl = DECL_RTL_IF_SET (decl);
2485 if (!decl_rtl)
2486 DBXOUT_DECR_NESTING_AND_RETURN (0);
2487 if (DECL_EXTERNAL (decl))
2488 break;
2489 /* Don't mention a nested function under its parent. */
2490 context = decl_function_context (decl);
2491 if (context == current_function_decl)
2492 break;
2493 /* Don't mention an inline instance of a nested function. */
2494 if (context && DECL_FROM_INLINE (decl))
2495 break;
2496 if (!MEM_P (decl_rtl)
2497 || GET_CODE (XEXP (decl_rtl, 0)) != SYMBOL_REF)
2498 break;
2500 dbxout_begin_complex_stabs ();
2501 stabstr_I (DECL_ASSEMBLER_NAME (decl));
2502 stabstr_S (TREE_PUBLIC (decl) ? ":F" : ":f");
2503 result = 1;
2505 if (TREE_TYPE (type))
2506 dbxout_type (TREE_TYPE (type), 0);
2507 else
2508 dbxout_type (void_type_node, 0);
2510 /* For a nested function, when that function is compiled,
2511 mention the containing function name
2512 as well as (since dbx wants it) our own assembler-name. */
2513 if (context != 0)
2515 stabstr_C (',');
2516 stabstr_I (DECL_ASSEMBLER_NAME (decl));
2517 stabstr_C (',');
2518 stabstr_I (DECL_NAME (context));
2521 dbxout_finish_complex_stabs (decl, N_FUN, XEXP (decl_rtl, 0), 0, 0);
2522 break;
2524 case TYPE_DECL:
2525 /* Don't output the same typedef twice.
2526 And don't output what language-specific stuff doesn't want output. */
2527 if (TREE_ASM_WRITTEN (decl) || TYPE_DECL_SUPPRESS_DEBUG (decl))
2528 DBXOUT_DECR_NESTING_AND_RETURN (0);
2530 /* Don't output typedefs for types with magic type numbers (XCOFF). */
2531 #ifdef DBX_ASSIGN_FUNDAMENTAL_TYPE_NUMBER
2533 int fundamental_type_number =
2534 DBX_ASSIGN_FUNDAMENTAL_TYPE_NUMBER (decl);
2536 if (fundamental_type_number != 0)
2538 TREE_ASM_WRITTEN (decl) = 1;
2539 TYPE_SYMTAB_ADDRESS (TREE_TYPE (decl)) = fundamental_type_number;
2540 DBXOUT_DECR_NESTING_AND_RETURN (0);
2543 #endif
2544 FORCE_TEXT;
2545 result = 1;
2547 int tag_needed = 1;
2548 int did_output = 0;
2550 if (DECL_NAME (decl))
2552 /* Nonzero means we must output a tag as well as a typedef. */
2553 tag_needed = 0;
2555 /* Handle the case of a C++ structure or union
2556 where the TYPE_NAME is a TYPE_DECL
2557 which gives both a typedef name and a tag. */
2558 /* dbx requires the tag first and the typedef second. */
2559 if ((TREE_CODE (type) == RECORD_TYPE
2560 || TREE_CODE (type) == UNION_TYPE
2561 || TREE_CODE (type) == QUAL_UNION_TYPE)
2562 && TYPE_NAME (type) == decl
2563 && !(use_gnu_debug_info_extensions && have_used_extensions)
2564 && !TREE_ASM_WRITTEN (TYPE_NAME (type))
2565 /* Distinguish the implicit typedefs of C++
2566 from explicit ones that might be found in C. */
2567 && DECL_ARTIFICIAL (decl)
2568 /* Do not generate a tag for incomplete records. */
2569 && COMPLETE_TYPE_P (type)
2570 /* Do not generate a tag for records of variable size,
2571 since this type can not be properly described in the
2572 DBX format, and it confuses some tools such as objdump. */
2573 && host_integerp (TYPE_SIZE (type), 1))
2575 tree name = TYPE_NAME (type);
2576 if (TREE_CODE (name) == TYPE_DECL)
2577 name = DECL_NAME (name);
2579 dbxout_begin_complex_stabs ();
2580 stabstr_I (name);
2581 stabstr_S (":T");
2582 dbxout_type (type, 1);
2583 dbxout_finish_complex_stabs (0, DBX_TYPE_DECL_STABS_CODE,
2584 0, 0, 0);
2587 dbxout_begin_complex_stabs ();
2589 /* Output leading class/struct qualifiers.
2590 ??? why not set have_used_extensions here ... because
2591 then the test of it below would always be true, I
2592 guess. But it's not clear to me why we shouldn't do
2593 that always in extended mode. */
2594 if (use_gnu_debug_info_extensions)
2595 dbxout_class_name_qualifiers (decl);
2597 /* Output typedef name. */
2598 stabstr_I (DECL_NAME (decl));
2599 stabstr_C (':');
2601 /* Short cut way to output a tag also. */
2602 if ((TREE_CODE (type) == RECORD_TYPE
2603 || TREE_CODE (type) == UNION_TYPE
2604 || TREE_CODE (type) == QUAL_UNION_TYPE)
2605 && TYPE_NAME (type) == decl
2606 /* Distinguish the implicit typedefs of C++
2607 from explicit ones that might be found in C. */
2608 && DECL_ARTIFICIAL (decl))
2610 if (use_gnu_debug_info_extensions && have_used_extensions)
2612 stabstr_C ('T');
2613 TREE_ASM_WRITTEN (TYPE_NAME (type)) = 1;
2617 stabstr_C ('t');
2618 dbxout_type (type, 1);
2619 dbxout_finish_complex_stabs (decl, DBX_TYPE_DECL_STABS_CODE,
2620 0, 0, 0);
2621 did_output = 1;
2624 /* Don't output a tag if this is an incomplete type. This prevents
2625 the sun4 Sun OS 4.x dbx from crashing. */
2627 if (tag_needed && TYPE_NAME (type) != 0
2628 && (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE
2629 || (DECL_NAME (TYPE_NAME (type)) != 0))
2630 && COMPLETE_TYPE_P (type)
2631 && !TREE_ASM_WRITTEN (TYPE_NAME (type)))
2633 /* For a TYPE_DECL with no name, but the type has a name,
2634 output a tag.
2635 This is what represents `struct foo' with no typedef. */
2636 /* In C++, the name of a type is the corresponding typedef.
2637 In C, it is an IDENTIFIER_NODE. */
2638 tree name = TYPE_NAME (type);
2639 if (TREE_CODE (name) == TYPE_DECL)
2640 name = DECL_NAME (name);
2642 dbxout_begin_complex_stabs ();
2643 stabstr_I (name);
2644 stabstr_S (":T");
2645 dbxout_type (type, 1);
2646 dbxout_finish_complex_stabs (0, DBX_TYPE_DECL_STABS_CODE, 0, 0, 0);
2647 did_output = 1;
2650 /* If an enum type has no name, it cannot be referred to, but
2651 we must output it anyway, to record the enumeration
2652 constants. */
2654 if (!did_output && TREE_CODE (type) == ENUMERAL_TYPE)
2656 dbxout_begin_complex_stabs ();
2657 /* Some debuggers fail when given NULL names, so give this a
2658 harmless name of " " (Why not "(anon)"?). */
2659 stabstr_S (" :T");
2660 dbxout_type (type, 1);
2661 dbxout_finish_complex_stabs (0, DBX_TYPE_DECL_STABS_CODE, 0, 0, 0);
2664 /* Prevent duplicate output of a typedef. */
2665 TREE_ASM_WRITTEN (decl) = 1;
2666 break;
2669 case PARM_DECL:
2670 /* Parm decls go in their own separate chains
2671 and are output by dbxout_reg_parms and dbxout_parms. */
2672 gcc_unreachable ();
2674 case RESULT_DECL:
2675 case VAR_DECL:
2676 /* Don't mention a variable that is external.
2677 Let the file that defines it describe it. */
2678 if (DECL_EXTERNAL (decl))
2679 break;
2681 decl_rtl = dbxout_expand_expr (decl);
2682 if (!decl_rtl)
2683 DBXOUT_DECR_NESTING_AND_RETURN (0);
2685 /* If the variable is really a constant
2686 and not written in memory, inform the debugger.
2688 ??? Why do we skip emitting the type and location in this case? */
2689 if (TREE_STATIC (decl) && TREE_READONLY (decl)
2690 && DECL_INITIAL (decl) != 0
2691 && host_integerp (DECL_INITIAL (decl), 0)
2692 && ! TREE_ASM_WRITTEN (decl)
2693 && (DECL_CONTEXT (decl) == NULL_TREE
2694 || TREE_CODE (DECL_CONTEXT (decl)) == BLOCK)
2695 && TREE_PUBLIC (decl) == 0)
2697 /* The sun4 assembler does not grok this. */
2699 if (TREE_CODE (TREE_TYPE (decl)) == INTEGER_TYPE
2700 || TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE)
2702 HOST_WIDE_INT ival = TREE_INT_CST_LOW (DECL_INITIAL (decl));
2704 dbxout_begin_complex_stabs ();
2705 stabstr_I (DECL_NAME (decl));
2706 stabstr_S (":c=i");
2707 stabstr_D (ival);
2708 dbxout_finish_complex_stabs (0, N_LSYM, 0, 0, 0);
2709 DBXOUT_DECR_NESTING;
2710 return 1;
2712 else
2713 break;
2715 /* else it is something we handle like a normal variable. */
2717 decl_rtl = eliminate_regs (decl_rtl, 0, NULL_RTX);
2718 #ifdef LEAF_REG_REMAP
2719 if (current_function_uses_only_leaf_regs)
2720 leaf_renumber_regs_insn (decl_rtl);
2721 #endif
2723 result = dbxout_symbol_location (decl, type, 0, decl_rtl);
2724 break;
2726 default:
2727 break;
2729 DBXOUT_DECR_NESTING;
2730 return result;
2733 /* Output the stab for DECL, a VAR_DECL, RESULT_DECL or PARM_DECL.
2734 Add SUFFIX to its name, if SUFFIX is not 0.
2735 Describe the variable as residing in HOME
2736 (usually HOME is DECL_RTL (DECL), but not always).
2737 Returns 1 if the stab was really emitted. */
2739 static int
2740 dbxout_symbol_location (tree decl, tree type, const char *suffix, rtx home)
2742 int letter = 0;
2743 STAB_CODE_TYPE code;
2744 rtx addr = 0;
2745 int number = 0;
2746 int regno = -1;
2748 /* Don't mention a variable at all
2749 if it was completely optimized into nothingness.
2751 If the decl was from an inline function, then its rtl
2752 is not identically the rtl that was used in this
2753 particular compilation. */
2754 if (GET_CODE (home) == SUBREG)
2756 rtx value = home;
2758 while (GET_CODE (value) == SUBREG)
2759 value = SUBREG_REG (value);
2760 if (REG_P (value))
2762 if (REGNO (value) >= FIRST_PSEUDO_REGISTER)
2763 return 0;
2765 home = alter_subreg (&home);
2767 if (REG_P (home))
2769 regno = REGNO (home);
2770 if (regno >= FIRST_PSEUDO_REGISTER)
2771 return 0;
2774 /* The kind-of-variable letter depends on where
2775 the variable is and on the scope of its name:
2776 G and N_GSYM for static storage and global scope,
2777 S for static storage and file scope,
2778 V for static storage and local scope,
2779 for those two, use N_LCSYM if data is in bss segment,
2780 N_STSYM if in data segment, N_FUN otherwise.
2781 (We used N_FUN originally, then changed to N_STSYM
2782 to please GDB. However, it seems that confused ld.
2783 Now GDB has been fixed to like N_FUN, says Kingdon.)
2784 no letter at all, and N_LSYM, for auto variable,
2785 r and N_RSYM for register variable. */
2787 if (MEM_P (home) && GET_CODE (XEXP (home, 0)) == SYMBOL_REF)
2789 if (TREE_PUBLIC (decl))
2791 letter = 'G';
2792 code = N_GSYM;
2794 else
2796 addr = XEXP (home, 0);
2798 letter = decl_function_context (decl) ? 'V' : 'S';
2800 /* Some ports can transform a symbol ref into a label ref,
2801 because the symbol ref is too far away and has to be
2802 dumped into a constant pool. Alternatively, the symbol
2803 in the constant pool might be referenced by a different
2804 symbol. */
2805 if (GET_CODE (addr) == SYMBOL_REF
2806 && CONSTANT_POOL_ADDRESS_P (addr))
2808 bool marked;
2809 rtx tmp = get_pool_constant_mark (addr, &marked);
2811 if (GET_CODE (tmp) == SYMBOL_REF)
2813 addr = tmp;
2814 if (CONSTANT_POOL_ADDRESS_P (addr))
2815 get_pool_constant_mark (addr, &marked);
2816 else
2817 marked = true;
2819 else if (GET_CODE (tmp) == LABEL_REF)
2821 addr = tmp;
2822 marked = true;
2825 /* If all references to the constant pool were optimized
2826 out, we just ignore the symbol. */
2827 if (!marked)
2828 return 0;
2831 /* This should be the same condition as in assemble_variable, but
2832 we don't have access to dont_output_data here. So, instead,
2833 we rely on the fact that error_mark_node initializers always
2834 end up in bss for C++ and never end up in bss for C. */
2835 if (DECL_INITIAL (decl) == 0
2836 || (!strcmp (lang_hooks.name, "GNU C++")
2837 && DECL_INITIAL (decl) == error_mark_node))
2838 code = N_LCSYM;
2839 else if (DECL_IN_TEXT_SECTION (decl))
2840 /* This is not quite right, but it's the closest
2841 of all the codes that Unix defines. */
2842 code = DBX_STATIC_CONST_VAR_CODE;
2843 else
2845 /* Ultrix `as' seems to need this. */
2846 #ifdef DBX_STATIC_STAB_DATA_SECTION
2847 data_section ();
2848 #endif
2849 code = N_STSYM;
2853 else if (regno >= 0)
2855 letter = 'r';
2856 code = N_RSYM;
2857 number = DBX_REGISTER_NUMBER (regno);
2859 else if (MEM_P (home)
2860 && (MEM_P (XEXP (home, 0))
2861 || (REG_P (XEXP (home, 0))
2862 && REGNO (XEXP (home, 0)) != HARD_FRAME_POINTER_REGNUM
2863 && REGNO (XEXP (home, 0)) != STACK_POINTER_REGNUM
2864 #if ARG_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
2865 && REGNO (XEXP (home, 0)) != ARG_POINTER_REGNUM
2866 #endif
2868 /* If the value is indirect by memory or by a register
2869 that isn't the frame pointer
2870 then it means the object is variable-sized and address through
2871 that register or stack slot. DBX has no way to represent this
2872 so all we can do is output the variable as a pointer.
2873 If it's not a parameter, ignore it. */
2875 if (REG_P (XEXP (home, 0)))
2877 letter = 'r';
2878 code = N_RSYM;
2879 if (REGNO (XEXP (home, 0)) >= FIRST_PSEUDO_REGISTER)
2880 return 0;
2881 number = DBX_REGISTER_NUMBER (REGNO (XEXP (home, 0)));
2883 else
2885 code = N_LSYM;
2886 /* RTL looks like (MEM (MEM (PLUS (REG...) (CONST_INT...)))).
2887 We want the value of that CONST_INT. */
2888 number = DEBUGGER_AUTO_OFFSET (XEXP (XEXP (home, 0), 0));
2891 /* Effectively do build_pointer_type, but don't cache this type,
2892 since it might be temporary whereas the type it points to
2893 might have been saved for inlining. */
2894 /* Don't use REFERENCE_TYPE because dbx can't handle that. */
2895 type = make_node (POINTER_TYPE);
2896 TREE_TYPE (type) = TREE_TYPE (decl);
2898 else if (MEM_P (home)
2899 && REG_P (XEXP (home, 0)))
2901 code = N_LSYM;
2902 number = DEBUGGER_AUTO_OFFSET (XEXP (home, 0));
2904 else if (MEM_P (home)
2905 && GET_CODE (XEXP (home, 0)) == PLUS
2906 && GET_CODE (XEXP (XEXP (home, 0), 1)) == CONST_INT)
2908 code = N_LSYM;
2909 /* RTL looks like (MEM (PLUS (REG...) (CONST_INT...)))
2910 We want the value of that CONST_INT. */
2911 number = DEBUGGER_AUTO_OFFSET (XEXP (home, 0));
2913 else if (MEM_P (home)
2914 && GET_CODE (XEXP (home, 0)) == CONST)
2916 /* Handle an obscure case which can arise when optimizing and
2917 when there are few available registers. (This is *always*
2918 the case for i386/i486 targets). The RTL looks like
2919 (MEM (CONST ...)) even though this variable is a local `auto'
2920 or a local `register' variable. In effect, what has happened
2921 is that the reload pass has seen that all assignments and
2922 references for one such a local variable can be replaced by
2923 equivalent assignments and references to some static storage
2924 variable, thereby avoiding the need for a register. In such
2925 cases we're forced to lie to debuggers and tell them that
2926 this variable was itself `static'. */
2927 code = N_LCSYM;
2928 letter = 'V';
2929 addr = XEXP (XEXP (home, 0), 0);
2931 else if (GET_CODE (home) == CONCAT)
2933 tree subtype;
2935 /* If TYPE is not a COMPLEX_TYPE (it might be a RECORD_TYPE,
2936 for example), then there is no easy way to figure out
2937 what SUBTYPE should be. So, we give up. */
2938 if (TREE_CODE (type) != COMPLEX_TYPE)
2939 return 0;
2941 subtype = TREE_TYPE (type);
2943 /* If the variable's storage is in two parts,
2944 output each as a separate stab with a modified name. */
2945 if (WORDS_BIG_ENDIAN)
2946 dbxout_symbol_location (decl, subtype, "$imag", XEXP (home, 0));
2947 else
2948 dbxout_symbol_location (decl, subtype, "$real", XEXP (home, 0));
2950 if (WORDS_BIG_ENDIAN)
2951 dbxout_symbol_location (decl, subtype, "$real", XEXP (home, 1));
2952 else
2953 dbxout_symbol_location (decl, subtype, "$imag", XEXP (home, 1));
2954 return 1;
2956 else
2957 /* Address might be a MEM, when DECL is a variable-sized object.
2958 Or it might be const0_rtx, meaning previous passes
2959 want us to ignore this variable. */
2960 return 0;
2962 /* Ok, start a symtab entry and output the variable name. */
2963 emit_pending_bincls_if_required ();
2964 FORCE_TEXT;
2966 #ifdef DBX_STATIC_BLOCK_START
2967 DBX_STATIC_BLOCK_START (asm_out_file, code);
2968 #endif
2970 dbxout_begin_complex_stabs_noforcetext ();
2971 dbxout_symbol_name (decl, suffix, letter);
2972 dbxout_type (type, 0);
2973 dbxout_finish_complex_stabs (decl, code, addr, 0, number);
2975 #ifdef DBX_STATIC_BLOCK_END
2976 DBX_STATIC_BLOCK_END (asm_out_file, code);
2977 #endif
2978 return 1;
2981 /* Output the symbol name of DECL for a stabs, with suffix SUFFIX.
2982 Then output LETTER to indicate the kind of location the symbol has. */
2984 static void
2985 dbxout_symbol_name (tree decl, const char *suffix, int letter)
2987 tree name;
2989 if (DECL_CONTEXT (decl)
2990 && (TYPE_P (DECL_CONTEXT (decl))
2991 || TREE_CODE (DECL_CONTEXT (decl)) == NAMESPACE_DECL))
2992 /* One slight hitch: if this is a VAR_DECL which is a class member
2993 or a namespace member, we must put out the mangled name instead of the
2994 DECL_NAME. Note also that static member (variable) names DO NOT begin
2995 with underscores in .stabs directives. */
2996 name = DECL_ASSEMBLER_NAME (decl);
2997 else
2998 /* ...but if we're function-local, we don't want to include the junk
2999 added by ASM_FORMAT_PRIVATE_NAME. */
3000 name = DECL_NAME (decl);
3002 if (name)
3003 stabstr_I (name);
3004 else
3005 stabstr_S ("(anon)");
3007 if (suffix)
3008 stabstr_S (suffix);
3009 stabstr_C (':');
3010 if (letter)
3011 stabstr_C (letter);
3014 /* Output definitions of all the decls in a chain. Return nonzero if
3015 anything was output */
3018 dbxout_syms (tree syms)
3020 int result = 0;
3021 while (syms)
3023 result += dbxout_symbol (syms, 1);
3024 syms = TREE_CHAIN (syms);
3026 return result;
3029 /* The following two functions output definitions of function parameters.
3030 Each parameter gets a definition locating it in the parameter list.
3031 Each parameter that is a register variable gets a second definition
3032 locating it in the register.
3034 Printing or argument lists in gdb uses the definitions that
3035 locate in the parameter list. But reference to the variable in
3036 expressions uses preferentially the definition as a register. */
3038 /* Output definitions, referring to storage in the parmlist,
3039 of all the parms in PARMS, which is a chain of PARM_DECL nodes. */
3041 void
3042 dbxout_parms (tree parms)
3044 ++debug_nesting;
3045 emit_pending_bincls_if_required ();
3047 for (; parms; parms = TREE_CHAIN (parms))
3048 if (DECL_NAME (parms)
3049 && TREE_TYPE (parms) != error_mark_node
3050 && DECL_RTL_SET_P (parms)
3051 && DECL_INCOMING_RTL (parms))
3053 tree eff_type;
3054 char letter;
3055 STAB_CODE_TYPE code;
3056 int number;
3058 /* Perform any necessary register eliminations on the parameter's rtl,
3059 so that the debugging output will be accurate. */
3060 DECL_INCOMING_RTL (parms)
3061 = eliminate_regs (DECL_INCOMING_RTL (parms), 0, NULL_RTX);
3062 SET_DECL_RTL (parms, eliminate_regs (DECL_RTL (parms), 0, NULL_RTX));
3063 #ifdef LEAF_REG_REMAP
3064 if (current_function_uses_only_leaf_regs)
3066 leaf_renumber_regs_insn (DECL_INCOMING_RTL (parms));
3067 leaf_renumber_regs_insn (DECL_RTL (parms));
3069 #endif
3071 if (PARM_PASSED_IN_MEMORY (parms))
3073 rtx inrtl = XEXP (DECL_INCOMING_RTL (parms), 0);
3075 /* ??? Here we assume that the parm address is indexed
3076 off the frame pointer or arg pointer.
3077 If that is not true, we produce meaningless results,
3078 but do not crash. */
3079 if (GET_CODE (inrtl) == PLUS
3080 && GET_CODE (XEXP (inrtl, 1)) == CONST_INT)
3081 number = INTVAL (XEXP (inrtl, 1));
3082 else
3083 number = 0;
3085 code = N_PSYM;
3086 number = DEBUGGER_ARG_OFFSET (number, inrtl);
3087 letter = 'p';
3089 /* It is quite tempting to use TREE_TYPE (parms) instead
3090 of DECL_ARG_TYPE (parms) for the eff_type, so that gcc
3091 reports the actual type of the parameter, rather than
3092 the promoted type. This certainly makes GDB's life
3093 easier, at least for some ports. The change is a bad
3094 idea however, since GDB expects to be able access the
3095 type without performing any conversions. So for
3096 example, if we were passing a float to an unprototyped
3097 function, gcc will store a double on the stack, but if
3098 we emit a stab saying the type is a float, then gdb
3099 will only read in a single value, and this will produce
3100 an erroneous value. */
3101 eff_type = DECL_ARG_TYPE (parms);
3103 else if (REG_P (DECL_RTL (parms)))
3105 rtx best_rtl;
3107 /* Parm passed in registers and lives in registers or nowhere. */
3108 code = DBX_REGPARM_STABS_CODE;
3109 letter = DBX_REGPARM_STABS_LETTER;
3111 /* For parms passed in registers, it is better to use the
3112 declared type of the variable, not the type it arrived in. */
3113 eff_type = TREE_TYPE (parms);
3115 /* If parm lives in a register, use that register; pretend
3116 the parm was passed there. It would be more consistent
3117 to describe the register where the parm was passed, but
3118 in practice that register usually holds something else.
3119 If the parm lives nowhere, use the register where it
3120 was passed. */
3121 if (REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
3122 best_rtl = DECL_RTL (parms);
3123 else
3124 best_rtl = DECL_INCOMING_RTL (parms);
3126 number = DBX_REGISTER_NUMBER (REGNO (best_rtl));
3128 else if (MEM_P (DECL_RTL (parms))
3129 && REG_P (XEXP (DECL_RTL (parms), 0))
3130 && REGNO (XEXP (DECL_RTL (parms), 0)) != HARD_FRAME_POINTER_REGNUM
3131 && REGNO (XEXP (DECL_RTL (parms), 0)) != STACK_POINTER_REGNUM
3132 #if ARG_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
3133 && REGNO (XEXP (DECL_RTL (parms), 0)) != ARG_POINTER_REGNUM
3134 #endif
3137 /* Parm was passed via invisible reference.
3138 That is, its address was passed in a register.
3139 Output it as if it lived in that register.
3140 The debugger will know from the type
3141 that it was actually passed by invisible reference. */
3143 code = DBX_REGPARM_STABS_CODE;
3145 /* GDB likes this marked with a special letter. */
3146 letter = (use_gnu_debug_info_extensions
3147 ? 'a' : DBX_REGPARM_STABS_LETTER);
3148 eff_type = TREE_TYPE (parms);
3150 /* DECL_RTL looks like (MEM (REG...). Get the register number.
3151 If it is an unallocated pseudo-reg, then use the register where
3152 it was passed instead.
3153 ??? Why is DBX_REGISTER_NUMBER not used here? */
3155 if (REGNO (XEXP (DECL_RTL (parms), 0)) < FIRST_PSEUDO_REGISTER)
3156 number = REGNO (XEXP (DECL_RTL (parms), 0));
3157 else
3158 number = REGNO (DECL_INCOMING_RTL (parms));
3160 else if (MEM_P (DECL_RTL (parms))
3161 && MEM_P (XEXP (DECL_RTL (parms), 0)))
3163 /* Parm was passed via invisible reference, with the reference
3164 living on the stack. DECL_RTL looks like
3165 (MEM (MEM (PLUS (REG ...) (CONST_INT ...)))) or it
3166 could look like (MEM (MEM (REG))). */
3168 code = N_PSYM;
3169 letter = 'v';
3170 eff_type = TREE_TYPE (parms);
3172 if (!REG_P (XEXP (XEXP (DECL_RTL (parms), 0), 0)))
3173 number = INTVAL (XEXP (XEXP (XEXP (DECL_RTL (parms), 0), 0), 1));
3174 else
3175 number = 0;
3177 number = DEBUGGER_ARG_OFFSET (number,
3178 XEXP (XEXP (DECL_RTL (parms), 0), 0));
3180 else if (MEM_P (DECL_RTL (parms))
3181 && XEXP (DECL_RTL (parms), 0) != const0_rtx
3182 /* ??? A constant address for a parm can happen
3183 when the reg it lives in is equiv to a constant in memory.
3184 Should make this not happen, after 2.4. */
3185 && ! CONSTANT_P (XEXP (DECL_RTL (parms), 0)))
3187 /* Parm was passed in registers but lives on the stack. */
3189 code = N_PSYM;
3190 letter = 'p';
3191 eff_type = TREE_TYPE (parms);
3193 /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))),
3194 in which case we want the value of that CONST_INT,
3195 or (MEM (REG ...)),
3196 in which case we use a value of zero. */
3197 if (!REG_P (XEXP (DECL_RTL (parms), 0)))
3198 number = INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1));
3199 else
3200 number = 0;
3202 /* Make a big endian correction if the mode of the type of the
3203 parameter is not the same as the mode of the rtl. */
3204 if (BYTES_BIG_ENDIAN
3205 && TYPE_MODE (TREE_TYPE (parms)) != GET_MODE (DECL_RTL (parms))
3206 && GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (parms))) < UNITS_PER_WORD)
3207 number += (GET_MODE_SIZE (GET_MODE (DECL_RTL (parms)))
3208 - GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (parms))));
3210 else
3211 /* ??? We don't know how to represent this argument. */
3212 continue;
3214 dbxout_begin_complex_stabs ();
3216 if (DECL_NAME (parms))
3218 stabstr_I (DECL_NAME (parms));
3219 stabstr_C (':');
3221 else
3222 stabstr_S ("(anon):");
3223 stabstr_C (letter);
3224 dbxout_type (eff_type, 0);
3225 dbxout_finish_complex_stabs (parms, code, 0, 0, number);
3227 DBXOUT_DECR_NESTING;
3230 /* Output definitions for the places where parms live during the function,
3231 when different from where they were passed, when the parms were passed
3232 in memory.
3234 It is not useful to do this for parms passed in registers
3235 that live during the function in different registers, because it is
3236 impossible to look in the passed register for the passed value,
3237 so we use the within-the-function register to begin with.
3239 PARMS is a chain of PARM_DECL nodes. */
3241 void
3242 dbxout_reg_parms (tree parms)
3244 ++debug_nesting;
3246 for (; parms; parms = TREE_CHAIN (parms))
3247 if (DECL_NAME (parms) && PARM_PASSED_IN_MEMORY (parms))
3249 /* Report parms that live in registers during the function
3250 but were passed in memory. */
3251 if (REG_P (DECL_RTL (parms))
3252 && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
3253 dbxout_symbol_location (parms, TREE_TYPE (parms),
3254 0, DECL_RTL (parms));
3255 else if (GET_CODE (DECL_RTL (parms)) == CONCAT)
3256 dbxout_symbol_location (parms, TREE_TYPE (parms),
3257 0, DECL_RTL (parms));
3258 /* Report parms that live in memory but not where they were passed. */
3259 else if (MEM_P (DECL_RTL (parms))
3260 && ! rtx_equal_p (DECL_RTL (parms), DECL_INCOMING_RTL (parms)))
3261 dbxout_symbol_location (parms, TREE_TYPE (parms),
3262 0, DECL_RTL (parms));
3264 DBXOUT_DECR_NESTING;
3267 /* Given a chain of ..._TYPE nodes (as come in a parameter list),
3268 output definitions of those names, in raw form */
3270 static void
3271 dbxout_args (tree args)
3273 while (args)
3275 stabstr_C (',');
3276 dbxout_type (TREE_VALUE (args), 0);
3277 args = TREE_CHAIN (args);
3281 /* Subroutine of dbxout_block. Emit an N_LBRAC stab referencing LABEL.
3282 BEGIN_LABEL is the name of the beginning of the function, which may
3283 be required. */
3284 static void
3285 dbx_output_lbrac (const char *label,
3286 const char *begin_label ATTRIBUTE_UNUSED)
3288 #ifdef DBX_OUTPUT_LBRAC
3289 DBX_OUTPUT_LBRAC (asm_out_file, label);
3290 #else
3291 dbxout_begin_stabn (N_LBRAC);
3292 if (DBX_BLOCKS_FUNCTION_RELATIVE)
3293 dbxout_stab_value_label_diff (label, begin_label);
3294 else
3295 dbxout_stab_value_label (label);
3296 #endif
3299 /* Subroutine of dbxout_block. Emit an N_RBRAC stab referencing LABEL.
3300 BEGIN_LABEL is the name of the beginning of the function, which may
3301 be required. */
3302 static void
3303 dbx_output_rbrac (const char *label,
3304 const char *begin_label ATTRIBUTE_UNUSED)
3306 #ifdef DBX_OUTPUT_RBRAC
3307 DBX_OUTPUT_RBRAC (asm_out_file, label);
3308 #else
3309 dbxout_begin_stabn (N_RBRAC);
3310 if (DBX_BLOCKS_FUNCTION_RELATIVE)
3311 dbxout_stab_value_label_diff (label, begin_label);
3312 else
3313 dbxout_stab_value_label (label);
3314 #endif
3317 /* Output everything about a symbol block (a BLOCK node
3318 that represents a scope level),
3319 including recursive output of contained blocks.
3321 BLOCK is the BLOCK node.
3322 DEPTH is its depth within containing symbol blocks.
3323 ARGS is usually zero; but for the outermost block of the
3324 body of a function, it is a chain of PARM_DECLs for the function parameters.
3325 We output definitions of all the register parms
3326 as if they were local variables of that block.
3328 If -g1 was used, we count blocks just the same, but output nothing
3329 except for the outermost block.
3331 Actually, BLOCK may be several blocks chained together.
3332 We handle them all in sequence. */
3334 static void
3335 dbxout_block (tree block, int depth, tree args)
3337 const char *begin_label
3338 = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
3340 while (block)
3342 /* Ignore blocks never expanded or otherwise marked as real. */
3343 if (TREE_USED (block) && TREE_ASM_WRITTEN (block))
3345 int did_output;
3346 int blocknum = BLOCK_NUMBER (block);
3348 /* In dbx format, the syms of a block come before the N_LBRAC.
3349 If nothing is output, we don't need the N_LBRAC, either. */
3350 did_output = 0;
3351 if (debug_info_level != DINFO_LEVEL_TERSE || depth == 0)
3352 did_output = dbxout_syms (BLOCK_VARS (block));
3353 if (args)
3354 dbxout_reg_parms (args);
3356 /* Now output an N_LBRAC symbol to represent the beginning of
3357 the block. Use the block's tree-walk order to generate
3358 the assembler symbols LBBn and LBEn
3359 that final will define around the code in this block. */
3360 if (did_output)
3362 char buf[20];
3363 const char *scope_start;
3365 if (depth == 0)
3366 /* The outermost block doesn't get LBB labels; use
3367 the function symbol. */
3368 scope_start = begin_label;
3369 else
3371 ASM_GENERATE_INTERNAL_LABEL (buf, "LBB", blocknum);
3372 scope_start = buf;
3375 if (BLOCK_HANDLER_BLOCK (block))
3377 /* A catch block. Must precede N_LBRAC. */
3378 tree decl = BLOCK_VARS (block);
3379 while (decl)
3381 dbxout_begin_complex_stabs ();
3382 stabstr_I (DECL_NAME (decl));
3383 stabstr_S (":C1");
3384 dbxout_finish_complex_stabs (0, N_CATCH, 0,
3385 scope_start, 0);
3386 decl = TREE_CHAIN (decl);
3389 dbx_output_lbrac (scope_start, begin_label);
3392 /* Output the subblocks. */
3393 dbxout_block (BLOCK_SUBBLOCKS (block), depth + 1, NULL_TREE);
3395 /* Refer to the marker for the end of the block. */
3396 if (did_output)
3398 char buf[100];
3399 if (depth == 0)
3400 /* The outermost block doesn't get LBE labels;
3401 use the "scope" label which will be emitted
3402 by dbxout_function_end. */
3403 ASM_GENERATE_INTERNAL_LABEL (buf, "Lscope", scope_labelno);
3404 else
3405 ASM_GENERATE_INTERNAL_LABEL (buf, "LBE", blocknum);
3407 dbx_output_rbrac (buf, begin_label);
3410 block = BLOCK_CHAIN (block);
3414 /* Output the information about a function and its arguments and result.
3415 Usually this follows the function's code,
3416 but on some systems, it comes before. */
3418 #if defined (DBX_DEBUGGING_INFO)
3419 static void
3420 dbxout_begin_function (tree decl)
3422 int saved_tree_used1;
3424 if (DECL_IGNORED_P (decl))
3425 return;
3427 saved_tree_used1 = TREE_USED (decl);
3428 TREE_USED (decl) = 1;
3429 if (DECL_NAME (DECL_RESULT (decl)) != 0)
3431 int saved_tree_used2 = TREE_USED (DECL_RESULT (decl));
3432 TREE_USED (DECL_RESULT (decl)) = 1;
3433 dbxout_symbol (decl, 0);
3434 TREE_USED (DECL_RESULT (decl)) = saved_tree_used2;
3436 else
3437 dbxout_symbol (decl, 0);
3438 TREE_USED (decl) = saved_tree_used1;
3440 dbxout_parms (DECL_ARGUMENTS (decl));
3441 if (DECL_NAME (DECL_RESULT (decl)) != 0)
3442 dbxout_symbol (DECL_RESULT (decl), 1);
3444 #endif /* DBX_DEBUGGING_INFO */
3446 #endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */
3448 #include "gt-dbxout.h"