cond.md (stzx_16): Use register_operand for operand 0.
[gcc.git] / gcc / dbxout.c
1 /* Output dbx-format symbol table information from GNU compiler.
2 Copyright (C) 1987-2013 Free Software Foundation, Inc.
3
4 This file is part of GCC.
5
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
10
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
19
20
21 /* Output dbx-format symbol table data.
22 This consists of many symbol table entries, each of them
23 a .stabs assembler pseudo-op with four operands:
24 a "name" which is really a description of one symbol and its type,
25 a "code", which is a symbol defined in stab.h whose name starts with N_,
26 an unused operand always 0,
27 and a "value" which is an address or an offset.
28 The name is enclosed in doublequote characters.
29
30 Each function, variable, typedef, and structure tag
31 has a symbol table entry to define it.
32 The beginning and end of each level of name scoping within
33 a function are also marked by special symbol table entries.
34
35 The "name" consists of the symbol name, a colon, a kind-of-symbol letter,
36 and a data type number. The data type number may be followed by
37 "=" and a type definition; normally this will happen the first time
38 the type number is mentioned. The type definition may refer to
39 other types by number, and those type numbers may be followed
40 by "=" and nested definitions.
41
42 This can make the "name" quite long.
43 When a name is more than 80 characters, we split the .stabs pseudo-op
44 into two .stabs pseudo-ops, both sharing the same "code" and "value".
45 The first one is marked as continued with a double-backslash at the
46 end of its "name".
47
48 The kind-of-symbol letter distinguished function names from global
49 variables from file-scope variables from parameters from auto
50 variables in memory from typedef names from register variables.
51 See `dbxout_symbol'.
52
53 The "code" is mostly redundant with the kind-of-symbol letter
54 that goes in the "name", but not entirely: for symbols located
55 in static storage, the "code" says which segment the address is in,
56 which controls how it is relocated.
57
58 The "value" for a symbol in static storage
59 is the core address of the symbol (actually, the assembler
60 label for the symbol). For a symbol located in a stack slot
61 it is the stack offset; for one in a register, the register number.
62 For a typedef symbol, it is zero.
63
64 If DEBUG_SYMS_TEXT is defined, all debugging symbols must be
65 output while in the text section.
66
67 For more on data type definitions, see `dbxout_type'. */
68
69 #include "config.h"
70 #include "system.h"
71 #include "coretypes.h"
72 #include "tm.h"
73
74 #include "tree.h"
75 #include "varasm.h"
76 #include "stor-layout.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 "diagnostic-core.h"
85 #include "toplev.h"
86 #include "tm_p.h"
87 #include "ggc.h"
88 #include "debug.h"
89 #include "function.h"
90 #include "target.h"
91 #include "common/common-target.h"
92 #include "langhooks.h"
93 #include "obstack.h"
94 #include "expr.h"
95 #include "cgraph.h"
96
97 #ifdef XCOFF_DEBUGGING_INFO
98 #include "xcoffout.h"
99 #endif
100
101 #ifndef ASM_STABS_OP
102 # ifdef XCOFF_DEBUGGING_INFO
103 # define ASM_STABS_OP "\t.stabx\t"
104 # else
105 # define ASM_STABS_OP "\t.stabs\t"
106 # endif
107 #endif
108
109 #ifndef ASM_STABN_OP
110 #define ASM_STABN_OP "\t.stabn\t"
111 #endif
112
113 #ifndef ASM_STABD_OP
114 #define ASM_STABD_OP "\t.stabd\t"
115 #endif
116
117 #ifndef DBX_TYPE_DECL_STABS_CODE
118 #define DBX_TYPE_DECL_STABS_CODE N_LSYM
119 #endif
120
121 #ifndef DBX_STATIC_CONST_VAR_CODE
122 #define DBX_STATIC_CONST_VAR_CODE N_FUN
123 #endif
124
125 #ifndef DBX_REGPARM_STABS_CODE
126 #define DBX_REGPARM_STABS_CODE N_RSYM
127 #endif
128
129 #ifndef DBX_REGPARM_STABS_LETTER
130 #define DBX_REGPARM_STABS_LETTER 'P'
131 #endif
132
133 #ifndef NO_DBX_FUNCTION_END
134 #define NO_DBX_FUNCTION_END 0
135 #endif
136
137 #ifndef NO_DBX_BNSYM_ENSYM
138 #define NO_DBX_BNSYM_ENSYM 0
139 #endif
140
141 #ifndef NO_DBX_MAIN_SOURCE_DIRECTORY
142 #define NO_DBX_MAIN_SOURCE_DIRECTORY 0
143 #endif
144
145 #ifndef DBX_BLOCKS_FUNCTION_RELATIVE
146 #define DBX_BLOCKS_FUNCTION_RELATIVE 0
147 #endif
148
149 #ifndef DBX_LINES_FUNCTION_RELATIVE
150 #define DBX_LINES_FUNCTION_RELATIVE 0
151 #endif
152
153 #ifndef DBX_CONTIN_LENGTH
154 #define DBX_CONTIN_LENGTH 80
155 #endif
156
157 #ifndef DBX_CONTIN_CHAR
158 #define DBX_CONTIN_CHAR '\\'
159 #endif
160
161 enum typestatus {TYPE_UNSEEN, TYPE_XREF, TYPE_DEFINED};
162
163 /* Structure recording information about a C data type.
164 The status element says whether we have yet output
165 the definition of the type. TYPE_XREF says we have
166 output it as a cross-reference only.
167 The file_number and type_number elements are used if DBX_USE_BINCL
168 is defined. */
169
170 struct GTY(()) typeinfo {
171 enum typestatus status;
172 int file_number;
173 int type_number;
174 };
175
176 /* Vector recording information about C data types.
177 When we first notice a data type (a tree node),
178 we assign it a number using next_type_number.
179 That is its index in this vector. */
180
181 static GTY ((length ("typevec_len"))) struct typeinfo *typevec;
182
183 /* Number of elements of space allocated in `typevec'. */
184
185 static GTY(()) int typevec_len;
186
187 /* In dbx output, each type gets a unique number.
188 This is the number for the next type output.
189 The number, once assigned, is in the TYPE_SYMTAB_ADDRESS field. */
190
191 static GTY(()) int next_type_number;
192
193 /* The C front end may call dbxout_symbol before dbxout_init runs.
194 We save all such decls in this list and output them when we get
195 to dbxout_init. */
196
197 static GTY(()) tree preinit_symbols;
198
199 enum binclstatus {BINCL_NOT_REQUIRED, BINCL_PENDING, BINCL_PROCESSED};
200
201 /* When using N_BINCL in dbx output, each type number is actually a
202 pair of the file number and the type number within the file.
203 This is a stack of input files. */
204
205 struct dbx_file
206 {
207 struct dbx_file *next;
208 int file_number;
209 int next_type_number;
210 enum binclstatus bincl_status; /* Keep track of lazy bincl. */
211 const char *pending_bincl_name; /* Name of bincl. */
212 struct dbx_file *prev; /* Chain to traverse all pending bincls. */
213 };
214
215 /* This is the top of the stack.
216
217 This is not saved for PCH, because restoring a PCH should not change it.
218 next_file_number does have to be saved, because the PCH may use some
219 file numbers; however, just before restoring a PCH, next_file_number
220 should always be 0 because we should not have needed any file numbers
221 yet. */
222
223 #if (defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)) \
224 && defined (DBX_USE_BINCL)
225 static struct dbx_file *current_file;
226 #endif
227
228 /* This is the next file number to use. */
229
230 static GTY(()) int next_file_number;
231
232 /* A counter for dbxout_function_end. */
233
234 static GTY(()) int scope_labelno;
235
236 /* A counter for dbxout_source_line. */
237
238 static GTY(()) int dbxout_source_line_counter;
239
240 /* Number for the next N_SOL filename stabs label. The number 0 is reserved
241 for the N_SO filename stabs label. */
242
243 static GTY(()) int source_label_number = 1;
244
245 /* Last source file name mentioned in a NOTE insn. */
246
247 static GTY(()) const char *lastfile;
248
249 /* Used by PCH machinery to detect if 'lastfile' should be reset to
250 base_input_file. */
251 static GTY(()) int lastfile_is_base;
252
253 /* Typical USG systems don't have stab.h, and they also have
254 no use for DBX-format debugging info. */
255
256 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
257
258 #ifdef DBX_USE_BINCL
259 /* If zero then there is no pending BINCL. */
260 static int pending_bincls = 0;
261 #endif
262
263 /* The original input file name. */
264 static const char *base_input_file;
265
266 #ifdef DEBUG_SYMS_TEXT
267 #define FORCE_TEXT switch_to_section (current_function_section ())
268 #else
269 #define FORCE_TEXT
270 #endif
271
272 #include "gstab.h"
273
274 /* 1 if PARM is passed to this function in memory. */
275
276 #define PARM_PASSED_IN_MEMORY(PARM) \
277 (MEM_P (DECL_INCOMING_RTL (PARM)))
278
279 /* A C expression for the integer offset value of an automatic variable
280 (N_LSYM) having address X (an RTX). */
281 #ifndef DEBUGGER_AUTO_OFFSET
282 #define DEBUGGER_AUTO_OFFSET(X) \
283 (GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0)
284 #endif
285
286 /* A C expression for the integer offset value of an argument (N_PSYM)
287 having address X (an RTX). The nominal offset is OFFSET.
288 Note that we use OFFSET + 0 here to avoid the self-assign warning
289 when the macro is called in a context like
290 number = DEBUGGER_ARG_OFFSET(number, X) */
291 #ifndef DEBUGGER_ARG_OFFSET
292 #define DEBUGGER_ARG_OFFSET(OFFSET, X) (OFFSET + 0)
293 #endif
294
295 /* This obstack holds the stab string currently being constructed. We
296 build it up here, then write it out, so we can split long lines up
297 properly (see dbxout_finish_complex_stabs). */
298 static struct obstack stabstr_ob;
299 static size_t stabstr_last_contin_point;
300
301 #ifdef DBX_USE_BINCL
302 static void emit_bincl_stab (const char *c);
303 static void emit_pending_bincls (void);
304 #endif
305 static inline void emit_pending_bincls_if_required (void);
306
307 static void dbxout_init (const char *);
308
309 static void dbxout_finish (const char *);
310 static void dbxout_start_source_file (unsigned, const char *);
311 static void dbxout_end_source_file (unsigned);
312 static void dbxout_typedefs (tree);
313 static void dbxout_type_index (tree);
314 static void dbxout_args (tree);
315 static void dbxout_type_fields (tree);
316 static void dbxout_type_method_1 (tree);
317 static void dbxout_type_methods (tree);
318 static void dbxout_range_type (tree, tree, tree);
319 static void dbxout_type (tree, int);
320 static bool print_int_cst_bounds_in_octal_p (tree, tree, tree);
321 static bool is_fortran (void);
322 static void dbxout_type_name (tree);
323 static void dbxout_class_name_qualifiers (tree);
324 static int dbxout_symbol_location (tree, tree, const char *, rtx);
325 static void dbxout_symbol_name (tree, const char *, int);
326 static void dbxout_common_name (tree, const char *, stab_code_type);
327 static const char *dbxout_common_check (tree, int *);
328 static void dbxout_global_decl (tree);
329 static void dbxout_type_decl (tree, int);
330 static void dbxout_handle_pch (unsigned);
331 static void debug_free_queue (void);
332 \f
333 /* The debug hooks structure. */
334 #if defined (DBX_DEBUGGING_INFO)
335
336 static void dbxout_source_line (unsigned int, const char *, int, bool);
337 static void dbxout_begin_prologue (unsigned int, const char *);
338 static void dbxout_source_file (const char *);
339 static void dbxout_function_end (tree);
340 static void dbxout_begin_function (tree);
341 static void dbxout_begin_block (unsigned, unsigned);
342 static void dbxout_end_block (unsigned, unsigned);
343 static void dbxout_function_decl (tree);
344
345 const struct gcc_debug_hooks dbx_debug_hooks =
346 {
347 dbxout_init,
348 dbxout_finish,
349 debug_nothing_void,
350 debug_nothing_int_charstar,
351 debug_nothing_int_charstar,
352 dbxout_start_source_file,
353 dbxout_end_source_file,
354 dbxout_begin_block,
355 dbxout_end_block,
356 debug_true_const_tree, /* ignore_block */
357 dbxout_source_line, /* source_line */
358 dbxout_begin_prologue, /* begin_prologue */
359 debug_nothing_int_charstar, /* end_prologue */
360 debug_nothing_int_charstar, /* begin_epilogue */
361 debug_nothing_int_charstar, /* end_epilogue */
362 #ifdef DBX_FUNCTION_FIRST
363 dbxout_begin_function,
364 #else
365 debug_nothing_tree, /* begin_function */
366 #endif
367 debug_nothing_int, /* end_function */
368 dbxout_function_decl,
369 dbxout_global_decl, /* global_decl */
370 dbxout_type_decl, /* type_decl */
371 debug_nothing_tree_tree_tree_bool, /* imported_module_or_decl */
372 debug_nothing_tree, /* deferred_inline_function */
373 debug_nothing_tree, /* outlining_inline_function */
374 debug_nothing_rtx, /* label */
375 dbxout_handle_pch, /* handle_pch */
376 debug_nothing_rtx, /* var_location */
377 debug_nothing_void, /* switch_text_section */
378 debug_nothing_tree_tree, /* set_name */
379 0, /* start_end_main_source_file */
380 TYPE_SYMTAB_IS_ADDRESS /* tree_type_symtab_field */
381 };
382 #endif /* DBX_DEBUGGING_INFO */
383
384 #if defined (XCOFF_DEBUGGING_INFO)
385 const struct gcc_debug_hooks xcoff_debug_hooks =
386 {
387 dbxout_init,
388 dbxout_finish,
389 debug_nothing_void,
390 debug_nothing_int_charstar,
391 debug_nothing_int_charstar,
392 dbxout_start_source_file,
393 dbxout_end_source_file,
394 xcoffout_begin_block,
395 xcoffout_end_block,
396 debug_true_const_tree, /* ignore_block */
397 xcoffout_source_line,
398 xcoffout_begin_prologue, /* begin_prologue */
399 debug_nothing_int_charstar, /* end_prologue */
400 debug_nothing_int_charstar, /* begin_epilogue */
401 xcoffout_end_epilogue,
402 debug_nothing_tree, /* begin_function */
403 xcoffout_end_function,
404 debug_nothing_tree, /* function_decl */
405 dbxout_global_decl, /* global_decl */
406 dbxout_type_decl, /* type_decl */
407 debug_nothing_tree_tree_tree_bool, /* imported_module_or_decl */
408 debug_nothing_tree, /* deferred_inline_function */
409 debug_nothing_tree, /* outlining_inline_function */
410 debug_nothing_rtx, /* label */
411 dbxout_handle_pch, /* handle_pch */
412 debug_nothing_rtx, /* var_location */
413 debug_nothing_void, /* switch_text_section */
414 debug_nothing_tree_tree, /* set_name */
415 0, /* start_end_main_source_file */
416 TYPE_SYMTAB_IS_ADDRESS /* tree_type_symtab_field */
417 };
418 #endif /* XCOFF_DEBUGGING_INFO */
419 \f
420 /* Numeric formatting helper macro. Note that this does not handle
421 hexadecimal. */
422 #define NUMBER_FMT_LOOP(P, NUM, BASE) \
423 do \
424 { \
425 int digit = NUM % BASE; \
426 NUM /= BASE; \
427 *--P = digit + '0'; \
428 } \
429 while (NUM > 0)
430
431 /* Utility: write a decimal integer NUM to asm_out_file. */
432 void
433 dbxout_int (int num)
434 {
435 char buf[64];
436 char *p = buf + sizeof buf;
437 unsigned int unum;
438
439 if (num == 0)
440 {
441 putc ('0', asm_out_file);
442 return;
443 }
444 if (num < 0)
445 {
446 putc ('-', asm_out_file);
447 unum = -num;
448 }
449 else
450 unum = num;
451
452 NUMBER_FMT_LOOP (p, unum, 10);
453
454 while (p < buf + sizeof buf)
455 {
456 putc (*p, asm_out_file);
457 p++;
458 }
459 }
460
461 \f
462 /* Primitives for emitting simple stabs directives. All other stabs
463 routines should use these functions instead of directly emitting
464 stabs. They are exported because machine-dependent code may need
465 to invoke them, e.g. in a DBX_OUTPUT_* macro whose definition
466 forwards to code in CPU.c. */
467
468 /* The following functions should all be called immediately after one
469 of the dbxout_begin_stab* functions (below). They write out
470 various things as the value of a stab. */
471
472 /* Write out a literal zero as the value of a stab. */
473 void
474 dbxout_stab_value_zero (void)
475 {
476 fputs ("0\n", asm_out_file);
477 }
478
479 /* Write out the label LABEL as the value of a stab. */
480 void
481 dbxout_stab_value_label (const char *label)
482 {
483 assemble_name (asm_out_file, label);
484 putc ('\n', asm_out_file);
485 }
486
487 /* Write out the difference of two labels, LABEL - BASE, as the value
488 of a stab. */
489 void
490 dbxout_stab_value_label_diff (const char *label, const char *base)
491 {
492 assemble_name (asm_out_file, label);
493 putc ('-', asm_out_file);
494 assemble_name (asm_out_file, base);
495 putc ('\n', asm_out_file);
496 }
497
498 /* Write out an internal label as the value of a stab, and immediately
499 emit that internal label. This should be used only when
500 dbxout_stabd will not work. STEM is the name stem of the label,
501 COUNTERP is a pointer to a counter variable which will be used to
502 guarantee label uniqueness. */
503 void
504 dbxout_stab_value_internal_label (const char *stem, int *counterp)
505 {
506 char label[100];
507 int counter = counterp ? (*counterp)++ : 0;
508
509 ASM_GENERATE_INTERNAL_LABEL (label, stem, counter);
510 dbxout_stab_value_label (label);
511 targetm.asm_out.internal_label (asm_out_file, stem, counter);
512 }
513
514 /* Write out the difference between BASE and an internal label as the
515 value of a stab, and immediately emit that internal label. STEM and
516 COUNTERP are as for dbxout_stab_value_internal_label. */
517 void
518 dbxout_stab_value_internal_label_diff (const char *stem, int *counterp,
519 const char *base)
520 {
521 char label[100];
522 int counter = counterp ? (*counterp)++ : 0;
523
524 ASM_GENERATE_INTERNAL_LABEL (label, stem, counter);
525 dbxout_stab_value_label_diff (label, base);
526 targetm.asm_out.internal_label (asm_out_file, stem, counter);
527 }
528
529 /* The following functions produce specific kinds of stab directives. */
530
531 /* Write a .stabd directive with type STYPE and desc SDESC to asm_out_file. */
532 void
533 dbxout_stabd (int stype, int sdesc)
534 {
535 fputs (ASM_STABD_OP, asm_out_file);
536 dbxout_int (stype);
537 fputs (",0,", asm_out_file);
538 dbxout_int (sdesc);
539 putc ('\n', asm_out_file);
540 }
541
542 /* Write a .stabn directive with type STYPE. This function stops
543 short of emitting the value field, which is the responsibility of
544 the caller (normally it will be either a symbol or the difference
545 of two symbols). */
546
547 void
548 dbxout_begin_stabn (int stype)
549 {
550 fputs (ASM_STABN_OP, asm_out_file);
551 dbxout_int (stype);
552 fputs (",0,0,", asm_out_file);
553 }
554
555 /* Write a .stabn directive with type N_SLINE and desc LINE. As above,
556 the value field is the responsibility of the caller. */
557 void
558 dbxout_begin_stabn_sline (int lineno)
559 {
560 fputs (ASM_STABN_OP, asm_out_file);
561 dbxout_int (N_SLINE);
562 fputs (",0,", asm_out_file);
563 dbxout_int (lineno);
564 putc (',', asm_out_file);
565 }
566
567 /* Begin a .stabs directive with string "", type STYPE, and desc and
568 other fields 0. The value field is the responsibility of the
569 caller. This function cannot be used for .stabx directives. */
570 void
571 dbxout_begin_empty_stabs (int stype)
572 {
573 fputs (ASM_STABS_OP, asm_out_file);
574 fputs ("\"\",", asm_out_file);
575 dbxout_int (stype);
576 fputs (",0,0,", asm_out_file);
577 }
578
579 /* Begin a .stabs directive with string STR, type STYPE, and desc 0.
580 The value field is the responsibility of the caller. */
581 void
582 dbxout_begin_simple_stabs (const char *str, int stype)
583 {
584 fputs (ASM_STABS_OP, asm_out_file);
585 output_quoted_string (asm_out_file, str);
586 putc (',', asm_out_file);
587 dbxout_int (stype);
588 fputs (",0,0,", asm_out_file);
589 }
590
591 /* As above but use SDESC for the desc field. */
592 void
593 dbxout_begin_simple_stabs_desc (const char *str, int stype, int sdesc)
594 {
595 fputs (ASM_STABS_OP, asm_out_file);
596 output_quoted_string (asm_out_file, str);
597 putc (',', asm_out_file);
598 dbxout_int (stype);
599 fputs (",0,", asm_out_file);
600 dbxout_int (sdesc);
601 putc (',', asm_out_file);
602 }
603
604 /* The next set of functions are entirely concerned with production of
605 "complex" .stabs directives: that is, .stabs directives whose
606 strings have to be constructed piecemeal. dbxout_type,
607 dbxout_symbol, etc. use these routines heavily. The string is queued
608 up in an obstack, then written out by dbxout_finish_complex_stabs, which
609 is also responsible for splitting it up if it exceeds DBX_CONTIN_LENGTH.
610 (You might think it would be more efficient to go straight to stdio
611 when DBX_CONTIN_LENGTH is 0 (i.e. no length limit) but that turns
612 out not to be the case, and anyway this needs fewer #ifdefs.) */
613
614 /* Begin a complex .stabs directive. If we can, write the initial
615 ASM_STABS_OP to the asm_out_file. */
616
617 static void
618 dbxout_begin_complex_stabs (void)
619 {
620 emit_pending_bincls_if_required ();
621 FORCE_TEXT;
622 fputs (ASM_STABS_OP, asm_out_file);
623 putc ('"', asm_out_file);
624 gcc_assert (stabstr_last_contin_point == 0);
625 }
626
627 /* As above, but do not force text or emit pending bincls. This is
628 used by dbxout_symbol_location, which needs to do something else. */
629 static void
630 dbxout_begin_complex_stabs_noforcetext (void)
631 {
632 fputs (ASM_STABS_OP, asm_out_file);
633 putc ('"', asm_out_file);
634 gcc_assert (stabstr_last_contin_point == 0);
635 }
636
637 /* Add CHR, a single character, to the string being built. */
638 #define stabstr_C(chr) obstack_1grow (&stabstr_ob, chr)
639
640 /* Add STR, a normal C string, to the string being built. */
641 #define stabstr_S(str) obstack_grow (&stabstr_ob, str, strlen (str))
642
643 /* Add the text of ID, an IDENTIFIER_NODE, to the string being built. */
644 #define stabstr_I(id) obstack_grow (&stabstr_ob, \
645 IDENTIFIER_POINTER (id), \
646 IDENTIFIER_LENGTH (id))
647
648 /* Add NUM, a signed decimal number, to the string being built. */
649 static void
650 stabstr_D (HOST_WIDE_INT num)
651 {
652 char buf[64];
653 char *p = buf + sizeof buf;
654 unsigned int unum;
655
656 if (num == 0)
657 {
658 stabstr_C ('0');
659 return;
660 }
661 if (num < 0)
662 {
663 stabstr_C ('-');
664 unum = -num;
665 }
666 else
667 unum = num;
668
669 NUMBER_FMT_LOOP (p, unum, 10);
670
671 obstack_grow (&stabstr_ob, p, (buf + sizeof buf) - p);
672 }
673
674 /* Add NUM, an unsigned decimal number, to the string being built. */
675 static void
676 stabstr_U (unsigned HOST_WIDE_INT num)
677 {
678 char buf[64];
679 char *p = buf + sizeof buf;
680 if (num == 0)
681 {
682 stabstr_C ('0');
683 return;
684 }
685 NUMBER_FMT_LOOP (p, num, 10);
686 obstack_grow (&stabstr_ob, p, (buf + sizeof buf) - p);
687 }
688
689 /* Add CST, an INTEGER_CST tree, to the string being built as an
690 unsigned octal number. This routine handles values which are
691 larger than a single HOST_WIDE_INT. */
692 static void
693 stabstr_O (tree cst)
694 {
695 unsigned HOST_WIDE_INT high = TREE_INT_CST_HIGH (cst);
696 unsigned HOST_WIDE_INT low = TREE_INT_CST_LOW (cst);
697
698 char buf[128];
699 char *p = buf + sizeof buf;
700
701 /* GDB wants constants with no extra leading "1" bits, so
702 we need to remove any sign-extension that might be
703 present. */
704 {
705 const unsigned int width = TYPE_PRECISION (TREE_TYPE (cst));
706 if (width == HOST_BITS_PER_DOUBLE_INT)
707 ;
708 else if (width > HOST_BITS_PER_WIDE_INT)
709 high &= (((HOST_WIDE_INT) 1 << (width - HOST_BITS_PER_WIDE_INT)) - 1);
710 else if (width == HOST_BITS_PER_WIDE_INT)
711 high = 0;
712 else
713 high = 0, low &= (((HOST_WIDE_INT) 1 << width) - 1);
714 }
715
716 /* Leading zero for base indicator. */
717 stabstr_C ('0');
718
719 /* If the value is zero, the base indicator will serve as the value
720 all by itself. */
721 if (high == 0 && low == 0)
722 return;
723
724 /* If the high half is zero, we need only print the low half normally. */
725 if (high == 0)
726 NUMBER_FMT_LOOP (p, low, 8);
727 else
728 {
729 /* When high != 0, we need to print enough zeroes from low to
730 give the digits from high their proper place-values. Hence
731 NUMBER_FMT_LOOP cannot be used. */
732 const int n_digits = HOST_BITS_PER_WIDE_INT / 3;
733 int i;
734
735 for (i = 1; i <= n_digits; i++)
736 {
737 unsigned int digit = low % 8;
738 low /= 8;
739 *--p = '0' + digit;
740 }
741
742 /* Octal digits carry exactly three bits of information. The
743 width of a HOST_WIDE_INT is not normally a multiple of three.
744 Therefore, the next digit printed probably needs to carry
745 information from both low and high. */
746 if (HOST_BITS_PER_WIDE_INT % 3 != 0)
747 {
748 const int n_leftover_bits = HOST_BITS_PER_WIDE_INT % 3;
749 const int n_bits_from_high = 3 - n_leftover_bits;
750
751 const unsigned HOST_WIDE_INT
752 low_mask = (((unsigned HOST_WIDE_INT)1) << n_leftover_bits) - 1;
753 const unsigned HOST_WIDE_INT
754 high_mask = (((unsigned HOST_WIDE_INT)1) << n_bits_from_high) - 1;
755
756 unsigned int digit;
757
758 /* At this point, only the bottom n_leftover_bits bits of low
759 should be set. */
760 gcc_assert (!(low & ~low_mask));
761
762 digit = (low | ((high & high_mask) << n_leftover_bits));
763 high >>= n_bits_from_high;
764
765 *--p = '0' + digit;
766 }
767
768 /* Now we can format high in the normal manner. However, if
769 the only bits of high that were set were handled by the
770 digit split between low and high, high will now be zero, and
771 we don't want to print extra digits in that case. */
772 if (high)
773 NUMBER_FMT_LOOP (p, high, 8);
774 }
775
776 obstack_grow (&stabstr_ob, p, (buf + sizeof buf) - p);
777 }
778
779 /* Called whenever it is safe to break a stabs string into multiple
780 .stabs directives. If the current string has exceeded the limit
781 set by DBX_CONTIN_LENGTH, mark the current position in the buffer
782 as a continuation point by inserting DBX_CONTIN_CHAR (doubled if
783 it is a backslash) and a null character. */
784 static inline void
785 stabstr_continue (void)
786 {
787 if (DBX_CONTIN_LENGTH > 0
788 && obstack_object_size (&stabstr_ob) - stabstr_last_contin_point
789 > DBX_CONTIN_LENGTH)
790 {
791 if (DBX_CONTIN_CHAR == '\\')
792 obstack_1grow (&stabstr_ob, '\\');
793 obstack_1grow (&stabstr_ob, DBX_CONTIN_CHAR);
794 obstack_1grow (&stabstr_ob, '\0');
795 stabstr_last_contin_point = obstack_object_size (&stabstr_ob);
796 }
797 }
798 #define CONTIN stabstr_continue ()
799
800 /* Macro subroutine of dbxout_finish_complex_stabs, which emits
801 all of the arguments to the .stabs directive after the string.
802 Overridden by xcoffout.h. CODE is the stabs code for this symbol;
803 LINE is the source line to write into the desc field (in extended
804 mode); SYM is the symbol itself.
805
806 ADDR, LABEL, and NUMBER are three different ways to represent the
807 stabs value field. At most one of these should be nonzero.
808
809 ADDR is used most of the time; it represents the value as an
810 RTL address constant.
811
812 LABEL is used (currently) only for N_CATCH stabs; it represents
813 the value as a string suitable for assemble_name.
814
815 NUMBER is used when the value is an offset from an implicit base
816 pointer (e.g. for a stack variable), or an index (e.g. for a
817 register variable). It represents the value as a decimal integer. */
818
819 #ifndef DBX_FINISH_STABS
820 #define DBX_FINISH_STABS(SYM, CODE, LINE, ADDR, LABEL, NUMBER) \
821 do { \
822 int line_ = use_gnu_debug_info_extensions ? LINE : 0; \
823 \
824 dbxout_int (CODE); \
825 fputs (",0,", asm_out_file); \
826 dbxout_int (line_); \
827 putc (',', asm_out_file); \
828 if (ADDR) \
829 output_addr_const (asm_out_file, ADDR); \
830 else if (LABEL) \
831 assemble_name (asm_out_file, LABEL); \
832 else \
833 dbxout_int (NUMBER); \
834 putc ('\n', asm_out_file); \
835 } while (0)
836 #endif
837
838 /* Finish the emission of a complex .stabs directive. When DBX_CONTIN_LENGTH
839 is zero, this has only to emit the close quote and the remainder of
840 the arguments. When it is nonzero, the string has been marshalled in
841 stabstr_ob, and this routine is responsible for breaking it up into
842 DBX_CONTIN_LENGTH-sized chunks.
843
844 SYM is the DECL of the symbol under consideration; it is used only
845 for its DECL_SOURCE_LINE. The other arguments are all passed directly
846 to DBX_FINISH_STABS; see above for details. */
847
848 static void
849 dbxout_finish_complex_stabs (tree sym, stab_code_type code,
850 rtx addr, const char *label, int number)
851 {
852 int line ATTRIBUTE_UNUSED;
853 char *str;
854 size_t len;
855
856 line = sym ? DECL_SOURCE_LINE (sym) : 0;
857 if (DBX_CONTIN_LENGTH > 0)
858 {
859 char *chunk;
860 size_t chunklen;
861
862 /* Nul-terminate the growing string, then get its size and
863 address. */
864 obstack_1grow (&stabstr_ob, '\0');
865
866 len = obstack_object_size (&stabstr_ob);
867 chunk = str = XOBFINISH (&stabstr_ob, char *);
868
869 /* Within the buffer are a sequence of NUL-separated strings,
870 each of which is to be written out as a separate stab
871 directive. */
872 for (;;)
873 {
874 chunklen = strlen (chunk);
875 fwrite (chunk, 1, chunklen, asm_out_file);
876 fputs ("\",", asm_out_file);
877
878 /* Must add an extra byte to account for the NUL separator. */
879 chunk += chunklen + 1;
880 len -= chunklen + 1;
881
882 /* Only put a line number on the last stab in the sequence. */
883 DBX_FINISH_STABS (sym, code, len == 0 ? line : 0,
884 addr, label, number);
885 if (len == 0)
886 break;
887
888 fputs (ASM_STABS_OP, asm_out_file);
889 putc ('"', asm_out_file);
890 }
891 stabstr_last_contin_point = 0;
892 }
893 else
894 {
895 /* No continuations - we can put the whole string out at once.
896 It is faster to augment the string with the close quote and
897 comma than to do a two-character fputs. */
898 obstack_grow (&stabstr_ob, "\",", 2);
899 len = obstack_object_size (&stabstr_ob);
900 str = XOBFINISH (&stabstr_ob, char *);
901
902 fwrite (str, 1, len, asm_out_file);
903 DBX_FINISH_STABS (sym, code, line, addr, label, number);
904 }
905 obstack_free (&stabstr_ob, str);
906 }
907
908 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
909
910 /* When -gused is used, emit debug info for only used symbols. But in
911 addition to the standard intercepted debug_hooks there are some
912 direct calls into this file, i.e., dbxout_symbol, dbxout_parms, and
913 dbxout_reg_params. Those routines may also be called from a higher
914 level intercepted routine. So to prevent recording data for an inner
915 call to one of these for an intercept, we maintain an intercept
916 nesting counter (debug_nesting). We only save the intercepted
917 arguments if the nesting is 1. */
918 static int debug_nesting = 0;
919
920 static tree *symbol_queue;
921 static int symbol_queue_index = 0;
922 static int symbol_queue_size = 0;
923
924 #define DBXOUT_DECR_NESTING \
925 if (--debug_nesting == 0 && symbol_queue_index > 0) \
926 { emit_pending_bincls_if_required (); debug_flush_symbol_queue (); }
927
928 #define DBXOUT_DECR_NESTING_AND_RETURN(x) \
929 do {--debug_nesting; return (x);} while (0)
930
931 #endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */
932
933 #if defined (DBX_DEBUGGING_INFO)
934
935 static void
936 dbxout_function_end (tree decl ATTRIBUTE_UNUSED)
937 {
938 char lscope_label_name[100];
939
940 /* The Lscope label must be emitted even if we aren't doing anything
941 else; dbxout_block needs it. */
942 switch_to_section (function_section (current_function_decl));
943
944 /* Convert Lscope into the appropriate format for local labels in case
945 the system doesn't insert underscores in front of user generated
946 labels. */
947 ASM_GENERATE_INTERNAL_LABEL (lscope_label_name, "Lscope", scope_labelno);
948 targetm.asm_out.internal_label (asm_out_file, "Lscope", scope_labelno);
949
950 /* The N_FUN tag at the end of the function is a GNU extension,
951 which may be undesirable, and is unnecessary if we do not have
952 named sections. */
953 if (!use_gnu_debug_info_extensions
954 || NO_DBX_FUNCTION_END
955 || !targetm_common.have_named_sections)
956 return;
957
958 /* By convention, GCC will mark the end of a function with an N_FUN
959 symbol and an empty string. */
960 if (flag_reorder_blocks_and_partition)
961 {
962 dbxout_begin_empty_stabs (N_FUN);
963 dbxout_stab_value_label_diff (crtl->subsections.hot_section_end_label,
964 crtl->subsections.hot_section_label);
965 dbxout_begin_empty_stabs (N_FUN);
966 dbxout_stab_value_label_diff (crtl->subsections.cold_section_end_label,
967 crtl->subsections.cold_section_label);
968 }
969 else
970 {
971 char begin_label[20];
972 /* Reference current function start using LFBB. */
973 ASM_GENERATE_INTERNAL_LABEL (begin_label, "LFBB", scope_labelno);
974 dbxout_begin_empty_stabs (N_FUN);
975 dbxout_stab_value_label_diff (lscope_label_name, begin_label);
976 }
977
978 if (!NO_DBX_BNSYM_ENSYM && !flag_debug_only_used_symbols)
979 dbxout_stabd (N_ENSYM, 0);
980 }
981 #endif /* DBX_DEBUGGING_INFO */
982
983 /* Get lang description for N_SO stab. */
984 static unsigned int ATTRIBUTE_UNUSED
985 get_lang_number (void)
986 {
987 const char *language_string = lang_hooks.name;
988
989 if (strcmp (language_string, "GNU C") == 0)
990 return N_SO_C;
991 else if (strcmp (language_string, "GNU C++") == 0)
992 return N_SO_CC;
993 else if (strcmp (language_string, "GNU F77") == 0)
994 return N_SO_FORTRAN;
995 else if (strcmp (language_string, "GNU Fortran") == 0)
996 return N_SO_FORTRAN90; /* CHECKME */
997 else if (strcmp (language_string, "GNU Pascal") == 0)
998 return N_SO_PASCAL;
999 else if (strcmp (language_string, "GNU Objective-C") == 0)
1000 return N_SO_OBJC;
1001 else if (strcmp (language_string, "GNU Objective-C++") == 0)
1002 return N_SO_OBJCPLUS;
1003 else
1004 return 0;
1005
1006 }
1007
1008 static bool
1009 is_fortran (void)
1010 {
1011 unsigned int lang = get_lang_number ();
1012
1013 return (lang == N_SO_FORTRAN) || (lang == N_SO_FORTRAN90);
1014 }
1015
1016 /* At the beginning of compilation, start writing the symbol table.
1017 Initialize `typevec' and output the standard data types of C. */
1018
1019 static void
1020 dbxout_init (const char *input_file_name)
1021 {
1022 char ltext_label_name[100];
1023 bool used_ltext_label_name = false;
1024 tree syms = lang_hooks.decls.getdecls ();
1025 const char *mapped_name;
1026
1027 typevec_len = 100;
1028 typevec = ggc_alloc_cleared_vec_typeinfo (typevec_len);
1029
1030 /* stabstr_ob contains one string, which will be just fine with
1031 1-byte alignment. */
1032 obstack_specify_allocation (&stabstr_ob, 0, 1, xmalloc, free);
1033
1034 /* Convert Ltext into the appropriate format for local labels in case
1035 the system doesn't insert underscores in front of user generated
1036 labels. */
1037 ASM_GENERATE_INTERNAL_LABEL (ltext_label_name, "Ltext", 0);
1038
1039 /* Put the current working directory in an N_SO symbol. */
1040 if (use_gnu_debug_info_extensions && !NO_DBX_MAIN_SOURCE_DIRECTORY)
1041 {
1042 static const char *cwd;
1043
1044 if (!cwd)
1045 {
1046 cwd = get_src_pwd ();
1047 if (cwd[0] == '\0')
1048 cwd = "/";
1049 else if (!IS_DIR_SEPARATOR (cwd[strlen (cwd) - 1]))
1050 cwd = concat (cwd, "/", NULL);
1051 cwd = remap_debug_filename (cwd);
1052 }
1053 #ifdef DBX_OUTPUT_MAIN_SOURCE_DIRECTORY
1054 DBX_OUTPUT_MAIN_SOURCE_DIRECTORY (asm_out_file, cwd);
1055 #else /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */
1056 dbxout_begin_simple_stabs_desc (cwd, N_SO, get_lang_number ());
1057 dbxout_stab_value_label (ltext_label_name);
1058 used_ltext_label_name = true;
1059 #endif /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */
1060 }
1061
1062 mapped_name = remap_debug_filename (input_file_name);
1063 #ifdef DBX_OUTPUT_MAIN_SOURCE_FILENAME
1064 DBX_OUTPUT_MAIN_SOURCE_FILENAME (asm_out_file, mapped_name);
1065 #else
1066 dbxout_begin_simple_stabs_desc (mapped_name, N_SO, get_lang_number ());
1067 dbxout_stab_value_label (ltext_label_name);
1068 used_ltext_label_name = true;
1069 #endif
1070
1071 if (used_ltext_label_name)
1072 {
1073 switch_to_section (text_section);
1074 targetm.asm_out.internal_label (asm_out_file, "Ltext", 0);
1075 }
1076
1077 /* Emit an N_OPT stab to indicate that this file was compiled by GCC.
1078 The string used is historical. */
1079 #ifndef NO_DBX_GCC_MARKER
1080 dbxout_begin_simple_stabs ("gcc2_compiled.", N_OPT);
1081 dbxout_stab_value_zero ();
1082 #endif
1083
1084 base_input_file = lastfile = input_file_name;
1085
1086 next_type_number = 1;
1087
1088 #ifdef DBX_USE_BINCL
1089 current_file = XNEW (struct dbx_file);
1090 current_file->next = NULL;
1091 current_file->file_number = 0;
1092 current_file->next_type_number = 1;
1093 next_file_number = 1;
1094 current_file->prev = NULL;
1095 current_file->bincl_status = BINCL_NOT_REQUIRED;
1096 current_file->pending_bincl_name = NULL;
1097 #endif
1098
1099 /* Get all permanent types that have typedef names, and output them
1100 all, except for those already output. Some language front ends
1101 put these declarations in the top-level scope; some do not;
1102 the latter are responsible for calling debug_hooks->type_decl from
1103 their record_builtin_type function. */
1104 dbxout_typedefs (syms);
1105
1106 if (preinit_symbols)
1107 {
1108 tree t;
1109 for (t = nreverse (preinit_symbols); t; t = TREE_CHAIN (t))
1110 dbxout_symbol (TREE_VALUE (t), 0);
1111 preinit_symbols = 0;
1112 }
1113 }
1114
1115 /* Output any typedef names for types described by TYPE_DECLs in SYMS. */
1116
1117 static void
1118 dbxout_typedefs (tree syms)
1119 {
1120 for (; syms != NULL_TREE; syms = DECL_CHAIN (syms))
1121 {
1122 if (TREE_CODE (syms) == TYPE_DECL)
1123 {
1124 tree type = TREE_TYPE (syms);
1125 if (TYPE_NAME (type)
1126 && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
1127 && COMPLETE_OR_VOID_TYPE_P (type)
1128 && ! TREE_ASM_WRITTEN (TYPE_NAME (type)))
1129 dbxout_symbol (TYPE_NAME (type), 0);
1130 }
1131 }
1132 }
1133
1134 #ifdef DBX_USE_BINCL
1135 /* Emit BINCL stab using given name. */
1136 static void
1137 emit_bincl_stab (const char *name)
1138 {
1139 dbxout_begin_simple_stabs (name, N_BINCL);
1140 dbxout_stab_value_zero ();
1141 }
1142
1143 /* If there are pending bincls then it is time to emit all of them. */
1144
1145 static inline void
1146 emit_pending_bincls_if_required (void)
1147 {
1148 if (pending_bincls)
1149 emit_pending_bincls ();
1150 }
1151
1152 /* Emit all pending bincls. */
1153
1154 static void
1155 emit_pending_bincls (void)
1156 {
1157 struct dbx_file *f = current_file;
1158
1159 /* Find first pending bincl. */
1160 while (f->bincl_status == BINCL_PENDING)
1161 f = f->next;
1162
1163 /* Now emit all bincls. */
1164 f = f->prev;
1165
1166 while (f)
1167 {
1168 if (f->bincl_status == BINCL_PENDING)
1169 {
1170 emit_bincl_stab (f->pending_bincl_name);
1171
1172 /* Update file number and status. */
1173 f->file_number = next_file_number++;
1174 f->bincl_status = BINCL_PROCESSED;
1175 }
1176 if (f == current_file)
1177 break;
1178 f = f->prev;
1179 }
1180
1181 /* All pending bincls have been emitted. */
1182 pending_bincls = 0;
1183 }
1184
1185 #else
1186
1187 static inline void
1188 emit_pending_bincls_if_required (void) {}
1189 #endif
1190
1191 /* Change to reading from a new source file. Generate a N_BINCL stab. */
1192
1193 static void
1194 dbxout_start_source_file (unsigned int line ATTRIBUTE_UNUSED,
1195 const char *filename ATTRIBUTE_UNUSED)
1196 {
1197 #ifdef DBX_USE_BINCL
1198 struct dbx_file *n = XNEW (struct dbx_file);
1199
1200 n->next = current_file;
1201 n->next_type_number = 1;
1202 /* Do not assign file number now.
1203 Delay it until we actually emit BINCL. */
1204 n->file_number = 0;
1205 n->prev = NULL;
1206 current_file->prev = n;
1207 n->bincl_status = BINCL_PENDING;
1208 n->pending_bincl_name = remap_debug_filename (filename);
1209 pending_bincls = 1;
1210 current_file = n;
1211 #endif
1212 }
1213
1214 /* Revert to reading a previous source file. Generate a N_EINCL stab. */
1215
1216 static void
1217 dbxout_end_source_file (unsigned int line ATTRIBUTE_UNUSED)
1218 {
1219 #ifdef DBX_USE_BINCL
1220 /* Emit EINCL stab only if BINCL is not pending. */
1221 if (current_file->bincl_status == BINCL_PROCESSED)
1222 {
1223 dbxout_begin_stabn (N_EINCL);
1224 dbxout_stab_value_zero ();
1225 }
1226 current_file->bincl_status = BINCL_NOT_REQUIRED;
1227 current_file = current_file->next;
1228 #endif
1229 }
1230
1231 /* Handle a few odd cases that occur when trying to make PCH files work. */
1232
1233 static void
1234 dbxout_handle_pch (unsigned at_end)
1235 {
1236 if (! at_end)
1237 {
1238 /* When using the PCH, this file will be included, so we need to output
1239 a BINCL. */
1240 dbxout_start_source_file (0, lastfile);
1241
1242 /* The base file when using the PCH won't be the same as
1243 the base file when it's being generated. */
1244 lastfile = NULL;
1245 }
1246 else
1247 {
1248 /* ... and an EINCL. */
1249 dbxout_end_source_file (0);
1250
1251 /* Deal with cases where 'lastfile' was never actually changed. */
1252 lastfile_is_base = lastfile == NULL;
1253 }
1254 }
1255
1256 #if defined (DBX_DEBUGGING_INFO)
1257
1258 static void dbxout_block (tree, int, tree);
1259
1260 /* Output debugging info to FILE to switch to sourcefile FILENAME. */
1261
1262 static void
1263 dbxout_source_file (const char *filename)
1264 {
1265 if (lastfile == 0 && lastfile_is_base)
1266 {
1267 lastfile = base_input_file;
1268 lastfile_is_base = 0;
1269 }
1270
1271 if (filename && (lastfile == 0 || strcmp (filename, lastfile)))
1272 {
1273 /* Don't change section amid function. */
1274 if (current_function_decl == NULL_TREE)
1275 switch_to_section (text_section);
1276
1277 dbxout_begin_simple_stabs (remap_debug_filename (filename), N_SOL);
1278 dbxout_stab_value_internal_label ("Ltext", &source_label_number);
1279 lastfile = filename;
1280 }
1281 }
1282
1283 /* Output N_BNSYM, line number symbol entry, and local symbol at
1284 function scope */
1285
1286 static void
1287 dbxout_begin_prologue (unsigned int lineno, const char *filename)
1288 {
1289 if (use_gnu_debug_info_extensions
1290 && !NO_DBX_FUNCTION_END
1291 && !NO_DBX_BNSYM_ENSYM
1292 && !flag_debug_only_used_symbols)
1293 dbxout_stabd (N_BNSYM, 0);
1294
1295 /* pre-increment the scope counter */
1296 scope_labelno++;
1297
1298 dbxout_source_line (lineno, filename, 0, true);
1299 /* Output function begin block at function scope, referenced
1300 by dbxout_block, dbxout_source_line and dbxout_function_end. */
1301 emit_pending_bincls_if_required ();
1302 targetm.asm_out.internal_label (asm_out_file, "LFBB", scope_labelno);
1303 }
1304
1305 /* Output a line number symbol entry for source file FILENAME and line
1306 number LINENO. */
1307
1308 static void
1309 dbxout_source_line (unsigned int lineno, const char *filename,
1310 int discriminator ATTRIBUTE_UNUSED,
1311 bool is_stmt ATTRIBUTE_UNUSED)
1312 {
1313 dbxout_source_file (filename);
1314
1315 #ifdef DBX_OUTPUT_SOURCE_LINE
1316 DBX_OUTPUT_SOURCE_LINE (asm_out_file, lineno, dbxout_source_line_counter);
1317 #else
1318 if (DBX_LINES_FUNCTION_RELATIVE)
1319 {
1320 char begin_label[20];
1321 dbxout_begin_stabn_sline (lineno);
1322 /* Reference current function start using LFBB. */
1323 ASM_GENERATE_INTERNAL_LABEL (begin_label, "LFBB", scope_labelno);
1324 dbxout_stab_value_internal_label_diff ("LM", &dbxout_source_line_counter,
1325 begin_label);
1326 }
1327 else
1328 dbxout_stabd (N_SLINE, lineno);
1329 #endif
1330 }
1331
1332 /* Describe the beginning of an internal block within a function. */
1333
1334 static void
1335 dbxout_begin_block (unsigned int line ATTRIBUTE_UNUSED, unsigned int n)
1336 {
1337 emit_pending_bincls_if_required ();
1338 targetm.asm_out.internal_label (asm_out_file, "LBB", n);
1339 }
1340
1341 /* Describe the end line-number of an internal block within a function. */
1342
1343 static void
1344 dbxout_end_block (unsigned int line ATTRIBUTE_UNUSED, unsigned int n)
1345 {
1346 emit_pending_bincls_if_required ();
1347 targetm.asm_out.internal_label (asm_out_file, "LBE", n);
1348 }
1349
1350 /* Output dbx data for a function definition.
1351 This includes a definition of the function name itself (a symbol),
1352 definitions of the parameters (locating them in the parameter list)
1353 and then output the block that makes up the function's body
1354 (including all the auto variables of the function). */
1355
1356 static void
1357 dbxout_function_decl (tree decl)
1358 {
1359 emit_pending_bincls_if_required ();
1360 #ifndef DBX_FUNCTION_FIRST
1361 dbxout_begin_function (decl);
1362 #endif
1363 dbxout_block (DECL_INITIAL (decl), 0, DECL_ARGUMENTS (decl));
1364 dbxout_function_end (decl);
1365 }
1366
1367 #endif /* DBX_DEBUGGING_INFO */
1368
1369 /* Debug information for a global DECL. Called from toplev.c after
1370 compilation proper has finished. */
1371 static void
1372 dbxout_global_decl (tree decl)
1373 {
1374 if (TREE_CODE (decl) == VAR_DECL && !DECL_EXTERNAL (decl))
1375 {
1376 int saved_tree_used = TREE_USED (decl);
1377 TREE_USED (decl) = 1;
1378 dbxout_symbol (decl, 0);
1379 TREE_USED (decl) = saved_tree_used;
1380 }
1381 }
1382
1383 /* This is just a function-type adapter; dbxout_symbol does exactly
1384 what we want but returns an int. */
1385 static void
1386 dbxout_type_decl (tree decl, int local)
1387 {
1388 dbxout_symbol (decl, local);
1389 }
1390
1391 /* At the end of compilation, finish writing the symbol table.
1392 The default is to call debug_free_queue but do nothing else. */
1393
1394 static void
1395 dbxout_finish (const char *filename ATTRIBUTE_UNUSED)
1396 {
1397 #ifdef DBX_OUTPUT_MAIN_SOURCE_FILE_END
1398 DBX_OUTPUT_MAIN_SOURCE_FILE_END (asm_out_file, filename);
1399 #elif defined DBX_OUTPUT_NULL_N_SO_AT_MAIN_SOURCE_FILE_END
1400 {
1401 switch_to_section (text_section);
1402 dbxout_begin_empty_stabs (N_SO);
1403 dbxout_stab_value_internal_label ("Letext", 0);
1404 }
1405 #endif
1406 debug_free_queue ();
1407 }
1408
1409 /* Output the index of a type. */
1410
1411 static void
1412 dbxout_type_index (tree type)
1413 {
1414 #ifndef DBX_USE_BINCL
1415 stabstr_D (TYPE_SYMTAB_ADDRESS (type));
1416 #else
1417 struct typeinfo *t = &typevec[TYPE_SYMTAB_ADDRESS (type)];
1418 stabstr_C ('(');
1419 stabstr_D (t->file_number);
1420 stabstr_C (',');
1421 stabstr_D (t->type_number);
1422 stabstr_C (')');
1423 #endif
1424 }
1425
1426 \f
1427 /* Generate the symbols for any queued up type symbols we encountered
1428 while generating the type info for some originally used symbol.
1429 This might generate additional entries in the queue. Only when
1430 the nesting depth goes to 0 is this routine called. */
1431
1432 static void
1433 debug_flush_symbol_queue (void)
1434 {
1435 int i;
1436
1437 /* Make sure that additionally queued items are not flushed
1438 prematurely. */
1439
1440 ++debug_nesting;
1441
1442 for (i = 0; i < symbol_queue_index; ++i)
1443 {
1444 /* If we pushed queued symbols then such symbols must be
1445 output no matter what anyone else says. Specifically,
1446 we need to make sure dbxout_symbol() thinks the symbol was
1447 used and also we need to override TYPE_DECL_SUPPRESS_DEBUG
1448 which may be set for outside reasons. */
1449 int saved_tree_used = TREE_USED (symbol_queue[i]);
1450 int saved_suppress_debug = TYPE_DECL_SUPPRESS_DEBUG (symbol_queue[i]);
1451 TREE_USED (symbol_queue[i]) = 1;
1452 TYPE_DECL_SUPPRESS_DEBUG (symbol_queue[i]) = 0;
1453
1454 #ifdef DBX_DEBUGGING_INFO
1455 dbxout_symbol (symbol_queue[i], 0);
1456 #endif
1457
1458 TREE_USED (symbol_queue[i]) = saved_tree_used;
1459 TYPE_DECL_SUPPRESS_DEBUG (symbol_queue[i]) = saved_suppress_debug;
1460 }
1461
1462 symbol_queue_index = 0;
1463 --debug_nesting;
1464 }
1465
1466 /* Queue a type symbol needed as part of the definition of a decl
1467 symbol. These symbols are generated when debug_flush_symbol_queue()
1468 is called. */
1469
1470 static void
1471 debug_queue_symbol (tree decl)
1472 {
1473 if (symbol_queue_index >= symbol_queue_size)
1474 {
1475 symbol_queue_size += 10;
1476 symbol_queue = XRESIZEVEC (tree, symbol_queue, symbol_queue_size);
1477 }
1478
1479 symbol_queue[symbol_queue_index++] = decl;
1480 }
1481
1482 /* Free symbol queue. */
1483 static void
1484 debug_free_queue (void)
1485 {
1486 if (symbol_queue)
1487 {
1488 free (symbol_queue);
1489 symbol_queue = NULL;
1490 symbol_queue_size = 0;
1491 }
1492 }
1493 \f
1494 /* Used in several places: evaluates to '0' for a private decl,
1495 '1' for a protected decl, '2' for a public decl. */
1496 #define DECL_ACCESSIBILITY_CHAR(DECL) \
1497 (TREE_PRIVATE (DECL) ? '0' : TREE_PROTECTED (DECL) ? '1' : '2')
1498
1499 /* Subroutine of `dbxout_type'. Output the type fields of TYPE.
1500 This must be a separate function because anonymous unions require
1501 recursive calls. */
1502
1503 static void
1504 dbxout_type_fields (tree type)
1505 {
1506 tree tem;
1507
1508 /* Output the name, type, position (in bits), size (in bits) of each
1509 field that we can support. */
1510 for (tem = TYPE_FIELDS (type); tem; tem = DECL_CHAIN (tem))
1511 {
1512 /* If one of the nodes is an error_mark or its type is then
1513 return early. */
1514 if (error_operand_p (tem))
1515 return;
1516
1517 /* Omit here local type decls until we know how to support them. */
1518 if (TREE_CODE (tem) == TYPE_DECL
1519 /* Omit here the nameless fields that are used to skip bits. */
1520 || DECL_IGNORED_P (tem)
1521 /* Omit fields whose position or size are variable or too large to
1522 represent. */
1523 || (TREE_CODE (tem) == FIELD_DECL
1524 && (! tree_fits_shwi_p (bit_position (tem))
1525 || ! DECL_SIZE (tem)
1526 || ! tree_fits_uhwi_p (DECL_SIZE (tem)))))
1527 continue;
1528
1529 else if (TREE_CODE (tem) != CONST_DECL)
1530 {
1531 /* Continue the line if necessary,
1532 but not before the first field. */
1533 if (tem != TYPE_FIELDS (type))
1534 CONTIN;
1535
1536 if (DECL_NAME (tem))
1537 stabstr_I (DECL_NAME (tem));
1538 stabstr_C (':');
1539
1540 if (use_gnu_debug_info_extensions
1541 && (TREE_PRIVATE (tem) || TREE_PROTECTED (tem)
1542 || TREE_CODE (tem) != FIELD_DECL))
1543 {
1544 stabstr_C ('/');
1545 stabstr_C (DECL_ACCESSIBILITY_CHAR (tem));
1546 }
1547
1548 dbxout_type ((TREE_CODE (tem) == FIELD_DECL
1549 && DECL_BIT_FIELD_TYPE (tem))
1550 ? DECL_BIT_FIELD_TYPE (tem) : TREE_TYPE (tem), 0);
1551
1552 if (TREE_CODE (tem) == VAR_DECL)
1553 {
1554 if (TREE_STATIC (tem) && use_gnu_debug_info_extensions)
1555 {
1556 tree name = DECL_ASSEMBLER_NAME (tem);
1557
1558 stabstr_C (':');
1559 stabstr_I (name);
1560 stabstr_C (';');
1561 }
1562 else
1563 /* If TEM is non-static, GDB won't understand it. */
1564 stabstr_S (",0,0;");
1565 }
1566 else
1567 {
1568 stabstr_C (',');
1569 stabstr_D (int_bit_position (tem));
1570 stabstr_C (',');
1571 stabstr_D (tree_to_uhwi (DECL_SIZE (tem)));
1572 stabstr_C (';');
1573 }
1574 }
1575 }
1576 }
1577 \f
1578 /* Subroutine of `dbxout_type_methods'. Output debug info about the
1579 method described DECL. */
1580
1581 static void
1582 dbxout_type_method_1 (tree decl)
1583 {
1584 char c1 = 'A', c2;
1585
1586 if (TREE_CODE (TREE_TYPE (decl)) == FUNCTION_TYPE)
1587 c2 = '?';
1588 else /* it's a METHOD_TYPE. */
1589 {
1590 tree firstarg = TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl)));
1591 /* A for normal functions.
1592 B for `const' member functions.
1593 C for `volatile' member functions.
1594 D for `const volatile' member functions. */
1595 if (TYPE_READONLY (TREE_TYPE (firstarg)))
1596 c1 += 1;
1597 if (TYPE_VOLATILE (TREE_TYPE (firstarg)))
1598 c1 += 2;
1599
1600 if (DECL_VINDEX (decl))
1601 c2 = '*';
1602 else
1603 c2 = '.';
1604 }
1605
1606 /* ??? Output the mangled name, which contains an encoding of the
1607 method's type signature. May not be necessary anymore. */
1608 stabstr_C (':');
1609 stabstr_I (DECL_ASSEMBLER_NAME (decl));
1610 stabstr_C (';');
1611 stabstr_C (DECL_ACCESSIBILITY_CHAR (decl));
1612 stabstr_C (c1);
1613 stabstr_C (c2);
1614
1615 if (DECL_VINDEX (decl) && tree_fits_shwi_p (DECL_VINDEX (decl)))
1616 {
1617 stabstr_D (tree_to_shwi (DECL_VINDEX (decl)));
1618 stabstr_C (';');
1619 dbxout_type (DECL_CONTEXT (decl), 0);
1620 stabstr_C (';');
1621 }
1622 }
1623 \f
1624 /* Subroutine of `dbxout_type'. Output debug info about the methods defined
1625 in TYPE. */
1626
1627 static void
1628 dbxout_type_methods (tree type)
1629 {
1630 /* C++: put out the method names and their parameter lists */
1631 tree methods = TYPE_METHODS (type);
1632 tree fndecl;
1633 tree last;
1634
1635 if (methods == NULL_TREE)
1636 return;
1637
1638 if (TREE_CODE (methods) != TREE_VEC)
1639 fndecl = methods;
1640 else if (TREE_VEC_ELT (methods, 0) != NULL_TREE)
1641 fndecl = TREE_VEC_ELT (methods, 0);
1642 else
1643 fndecl = TREE_VEC_ELT (methods, 1);
1644
1645 while (fndecl)
1646 {
1647 int need_prefix = 1;
1648
1649 /* Group together all the methods for the same operation.
1650 These differ in the types of the arguments. */
1651 for (last = NULL_TREE;
1652 fndecl && (last == NULL_TREE || DECL_NAME (fndecl) == DECL_NAME (last));
1653 fndecl = DECL_CHAIN (fndecl))
1654 /* Output the name of the field (after overloading), as
1655 well as the name of the field before overloading, along
1656 with its parameter list */
1657 {
1658 /* Skip methods that aren't FUNCTION_DECLs. (In C++, these
1659 include TEMPLATE_DECLs.) The debugger doesn't know what
1660 to do with such entities anyhow. */
1661 if (TREE_CODE (fndecl) != FUNCTION_DECL)
1662 continue;
1663
1664 CONTIN;
1665
1666 last = fndecl;
1667
1668 /* Also ignore abstract methods; those are only interesting to
1669 the DWARF backends. */
1670 if (DECL_IGNORED_P (fndecl) || DECL_ABSTRACT (fndecl))
1671 continue;
1672
1673 /* Redundantly output the plain name, since that's what gdb
1674 expects. */
1675 if (need_prefix)
1676 {
1677 stabstr_I (DECL_NAME (fndecl));
1678 stabstr_S ("::");
1679 need_prefix = 0;
1680 }
1681
1682 dbxout_type (TREE_TYPE (fndecl), 0);
1683 dbxout_type_method_1 (fndecl);
1684 }
1685 if (!need_prefix)
1686 stabstr_C (';');
1687 }
1688 }
1689
1690 /* Emit a "range" type specification, which has the form:
1691 "r<index type>;<lower bound>;<upper bound>;".
1692 TYPE is an INTEGER_TYPE, LOW and HIGH are the bounds. */
1693
1694 static void
1695 dbxout_range_type (tree type, tree low, tree high)
1696 {
1697 stabstr_C ('r');
1698 if (TREE_TYPE (type))
1699 dbxout_type (TREE_TYPE (type), 0);
1700 else if (TREE_CODE (type) != INTEGER_TYPE)
1701 dbxout_type (type, 0); /* E.g. Pascal's ARRAY [BOOLEAN] of INTEGER */
1702 else
1703 {
1704 /* Traditionally, we made sure 'int' was type 1, and builtin types
1705 were defined to be sub-ranges of int. Unfortunately, this
1706 does not allow us to distinguish true sub-ranges from integer
1707 types. So, instead we define integer (non-sub-range) types as
1708 sub-ranges of themselves. This matters for Chill. If this isn't
1709 a subrange type, then we want to define it in terms of itself.
1710 However, in C, this may be an anonymous integer type, and we don't
1711 want to emit debug info referring to it. Just calling
1712 dbxout_type_index won't work anyways, because the type hasn't been
1713 defined yet. We make this work for both cases by checked to see
1714 whether this is a defined type, referring to it if it is, and using
1715 'int' otherwise. */
1716 if (TYPE_SYMTAB_ADDRESS (type) != 0)
1717 dbxout_type_index (type);
1718 else
1719 dbxout_type_index (integer_type_node);
1720 }
1721
1722 stabstr_C (';');
1723 if (low && tree_fits_shwi_p (low))
1724 {
1725 if (print_int_cst_bounds_in_octal_p (type, low, high))
1726 stabstr_O (low);
1727 else
1728 stabstr_D (tree_to_shwi (low));
1729 }
1730 else
1731 stabstr_C ('0');
1732
1733 stabstr_C (';');
1734 if (high && tree_fits_shwi_p (high))
1735 {
1736 if (print_int_cst_bounds_in_octal_p (type, low, high))
1737 stabstr_O (high);
1738 else
1739 stabstr_D (tree_to_shwi (high));
1740 stabstr_C (';');
1741 }
1742 else
1743 stabstr_S ("-1;");
1744 }
1745 \f
1746
1747 /* Output a reference to a type. If the type has not yet been
1748 described in the dbx output, output its definition now.
1749 For a type already defined, just refer to its definition
1750 using the type number.
1751
1752 If FULL is nonzero, and the type has been described only with
1753 a forward-reference, output the definition now.
1754 If FULL is zero in this case, just refer to the forward-reference
1755 using the number previously allocated. */
1756
1757 static void
1758 dbxout_type (tree type, int full)
1759 {
1760 static int anonymous_type_number = 0;
1761 tree tem, main_variant, low, high;
1762
1763 if (TREE_CODE (type) == INTEGER_TYPE)
1764 {
1765 if (TREE_TYPE (type) == 0)
1766 {
1767 low = TYPE_MIN_VALUE (type);
1768 high = TYPE_MAX_VALUE (type);
1769 }
1770
1771 else if (subrange_type_for_debug_p (type, &low, &high))
1772 ;
1773
1774 /* If this is a subtype that should not be emitted as a subrange type,
1775 use the base type. */
1776 else
1777 {
1778 type = TREE_TYPE (type);
1779 low = TYPE_MIN_VALUE (type);
1780 high = TYPE_MAX_VALUE (type);
1781 }
1782 }
1783
1784 /* If there was an input error and we don't really have a type,
1785 avoid crashing and write something that is at least valid
1786 by assuming `int'. */
1787 if (type == error_mark_node)
1788 type = integer_type_node;
1789 else
1790 {
1791 if (TYPE_NAME (type)
1792 && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
1793 && TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (type)))
1794 full = 0;
1795 }
1796
1797 /* Try to find the "main variant" with the same name. */
1798 if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
1799 && DECL_ORIGINAL_TYPE (TYPE_NAME (type)))
1800 main_variant = TREE_TYPE (TYPE_NAME (type));
1801 else
1802 main_variant = TYPE_MAIN_VARIANT (type);
1803
1804 /* If we are not using extensions, stabs does not distinguish const and
1805 volatile, so there is no need to make them separate types. */
1806 if (!use_gnu_debug_info_extensions)
1807 type = main_variant;
1808
1809 if (TYPE_SYMTAB_ADDRESS (type) == 0)
1810 {
1811 /* Type has no dbx number assigned. Assign next available number. */
1812 TYPE_SYMTAB_ADDRESS (type) = next_type_number++;
1813
1814 /* Make sure type vector is long enough to record about this type. */
1815
1816 if (next_type_number == typevec_len)
1817 {
1818 typevec = GGC_RESIZEVEC (struct typeinfo, typevec, typevec_len * 2);
1819 memset (typevec + typevec_len, 0, typevec_len * sizeof typevec[0]);
1820 typevec_len *= 2;
1821 }
1822
1823 #ifdef DBX_USE_BINCL
1824 emit_pending_bincls_if_required ();
1825 typevec[TYPE_SYMTAB_ADDRESS (type)].file_number
1826 = current_file->file_number;
1827 typevec[TYPE_SYMTAB_ADDRESS (type)].type_number
1828 = current_file->next_type_number++;
1829 #endif
1830 }
1831
1832 if (flag_debug_only_used_symbols)
1833 {
1834 if ((TREE_CODE (type) == RECORD_TYPE
1835 || TREE_CODE (type) == UNION_TYPE
1836 || TREE_CODE (type) == QUAL_UNION_TYPE
1837 || TREE_CODE (type) == ENUMERAL_TYPE)
1838 && TYPE_STUB_DECL (type)
1839 && DECL_P (TYPE_STUB_DECL (type))
1840 && ! DECL_IGNORED_P (TYPE_STUB_DECL (type)))
1841 debug_queue_symbol (TYPE_STUB_DECL (type));
1842 else if (TYPE_NAME (type)
1843 && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL)
1844 debug_queue_symbol (TYPE_NAME (type));
1845 }
1846
1847 /* Output the number of this type, to refer to it. */
1848 dbxout_type_index (type);
1849
1850 #ifdef DBX_TYPE_DEFINED
1851 if (DBX_TYPE_DEFINED (type))
1852 return;
1853 #endif
1854
1855 /* If this type's definition has been output or is now being output,
1856 that is all. */
1857
1858 switch (typevec[TYPE_SYMTAB_ADDRESS (type)].status)
1859 {
1860 case TYPE_UNSEEN:
1861 break;
1862 case TYPE_XREF:
1863 /* If we have already had a cross reference,
1864 and either that's all we want or that's the best we could do,
1865 don't repeat the cross reference.
1866 Sun dbx crashes if we do. */
1867 if (! full || !COMPLETE_TYPE_P (type)
1868 /* No way in DBX fmt to describe a variable size. */
1869 || ! tree_fits_uhwi_p (TYPE_SIZE (type)))
1870 return;
1871 break;
1872 case TYPE_DEFINED:
1873 return;
1874 }
1875
1876 #ifdef DBX_NO_XREFS
1877 /* For systems where dbx output does not allow the `=xsNAME:' syntax,
1878 leave the type-number completely undefined rather than output
1879 a cross-reference. If we have already used GNU debug info extensions,
1880 then it is OK to output a cross reference. This is necessary to get
1881 proper C++ debug output. */
1882 if ((TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE
1883 || TREE_CODE (type) == QUAL_UNION_TYPE
1884 || TREE_CODE (type) == ENUMERAL_TYPE)
1885 && ! use_gnu_debug_info_extensions)
1886 /* We must use the same test here as we use twice below when deciding
1887 whether to emit a cross-reference. */
1888 if ((TYPE_NAME (type) != 0
1889 && ! (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
1890 && DECL_IGNORED_P (TYPE_NAME (type)))
1891 && !full)
1892 || !COMPLETE_TYPE_P (type)
1893 /* No way in DBX fmt to describe a variable size. */
1894 || ! tree_fits_uhwi_p (TYPE_SIZE (type)))
1895 {
1896 typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_XREF;
1897 return;
1898 }
1899 #endif
1900
1901 /* Output a definition now. */
1902 stabstr_C ('=');
1903
1904 /* Mark it as defined, so that if it is self-referent
1905 we will not get into an infinite recursion of definitions. */
1906
1907 typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_DEFINED;
1908
1909 /* If this type is a variant of some other, hand off. Types with
1910 different names are usefully distinguished. We only distinguish
1911 cv-qualified types if we're using extensions. */
1912 if (TYPE_READONLY (type) > TYPE_READONLY (main_variant))
1913 {
1914 stabstr_C ('k');
1915 dbxout_type (build_type_variant (type, 0, TYPE_VOLATILE (type)), 0);
1916 return;
1917 }
1918 else if (TYPE_VOLATILE (type) > TYPE_VOLATILE (main_variant))
1919 {
1920 stabstr_C ('B');
1921 dbxout_type (build_type_variant (type, TYPE_READONLY (type), 0), 0);
1922 return;
1923 }
1924 else if (main_variant != TYPE_MAIN_VARIANT (type))
1925 {
1926 if (flag_debug_only_used_symbols)
1927 {
1928 tree orig_type = DECL_ORIGINAL_TYPE (TYPE_NAME (type));
1929
1930 if ((TREE_CODE (orig_type) == RECORD_TYPE
1931 || TREE_CODE (orig_type) == UNION_TYPE
1932 || TREE_CODE (orig_type) == QUAL_UNION_TYPE
1933 || TREE_CODE (orig_type) == ENUMERAL_TYPE)
1934 && TYPE_STUB_DECL (orig_type)
1935 && ! DECL_IGNORED_P (TYPE_STUB_DECL (orig_type)))
1936 debug_queue_symbol (TYPE_STUB_DECL (orig_type));
1937 }
1938 /* 'type' is a typedef; output the type it refers to. */
1939 dbxout_type (DECL_ORIGINAL_TYPE (TYPE_NAME (type)), 0);
1940 return;
1941 }
1942 /* else continue. */
1943
1944 switch (TREE_CODE (type))
1945 {
1946 case VOID_TYPE:
1947 case NULLPTR_TYPE:
1948 case LANG_TYPE:
1949 /* For a void type, just define it as itself; i.e., "5=5".
1950 This makes us consider it defined
1951 without saying what it is. The debugger will make it
1952 a void type when the reference is seen, and nothing will
1953 ever override that default. */
1954 dbxout_type_index (type);
1955 break;
1956
1957 case INTEGER_TYPE:
1958 if (type == char_type_node && ! TYPE_UNSIGNED (type))
1959 {
1960 /* Output the type `char' as a subrange of itself!
1961 I don't understand this definition, just copied it
1962 from the output of pcc.
1963 This used to use `r2' explicitly and we used to
1964 take care to make sure that `char' was type number 2. */
1965 stabstr_C ('r');
1966 dbxout_type_index (type);
1967 stabstr_S (";0;127;");
1968 }
1969
1970 /* If this is a subtype of another integer type, always prefer to
1971 write it as a subtype. */
1972 else if (TREE_TYPE (type) != 0
1973 && TREE_CODE (TREE_TYPE (type)) == INTEGER_TYPE)
1974 {
1975 /* If the size is non-standard, say what it is if we can use
1976 GDB extensions. */
1977
1978 if (use_gnu_debug_info_extensions
1979 && TYPE_PRECISION (type) != TYPE_PRECISION (integer_type_node))
1980 {
1981 stabstr_S ("@s");
1982 stabstr_D (TYPE_PRECISION (type));
1983 stabstr_C (';');
1984 }
1985
1986 dbxout_range_type (type, low, high);
1987 }
1988
1989 else
1990 {
1991 /* If the size is non-standard, say what it is if we can use
1992 GDB extensions. */
1993
1994 if (use_gnu_debug_info_extensions
1995 && TYPE_PRECISION (type) != TYPE_PRECISION (integer_type_node))
1996 {
1997 stabstr_S ("@s");
1998 stabstr_D (TYPE_PRECISION (type));
1999 stabstr_C (';');
2000 }
2001
2002 if (print_int_cst_bounds_in_octal_p (type, low, high))
2003 {
2004 stabstr_C ('r');
2005
2006 /* If this type derives from another type, output type index of
2007 parent type. This is particularly important when parent type
2008 is an enumerated type, because not generating the parent type
2009 index would transform the definition of this enumerated type
2010 into a plain unsigned type. */
2011 if (TREE_TYPE (type) != 0)
2012 dbxout_type_index (TREE_TYPE (type));
2013 else
2014 dbxout_type_index (type);
2015
2016 stabstr_C (';');
2017 stabstr_O (low);
2018 stabstr_C (';');
2019 stabstr_O (high);
2020 stabstr_C (';');
2021 }
2022
2023 else
2024 /* Output other integer types as subranges of `int'. */
2025 dbxout_range_type (type, low, high);
2026 }
2027
2028 break;
2029
2030 case REAL_TYPE:
2031 case FIXED_POINT_TYPE:
2032 /* This used to say `r1' and we used to take care
2033 to make sure that `int' was type number 1. */
2034 stabstr_C ('r');
2035 dbxout_type_index (integer_type_node);
2036 stabstr_C (';');
2037 stabstr_D (int_size_in_bytes (type));
2038 stabstr_S (";0;");
2039 break;
2040
2041 case BOOLEAN_TYPE:
2042 if (use_gnu_debug_info_extensions)
2043 {
2044 stabstr_S ("@s");
2045 stabstr_D (BITS_PER_UNIT * int_size_in_bytes (type));
2046 stabstr_S (";-16;");
2047 }
2048 else /* Define as enumeral type (False, True) */
2049 stabstr_S ("eFalse:0,True:1,;");
2050 break;
2051
2052 case COMPLEX_TYPE:
2053 /* Differs from the REAL_TYPE by its new data type number.
2054 R3 is NF_COMPLEX. We don't try to use any of the other NF_*
2055 codes since gdb doesn't care anyway. */
2056
2057 if (TREE_CODE (TREE_TYPE (type)) == REAL_TYPE)
2058 {
2059 stabstr_S ("R3;");
2060 stabstr_D (2 * int_size_in_bytes (TREE_TYPE (type)));
2061 stabstr_S (";0;");
2062 }
2063 else
2064 {
2065 /* Output a complex integer type as a structure,
2066 pending some other way to do it. */
2067 stabstr_C ('s');
2068 stabstr_D (int_size_in_bytes (type));
2069
2070 stabstr_S ("real:");
2071 dbxout_type (TREE_TYPE (type), 0);
2072 stabstr_S (",0,");
2073 stabstr_D (TYPE_PRECISION (TREE_TYPE (type)));
2074
2075 stabstr_S (";imag:");
2076 dbxout_type (TREE_TYPE (type), 0);
2077 stabstr_C (',');
2078 stabstr_D (TYPE_PRECISION (TREE_TYPE (type)));
2079 stabstr_C (',');
2080 stabstr_D (TYPE_PRECISION (TREE_TYPE (type)));
2081 stabstr_S (";;");
2082 }
2083 break;
2084
2085 case ARRAY_TYPE:
2086 /* Make arrays of packed bits look like bitstrings for chill. */
2087 if (TYPE_PACKED (type) && use_gnu_debug_info_extensions)
2088 {
2089 stabstr_S ("@s");
2090 stabstr_D (BITS_PER_UNIT * int_size_in_bytes (type));
2091 stabstr_S (";@S;S");
2092 dbxout_type (TYPE_DOMAIN (type), 0);
2093 break;
2094 }
2095
2096 /* Output "a" followed by a range type definition
2097 for the index type of the array
2098 followed by a reference to the target-type.
2099 ar1;0;N;M for a C array of type M and size N+1. */
2100 /* Check if a character string type, which in Chill is
2101 different from an array of characters. */
2102 if (TYPE_STRING_FLAG (type) && use_gnu_debug_info_extensions)
2103 {
2104 stabstr_S ("@S;");
2105 }
2106 tem = TYPE_DOMAIN (type);
2107 if (tem == NULL)
2108 {
2109 stabstr_S ("ar");
2110 dbxout_type_index (integer_type_node);
2111 stabstr_S (";0;-1;");
2112 }
2113 else
2114 {
2115 stabstr_C ('a');
2116 dbxout_range_type (tem, TYPE_MIN_VALUE (tem), TYPE_MAX_VALUE (tem));
2117 }
2118
2119 dbxout_type (TREE_TYPE (type), 0);
2120 break;
2121
2122 case VECTOR_TYPE:
2123 /* Make vectors look like an array. */
2124 if (use_gnu_debug_info_extensions)
2125 stabstr_S ("@V;");
2126
2127 /* Output "a" followed by a range type definition
2128 for the index type of the array
2129 followed by a reference to the target-type.
2130 ar1;0;N;M for a C array of type M and size N+1. */
2131 stabstr_C ('a');
2132 dbxout_range_type (integer_type_node, size_zero_node,
2133 size_int (TYPE_VECTOR_SUBPARTS (type) - 1));
2134
2135 dbxout_type (TREE_TYPE (type), 0);
2136 break;
2137
2138 case RECORD_TYPE:
2139 case UNION_TYPE:
2140 case QUAL_UNION_TYPE:
2141 {
2142 tree binfo = TYPE_BINFO (type);
2143
2144 /* Output a structure type. We must use the same test here as we
2145 use in the DBX_NO_XREFS case above. */
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)
2151 /* No way in DBX fmt to describe a variable size. */
2152 || ! tree_fits_uhwi_p (TYPE_SIZE (type)))
2153 {
2154 /* If the type is just a cross reference, output one
2155 and mark the type as partially described.
2156 If it later becomes defined, we will output
2157 its real definition.
2158 If the type has a name, don't nest its definition within
2159 another type's definition; instead, output an xref
2160 and let the definition come when the name is defined. */
2161 stabstr_S ((TREE_CODE (type) == RECORD_TYPE) ? "xs" : "xu");
2162 if (TYPE_NAME (type) != 0
2163 /* The C frontend creates for anonymous variable length
2164 records/unions TYPE_NAME with DECL_NAME NULL. */
2165 && (TREE_CODE (TYPE_NAME (type)) != TYPE_DECL
2166 || DECL_NAME (TYPE_NAME (type))))
2167 dbxout_type_name (type);
2168 else
2169 {
2170 stabstr_S ("$$");
2171 stabstr_D (anonymous_type_number++);
2172 }
2173
2174 stabstr_C (':');
2175 typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_XREF;
2176 break;
2177 }
2178
2179 /* Identify record or union, and print its size. */
2180 stabstr_C ((TREE_CODE (type) == RECORD_TYPE) ? 's' : 'u');
2181 stabstr_D (int_size_in_bytes (type));
2182
2183 if (binfo)
2184 {
2185 int i;
2186 tree child;
2187 vec<tree, va_gc> *accesses = BINFO_BASE_ACCESSES (binfo);
2188
2189 if (use_gnu_debug_info_extensions)
2190 {
2191 if (BINFO_N_BASE_BINFOS (binfo))
2192 {
2193 stabstr_C ('!');
2194 stabstr_U (BINFO_N_BASE_BINFOS (binfo));
2195 stabstr_C (',');
2196 }
2197 }
2198 for (i = 0; BINFO_BASE_ITERATE (binfo, i, child); i++)
2199 {
2200 tree access = (accesses ? (*accesses)[i] : access_public_node);
2201
2202 if (use_gnu_debug_info_extensions)
2203 {
2204 stabstr_C (BINFO_VIRTUAL_P (child) ? '1' : '0');
2205 stabstr_C (access == access_public_node ? '2' :
2206 access == access_protected_node
2207 ? '1' :'0');
2208 if (BINFO_VIRTUAL_P (child)
2209 && (strcmp (lang_hooks.name, "GNU C++") == 0
2210 || strcmp (lang_hooks.name, "GNU Objective-C++") == 0))
2211 /* For a virtual base, print the (negative)
2212 offset within the vtable where we must look
2213 to find the necessary adjustment. */
2214 stabstr_D
2215 (tree_to_shwi (BINFO_VPTR_FIELD (child))
2216 * BITS_PER_UNIT);
2217 else
2218 stabstr_D (tree_to_shwi (BINFO_OFFSET (child))
2219 * BITS_PER_UNIT);
2220 stabstr_C (',');
2221 dbxout_type (BINFO_TYPE (child), 0);
2222 stabstr_C (';');
2223 }
2224 else
2225 {
2226 /* Print out the base class information with
2227 fields which have the same names at the types
2228 they hold. */
2229 dbxout_type_name (BINFO_TYPE (child));
2230 stabstr_C (':');
2231 dbxout_type (BINFO_TYPE (child), full);
2232 stabstr_C (',');
2233 stabstr_D (tree_to_shwi (BINFO_OFFSET (child))
2234 * BITS_PER_UNIT);
2235 stabstr_C (',');
2236 stabstr_D
2237 (tree_to_shwi (TYPE_SIZE (BINFO_TYPE (child)))
2238 * BITS_PER_UNIT);
2239 stabstr_C (';');
2240 }
2241 }
2242 }
2243 }
2244
2245 /* Write out the field declarations. */
2246 dbxout_type_fields (type);
2247 if (use_gnu_debug_info_extensions && TYPE_METHODS (type) != NULL_TREE)
2248 {
2249 dbxout_type_methods (type);
2250 }
2251
2252 stabstr_C (';');
2253
2254 if (use_gnu_debug_info_extensions && TREE_CODE (type) == RECORD_TYPE
2255 /* Avoid the ~ if we don't really need it--it confuses dbx. */
2256 && TYPE_VFIELD (type))
2257 {
2258
2259 /* We need to write out info about what field this class
2260 uses as its "main" vtable pointer field, because if this
2261 field is inherited from a base class, GDB cannot necessarily
2262 figure out which field it's using in time. */
2263 stabstr_S ("~%");
2264 dbxout_type (DECL_FCONTEXT (TYPE_VFIELD (type)), 0);
2265 stabstr_C (';');
2266 }
2267 break;
2268
2269 case ENUMERAL_TYPE:
2270 /* We must use the same test here as we use in the DBX_NO_XREFS case
2271 above. We simplify it a bit since an enum will never have a variable
2272 size. */
2273 if ((TYPE_NAME (type) != 0
2274 && ! (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
2275 && DECL_IGNORED_P (TYPE_NAME (type)))
2276 && !full)
2277 || !COMPLETE_TYPE_P (type))
2278 {
2279 stabstr_S ("xe");
2280 dbxout_type_name (type);
2281 typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_XREF;
2282 stabstr_C (':');
2283 return;
2284 }
2285 if (use_gnu_debug_info_extensions
2286 && TYPE_PRECISION (type) != TYPE_PRECISION (integer_type_node))
2287 {
2288 stabstr_S ("@s");
2289 stabstr_D (TYPE_PRECISION (type));
2290 stabstr_C (';');
2291 }
2292
2293 stabstr_C ('e');
2294 for (tem = TYPE_VALUES (type); tem; tem = TREE_CHAIN (tem))
2295 {
2296 tree value = TREE_VALUE (tem);
2297
2298 stabstr_I (TREE_PURPOSE (tem));
2299 stabstr_C (':');
2300
2301 if (TREE_CODE (value) == CONST_DECL)
2302 value = DECL_INITIAL (value);
2303
2304 if (TREE_INT_CST_HIGH (value) == 0)
2305 stabstr_D (TREE_INT_CST_LOW (value));
2306 else if (TREE_INT_CST_HIGH (value) == -1
2307 && (HOST_WIDE_INT) TREE_INT_CST_LOW (value) < 0)
2308 stabstr_D (TREE_INT_CST_LOW (value));
2309 else
2310 stabstr_O (value);
2311
2312 stabstr_C (',');
2313 if (TREE_CHAIN (tem) != 0)
2314 CONTIN;
2315 }
2316
2317 stabstr_C (';');
2318 break;
2319
2320 case POINTER_TYPE:
2321 stabstr_C ('*');
2322 dbxout_type (TREE_TYPE (type), 0);
2323 break;
2324
2325 case METHOD_TYPE:
2326 if (use_gnu_debug_info_extensions)
2327 {
2328 stabstr_C ('#');
2329
2330 /* Write the argument types out longhand. */
2331 dbxout_type (TYPE_METHOD_BASETYPE (type), 0);
2332 stabstr_C (',');
2333 dbxout_type (TREE_TYPE (type), 0);
2334 dbxout_args (TYPE_ARG_TYPES (type));
2335 stabstr_C (';');
2336 }
2337 else
2338 /* Treat it as a function type. */
2339 dbxout_type (TREE_TYPE (type), 0);
2340 break;
2341
2342 case OFFSET_TYPE:
2343 if (use_gnu_debug_info_extensions)
2344 {
2345 stabstr_C ('@');
2346 dbxout_type (TYPE_OFFSET_BASETYPE (type), 0);
2347 stabstr_C (',');
2348 dbxout_type (TREE_TYPE (type), 0);
2349 }
2350 else
2351 /* Should print as an int, because it is really just an offset. */
2352 dbxout_type (integer_type_node, 0);
2353 break;
2354
2355 case REFERENCE_TYPE:
2356 if (use_gnu_debug_info_extensions)
2357 {
2358 stabstr_C ('&');
2359 }
2360 else
2361 stabstr_C ('*');
2362 dbxout_type (TREE_TYPE (type), 0);
2363 break;
2364
2365 case FUNCTION_TYPE:
2366 stabstr_C ('f');
2367 dbxout_type (TREE_TYPE (type), 0);
2368 break;
2369
2370 case POINTER_BOUNDS_TYPE:
2371 /* No debug info for pointer bounds type supported yet. */
2372 break;
2373
2374 default:
2375 gcc_unreachable ();
2376 }
2377 }
2378
2379 /* Return nonzero if the given type represents an integer whose bounds
2380 should be printed in octal format. */
2381
2382 static bool
2383 print_int_cst_bounds_in_octal_p (tree type, tree low, tree high)
2384 {
2385 /* If we can use GDB extensions and the size is wider than a long
2386 (the size used by GDB to read them) or we may have trouble writing
2387 the bounds the usual way, write them in octal. Note the test is for
2388 the *target's* size of "long", not that of the host. The host test
2389 is just to make sure we can write it out in case the host wide int
2390 is narrower than the target "long".
2391
2392 For unsigned types, we use octal if they are the same size or larger.
2393 This is because we print the bounds as signed decimal, and hence they
2394 can't span same size unsigned types. */
2395
2396 if (use_gnu_debug_info_extensions
2397 && low && TREE_CODE (low) == INTEGER_CST
2398 && high && TREE_CODE (high) == INTEGER_CST
2399 && (TYPE_PRECISION (type) > TYPE_PRECISION (integer_type_node)
2400 || ((TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node))
2401 && TYPE_UNSIGNED (type))
2402 || TYPE_PRECISION (type) > HOST_BITS_PER_WIDE_INT
2403 || (TYPE_PRECISION (type) == HOST_BITS_PER_WIDE_INT
2404 && TYPE_UNSIGNED (type))))
2405 return TRUE;
2406 else
2407 return FALSE;
2408 }
2409
2410 /* Output the name of type TYPE, with no punctuation.
2411 Such names can be set up either by typedef declarations
2412 or by struct, enum and union tags. */
2413
2414 static void
2415 dbxout_type_name (tree type)
2416 {
2417 tree t = TYPE_NAME (type);
2418
2419 gcc_assert (t);
2420 switch (TREE_CODE (t))
2421 {
2422 case IDENTIFIER_NODE:
2423 break;
2424 case TYPE_DECL:
2425 t = DECL_NAME (t);
2426 break;
2427 default:
2428 gcc_unreachable ();
2429 }
2430
2431 stabstr_I (t);
2432 }
2433
2434 /* Output leading leading struct or class names needed for qualifying
2435 type whose scope is limited to a struct or class. */
2436
2437 static void
2438 dbxout_class_name_qualifiers (tree decl)
2439 {
2440 tree context = decl_type_context (decl);
2441
2442 if (context != NULL_TREE
2443 && TREE_CODE (context) == RECORD_TYPE
2444 && TYPE_NAME (context) != 0
2445 && (TREE_CODE (TYPE_NAME (context)) == IDENTIFIER_NODE
2446 || (DECL_NAME (TYPE_NAME (context)) != 0)))
2447 {
2448 tree name = TYPE_NAME (context);
2449
2450 if (TREE_CODE (name) == TYPE_DECL)
2451 {
2452 dbxout_class_name_qualifiers (name);
2453 name = DECL_NAME (name);
2454 }
2455 stabstr_I (name);
2456 stabstr_S ("::");
2457 }
2458 }
2459 \f
2460 /* This is a specialized subset of expand_expr for use by dbxout_symbol in
2461 evaluating DECL_VALUE_EXPR. In particular, we stop if we find decls that
2462 haven't been expanded, or if the expression is getting so complex we won't
2463 be able to represent it in stabs anyway. Returns NULL on failure. */
2464
2465 static rtx
2466 dbxout_expand_expr (tree expr)
2467 {
2468 switch (TREE_CODE (expr))
2469 {
2470 case VAR_DECL:
2471 /* We can't handle emulated tls variables, because the address is an
2472 offset to the return value of __emutls_get_address, and there is no
2473 way to express that in stabs. Also, there are name mangling issues
2474 here. We end up with references to undefined symbols if we don't
2475 disable debug info for these variables. */
2476 if (!targetm.have_tls && DECL_THREAD_LOCAL_P (expr))
2477 return NULL;
2478 if (TREE_STATIC (expr)
2479 && !TREE_ASM_WRITTEN (expr)
2480 && !DECL_HAS_VALUE_EXPR_P (expr)
2481 && !TREE_PUBLIC (expr)
2482 && DECL_RTL_SET_P (expr)
2483 && MEM_P (DECL_RTL (expr)))
2484 {
2485 /* If this is a var that might not be actually output,
2486 return NULL, otherwise stabs might reference an undefined
2487 symbol. */
2488 struct varpool_node *node = varpool_get_node (expr);
2489 if (!node || !node->definition)
2490 return NULL;
2491 }
2492 /* FALLTHRU */
2493
2494 case PARM_DECL:
2495 case RESULT_DECL:
2496 if (DECL_HAS_VALUE_EXPR_P (expr))
2497 return dbxout_expand_expr (DECL_VALUE_EXPR (expr));
2498 /* FALLTHRU */
2499
2500 case CONST_DECL:
2501 return DECL_RTL_IF_SET (expr);
2502
2503 case INTEGER_CST:
2504 return expand_expr (expr, NULL_RTX, VOIDmode, EXPAND_INITIALIZER);
2505
2506 case COMPONENT_REF:
2507 case ARRAY_REF:
2508 case ARRAY_RANGE_REF:
2509 case BIT_FIELD_REF:
2510 {
2511 enum machine_mode mode;
2512 HOST_WIDE_INT bitsize, bitpos;
2513 tree offset, tem;
2514 int volatilep = 0, unsignedp = 0;
2515 rtx x;
2516
2517 tem = get_inner_reference (expr, &bitsize, &bitpos, &offset,
2518 &mode, &unsignedp, &volatilep, true);
2519
2520 x = dbxout_expand_expr (tem);
2521 if (x == NULL || !MEM_P (x))
2522 return NULL;
2523 if (offset != NULL)
2524 {
2525 if (!tree_fits_shwi_p (offset))
2526 return NULL;
2527 x = adjust_address_nv (x, mode, tree_to_shwi (offset));
2528 }
2529 if (bitpos != 0)
2530 x = adjust_address_nv (x, mode, bitpos / BITS_PER_UNIT);
2531
2532 return x;
2533 }
2534
2535 default:
2536 return NULL;
2537 }
2538 }
2539
2540 /* Helper function for output_used_types. Queue one entry from the
2541 used types hash to be output. */
2542
2543 static int
2544 output_used_types_helper (void **slot, void *data)
2545 {
2546 tree type = (tree) *slot;
2547 vec<tree> *types_p = (vec<tree> *) data;
2548
2549 if ((TREE_CODE (type) == RECORD_TYPE
2550 || TREE_CODE (type) == UNION_TYPE
2551 || TREE_CODE (type) == QUAL_UNION_TYPE
2552 || TREE_CODE (type) == ENUMERAL_TYPE)
2553 && TYPE_STUB_DECL (type)
2554 && DECL_P (TYPE_STUB_DECL (type))
2555 && ! DECL_IGNORED_P (TYPE_STUB_DECL (type)))
2556 types_p->quick_push (TYPE_STUB_DECL (type));
2557 else if (TYPE_NAME (type)
2558 && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL)
2559 types_p->quick_push (TYPE_NAME (type));
2560
2561 return 1;
2562 }
2563
2564 /* This is a qsort callback which sorts types and declarations into a
2565 predictable order (types, then declarations, sorted by UID
2566 within). */
2567
2568 static int
2569 output_types_sort (const void *pa, const void *pb)
2570 {
2571 const tree lhs = *((const tree *)pa);
2572 const tree rhs = *((const tree *)pb);
2573
2574 if (TYPE_P (lhs))
2575 {
2576 if (TYPE_P (rhs))
2577 return TYPE_UID (lhs) - TYPE_UID (rhs);
2578 else
2579 return 1;
2580 }
2581 else
2582 {
2583 if (TYPE_P (rhs))
2584 return -1;
2585 else
2586 return DECL_UID (lhs) - DECL_UID (rhs);
2587 }
2588 }
2589
2590
2591 /* Force all types used by this function to be output in debug
2592 information. */
2593
2594 static void
2595 output_used_types (void)
2596 {
2597 if (cfun && cfun->used_types_hash)
2598 {
2599 vec<tree> types;
2600 int i;
2601 tree type;
2602
2603 types.create (htab_elements (cfun->used_types_hash));
2604 htab_traverse (cfun->used_types_hash, output_used_types_helper, &types);
2605
2606 /* Sort by UID to prevent dependence on hash table ordering. */
2607 types.qsort (output_types_sort);
2608
2609 FOR_EACH_VEC_ELT (types, i, type)
2610 debug_queue_symbol (type);
2611
2612 types.release ();
2613 }
2614 }
2615
2616 /* Output a .stabs for the symbol defined by DECL,
2617 which must be a ..._DECL node in the normal namespace.
2618 It may be a CONST_DECL, a FUNCTION_DECL, a PARM_DECL or a VAR_DECL.
2619 LOCAL is nonzero if the scope is less than the entire file.
2620 Return 1 if a stabs might have been emitted. */
2621
2622 int
2623 dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED)
2624 {
2625 tree type = TREE_TYPE (decl);
2626 tree context = NULL_TREE;
2627 int result = 0;
2628 rtx decl_rtl;
2629
2630 /* "Intercept" dbxout_symbol() calls like we do all debug_hooks. */
2631 ++debug_nesting;
2632
2633 /* Ignore nameless syms, but don't ignore type tags. */
2634
2635 if ((DECL_NAME (decl) == 0 && TREE_CODE (decl) != TYPE_DECL)
2636 || DECL_IGNORED_P (decl))
2637 DBXOUT_DECR_NESTING_AND_RETURN (0);
2638
2639 /* If we are to generate only the symbols actually used then such
2640 symbol nodes are flagged with TREE_USED. Ignore any that
2641 aren't flagged as TREE_USED. */
2642
2643 if (flag_debug_only_used_symbols
2644 && (!TREE_USED (decl)
2645 && (TREE_CODE (decl) != VAR_DECL || !DECL_INITIAL (decl))))
2646 DBXOUT_DECR_NESTING_AND_RETURN (0);
2647
2648 /* If dbxout_init has not yet run, queue this symbol for later. */
2649 if (!typevec)
2650 {
2651 preinit_symbols = tree_cons (0, decl, preinit_symbols);
2652 DBXOUT_DECR_NESTING_AND_RETURN (0);
2653 }
2654
2655 if (flag_debug_only_used_symbols)
2656 {
2657 tree t;
2658
2659 /* We now have a used symbol. We need to generate the info for
2660 the symbol's type in addition to the symbol itself. These
2661 type symbols are queued to be generated after were done with
2662 the symbol itself (otherwise they would fight over the
2663 stabstr obstack).
2664
2665 Note, because the TREE_TYPE(type) might be something like a
2666 pointer to a named type we need to look for the first name
2667 we see following the TREE_TYPE chain. */
2668
2669 t = type;
2670 while (POINTER_TYPE_P (t))
2671 t = TREE_TYPE (t);
2672
2673 /* RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE, and ENUMERAL_TYPE
2674 need special treatment. The TYPE_STUB_DECL field in these
2675 types generally represents the tag name type we want to
2676 output. In addition there could be a typedef type with
2677 a different name. In that case we also want to output
2678 that. */
2679
2680 if (TREE_CODE (t) == RECORD_TYPE
2681 || TREE_CODE (t) == UNION_TYPE
2682 || TREE_CODE (t) == QUAL_UNION_TYPE
2683 || TREE_CODE (t) == ENUMERAL_TYPE)
2684 {
2685 if (TYPE_STUB_DECL (t)
2686 && TYPE_STUB_DECL (t) != decl
2687 && DECL_P (TYPE_STUB_DECL (t))
2688 && ! DECL_IGNORED_P (TYPE_STUB_DECL (t)))
2689 {
2690 debug_queue_symbol (TYPE_STUB_DECL (t));
2691 if (TYPE_NAME (t)
2692 && TYPE_NAME (t) != TYPE_STUB_DECL (t)
2693 && TYPE_NAME (t) != decl
2694 && DECL_P (TYPE_NAME (t)))
2695 debug_queue_symbol (TYPE_NAME (t));
2696 }
2697 }
2698 else if (TYPE_NAME (t)
2699 && TYPE_NAME (t) != decl
2700 && DECL_P (TYPE_NAME (t)))
2701 debug_queue_symbol (TYPE_NAME (t));
2702 }
2703
2704 emit_pending_bincls_if_required ();
2705
2706 switch (TREE_CODE (decl))
2707 {
2708 case CONST_DECL:
2709 /* Enum values are defined by defining the enum type. */
2710 break;
2711
2712 case FUNCTION_DECL:
2713 decl_rtl = DECL_RTL_IF_SET (decl);
2714 if (!decl_rtl)
2715 DBXOUT_DECR_NESTING_AND_RETURN (0);
2716 if (DECL_EXTERNAL (decl))
2717 break;
2718 /* Don't mention a nested function under its parent. */
2719 context = decl_function_context (decl);
2720 if (context == current_function_decl)
2721 break;
2722 /* Don't mention an inline instance of a nested function. */
2723 if (context && DECL_FROM_INLINE (decl))
2724 break;
2725 if (!MEM_P (decl_rtl)
2726 || GET_CODE (XEXP (decl_rtl, 0)) != SYMBOL_REF)
2727 break;
2728
2729 if (flag_debug_only_used_symbols)
2730 output_used_types ();
2731
2732 dbxout_begin_complex_stabs ();
2733 stabstr_I (DECL_ASSEMBLER_NAME (decl));
2734 stabstr_S (TREE_PUBLIC (decl) ? ":F" : ":f");
2735 result = 1;
2736
2737 if (TREE_TYPE (type))
2738 dbxout_type (TREE_TYPE (type), 0);
2739 else
2740 dbxout_type (void_type_node, 0);
2741
2742 /* For a nested function, when that function is compiled,
2743 mention the containing function name
2744 as well as (since dbx wants it) our own assembler-name. */
2745 if (context != 0)
2746 {
2747 stabstr_C (',');
2748 stabstr_I (DECL_ASSEMBLER_NAME (decl));
2749 stabstr_C (',');
2750 stabstr_I (DECL_NAME (context));
2751 }
2752
2753 dbxout_finish_complex_stabs (decl, N_FUN, XEXP (decl_rtl, 0), 0, 0);
2754 break;
2755
2756 case TYPE_DECL:
2757 /* Don't output the same typedef twice.
2758 And don't output what language-specific stuff doesn't want output. */
2759 if (TREE_ASM_WRITTEN (decl) || TYPE_DECL_SUPPRESS_DEBUG (decl))
2760 DBXOUT_DECR_NESTING_AND_RETURN (0);
2761
2762 /* Don't output typedefs for types with magic type numbers (XCOFF). */
2763 #ifdef DBX_ASSIGN_FUNDAMENTAL_TYPE_NUMBER
2764 {
2765 int fundamental_type_number =
2766 DBX_ASSIGN_FUNDAMENTAL_TYPE_NUMBER (decl);
2767
2768 if (fundamental_type_number != 0)
2769 {
2770 TREE_ASM_WRITTEN (decl) = 1;
2771 TYPE_SYMTAB_ADDRESS (TREE_TYPE (decl)) = fundamental_type_number;
2772 DBXOUT_DECR_NESTING_AND_RETURN (0);
2773 }
2774 }
2775 #endif
2776 FORCE_TEXT;
2777 result = 1;
2778 {
2779 int tag_needed = 1;
2780 int did_output = 0;
2781
2782 if (DECL_NAME (decl))
2783 {
2784 /* Nonzero means we must output a tag as well as a typedef. */
2785 tag_needed = 0;
2786
2787 /* Handle the case of a C++ structure or union
2788 where the TYPE_NAME is a TYPE_DECL
2789 which gives both a typedef name and a tag. */
2790 /* dbx requires the tag first and the typedef second. */
2791 if ((TREE_CODE (type) == RECORD_TYPE
2792 || TREE_CODE (type) == UNION_TYPE
2793 || TREE_CODE (type) == QUAL_UNION_TYPE)
2794 && TYPE_NAME (type) == decl
2795 && !use_gnu_debug_info_extensions
2796 && !TREE_ASM_WRITTEN (TYPE_NAME (type))
2797 /* Distinguish the implicit typedefs of C++
2798 from explicit ones that might be found in C. */
2799 && DECL_ARTIFICIAL (decl)
2800 /* Do not generate a tag for incomplete records. */
2801 && COMPLETE_TYPE_P (type)
2802 /* Do not generate a tag for records of variable size,
2803 since this type can not be properly described in the
2804 DBX format, and it confuses some tools such as objdump. */
2805 && tree_fits_uhwi_p (TYPE_SIZE (type)))
2806 {
2807 tree name = TYPE_NAME (type);
2808 if (TREE_CODE (name) == TYPE_DECL)
2809 name = DECL_NAME (name);
2810
2811 dbxout_begin_complex_stabs ();
2812 stabstr_I (name);
2813 stabstr_S (":T");
2814 dbxout_type (type, 1);
2815 dbxout_finish_complex_stabs (0, DBX_TYPE_DECL_STABS_CODE,
2816 0, 0, 0);
2817 }
2818
2819 dbxout_begin_complex_stabs ();
2820
2821 /* Output leading class/struct qualifiers. */
2822 if (use_gnu_debug_info_extensions)
2823 dbxout_class_name_qualifiers (decl);
2824
2825 /* Output typedef name. */
2826 stabstr_I (DECL_NAME (decl));
2827 stabstr_C (':');
2828
2829 /* Short cut way to output a tag also. */
2830 if ((TREE_CODE (type) == RECORD_TYPE
2831 || TREE_CODE (type) == UNION_TYPE
2832 || TREE_CODE (type) == QUAL_UNION_TYPE)
2833 && TYPE_NAME (type) == decl
2834 /* Distinguish the implicit typedefs of C++
2835 from explicit ones that might be found in C. */
2836 && DECL_ARTIFICIAL (decl))
2837 {
2838 if (use_gnu_debug_info_extensions)
2839 {
2840 stabstr_C ('T');
2841 TREE_ASM_WRITTEN (TYPE_NAME (type)) = 1;
2842 }
2843 }
2844
2845 stabstr_C ('t');
2846 dbxout_type (type, 1);
2847 dbxout_finish_complex_stabs (decl, DBX_TYPE_DECL_STABS_CODE,
2848 0, 0, 0);
2849 did_output = 1;
2850 }
2851
2852 /* Don't output a tag if this is an incomplete type. This prevents
2853 the sun4 Sun OS 4.x dbx from crashing. */
2854
2855 if (tag_needed && TYPE_NAME (type) != 0
2856 && (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE
2857 || (DECL_NAME (TYPE_NAME (type)) != 0))
2858 && COMPLETE_TYPE_P (type)
2859 && !TREE_ASM_WRITTEN (TYPE_NAME (type)))
2860 {
2861 /* For a TYPE_DECL with no name, but the type has a name,
2862 output a tag.
2863 This is what represents `struct foo' with no typedef. */
2864 /* In C++, the name of a type is the corresponding typedef.
2865 In C, it is an IDENTIFIER_NODE. */
2866 tree name = TYPE_NAME (type);
2867 if (TREE_CODE (name) == TYPE_DECL)
2868 name = DECL_NAME (name);
2869
2870 dbxout_begin_complex_stabs ();
2871 stabstr_I (name);
2872 stabstr_S (":T");
2873 dbxout_type (type, 1);
2874 dbxout_finish_complex_stabs (0, DBX_TYPE_DECL_STABS_CODE, 0, 0, 0);
2875 did_output = 1;
2876 }
2877
2878 /* If an enum type has no name, it cannot be referred to, but
2879 we must output it anyway, to record the enumeration
2880 constants. */
2881
2882 if (!did_output && TREE_CODE (type) == ENUMERAL_TYPE)
2883 {
2884 dbxout_begin_complex_stabs ();
2885 /* Some debuggers fail when given NULL names, so give this a
2886 harmless name of " " (Why not "(anon)"?). */
2887 stabstr_S (" :T");
2888 dbxout_type (type, 1);
2889 dbxout_finish_complex_stabs (0, DBX_TYPE_DECL_STABS_CODE, 0, 0, 0);
2890 }
2891
2892 /* Prevent duplicate output of a typedef. */
2893 TREE_ASM_WRITTEN (decl) = 1;
2894 break;
2895 }
2896
2897 case PARM_DECL:
2898 if (DECL_HAS_VALUE_EXPR_P (decl))
2899 decl = DECL_VALUE_EXPR (decl);
2900
2901 /* PARM_DECLs go in their own separate chain and are output by
2902 dbxout_reg_parms and dbxout_parms, except for those that are
2903 disguised VAR_DECLs like Out parameters in Ada. */
2904 gcc_assert (TREE_CODE (decl) == VAR_DECL);
2905
2906 /* ... fall through ... */
2907
2908 case RESULT_DECL:
2909 case VAR_DECL:
2910 /* Don't mention a variable that is external.
2911 Let the file that defines it describe it. */
2912 if (DECL_EXTERNAL (decl))
2913 break;
2914
2915 /* If the variable is really a constant
2916 and not written in memory, inform the debugger.
2917
2918 ??? Why do we skip emitting the type and location in this case? */
2919 if (TREE_STATIC (decl) && TREE_READONLY (decl)
2920 && DECL_INITIAL (decl) != 0
2921 && tree_fits_shwi_p (DECL_INITIAL (decl))
2922 && ! TREE_ASM_WRITTEN (decl)
2923 && (DECL_FILE_SCOPE_P (decl)
2924 || TREE_CODE (DECL_CONTEXT (decl)) == BLOCK
2925 || TREE_CODE (DECL_CONTEXT (decl)) == NAMESPACE_DECL)
2926 && TREE_PUBLIC (decl) == 0)
2927 {
2928 /* The sun4 assembler does not grok this. */
2929
2930 if (TREE_CODE (TREE_TYPE (decl)) == INTEGER_TYPE
2931 || TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE)
2932 {
2933 HOST_WIDE_INT ival = tree_to_shwi (DECL_INITIAL (decl));
2934
2935 dbxout_begin_complex_stabs ();
2936 dbxout_symbol_name (decl, NULL, 'c');
2937 stabstr_S ("=i");
2938 stabstr_D (ival);
2939 dbxout_finish_complex_stabs (0, N_LSYM, 0, 0, 0);
2940 DBXOUT_DECR_NESTING;
2941 return 1;
2942 }
2943 else
2944 break;
2945 }
2946 /* else it is something we handle like a normal variable. */
2947
2948 decl_rtl = dbxout_expand_expr (decl);
2949 if (!decl_rtl)
2950 DBXOUT_DECR_NESTING_AND_RETURN (0);
2951
2952 decl_rtl = eliminate_regs (decl_rtl, VOIDmode, NULL_RTX);
2953 #ifdef LEAF_REG_REMAP
2954 if (crtl->uses_only_leaf_regs)
2955 leaf_renumber_regs_insn (decl_rtl);
2956 #endif
2957
2958 result = dbxout_symbol_location (decl, type, 0, decl_rtl);
2959 break;
2960
2961 default:
2962 break;
2963 }
2964 DBXOUT_DECR_NESTING;
2965 return result;
2966 }
2967 \f
2968 /* Output the stab for DECL, a VAR_DECL, RESULT_DECL or PARM_DECL.
2969 Add SUFFIX to its name, if SUFFIX is not 0.
2970 Describe the variable as residing in HOME
2971 (usually HOME is DECL_RTL (DECL), but not always).
2972 Returns 1 if the stab was really emitted. */
2973
2974 static int
2975 dbxout_symbol_location (tree decl, tree type, const char *suffix, rtx home)
2976 {
2977 int letter = 0;
2978 stab_code_type code;
2979 rtx addr = 0;
2980 int number = 0;
2981 int regno = -1;
2982
2983 /* Don't mention a variable at all
2984 if it was completely optimized into nothingness.
2985
2986 If the decl was from an inline function, then its rtl
2987 is not identically the rtl that was used in this
2988 particular compilation. */
2989 if (GET_CODE (home) == SUBREG)
2990 {
2991 rtx value = home;
2992
2993 while (GET_CODE (value) == SUBREG)
2994 value = SUBREG_REG (value);
2995 if (REG_P (value))
2996 {
2997 if (REGNO (value) >= FIRST_PSEUDO_REGISTER)
2998 return 0;
2999 }
3000 home = alter_subreg (&home, true);
3001 }
3002 if (REG_P (home))
3003 {
3004 regno = REGNO (home);
3005 if (regno >= FIRST_PSEUDO_REGISTER)
3006 return 0;
3007 }
3008
3009 /* The kind-of-variable letter depends on where
3010 the variable is and on the scope of its name:
3011 G and N_GSYM for static storage and global scope,
3012 S for static storage and file scope,
3013 V for static storage and local scope,
3014 for those two, use N_LCSYM if data is in bss segment,
3015 N_STSYM if in data segment, N_FUN otherwise.
3016 (We used N_FUN originally, then changed to N_STSYM
3017 to please GDB. However, it seems that confused ld.
3018 Now GDB has been fixed to like N_FUN, says Kingdon.)
3019 no letter at all, and N_LSYM, for auto variable,
3020 r and N_RSYM for register variable. */
3021
3022 if (MEM_P (home) && GET_CODE (XEXP (home, 0)) == SYMBOL_REF)
3023 {
3024 if (TREE_PUBLIC (decl))
3025 {
3026 int offs;
3027 letter = 'G';
3028 code = N_GSYM;
3029 if (NULL != dbxout_common_check (decl, &offs))
3030 {
3031 letter = 'V';
3032 addr = 0;
3033 number = offs;
3034 }
3035 }
3036 else
3037 {
3038 addr = XEXP (home, 0);
3039
3040 letter = decl_function_context (decl) ? 'V' : 'S';
3041
3042 /* Some ports can transform a symbol ref into a label ref,
3043 because the symbol ref is too far away and has to be
3044 dumped into a constant pool. Alternatively, the symbol
3045 in the constant pool might be referenced by a different
3046 symbol. */
3047 if (GET_CODE (addr) == SYMBOL_REF
3048 && CONSTANT_POOL_ADDRESS_P (addr))
3049 {
3050 bool marked;
3051 rtx tmp = get_pool_constant_mark (addr, &marked);
3052
3053 if (GET_CODE (tmp) == SYMBOL_REF)
3054 {
3055 addr = tmp;
3056 if (CONSTANT_POOL_ADDRESS_P (addr))
3057 get_pool_constant_mark (addr, &marked);
3058 else
3059 marked = true;
3060 }
3061 else if (GET_CODE (tmp) == LABEL_REF)
3062 {
3063 addr = tmp;
3064 marked = true;
3065 }
3066
3067 /* If all references to the constant pool were optimized
3068 out, we just ignore the symbol. */
3069 if (!marked)
3070 return 0;
3071 }
3072
3073 /* This should be the same condition as in assemble_variable, but
3074 we don't have access to dont_output_data here. So, instead,
3075 we rely on the fact that error_mark_node initializers always
3076 end up in bss for C++ and never end up in bss for C. */
3077 if (DECL_INITIAL (decl) == 0
3078 || (!strcmp (lang_hooks.name, "GNU C++")
3079 && DECL_INITIAL (decl) == error_mark_node))
3080 {
3081 int offs;
3082 code = N_LCSYM;
3083 if (NULL != dbxout_common_check (decl, &offs))
3084 {
3085 addr = 0;
3086 number = offs;
3087 letter = 'V';
3088 code = N_GSYM;
3089 }
3090 }
3091 else if (DECL_IN_TEXT_SECTION (decl))
3092 /* This is not quite right, but it's the closest
3093 of all the codes that Unix defines. */
3094 code = DBX_STATIC_CONST_VAR_CODE;
3095 else
3096 {
3097 /* Ultrix `as' seems to need this. */
3098 #ifdef DBX_STATIC_STAB_DATA_SECTION
3099 switch_to_section (data_section);
3100 #endif
3101 code = N_STSYM;
3102 }
3103 }
3104 }
3105 else if (regno >= 0)
3106 {
3107 letter = 'r';
3108 code = N_RSYM;
3109 number = DBX_REGISTER_NUMBER (regno);
3110 }
3111 else if (MEM_P (home)
3112 && (MEM_P (XEXP (home, 0))
3113 || (REG_P (XEXP (home, 0))
3114 && REGNO (XEXP (home, 0)) != HARD_FRAME_POINTER_REGNUM
3115 && REGNO (XEXP (home, 0)) != STACK_POINTER_REGNUM
3116 #if !HARD_FRAME_POINTER_IS_ARG_POINTER
3117 && REGNO (XEXP (home, 0)) != ARG_POINTER_REGNUM
3118 #endif
3119 )))
3120 /* If the value is indirect by memory or by a register
3121 that isn't the frame pointer
3122 then it means the object is variable-sized and address through
3123 that register or stack slot. DBX has no way to represent this
3124 so all we can do is output the variable as a pointer.
3125 If it's not a parameter, ignore it. */
3126 {
3127 if (REG_P (XEXP (home, 0)))
3128 {
3129 letter = 'r';
3130 code = N_RSYM;
3131 if (REGNO (XEXP (home, 0)) >= FIRST_PSEUDO_REGISTER)
3132 return 0;
3133 number = DBX_REGISTER_NUMBER (REGNO (XEXP (home, 0)));
3134 }
3135 else
3136 {
3137 code = N_LSYM;
3138 /* RTL looks like (MEM (MEM (PLUS (REG...) (CONST_INT...)))).
3139 We want the value of that CONST_INT. */
3140 number = DEBUGGER_AUTO_OFFSET (XEXP (XEXP (home, 0), 0));
3141 }
3142
3143 /* Effectively do build_pointer_type, but don't cache this type,
3144 since it might be temporary whereas the type it points to
3145 might have been saved for inlining. */
3146 /* Don't use REFERENCE_TYPE because dbx can't handle that. */
3147 type = make_node (POINTER_TYPE);
3148 TREE_TYPE (type) = TREE_TYPE (decl);
3149 }
3150 else if (MEM_P (home)
3151 && REG_P (XEXP (home, 0)))
3152 {
3153 code = N_LSYM;
3154 number = DEBUGGER_AUTO_OFFSET (XEXP (home, 0));
3155 }
3156 else if (MEM_P (home)
3157 && GET_CODE (XEXP (home, 0)) == PLUS
3158 && CONST_INT_P (XEXP (XEXP (home, 0), 1)))
3159 {
3160 code = N_LSYM;
3161 /* RTL looks like (MEM (PLUS (REG...) (CONST_INT...)))
3162 We want the value of that CONST_INT. */
3163 number = DEBUGGER_AUTO_OFFSET (XEXP (home, 0));
3164 }
3165 else if (MEM_P (home)
3166 && GET_CODE (XEXP (home, 0)) == CONST)
3167 {
3168 /* Handle an obscure case which can arise when optimizing and
3169 when there are few available registers. (This is *always*
3170 the case for i386/i486 targets). The RTL looks like
3171 (MEM (CONST ...)) even though this variable is a local `auto'
3172 or a local `register' variable. In effect, what has happened
3173 is that the reload pass has seen that all assignments and
3174 references for one such a local variable can be replaced by
3175 equivalent assignments and references to some static storage
3176 variable, thereby avoiding the need for a register. In such
3177 cases we're forced to lie to debuggers and tell them that
3178 this variable was itself `static'. */
3179 int offs;
3180 code = N_LCSYM;
3181 letter = 'V';
3182 if (NULL == dbxout_common_check (decl, &offs))
3183 addr = XEXP (XEXP (home, 0), 0);
3184 else
3185 {
3186 addr = 0;
3187 number = offs;
3188 code = N_GSYM;
3189 }
3190 }
3191 else if (GET_CODE (home) == CONCAT)
3192 {
3193 tree subtype;
3194
3195 /* If TYPE is not a COMPLEX_TYPE (it might be a RECORD_TYPE,
3196 for example), then there is no easy way to figure out
3197 what SUBTYPE should be. So, we give up. */
3198 if (TREE_CODE (type) != COMPLEX_TYPE)
3199 return 0;
3200
3201 subtype = TREE_TYPE (type);
3202
3203 /* If the variable's storage is in two parts,
3204 output each as a separate stab with a modified name. */
3205 if (WORDS_BIG_ENDIAN)
3206 dbxout_symbol_location (decl, subtype, "$imag", XEXP (home, 0));
3207 else
3208 dbxout_symbol_location (decl, subtype, "$real", XEXP (home, 0));
3209
3210 if (WORDS_BIG_ENDIAN)
3211 dbxout_symbol_location (decl, subtype, "$real", XEXP (home, 1));
3212 else
3213 dbxout_symbol_location (decl, subtype, "$imag", XEXP (home, 1));
3214 return 1;
3215 }
3216 else
3217 /* Address might be a MEM, when DECL is a variable-sized object.
3218 Or it might be const0_rtx, meaning previous passes
3219 want us to ignore this variable. */
3220 return 0;
3221
3222 /* Ok, start a symtab entry and output the variable name. */
3223 emit_pending_bincls_if_required ();
3224 FORCE_TEXT;
3225
3226 #ifdef DBX_STATIC_BLOCK_START
3227 DBX_STATIC_BLOCK_START (asm_out_file, code);
3228 #endif
3229
3230 dbxout_begin_complex_stabs_noforcetext ();
3231 dbxout_symbol_name (decl, suffix, letter);
3232 dbxout_type (type, 0);
3233 dbxout_finish_complex_stabs (decl, code, addr, 0, number);
3234
3235 #ifdef DBX_STATIC_BLOCK_END
3236 DBX_STATIC_BLOCK_END (asm_out_file, code);
3237 #endif
3238 return 1;
3239 }
3240 \f
3241 /* Output the symbol name of DECL for a stabs, with suffix SUFFIX.
3242 Then output LETTER to indicate the kind of location the symbol has. */
3243
3244 static void
3245 dbxout_symbol_name (tree decl, const char *suffix, int letter)
3246 {
3247 tree name;
3248
3249 if (DECL_CONTEXT (decl)
3250 && (TYPE_P (DECL_CONTEXT (decl))
3251 || TREE_CODE (DECL_CONTEXT (decl)) == NAMESPACE_DECL))
3252 /* One slight hitch: if this is a VAR_DECL which is a class member
3253 or a namespace member, we must put out the mangled name instead of the
3254 DECL_NAME. Note also that static member (variable) names DO NOT begin
3255 with underscores in .stabs directives. */
3256 name = DECL_ASSEMBLER_NAME (decl);
3257 else
3258 /* ...but if we're function-local, we don't want to include the junk
3259 added by ASM_FORMAT_PRIVATE_NAME. */
3260 name = DECL_NAME (decl);
3261
3262 if (name)
3263 stabstr_I (name);
3264 else
3265 stabstr_S ("(anon)");
3266
3267 if (suffix)
3268 stabstr_S (suffix);
3269 stabstr_C (':');
3270 if (letter)
3271 stabstr_C (letter);
3272 }
3273
3274
3275 /* Output the common block name for DECL in a stabs.
3276
3277 Symbols in global common (.comm) get wrapped with an N_BCOMM/N_ECOMM pair
3278 around each group of symbols in the same .comm area. The N_GSYM stabs
3279 that are emitted only contain the offset in the common area. This routine
3280 emits the N_BCOMM and N_ECOMM stabs. */
3281
3282 static void
3283 dbxout_common_name (tree decl, const char *name, stab_code_type op)
3284 {
3285 dbxout_begin_complex_stabs ();
3286 stabstr_S (name);
3287 dbxout_finish_complex_stabs (decl, op, NULL_RTX, NULL, 0);
3288 }
3289
3290 /* Check decl to determine whether it is a VAR_DECL destined for storage in a
3291 common area. If it is, the return value will be a non-null string giving
3292 the name of the common storage block it will go into. If non-null, the
3293 value is the offset into the common block for that symbol's storage. */
3294
3295 static const char *
3296 dbxout_common_check (tree decl, int *value)
3297 {
3298 rtx home;
3299 rtx sym_addr;
3300 const char *name = NULL;
3301
3302 /* If the decl isn't a VAR_DECL, or if it isn't static, or if
3303 it does not have a value (the offset into the common area), or if it
3304 is thread local (as opposed to global) then it isn't common, and shouldn't
3305 be handled as such.
3306
3307 ??? DECL_THREAD_LOCAL_P check prevents problems with improper .stabs
3308 for thread-local symbols. Can be handled via same mechanism as used
3309 in dwarf2out.c. */
3310 if (TREE_CODE (decl) != VAR_DECL
3311 || !TREE_STATIC (decl)
3312 || !DECL_HAS_VALUE_EXPR_P (decl)
3313 || DECL_THREAD_LOCAL_P (decl)
3314 || !is_fortran ())
3315 return NULL;
3316
3317 home = DECL_RTL (decl);
3318 if (home == NULL_RTX || GET_CODE (home) != MEM)
3319 return NULL;
3320
3321 sym_addr = dbxout_expand_expr (DECL_VALUE_EXPR (decl));
3322 if (sym_addr == NULL_RTX || GET_CODE (sym_addr) != MEM)
3323 return NULL;
3324
3325 sym_addr = XEXP (sym_addr, 0);
3326 if (GET_CODE (sym_addr) == CONST)
3327 sym_addr = XEXP (sym_addr, 0);
3328 if ((GET_CODE (sym_addr) == SYMBOL_REF || GET_CODE (sym_addr) == PLUS)
3329 && DECL_INITIAL (decl) == 0)
3330 {
3331
3332 /* We have a sym that will go into a common area, meaning that it
3333 will get storage reserved with a .comm/.lcomm assembler pseudo-op.
3334
3335 Determine name of common area this symbol will be an offset into,
3336 and offset into that area. Also retrieve the decl for the area
3337 that the symbol is offset into. */
3338 tree cdecl = NULL;
3339
3340 switch (GET_CODE (sym_addr))
3341 {
3342 case PLUS:
3343 if (CONST_INT_P (XEXP (sym_addr, 0)))
3344 {
3345 name =
3346 targetm.strip_name_encoding (XSTR (XEXP (sym_addr, 1), 0));
3347 *value = INTVAL (XEXP (sym_addr, 0));
3348 cdecl = SYMBOL_REF_DECL (XEXP (sym_addr, 1));
3349 }
3350 else
3351 {
3352 name =
3353 targetm.strip_name_encoding (XSTR (XEXP (sym_addr, 0), 0));
3354 *value = INTVAL (XEXP (sym_addr, 1));
3355 cdecl = SYMBOL_REF_DECL (XEXP (sym_addr, 0));
3356 }
3357 break;
3358
3359 case SYMBOL_REF:
3360 name = targetm.strip_name_encoding (XSTR (sym_addr, 0));
3361 *value = 0;
3362 cdecl = SYMBOL_REF_DECL (sym_addr);
3363 break;
3364
3365 default:
3366 error ("common symbol debug info is not structured as "
3367 "symbol+offset");
3368 }
3369
3370 /* Check area common symbol is offset into. If this is not public, then
3371 it is not a symbol in a common block. It must be a .lcomm symbol, not
3372 a .comm symbol. */
3373 if (cdecl == NULL || !TREE_PUBLIC (cdecl))
3374 name = NULL;
3375 }
3376 else
3377 name = NULL;
3378
3379 return name;
3380 }
3381
3382 /* Output definitions of all the decls in a chain. Return nonzero if
3383 anything was output */
3384
3385 int
3386 dbxout_syms (tree syms)
3387 {
3388 int result = 0;
3389 const char *comm_prev = NULL;
3390 tree syms_prev = NULL;
3391
3392 while (syms)
3393 {
3394 int temp, copen, cclos;
3395 const char *comm_new;
3396
3397 /* Check for common symbol, and then progression into a new/different
3398 block of common symbols. Emit closing/opening common bracket if
3399 necessary. */
3400 comm_new = dbxout_common_check (syms, &temp);
3401 copen = comm_new != NULL
3402 && (comm_prev == NULL || strcmp (comm_new, comm_prev));
3403 cclos = comm_prev != NULL
3404 && (comm_new == NULL || strcmp (comm_new, comm_prev));
3405 if (cclos)
3406 dbxout_common_name (syms_prev, comm_prev, N_ECOMM);
3407 if (copen)
3408 {
3409 dbxout_common_name (syms, comm_new, N_BCOMM);
3410 syms_prev = syms;
3411 }
3412 comm_prev = comm_new;
3413
3414 result += dbxout_symbol (syms, 1);
3415 syms = DECL_CHAIN (syms);
3416 }
3417
3418 if (comm_prev != NULL)
3419 dbxout_common_name (syms_prev, comm_prev, N_ECOMM);
3420
3421 return result;
3422 }
3423 \f
3424 /* The following two functions output definitions of function parameters.
3425 Each parameter gets a definition locating it in the parameter list.
3426 Each parameter that is a register variable gets a second definition
3427 locating it in the register.
3428
3429 Printing or argument lists in gdb uses the definitions that
3430 locate in the parameter list. But reference to the variable in
3431 expressions uses preferentially the definition as a register. */
3432
3433 /* Output definitions, referring to storage in the parmlist,
3434 of all the parms in PARMS, which is a chain of PARM_DECL nodes. */
3435
3436 void
3437 dbxout_parms (tree parms)
3438 {
3439 ++debug_nesting;
3440 emit_pending_bincls_if_required ();
3441
3442 for (; parms; parms = DECL_CHAIN (parms))
3443 if (DECL_NAME (parms)
3444 && TREE_TYPE (parms) != error_mark_node
3445 && DECL_RTL_SET_P (parms)
3446 && DECL_INCOMING_RTL (parms))
3447 {
3448 tree eff_type;
3449 char letter;
3450 stab_code_type code;
3451 int number;
3452
3453 /* Perform any necessary register eliminations on the parameter's rtl,
3454 so that the debugging output will be accurate. */
3455 DECL_INCOMING_RTL (parms)
3456 = eliminate_regs (DECL_INCOMING_RTL (parms), VOIDmode, NULL_RTX);
3457 SET_DECL_RTL (parms,
3458 eliminate_regs (DECL_RTL (parms), VOIDmode, NULL_RTX));
3459 #ifdef LEAF_REG_REMAP
3460 if (crtl->uses_only_leaf_regs)
3461 {
3462 leaf_renumber_regs_insn (DECL_INCOMING_RTL (parms));
3463 leaf_renumber_regs_insn (DECL_RTL (parms));
3464 }
3465 #endif
3466
3467 if (PARM_PASSED_IN_MEMORY (parms))
3468 {
3469 rtx inrtl = XEXP (DECL_INCOMING_RTL (parms), 0);
3470
3471 /* ??? Here we assume that the parm address is indexed
3472 off the frame pointer or arg pointer.
3473 If that is not true, we produce meaningless results,
3474 but do not crash. */
3475 if (GET_CODE (inrtl) == PLUS
3476 && CONST_INT_P (XEXP (inrtl, 1)))
3477 number = INTVAL (XEXP (inrtl, 1));
3478 else
3479 number = 0;
3480
3481 code = N_PSYM;
3482 number = DEBUGGER_ARG_OFFSET (number, inrtl);
3483 letter = 'p';
3484
3485 /* It is quite tempting to use TREE_TYPE (parms) instead
3486 of DECL_ARG_TYPE (parms) for the eff_type, so that gcc
3487 reports the actual type of the parameter, rather than
3488 the promoted type. This certainly makes GDB's life
3489 easier, at least for some ports. The change is a bad
3490 idea however, since GDB expects to be able access the
3491 type without performing any conversions. So for
3492 example, if we were passing a float to an unprototyped
3493 function, gcc will store a double on the stack, but if
3494 we emit a stab saying the type is a float, then gdb
3495 will only read in a single value, and this will produce
3496 an erroneous value. */
3497 eff_type = DECL_ARG_TYPE (parms);
3498 }
3499 else if (REG_P (DECL_RTL (parms)))
3500 {
3501 rtx best_rtl;
3502
3503 /* Parm passed in registers and lives in registers or nowhere. */
3504 code = DBX_REGPARM_STABS_CODE;
3505 letter = DBX_REGPARM_STABS_LETTER;
3506
3507 /* For parms passed in registers, it is better to use the
3508 declared type of the variable, not the type it arrived in. */
3509 eff_type = TREE_TYPE (parms);
3510
3511 /* If parm lives in a register, use that register; pretend
3512 the parm was passed there. It would be more consistent
3513 to describe the register where the parm was passed, but
3514 in practice that register usually holds something else.
3515 If the parm lives nowhere, use the register where it
3516 was passed. */
3517 if (REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
3518 best_rtl = DECL_RTL (parms);
3519 else if (GET_CODE (DECL_INCOMING_RTL (parms)) == PARALLEL)
3520 best_rtl = XEXP (XVECEXP (DECL_INCOMING_RTL (parms), 0, 0), 0);
3521 else
3522 best_rtl = DECL_INCOMING_RTL (parms);
3523
3524 number = DBX_REGISTER_NUMBER (REGNO (best_rtl));
3525 }
3526 else if (MEM_P (DECL_RTL (parms))
3527 && REG_P (XEXP (DECL_RTL (parms), 0))
3528 && REGNO (XEXP (DECL_RTL (parms), 0)) != HARD_FRAME_POINTER_REGNUM
3529 && REGNO (XEXP (DECL_RTL (parms), 0)) != STACK_POINTER_REGNUM
3530 #if !HARD_FRAME_POINTER_IS_ARG_POINTER
3531 && REGNO (XEXP (DECL_RTL (parms), 0)) != ARG_POINTER_REGNUM
3532 #endif
3533 )
3534 {
3535 /* Parm was passed via invisible reference.
3536 That is, its address was passed in a register.
3537 Output it as if it lived in that register.
3538 The debugger will know from the type
3539 that it was actually passed by invisible reference. */
3540
3541 code = DBX_REGPARM_STABS_CODE;
3542
3543 /* GDB likes this marked with a special letter. */
3544 letter = (use_gnu_debug_info_extensions
3545 ? 'a' : DBX_REGPARM_STABS_LETTER);
3546 eff_type = TREE_TYPE (parms);
3547
3548 /* DECL_RTL looks like (MEM (REG...). Get the register number.
3549 If it is an unallocated pseudo-reg, then use the register where
3550 it was passed instead.
3551 ??? Why is DBX_REGISTER_NUMBER not used here? */
3552
3553 if (REGNO (XEXP (DECL_RTL (parms), 0)) < FIRST_PSEUDO_REGISTER)
3554 number = REGNO (XEXP (DECL_RTL (parms), 0));
3555 else
3556 number = REGNO (DECL_INCOMING_RTL (parms));
3557 }
3558 else if (MEM_P (DECL_RTL (parms))
3559 && MEM_P (XEXP (DECL_RTL (parms), 0)))
3560 {
3561 /* Parm was passed via invisible reference, with the reference
3562 living on the stack. DECL_RTL looks like
3563 (MEM (MEM (PLUS (REG ...) (CONST_INT ...)))) or it
3564 could look like (MEM (MEM (REG))). */
3565
3566 code = N_PSYM;
3567 letter = 'v';
3568 eff_type = TREE_TYPE (parms);
3569
3570 if (!REG_P (XEXP (XEXP (DECL_RTL (parms), 0), 0)))
3571 number = INTVAL (XEXP (XEXP (XEXP (DECL_RTL (parms), 0), 0), 1));
3572 else
3573 number = 0;
3574
3575 number = DEBUGGER_ARG_OFFSET (number,
3576 XEXP (XEXP (DECL_RTL (parms), 0), 0));
3577 }
3578 else if (MEM_P (DECL_RTL (parms))
3579 && XEXP (DECL_RTL (parms), 0) != const0_rtx
3580 /* ??? A constant address for a parm can happen
3581 when the reg it lives in is equiv to a constant in memory.
3582 Should make this not happen, after 2.4. */
3583 && ! CONSTANT_P (XEXP (DECL_RTL (parms), 0)))
3584 {
3585 /* Parm was passed in registers but lives on the stack. */
3586
3587 code = N_PSYM;
3588 letter = 'p';
3589 eff_type = TREE_TYPE (parms);
3590
3591 /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))),
3592 in which case we want the value of that CONST_INT,
3593 or (MEM (REG ...)),
3594 in which case we use a value of zero. */
3595 if (!REG_P (XEXP (DECL_RTL (parms), 0)))
3596 number = INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1));
3597 else
3598 number = 0;
3599
3600 /* Make a big endian correction if the mode of the type of the
3601 parameter is not the same as the mode of the rtl. */
3602 if (BYTES_BIG_ENDIAN
3603 && TYPE_MODE (TREE_TYPE (parms)) != GET_MODE (DECL_RTL (parms))
3604 && GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (parms))) < UNITS_PER_WORD)
3605 number += (GET_MODE_SIZE (GET_MODE (DECL_RTL (parms)))
3606 - GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (parms))));
3607 }
3608 else
3609 /* ??? We don't know how to represent this argument. */
3610 continue;
3611
3612 dbxout_begin_complex_stabs ();
3613
3614 if (DECL_NAME (parms))
3615 {
3616 stabstr_I (DECL_NAME (parms));
3617 stabstr_C (':');
3618 }
3619 else
3620 stabstr_S ("(anon):");
3621 stabstr_C (letter);
3622 dbxout_type (eff_type, 0);
3623 dbxout_finish_complex_stabs (parms, code, 0, 0, number);
3624 }
3625 DBXOUT_DECR_NESTING;
3626 }
3627
3628 /* Output definitions for the places where parms live during the function,
3629 when different from where they were passed, when the parms were passed
3630 in memory.
3631
3632 It is not useful to do this for parms passed in registers
3633 that live during the function in different registers, because it is
3634 impossible to look in the passed register for the passed value,
3635 so we use the within-the-function register to begin with.
3636
3637 PARMS is a chain of PARM_DECL nodes. */
3638
3639 void
3640 dbxout_reg_parms (tree parms)
3641 {
3642 ++debug_nesting;
3643
3644 for (; parms; parms = DECL_CHAIN (parms))
3645 if (DECL_NAME (parms) && PARM_PASSED_IN_MEMORY (parms))
3646 {
3647 /* Report parms that live in registers during the function
3648 but were passed in memory. */
3649 if (REG_P (DECL_RTL (parms))
3650 && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
3651 dbxout_symbol_location (parms, TREE_TYPE (parms),
3652 0, DECL_RTL (parms));
3653 else if (GET_CODE (DECL_RTL (parms)) == CONCAT)
3654 dbxout_symbol_location (parms, TREE_TYPE (parms),
3655 0, DECL_RTL (parms));
3656 /* Report parms that live in memory but not where they were passed. */
3657 else if (MEM_P (DECL_RTL (parms))
3658 && ! rtx_equal_p (DECL_RTL (parms), DECL_INCOMING_RTL (parms)))
3659 dbxout_symbol_location (parms, TREE_TYPE (parms),
3660 0, DECL_RTL (parms));
3661 }
3662 DBXOUT_DECR_NESTING;
3663 }
3664 \f
3665 /* Given a chain of ..._TYPE nodes (as come in a parameter list),
3666 output definitions of those names, in raw form */
3667
3668 static void
3669 dbxout_args (tree args)
3670 {
3671 while (args)
3672 {
3673 stabstr_C (',');
3674 dbxout_type (TREE_VALUE (args), 0);
3675 args = TREE_CHAIN (args);
3676 }
3677 }
3678 \f
3679 #if defined (DBX_DEBUGGING_INFO)
3680
3681 /* Subroutine of dbxout_block. Emit an N_LBRAC stab referencing LABEL.
3682 BEGIN_LABEL is the name of the beginning of the function, which may
3683 be required. */
3684 static void
3685 dbx_output_lbrac (const char *label,
3686 const char *begin_label ATTRIBUTE_UNUSED)
3687 {
3688 dbxout_begin_stabn (N_LBRAC);
3689 if (DBX_BLOCKS_FUNCTION_RELATIVE)
3690 dbxout_stab_value_label_diff (label, begin_label);
3691 else
3692 dbxout_stab_value_label (label);
3693 }
3694
3695 /* Subroutine of dbxout_block. Emit an N_RBRAC stab referencing LABEL.
3696 BEGIN_LABEL is the name of the beginning of the function, which may
3697 be required. */
3698 static void
3699 dbx_output_rbrac (const char *label,
3700 const char *begin_label ATTRIBUTE_UNUSED)
3701 {
3702 dbxout_begin_stabn (N_RBRAC);
3703 if (DBX_BLOCKS_FUNCTION_RELATIVE)
3704 dbxout_stab_value_label_diff (label, begin_label);
3705 else
3706 dbxout_stab_value_label (label);
3707 }
3708
3709 /* Output everything about a symbol block (a BLOCK node
3710 that represents a scope level),
3711 including recursive output of contained blocks.
3712
3713 BLOCK is the BLOCK node.
3714 DEPTH is its depth within containing symbol blocks.
3715 ARGS is usually zero; but for the outermost block of the
3716 body of a function, it is a chain of PARM_DECLs for the function parameters.
3717 We output definitions of all the register parms
3718 as if they were local variables of that block.
3719
3720 If -g1 was used, we count blocks just the same, but output nothing
3721 except for the outermost block.
3722
3723 Actually, BLOCK may be several blocks chained together.
3724 We handle them all in sequence. */
3725
3726 static void
3727 dbxout_block (tree block, int depth, tree args)
3728 {
3729 char begin_label[20];
3730 /* Reference current function start using LFBB. */
3731 ASM_GENERATE_INTERNAL_LABEL (begin_label, "LFBB", scope_labelno);
3732
3733 while (block)
3734 {
3735 /* Ignore blocks never expanded or otherwise marked as real. */
3736 if (TREE_USED (block) && TREE_ASM_WRITTEN (block))
3737 {
3738 int did_output;
3739 int blocknum = BLOCK_NUMBER (block);
3740
3741 /* In dbx format, the syms of a block come before the N_LBRAC.
3742 If nothing is output, we don't need the N_LBRAC, either. */
3743 did_output = 0;
3744 if (debug_info_level != DINFO_LEVEL_TERSE || depth == 0)
3745 did_output = dbxout_syms (BLOCK_VARS (block));
3746 if (args)
3747 dbxout_reg_parms (args);
3748
3749 /* Now output an N_LBRAC symbol to represent the beginning of
3750 the block. Use the block's tree-walk order to generate
3751 the assembler symbols LBBn and LBEn
3752 that final will define around the code in this block. */
3753 if (did_output)
3754 {
3755 char buf[20];
3756 const char *scope_start;
3757
3758 if (depth == 0)
3759 /* The outermost block doesn't get LBB labels; use
3760 the LFBB local symbol emitted by dbxout_begin_prologue. */
3761 scope_start = begin_label;
3762 else
3763 {
3764 ASM_GENERATE_INTERNAL_LABEL (buf, "LBB", blocknum);
3765 scope_start = buf;
3766 }
3767
3768 dbx_output_lbrac (scope_start, begin_label);
3769 }
3770
3771 /* Output the subblocks. */
3772 dbxout_block (BLOCK_SUBBLOCKS (block), depth + 1, NULL_TREE);
3773
3774 /* Refer to the marker for the end of the block. */
3775 if (did_output)
3776 {
3777 char buf[100];
3778 if (depth == 0)
3779 /* The outermost block doesn't get LBE labels;
3780 use the "scope" label which will be emitted
3781 by dbxout_function_end. */
3782 ASM_GENERATE_INTERNAL_LABEL (buf, "Lscope", scope_labelno);
3783 else
3784 ASM_GENERATE_INTERNAL_LABEL (buf, "LBE", blocknum);
3785
3786 dbx_output_rbrac (buf, begin_label);
3787 }
3788 }
3789 block = BLOCK_CHAIN (block);
3790 }
3791 }
3792
3793 /* Output the information about a function and its arguments and result.
3794 Usually this follows the function's code,
3795 but on some systems, it comes before. */
3796
3797 static void
3798 dbxout_begin_function (tree decl)
3799 {
3800 int saved_tree_used1;
3801
3802 saved_tree_used1 = TREE_USED (decl);
3803 TREE_USED (decl) = 1;
3804 if (DECL_NAME (DECL_RESULT (decl)) != 0)
3805 {
3806 int saved_tree_used2 = TREE_USED (DECL_RESULT (decl));
3807 TREE_USED (DECL_RESULT (decl)) = 1;
3808 dbxout_symbol (decl, 0);
3809 TREE_USED (DECL_RESULT (decl)) = saved_tree_used2;
3810 }
3811 else
3812 dbxout_symbol (decl, 0);
3813 TREE_USED (decl) = saved_tree_used1;
3814
3815 dbxout_parms (DECL_ARGUMENTS (decl));
3816 if (DECL_NAME (DECL_RESULT (decl)) != 0)
3817 dbxout_symbol (DECL_RESULT (decl), 1);
3818 }
3819 #endif /* DBX_DEBUGGING_INFO */
3820
3821 #endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */
3822
3823 /* Record an element in the table of global destructors. SYMBOL is
3824 a SYMBOL_REF of the function to be called; PRIORITY is a number
3825 between 0 and MAX_INIT_PRIORITY. */
3826
3827 void
3828 default_stabs_asm_out_destructor (rtx symbol ATTRIBUTE_UNUSED,
3829 int priority ATTRIBUTE_UNUSED)
3830 {
3831 #if defined DBX_DEBUGGING_INFO || defined XCOFF_DEBUGGING_INFO
3832 /* Tell GNU LD that this is part of the static destructor set.
3833 This will work for any system that uses stabs, most usefully
3834 aout systems. */
3835 dbxout_begin_simple_stabs ("___DTOR_LIST__", 22 /* N_SETT */);
3836 dbxout_stab_value_label (XSTR (symbol, 0));
3837 #else
3838 sorry ("global destructors not supported on this target");
3839 #endif
3840 }
3841
3842 /* Likewise for global constructors. */
3843
3844 void
3845 default_stabs_asm_out_constructor (rtx symbol ATTRIBUTE_UNUSED,
3846 int priority ATTRIBUTE_UNUSED)
3847 {
3848 #if defined DBX_DEBUGGING_INFO || defined XCOFF_DEBUGGING_INFO
3849 /* Tell GNU LD that this is part of the static destructor set.
3850 This will work for any system that uses stabs, most usefully
3851 aout systems. */
3852 dbxout_begin_simple_stabs ("___CTOR_LIST__", 22 /* N_SETT */);
3853 dbxout_stab_value_label (XSTR (symbol, 0));
3854 #else
3855 sorry ("global constructors not supported on this target");
3856 #endif
3857 }
3858
3859 #include "gt-dbxout.h"