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