1 /* Output dbx-format symbol table information from GNU compiler.
2 Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 /* Output dbx-format symbol table data.
24 This consists of many symbol table entries, each of them
25 a .stabs assembler pseudo-op with four operands:
26 a "name" which is really a description of one symbol and its type,
27 a "code", which is a symbol defined in stab.h whose name starts with N_,
28 an unused operand always 0,
29 and a "value" which is an address or an offset.
30 The name is enclosed in doublequote characters.
32 Each function, variable, typedef, and structure tag
33 has a symbol table entry to define it.
34 The beginning and end of each level of name scoping within
35 a function are also marked by special symbol table entries.
37 The "name" consists of the symbol name, a colon, a kind-of-symbol letter,
38 and a data type number. The data type number may be followed by
39 "=" and a type definition; normally this will happen the first time
40 the type number is mentioned. The type definition may refer to
41 other types by number, and those type numbers may be followed
42 by "=" and nested definitions.
44 This can make the "name" quite long.
45 When a name is more than 80 characters, we split the .stabs pseudo-op
46 into two .stabs pseudo-ops, both sharing the same "code" and "value".
47 The first one is marked as continued with a double-backslash at the
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.
55 The "code" is mostly redundant with the kind-of-symbol letter
56 that goes in the "name", but not entirely: for symbols located
57 in static storage, the "code" says which segment the address is in,
58 which controls how it is relocated.
60 The "value" for a symbol in static storage
61 is the core address of the symbol (actually, the assembler
62 label for the symbol). For a symbol located in a stack slot
63 it is the stack offset; for one in a register, the register number.
64 For a typedef symbol, it is zero.
66 If DEBUG_SYMS_TEXT is defined, all debugging symbols must be
67 output while in the text section.
69 For more on data type definitions, see `dbxout_type'. */
73 #include "coretypes.h"
80 #include "insn-config.h"
82 #include "output.h" /* ASM_OUTPUT_SOURCE_LINE may refer to sdb functions. */
90 #include "langhooks.h"
92 #ifdef XCOFF_DEBUGGING_INFO
97 #define ASM_STABS_OP "\t.stabs\t"
101 #define ASM_STABN_OP "\t.stabn\t"
104 #ifndef DBX_TYPE_DECL_STABS_CODE
105 #define DBX_TYPE_DECL_STABS_CODE N_LSYM
108 #ifndef DBX_STATIC_CONST_VAR_CODE
109 #define DBX_STATIC_CONST_VAR_CODE N_FUN
112 #ifndef DBX_REGPARM_STABS_CODE
113 #define DBX_REGPARM_STABS_CODE N_RSYM
116 #ifndef DBX_REGPARM_STABS_LETTER
117 #define DBX_REGPARM_STABS_LETTER 'P'
120 /* This is used for parameters passed by invisible reference in a register. */
121 #ifndef GDB_INV_REF_REGPARM_STABS_LETTER
122 #define GDB_INV_REF_REGPARM_STABS_LETTER 'a'
125 #ifndef DBX_MEMPARM_STABS_LETTER
126 #define DBX_MEMPARM_STABS_LETTER 'p'
129 #ifndef FILE_NAME_JOINER
130 #define FILE_NAME_JOINER "/"
133 /* GDB needs to know that the stabs were generated by GCC. We emit an
134 N_OPT stab at the beginning of the source file to indicate this.
135 The string is historical, and different on a very few targets. */
136 #ifndef STABS_GCC_MARKER
137 #define STABS_GCC_MARKER "gcc2_compiled."
140 enum typestatus
{TYPE_UNSEEN
, TYPE_XREF
, TYPE_DEFINED
};
142 /* Structure recording information about a C data type.
143 The status element says whether we have yet output
144 the definition of the type. TYPE_XREF says we have
145 output it as a cross-reference only.
146 The file_number and type_number elements are used if DBX_USE_BINCL
149 struct typeinfo
GTY(())
151 enum typestatus status
;
156 /* Vector recording information about C data types.
157 When we first notice a data type (a tree node),
158 we assign it a number using next_type_number.
159 That is its index in this vector. */
161 static GTY ((length ("typevec_len"))) struct typeinfo
*typevec
;
163 /* Number of elements of space allocated in `typevec'. */
165 static GTY(()) int typevec_len
;
167 /* In dbx output, each type gets a unique number.
168 This is the number for the next type output.
169 The number, once assigned, is in the TYPE_SYMTAB_ADDRESS field. */
171 static GTY(()) int next_type_number
;
173 /* When using N_BINCL in dbx output, each type number is actually a
174 pair of the file number and the type number within the file.
175 This is a stack of input files. */
177 struct dbx_file
GTY(())
179 struct dbx_file
*next
;
181 int next_type_number
;
184 /* This is the top of the stack. */
186 static GTY(()) struct dbx_file
*current_file
;
188 /* This is the next file number to use. */
190 static GTY(()) int next_file_number
;
192 /* Typical USG systems don't have stab.h, and they also have
193 no use for DBX-format debugging info. */
195 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
197 /* Last source file name mentioned in a NOTE insn. */
199 static const char *lastfile
;
201 /* Current working directory. */
203 static const char *cwd
;
205 /* Nonzero if we have actually used any of the GDB extensions
206 to the debugging format. The idea is that we use them for the
207 first time only if there's a strong reason, but once we have done that,
208 we use them whenever convenient. */
210 static int have_used_extensions
= 0;
212 /* Number for the next N_SOL filename stabs label. The number 0 is reserved
213 for the N_SO filename stabs label. */
215 #if defined (DBX_DEBUGGING_INFO) && !defined (DBX_OUTPUT_SOURCE_FILENAME)
216 static int source_label_number
= 1;
219 #ifdef DEBUG_SYMS_TEXT
220 #define FORCE_TEXT function_section (current_function_decl);
227 #define STAB_CODE_TYPE enum __stab_debug_code
229 /* 1 if PARM is passed to this function in memory. */
231 #define PARM_PASSED_IN_MEMORY(PARM) \
232 (GET_CODE (DECL_INCOMING_RTL (PARM)) == MEM)
234 /* A C expression for the integer offset value of an automatic variable
235 (N_LSYM) having address X (an RTX). */
236 #ifndef DEBUGGER_AUTO_OFFSET
237 #define DEBUGGER_AUTO_OFFSET(X) \
238 (GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0)
241 /* A C expression for the integer offset value of an argument (N_PSYM)
242 having address X (an RTX). The nominal offset is OFFSET. */
243 #ifndef DEBUGGER_ARG_OFFSET
244 #define DEBUGGER_ARG_OFFSET(OFFSET, X) (OFFSET)
247 /* Stream for writing to assembler file. */
249 static FILE *asmfile
;
251 /* These variables are for dbxout_symbol to communicate to
252 dbxout_finish_symbol.
253 current_sym_code is the symbol-type-code, a symbol N_... define in stab.h.
254 current_sym_value and current_sym_addr are two ways to address the
255 value to store in the symtab entry.
256 current_sym_addr if nonzero represents the value as an rtx.
257 If that is zero, current_sym_value is used. This is used
258 when the value is an offset (such as for auto variables,
259 register variables and parms). */
261 static STAB_CODE_TYPE current_sym_code
;
262 static int current_sym_value
;
263 static rtx current_sym_addr
;
265 /* Number of chars of symbol-description generated so far for the
266 current symbol. Used by CHARS and CONTIN. */
268 static int current_sym_nchars
;
270 /* Report having output N chars of the current symbol-description. */
272 #define CHARS(N) (current_sym_nchars += (N))
274 /* Break the current symbol-description, generating a continuation,
275 if it has become long. */
277 #ifndef DBX_CONTIN_LENGTH
278 #define DBX_CONTIN_LENGTH 80
281 #if DBX_CONTIN_LENGTH > 0
283 do {if (current_sym_nchars > DBX_CONTIN_LENGTH) dbxout_continue ();} while (0)
285 #define CONTIN do { } while (0)
288 static void dbxout_init
PARAMS ((const char *));
289 static void dbxout_finish
PARAMS ((const char *));
290 static void dbxout_start_source_file
PARAMS ((unsigned, const char *));
291 static void dbxout_end_source_file
PARAMS ((unsigned));
292 static void dbxout_typedefs
PARAMS ((tree
));
293 static void dbxout_fptype_value
PARAMS ((tree
));
294 static void dbxout_type_index
PARAMS ((tree
));
295 #if DBX_CONTIN_LENGTH > 0
296 static void dbxout_continue
PARAMS ((void));
298 static void dbxout_args
PARAMS ((tree
));
299 static void dbxout_type_fields
PARAMS ((tree
));
300 static void dbxout_type_method_1
PARAMS ((tree
, const char *));
301 static void dbxout_type_methods
PARAMS ((tree
));
302 static void dbxout_range_type
PARAMS ((tree
));
303 static void dbxout_type
PARAMS ((tree
, int));
304 static void print_int_cst_octal
PARAMS ((tree
));
305 static void print_octal
PARAMS ((unsigned HOST_WIDE_INT
, int));
306 static void print_wide_int
PARAMS ((HOST_WIDE_INT
));
307 static void dbxout_type_name
PARAMS ((tree
));
308 static void dbxout_class_name_qualifiers
PARAMS ((tree
));
309 static int dbxout_symbol_location
PARAMS ((tree
, tree
, const char *, rtx
));
310 static void dbxout_symbol_name
PARAMS ((tree
, const char *, int));
311 static void dbxout_prepare_symbol
PARAMS ((tree
));
312 static void dbxout_finish_symbol
PARAMS ((tree
));
313 static void dbxout_block
PARAMS ((tree
, int, tree
));
314 static void dbxout_global_decl
PARAMS ((tree
));
316 /* The debug hooks structure. */
317 #if defined (DBX_DEBUGGING_INFO)
319 static void dbxout_source_line
PARAMS ((unsigned int, const char *));
320 static void dbxout_source_file
PARAMS ((FILE *, const char *));
321 static void dbxout_function_end
PARAMS ((void));
322 static void dbxout_begin_function
PARAMS ((tree
));
323 static void dbxout_begin_block
PARAMS ((unsigned, unsigned));
324 static void dbxout_end_block
PARAMS ((unsigned, unsigned));
325 static void dbxout_function_decl
PARAMS ((tree
));
327 const struct gcc_debug_hooks dbx_debug_hooks
=
331 debug_nothing_int_charstar
,
332 debug_nothing_int_charstar
,
333 dbxout_start_source_file
,
334 dbxout_end_source_file
,
337 debug_true_tree
, /* ignore_block */
338 dbxout_source_line
, /* source_line */
339 dbxout_source_line
, /* begin_prologue: just output line info */
340 debug_nothing_int_charstar
, /* end_prologue */
341 debug_nothing_int_charstar
, /* end_epilogue */
342 #ifdef DBX_FUNCTION_FIRST
343 dbxout_begin_function
,
345 debug_nothing_tree
, /* begin_function */
347 debug_nothing_int
, /* end_function */
348 dbxout_function_decl
,
349 dbxout_global_decl
, /* global_decl */
350 debug_nothing_tree
, /* deferred_inline_function */
351 debug_nothing_tree
, /* outlining_inline_function */
352 debug_nothing_rtx
/* label */
354 #endif /* DBX_DEBUGGING_INFO */
356 #if defined (XCOFF_DEBUGGING_INFO)
357 const struct gcc_debug_hooks xcoff_debug_hooks
=
361 debug_nothing_int_charstar
,
362 debug_nothing_int_charstar
,
363 dbxout_start_source_file
,
364 dbxout_end_source_file
,
365 xcoffout_begin_block
,
367 debug_true_tree
, /* ignore_block */
368 xcoffout_source_line
,
369 xcoffout_begin_prologue
, /* begin_prologue */
370 debug_nothing_int_charstar
, /* end_prologue */
371 xcoffout_end_epilogue
,
372 debug_nothing_tree
, /* begin_function */
373 xcoffout_end_function
,
374 debug_nothing_tree
, /* function_decl */
375 dbxout_global_decl
, /* global_decl */
376 debug_nothing_tree
, /* deferred_inline_function */
377 debug_nothing_tree
, /* outlining_inline_function */
378 debug_nothing_rtx
/* label */
380 #endif /* XCOFF_DEBUGGING_INFO */
382 #if defined (DBX_DEBUGGING_INFO)
384 dbxout_function_end ()
386 static int scope_labelno
= 0;
387 char lscope_label_name
[100];
388 /* Convert Ltext into the appropriate format for local labels in case
389 the system doesn't insert underscores in front of user generated
391 ASM_GENERATE_INTERNAL_LABEL (lscope_label_name
, "Lscope", scope_labelno
);
392 (*targetm
.asm_out
.internal_label
) (asmfile
, "Lscope", scope_labelno
);
395 /* By convention, GCC will mark the end of a function with an N_FUN
396 symbol and an empty string. */
397 #ifdef DBX_OUTPUT_NFUN
398 DBX_OUTPUT_NFUN (asmfile
, lscope_label_name
, current_function_decl
);
400 fprintf (asmfile
, "%s\"\",%d,0,0,", ASM_STABS_OP
, N_FUN
);
401 assemble_name (asmfile
, lscope_label_name
);
403 assemble_name (asmfile
, XSTR (XEXP (DECL_RTL (current_function_decl
), 0), 0));
404 fprintf (asmfile
, "\n");
407 #endif /* DBX_DEBUGGING_INFO */
409 /* At the beginning of compilation, start writing the symbol table.
410 Initialize `typevec' and output the standard data types of C. */
413 dbxout_init (input_file_name
)
414 const char *input_file_name
;
416 char ltext_label_name
[100];
417 tree syms
= (*lang_hooks
.decls
.getdecls
) ();
419 asmfile
= asm_out_file
;
422 typevec
= (struct typeinfo
*) ggc_calloc (typevec_len
, sizeof typevec
[0]);
424 /* Convert Ltext into the appropriate format for local labels in case
425 the system doesn't insert underscores in front of user generated
427 ASM_GENERATE_INTERNAL_LABEL (ltext_label_name
, "Ltext", 0);
429 /* Put the current working directory in an N_SO symbol. */
430 #ifndef DBX_WORKING_DIRECTORY /* Only some versions of DBX want this,
431 but GDB always does. */
432 if (use_gnu_debug_info_extensions
)
435 if (!cwd
&& (cwd
= getpwd ()) && (!*cwd
|| cwd
[strlen (cwd
) - 1] != '/'))
436 cwd
= concat (cwd
, FILE_NAME_JOINER
, NULL
);
439 #ifdef DBX_OUTPUT_MAIN_SOURCE_DIRECTORY
440 DBX_OUTPUT_MAIN_SOURCE_DIRECTORY (asmfile
, cwd
);
441 #else /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */
442 fprintf (asmfile
, "%s", ASM_STABS_OP
);
443 output_quoted_string (asmfile
, cwd
);
444 fprintf (asmfile
, ",%d,0,0,", N_SO
);
445 assemble_name (asmfile
, ltext_label_name
);
446 fputc ('\n', asmfile
);
447 #endif /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */
451 #ifdef DBX_OUTPUT_MAIN_SOURCE_FILENAME
452 /* This should NOT be DBX_OUTPUT_SOURCE_FILENAME. That
453 would give us an N_SOL, and we want an N_SO. */
454 DBX_OUTPUT_MAIN_SOURCE_FILENAME (asmfile
, input_file_name
);
455 #else /* no DBX_OUTPUT_MAIN_SOURCE_FILENAME */
456 /* We include outputting `Ltext:' here,
457 because that gives you a way to override it. */
458 /* Used to put `Ltext:' before the reference, but that loses on sun 4. */
459 fprintf (asmfile
, "%s", ASM_STABS_OP
);
460 output_quoted_string (asmfile
, input_file_name
);
461 fprintf (asmfile
, ",%d,0,0,", N_SO
);
462 assemble_name (asmfile
, ltext_label_name
);
463 fputc ('\n', asmfile
);
465 (*targetm
.asm_out
.internal_label
) (asmfile
, "Ltext", 0);
466 #endif /* no DBX_OUTPUT_MAIN_SOURCE_FILENAME */
468 #ifdef DBX_OUTPUT_GCC_MARKER
469 DBX_OUTPUT_GCC_MARKER (asmfile
);
471 /* Emit an N_OPT stab to indicate that this file was compiled by GCC. */
472 fprintf (asmfile
, "%s\"%s\",%d,0,0,0\n",
473 ASM_STABS_OP
, STABS_GCC_MARKER
, N_OPT
);
476 lastfile
= input_file_name
;
478 next_type_number
= 1;
481 current_file
= (struct dbx_file
*) ggc_alloc (sizeof *current_file
);
482 current_file
->next
= NULL
;
483 current_file
->file_number
= 0;
484 current_file
->next_type_number
= 1;
485 next_file_number
= 1;
488 /* Make sure that types `int' and `char' have numbers 1 and 2.
489 Definitions of other integer types will refer to those numbers.
490 (Actually it should no longer matter what their numbers are.
491 Also, if any types with tags have been defined, dbxout_symbol
492 will output them first, so the numbers won't be 1 and 2. That
493 happens in C++. So it's a good thing it should no longer matter). */
495 #ifdef DBX_OUTPUT_STANDARD_TYPES
496 DBX_OUTPUT_STANDARD_TYPES (syms
);
498 dbxout_symbol (TYPE_NAME (integer_type_node
), 0);
499 dbxout_symbol (TYPE_NAME (char_type_node
), 0);
502 /* Get all permanent types that have typedef names,
503 and output them all, except for those already output. */
505 dbxout_typedefs (syms
);
508 /* Output any typedef names for types described by TYPE_DECLs in SYMS,
509 in the reverse order from that which is found in SYMS. */
512 dbxout_typedefs (syms
)
517 dbxout_typedefs (TREE_CHAIN (syms
));
518 if (TREE_CODE (syms
) == TYPE_DECL
)
520 tree type
= TREE_TYPE (syms
);
522 && TREE_CODE (TYPE_NAME (type
)) == TYPE_DECL
523 && COMPLETE_TYPE_P (type
)
524 && ! TREE_ASM_WRITTEN (TYPE_NAME (type
)))
525 dbxout_symbol (TYPE_NAME (type
), 0);
530 /* Change to reading from a new source file. Generate a N_BINCL stab. */
533 dbxout_start_source_file (line
, filename
)
534 unsigned int line ATTRIBUTE_UNUSED
;
535 const char *filename ATTRIBUTE_UNUSED
;
538 struct dbx_file
*n
= (struct dbx_file
*) ggc_alloc (sizeof *n
);
540 n
->next
= current_file
;
541 n
->file_number
= next_file_number
++;
542 n
->next_type_number
= 1;
544 fprintf (asmfile
, "%s", ASM_STABS_OP
);
545 output_quoted_string (asmfile
, filename
);
546 fprintf (asmfile
, ",%d,0,0,0\n", N_BINCL
);
550 /* Revert to reading a previous source file. Generate a N_EINCL stab. */
553 dbxout_end_source_file (line
)
554 unsigned int line ATTRIBUTE_UNUSED
;
557 fprintf (asmfile
, "%s%d,0,0,0\n", ASM_STABN_OP
, N_EINCL
);
558 current_file
= current_file
->next
;
562 #if defined (DBX_DEBUGGING_INFO)
563 /* Output debugging info to FILE to switch to sourcefile FILENAME. */
566 dbxout_source_file (file
, filename
)
568 const char *filename
;
570 if (filename
&& (lastfile
== 0 || strcmp (filename
, lastfile
)))
572 #ifdef DBX_OUTPUT_SOURCE_FILENAME
573 DBX_OUTPUT_SOURCE_FILENAME (file
, filename
);
575 char ltext_label_name
[100];
577 ASM_GENERATE_INTERNAL_LABEL (ltext_label_name
, "Ltext",
578 source_label_number
);
579 fprintf (file
, "%s", ASM_STABS_OP
);
580 output_quoted_string (file
, filename
);
581 fprintf (asmfile
, ",%d,0,0,", N_SOL
);
582 assemble_name (asmfile
, ltext_label_name
);
583 fputc ('\n', asmfile
);
584 if (current_function_decl
!= NULL_TREE
585 && DECL_SECTION_NAME (current_function_decl
) != NULL_TREE
)
586 ; /* Don't change section amid function. */
589 (*targetm
.asm_out
.internal_label
) (file
, "Ltext", source_label_number
);
590 source_label_number
++;
596 /* Output a line number symbol entry for source file FILENAME and line
600 dbxout_source_line (lineno
, filename
)
602 const char *filename
;
604 dbxout_source_file (asmfile
, filename
);
606 #ifdef ASM_OUTPUT_SOURCE_LINE
607 ASM_OUTPUT_SOURCE_LINE (asmfile
, lineno
);
609 fprintf (asmfile
, "%s%d,0,%d\n", ASM_STABD_OP
, N_SLINE
, lineno
);
613 /* Describe the beginning of an internal block within a function. */
616 dbxout_begin_block (line
, n
)
617 unsigned int line ATTRIBUTE_UNUSED
;
620 (*targetm
.asm_out
.internal_label
) (asmfile
, "LBB", n
);
623 /* Describe the end line-number of an internal block within a function. */
626 dbxout_end_block (line
, n
)
627 unsigned int line ATTRIBUTE_UNUSED
;
630 (*targetm
.asm_out
.internal_label
) (asmfile
, "LBE", n
);
633 /* Output dbx data for a function definition.
634 This includes a definition of the function name itself (a symbol),
635 definitions of the parameters (locating them in the parameter list)
636 and then output the block that makes up the function's body
637 (including all the auto variables of the function). */
640 dbxout_function_decl (decl
)
643 #ifndef DBX_FUNCTION_FIRST
644 dbxout_begin_function (decl
);
646 dbxout_block (DECL_INITIAL (decl
), 0, DECL_ARGUMENTS (decl
));
647 #ifdef DBX_OUTPUT_FUNCTION_END
648 DBX_OUTPUT_FUNCTION_END (asmfile
, decl
);
650 if (use_gnu_debug_info_extensions
651 #if defined(NO_DBX_FUNCTION_END)
652 && ! NO_DBX_FUNCTION_END
654 && targetm
.have_named_sections
)
655 dbxout_function_end ();
658 #endif /* DBX_DEBUGGING_INFO */
660 /* Debug information for a global DECL. Called from toplev.c after
661 compilation proper has finished. */
663 dbxout_global_decl (decl
)
666 if (TREE_CODE (decl
) == VAR_DECL
667 && ! DECL_EXTERNAL (decl
)
668 && DECL_RTL_SET_P (decl
)) /* Not necessary? */
669 dbxout_symbol (decl
, 0);
672 /* At the end of compilation, finish writing the symbol table.
673 Unless you define DBX_OUTPUT_MAIN_SOURCE_FILE_END, the default is
677 dbxout_finish (filename
)
678 const char *filename ATTRIBUTE_UNUSED
;
680 #ifdef DBX_OUTPUT_MAIN_SOURCE_FILE_END
681 DBX_OUTPUT_MAIN_SOURCE_FILE_END (asmfile
, filename
);
682 #endif /* DBX_OUTPUT_MAIN_SOURCE_FILE_END */
685 /* Output floating point type values used by the 'R' stab letter.
686 These numbers come from include/aout/stab_gnu.h in binutils/gdb.
688 There are only 3 real/complex types defined, and we need 7/6.
689 We use NF_SINGLE as a generic float type, and NF_COMPLEX as a generic
690 complex type. Since we have the type size anyways, we don't really need
691 to distinguish between different FP types, we only need to distinguish
692 between float and complex. This works fine with gdb.
694 We only use this for complex types, to avoid breaking backwards
695 compatibility for real types. complex types aren't in ISO C90, so it is
696 OK if old debuggers don't understand the debug info we emit for them. */
698 /* ??? These are supposed to be IEEE types, but we don't check for that.
699 We could perhaps add additional numbers for non-IEEE types if we need
703 dbxout_fptype_value (type
)
707 enum machine_mode mode
= TYPE_MODE (type
);
709 if (TREE_CODE (type
) == REAL_TYPE
)
713 else if (mode
== DFmode
)
715 else if (mode
== TFmode
|| mode
== XFmode
)
718 /* Use NF_SINGLE as a generic real type for other sizes. */
721 else if (TREE_CODE (type
) == COMPLEX_TYPE
)
725 else if (mode
== DCmode
)
727 else if (mode
== TCmode
|| mode
== XCmode
)
730 /* Use NF_COMPLEX as a generic complex type for other sizes. */
736 putc (value
, asmfile
);
740 /* Output the index of a type. */
743 dbxout_type_index (type
)
746 #ifndef DBX_USE_BINCL
747 fprintf (asmfile
, "%d", TYPE_SYMTAB_ADDRESS (type
));
750 struct typeinfo
*t
= &typevec
[TYPE_SYMTAB_ADDRESS (type
)];
751 fprintf (asmfile
, "(%d,%d)", t
->file_number
, t
->type_number
);
756 #if DBX_CONTIN_LENGTH > 0
757 /* Continue a symbol-description that gets too big.
758 End one symbol table entry with a double-backslash
759 and start a new one, eventually producing something like
760 .stabs "start......\\",code,0,value
761 .stabs "...rest",code,0,value */
766 #ifdef DBX_CONTIN_CHAR
767 fprintf (asmfile
, "%c", DBX_CONTIN_CHAR
);
769 fprintf (asmfile
, "\\\\");
771 dbxout_finish_symbol (NULL_TREE
);
772 fprintf (asmfile
, "%s\"", ASM_STABS_OP
);
773 current_sym_nchars
= 0;
775 #endif /* DBX_CONTIN_LENGTH > 0 */
777 /* Subroutine of `dbxout_type'. Output the type fields of TYPE.
778 This must be a separate function because anonymous unions require
782 dbxout_type_fields (type
)
787 /* Output the name, type, position (in bits), size (in bits) of each
788 field that we can support. */
789 for (tem
= TYPE_FIELDS (type
); tem
; tem
= TREE_CHAIN (tem
))
791 /* Omit here local type decls until we know how to support them. */
792 if (TREE_CODE (tem
) == TYPE_DECL
793 /* Omit fields whose position or size are variable or too large to
795 || (TREE_CODE (tem
) == FIELD_DECL
796 && (! host_integerp (bit_position (tem
), 0)
798 || ! host_integerp (DECL_SIZE (tem
), 1)))
799 /* Omit here the nameless fields that are used to skip bits. */
800 || DECL_IGNORED_P (tem
))
803 else if (TREE_CODE (tem
) != CONST_DECL
)
805 /* Continue the line if necessary,
806 but not before the first field. */
807 if (tem
!= TYPE_FIELDS (type
))
812 fprintf (asmfile
, "%s:", IDENTIFIER_POINTER (DECL_NAME (tem
)));
813 CHARS (2 + IDENTIFIER_LENGTH (DECL_NAME (tem
)));
817 fprintf (asmfile
, ":");
821 if (use_gnu_debug_info_extensions
822 && (TREE_PRIVATE (tem
) || TREE_PROTECTED (tem
)
823 || TREE_CODE (tem
) != FIELD_DECL
))
825 have_used_extensions
= 1;
827 putc ((TREE_PRIVATE (tem
) ? '0'
828 : TREE_PROTECTED (tem
) ? '1' : '2'),
833 dbxout_type ((TREE_CODE (tem
) == FIELD_DECL
834 && DECL_BIT_FIELD_TYPE (tem
))
835 ? DECL_BIT_FIELD_TYPE (tem
) : TREE_TYPE (tem
), 0);
837 if (TREE_CODE (tem
) == VAR_DECL
)
839 if (TREE_STATIC (tem
) && use_gnu_debug_info_extensions
)
841 tree name
= DECL_ASSEMBLER_NAME (tem
);
843 have_used_extensions
= 1;
844 fprintf (asmfile
, ":%s;", IDENTIFIER_POINTER (name
));
845 CHARS (IDENTIFIER_LENGTH (name
) + 2);
849 /* If TEM is non-static, GDB won't understand it. */
850 fprintf (asmfile
, ",0,0;");
857 print_wide_int (int_bit_position (tem
));
859 print_wide_int (tree_low_cst (DECL_SIZE (tem
), 1));
867 /* Subroutine of `dbxout_type_methods'. Output debug info about the
868 method described DECL. DEBUG_NAME is an encoding of the method's
869 type signature. ??? We may be able to do without DEBUG_NAME altogether
873 dbxout_type_method_1 (decl
, debug_name
)
875 const char *debug_name
;
879 if (TREE_CODE (TREE_TYPE (decl
)) == FUNCTION_TYPE
)
881 else /* it's a METHOD_TYPE. */
883 tree firstarg
= TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl
)));
884 /* A for normal functions.
885 B for `const' member functions.
886 C for `volatile' member functions.
887 D for `const volatile' member functions. */
888 if (TYPE_READONLY (TREE_TYPE (firstarg
)))
890 if (TYPE_VOLATILE (TREE_TYPE (firstarg
)))
893 if (DECL_VINDEX (decl
))
899 fprintf (asmfile
, ":%s;%c%c%c", debug_name
,
900 TREE_PRIVATE (decl
) ? '0'
901 : TREE_PROTECTED (decl
) ? '1' : '2', c1
, c2
);
902 CHARS (IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (decl
)) + 6
903 - (debug_name
- IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
))));
905 if (DECL_VINDEX (decl
) && host_integerp (DECL_VINDEX (decl
), 0))
907 print_wide_int (tree_low_cst (DECL_VINDEX (decl
), 0));
910 dbxout_type (DECL_CONTEXT (decl
), 0);
911 fprintf (asmfile
, ";");
916 /* Subroutine of `dbxout_type'. Output debug info about the methods defined
920 dbxout_type_methods (type
)
923 /* C++: put out the method names and their parameter lists */
924 tree methods
= TYPE_METHODS (type
);
928 char formatted_type_identifier_length
[16];
929 int type_identifier_length
;
931 if (methods
== NULL_TREE
)
934 type_encoding
= DECL_NAME (TYPE_NAME (type
));
937 /* C++: Template classes break some assumptions made by this code about
938 the class names, constructor names, and encodings for assembler
939 label names. For now, disable output of dbx info for them. */
941 const char *ptr
= IDENTIFIER_POINTER (type_encoding
);
942 /* This should use index. (mrs) */
943 while (*ptr
&& *ptr
!= '<') ptr
++;
954 type_identifier_length
= IDENTIFIER_LENGTH (type_encoding
);
956 sprintf (formatted_type_identifier_length
, "%d", type_identifier_length
);
958 if (TREE_CODE (methods
) != TREE_VEC
)
960 else if (TREE_VEC_ELT (methods
, 0) != NULL_TREE
)
961 fndecl
= TREE_VEC_ELT (methods
, 0);
963 fndecl
= TREE_VEC_ELT (methods
, 1);
969 /* Group together all the methods for the same operation.
970 These differ in the types of the arguments. */
971 for (last
= NULL_TREE
;
972 fndecl
&& (last
== NULL_TREE
|| DECL_NAME (fndecl
) == DECL_NAME (last
));
973 fndecl
= TREE_CHAIN (fndecl
))
974 /* Output the name of the field (after overloading), as
975 well as the name of the field before overloading, along
976 with its parameter list */
978 /* This is the "mangled" name of the method.
979 It encodes the argument types. */
980 const char *debug_name
;
982 /* Skip methods that aren't FUNCTION_DECLs. (In C++, these
983 include TEMPLATE_DECLs.) The debugger doesn't know what
984 to do with such entities anyhow. */
985 if (TREE_CODE (fndecl
) != FUNCTION_DECL
)
988 debug_name
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fndecl
));
994 /* Also ignore abstract methods; those are only interesting to
995 the DWARF backends. */
996 if (DECL_IGNORED_P (fndecl
) || DECL_ABSTRACT (fndecl
))
999 /* Redundantly output the plain name, since that's what gdb
1003 tree name
= DECL_NAME (fndecl
);
1004 fprintf (asmfile
, "%s::", IDENTIFIER_POINTER (name
));
1005 CHARS (IDENTIFIER_LENGTH (name
) + 2);
1009 dbxout_type (TREE_TYPE (fndecl
), 0);
1011 dbxout_type_method_1 (fndecl
, debug_name
);
1015 putc (';', asmfile
);
1021 /* Emit a "range" type specification, which has the form:
1022 "r<index type>;<lower bound>;<upper bound>;".
1023 TYPE is an INTEGER_TYPE. */
1026 dbxout_range_type (type
)
1029 fprintf (asmfile
, "r");
1030 if (TREE_TYPE (type
))
1031 dbxout_type (TREE_TYPE (type
), 0);
1032 else if (TREE_CODE (type
) != INTEGER_TYPE
)
1033 dbxout_type (type
, 0); /* E.g. Pascal's ARRAY [BOOLEAN] of INTEGER */
1036 /* Traditionally, we made sure 'int' was type 1, and builtin types
1037 were defined to be sub-ranges of int. Unfortunately, this
1038 does not allow us to distinguish true sub-ranges from integer
1039 types. So, instead we define integer (non-sub-range) types as
1040 sub-ranges of themselves. This matters for Chill. If this isn't
1041 a subrange type, then we want to define it in terms of itself.
1042 However, in C, this may be an anonymous integer type, and we don't
1043 want to emit debug info referring to it. Just calling
1044 dbxout_type_index won't work anyways, because the type hasn't been
1045 defined yet. We make this work for both cases by checked to see
1046 whether this is a defined type, referring to it if it is, and using
1048 if (TYPE_SYMTAB_ADDRESS (type
) != 0)
1049 dbxout_type_index (type
);
1051 dbxout_type_index (integer_type_node
);
1054 if (TYPE_MIN_VALUE (type
) != 0
1055 && host_integerp (TYPE_MIN_VALUE (type
), 0))
1057 putc (';', asmfile
);
1059 print_wide_int (tree_low_cst (TYPE_MIN_VALUE (type
), 0));
1063 fprintf (asmfile
, ";0");
1067 if (TYPE_MAX_VALUE (type
) != 0
1068 && host_integerp (TYPE_MAX_VALUE (type
), 0))
1070 putc (';', asmfile
);
1072 print_wide_int (tree_low_cst (TYPE_MAX_VALUE (type
), 0));
1073 putc (';', asmfile
);
1078 fprintf (asmfile
, ";-1;");
1083 /* Output a reference to a type. If the type has not yet been
1084 described in the dbx output, output its definition now.
1085 For a type already defined, just refer to its definition
1086 using the type number.
1088 If FULL is nonzero, and the type has been described only with
1089 a forward-reference, output the definition now.
1090 If FULL is zero in this case, just refer to the forward-reference
1091 using the number previously allocated. */
1094 dbxout_type (type
, full
)
1100 static int anonymous_type_number
= 0;
1102 if (TREE_CODE (type
) == VECTOR_TYPE
)
1103 /* The frontend feeds us a representation for the vector as a struct
1104 containing an array. Pull out the array type. */
1105 type
= TREE_TYPE (TYPE_FIELDS (TYPE_DEBUG_REPRESENTATION_TYPE (type
)));
1107 /* If there was an input error and we don't really have a type,
1108 avoid crashing and write something that is at least valid
1109 by assuming `int'. */
1110 if (type
== error_mark_node
)
1111 type
= integer_type_node
;
1114 if (TYPE_NAME (type
)
1115 && TREE_CODE (TYPE_NAME (type
)) == TYPE_DECL
1116 && TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (type
)))
1120 /* Try to find the "main variant" with the same name. */
1121 if (TYPE_NAME (type
) && TREE_CODE (TYPE_NAME (type
)) == TYPE_DECL
1122 && DECL_ORIGINAL_TYPE (TYPE_NAME (type
)))
1123 main_variant
= TREE_TYPE (TYPE_NAME (type
));
1125 main_variant
= TYPE_MAIN_VARIANT (type
);
1127 /* If we are not using extensions, stabs does not distinguish const and
1128 volatile, so there is no need to make them separate types. */
1129 if (!use_gnu_debug_info_extensions
)
1130 type
= main_variant
;
1132 if (TYPE_SYMTAB_ADDRESS (type
) == 0)
1134 /* Type has no dbx number assigned. Assign next available number. */
1135 TYPE_SYMTAB_ADDRESS (type
) = next_type_number
++;
1137 /* Make sure type vector is long enough to record about this type. */
1139 if (next_type_number
== typevec_len
)
1142 = (struct typeinfo
*) ggc_realloc (typevec
,
1144 * sizeof typevec
[0]));
1145 memset ((char *) (typevec
+ typevec_len
), 0,
1146 typevec_len
* sizeof typevec
[0]);
1150 #ifdef DBX_USE_BINCL
1151 typevec
[TYPE_SYMTAB_ADDRESS (type
)].file_number
1152 = current_file
->file_number
;
1153 typevec
[TYPE_SYMTAB_ADDRESS (type
)].type_number
1154 = current_file
->next_type_number
++;
1158 /* Output the number of this type, to refer to it. */
1159 dbxout_type_index (type
);
1161 #ifdef DBX_TYPE_DEFINED
1162 if (DBX_TYPE_DEFINED (type
))
1166 /* If this type's definition has been output or is now being output,
1169 switch (typevec
[TYPE_SYMTAB_ADDRESS (type
)].status
)
1174 /* If we have already had a cross reference,
1175 and either that's all we want or that's the best we could do,
1176 don't repeat the cross reference.
1177 Sun dbx crashes if we do. */
1178 if (! full
|| !COMPLETE_TYPE_P (type
)
1179 /* No way in DBX fmt to describe a variable size. */
1180 || ! host_integerp (TYPE_SIZE (type
), 1))
1188 /* For systems where dbx output does not allow the `=xsNAME:' syntax,
1189 leave the type-number completely undefined rather than output
1190 a cross-reference. If we have already used GNU debug info extensions,
1191 then it is OK to output a cross reference. This is necessary to get
1192 proper C++ debug output. */
1193 if ((TREE_CODE (type
) == RECORD_TYPE
|| TREE_CODE (type
) == UNION_TYPE
1194 || TREE_CODE (type
) == QUAL_UNION_TYPE
1195 || TREE_CODE (type
) == ENUMERAL_TYPE
)
1196 && ! use_gnu_debug_info_extensions
)
1197 /* We must use the same test here as we use twice below when deciding
1198 whether to emit a cross-reference. */
1199 if ((TYPE_NAME (type
) != 0
1200 && ! (TREE_CODE (TYPE_NAME (type
)) == TYPE_DECL
1201 && DECL_IGNORED_P (TYPE_NAME (type
)))
1203 || !COMPLETE_TYPE_P (type
)
1204 /* No way in DBX fmt to describe a variable size. */
1205 || ! host_integerp (TYPE_SIZE (type
), 1))
1207 typevec
[TYPE_SYMTAB_ADDRESS (type
)].status
= TYPE_XREF
;
1212 /* Output a definition now. */
1214 fprintf (asmfile
, "=");
1217 /* Mark it as defined, so that if it is self-referent
1218 we will not get into an infinite recursion of definitions. */
1220 typevec
[TYPE_SYMTAB_ADDRESS (type
)].status
= TYPE_DEFINED
;
1222 /* If this type is a variant of some other, hand off. Types with
1223 different names are usefully distinguished. We only distinguish
1224 cv-qualified types if we're using extensions. */
1225 if (TYPE_READONLY (type
) > TYPE_READONLY (main_variant
))
1227 putc ('k', asmfile
);
1229 dbxout_type (build_type_variant (type
, 0, TYPE_VOLATILE (type
)), 0);
1232 else if (TYPE_VOLATILE (type
) > TYPE_VOLATILE (main_variant
))
1234 putc ('B', asmfile
);
1236 dbxout_type (build_type_variant (type
, TYPE_READONLY (type
), 0), 0);
1239 else if (main_variant
!= TYPE_MAIN_VARIANT (type
))
1241 /* 'type' is a typedef; output the type it refers to. */
1242 dbxout_type (DECL_ORIGINAL_TYPE (TYPE_NAME (type
)), 0);
1245 /* else continue. */
1247 switch (TREE_CODE (type
))
1251 /* For a void type, just define it as itself; ie, "5=5".
1252 This makes us consider it defined
1253 without saying what it is. The debugger will make it
1254 a void type when the reference is seen, and nothing will
1255 ever override that default. */
1256 dbxout_type_index (type
);
1260 if (type
== char_type_node
&& ! TREE_UNSIGNED (type
))
1262 /* Output the type `char' as a subrange of itself!
1263 I don't understand this definition, just copied it
1264 from the output of pcc.
1265 This used to use `r2' explicitly and we used to
1266 take care to make sure that `char' was type number 2. */
1267 fprintf (asmfile
, "r");
1269 dbxout_type_index (type
);
1270 fprintf (asmfile
, ";0;127;");
1274 /* If this is a subtype of another integer type, always prefer to
1275 write it as a subtype. */
1276 else if (TREE_TYPE (type
) != 0
1277 && TREE_CODE (TREE_TYPE (type
)) == INTEGER_TYPE
)
1279 /* If the size is non-standard, say what it is if we can use
1282 if (use_gnu_debug_info_extensions
1283 && TYPE_PRECISION (type
) != TYPE_PRECISION (integer_type_node
))
1285 have_used_extensions
= 1;
1286 fprintf (asmfile
, "@s%d;", TYPE_PRECISION (type
));
1290 dbxout_range_type (type
);
1295 /* If the size is non-standard, say what it is if we can use
1298 if (use_gnu_debug_info_extensions
1299 && TYPE_PRECISION (type
) != TYPE_PRECISION (integer_type_node
))
1301 have_used_extensions
= 1;
1302 fprintf (asmfile
, "@s%d;", TYPE_PRECISION (type
));
1306 /* If we can use GDB extensions and the size is wider than a
1307 long (the size used by GDB to read them) or we may have
1308 trouble writing the bounds the usual way, write them in
1309 octal. Note the test is for the *target's* size of "long",
1310 not that of the host. The host test is just to make sure we
1311 can write it out in case the host wide int is narrower than the
1314 /* For unsigned types, we use octal if they are the same size or
1315 larger. This is because we print the bounds as signed decimal,
1316 and hence they can't span same size unsigned types. */
1318 if (use_gnu_debug_info_extensions
1319 && TYPE_MIN_VALUE (type
) != 0
1320 && TREE_CODE (TYPE_MIN_VALUE (type
)) == INTEGER_CST
1321 && TYPE_MAX_VALUE (type
) != 0
1322 && TREE_CODE (TYPE_MAX_VALUE (type
)) == INTEGER_CST
1323 && (TYPE_PRECISION (type
) > TYPE_PRECISION (integer_type_node
)
1324 || ((TYPE_PRECISION (type
)
1325 == TYPE_PRECISION (integer_type_node
))
1326 && TREE_UNSIGNED (type
))
1327 || TYPE_PRECISION (type
) > HOST_BITS_PER_WIDE_INT
1328 || (TYPE_PRECISION (type
) == HOST_BITS_PER_WIDE_INT
1329 && TREE_UNSIGNED (type
))))
1331 fprintf (asmfile
, "r");
1333 dbxout_type_index (type
);
1334 fprintf (asmfile
, ";");
1336 print_int_cst_octal (TYPE_MIN_VALUE (type
));
1337 fprintf (asmfile
, ";");
1339 print_int_cst_octal (TYPE_MAX_VALUE (type
));
1340 fprintf (asmfile
, ";");
1345 /* Output other integer types as subranges of `int'. */
1346 dbxout_range_type (type
);
1352 /* This used to say `r1' and we used to take care
1353 to make sure that `int' was type number 1. */
1354 fprintf (asmfile
, "r");
1356 dbxout_type_index (integer_type_node
);
1357 putc (';', asmfile
);
1359 print_wide_int (int_size_in_bytes (type
));
1360 fputs (";0;", asmfile
);
1365 if (use_gnu_debug_info_extensions
)
1367 have_used_extensions
= 1;
1368 fputs ("@s", asmfile
);
1370 print_wide_int (BITS_PER_UNIT
* int_size_in_bytes (type
));
1371 fputs (";-20;", asmfile
);
1376 /* Output the type `char' as a subrange of itself.
1377 That is what pcc seems to do. */
1378 fprintf (asmfile
, "r");
1380 dbxout_type_index (char_type_node
);
1381 fprintf (asmfile
, ";0;%d;", TREE_UNSIGNED (type
) ? 255 : 127);
1387 if (use_gnu_debug_info_extensions
)
1389 have_used_extensions
= 1;
1390 fputs ("@s", asmfile
);
1392 print_wide_int (BITS_PER_UNIT
* int_size_in_bytes (type
));
1393 fputs (";-16;", asmfile
);
1396 else /* Define as enumeral type (False, True) */
1398 fprintf (asmfile
, "eFalse:0,True:1,;");
1404 putc ('d', asmfile
);
1406 dbxout_type (TREE_TYPE (type
), 0);
1410 /* Differs from the REAL_TYPE by its new data type number */
1412 if (TREE_CODE (TREE_TYPE (type
)) == REAL_TYPE
)
1414 putc ('R', asmfile
);
1416 dbxout_fptype_value (type
);
1417 putc (';', asmfile
);
1419 print_wide_int (2 * int_size_in_bytes (TREE_TYPE (type
)));
1420 fputs (";0;", asmfile
);
1425 /* Output a complex integer type as a structure,
1426 pending some other way to do it. */
1427 putc ('s', asmfile
);
1429 print_wide_int (int_size_in_bytes (type
));
1430 fprintf (asmfile
, "real:");
1433 dbxout_type (TREE_TYPE (type
), 0);
1434 fprintf (asmfile
, ",0,%d;", TYPE_PRECISION (TREE_TYPE (type
)));
1436 fprintf (asmfile
, "imag:");
1438 dbxout_type (TREE_TYPE (type
), 0);
1439 fprintf (asmfile
, ",%d,%d;;", TYPE_PRECISION (TREE_TYPE (type
)),
1440 TYPE_PRECISION (TREE_TYPE (type
)));
1446 if (use_gnu_debug_info_extensions
)
1448 have_used_extensions
= 1;
1449 fputs ("@s", asmfile
);
1451 print_wide_int (BITS_PER_UNIT
* int_size_in_bytes (type
));
1452 putc (';', asmfile
);
1455 /* Check if a bitstring type, which in Chill is
1456 different from a [power]set. */
1457 if (TYPE_STRING_FLAG (type
))
1459 fprintf (asmfile
, "@S;");
1463 putc ('S', asmfile
);
1465 dbxout_type (TYPE_DOMAIN (type
), 0);
1469 /* Make arrays of packed bits look like bitstrings for chill. */
1470 if (TYPE_PACKED (type
) && use_gnu_debug_info_extensions
)
1472 have_used_extensions
= 1;
1473 fputs ("@s", asmfile
);
1475 print_wide_int (BITS_PER_UNIT
* int_size_in_bytes (type
));
1476 fprintf (asmfile
, ";@S;S");
1478 dbxout_type (TYPE_DOMAIN (type
), 0);
1482 /* Output "a" followed by a range type definition
1483 for the index type of the array
1484 followed by a reference to the target-type.
1485 ar1;0;N;M for a C array of type M and size N+1. */
1486 /* Check if a character string type, which in Chill is
1487 different from an array of characters. */
1488 if (TYPE_STRING_FLAG (type
) && use_gnu_debug_info_extensions
)
1490 have_used_extensions
= 1;
1491 fprintf (asmfile
, "@S;");
1494 tem
= TYPE_DOMAIN (type
);
1497 fprintf (asmfile
, "ar");
1499 dbxout_type_index (integer_type_node
);
1500 fprintf (asmfile
, ";0;-1;");
1505 fprintf (asmfile
, "a");
1507 dbxout_range_type (tem
);
1510 dbxout_type (TREE_TYPE (type
), 0);
1515 case QUAL_UNION_TYPE
:
1517 int i
, n_baseclasses
= 0;
1519 if (TYPE_BINFO (type
) != 0
1520 && TREE_CODE (TYPE_BINFO (type
)) == TREE_VEC
1521 && TYPE_BINFO_BASETYPES (type
) != 0)
1522 n_baseclasses
= TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (type
));
1524 /* Output a structure type. We must use the same test here as we
1525 use in the DBX_NO_XREFS case above. */
1526 if ((TYPE_NAME (type
) != 0
1527 && ! (TREE_CODE (TYPE_NAME (type
)) == TYPE_DECL
1528 && DECL_IGNORED_P (TYPE_NAME (type
)))
1530 || !COMPLETE_TYPE_P (type
)
1531 /* No way in DBX fmt to describe a variable size. */
1532 || ! host_integerp (TYPE_SIZE (type
), 1))
1534 /* If the type is just a cross reference, output one
1535 and mark the type as partially described.
1536 If it later becomes defined, we will output
1537 its real definition.
1538 If the type has a name, don't nest its definition within
1539 another type's definition; instead, output an xref
1540 and let the definition come when the name is defined. */
1541 fputs ((TREE_CODE (type
) == RECORD_TYPE
) ? "xs" : "xu", asmfile
);
1543 #if 0 /* This assertion is legitimately false in C++. */
1544 /* We shouldn't be outputting a reference to a type before its
1545 definition unless the type has a tag name.
1546 A typedef name without a tag name should be impossible. */
1547 if (TREE_CODE (TYPE_NAME (type
)) != IDENTIFIER_NODE
)
1550 if (TYPE_NAME (type
) != 0)
1551 dbxout_type_name (type
);
1554 fprintf (asmfile
, "$$%d", anonymous_type_number
++);
1558 fprintf (asmfile
, ":");
1560 typevec
[TYPE_SYMTAB_ADDRESS (type
)].status
= TYPE_XREF
;
1564 /* Identify record or union, and print its size. */
1565 putc (((TREE_CODE (type
) == RECORD_TYPE
) ? 's' : 'u'), asmfile
);
1567 print_wide_int (int_size_in_bytes (type
));
1569 if (use_gnu_debug_info_extensions
)
1573 have_used_extensions
= 1;
1574 fprintf (asmfile
, "!%d,", n_baseclasses
);
1578 for (i
= 0; i
< n_baseclasses
; i
++)
1580 tree binfo
= TYPE_BINFO (type
);
1581 tree child
= BINFO_BASETYPE (binfo
, i
);
1582 tree access
= (BINFO_BASEACCESSES (binfo
)
1583 ? BINFO_BASEACCESS (binfo
, i
) : access_public_node
);
1585 if (use_gnu_debug_info_extensions
)
1587 have_used_extensions
= 1;
1588 putc (TREE_VIA_VIRTUAL (child
) ? '1' : '0', asmfile
);
1589 putc (access
== access_public_node
? '2' : '0', asmfile
);
1591 if (TREE_VIA_VIRTUAL (child
)
1592 && strcmp (lang_hooks
.name
, "GNU C++") == 0)
1593 /* For a virtual base, print the (negative) offset within
1594 the vtable where we must look to find the necessary
1596 print_wide_int (tree_low_cst (BINFO_VPTR_FIELD (child
), 0)
1599 print_wide_int (tree_low_cst (BINFO_OFFSET (child
), 0)
1601 putc (',', asmfile
);
1603 dbxout_type (BINFO_TYPE (child
), 0);
1604 putc (';', asmfile
);
1609 /* Print out the base class information with fields
1610 which have the same names at the types they hold. */
1611 dbxout_type_name (BINFO_TYPE (child
));
1612 putc (':', asmfile
);
1614 dbxout_type (BINFO_TYPE (child
), full
);
1615 putc (',', asmfile
);
1617 print_wide_int (tree_low_cst (BINFO_OFFSET (child
), 0)
1619 putc (',', asmfile
);
1621 print_wide_int (tree_low_cst (DECL_SIZE
1623 (BINFO_TYPE (child
))),
1626 putc (';', asmfile
);
1632 /* Write out the field declarations. */
1633 dbxout_type_fields (type
);
1634 if (use_gnu_debug_info_extensions
&& TYPE_METHODS (type
) != NULL_TREE
)
1636 have_used_extensions
= 1;
1637 dbxout_type_methods (type
);
1640 putc (';', asmfile
);
1643 if (use_gnu_debug_info_extensions
&& TREE_CODE (type
) == RECORD_TYPE
1644 /* Avoid the ~ if we don't really need it--it confuses dbx. */
1645 && TYPE_VFIELD (type
))
1647 have_used_extensions
= 1;
1649 /* Tell GDB+ that it may keep reading. */
1650 putc ('~', asmfile
);
1653 /* We need to write out info about what field this class
1654 uses as its "main" vtable pointer field, because if this
1655 field is inherited from a base class, GDB cannot necessarily
1656 figure out which field it's using in time. */
1657 if (TYPE_VFIELD (type
))
1659 putc ('%', asmfile
);
1661 dbxout_type (DECL_FCONTEXT (TYPE_VFIELD (type
)), 0);
1664 putc (';', asmfile
);
1670 /* We must use the same test here as we use in the DBX_NO_XREFS case
1671 above. We simplify it a bit since an enum will never have a variable
1673 if ((TYPE_NAME (type
) != 0
1674 && ! (TREE_CODE (TYPE_NAME (type
)) == TYPE_DECL
1675 && DECL_IGNORED_P (TYPE_NAME (type
)))
1677 || !COMPLETE_TYPE_P (type
))
1679 fprintf (asmfile
, "xe");
1681 dbxout_type_name (type
);
1682 typevec
[TYPE_SYMTAB_ADDRESS (type
)].status
= TYPE_XREF
;
1683 putc (':', asmfile
);
1687 #ifdef DBX_OUTPUT_ENUM
1688 DBX_OUTPUT_ENUM (asmfile
, type
);
1690 if (use_gnu_debug_info_extensions
1691 && TYPE_PRECISION (type
) != TYPE_PRECISION (integer_type_node
))
1693 fprintf (asmfile
, "@s%d;", TYPE_PRECISION (type
));
1697 putc ('e', asmfile
);
1699 for (tem
= TYPE_VALUES (type
); tem
; tem
= TREE_CHAIN (tem
))
1701 fprintf (asmfile
, "%s:", IDENTIFIER_POINTER (TREE_PURPOSE (tem
)));
1702 CHARS (IDENTIFIER_LENGTH (TREE_PURPOSE (tem
)) + 1);
1703 if (TREE_INT_CST_HIGH (TREE_VALUE (tem
)) == 0)
1704 print_wide_int (TREE_INT_CST_LOW (TREE_VALUE (tem
)));
1705 else if (TREE_INT_CST_HIGH (TREE_VALUE (tem
)) == -1
1706 && (HOST_WIDE_INT
) TREE_INT_CST_LOW (TREE_VALUE (tem
)) < 0)
1707 print_wide_int (TREE_INT_CST_LOW (TREE_VALUE (tem
)));
1709 print_int_cst_octal (TREE_VALUE (tem
));
1711 putc (',', asmfile
);
1713 if (TREE_CHAIN (tem
) != 0)
1717 putc (';', asmfile
);
1723 putc ('*', asmfile
);
1725 dbxout_type (TREE_TYPE (type
), 0);
1729 if (use_gnu_debug_info_extensions
)
1731 have_used_extensions
= 1;
1732 putc ('#', asmfile
);
1735 /* Write the argument types out longhand. */
1736 dbxout_type (TYPE_METHOD_BASETYPE (type
), 0);
1737 putc (',', asmfile
);
1739 dbxout_type (TREE_TYPE (type
), 0);
1740 dbxout_args (TYPE_ARG_TYPES (type
));
1741 putc (';', asmfile
);
1745 /* Treat it as a function type. */
1746 dbxout_type (TREE_TYPE (type
), 0);
1750 if (use_gnu_debug_info_extensions
)
1752 have_used_extensions
= 1;
1753 putc ('@', asmfile
);
1755 dbxout_type (TYPE_OFFSET_BASETYPE (type
), 0);
1756 putc (',', asmfile
);
1758 dbxout_type (TREE_TYPE (type
), 0);
1761 /* Should print as an int, because it is really just an offset. */
1762 dbxout_type (integer_type_node
, 0);
1765 case REFERENCE_TYPE
:
1766 if (use_gnu_debug_info_extensions
)
1767 have_used_extensions
= 1;
1768 putc (use_gnu_debug_info_extensions
? '&' : '*', asmfile
);
1770 dbxout_type (TREE_TYPE (type
), 0);
1774 putc ('f', asmfile
);
1776 dbxout_type (TREE_TYPE (type
), 0);
1784 /* Print the value of integer constant C, in octal,
1785 handling double precision. */
1788 print_int_cst_octal (c
)
1791 unsigned HOST_WIDE_INT high
= TREE_INT_CST_HIGH (c
);
1792 unsigned HOST_WIDE_INT low
= TREE_INT_CST_LOW (c
);
1793 int excess
= (3 - (HOST_BITS_PER_WIDE_INT
% 3));
1794 unsigned int width
= TYPE_PRECISION (TREE_TYPE (c
));
1796 /* GDB wants constants with no extra leading "1" bits, so
1797 we need to remove any sign-extension that might be
1799 if (width
== HOST_BITS_PER_WIDE_INT
* 2)
1801 else if (width
> HOST_BITS_PER_WIDE_INT
)
1802 high
&= (((HOST_WIDE_INT
) 1 << (width
- HOST_BITS_PER_WIDE_INT
)) - 1);
1803 else if (width
== HOST_BITS_PER_WIDE_INT
)
1806 high
= 0, low
&= (((HOST_WIDE_INT
) 1 << width
) - 1);
1808 fprintf (asmfile
, "0");
1813 print_octal (high
, HOST_BITS_PER_WIDE_INT
/ 3);
1814 print_octal (low
, HOST_BITS_PER_WIDE_INT
/ 3);
1818 unsigned HOST_WIDE_INT beg
= high
>> excess
;
1819 unsigned HOST_WIDE_INT middle
1820 = ((high
& (((HOST_WIDE_INT
) 1 << excess
) - 1)) << (3 - excess
)
1821 | (low
>> (HOST_BITS_PER_WIDE_INT
/ 3 * 3)));
1822 unsigned HOST_WIDE_INT end
1823 = low
& (((unsigned HOST_WIDE_INT
) 1
1824 << (HOST_BITS_PER_WIDE_INT
/ 3 * 3))
1827 fprintf (asmfile
, "%o%01o", (int) beg
, (int) middle
);
1829 print_octal (end
, HOST_BITS_PER_WIDE_INT
/ 3);
1834 print_octal (value
, digits
)
1835 unsigned HOST_WIDE_INT value
;
1840 for (i
= digits
- 1; i
>= 0; i
--)
1841 fprintf (asmfile
, "%01o", (int) ((value
>> (3 * i
)) & 7));
1846 /* Output C in decimal while adjusting the number of digits written. */
1854 fprintf (asmfile
, HOST_WIDE_INT_PRINT_DEC
, c
);
1865 /* Output the name of type TYPE, with no punctuation.
1866 Such names can be set up either by typedef declarations
1867 or by struct, enum and union tags. */
1870 dbxout_type_name (type
)
1874 if (TYPE_NAME (type
) == 0)
1876 if (TREE_CODE (TYPE_NAME (type
)) == IDENTIFIER_NODE
)
1878 t
= TYPE_NAME (type
);
1880 else if (TREE_CODE (TYPE_NAME (type
)) == TYPE_DECL
)
1882 t
= DECL_NAME (TYPE_NAME (type
));
1887 fprintf (asmfile
, "%s", IDENTIFIER_POINTER (t
));
1888 CHARS (IDENTIFIER_LENGTH (t
));
1891 /* Output leading leading struct or class names needed for qualifying
1892 type whose scope is limited to a struct or class. */
1895 dbxout_class_name_qualifiers (decl
)
1898 tree context
= decl_type_context (decl
);
1900 if (context
!= NULL_TREE
1901 && TREE_CODE(context
) == RECORD_TYPE
1902 && TYPE_NAME (context
) != 0
1903 && (TREE_CODE (TYPE_NAME (context
)) == IDENTIFIER_NODE
1904 || (DECL_NAME (TYPE_NAME (context
)) != 0)))
1906 tree name
= TYPE_NAME (context
);
1908 if (TREE_CODE (name
) == TYPE_DECL
)
1910 dbxout_class_name_qualifiers (name
);
1911 name
= DECL_NAME (name
);
1913 fprintf (asmfile
, "%s::", IDENTIFIER_POINTER (name
));
1914 CHARS (IDENTIFIER_LENGTH (name
) + 2);
1918 /* Output a .stabs for the symbol defined by DECL,
1919 which must be a ..._DECL node in the normal namespace.
1920 It may be a CONST_DECL, a FUNCTION_DECL, a PARM_DECL or a VAR_DECL.
1921 LOCAL is nonzero if the scope is less than the entire file.
1922 Return 1 if a stabs might have been emitted. */
1925 dbxout_symbol (decl
, local
)
1927 int local ATTRIBUTE_UNUSED
;
1929 tree type
= TREE_TYPE (decl
);
1930 tree context
= NULL_TREE
;
1933 /* Cast avoids warning in old compilers. */
1934 current_sym_code
= (STAB_CODE_TYPE
) 0;
1935 current_sym_value
= 0;
1936 current_sym_addr
= 0;
1938 /* Ignore nameless syms, but don't ignore type tags. */
1940 if ((DECL_NAME (decl
) == 0 && TREE_CODE (decl
) != TYPE_DECL
)
1941 || DECL_IGNORED_P (decl
))
1944 dbxout_prepare_symbol (decl
);
1946 /* The output will always start with the symbol name,
1947 so always count that in the length-output-so-far. */
1949 if (DECL_NAME (decl
) != 0)
1950 current_sym_nchars
= 2 + IDENTIFIER_LENGTH (DECL_NAME (decl
));
1952 switch (TREE_CODE (decl
))
1955 /* Enum values are defined by defining the enum type. */
1959 if (DECL_RTL (decl
) == 0)
1961 if (DECL_EXTERNAL (decl
))
1963 /* Don't mention a nested function under its parent. */
1964 context
= decl_function_context (decl
);
1965 if (context
== current_function_decl
)
1967 if (GET_CODE (DECL_RTL (decl
)) != MEM
1968 || GET_CODE (XEXP (DECL_RTL (decl
), 0)) != SYMBOL_REF
)
1972 fprintf (asmfile
, "%s\"%s:%c", ASM_STABS_OP
,
1973 IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
)),
1974 TREE_PUBLIC (decl
) ? 'F' : 'f');
1977 current_sym_code
= N_FUN
;
1978 current_sym_addr
= XEXP (DECL_RTL (decl
), 0);
1980 if (TREE_TYPE (type
))
1981 dbxout_type (TREE_TYPE (type
), 0);
1983 dbxout_type (void_type_node
, 0);
1985 /* For a nested function, when that function is compiled,
1986 mention the containing function name
1987 as well as (since dbx wants it) our own assembler-name. */
1989 fprintf (asmfile
, ",%s,%s",
1990 IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
)),
1991 IDENTIFIER_POINTER (DECL_NAME (context
)));
1993 dbxout_finish_symbol (decl
);
1998 /* This seems all wrong. Outputting most kinds of types gives no name
1999 at all. A true definition gives no name; a cross-ref for a
2000 structure can give the tag name, but not a type name.
2001 It seems that no typedef name is defined by outputting a type. */
2003 /* If this typedef name was defined by outputting the type,
2004 don't duplicate it. */
2005 if (typevec
[TYPE_SYMTAB_ADDRESS (type
)].status
== TYPE_DEFINED
2006 && TYPE_NAME (TREE_TYPE (decl
)) == decl
)
2009 /* Don't output the same typedef twice.
2010 And don't output what language-specific stuff doesn't want output. */
2011 if (TREE_ASM_WRITTEN (decl
) || TYPE_DECL_SUPPRESS_DEBUG (decl
))
2020 if (DECL_NAME (decl
))
2022 /* Nonzero means we must output a tag as well as a typedef. */
2025 /* Handle the case of a C++ structure or union
2026 where the TYPE_NAME is a TYPE_DECL
2027 which gives both a typedef name and a tag. */
2028 /* dbx requires the tag first and the typedef second. */
2029 if ((TREE_CODE (type
) == RECORD_TYPE
2030 || TREE_CODE (type
) == UNION_TYPE
2031 || TREE_CODE (type
) == QUAL_UNION_TYPE
)
2032 && TYPE_NAME (type
) == decl
2033 && !(use_gnu_debug_info_extensions
&& have_used_extensions
)
2034 && !TREE_ASM_WRITTEN (TYPE_NAME (type
))
2035 /* Distinguish the implicit typedefs of C++
2036 from explicit ones that might be found in C. */
2037 && DECL_ARTIFICIAL (decl
)
2038 /* Do not generate a tag for records of variable size,
2039 since this type can not be properly described in the
2040 DBX format, and it confuses some tools such as objdump. */
2041 && host_integerp (TYPE_SIZE (type
), 1))
2043 tree name
= TYPE_NAME (type
);
2044 if (TREE_CODE (name
) == TYPE_DECL
)
2045 name
= DECL_NAME (name
);
2047 current_sym_code
= DBX_TYPE_DECL_STABS_CODE
;
2048 current_sym_value
= 0;
2049 current_sym_addr
= 0;
2050 current_sym_nchars
= 2 + IDENTIFIER_LENGTH (name
);
2052 fprintf (asmfile
, "%s\"%s:T", ASM_STABS_OP
,
2053 IDENTIFIER_POINTER (name
));
2054 dbxout_type (type
, 1);
2055 dbxout_finish_symbol (NULL_TREE
);
2058 /* Output .stabs (or whatever) and leading double quote. */
2059 fprintf (asmfile
, "%s\"", ASM_STABS_OP
);
2061 if (use_gnu_debug_info_extensions
)
2063 /* Output leading class/struct qualifiers. */
2064 dbxout_class_name_qualifiers (decl
);
2067 /* Output typedef name. */
2068 fprintf (asmfile
, "%s:", IDENTIFIER_POINTER (DECL_NAME (decl
)));
2070 /* Short cut way to output a tag also. */
2071 if ((TREE_CODE (type
) == RECORD_TYPE
2072 || TREE_CODE (type
) == UNION_TYPE
2073 || TREE_CODE (type
) == QUAL_UNION_TYPE
)
2074 && TYPE_NAME (type
) == decl
2075 /* Distinguish the implicit typedefs of C++
2076 from explicit ones that might be found in C. */
2077 && DECL_ARTIFICIAL (decl
))
2079 if (use_gnu_debug_info_extensions
&& have_used_extensions
)
2081 putc ('T', asmfile
);
2082 TREE_ASM_WRITTEN (TYPE_NAME (type
)) = 1;
2084 #if 0 /* Now we generate the tag for this case up above. */
2090 putc ('t', asmfile
);
2091 current_sym_code
= DBX_TYPE_DECL_STABS_CODE
;
2093 dbxout_type (type
, 1);
2094 dbxout_finish_symbol (decl
);
2098 /* Don't output a tag if this is an incomplete type. This prevents
2099 the sun4 Sun OS 4.x dbx from crashing. */
2101 if (tag_needed
&& TYPE_NAME (type
) != 0
2102 && (TREE_CODE (TYPE_NAME (type
)) == IDENTIFIER_NODE
2103 || (DECL_NAME (TYPE_NAME (type
)) != 0))
2104 && COMPLETE_TYPE_P (type
)
2105 && !TREE_ASM_WRITTEN (TYPE_NAME (type
)))
2107 /* For a TYPE_DECL with no name, but the type has a name,
2109 This is what represents `struct foo' with no typedef. */
2110 /* In C++, the name of a type is the corresponding typedef.
2111 In C, it is an IDENTIFIER_NODE. */
2112 tree name
= TYPE_NAME (type
);
2113 if (TREE_CODE (name
) == TYPE_DECL
)
2114 name
= DECL_NAME (name
);
2116 current_sym_code
= DBX_TYPE_DECL_STABS_CODE
;
2117 current_sym_value
= 0;
2118 current_sym_addr
= 0;
2119 current_sym_nchars
= 2 + IDENTIFIER_LENGTH (name
);
2121 fprintf (asmfile
, "%s\"%s:T", ASM_STABS_OP
,
2122 IDENTIFIER_POINTER (name
));
2123 dbxout_type (type
, 1);
2124 dbxout_finish_symbol (NULL_TREE
);
2128 /* If an enum type has no name, it cannot be referred to,
2129 but we must output it anyway, since the enumeration constants
2130 can be referred to. */
2131 if (!did_output
&& TREE_CODE (type
) == ENUMERAL_TYPE
)
2133 current_sym_code
= DBX_TYPE_DECL_STABS_CODE
;
2134 current_sym_value
= 0;
2135 current_sym_addr
= 0;
2136 current_sym_nchars
= 2;
2138 /* Some debuggers fail when given NULL names, so give this a
2139 harmless name of ` '. */
2140 fprintf (asmfile
, "%s\" :T", ASM_STABS_OP
);
2141 dbxout_type (type
, 1);
2142 dbxout_finish_symbol (NULL_TREE
);
2145 /* Prevent duplicate output of a typedef. */
2146 TREE_ASM_WRITTEN (decl
) = 1;
2151 /* Parm decls go in their own separate chains
2152 and are output by dbxout_reg_parms and dbxout_parms. */
2156 /* Named return value, treat like a VAR_DECL. */
2158 if (! DECL_RTL_SET_P (decl
))
2160 /* Don't mention a variable that is external.
2161 Let the file that defines it describe it. */
2162 if (DECL_EXTERNAL (decl
))
2165 /* If the variable is really a constant
2166 and not written in memory, inform the debugger. */
2167 if (TREE_STATIC (decl
) && TREE_READONLY (decl
)
2168 && DECL_INITIAL (decl
) != 0
2169 && host_integerp (DECL_INITIAL (decl
), 0)
2170 && ! TREE_ASM_WRITTEN (decl
)
2171 && (DECL_CONTEXT (decl
) == NULL_TREE
2172 || TREE_CODE (DECL_CONTEXT (decl
)) == BLOCK
))
2174 if (TREE_PUBLIC (decl
) == 0)
2176 /* The sun4 assembler does not grok this. */
2177 const char *name
= IDENTIFIER_POINTER (DECL_NAME (decl
));
2179 if (TREE_CODE (TREE_TYPE (decl
)) == INTEGER_TYPE
2180 || TREE_CODE (TREE_TYPE (decl
)) == ENUMERAL_TYPE
)
2182 HOST_WIDE_INT ival
= tree_low_cst (DECL_INITIAL (decl
), 0);
2183 #ifdef DBX_OUTPUT_CONSTANT_SYMBOL
2184 DBX_OUTPUT_CONSTANT_SYMBOL (asmfile
, name
, ival
);
2186 fprintf (asmfile
, "%s\"%s:c=i", ASM_STABS_OP
, name
);
2188 fprintf (asmfile
, HOST_WIDE_INT_PRINT_DEC
, ival
);
2189 fprintf (asmfile
, "\",0x%x,0,0,0\n", N_LSYM
);
2193 else if (TREE_CODE (TREE_TYPE (decl
)) == REAL_TYPE
)
2195 /* don't know how to do this yet. */
2199 /* else it is something we handle like a normal variable. */
2202 SET_DECL_RTL (decl
, eliminate_regs (DECL_RTL (decl
), 0, NULL_RTX
));
2203 #ifdef LEAF_REG_REMAP
2204 if (current_function_uses_only_leaf_regs
)
2205 leaf_renumber_regs_insn (DECL_RTL (decl
));
2208 result
= dbxout_symbol_location (decl
, type
, 0, DECL_RTL (decl
));
2217 /* Output the stab for DECL, a VAR_DECL, RESULT_DECL or PARM_DECL.
2218 Add SUFFIX to its name, if SUFFIX is not 0.
2219 Describe the variable as residing in HOME
2220 (usually HOME is DECL_RTL (DECL), but not always).
2221 Returns 1 if the stab was really emitted. */
2224 dbxout_symbol_location (decl
, type
, suffix
, home
)
2232 /* Don't mention a variable at all
2233 if it was completely optimized into nothingness.
2235 If the decl was from an inline function, then its rtl
2236 is not identically the rtl that was used in this
2237 particular compilation. */
2238 if (GET_CODE (home
) == SUBREG
)
2242 while (GET_CODE (value
) == SUBREG
)
2243 value
= SUBREG_REG (value
);
2244 if (GET_CODE (value
) == REG
)
2246 if (REGNO (value
) >= FIRST_PSEUDO_REGISTER
)
2249 home
= alter_subreg (&home
);
2251 if (GET_CODE (home
) == REG
)
2253 regno
= REGNO (home
);
2254 if (regno
>= FIRST_PSEUDO_REGISTER
)
2258 /* The kind-of-variable letter depends on where
2259 the variable is and on the scope of its name:
2260 G and N_GSYM for static storage and global scope,
2261 S for static storage and file scope,
2262 V for static storage and local scope,
2263 for those two, use N_LCSYM if data is in bss segment,
2264 N_STSYM if in data segment, N_FUN otherwise.
2265 (We used N_FUN originally, then changed to N_STSYM
2266 to please GDB. However, it seems that confused ld.
2267 Now GDB has been fixed to like N_FUN, says Kingdon.)
2268 no letter at all, and N_LSYM, for auto variable,
2269 r and N_RSYM for register variable. */
2271 if (GET_CODE (home
) == MEM
2272 && GET_CODE (XEXP (home
, 0)) == SYMBOL_REF
)
2274 if (TREE_PUBLIC (decl
))
2277 current_sym_code
= N_GSYM
;
2281 current_sym_addr
= XEXP (home
, 0);
2283 letter
= decl_function_context (decl
) ? 'V' : 'S';
2285 /* This should be the same condition as in assemble_variable, but
2286 we don't have access to dont_output_data here. So, instead,
2287 we rely on the fact that error_mark_node initializers always
2288 end up in bss for C++ and never end up in bss for C. */
2289 if (DECL_INITIAL (decl
) == 0
2290 || (!strcmp (lang_hooks
.name
, "GNU C++")
2291 && DECL_INITIAL (decl
) == error_mark_node
))
2292 current_sym_code
= N_LCSYM
;
2293 else if (DECL_IN_TEXT_SECTION (decl
))
2294 /* This is not quite right, but it's the closest
2295 of all the codes that Unix defines. */
2296 current_sym_code
= DBX_STATIC_CONST_VAR_CODE
;
2299 /* Some ports can transform a symbol ref into a label ref,
2300 because the symbol ref is too far away and has to be
2301 dumped into a constant pool. Alternatively, the symbol
2302 in the constant pool might be referenced by a different
2304 if (GET_CODE (current_sym_addr
) == SYMBOL_REF
2305 && CONSTANT_POOL_ADDRESS_P (current_sym_addr
))
2307 rtx tmp
= get_pool_constant (current_sym_addr
);
2309 if (GET_CODE (tmp
) == SYMBOL_REF
2310 || GET_CODE (tmp
) == LABEL_REF
)
2311 current_sym_addr
= tmp
;
2314 /* Ultrix `as' seems to need this. */
2315 #ifdef DBX_STATIC_STAB_DATA_SECTION
2318 current_sym_code
= N_STSYM
;
2322 else if (regno
>= 0)
2325 current_sym_code
= N_RSYM
;
2326 current_sym_value
= DBX_REGISTER_NUMBER (regno
);
2328 else if (GET_CODE (home
) == MEM
2329 && (GET_CODE (XEXP (home
, 0)) == MEM
2330 || (GET_CODE (XEXP (home
, 0)) == REG
2331 && REGNO (XEXP (home
, 0)) != HARD_FRAME_POINTER_REGNUM
2332 && REGNO (XEXP (home
, 0)) != STACK_POINTER_REGNUM
2333 #if ARG_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
2334 && REGNO (XEXP (home
, 0)) != ARG_POINTER_REGNUM
2337 /* If the value is indirect by memory or by a register
2338 that isn't the frame pointer
2339 then it means the object is variable-sized and address through
2340 that register or stack slot. DBX has no way to represent this
2341 so all we can do is output the variable as a pointer.
2342 If it's not a parameter, ignore it.
2343 (VAR_DECLs like this can be made by integrate.c.) */
2345 if (GET_CODE (XEXP (home
, 0)) == REG
)
2348 current_sym_code
= N_RSYM
;
2349 if (REGNO (XEXP (home
, 0)) >= FIRST_PSEUDO_REGISTER
)
2351 current_sym_value
= DBX_REGISTER_NUMBER (REGNO (XEXP (home
, 0)));
2355 current_sym_code
= N_LSYM
;
2356 /* RTL looks like (MEM (MEM (PLUS (REG...) (CONST_INT...)))).
2357 We want the value of that CONST_INT. */
2359 = DEBUGGER_AUTO_OFFSET (XEXP (XEXP (home
, 0), 0));
2362 /* Effectively do build_pointer_type, but don't cache this type,
2363 since it might be temporary whereas the type it points to
2364 might have been saved for inlining. */
2365 /* Don't use REFERENCE_TYPE because dbx can't handle that. */
2366 type
= make_node (POINTER_TYPE
);
2367 TREE_TYPE (type
) = TREE_TYPE (decl
);
2369 else if (GET_CODE (home
) == MEM
2370 && GET_CODE (XEXP (home
, 0)) == REG
)
2372 current_sym_code
= N_LSYM
;
2373 current_sym_value
= DEBUGGER_AUTO_OFFSET (XEXP (home
, 0));
2375 else if (GET_CODE (home
) == MEM
2376 && GET_CODE (XEXP (home
, 0)) == PLUS
2377 && GET_CODE (XEXP (XEXP (home
, 0), 1)) == CONST_INT
)
2379 current_sym_code
= N_LSYM
;
2380 /* RTL looks like (MEM (PLUS (REG...) (CONST_INT...)))
2381 We want the value of that CONST_INT. */
2382 current_sym_value
= DEBUGGER_AUTO_OFFSET (XEXP (home
, 0));
2384 else if (GET_CODE (home
) == MEM
2385 && GET_CODE (XEXP (home
, 0)) == CONST
)
2387 /* Handle an obscure case which can arise when optimizing and
2388 when there are few available registers. (This is *always*
2389 the case for i386/i486 targets). The RTL looks like
2390 (MEM (CONST ...)) even though this variable is a local `auto'
2391 or a local `register' variable. In effect, what has happened
2392 is that the reload pass has seen that all assignments and
2393 references for one such a local variable can be replaced by
2394 equivalent assignments and references to some static storage
2395 variable, thereby avoiding the need for a register. In such
2396 cases we're forced to lie to debuggers and tell them that
2397 this variable was itself `static'. */
2398 current_sym_code
= N_LCSYM
;
2400 current_sym_addr
= XEXP (XEXP (home
, 0), 0);
2402 else if (GET_CODE (home
) == CONCAT
)
2406 /* If TYPE is not a COMPLEX_TYPE (it might be a RECORD_TYPE,
2407 for example), then there is no easy way to figure out
2408 what SUBTYPE should be. So, we give up. */
2409 if (TREE_CODE (type
) != COMPLEX_TYPE
)
2412 subtype
= TREE_TYPE (type
);
2414 /* If the variable's storage is in two parts,
2415 output each as a separate stab with a modified name. */
2416 if (WORDS_BIG_ENDIAN
)
2417 dbxout_symbol_location (decl
, subtype
, "$imag", XEXP (home
, 0));
2419 dbxout_symbol_location (decl
, subtype
, "$real", XEXP (home
, 0));
2421 /* Cast avoids warning in old compilers. */
2422 current_sym_code
= (STAB_CODE_TYPE
) 0;
2423 current_sym_value
= 0;
2424 current_sym_addr
= 0;
2425 dbxout_prepare_symbol (decl
);
2427 if (WORDS_BIG_ENDIAN
)
2428 dbxout_symbol_location (decl
, subtype
, "$real", XEXP (home
, 1));
2430 dbxout_symbol_location (decl
, subtype
, "$imag", XEXP (home
, 1));
2434 /* Address might be a MEM, when DECL is a variable-sized object.
2435 Or it might be const0_rtx, meaning previous passes
2436 want us to ignore this variable. */
2439 /* Ok, start a symtab entry and output the variable name. */
2442 #ifdef DBX_STATIC_BLOCK_START
2443 DBX_STATIC_BLOCK_START (asmfile
, current_sym_code
);
2446 dbxout_symbol_name (decl
, suffix
, letter
);
2447 dbxout_type (type
, 0);
2448 dbxout_finish_symbol (decl
);
2450 #ifdef DBX_STATIC_BLOCK_END
2451 DBX_STATIC_BLOCK_END (asmfile
, current_sym_code
);
2456 /* Output the symbol name of DECL for a stabs, with suffix SUFFIX.
2457 Then output LETTER to indicate the kind of location the symbol has. */
2460 dbxout_symbol_name (decl
, suffix
, letter
)
2467 if (DECL_CONTEXT (decl
) && TYPE_P (DECL_CONTEXT (decl
)))
2468 /* One slight hitch: if this is a VAR_DECL which is a static
2469 class member, we must put out the mangled name instead of the
2470 DECL_NAME. Note also that static member (variable) names DO NOT begin
2471 with underscores in .stabs directives. */
2472 name
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
));
2474 /* ...but if we're function-local, we don't want to include the junk
2475 added by ASM_FORMAT_PRIVATE_NAME. */
2476 name
= IDENTIFIER_POINTER (DECL_NAME (decl
));
2480 fprintf (asmfile
, "%s\"%s%s:", ASM_STABS_OP
, name
,
2481 (suffix
? suffix
: ""));
2484 putc (letter
, asmfile
);
2488 dbxout_prepare_symbol (decl
)
2489 tree decl ATTRIBUTE_UNUSED
;
2492 const char *filename
= DECL_SOURCE_FILE (decl
);
2494 dbxout_source_file (asmfile
, filename
);
2499 dbxout_finish_symbol (sym
)
2502 #ifdef DBX_FINISH_SYMBOL
2503 DBX_FINISH_SYMBOL (sym
);
2506 if (use_gnu_debug_info_extensions
&& sym
!= 0)
2507 line
= DECL_SOURCE_LINE (sym
);
2509 fprintf (asmfile
, "\",%d,0,%d,", current_sym_code
, line
);
2510 if (current_sym_addr
)
2511 output_addr_const (asmfile
, current_sym_addr
);
2513 fprintf (asmfile
, "%d", current_sym_value
);
2514 putc ('\n', asmfile
);
2518 /* Output definitions of all the decls in a chain. Return nonzero if
2519 anything was output */
2528 result
+= dbxout_symbol (syms
, 1);
2529 syms
= TREE_CHAIN (syms
);
2534 /* The following two functions output definitions of function parameters.
2535 Each parameter gets a definition locating it in the parameter list.
2536 Each parameter that is a register variable gets a second definition
2537 locating it in the register.
2539 Printing or argument lists in gdb uses the definitions that
2540 locate in the parameter list. But reference to the variable in
2541 expressions uses preferentially the definition as a register. */
2543 /* Output definitions, referring to storage in the parmlist,
2544 of all the parms in PARMS, which is a chain of PARM_DECL nodes. */
2547 dbxout_parms (parms
)
2550 for (; parms
; parms
= TREE_CHAIN (parms
))
2551 if (DECL_NAME (parms
) && TREE_TYPE (parms
) != error_mark_node
)
2553 dbxout_prepare_symbol (parms
);
2555 /* Perform any necessary register eliminations on the parameter's rtl,
2556 so that the debugging output will be accurate. */
2557 DECL_INCOMING_RTL (parms
)
2558 = eliminate_regs (DECL_INCOMING_RTL (parms
), 0, NULL_RTX
);
2559 SET_DECL_RTL (parms
, eliminate_regs (DECL_RTL (parms
), 0, NULL_RTX
));
2560 #ifdef LEAF_REG_REMAP
2561 if (current_function_uses_only_leaf_regs
)
2563 leaf_renumber_regs_insn (DECL_INCOMING_RTL (parms
));
2564 leaf_renumber_regs_insn (DECL_RTL (parms
));
2568 if (PARM_PASSED_IN_MEMORY (parms
))
2570 rtx addr
= XEXP (DECL_INCOMING_RTL (parms
), 0);
2572 /* ??? Here we assume that the parm address is indexed
2573 off the frame pointer or arg pointer.
2574 If that is not true, we produce meaningless results,
2575 but do not crash. */
2576 if (GET_CODE (addr
) == PLUS
2577 && GET_CODE (XEXP (addr
, 1)) == CONST_INT
)
2578 current_sym_value
= INTVAL (XEXP (addr
, 1));
2580 current_sym_value
= 0;
2582 current_sym_code
= N_PSYM
;
2583 current_sym_addr
= 0;
2586 if (DECL_NAME (parms
))
2588 current_sym_nchars
= 2 + IDENTIFIER_LENGTH (DECL_NAME (parms
));
2590 fprintf (asmfile
, "%s\"%s:%c", ASM_STABS_OP
,
2591 IDENTIFIER_POINTER (DECL_NAME (parms
)),
2592 DBX_MEMPARM_STABS_LETTER
);
2596 current_sym_nchars
= 8;
2597 fprintf (asmfile
, "%s\"(anon):%c", ASM_STABS_OP
,
2598 DBX_MEMPARM_STABS_LETTER
);
2601 /* It is quite tempting to use:
2603 dbxout_type (TREE_TYPE (parms), 0);
2605 as the next statement, rather than using DECL_ARG_TYPE(), so
2606 that gcc reports the actual type of the parameter, rather
2607 than the promoted type. This certainly makes GDB's life
2608 easier, at least for some ports. The change is a bad idea
2609 however, since GDB expects to be able access the type without
2610 performing any conversions. So for example, if we were
2611 passing a float to an unprototyped function, gcc will store a
2612 double on the stack, but if we emit a stab saying the type is a
2613 float, then gdb will only read in a single value, and this will
2614 produce an erroneous value. */
2615 dbxout_type (DECL_ARG_TYPE (parms
), 0);
2616 current_sym_value
= DEBUGGER_ARG_OFFSET (current_sym_value
, addr
);
2617 dbxout_finish_symbol (parms
);
2619 else if (GET_CODE (DECL_RTL (parms
)) == REG
)
2622 char regparm_letter
;
2624 /* Parm passed in registers and lives in registers or nowhere. */
2626 current_sym_code
= DBX_REGPARM_STABS_CODE
;
2627 regparm_letter
= DBX_REGPARM_STABS_LETTER
;
2628 current_sym_addr
= 0;
2630 /* If parm lives in a register, use that register;
2631 pretend the parm was passed there. It would be more consistent
2632 to describe the register where the parm was passed,
2633 but in practice that register usually holds something else.
2635 If we use DECL_RTL, then we must use the declared type of
2636 the variable, not the type that it arrived in. */
2637 if (REGNO (DECL_RTL (parms
)) < FIRST_PSEUDO_REGISTER
)
2639 best_rtl
= DECL_RTL (parms
);
2640 parm_type
= TREE_TYPE (parms
);
2642 /* If the parm lives nowhere, use the register where it was
2643 passed. It is also better to use the declared type here. */
2646 best_rtl
= DECL_INCOMING_RTL (parms
);
2647 parm_type
= TREE_TYPE (parms
);
2649 current_sym_value
= DBX_REGISTER_NUMBER (REGNO (best_rtl
));
2652 if (DECL_NAME (parms
))
2654 current_sym_nchars
= 2 + IDENTIFIER_LENGTH (DECL_NAME (parms
));
2655 fprintf (asmfile
, "%s\"%s:%c", ASM_STABS_OP
,
2656 IDENTIFIER_POINTER (DECL_NAME (parms
)),
2661 current_sym_nchars
= 8;
2662 fprintf (asmfile
, "%s\"(anon):%c", ASM_STABS_OP
,
2666 dbxout_type (parm_type
, 0);
2667 dbxout_finish_symbol (parms
);
2669 else if (GET_CODE (DECL_RTL (parms
)) == MEM
2670 && GET_CODE (XEXP (DECL_RTL (parms
), 0)) == REG
2671 && REGNO (XEXP (DECL_RTL (parms
), 0)) != HARD_FRAME_POINTER_REGNUM
2672 && REGNO (XEXP (DECL_RTL (parms
), 0)) != STACK_POINTER_REGNUM
2673 #if ARG_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
2674 && REGNO (XEXP (DECL_RTL (parms
), 0)) != ARG_POINTER_REGNUM
2678 /* Parm was passed via invisible reference.
2679 That is, its address was passed in a register.
2680 Output it as if it lived in that register.
2681 The debugger will know from the type
2682 that it was actually passed by invisible reference. */
2684 char regparm_letter
;
2685 /* Parm passed in registers and lives in registers or nowhere. */
2687 current_sym_code
= DBX_REGPARM_STABS_CODE
;
2688 if (use_gnu_debug_info_extensions
)
2689 regparm_letter
= GDB_INV_REF_REGPARM_STABS_LETTER
;
2691 regparm_letter
= DBX_REGPARM_STABS_LETTER
;
2693 /* DECL_RTL looks like (MEM (REG...). Get the register number.
2694 If it is an unallocated pseudo-reg, then use the register where
2695 it was passed instead. */
2696 if (REGNO (XEXP (DECL_RTL (parms
), 0)) < FIRST_PSEUDO_REGISTER
)
2697 current_sym_value
= REGNO (XEXP (DECL_RTL (parms
), 0));
2699 current_sym_value
= REGNO (DECL_INCOMING_RTL (parms
));
2701 current_sym_addr
= 0;
2704 if (DECL_NAME (parms
))
2707 = 2 + strlen (IDENTIFIER_POINTER (DECL_NAME (parms
)));
2709 fprintf (asmfile
, "%s\"%s:%c", ASM_STABS_OP
,
2710 IDENTIFIER_POINTER (DECL_NAME (parms
)),
2715 current_sym_nchars
= 8;
2716 fprintf (asmfile
, "%s\"(anon):%c", ASM_STABS_OP
,
2720 dbxout_type (TREE_TYPE (parms
), 0);
2721 dbxout_finish_symbol (parms
);
2723 else if (GET_CODE (DECL_RTL (parms
)) == MEM
2724 && GET_CODE (XEXP (DECL_RTL (parms
), 0)) == MEM
)
2726 /* Parm was passed via invisible reference, with the reference
2727 living on the stack. DECL_RTL looks like
2728 (MEM (MEM (PLUS (REG ...) (CONST_INT ...)))) or it
2729 could look like (MEM (MEM (REG))). */
2730 const char *const decl_name
= (DECL_NAME (parms
)
2731 ? IDENTIFIER_POINTER (DECL_NAME (parms
))
2733 if (GET_CODE (XEXP (XEXP (DECL_RTL (parms
), 0), 0)) == REG
)
2734 current_sym_value
= 0;
2737 = INTVAL (XEXP (XEXP (XEXP (DECL_RTL (parms
), 0), 0), 1));
2738 current_sym_addr
= 0;
2739 current_sym_code
= N_PSYM
;
2742 fprintf (asmfile
, "%s\"%s:v", ASM_STABS_OP
, decl_name
);
2745 = DEBUGGER_ARG_OFFSET (current_sym_value
,
2746 XEXP (XEXP (DECL_RTL (parms
), 0), 0));
2747 dbxout_type (TREE_TYPE (parms
), 0);
2748 dbxout_finish_symbol (parms
);
2750 else if (GET_CODE (DECL_RTL (parms
)) == MEM
2751 && XEXP (DECL_RTL (parms
), 0) != const0_rtx
2752 /* ??? A constant address for a parm can happen
2753 when the reg it lives in is equiv to a constant in memory.
2754 Should make this not happen, after 2.4. */
2755 && ! CONSTANT_P (XEXP (DECL_RTL (parms
), 0)))
2757 /* Parm was passed in registers but lives on the stack. */
2759 current_sym_code
= N_PSYM
;
2760 /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))),
2761 in which case we want the value of that CONST_INT,
2763 in which case we use a value of zero. */
2764 if (GET_CODE (XEXP (DECL_RTL (parms
), 0)) == REG
)
2765 current_sym_value
= 0;
2768 = INTVAL (XEXP (XEXP (DECL_RTL (parms
), 0), 1));
2770 current_sym_addr
= 0;
2772 /* Make a big endian correction if the mode of the type of the
2773 parameter is not the same as the mode of the rtl. */
2774 if (BYTES_BIG_ENDIAN
2775 && TYPE_MODE (TREE_TYPE (parms
)) != GET_MODE (DECL_RTL (parms
))
2776 && GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (parms
))) < UNITS_PER_WORD
)
2778 current_sym_value
+=
2779 GET_MODE_SIZE (GET_MODE (DECL_RTL (parms
)))
2780 - GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (parms
)));
2784 if (DECL_NAME (parms
))
2787 = 2 + strlen (IDENTIFIER_POINTER (DECL_NAME (parms
)));
2789 fprintf (asmfile
, "%s\"%s:%c", ASM_STABS_OP
,
2790 IDENTIFIER_POINTER (DECL_NAME (parms
)),
2791 DBX_MEMPARM_STABS_LETTER
);
2795 current_sym_nchars
= 8;
2796 fprintf (asmfile
, "%s\"(anon):%c", ASM_STABS_OP
,
2797 DBX_MEMPARM_STABS_LETTER
);
2801 = DEBUGGER_ARG_OFFSET (current_sym_value
,
2802 XEXP (DECL_RTL (parms
), 0));
2803 dbxout_type (TREE_TYPE (parms
), 0);
2804 dbxout_finish_symbol (parms
);
2809 /* Output definitions for the places where parms live during the function,
2810 when different from where they were passed, when the parms were passed
2813 It is not useful to do this for parms passed in registers
2814 that live during the function in different registers, because it is
2815 impossible to look in the passed register for the passed value,
2816 so we use the within-the-function register to begin with.
2818 PARMS is a chain of PARM_DECL nodes. */
2821 dbxout_reg_parms (parms
)
2824 for (; parms
; parms
= TREE_CHAIN (parms
))
2825 if (DECL_NAME (parms
) && PARM_PASSED_IN_MEMORY (parms
))
2827 dbxout_prepare_symbol (parms
);
2829 /* Report parms that live in registers during the function
2830 but were passed in memory. */
2831 if (GET_CODE (DECL_RTL (parms
)) == REG
2832 && REGNO (DECL_RTL (parms
)) < FIRST_PSEUDO_REGISTER
)
2833 dbxout_symbol_location (parms
, TREE_TYPE (parms
),
2834 0, DECL_RTL (parms
));
2835 else if (GET_CODE (DECL_RTL (parms
)) == CONCAT
)
2836 dbxout_symbol_location (parms
, TREE_TYPE (parms
),
2837 0, DECL_RTL (parms
));
2838 /* Report parms that live in memory but not where they were passed. */
2839 else if (GET_CODE (DECL_RTL (parms
)) == MEM
2840 && ! rtx_equal_p (DECL_RTL (parms
), DECL_INCOMING_RTL (parms
)))
2841 dbxout_symbol_location (parms
, TREE_TYPE (parms
),
2842 0, DECL_RTL (parms
));
2846 /* Given a chain of ..._TYPE nodes (as come in a parameter list),
2847 output definitions of those names, in raw form */
2855 putc (',', asmfile
);
2856 dbxout_type (TREE_VALUE (args
), 0);
2858 args
= TREE_CHAIN (args
);
2862 /* Output everything about a symbol block (a BLOCK node
2863 that represents a scope level),
2864 including recursive output of contained blocks.
2866 BLOCK is the BLOCK node.
2867 DEPTH is its depth within containing symbol blocks.
2868 ARGS is usually zero; but for the outermost block of the
2869 body of a function, it is a chain of PARM_DECLs for the function parameters.
2870 We output definitions of all the register parms
2871 as if they were local variables of that block.
2873 If -g1 was used, we count blocks just the same, but output nothing
2874 except for the outermost block.
2876 Actually, BLOCK may be several blocks chained together.
2877 We handle them all in sequence. */
2880 dbxout_block (block
, depth
, args
)
2887 #if DBX_BLOCKS_FUNCTION_RELATIVE
2888 const char *begin_label
;
2889 if (current_function_func_begin_label
!= NULL_TREE
)
2890 begin_label
= IDENTIFIER_POINTER (current_function_func_begin_label
);
2892 begin_label
= XSTR (XEXP (DECL_RTL (current_function_decl
), 0), 0);
2897 /* Ignore blocks never expanded or otherwise marked as real. */
2898 if (TREE_USED (block
) && TREE_ASM_WRITTEN (block
))
2902 #ifdef DBX_LBRAC_FIRST
2905 /* In dbx format, the syms of a block come before the N_LBRAC.
2906 If nothing is output, we don't need the N_LBRAC, either. */
2908 if (debug_info_level
!= DINFO_LEVEL_TERSE
|| depth
== 0)
2909 did_output
= dbxout_syms (BLOCK_VARS (block
));
2911 dbxout_reg_parms (args
);
2914 /* Now output an N_LBRAC symbol to represent the beginning of
2915 the block. Use the block's tree-walk order to generate
2916 the assembler symbols LBBn and LBEn
2917 that final will define around the code in this block. */
2918 if (depth
> 0 && did_output
)
2921 blocknum
= BLOCK_NUMBER (block
);
2922 ASM_GENERATE_INTERNAL_LABEL (buf
, "LBB", blocknum
);
2924 if (BLOCK_HANDLER_BLOCK (block
))
2926 /* A catch block. Must precede N_LBRAC. */
2927 tree decl
= BLOCK_VARS (block
);
2930 #ifdef DBX_OUTPUT_CATCH
2931 DBX_OUTPUT_CATCH (asmfile
, decl
, buf
);
2933 fprintf (asmfile
, "%s\"%s:C1\",%d,0,0,", ASM_STABS_OP
,
2934 IDENTIFIER_POINTER (DECL_NAME (decl
)), N_CATCH
);
2935 assemble_name (asmfile
, buf
);
2936 fprintf (asmfile
, "\n");
2938 decl
= TREE_CHAIN (decl
);
2942 #ifdef DBX_OUTPUT_LBRAC
2943 DBX_OUTPUT_LBRAC (asmfile
, buf
);
2945 fprintf (asmfile
, "%s%d,0,0,", ASM_STABN_OP
, N_LBRAC
);
2946 assemble_name (asmfile
, buf
);
2947 #if DBX_BLOCKS_FUNCTION_RELATIVE
2948 putc ('-', asmfile
);
2949 assemble_name (asmfile
, begin_label
);
2951 fprintf (asmfile
, "\n");
2955 #ifdef DBX_LBRAC_FIRST
2956 /* On some weird machines, the syms of a block
2957 come after the N_LBRAC. */
2958 if (debug_info_level
!= DINFO_LEVEL_TERSE
|| depth
== 0)
2959 dbxout_syms (BLOCK_VARS (block
));
2961 dbxout_reg_parms (args
);
2964 /* Output the subblocks. */
2965 dbxout_block (BLOCK_SUBBLOCKS (block
), depth
+ 1, NULL_TREE
);
2967 /* Refer to the marker for the end of the block. */
2968 if (depth
> 0 && did_output
)
2971 ASM_GENERATE_INTERNAL_LABEL (buf
, "LBE", blocknum
);
2972 #ifdef DBX_OUTPUT_RBRAC
2973 DBX_OUTPUT_RBRAC (asmfile
, buf
);
2975 fprintf (asmfile
, "%s%d,0,0,", ASM_STABN_OP
, N_RBRAC
);
2976 assemble_name (asmfile
, buf
);
2977 #if DBX_BLOCKS_FUNCTION_RELATIVE
2978 putc ('-', asmfile
);
2979 assemble_name (asmfile
, begin_label
);
2981 fprintf (asmfile
, "\n");
2985 block
= BLOCK_CHAIN (block
);
2989 /* Output the information about a function and its arguments and result.
2990 Usually this follows the function's code,
2991 but on some systems, it comes before. */
2993 #if defined (DBX_DEBUGGING_INFO)
2995 dbxout_begin_function (decl
)
2998 dbxout_symbol (decl
, 0);
2999 dbxout_parms (DECL_ARGUMENTS (decl
));
3000 if (DECL_NAME (DECL_RESULT (decl
)) != 0)
3001 dbxout_symbol (DECL_RESULT (decl
), 1);
3003 #endif /* DBX_DEBUGGING_INFO */
3005 #endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */
3007 #include "gt-dbxout.h"