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");
1334 /* If this type derives from another type, output type index of
1335 parent type. This is particularly important when parent type
1336 is an enumerated type, because not generating the parent type
1337 index would transform the definition of this enumerated type
1338 into a plain unsigned type. */
1339 if (TREE_TYPE (type
) != 0)
1340 dbxout_type_index (TREE_TYPE (type
));
1342 dbxout_type_index (type
);
1344 fprintf (asmfile
, ";");
1346 print_int_cst_octal (TYPE_MIN_VALUE (type
));
1347 fprintf (asmfile
, ";");
1349 print_int_cst_octal (TYPE_MAX_VALUE (type
));
1350 fprintf (asmfile
, ";");
1355 /* Output other integer types as subranges of `int'. */
1356 dbxout_range_type (type
);
1362 /* This used to say `r1' and we used to take care
1363 to make sure that `int' was type number 1. */
1364 fprintf (asmfile
, "r");
1366 dbxout_type_index (integer_type_node
);
1367 putc (';', asmfile
);
1369 print_wide_int (int_size_in_bytes (type
));
1370 fputs (";0;", asmfile
);
1375 if (use_gnu_debug_info_extensions
)
1377 have_used_extensions
= 1;
1378 fputs ("@s", asmfile
);
1380 print_wide_int (BITS_PER_UNIT
* int_size_in_bytes (type
));
1381 fputs (";-20;", asmfile
);
1386 /* Output the type `char' as a subrange of itself.
1387 That is what pcc seems to do. */
1388 fprintf (asmfile
, "r");
1390 dbxout_type_index (char_type_node
);
1391 fprintf (asmfile
, ";0;%d;", TREE_UNSIGNED (type
) ? 255 : 127);
1397 if (use_gnu_debug_info_extensions
)
1399 have_used_extensions
= 1;
1400 fputs ("@s", asmfile
);
1402 print_wide_int (BITS_PER_UNIT
* int_size_in_bytes (type
));
1403 fputs (";-16;", asmfile
);
1406 else /* Define as enumeral type (False, True) */
1408 fprintf (asmfile
, "eFalse:0,True:1,;");
1414 putc ('d', asmfile
);
1416 dbxout_type (TREE_TYPE (type
), 0);
1420 /* Differs from the REAL_TYPE by its new data type number */
1422 if (TREE_CODE (TREE_TYPE (type
)) == REAL_TYPE
)
1424 putc ('R', asmfile
);
1426 dbxout_fptype_value (type
);
1427 putc (';', asmfile
);
1429 print_wide_int (2 * int_size_in_bytes (TREE_TYPE (type
)));
1430 fputs (";0;", asmfile
);
1435 /* Output a complex integer type as a structure,
1436 pending some other way to do it. */
1437 putc ('s', asmfile
);
1439 print_wide_int (int_size_in_bytes (type
));
1440 fprintf (asmfile
, "real:");
1443 dbxout_type (TREE_TYPE (type
), 0);
1444 fprintf (asmfile
, ",0,%d;", TYPE_PRECISION (TREE_TYPE (type
)));
1446 fprintf (asmfile
, "imag:");
1448 dbxout_type (TREE_TYPE (type
), 0);
1449 fprintf (asmfile
, ",%d,%d;;", TYPE_PRECISION (TREE_TYPE (type
)),
1450 TYPE_PRECISION (TREE_TYPE (type
)));
1456 if (use_gnu_debug_info_extensions
)
1458 have_used_extensions
= 1;
1459 fputs ("@s", asmfile
);
1461 print_wide_int (BITS_PER_UNIT
* int_size_in_bytes (type
));
1462 putc (';', asmfile
);
1465 /* Check if a bitstring type, which in Chill is
1466 different from a [power]set. */
1467 if (TYPE_STRING_FLAG (type
))
1469 fprintf (asmfile
, "@S;");
1473 putc ('S', asmfile
);
1475 dbxout_type (TYPE_DOMAIN (type
), 0);
1479 /* Make arrays of packed bits look like bitstrings for chill. */
1480 if (TYPE_PACKED (type
) && use_gnu_debug_info_extensions
)
1482 have_used_extensions
= 1;
1483 fputs ("@s", asmfile
);
1485 print_wide_int (BITS_PER_UNIT
* int_size_in_bytes (type
));
1486 fprintf (asmfile
, ";@S;S");
1488 dbxout_type (TYPE_DOMAIN (type
), 0);
1492 /* Output "a" followed by a range type definition
1493 for the index type of the array
1494 followed by a reference to the target-type.
1495 ar1;0;N;M for a C array of type M and size N+1. */
1496 /* Check if a character string type, which in Chill is
1497 different from an array of characters. */
1498 if (TYPE_STRING_FLAG (type
) && use_gnu_debug_info_extensions
)
1500 have_used_extensions
= 1;
1501 fprintf (asmfile
, "@S;");
1504 tem
= TYPE_DOMAIN (type
);
1507 fprintf (asmfile
, "ar");
1509 dbxout_type_index (integer_type_node
);
1510 fprintf (asmfile
, ";0;-1;");
1515 fprintf (asmfile
, "a");
1517 dbxout_range_type (tem
);
1520 dbxout_type (TREE_TYPE (type
), 0);
1525 case QUAL_UNION_TYPE
:
1527 int i
, n_baseclasses
= 0;
1529 if (TYPE_BINFO (type
) != 0
1530 && TREE_CODE (TYPE_BINFO (type
)) == TREE_VEC
1531 && TYPE_BINFO_BASETYPES (type
) != 0)
1532 n_baseclasses
= TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (type
));
1534 /* Output a structure type. We must use the same test here as we
1535 use in the DBX_NO_XREFS case above. */
1536 if ((TYPE_NAME (type
) != 0
1537 && ! (TREE_CODE (TYPE_NAME (type
)) == TYPE_DECL
1538 && DECL_IGNORED_P (TYPE_NAME (type
)))
1540 || !COMPLETE_TYPE_P (type
)
1541 /* No way in DBX fmt to describe a variable size. */
1542 || ! host_integerp (TYPE_SIZE (type
), 1))
1544 /* If the type is just a cross reference, output one
1545 and mark the type as partially described.
1546 If it later becomes defined, we will output
1547 its real definition.
1548 If the type has a name, don't nest its definition within
1549 another type's definition; instead, output an xref
1550 and let the definition come when the name is defined. */
1551 fputs ((TREE_CODE (type
) == RECORD_TYPE
) ? "xs" : "xu", asmfile
);
1553 #if 0 /* This assertion is legitimately false in C++. */
1554 /* We shouldn't be outputting a reference to a type before its
1555 definition unless the type has a tag name.
1556 A typedef name without a tag name should be impossible. */
1557 if (TREE_CODE (TYPE_NAME (type
)) != IDENTIFIER_NODE
)
1560 if (TYPE_NAME (type
) != 0)
1561 dbxout_type_name (type
);
1564 fprintf (asmfile
, "$$%d", anonymous_type_number
++);
1568 fprintf (asmfile
, ":");
1570 typevec
[TYPE_SYMTAB_ADDRESS (type
)].status
= TYPE_XREF
;
1574 /* Identify record or union, and print its size. */
1575 putc (((TREE_CODE (type
) == RECORD_TYPE
) ? 's' : 'u'), asmfile
);
1577 print_wide_int (int_size_in_bytes (type
));
1579 if (use_gnu_debug_info_extensions
)
1583 have_used_extensions
= 1;
1584 fprintf (asmfile
, "!%d,", n_baseclasses
);
1588 for (i
= 0; i
< n_baseclasses
; i
++)
1590 tree binfo
= TYPE_BINFO (type
);
1591 tree child
= BINFO_BASETYPE (binfo
, i
);
1592 tree access
= (BINFO_BASEACCESSES (binfo
)
1593 ? BINFO_BASEACCESS (binfo
, i
) : access_public_node
);
1595 if (use_gnu_debug_info_extensions
)
1597 have_used_extensions
= 1;
1598 putc (TREE_VIA_VIRTUAL (child
) ? '1' : '0', asmfile
);
1599 putc (access
== access_public_node
? '2' : '0', asmfile
);
1601 if (TREE_VIA_VIRTUAL (child
)
1602 && strcmp (lang_hooks
.name
, "GNU C++") == 0)
1603 /* For a virtual base, print the (negative) offset within
1604 the vtable where we must look to find the necessary
1606 print_wide_int (tree_low_cst (BINFO_VPTR_FIELD (child
), 0)
1609 print_wide_int (tree_low_cst (BINFO_OFFSET (child
), 0)
1611 putc (',', asmfile
);
1613 dbxout_type (BINFO_TYPE (child
), 0);
1614 putc (';', asmfile
);
1619 /* Print out the base class information with fields
1620 which have the same names at the types they hold. */
1621 dbxout_type_name (BINFO_TYPE (child
));
1622 putc (':', asmfile
);
1624 dbxout_type (BINFO_TYPE (child
), full
);
1625 putc (',', asmfile
);
1627 print_wide_int (tree_low_cst (BINFO_OFFSET (child
), 0)
1629 putc (',', asmfile
);
1631 print_wide_int (tree_low_cst (DECL_SIZE
1633 (BINFO_TYPE (child
))),
1636 putc (';', asmfile
);
1642 /* Write out the field declarations. */
1643 dbxout_type_fields (type
);
1644 if (use_gnu_debug_info_extensions
&& TYPE_METHODS (type
) != NULL_TREE
)
1646 have_used_extensions
= 1;
1647 dbxout_type_methods (type
);
1650 putc (';', asmfile
);
1653 if (use_gnu_debug_info_extensions
&& TREE_CODE (type
) == RECORD_TYPE
1654 /* Avoid the ~ if we don't really need it--it confuses dbx. */
1655 && TYPE_VFIELD (type
))
1657 have_used_extensions
= 1;
1659 /* Tell GDB+ that it may keep reading. */
1660 putc ('~', asmfile
);
1663 /* We need to write out info about what field this class
1664 uses as its "main" vtable pointer field, because if this
1665 field is inherited from a base class, GDB cannot necessarily
1666 figure out which field it's using in time. */
1667 if (TYPE_VFIELD (type
))
1669 putc ('%', asmfile
);
1671 dbxout_type (DECL_FCONTEXT (TYPE_VFIELD (type
)), 0);
1674 putc (';', asmfile
);
1680 /* We must use the same test here as we use in the DBX_NO_XREFS case
1681 above. We simplify it a bit since an enum will never have a variable
1683 if ((TYPE_NAME (type
) != 0
1684 && ! (TREE_CODE (TYPE_NAME (type
)) == TYPE_DECL
1685 && DECL_IGNORED_P (TYPE_NAME (type
)))
1687 || !COMPLETE_TYPE_P (type
))
1689 fprintf (asmfile
, "xe");
1691 dbxout_type_name (type
);
1692 typevec
[TYPE_SYMTAB_ADDRESS (type
)].status
= TYPE_XREF
;
1693 putc (':', asmfile
);
1697 #ifdef DBX_OUTPUT_ENUM
1698 DBX_OUTPUT_ENUM (asmfile
, type
);
1700 if (use_gnu_debug_info_extensions
1701 && TYPE_PRECISION (type
) != TYPE_PRECISION (integer_type_node
))
1703 fprintf (asmfile
, "@s%d;", TYPE_PRECISION (type
));
1707 putc ('e', asmfile
);
1709 for (tem
= TYPE_VALUES (type
); tem
; tem
= TREE_CHAIN (tem
))
1711 fprintf (asmfile
, "%s:", IDENTIFIER_POINTER (TREE_PURPOSE (tem
)));
1712 CHARS (IDENTIFIER_LENGTH (TREE_PURPOSE (tem
)) + 1);
1713 if (TREE_INT_CST_HIGH (TREE_VALUE (tem
)) == 0)
1714 print_wide_int (TREE_INT_CST_LOW (TREE_VALUE (tem
)));
1715 else if (TREE_INT_CST_HIGH (TREE_VALUE (tem
)) == -1
1716 && (HOST_WIDE_INT
) TREE_INT_CST_LOW (TREE_VALUE (tem
)) < 0)
1717 print_wide_int (TREE_INT_CST_LOW (TREE_VALUE (tem
)));
1719 print_int_cst_octal (TREE_VALUE (tem
));
1721 putc (',', asmfile
);
1723 if (TREE_CHAIN (tem
) != 0)
1727 putc (';', asmfile
);
1733 putc ('*', asmfile
);
1735 dbxout_type (TREE_TYPE (type
), 0);
1739 if (use_gnu_debug_info_extensions
)
1741 have_used_extensions
= 1;
1742 putc ('#', asmfile
);
1745 /* Write the argument types out longhand. */
1746 dbxout_type (TYPE_METHOD_BASETYPE (type
), 0);
1747 putc (',', asmfile
);
1749 dbxout_type (TREE_TYPE (type
), 0);
1750 dbxout_args (TYPE_ARG_TYPES (type
));
1751 putc (';', asmfile
);
1755 /* Treat it as a function type. */
1756 dbxout_type (TREE_TYPE (type
), 0);
1760 if (use_gnu_debug_info_extensions
)
1762 have_used_extensions
= 1;
1763 putc ('@', asmfile
);
1765 dbxout_type (TYPE_OFFSET_BASETYPE (type
), 0);
1766 putc (',', asmfile
);
1768 dbxout_type (TREE_TYPE (type
), 0);
1771 /* Should print as an int, because it is really just an offset. */
1772 dbxout_type (integer_type_node
, 0);
1775 case REFERENCE_TYPE
:
1776 if (use_gnu_debug_info_extensions
)
1777 have_used_extensions
= 1;
1778 putc (use_gnu_debug_info_extensions
? '&' : '*', asmfile
);
1780 dbxout_type (TREE_TYPE (type
), 0);
1784 putc ('f', asmfile
);
1786 dbxout_type (TREE_TYPE (type
), 0);
1794 /* Print the value of integer constant C, in octal,
1795 handling double precision. */
1798 print_int_cst_octal (c
)
1801 unsigned HOST_WIDE_INT high
= TREE_INT_CST_HIGH (c
);
1802 unsigned HOST_WIDE_INT low
= TREE_INT_CST_LOW (c
);
1803 int excess
= (3 - (HOST_BITS_PER_WIDE_INT
% 3));
1804 unsigned int width
= TYPE_PRECISION (TREE_TYPE (c
));
1806 /* GDB wants constants with no extra leading "1" bits, so
1807 we need to remove any sign-extension that might be
1809 if (width
== HOST_BITS_PER_WIDE_INT
* 2)
1811 else if (width
> HOST_BITS_PER_WIDE_INT
)
1812 high
&= (((HOST_WIDE_INT
) 1 << (width
- HOST_BITS_PER_WIDE_INT
)) - 1);
1813 else if (width
== HOST_BITS_PER_WIDE_INT
)
1816 high
= 0, low
&= (((HOST_WIDE_INT
) 1 << width
) - 1);
1818 fprintf (asmfile
, "0");
1823 print_octal (high
, HOST_BITS_PER_WIDE_INT
/ 3);
1824 print_octal (low
, HOST_BITS_PER_WIDE_INT
/ 3);
1828 unsigned HOST_WIDE_INT beg
= high
>> excess
;
1829 unsigned HOST_WIDE_INT middle
1830 = ((high
& (((HOST_WIDE_INT
) 1 << excess
) - 1)) << (3 - excess
)
1831 | (low
>> (HOST_BITS_PER_WIDE_INT
/ 3 * 3)));
1832 unsigned HOST_WIDE_INT end
1833 = low
& (((unsigned HOST_WIDE_INT
) 1
1834 << (HOST_BITS_PER_WIDE_INT
/ 3 * 3))
1837 fprintf (asmfile
, "%o%01o", (int) beg
, (int) middle
);
1839 print_octal (end
, HOST_BITS_PER_WIDE_INT
/ 3);
1844 print_octal (value
, digits
)
1845 unsigned HOST_WIDE_INT value
;
1850 for (i
= digits
- 1; i
>= 0; i
--)
1851 fprintf (asmfile
, "%01o", (int) ((value
>> (3 * i
)) & 7));
1856 /* Output C in decimal while adjusting the number of digits written. */
1864 fprintf (asmfile
, HOST_WIDE_INT_PRINT_DEC
, c
);
1875 /* Output the name of type TYPE, with no punctuation.
1876 Such names can be set up either by typedef declarations
1877 or by struct, enum and union tags. */
1880 dbxout_type_name (type
)
1884 if (TYPE_NAME (type
) == 0)
1886 if (TREE_CODE (TYPE_NAME (type
)) == IDENTIFIER_NODE
)
1888 t
= TYPE_NAME (type
);
1890 else if (TREE_CODE (TYPE_NAME (type
)) == TYPE_DECL
)
1892 t
= DECL_NAME (TYPE_NAME (type
));
1897 fprintf (asmfile
, "%s", IDENTIFIER_POINTER (t
));
1898 CHARS (IDENTIFIER_LENGTH (t
));
1901 /* Output leading leading struct or class names needed for qualifying
1902 type whose scope is limited to a struct or class. */
1905 dbxout_class_name_qualifiers (decl
)
1908 tree context
= decl_type_context (decl
);
1910 if (context
!= NULL_TREE
1911 && TREE_CODE(context
) == RECORD_TYPE
1912 && TYPE_NAME (context
) != 0
1913 && (TREE_CODE (TYPE_NAME (context
)) == IDENTIFIER_NODE
1914 || (DECL_NAME (TYPE_NAME (context
)) != 0)))
1916 tree name
= TYPE_NAME (context
);
1918 if (TREE_CODE (name
) == TYPE_DECL
)
1920 dbxout_class_name_qualifiers (name
);
1921 name
= DECL_NAME (name
);
1923 fprintf (asmfile
, "%s::", IDENTIFIER_POINTER (name
));
1924 CHARS (IDENTIFIER_LENGTH (name
) + 2);
1928 /* Output a .stabs for the symbol defined by DECL,
1929 which must be a ..._DECL node in the normal namespace.
1930 It may be a CONST_DECL, a FUNCTION_DECL, a PARM_DECL or a VAR_DECL.
1931 LOCAL is nonzero if the scope is less than the entire file.
1932 Return 1 if a stabs might have been emitted. */
1935 dbxout_symbol (decl
, local
)
1937 int local ATTRIBUTE_UNUSED
;
1939 tree type
= TREE_TYPE (decl
);
1940 tree context
= NULL_TREE
;
1943 /* Cast avoids warning in old compilers. */
1944 current_sym_code
= (STAB_CODE_TYPE
) 0;
1945 current_sym_value
= 0;
1946 current_sym_addr
= 0;
1948 /* Ignore nameless syms, but don't ignore type tags. */
1950 if ((DECL_NAME (decl
) == 0 && TREE_CODE (decl
) != TYPE_DECL
)
1951 || DECL_IGNORED_P (decl
))
1954 dbxout_prepare_symbol (decl
);
1956 /* The output will always start with the symbol name,
1957 so always count that in the length-output-so-far. */
1959 if (DECL_NAME (decl
) != 0)
1960 current_sym_nchars
= 2 + IDENTIFIER_LENGTH (DECL_NAME (decl
));
1962 switch (TREE_CODE (decl
))
1965 /* Enum values are defined by defining the enum type. */
1969 if (DECL_RTL (decl
) == 0)
1971 if (DECL_EXTERNAL (decl
))
1973 /* Don't mention a nested function under its parent. */
1974 context
= decl_function_context (decl
);
1975 if (context
== current_function_decl
)
1977 if (GET_CODE (DECL_RTL (decl
)) != MEM
1978 || GET_CODE (XEXP (DECL_RTL (decl
), 0)) != SYMBOL_REF
)
1982 fprintf (asmfile
, "%s\"%s:%c", ASM_STABS_OP
,
1983 IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
)),
1984 TREE_PUBLIC (decl
) ? 'F' : 'f');
1987 current_sym_code
= N_FUN
;
1988 current_sym_addr
= XEXP (DECL_RTL (decl
), 0);
1990 if (TREE_TYPE (type
))
1991 dbxout_type (TREE_TYPE (type
), 0);
1993 dbxout_type (void_type_node
, 0);
1995 /* For a nested function, when that function is compiled,
1996 mention the containing function name
1997 as well as (since dbx wants it) our own assembler-name. */
1999 fprintf (asmfile
, ",%s,%s",
2000 IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
)),
2001 IDENTIFIER_POINTER (DECL_NAME (context
)));
2003 dbxout_finish_symbol (decl
);
2008 /* This seems all wrong. Outputting most kinds of types gives no name
2009 at all. A true definition gives no name; a cross-ref for a
2010 structure can give the tag name, but not a type name.
2011 It seems that no typedef name is defined by outputting a type. */
2013 /* If this typedef name was defined by outputting the type,
2014 don't duplicate it. */
2015 if (typevec
[TYPE_SYMTAB_ADDRESS (type
)].status
== TYPE_DEFINED
2016 && TYPE_NAME (TREE_TYPE (decl
)) == decl
)
2019 /* Don't output the same typedef twice.
2020 And don't output what language-specific stuff doesn't want output. */
2021 if (TREE_ASM_WRITTEN (decl
) || TYPE_DECL_SUPPRESS_DEBUG (decl
))
2030 if (DECL_NAME (decl
))
2032 /* Nonzero means we must output a tag as well as a typedef. */
2035 /* Handle the case of a C++ structure or union
2036 where the TYPE_NAME is a TYPE_DECL
2037 which gives both a typedef name and a tag. */
2038 /* dbx requires the tag first and the typedef second. */
2039 if ((TREE_CODE (type
) == RECORD_TYPE
2040 || TREE_CODE (type
) == UNION_TYPE
2041 || TREE_CODE (type
) == QUAL_UNION_TYPE
)
2042 && TYPE_NAME (type
) == decl
2043 && !(use_gnu_debug_info_extensions
&& have_used_extensions
)
2044 && !TREE_ASM_WRITTEN (TYPE_NAME (type
))
2045 /* Distinguish the implicit typedefs of C++
2046 from explicit ones that might be found in C. */
2047 && DECL_ARTIFICIAL (decl
)
2048 /* Do not generate a tag for records of variable size,
2049 since this type can not be properly described in the
2050 DBX format, and it confuses some tools such as objdump. */
2051 && host_integerp (TYPE_SIZE (type
), 1))
2053 tree name
= TYPE_NAME (type
);
2054 if (TREE_CODE (name
) == TYPE_DECL
)
2055 name
= DECL_NAME (name
);
2057 current_sym_code
= DBX_TYPE_DECL_STABS_CODE
;
2058 current_sym_value
= 0;
2059 current_sym_addr
= 0;
2060 current_sym_nchars
= 2 + IDENTIFIER_LENGTH (name
);
2062 fprintf (asmfile
, "%s\"%s:T", ASM_STABS_OP
,
2063 IDENTIFIER_POINTER (name
));
2064 dbxout_type (type
, 1);
2065 dbxout_finish_symbol (NULL_TREE
);
2068 /* Output .stabs (or whatever) and leading double quote. */
2069 fprintf (asmfile
, "%s\"", ASM_STABS_OP
);
2071 if (use_gnu_debug_info_extensions
)
2073 /* Output leading class/struct qualifiers. */
2074 dbxout_class_name_qualifiers (decl
);
2077 /* Output typedef name. */
2078 fprintf (asmfile
, "%s:", IDENTIFIER_POINTER (DECL_NAME (decl
)));
2080 /* Short cut way to output a tag also. */
2081 if ((TREE_CODE (type
) == RECORD_TYPE
2082 || TREE_CODE (type
) == UNION_TYPE
2083 || TREE_CODE (type
) == QUAL_UNION_TYPE
)
2084 && TYPE_NAME (type
) == decl
2085 /* Distinguish the implicit typedefs of C++
2086 from explicit ones that might be found in C. */
2087 && DECL_ARTIFICIAL (decl
))
2089 if (use_gnu_debug_info_extensions
&& have_used_extensions
)
2091 putc ('T', asmfile
);
2092 TREE_ASM_WRITTEN (TYPE_NAME (type
)) = 1;
2094 #if 0 /* Now we generate the tag for this case up above. */
2100 putc ('t', asmfile
);
2101 current_sym_code
= DBX_TYPE_DECL_STABS_CODE
;
2103 dbxout_type (type
, 1);
2104 dbxout_finish_symbol (decl
);
2108 /* Don't output a tag if this is an incomplete type. This prevents
2109 the sun4 Sun OS 4.x dbx from crashing. */
2111 if (tag_needed
&& TYPE_NAME (type
) != 0
2112 && (TREE_CODE (TYPE_NAME (type
)) == IDENTIFIER_NODE
2113 || (DECL_NAME (TYPE_NAME (type
)) != 0))
2114 && COMPLETE_TYPE_P (type
)
2115 && !TREE_ASM_WRITTEN (TYPE_NAME (type
)))
2117 /* For a TYPE_DECL with no name, but the type has a name,
2119 This is what represents `struct foo' with no typedef. */
2120 /* In C++, the name of a type is the corresponding typedef.
2121 In C, it is an IDENTIFIER_NODE. */
2122 tree name
= TYPE_NAME (type
);
2123 if (TREE_CODE (name
) == TYPE_DECL
)
2124 name
= DECL_NAME (name
);
2126 current_sym_code
= DBX_TYPE_DECL_STABS_CODE
;
2127 current_sym_value
= 0;
2128 current_sym_addr
= 0;
2129 current_sym_nchars
= 2 + IDENTIFIER_LENGTH (name
);
2131 fprintf (asmfile
, "%s\"%s:T", ASM_STABS_OP
,
2132 IDENTIFIER_POINTER (name
));
2133 dbxout_type (type
, 1);
2134 dbxout_finish_symbol (NULL_TREE
);
2138 /* If an enum type has no name, it cannot be referred to,
2139 but we must output it anyway, since the enumeration constants
2140 can be referred to. */
2141 if (!did_output
&& TREE_CODE (type
) == ENUMERAL_TYPE
)
2143 current_sym_code
= DBX_TYPE_DECL_STABS_CODE
;
2144 current_sym_value
= 0;
2145 current_sym_addr
= 0;
2146 current_sym_nchars
= 2;
2148 /* Some debuggers fail when given NULL names, so give this a
2149 harmless name of ` '. */
2150 fprintf (asmfile
, "%s\" :T", ASM_STABS_OP
);
2151 dbxout_type (type
, 1);
2152 dbxout_finish_symbol (NULL_TREE
);
2155 /* Prevent duplicate output of a typedef. */
2156 TREE_ASM_WRITTEN (decl
) = 1;
2161 /* Parm decls go in their own separate chains
2162 and are output by dbxout_reg_parms and dbxout_parms. */
2166 /* Named return value, treat like a VAR_DECL. */
2168 if (! DECL_RTL_SET_P (decl
))
2170 /* Don't mention a variable that is external.
2171 Let the file that defines it describe it. */
2172 if (DECL_EXTERNAL (decl
))
2175 /* If the variable is really a constant
2176 and not written in memory, inform the debugger. */
2177 if (TREE_STATIC (decl
) && TREE_READONLY (decl
)
2178 && DECL_INITIAL (decl
) != 0
2179 && host_integerp (DECL_INITIAL (decl
), 0)
2180 && ! TREE_ASM_WRITTEN (decl
)
2181 && (DECL_CONTEXT (decl
) == NULL_TREE
2182 || TREE_CODE (DECL_CONTEXT (decl
)) == BLOCK
))
2184 if (TREE_PUBLIC (decl
) == 0)
2186 /* The sun4 assembler does not grok this. */
2187 const char *name
= IDENTIFIER_POINTER (DECL_NAME (decl
));
2189 if (TREE_CODE (TREE_TYPE (decl
)) == INTEGER_TYPE
2190 || TREE_CODE (TREE_TYPE (decl
)) == ENUMERAL_TYPE
)
2192 HOST_WIDE_INT ival
= tree_low_cst (DECL_INITIAL (decl
), 0);
2193 #ifdef DBX_OUTPUT_CONSTANT_SYMBOL
2194 DBX_OUTPUT_CONSTANT_SYMBOL (asmfile
, name
, ival
);
2196 fprintf (asmfile
, "%s\"%s:c=i", ASM_STABS_OP
, name
);
2198 fprintf (asmfile
, HOST_WIDE_INT_PRINT_DEC
, ival
);
2199 fprintf (asmfile
, "\",0x%x,0,0,0\n", N_LSYM
);
2203 else if (TREE_CODE (TREE_TYPE (decl
)) == REAL_TYPE
)
2205 /* don't know how to do this yet. */
2209 /* else it is something we handle like a normal variable. */
2212 SET_DECL_RTL (decl
, eliminate_regs (DECL_RTL (decl
), 0, NULL_RTX
));
2213 #ifdef LEAF_REG_REMAP
2214 if (current_function_uses_only_leaf_regs
)
2215 leaf_renumber_regs_insn (DECL_RTL (decl
));
2218 result
= dbxout_symbol_location (decl
, type
, 0, DECL_RTL (decl
));
2227 /* Output the stab for DECL, a VAR_DECL, RESULT_DECL or PARM_DECL.
2228 Add SUFFIX to its name, if SUFFIX is not 0.
2229 Describe the variable as residing in HOME
2230 (usually HOME is DECL_RTL (DECL), but not always).
2231 Returns 1 if the stab was really emitted. */
2234 dbxout_symbol_location (decl
, type
, suffix
, home
)
2242 /* Don't mention a variable at all
2243 if it was completely optimized into nothingness.
2245 If the decl was from an inline function, then its rtl
2246 is not identically the rtl that was used in this
2247 particular compilation. */
2248 if (GET_CODE (home
) == SUBREG
)
2252 while (GET_CODE (value
) == SUBREG
)
2253 value
= SUBREG_REG (value
);
2254 if (GET_CODE (value
) == REG
)
2256 if (REGNO (value
) >= FIRST_PSEUDO_REGISTER
)
2259 home
= alter_subreg (&home
);
2261 if (GET_CODE (home
) == REG
)
2263 regno
= REGNO (home
);
2264 if (regno
>= FIRST_PSEUDO_REGISTER
)
2268 /* The kind-of-variable letter depends on where
2269 the variable is and on the scope of its name:
2270 G and N_GSYM for static storage and global scope,
2271 S for static storage and file scope,
2272 V for static storage and local scope,
2273 for those two, use N_LCSYM if data is in bss segment,
2274 N_STSYM if in data segment, N_FUN otherwise.
2275 (We used N_FUN originally, then changed to N_STSYM
2276 to please GDB. However, it seems that confused ld.
2277 Now GDB has been fixed to like N_FUN, says Kingdon.)
2278 no letter at all, and N_LSYM, for auto variable,
2279 r and N_RSYM for register variable. */
2281 if (GET_CODE (home
) == MEM
2282 && GET_CODE (XEXP (home
, 0)) == SYMBOL_REF
)
2284 if (TREE_PUBLIC (decl
))
2287 current_sym_code
= N_GSYM
;
2291 current_sym_addr
= XEXP (home
, 0);
2293 letter
= decl_function_context (decl
) ? 'V' : 'S';
2295 /* This should be the same condition as in assemble_variable, but
2296 we don't have access to dont_output_data here. So, instead,
2297 we rely on the fact that error_mark_node initializers always
2298 end up in bss for C++ and never end up in bss for C. */
2299 if (DECL_INITIAL (decl
) == 0
2300 || (!strcmp (lang_hooks
.name
, "GNU C++")
2301 && DECL_INITIAL (decl
) == error_mark_node
))
2302 current_sym_code
= N_LCSYM
;
2303 else if (DECL_IN_TEXT_SECTION (decl
))
2304 /* This is not quite right, but it's the closest
2305 of all the codes that Unix defines. */
2306 current_sym_code
= DBX_STATIC_CONST_VAR_CODE
;
2309 /* Some ports can transform a symbol ref into a label ref,
2310 because the symbol ref is too far away and has to be
2311 dumped into a constant pool. Alternatively, the symbol
2312 in the constant pool might be referenced by a different
2314 if (GET_CODE (current_sym_addr
) == SYMBOL_REF
2315 && CONSTANT_POOL_ADDRESS_P (current_sym_addr
))
2317 rtx tmp
= get_pool_constant (current_sym_addr
);
2319 if (GET_CODE (tmp
) == SYMBOL_REF
2320 || GET_CODE (tmp
) == LABEL_REF
)
2321 current_sym_addr
= tmp
;
2324 /* Ultrix `as' seems to need this. */
2325 #ifdef DBX_STATIC_STAB_DATA_SECTION
2328 current_sym_code
= N_STSYM
;
2332 else if (regno
>= 0)
2335 current_sym_code
= N_RSYM
;
2336 current_sym_value
= DBX_REGISTER_NUMBER (regno
);
2338 else if (GET_CODE (home
) == MEM
2339 && (GET_CODE (XEXP (home
, 0)) == MEM
2340 || (GET_CODE (XEXP (home
, 0)) == REG
2341 && REGNO (XEXP (home
, 0)) != HARD_FRAME_POINTER_REGNUM
2342 && REGNO (XEXP (home
, 0)) != STACK_POINTER_REGNUM
2343 #if ARG_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
2344 && REGNO (XEXP (home
, 0)) != ARG_POINTER_REGNUM
2347 /* If the value is indirect by memory or by a register
2348 that isn't the frame pointer
2349 then it means the object is variable-sized and address through
2350 that register or stack slot. DBX has no way to represent this
2351 so all we can do is output the variable as a pointer.
2352 If it's not a parameter, ignore it.
2353 (VAR_DECLs like this can be made by integrate.c.) */
2355 if (GET_CODE (XEXP (home
, 0)) == REG
)
2358 current_sym_code
= N_RSYM
;
2359 if (REGNO (XEXP (home
, 0)) >= FIRST_PSEUDO_REGISTER
)
2361 current_sym_value
= DBX_REGISTER_NUMBER (REGNO (XEXP (home
, 0)));
2365 current_sym_code
= N_LSYM
;
2366 /* RTL looks like (MEM (MEM (PLUS (REG...) (CONST_INT...)))).
2367 We want the value of that CONST_INT. */
2369 = DEBUGGER_AUTO_OFFSET (XEXP (XEXP (home
, 0), 0));
2372 /* Effectively do build_pointer_type, but don't cache this type,
2373 since it might be temporary whereas the type it points to
2374 might have been saved for inlining. */
2375 /* Don't use REFERENCE_TYPE because dbx can't handle that. */
2376 type
= make_node (POINTER_TYPE
);
2377 TREE_TYPE (type
) = TREE_TYPE (decl
);
2379 else if (GET_CODE (home
) == MEM
2380 && GET_CODE (XEXP (home
, 0)) == REG
)
2382 current_sym_code
= N_LSYM
;
2383 current_sym_value
= DEBUGGER_AUTO_OFFSET (XEXP (home
, 0));
2385 else if (GET_CODE (home
) == MEM
2386 && GET_CODE (XEXP (home
, 0)) == PLUS
2387 && GET_CODE (XEXP (XEXP (home
, 0), 1)) == CONST_INT
)
2389 current_sym_code
= N_LSYM
;
2390 /* RTL looks like (MEM (PLUS (REG...) (CONST_INT...)))
2391 We want the value of that CONST_INT. */
2392 current_sym_value
= DEBUGGER_AUTO_OFFSET (XEXP (home
, 0));
2394 else if (GET_CODE (home
) == MEM
2395 && GET_CODE (XEXP (home
, 0)) == CONST
)
2397 /* Handle an obscure case which can arise when optimizing and
2398 when there are few available registers. (This is *always*
2399 the case for i386/i486 targets). The RTL looks like
2400 (MEM (CONST ...)) even though this variable is a local `auto'
2401 or a local `register' variable. In effect, what has happened
2402 is that the reload pass has seen that all assignments and
2403 references for one such a local variable can be replaced by
2404 equivalent assignments and references to some static storage
2405 variable, thereby avoiding the need for a register. In such
2406 cases we're forced to lie to debuggers and tell them that
2407 this variable was itself `static'. */
2408 current_sym_code
= N_LCSYM
;
2410 current_sym_addr
= XEXP (XEXP (home
, 0), 0);
2412 else if (GET_CODE (home
) == CONCAT
)
2416 /* If TYPE is not a COMPLEX_TYPE (it might be a RECORD_TYPE,
2417 for example), then there is no easy way to figure out
2418 what SUBTYPE should be. So, we give up. */
2419 if (TREE_CODE (type
) != COMPLEX_TYPE
)
2422 subtype
= TREE_TYPE (type
);
2424 /* If the variable's storage is in two parts,
2425 output each as a separate stab with a modified name. */
2426 if (WORDS_BIG_ENDIAN
)
2427 dbxout_symbol_location (decl
, subtype
, "$imag", XEXP (home
, 0));
2429 dbxout_symbol_location (decl
, subtype
, "$real", XEXP (home
, 0));
2431 /* Cast avoids warning in old compilers. */
2432 current_sym_code
= (STAB_CODE_TYPE
) 0;
2433 current_sym_value
= 0;
2434 current_sym_addr
= 0;
2435 dbxout_prepare_symbol (decl
);
2437 if (WORDS_BIG_ENDIAN
)
2438 dbxout_symbol_location (decl
, subtype
, "$real", XEXP (home
, 1));
2440 dbxout_symbol_location (decl
, subtype
, "$imag", XEXP (home
, 1));
2444 /* Address might be a MEM, when DECL is a variable-sized object.
2445 Or it might be const0_rtx, meaning previous passes
2446 want us to ignore this variable. */
2449 /* Ok, start a symtab entry and output the variable name. */
2452 #ifdef DBX_STATIC_BLOCK_START
2453 DBX_STATIC_BLOCK_START (asmfile
, current_sym_code
);
2456 dbxout_symbol_name (decl
, suffix
, letter
);
2457 dbxout_type (type
, 0);
2458 dbxout_finish_symbol (decl
);
2460 #ifdef DBX_STATIC_BLOCK_END
2461 DBX_STATIC_BLOCK_END (asmfile
, current_sym_code
);
2466 /* Output the symbol name of DECL for a stabs, with suffix SUFFIX.
2467 Then output LETTER to indicate the kind of location the symbol has. */
2470 dbxout_symbol_name (decl
, suffix
, letter
)
2477 if (DECL_CONTEXT (decl
) && TYPE_P (DECL_CONTEXT (decl
)))
2478 /* One slight hitch: if this is a VAR_DECL which is a static
2479 class member, we must put out the mangled name instead of the
2480 DECL_NAME. Note also that static member (variable) names DO NOT begin
2481 with underscores in .stabs directives. */
2482 name
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
));
2484 /* ...but if we're function-local, we don't want to include the junk
2485 added by ASM_FORMAT_PRIVATE_NAME. */
2486 name
= IDENTIFIER_POINTER (DECL_NAME (decl
));
2490 fprintf (asmfile
, "%s\"%s%s:", ASM_STABS_OP
, name
,
2491 (suffix
? suffix
: ""));
2494 putc (letter
, asmfile
);
2498 dbxout_prepare_symbol (decl
)
2499 tree decl ATTRIBUTE_UNUSED
;
2502 const char *filename
= DECL_SOURCE_FILE (decl
);
2504 dbxout_source_file (asmfile
, filename
);
2509 dbxout_finish_symbol (sym
)
2512 #ifdef DBX_FINISH_SYMBOL
2513 DBX_FINISH_SYMBOL (sym
);
2516 if (use_gnu_debug_info_extensions
&& sym
!= 0)
2517 line
= DECL_SOURCE_LINE (sym
);
2519 fprintf (asmfile
, "\",%d,0,%d,", current_sym_code
, line
);
2520 if (current_sym_addr
)
2521 output_addr_const (asmfile
, current_sym_addr
);
2523 fprintf (asmfile
, "%d", current_sym_value
);
2524 putc ('\n', asmfile
);
2528 /* Output definitions of all the decls in a chain. Return nonzero if
2529 anything was output */
2538 result
+= dbxout_symbol (syms
, 1);
2539 syms
= TREE_CHAIN (syms
);
2544 /* The following two functions output definitions of function parameters.
2545 Each parameter gets a definition locating it in the parameter list.
2546 Each parameter that is a register variable gets a second definition
2547 locating it in the register.
2549 Printing or argument lists in gdb uses the definitions that
2550 locate in the parameter list. But reference to the variable in
2551 expressions uses preferentially the definition as a register. */
2553 /* Output definitions, referring to storage in the parmlist,
2554 of all the parms in PARMS, which is a chain of PARM_DECL nodes. */
2557 dbxout_parms (parms
)
2560 for (; parms
; parms
= TREE_CHAIN (parms
))
2561 if (DECL_NAME (parms
) && TREE_TYPE (parms
) != error_mark_node
)
2563 dbxout_prepare_symbol (parms
);
2565 /* Perform any necessary register eliminations on the parameter's rtl,
2566 so that the debugging output will be accurate. */
2567 DECL_INCOMING_RTL (parms
)
2568 = eliminate_regs (DECL_INCOMING_RTL (parms
), 0, NULL_RTX
);
2569 SET_DECL_RTL (parms
, eliminate_regs (DECL_RTL (parms
), 0, NULL_RTX
));
2570 #ifdef LEAF_REG_REMAP
2571 if (current_function_uses_only_leaf_regs
)
2573 leaf_renumber_regs_insn (DECL_INCOMING_RTL (parms
));
2574 leaf_renumber_regs_insn (DECL_RTL (parms
));
2578 if (PARM_PASSED_IN_MEMORY (parms
))
2580 rtx addr
= XEXP (DECL_INCOMING_RTL (parms
), 0);
2582 /* ??? Here we assume that the parm address is indexed
2583 off the frame pointer or arg pointer.
2584 If that is not true, we produce meaningless results,
2585 but do not crash. */
2586 if (GET_CODE (addr
) == PLUS
2587 && GET_CODE (XEXP (addr
, 1)) == CONST_INT
)
2588 current_sym_value
= INTVAL (XEXP (addr
, 1));
2590 current_sym_value
= 0;
2592 current_sym_code
= N_PSYM
;
2593 current_sym_addr
= 0;
2596 if (DECL_NAME (parms
))
2598 current_sym_nchars
= 2 + IDENTIFIER_LENGTH (DECL_NAME (parms
));
2600 fprintf (asmfile
, "%s\"%s:%c", ASM_STABS_OP
,
2601 IDENTIFIER_POINTER (DECL_NAME (parms
)),
2602 DBX_MEMPARM_STABS_LETTER
);
2606 current_sym_nchars
= 8;
2607 fprintf (asmfile
, "%s\"(anon):%c", ASM_STABS_OP
,
2608 DBX_MEMPARM_STABS_LETTER
);
2611 /* It is quite tempting to use:
2613 dbxout_type (TREE_TYPE (parms), 0);
2615 as the next statement, rather than using DECL_ARG_TYPE(), so
2616 that gcc reports the actual type of the parameter, rather
2617 than the promoted type. This certainly makes GDB's life
2618 easier, at least for some ports. The change is a bad idea
2619 however, since GDB expects to be able access the type without
2620 performing any conversions. So for example, if we were
2621 passing a float to an unprototyped function, gcc will store a
2622 double on the stack, but if we emit a stab saying the type is a
2623 float, then gdb will only read in a single value, and this will
2624 produce an erroneous value. */
2625 dbxout_type (DECL_ARG_TYPE (parms
), 0);
2626 current_sym_value
= DEBUGGER_ARG_OFFSET (current_sym_value
, addr
);
2627 dbxout_finish_symbol (parms
);
2629 else if (GET_CODE (DECL_RTL (parms
)) == REG
)
2632 char regparm_letter
;
2634 /* Parm passed in registers and lives in registers or nowhere. */
2636 current_sym_code
= DBX_REGPARM_STABS_CODE
;
2637 regparm_letter
= DBX_REGPARM_STABS_LETTER
;
2638 current_sym_addr
= 0;
2640 /* If parm lives in a register, use that register;
2641 pretend the parm was passed there. It would be more consistent
2642 to describe the register where the parm was passed,
2643 but in practice that register usually holds something else.
2645 If we use DECL_RTL, then we must use the declared type of
2646 the variable, not the type that it arrived in. */
2647 if (REGNO (DECL_RTL (parms
)) < FIRST_PSEUDO_REGISTER
)
2649 best_rtl
= DECL_RTL (parms
);
2650 parm_type
= TREE_TYPE (parms
);
2652 /* If the parm lives nowhere, use the register where it was
2653 passed. It is also better to use the declared type here. */
2656 best_rtl
= DECL_INCOMING_RTL (parms
);
2657 parm_type
= TREE_TYPE (parms
);
2659 current_sym_value
= DBX_REGISTER_NUMBER (REGNO (best_rtl
));
2662 if (DECL_NAME (parms
))
2664 current_sym_nchars
= 2 + IDENTIFIER_LENGTH (DECL_NAME (parms
));
2665 fprintf (asmfile
, "%s\"%s:%c", ASM_STABS_OP
,
2666 IDENTIFIER_POINTER (DECL_NAME (parms
)),
2671 current_sym_nchars
= 8;
2672 fprintf (asmfile
, "%s\"(anon):%c", ASM_STABS_OP
,
2676 dbxout_type (parm_type
, 0);
2677 dbxout_finish_symbol (parms
);
2679 else if (GET_CODE (DECL_RTL (parms
)) == MEM
2680 && GET_CODE (XEXP (DECL_RTL (parms
), 0)) == REG
2681 && REGNO (XEXP (DECL_RTL (parms
), 0)) != HARD_FRAME_POINTER_REGNUM
2682 && REGNO (XEXP (DECL_RTL (parms
), 0)) != STACK_POINTER_REGNUM
2683 #if ARG_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
2684 && REGNO (XEXP (DECL_RTL (parms
), 0)) != ARG_POINTER_REGNUM
2688 /* Parm was passed via invisible reference.
2689 That is, its address was passed in a register.
2690 Output it as if it lived in that register.
2691 The debugger will know from the type
2692 that it was actually passed by invisible reference. */
2694 char regparm_letter
;
2695 /* Parm passed in registers and lives in registers or nowhere. */
2697 current_sym_code
= DBX_REGPARM_STABS_CODE
;
2698 if (use_gnu_debug_info_extensions
)
2699 regparm_letter
= GDB_INV_REF_REGPARM_STABS_LETTER
;
2701 regparm_letter
= DBX_REGPARM_STABS_LETTER
;
2703 /* DECL_RTL looks like (MEM (REG...). Get the register number.
2704 If it is an unallocated pseudo-reg, then use the register where
2705 it was passed instead. */
2706 if (REGNO (XEXP (DECL_RTL (parms
), 0)) < FIRST_PSEUDO_REGISTER
)
2707 current_sym_value
= REGNO (XEXP (DECL_RTL (parms
), 0));
2709 current_sym_value
= REGNO (DECL_INCOMING_RTL (parms
));
2711 current_sym_addr
= 0;
2714 if (DECL_NAME (parms
))
2717 = 2 + strlen (IDENTIFIER_POINTER (DECL_NAME (parms
)));
2719 fprintf (asmfile
, "%s\"%s:%c", ASM_STABS_OP
,
2720 IDENTIFIER_POINTER (DECL_NAME (parms
)),
2725 current_sym_nchars
= 8;
2726 fprintf (asmfile
, "%s\"(anon):%c", ASM_STABS_OP
,
2730 dbxout_type (TREE_TYPE (parms
), 0);
2731 dbxout_finish_symbol (parms
);
2733 else if (GET_CODE (DECL_RTL (parms
)) == MEM
2734 && GET_CODE (XEXP (DECL_RTL (parms
), 0)) == MEM
)
2736 /* Parm was passed via invisible reference, with the reference
2737 living on the stack. DECL_RTL looks like
2738 (MEM (MEM (PLUS (REG ...) (CONST_INT ...)))) or it
2739 could look like (MEM (MEM (REG))). */
2740 const char *const decl_name
= (DECL_NAME (parms
)
2741 ? IDENTIFIER_POINTER (DECL_NAME (parms
))
2743 if (GET_CODE (XEXP (XEXP (DECL_RTL (parms
), 0), 0)) == REG
)
2744 current_sym_value
= 0;
2747 = INTVAL (XEXP (XEXP (XEXP (DECL_RTL (parms
), 0), 0), 1));
2748 current_sym_addr
= 0;
2749 current_sym_code
= N_PSYM
;
2752 fprintf (asmfile
, "%s\"%s:v", ASM_STABS_OP
, decl_name
);
2755 = DEBUGGER_ARG_OFFSET (current_sym_value
,
2756 XEXP (XEXP (DECL_RTL (parms
), 0), 0));
2757 dbxout_type (TREE_TYPE (parms
), 0);
2758 dbxout_finish_symbol (parms
);
2760 else if (GET_CODE (DECL_RTL (parms
)) == MEM
2761 && XEXP (DECL_RTL (parms
), 0) != const0_rtx
2762 /* ??? A constant address for a parm can happen
2763 when the reg it lives in is equiv to a constant in memory.
2764 Should make this not happen, after 2.4. */
2765 && ! CONSTANT_P (XEXP (DECL_RTL (parms
), 0)))
2767 /* Parm was passed in registers but lives on the stack. */
2769 current_sym_code
= N_PSYM
;
2770 /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))),
2771 in which case we want the value of that CONST_INT,
2773 in which case we use a value of zero. */
2774 if (GET_CODE (XEXP (DECL_RTL (parms
), 0)) == REG
)
2775 current_sym_value
= 0;
2778 = INTVAL (XEXP (XEXP (DECL_RTL (parms
), 0), 1));
2780 current_sym_addr
= 0;
2782 /* Make a big endian correction if the mode of the type of the
2783 parameter is not the same as the mode of the rtl. */
2784 if (BYTES_BIG_ENDIAN
2785 && TYPE_MODE (TREE_TYPE (parms
)) != GET_MODE (DECL_RTL (parms
))
2786 && GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (parms
))) < UNITS_PER_WORD
)
2788 current_sym_value
+=
2789 GET_MODE_SIZE (GET_MODE (DECL_RTL (parms
)))
2790 - GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (parms
)));
2794 if (DECL_NAME (parms
))
2797 = 2 + strlen (IDENTIFIER_POINTER (DECL_NAME (parms
)));
2799 fprintf (asmfile
, "%s\"%s:%c", ASM_STABS_OP
,
2800 IDENTIFIER_POINTER (DECL_NAME (parms
)),
2801 DBX_MEMPARM_STABS_LETTER
);
2805 current_sym_nchars
= 8;
2806 fprintf (asmfile
, "%s\"(anon):%c", ASM_STABS_OP
,
2807 DBX_MEMPARM_STABS_LETTER
);
2811 = DEBUGGER_ARG_OFFSET (current_sym_value
,
2812 XEXP (DECL_RTL (parms
), 0));
2813 dbxout_type (TREE_TYPE (parms
), 0);
2814 dbxout_finish_symbol (parms
);
2819 /* Output definitions for the places where parms live during the function,
2820 when different from where they were passed, when the parms were passed
2823 It is not useful to do this for parms passed in registers
2824 that live during the function in different registers, because it is
2825 impossible to look in the passed register for the passed value,
2826 so we use the within-the-function register to begin with.
2828 PARMS is a chain of PARM_DECL nodes. */
2831 dbxout_reg_parms (parms
)
2834 for (; parms
; parms
= TREE_CHAIN (parms
))
2835 if (DECL_NAME (parms
) && PARM_PASSED_IN_MEMORY (parms
))
2837 dbxout_prepare_symbol (parms
);
2839 /* Report parms that live in registers during the function
2840 but were passed in memory. */
2841 if (GET_CODE (DECL_RTL (parms
)) == REG
2842 && REGNO (DECL_RTL (parms
)) < FIRST_PSEUDO_REGISTER
)
2843 dbxout_symbol_location (parms
, TREE_TYPE (parms
),
2844 0, DECL_RTL (parms
));
2845 else if (GET_CODE (DECL_RTL (parms
)) == CONCAT
)
2846 dbxout_symbol_location (parms
, TREE_TYPE (parms
),
2847 0, DECL_RTL (parms
));
2848 /* Report parms that live in memory but not where they were passed. */
2849 else if (GET_CODE (DECL_RTL (parms
)) == MEM
2850 && ! rtx_equal_p (DECL_RTL (parms
), DECL_INCOMING_RTL (parms
)))
2851 dbxout_symbol_location (parms
, TREE_TYPE (parms
),
2852 0, DECL_RTL (parms
));
2856 /* Given a chain of ..._TYPE nodes (as come in a parameter list),
2857 output definitions of those names, in raw form */
2865 putc (',', asmfile
);
2866 dbxout_type (TREE_VALUE (args
), 0);
2868 args
= TREE_CHAIN (args
);
2872 /* Output everything about a symbol block (a BLOCK node
2873 that represents a scope level),
2874 including recursive output of contained blocks.
2876 BLOCK is the BLOCK node.
2877 DEPTH is its depth within containing symbol blocks.
2878 ARGS is usually zero; but for the outermost block of the
2879 body of a function, it is a chain of PARM_DECLs for the function parameters.
2880 We output definitions of all the register parms
2881 as if they were local variables of that block.
2883 If -g1 was used, we count blocks just the same, but output nothing
2884 except for the outermost block.
2886 Actually, BLOCK may be several blocks chained together.
2887 We handle them all in sequence. */
2890 dbxout_block (block
, depth
, args
)
2897 #if DBX_BLOCKS_FUNCTION_RELATIVE
2898 const char *begin_label
;
2899 if (current_function_func_begin_label
!= NULL_TREE
)
2900 begin_label
= IDENTIFIER_POINTER (current_function_func_begin_label
);
2902 begin_label
= XSTR (XEXP (DECL_RTL (current_function_decl
), 0), 0);
2907 /* Ignore blocks never expanded or otherwise marked as real. */
2908 if (TREE_USED (block
) && TREE_ASM_WRITTEN (block
))
2912 #ifdef DBX_LBRAC_FIRST
2915 /* In dbx format, the syms of a block come before the N_LBRAC.
2916 If nothing is output, we don't need the N_LBRAC, either. */
2918 if (debug_info_level
!= DINFO_LEVEL_TERSE
|| depth
== 0)
2919 did_output
= dbxout_syms (BLOCK_VARS (block
));
2921 dbxout_reg_parms (args
);
2924 /* Now output an N_LBRAC symbol to represent the beginning of
2925 the block. Use the block's tree-walk order to generate
2926 the assembler symbols LBBn and LBEn
2927 that final will define around the code in this block. */
2928 if (depth
> 0 && did_output
)
2931 blocknum
= BLOCK_NUMBER (block
);
2932 ASM_GENERATE_INTERNAL_LABEL (buf
, "LBB", blocknum
);
2934 if (BLOCK_HANDLER_BLOCK (block
))
2936 /* A catch block. Must precede N_LBRAC. */
2937 tree decl
= BLOCK_VARS (block
);
2940 #ifdef DBX_OUTPUT_CATCH
2941 DBX_OUTPUT_CATCH (asmfile
, decl
, buf
);
2943 fprintf (asmfile
, "%s\"%s:C1\",%d,0,0,", ASM_STABS_OP
,
2944 IDENTIFIER_POINTER (DECL_NAME (decl
)), N_CATCH
);
2945 assemble_name (asmfile
, buf
);
2946 fprintf (asmfile
, "\n");
2948 decl
= TREE_CHAIN (decl
);
2952 #ifdef DBX_OUTPUT_LBRAC
2953 DBX_OUTPUT_LBRAC (asmfile
, buf
);
2955 fprintf (asmfile
, "%s%d,0,0,", ASM_STABN_OP
, N_LBRAC
);
2956 assemble_name (asmfile
, buf
);
2957 #if DBX_BLOCKS_FUNCTION_RELATIVE
2958 putc ('-', asmfile
);
2959 assemble_name (asmfile
, begin_label
);
2961 fprintf (asmfile
, "\n");
2965 #ifdef DBX_LBRAC_FIRST
2966 /* On some weird machines, the syms of a block
2967 come after the N_LBRAC. */
2968 if (debug_info_level
!= DINFO_LEVEL_TERSE
|| depth
== 0)
2969 dbxout_syms (BLOCK_VARS (block
));
2971 dbxout_reg_parms (args
);
2974 /* Output the subblocks. */
2975 dbxout_block (BLOCK_SUBBLOCKS (block
), depth
+ 1, NULL_TREE
);
2977 /* Refer to the marker for the end of the block. */
2978 if (depth
> 0 && did_output
)
2981 ASM_GENERATE_INTERNAL_LABEL (buf
, "LBE", blocknum
);
2982 #ifdef DBX_OUTPUT_RBRAC
2983 DBX_OUTPUT_RBRAC (asmfile
, buf
);
2985 fprintf (asmfile
, "%s%d,0,0,", ASM_STABN_OP
, N_RBRAC
);
2986 assemble_name (asmfile
, buf
);
2987 #if DBX_BLOCKS_FUNCTION_RELATIVE
2988 putc ('-', asmfile
);
2989 assemble_name (asmfile
, begin_label
);
2991 fprintf (asmfile
, "\n");
2995 block
= BLOCK_CHAIN (block
);
2999 /* Output the information about a function and its arguments and result.
3000 Usually this follows the function's code,
3001 but on some systems, it comes before. */
3003 #if defined (DBX_DEBUGGING_INFO)
3005 dbxout_begin_function (decl
)
3008 dbxout_symbol (decl
, 0);
3009 dbxout_parms (DECL_ARGUMENTS (decl
));
3010 if (DECL_NAME (DECL_RESULT (decl
)) != 0)
3011 dbxout_symbol (DECL_RESULT (decl
), 1);
3013 #endif /* DBX_DEBUGGING_INFO */
3015 #endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */
3017 #include "gt-dbxout.h"