1 /* Output dbx-format symbol table information from GNU compiler.
2 Copyright (C) 1987, 1988, 1992 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
21 /* Output dbx-format symbol table data.
22 This consists of many symbol table entries, each of them
23 a .stabs assembler pseudo-op with four operands:
24 a "name" which is really a description of one symbol and its type,
25 a "code", which is a symbol defined in stab.h whose name starts with N_,
26 an unused operand always 0,
27 and a "value" which is an address or an offset.
28 The name is enclosed in doublequote characters.
30 Each function, variable, typedef, and structure tag
31 has a symbol table entry to define it.
32 The beginning and end of each level of name scoping within
33 a function are also marked by special symbol table entries.
35 The "name" consists of the symbol name, a colon, a kind-of-symbol letter,
36 and a data type number. The data type number may be followed by
37 "=" and a type definition; normally this will happen the first time
38 the type number is mentioned. The type definition may refer to
39 other types by number, and those type numbers may be followed
40 by "=" and nested definitions.
42 This can make the "name" quite long.
43 When a name is more than 80 characters, we split the .stabs pseudo-op
44 into two .stabs pseudo-ops, both sharing the same "code" and "value".
45 The first one is marked as continued with a double-backslash at the
48 The kind-of-symbol letter distinguished function names from global
49 variables from file-scope variables from parameters from auto
50 variables in memory from typedef names from register variables.
53 The "code" is mostly redundant with the kind-of-symbol letter
54 that goes in the "name", but not entirely: for symbols located
55 in static storage, the "code" says which segment the address is in,
56 which controls how it is relocated.
58 The "value" for a symbol in static storage
59 is the core address of the symbol (actually, the assembler
60 label for the symbol). For a symbol located in a stack slot
61 it is the stack offset; for one in a register, the register number.
62 For a typedef symbol, it is zero.
64 If DEBUG_SYMS_TEXT is defined, all debugging symbols must be
65 output while in the text section.
67 For more on data type definitions, see `dbxout_type'. */
69 /* Include these first, because they may define MIN and MAX. */
78 #include "insn-config.h"
81 #include "output.h" /* ASM_OUTPUT_SOURCE_LINE may refer to sdb functions. */
87 #ifdef XCOFF_DEBUGGING_INFO
92 #define ASM_STABS_OP ".stabs"
96 #define ASM_STABN_OP ".stabn"
99 #ifndef DBX_TYPE_DECL_STABS_CODE
100 #define DBX_TYPE_DECL_STABS_CODE N_LSYM
103 #ifndef DBX_STATIC_CONST_VAR_CODE
104 #define DBX_STATIC_CONST_VAR_CODE N_FUN
107 #ifndef DBX_REGPARM_STABS_CODE
108 #define DBX_REGPARM_STABS_CODE N_RSYM
111 #ifndef DBX_REGPARM_STABS_LETTER
112 #define DBX_REGPARM_STABS_LETTER 'P'
115 #ifndef DBX_MEMPARM_STABS_LETTER
116 #define DBX_MEMPARM_STABS_LETTER 'p'
119 /* Nonzero means if the type has methods, only output debugging
120 information if methods are actually written to the asm file. */
122 static int flag_minimal_debug = 1;
124 /* Nonzero if we have actually used any of the GDB extensions
125 to the debugging format. The idea is that we use them for the
126 first time only if there's a strong reason, but once we have done that,
127 we use them whenever convenient. */
129 static int have_used_extensions = 0;
133 /* Typical USG systems don't have stab.h, and they also have
134 no use for DBX-format debugging info. */
136 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
138 #ifdef DEBUG_SYMS_TEXT
139 #define FORCE_TEXT text_section ();
144 #if defined (USG) || defined (NO_STAB_H)
145 #include "gstab.h" /* If doing DBX on sysV, use our own stab.h. */
147 #include <stab.h> /* On BSD, use the system's stab.h. */
149 /* This is a GNU extension we need to reference in this file. */
156 #define STAB_CODE_TYPE enum __stab_debug_code
158 #define STAB_CODE_TYPE int
161 /* 1 if PARM is passed to this function in memory. */
163 #define PARM_PASSED_IN_MEMORY(PARM) \
164 (GET_CODE (DECL_INCOMING_RTL (PARM)) == MEM)
166 /* A C expression for the integer offset value of an automatic variable
167 (N_LSYM) having address X (an RTX). */
168 #ifndef DEBUGGER_AUTO_OFFSET
169 #define DEBUGGER_AUTO_OFFSET(X) \
170 (GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0)
173 /* A C expression for the integer offset value of an argument (N_PSYM)
174 having address X (an RTX). The nominal offset is OFFSET. */
175 #ifndef DEBUGGER_ARG_OFFSET
176 #define DEBUGGER_ARG_OFFSET(OFFSET, X) (OFFSET)
179 /* Stream for writing to assembler file. */
181 static FILE *asmfile;
183 /* Last source file name mentioned in a NOTE insn. */
185 static char *lastfile;
187 /* Current working directory. */
191 enum typestatus {TYPE_UNSEEN, TYPE_XREF, TYPE_DEFINED};
193 /* Vector recording the status of describing C data types.
194 When we first notice a data type (a tree node),
195 we assign it a number using next_type_number.
196 That is its index in this vector.
197 The vector element says whether we have yet output
198 the definition of the type. TYPE_XREF says we have
199 output it as a cross-reference only. */
201 enum typestatus *typevec;
203 /* Number of elements of space allocated in `typevec'. */
205 static int typevec_len;
207 /* In dbx output, each type gets a unique number.
208 This is the number for the next type output.
209 The number, once assigned, is in the TYPE_SYMTAB_ADDRESS field. */
211 static int next_type_number;
213 /* In dbx output, we must assign symbol-blocks id numbers
214 in the order in which their beginnings are encountered.
215 We output debugging info that refers to the beginning and
216 end of the ranges of code in each block
217 with assembler labels LBBn and LBEn, where n is the block number.
218 The labels are generated in final, which assigns numbers to the
219 blocks in the same way. */
221 static int next_block_number;
223 /* These variables are for dbxout_symbol to communicate to
224 dbxout_finish_symbol.
225 current_sym_code is the symbol-type-code, a symbol N_... define in stab.h.
226 current_sym_value and current_sym_addr are two ways to address the
227 value to store in the symtab entry.
228 current_sym_addr if nonzero represents the value as an rtx.
229 If that is zero, current_sym_value is used. This is used
230 when the value is an offset (such as for auto variables,
231 register variables and parms). */
233 static STAB_CODE_TYPE current_sym_code;
234 static int current_sym_value;
235 static rtx current_sym_addr;
237 /* Number of chars of symbol-description generated so far for the
238 current symbol. Used by CHARS and CONTIN. */
240 static int current_sym_nchars;
242 /* Report having output N chars of the current symbol-description. */
244 #define CHARS(N) (current_sym_nchars += (N))
246 /* Break the current symbol-description, generating a continuation,
247 if it has become long. */
249 #ifndef DBX_CONTIN_LENGTH
250 #define DBX_CONTIN_LENGTH 80
253 #if DBX_CONTIN_LENGTH > 0
255 do {if (current_sym_nchars > DBX_CONTIN_LENGTH) dbxout_continue ();} while (0)
260 void dbxout_types ();
262 void dbxout_symbol ();
263 static void dbxout_type_name ();
264 static void dbxout_type ();
265 static void dbxout_typedefs ();
266 static void dbxout_prepare_symbol ();
267 static void dbxout_finish_symbol ();
268 static void dbxout_continue ();
269 static void print_int_cst_octal ();
270 static void print_octal ();
272 #if 0 /* Not clear we will actually need this. */
274 /* Return the absolutized filename for the given relative
275 filename. Note that if that filename is already absolute, it may
276 still be returned in a modified form because this routine also
277 eliminates redundant slashes and single dots and eliminates double
278 dots to get a shortest possible filename from the given input
279 filename. The absolutization of relative filenames is made by
280 assuming that the given filename is to be taken as relative to
281 the first argument (cwd) or to the current directory if cwd is
285 abspath (rel_filename)
288 /* Setup the current working directory as needed. */
290 = (char *) alloca (strlen (cwd) + strlen (rel_filename) + 1);
291 char *endp = abs_buffer;
295 /* Copy the filename (possibly preceded by the current working
296 directory name) into the absolutization buffer. */
301 if (rel_filename[0] != '/')
304 while (*endp++ = *src_p++)
306 *(endp-1) = '/'; /* overwrite null */
308 src_p = rel_filename;
309 while (*endp++ = *src_p++)
314 /* Now make a copy of abs_buffer into abs_buffer, shortening the
315 filename (by taking out slashes and dots) as we go. */
317 outp = inp = abs_buffer;
318 *outp++ = *inp++; /* copy first slash */
323 else if (inp[0] == '/' && outp[-1] == '/')
328 else if (inp[0] == '.' && outp[-1] == '/')
332 else if (inp[1] == '/')
337 else if ((inp[1] == '.') && (inp[2] == 0 || inp[2] == '/'))
339 inp += (inp[2] == '/') ? 3 : 2;
341 while (outp >= abs_buffer && *outp != '/')
343 if (outp < abs_buffer)
345 /* Catch cases like /.. where we try to backup to a
346 point above the absolute root of the logical file
349 fprintf (stderr, "%s: invalid file name: %s\n",
350 pname, rel_filename);
360 /* On exit, make sure that there is a trailing null, and make sure that
361 the last character of the returned string is *not* a slash. */
367 /* Make a copy (in the heap) of the stuff left in the absolutization
368 buffer and return a pointer to the copy. */
370 value = (char *) oballoc (strlen (abs_buffer) + 1);
371 strcpy (value, abs_buffer);
376 /* At the beginning of compilation, start writing the symbol table.
377 Initialize `typevec' and output the standard data types of C. */
380 dbxout_init (asm_file, input_file_name, syms)
382 char *input_file_name;
385 char ltext_label_name[100];
390 typevec = (enum typestatus *) xmalloc (typevec_len * sizeof typevec[0]);
391 bzero (typevec, typevec_len * sizeof typevec[0]);
393 /* Convert Ltext into the appropriate format for local labels in case
394 the system doesn't insert underscores in front of user generated
396 ASM_GENERATE_INTERNAL_LABEL (ltext_label_name, "Ltext", 0);
398 /* Put the current working directory in an N_SO symbol. */
399 #ifndef DBX_WORKING_DIRECTORY /* Only some versions of DBX want this,
400 but GDB always does. */
401 if (use_gnu_debug_info_extensions)
404 if (cwd || (cwd = getpwd ()))
406 #ifdef DBX_OUTPUT_MAIN_SOURCE_DIRECTORY
407 DBX_OUTPUT_MAIN_SOURCE_DIRECTORY (asmfile, cwd);
408 #else /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */
409 fprintf (asmfile, "%s \"%s/\",%d,0,0,%s\n", ASM_STABS_OP,
410 cwd, N_SO, <ext_label_name[1]);
411 #endif /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */
415 #ifdef DBX_OUTPUT_MAIN_SOURCE_FILENAME
416 /* This should NOT be DBX_OUTPUT_SOURCE_FILENAME. That
417 would give us an N_SOL, and we want an N_SO. */
418 DBX_OUTPUT_MAIN_SOURCE_FILENAME (asmfile, input_file_name);
419 #else /* no DBX_OUTPUT_MAIN_SOURCE_FILENAME */
420 /* We include outputting `Ltext:' here,
421 because that gives you a way to override it. */
422 /* Used to put `Ltext:' before the reference, but that loses on sun 4. */
423 fprintf (asmfile, "%s \"%s\",%d,0,0,%s\n", ASM_STABS_OP, input_file_name,
424 N_SO, <ext_label_name[1]);
426 ASM_OUTPUT_INTERNAL_LABEL (asmfile, "Ltext", 0);
427 #endif /* no DBX_OUTPUT_MAIN_SOURCE_FILENAME */
429 /* Possibly output something to inform GDB that this compilation was by
430 GCC. It's easier for GDB to parse it when after the N_SO's. This
431 is used in Solaris 2. */
432 #ifdef ASM_IDENTIFY_GCC_AFTER_SOURCE
433 ASM_IDENTIFY_GCC_AFTER_SOURCE (asmfile);
436 lastfile = input_file_name;
438 next_type_number = 1;
439 next_block_number = 2;
441 /* Make sure that types `int' and `char' have numbers 1 and 2.
442 Definitions of other integer types will refer to those numbers.
443 (Actually it should no longer matter what their numbers are.
444 Also, if any types with tags have been defined, dbxout_symbol
445 will output them first, so the numbers won't be 1 and 2. That
446 happens in C++. So it's a good thing it should no longer matter). */
448 #ifdef DBX_OUTPUT_STANDARD_TYPES
449 DBX_OUTPUT_STANDARD_TYPES (syms);
451 dbxout_symbol (TYPE_NAME (integer_type_node), 0);
452 dbxout_symbol (TYPE_NAME (char_type_node), 0);
455 /* Get all permanent types that have typedef names,
456 and output them all, except for those already output. */
458 dbxout_typedefs (syms);
461 /* Output any typedef names for types described by TYPE_DECLs in SYMS,
462 in the reverse order from that which is found in SYMS. */
465 dbxout_typedefs (syms)
470 dbxout_typedefs (TREE_CHAIN (syms));
471 if (TREE_CODE (syms) == TYPE_DECL)
473 tree type = TREE_TYPE (syms);
475 && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
476 && ! TREE_ASM_WRITTEN (TYPE_NAME (type)))
477 dbxout_symbol (TYPE_NAME (type), 0);
482 /* Output debugging info to FILE to switch to sourcefile FILENAME. */
485 dbxout_source_file (file, filename)
489 char ltext_label_name[100];
491 if (filename && (lastfile == 0 || strcmp (filename, lastfile)))
493 #ifdef DBX_OUTPUT_SOURCE_FILENAME
494 DBX_OUTPUT_SOURCE_FILENAME (file, filename);
496 ASM_GENERATE_INTERNAL_LABEL (ltext_label_name, "Ltext", 0);
497 fprintf (file, "%s \"%s\",%d,0,0,%s\n", ASM_STABS_OP,
498 filename, N_SOL, <ext_label_name[1]);
504 /* Output a line number symbol entry into output stream FILE,
505 for source file FILENAME and line number LINENO. */
508 dbxout_source_line (file, filename, lineno)
513 dbxout_source_file (file, filename);
515 #ifdef ASM_OUTPUT_SOURCE_LINE
516 ASM_OUTPUT_SOURCE_LINE (file, lineno);
518 fprintf (file, "\t%s %d,0,%d\n", ASM_STABD_OP, N_SLINE, lineno);
522 /* At the end of compilation, finish writing the symbol table.
523 Unless you define DBX_OUTPUT_MAIN_SOURCE_FILE_END, the default is
527 dbxout_finish (file, filename)
531 #ifdef DBX_OUTPUT_MAIN_SOURCE_FILE_END
532 DBX_OUTPUT_MAIN_SOURCE_FILE_END (file, filename);
533 #endif /* DBX_OUTPUT_MAIN_SOURCE_FILE_END */
536 /* Continue a symbol-description that gets too big.
537 End one symbol table entry with a double-backslash
538 and start a new one, eventually producing something like
539 .stabs "start......\\",code,0,value
540 .stabs "...rest",code,0,value */
545 #ifdef DBX_CONTIN_CHAR
546 fprintf (asmfile, "%c", DBX_CONTIN_CHAR);
548 fprintf (asmfile, "\\\\");
550 dbxout_finish_symbol (NULL_TREE);
551 fprintf (asmfile, "%s \"", ASM_STABS_OP);
552 current_sym_nchars = 0;
555 /* Subroutine of `dbxout_type'. Output the type fields of TYPE.
556 This must be a separate function because anonymous unions require
560 dbxout_type_fields (type)
564 /* Output the name, type, position (in bits), size (in bits) of each
566 for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
568 /* For nameless subunions and subrecords, treat their fields as ours. */
569 if (DECL_NAME (tem) == NULL_TREE
570 && (TREE_CODE (TREE_TYPE (tem)) == UNION_TYPE
571 || TREE_CODE (TREE_TYPE (tem)) == RECORD_TYPE))
572 dbxout_type_fields (TREE_TYPE (tem));
573 /* Omit here local type decls until we know how to support them. */
574 else if (TREE_CODE (tem) == TYPE_DECL)
576 /* Omit here the nameless fields that are used to skip bits. */
577 else if (DECL_NAME (tem) != 0 && TREE_CODE (tem) != CONST_DECL)
579 /* Continue the line if necessary,
580 but not before the first field. */
581 if (tem != TYPE_FIELDS (type))
584 if (use_gnu_debug_info_extensions
585 && flag_minimal_debug
586 && TREE_CODE (tem) == FIELD_DECL
587 && DECL_VIRTUAL_P (tem)
588 && DECL_ASSEMBLER_NAME (tem))
590 have_used_extensions = 1;
591 CHARS (3 + IDENTIFIER_LENGTH (DECL_NAME (TYPE_NAME (DECL_FCONTEXT (tem)))));
592 fputs (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (tem)), asmfile);
593 dbxout_type (DECL_FCONTEXT (tem), 0, 0);
594 fprintf (asmfile, ":");
595 dbxout_type (TREE_TYPE (tem), 0, 0);
596 fprintf (asmfile, ",%d;",
597 TREE_INT_CST_LOW (DECL_FIELD_BITPOS (tem)));
601 fprintf (asmfile, "%s:", IDENTIFIER_POINTER (DECL_NAME (tem)));
602 CHARS (2 + IDENTIFIER_LENGTH (DECL_NAME (tem)));
604 if (use_gnu_debug_info_extensions
605 && (TREE_PRIVATE (tem) || TREE_PROTECTED (tem)
606 || TREE_CODE (tem) != FIELD_DECL))
608 have_used_extensions = 1;
610 putc ((TREE_PRIVATE (tem) ? '0'
611 : TREE_PROTECTED (tem) ? '1' : '2'),
616 dbxout_type ((TREE_CODE (tem) == FIELD_DECL
617 && DECL_BIT_FIELD_TYPE (tem))
618 ? DECL_BIT_FIELD_TYPE (tem)
619 : TREE_TYPE (tem), 0, 0);
621 if (TREE_CODE (tem) == VAR_DECL)
623 if (TREE_STATIC (tem) && use_gnu_debug_info_extensions)
625 char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (tem));
626 have_used_extensions = 1;
627 fprintf (asmfile, ":%s;", name);
628 CHARS (strlen (name));
632 /* If TEM is non-static, GDB won't understand it. */
633 fprintf (asmfile, ",0,0;");
636 else if (TREE_CODE (DECL_FIELD_BITPOS (tem)) == INTEGER_CST)
638 fprintf (asmfile, ",%d,%d;",
639 TREE_INT_CST_LOW (DECL_FIELD_BITPOS (tem)),
640 TREE_INT_CST_LOW (DECL_SIZE (tem)));
643 /* This has yet to be implemented. */
650 /* Subroutine of `dbxout_type_methods'. Output debug info about the
651 method described DECL. DEBUG_NAME is an encoding of the method's
652 type signature. ??? We may be able to do without DEBUG_NAME altogether
656 dbxout_type_method_1 (decl, debug_name)
660 tree firstarg = TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl)));
663 if (TREE_CODE (TREE_TYPE (decl)) == FUNCTION_TYPE)
665 else /* it's a METHOD_TYPE. */
667 /* A for normal functions.
668 B for `const' member functions.
669 C for `volatile' member functions.
670 D for `const volatile' member functions. */
671 if (TYPE_READONLY (TREE_TYPE (firstarg)))
673 if (TYPE_VOLATILE (TREE_TYPE (firstarg)))
676 if (DECL_VINDEX (decl))
682 fprintf (asmfile, ":%s;%c%c%c", debug_name,
683 TREE_PRIVATE (decl) ? '0' : TREE_PROTECTED (decl) ? '1' : '2', c1, c2);
684 CHARS (IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (decl)) + 6
685 - (debug_name - IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))));
686 if (DECL_VINDEX (decl))
688 fprintf (asmfile, "%d;",
689 TREE_INT_CST_LOW (DECL_VINDEX (decl)));
690 dbxout_type (DECL_CONTEXT (decl), 0, 0);
691 fprintf (asmfile, ";");
696 /* Subroutine of `dbxout_type'. Output debug info about the methods defined
700 dbxout_type_methods (type)
703 /* C++: put out the method names and their parameter lists */
704 tree methods = TYPE_METHODS (type);
706 register tree fndecl;
708 char formatted_type_identifier_length[16];
709 register int type_identifier_length;
711 if (methods == NULL_TREE)
714 type_encoding = DECL_NAME (TYPE_NAME (type));
716 /* C++: Template classes break some assumptions made by this code about
717 the class names, constructor names, and encodings for assembler
718 label names. For now, disable output of dbx info for them. */
720 char *ptr = IDENTIFIER_POINTER (type_encoding);
721 /* This should use index. (mrs) */
722 while (*ptr && *ptr != '<') ptr++;
729 warning ("dbx info for template class methods not yet supported");
735 type_identifier_length = IDENTIFIER_LENGTH (type_encoding);
737 sprintf(formatted_type_identifier_length, "%d", type_identifier_length);
739 if (TREE_CODE (methods) == FUNCTION_DECL)
741 else if (TREE_VEC_ELT (methods, 0) != NULL_TREE)
742 fndecl = TREE_VEC_ELT (methods, 0);
744 fndecl = TREE_VEC_ELT (methods, 1);
748 tree name = DECL_NAME (fndecl);
751 /* Group together all the methods for the same operation.
752 These differ in the types of the arguments. */
753 for (last = NULL_TREE;
754 fndecl && (last == NULL_TREE || DECL_NAME (fndecl) == DECL_NAME (last));
755 fndecl = TREE_CHAIN (fndecl))
756 /* Output the name of the field (after overloading), as
757 well as the name of the field before overloading, along
758 with its parameter list */
760 /* This is the "mangled" name of the method.
761 It encodes the argument types. */
762 char *debug_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fndecl));
769 if (DECL_IGNORED_P (fndecl))
772 if (flag_minimal_debug)
774 /* Detect ordinary methods because their mangled names
775 start with the operation name. */
776 if (!strncmp (IDENTIFIER_POINTER (name), debug_name,
777 IDENTIFIER_LENGTH (name)))
779 debug_name += IDENTIFIER_LENGTH (name);
780 if (debug_name[0] == '_' && debug_name[1] == '_')
782 char *method_name = debug_name + 2;
783 char *length_ptr = formatted_type_identifier_length;
784 /* Get past const and volatile qualifiers. */
785 while (*method_name == 'C' || *method_name == 'V')
787 /* Skip digits for length of type_encoding. */
788 while (*method_name == *length_ptr && *length_ptr)
789 length_ptr++, method_name++;
790 if (! strncmp (method_name,
791 IDENTIFIER_POINTER (type_encoding),
792 type_identifier_length))
793 method_name += type_identifier_length;
794 debug_name = method_name;
797 /* Detect constructors by their style of name mangling. */
798 else if (debug_name[0] == '_' && debug_name[1] == '_')
800 char *ctor_name = debug_name + 2;
801 char *length_ptr = formatted_type_identifier_length;
802 while (*ctor_name == 'C' || *ctor_name == 'V')
804 /* Skip digits for length of type_encoding. */
805 while (*ctor_name == *length_ptr && *length_ptr)
806 length_ptr++, ctor_name++;
807 if (!strncmp (IDENTIFIER_POINTER (type_encoding), ctor_name,
808 type_identifier_length))
809 debug_name = ctor_name + type_identifier_length;
811 /* The other alternative is a destructor. */
815 /* Output the operation name just once, for the first method
819 fprintf (asmfile, "%s::", IDENTIFIER_POINTER (name));
820 CHARS (IDENTIFIER_LENGTH (name) + 2);
825 dbxout_type (TREE_TYPE (fndecl), 0, destructor);
827 dbxout_type_method_1 (fndecl, debug_name);
837 /* Output a reference to a type. If the type has not yet been
838 described in the dbx output, output its definition now.
839 For a type already defined, just refer to its definition
840 using the type number.
842 If FULL is nonzero, and the type has been described only with
843 a forward-reference, output the definition now.
844 If FULL is zero in this case, just refer to the forward-reference
845 using the number previously allocated.
847 If SHOW_ARG_TYPES is nonzero, we output a description of the argument
848 types for a METHOD_TYPE. */
851 dbxout_type (type, full, show_arg_types)
858 /* If there was an input error and we don't really have a type,
859 avoid crashing and write something that is at least valid
860 by assuming `int'. */
861 if (type == error_mark_node)
862 type = integer_type_node;
865 type = TYPE_MAIN_VARIANT (type);
867 && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
868 && DECL_IGNORED_P (TYPE_NAME (type)))
872 if (TYPE_SYMTAB_ADDRESS (type) == 0)
874 /* Type has no dbx number assigned. Assign next available number. */
875 TYPE_SYMTAB_ADDRESS (type) = next_type_number++;
877 /* Make sure type vector is long enough to record about this type. */
879 if (next_type_number == typevec_len)
881 typevec = (enum typestatus *) xrealloc (typevec, typevec_len * 2 * sizeof typevec[0]);
882 bzero (typevec + typevec_len, typevec_len * sizeof typevec[0]);
887 /* Output the number of this type, to refer to it. */
888 fprintf (asmfile, "%d", TYPE_SYMTAB_ADDRESS (type));
891 #ifdef DBX_TYPE_DEFINED
892 if (DBX_TYPE_DEFINED (type))
896 /* If this type's definition has been output or is now being output,
899 switch (typevec[TYPE_SYMTAB_ADDRESS (type)])
904 /* If we have already had a cross reference,
905 and either that's all we want or that's the best we could do,
906 don't repeat the cross reference.
907 Sun dbx crashes if we do. */
908 if (! full || TYPE_SIZE (type) == 0
909 /* No way in DBX fmt to describe a variable size. */
910 || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
918 /* For systems where dbx output does not allow the `=xsNAME:' syntax,
919 leave the type-number completely undefined rather than output
920 a cross-reference. */
921 if (TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE
922 || TREE_CODE (type) == ENUMERAL_TYPE)
924 if ((TYPE_NAME (type) != 0 && !full)
925 || TYPE_SIZE (type) == 0)
927 typevec[TYPE_SYMTAB_ADDRESS (type)] = TYPE_XREF;
932 /* Output a definition now. */
934 fprintf (asmfile, "=");
937 /* Mark it as defined, so that if it is self-referent
938 we will not get into an infinite recursion of definitions. */
940 typevec[TYPE_SYMTAB_ADDRESS (type)] = TYPE_DEFINED;
942 switch (TREE_CODE (type))
946 /* For a void type, just define it as itself; ie, "5=5".
947 This makes us consider it defined
948 without saying what it is. The debugger will make it
949 a void type when the reference is seen, and nothing will
950 ever override that default. */
951 fprintf (asmfile, "%d", TYPE_SYMTAB_ADDRESS (type));
956 if (type == char_type_node && ! TREE_UNSIGNED (type))
957 /* Output the type `char' as a subrange of itself!
958 I don't understand this definition, just copied it
959 from the output of pcc.
960 This used to use `r2' explicitly and we used to
961 take care to make sure that `char' was type number 2. */
962 fprintf (asmfile, "r%d;0;127;", TYPE_SYMTAB_ADDRESS (type));
964 else if (TYPE_PRECISION (type) > BITS_PER_WORD)
966 /* This used to say `r1' and we used to take care
967 to make sure that `int' was type number 1. */
968 fprintf (asmfile, "r%d;", TYPE_SYMTAB_ADDRESS (integer_type_node));
969 print_int_cst_octal (TYPE_MIN_VALUE (type));
970 fprintf (asmfile, ";");
971 print_int_cst_octal (TYPE_MAX_VALUE (type));
972 fprintf (asmfile, ";");
976 /* Output other integer types as subranges of `int'. */
977 /* This used to say `r1' and we used to take care
978 to make sure that `int' was type number 1. */
979 fprintf (asmfile, "r%d;%d;%d;",
980 TYPE_SYMTAB_ADDRESS (integer_type_node),
981 TREE_INT_CST_LOW (TYPE_MIN_VALUE (type)),
982 TREE_INT_CST_LOW (TYPE_MAX_VALUE (type)));
987 /* This used to say `r1' and we used to take care
988 to make sure that `int' was type number 1. */
989 fprintf (asmfile, "r%d;%d;0;", TYPE_SYMTAB_ADDRESS (integer_type_node),
990 TREE_INT_CST_LOW (size_in_bytes (type)));
995 /* Output the type `char' as a subrange of itself.
996 That is what pcc seems to do. */
997 fprintf (asmfile, "r%d;0;%d;", TYPE_SYMTAB_ADDRESS (char_type_node),
998 TREE_UNSIGNED (type) ? 255 : 127);
1002 case BOOLEAN_TYPE: /* Define as enumeral type (False, True) */
1003 fprintf (asmfile, "eFalse:0,True:1,;");
1008 putc ('d', asmfile);
1010 dbxout_type (TREE_TYPE (type), 0);
1014 /* Differs from the REAL_TYPE by its new data type number */
1016 if (TREE_CODE (TREE_TYPE (type)) == REAL_TYPE)
1018 fprintf (asmfile, "r%d;%d;0;",
1019 TYPE_SYMTAB_ADDRESS (type),
1020 TREE_INT_CST_LOW (size_in_bytes (TREE_TYPE (type))));
1021 CHARS (15); /* The number is propably incorrect here */
1023 abort (); /* What to do with CSImode complex? */
1027 putc ('S', asmfile);
1029 dbxout_type (TREE_TYPE (type), 0);
1033 /* Output "a" followed by a range type definition
1034 for the index type of the array
1035 followed by a reference to the target-type.
1036 ar1;0;N;M for an array of type M and size N. */
1037 /* This used to say `r1' and we used to take care
1038 to make sure that `int' was type number 1. */
1039 fprintf (asmfile, "ar%d;0;%d;", TYPE_SYMTAB_ADDRESS (integer_type_node),
1042 ? TREE_INT_CST_LOW (TYPE_MAX_VALUE (TYPE_DOMAIN (type)))
1045 dbxout_type (TREE_TYPE (type), 0, 0);
1051 int i, n_baseclasses = 0;
1053 if (TYPE_BINFO (type) != 0 && TYPE_BINFO_BASETYPES (type) != 0)
1054 n_baseclasses = TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (type));
1056 /* Output a structure type. */
1057 if ((TYPE_NAME (type) != 0
1058 #if 0 /* Tiemann says this creates output tha "confuses GDB".
1059 Too bad the info is so vague. Hope this doesn't lose. */
1060 && ! (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
1061 && DECL_IGNORED_P (TYPE_NAME (type)))
1064 || TYPE_SIZE (type) == 0
1065 /* No way in DBX fmt to describe a variable size. */
1066 || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
1068 /* If the type is just a cross reference, output one
1069 and mark the type as partially described.
1070 If it later becomes defined, we will output
1071 its real definition.
1072 If the type has a name, don't nest its definition within
1073 another type's definition; instead, output an xref
1074 and let the definition come when the name is defined. */
1075 fprintf (asmfile, (TREE_CODE (type) == RECORD_TYPE) ? "xs" : "xu");
1077 #if 0 /* This assertion is legitimately false in C++. */
1078 /* We shouldn't be outputting a reference to a type before its
1079 definition unless the type has a tag name.
1080 A typedef name without a tag name should be impossible. */
1081 if (TREE_CODE (TYPE_NAME (type)) != IDENTIFIER_NODE)
1084 dbxout_type_name (type);
1085 fprintf (asmfile, ":");
1086 typevec[TYPE_SYMTAB_ADDRESS (type)] = TYPE_XREF;
1089 tem = size_in_bytes (type);
1091 /* Identify record or union, and print its size. */
1092 fprintf (asmfile, (TREE_CODE (type) == RECORD_TYPE) ? "s%d" : "u%d",
1093 TREE_INT_CST_LOW (tem));
1095 if (use_gnu_debug_info_extensions)
1099 have_used_extensions = 1;
1100 fprintf (asmfile, "!%d,", n_baseclasses);
1104 for (i = 0; i < n_baseclasses; i++)
1106 tree child = TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (type)), i);
1107 if (use_gnu_debug_info_extensions)
1109 have_used_extensions = 1;
1110 putc (TREE_VIA_VIRTUAL (child) ? '1'
1113 putc (TREE_VIA_PUBLIC (child) ? '2'
1116 fprintf (asmfile, "%d,",
1117 TREE_INT_CST_LOW (BINFO_OFFSET (child)) * BITS_PER_UNIT);
1119 dbxout_type (BINFO_TYPE (child), 0, 0);
1120 putc (';', asmfile);
1124 /* Print out the base class information with fields
1125 which have the same names at the types they hold. */
1126 dbxout_type_name (BINFO_TYPE (child));
1127 putc (':', asmfile);
1128 dbxout_type (BINFO_TYPE (child), full, 0);
1129 fprintf (asmfile, ",%d,%d;",
1130 TREE_INT_CST_LOW (BINFO_OFFSET (child)) * BITS_PER_UNIT,
1131 TREE_INT_CST_LOW (DECL_SIZE (TYPE_NAME (BINFO_TYPE (child)))) * BITS_PER_UNIT);
1139 /* Write out the field declarations. */
1140 dbxout_type_fields (type);
1141 if (use_gnu_debug_info_extensions && TYPE_METHODS (type) != NULL_TREE)
1143 have_used_extensions = 1;
1144 dbxout_type_methods (type);
1146 putc (';', asmfile);
1148 if (use_gnu_debug_info_extensions && TREE_CODE (type) == RECORD_TYPE
1149 /* Avoid the ~ if we don't really need it--it confuses dbx. */
1150 && TYPE_VFIELD (type))
1152 have_used_extensions = 1;
1154 /* Tell GDB+ that it may keep reading. */
1155 putc ('~', asmfile);
1157 /* We need to write out info about what field this class
1158 uses as its "main" vtable pointer field, because if this
1159 field is inherited from a base class, GDB cannot necessarily
1160 figure out which field it's using in time. */
1161 if (TYPE_VFIELD (type))
1163 putc ('%', asmfile);
1164 dbxout_type (DECL_FCONTEXT (TYPE_VFIELD (type)), 0, 0);
1166 putc (';', asmfile);
1172 if ((TYPE_NAME (type) != 0 && !full
1173 && (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
1174 && ! DECL_IGNORED_P (TYPE_NAME (type))))
1175 || TYPE_SIZE (type) == 0)
1177 fprintf (asmfile, "xe");
1179 dbxout_type_name (type);
1180 typevec[TYPE_SYMTAB_ADDRESS (type)] = TYPE_XREF;
1181 fprintf (asmfile, ":");
1184 #ifdef DBX_OUTPUT_ENUM
1185 DBX_OUTPUT_ENUM (asmfile, type);
1187 putc ('e', asmfile);
1189 for (tem = TYPE_VALUES (type); tem; tem = TREE_CHAIN (tem))
1191 fprintf (asmfile, "%s:%d,", IDENTIFIER_POINTER (TREE_PURPOSE (tem)),
1192 TREE_INT_CST_LOW (TREE_VALUE (tem)));
1193 CHARS (11 + IDENTIFIER_LENGTH (TREE_PURPOSE (tem)));
1194 if (TREE_CHAIN (tem) != 0)
1197 putc (';', asmfile);
1203 putc ('*', asmfile);
1205 dbxout_type (TREE_TYPE (type), 0, 0);
1209 if (use_gnu_debug_info_extensions)
1211 have_used_extensions = 1;
1212 putc ('#', asmfile);
1214 if (flag_minimal_debug && !show_arg_types)
1216 /* Normally, just output the return type.
1217 The argument types are encoded in the method name. */
1218 putc ('#', asmfile);
1219 dbxout_type (TREE_TYPE (type), 0, 0);
1220 putc (';', asmfile);
1225 /* When outputting destructors, we need to write
1226 the argument types out longhand. */
1227 dbxout_type (TYPE_METHOD_BASETYPE (type), 0, 0);
1228 putc (',', asmfile);
1230 dbxout_type (TREE_TYPE (type), 0, 0);
1231 dbxout_args (TYPE_ARG_TYPES (type));
1232 putc (';', asmfile);
1238 /* Treat it as a function type. */
1239 dbxout_type (TREE_TYPE (type), 0, 0);
1244 if (use_gnu_debug_info_extensions)
1246 have_used_extensions = 1;
1247 putc ('@', asmfile);
1249 dbxout_type (TYPE_OFFSET_BASETYPE (type), 0, 0);
1250 putc (',', asmfile);
1252 dbxout_type (TREE_TYPE (type), 0, 0);
1256 /* Should print as an int, because it is really
1258 dbxout_type (integer_type_node, 0, 0);
1262 case REFERENCE_TYPE:
1263 if (use_gnu_debug_info_extensions)
1264 have_used_extensions = 1;
1265 putc (use_gnu_debug_info_extensions ? '&' : '*', asmfile);
1267 dbxout_type (TREE_TYPE (type), 0, 0);
1271 putc ('f', asmfile);
1273 dbxout_type (TREE_TYPE (type), 0, 0);
1281 /* Print the value of integer constant C, in octal,
1282 handling double precision. */
1285 print_int_cst_octal (c)
1288 unsigned HOST_WIDE_INT high = TREE_INT_CST_HIGH (c);
1289 unsigned HOST_WIDE_INT low = TREE_INT_CST_LOW (c);
1290 int excess = (3 - (HOST_BITS_PER_WIDE_INT % 3));
1292 fprintf (asmfile, "0");
1296 print_octal (high, HOST_BITS_PER_WIDE_INT / 3);
1297 print_octal (low, HOST_BITS_PER_WIDE_INT / 3);
1301 unsigned HOST_WIDE_INT beg = high >> excess;
1302 unsigned HOST_WIDE_INT middle
1303 = ((high & (((HOST_WIDE_INT) 1 << excess) - 1)) << (3 - excess)
1304 | (low >> (HOST_BITS_PER_WIDE_INT / 3 * 3)));
1305 unsigned HOST_WIDE_INT end
1306 = low & (((HOST_WIDE_INT) 1 << (HOST_BITS_PER_WIDE_INT / 3 * 3)) - 1);
1307 fprintf (asmfile, "%o%01o", beg, middle);
1308 print_octal (end, HOST_BITS_PER_WIDE_INT / 3);
1313 print_octal (value, digits)
1314 unsigned HOST_WIDE_INT value;
1319 for (i = digits - 1; i >= 0; i--)
1320 fprintf (asmfile, "%01o", ((value >> (3 * i)) & 7));
1323 /* Output the name of type TYPE, with no punctuation.
1324 Such names can be set up either by typedef declarations
1325 or by struct, enum and union tags. */
1328 dbxout_type_name (type)
1332 if (TYPE_NAME (type) == 0)
1334 if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
1336 t = TYPE_NAME (type);
1338 else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL)
1340 t = DECL_NAME (TYPE_NAME (type));
1345 fprintf (asmfile, "%s", IDENTIFIER_POINTER (t));
1346 CHARS (IDENTIFIER_LENGTH (t));
1349 /* Output a .stabs for the symbol defined by DECL,
1350 which must be a ..._DECL node in the normal namespace.
1351 It may be a CONST_DECL, a FUNCTION_DECL, a PARM_DECL or a VAR_DECL.
1352 LOCAL is nonzero if the scope is less than the entire file. */
1355 dbxout_symbol (decl, local)
1360 tree type = TREE_TYPE (decl);
1361 tree context = NULL_TREE;
1364 /* Cast avoids warning in old compilers. */
1365 current_sym_code = (STAB_CODE_TYPE) 0;
1366 current_sym_value = 0;
1367 current_sym_addr = 0;
1369 /* Ignore nameless syms, but don't ignore type tags. */
1371 if ((DECL_NAME (decl) == 0 && TREE_CODE (decl) != TYPE_DECL)
1372 || DECL_IGNORED_P (decl))
1375 dbxout_prepare_symbol (decl);
1377 /* The output will always start with the symbol name,
1378 so always count that in the length-output-so-far. */
1380 if (DECL_NAME (decl) != 0)
1381 current_sym_nchars = 2 + IDENTIFIER_LENGTH (DECL_NAME (decl));
1383 switch (TREE_CODE (decl))
1386 /* Enum values are defined by defining the enum type. */
1390 if (DECL_RTL (decl) == 0)
1392 if (DECL_EXTERNAL (decl))
1394 /* Don't mention a nested function under its parent. */
1395 context = decl_function_context (decl);
1396 if (context == current_function_decl)
1398 if (GET_CODE (DECL_RTL (decl)) != MEM
1399 || GET_CODE (XEXP (DECL_RTL (decl), 0)) != SYMBOL_REF)
1403 fprintf (asmfile, "%s \"%s:%c", ASM_STABS_OP,
1404 IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)),
1405 TREE_PUBLIC (decl) ? 'F' : 'f');
1407 current_sym_code = N_FUN;
1408 current_sym_addr = XEXP (DECL_RTL (decl), 0);
1410 if (TREE_TYPE (type))
1411 dbxout_type (TREE_TYPE (type), 0, 0);
1413 dbxout_type (void_type_node, 0, 0);
1415 /* For a nested function, when that function is compiled,
1416 mention the containing function name
1417 as well as (since dbx wants it) our own assembler-name. */
1419 fprintf (asmfile, ",%s,%s",
1420 IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)),
1421 IDENTIFIER_POINTER (DECL_NAME (context)));
1423 dbxout_finish_symbol (decl);
1428 /* This seems all wrong. Outputting most kinds of types gives no name
1429 at all. A true definition gives no name; a cross-ref for a
1430 structure can give the tag name, but not a type name.
1431 It seems that no typedef name is defined by outputting a type. */
1433 /* If this typedef name was defined by outputting the type,
1434 don't duplicate it. */
1435 if (typevec[TYPE_SYMTAB_ADDRESS (type)] == TYPE_DEFINED
1436 && TYPE_NAME (TREE_TYPE (decl)) == decl)
1439 /* Don't output the same typedef twice.
1440 And don't output what language-specific stuff doesn't want output. */
1441 if (TREE_ASM_WRITTEN (decl) || DECL_IGNORED_P (decl))
1450 if (DECL_NAME (decl))
1452 /* Nonzero means we must output a tag as well as a typedef. */
1455 /* Handle the case of a C++ structure or union
1456 where the TYPE_NAME is a TYPE_DECL
1457 which gives both a typedef name and a tag. */
1458 /* dbx requires the tag first and the typedef second. */
1459 if ((TREE_CODE (type) == RECORD_TYPE
1460 || TREE_CODE (type) == UNION_TYPE)
1461 && TYPE_NAME (type) == decl
1462 && !(use_gnu_debug_info_extensions && have_used_extensions)
1463 && !TREE_ASM_WRITTEN (TYPE_NAME (type))
1464 /* Distinguish the implicit typedefs of C++
1465 from explicit ones that might be found in C. */
1466 && DECL_SOURCE_LINE (decl) == 0)
1468 tree name = TYPE_NAME (type);
1469 if (TREE_CODE (name) == TYPE_DECL)
1470 name = DECL_NAME (name);
1472 current_sym_code = DBX_TYPE_DECL_STABS_CODE;
1473 current_sym_value = 0;
1474 current_sym_addr = 0;
1475 current_sym_nchars = 2 + IDENTIFIER_LENGTH (name);
1477 fprintf (asmfile, "%s \"%s:T", ASM_STABS_OP,
1478 IDENTIFIER_POINTER (name));
1479 dbxout_type (type, 1, 0);
1480 dbxout_finish_symbol (NULL_TREE);
1483 /* Output typedef name. */
1484 fprintf (asmfile, "%s \"%s:", ASM_STABS_OP,
1485 IDENTIFIER_POINTER (DECL_NAME (decl)));
1487 /* Short cut way to output a tag also. */
1488 if ((TREE_CODE (type) == RECORD_TYPE
1489 || TREE_CODE (type) == UNION_TYPE)
1490 && TYPE_NAME (type) == decl)
1492 if (use_gnu_debug_info_extensions && have_used_extensions)
1494 putc ('T', asmfile);
1495 TREE_ASM_WRITTEN (TYPE_NAME (type)) = 1;
1497 #if 0 /* Now we generate the tag for this case up above. */
1503 putc ('t', asmfile);
1504 current_sym_code = DBX_TYPE_DECL_STABS_CODE;
1506 dbxout_type (type, 1, 0);
1507 dbxout_finish_symbol (decl);
1511 if (tag_needed && TYPE_NAME (type) != 0
1512 && !TREE_ASM_WRITTEN (TYPE_NAME (type)))
1514 /* For a TYPE_DECL with no name, but the type has a name,
1516 This is what represents `struct foo' with no typedef. */
1517 /* In C++, the name of a type is the corresponding typedef.
1518 In C, it is an IDENTIFIER_NODE. */
1519 tree name = TYPE_NAME (type);
1520 if (TREE_CODE (name) == TYPE_DECL)
1521 name = DECL_NAME (name);
1523 current_sym_code = DBX_TYPE_DECL_STABS_CODE;
1524 current_sym_value = 0;
1525 current_sym_addr = 0;
1526 current_sym_nchars = 2 + IDENTIFIER_LENGTH (name);
1528 fprintf (asmfile, "%s \"%s:T", ASM_STABS_OP,
1529 IDENTIFIER_POINTER (name));
1530 dbxout_type (type, 1, 0);
1531 dbxout_finish_symbol (NULL_TREE);
1535 /* If an enum type has no name, it cannot be referred to,
1536 but we must output it anyway, since the enumeration constants
1537 can be referred to. */
1538 if (!did_output && TREE_CODE (type) == ENUMERAL_TYPE)
1540 current_sym_code = DBX_TYPE_DECL_STABS_CODE;
1541 current_sym_value = 0;
1542 current_sym_addr = 0;
1543 current_sym_nchars = 2;
1545 fprintf (asmfile, "%s \":T", ASM_STABS_OP);
1546 dbxout_type (type, 1, 0);
1547 dbxout_finish_symbol (NULL_TREE);
1550 /* Prevent duplicate output of a typedef. */
1551 TREE_ASM_WRITTEN (decl) = 1;
1556 /* Parm decls go in their own separate chains
1557 and are output by dbxout_reg_parms and dbxout_parms. */
1561 /* Named return value, treat like a VAR_DECL. */
1563 if (DECL_RTL (decl) == 0)
1565 /* Don't mention a variable that is external.
1566 Let the file that defines it describe it. */
1567 if (DECL_EXTERNAL (decl))
1570 /* If the variable is really a constant
1571 and not written in memory, inform the debugger. */
1572 if (TREE_STATIC (decl) && TREE_READONLY (decl)
1573 && DECL_INITIAL (decl) != 0
1574 && ! TREE_ASM_WRITTEN (decl)
1575 && (DECL_FIELD_CONTEXT (decl) == NULL_TREE
1576 || TREE_CODE (DECL_FIELD_CONTEXT (decl)) == BLOCK))
1578 if (TREE_PUBLIC (decl) == 0)
1580 /* The sun4 assembler does not grok this. */
1581 char *name = IDENTIFIER_POINTER (DECL_NAME (decl));
1582 if (TREE_CODE (TREE_TYPE (decl)) == INTEGER_TYPE
1583 || TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE)
1585 HOST_WIDE_INT ival = TREE_INT_CST_LOW (DECL_INITIAL (decl));
1586 #ifdef DBX_OUTPUT_CONSTANT_SYMBOL
1587 DBX_OUTPUT_CONSTANT_SYMBOL (asmfile, name, ival);
1589 fprintf (asmfile, "%s \"%s:c=i%d\",0x%x,0,0,0\n",
1590 ASM_STABS_OP, name, ival, N_LSYM);
1594 else if (TREE_CODE (TREE_TYPE (decl)) == REAL_TYPE)
1596 /* don't know how to do this yet. */
1600 /* else it is something we handle like a normal variable. */
1603 DECL_RTL (decl) = eliminate_regs (DECL_RTL (decl), 0, 0);
1604 #ifdef LEAF_REG_REMAP
1606 leaf_renumber_regs_insn (DECL_RTL (decl));
1609 /* Don't mention a variable at all
1610 if it was completely optimized into nothingness.
1612 If DECL was from an inline function, then it's rtl
1613 is not identically the rtl that was used in this
1614 particular compilation. */
1615 if (GET_CODE (DECL_RTL (decl)) == REG)
1617 regno = REGNO (DECL_RTL (decl));
1618 if (regno >= FIRST_PSEUDO_REGISTER)
1621 else if (GET_CODE (DECL_RTL (decl)) == SUBREG)
1623 rtx value = DECL_RTL (decl);
1625 while (GET_CODE (value) == SUBREG)
1627 offset += SUBREG_WORD (value);
1628 value = SUBREG_REG (value);
1630 if (GET_CODE (value) == REG)
1632 regno = REGNO (value);
1633 if (regno >= FIRST_PSEUDO_REGISTER)
1637 alter_subreg (DECL_RTL (decl));
1640 /* The kind-of-variable letter depends on where
1641 the variable is and on the scope of its name:
1642 G and N_GSYM for static storage and global scope,
1643 S for static storage and file scope,
1644 V for static storage and local scope,
1645 for those two, use N_LCSYM if data is in bss segment,
1646 N_STSYM if in data segment, N_FUN otherwise.
1647 (We used N_FUN originally, then changed to N_STSYM
1648 to please GDB. However, it seems that confused ld.
1649 Now GDB has been fixed to like N_FUN, says Kingdon.)
1650 no letter at all, and N_LSYM, for auto variable,
1651 r and N_RSYM for register variable. */
1653 if (GET_CODE (DECL_RTL (decl)) == MEM
1654 && GET_CODE (XEXP (DECL_RTL (decl), 0)) == SYMBOL_REF)
1656 if (TREE_PUBLIC (decl))
1659 current_sym_code = N_GSYM;
1663 current_sym_addr = XEXP (DECL_RTL (decl), 0);
1665 letter = decl_function_context (decl) ? 'V' : 'S';
1667 if (!DECL_INITIAL (decl))
1668 current_sym_code = N_LCSYM;
1669 else if (TREE_READONLY (decl) && ! TREE_THIS_VOLATILE (decl))
1670 /* This is not quite right, but it's the closest
1671 of all the codes that Unix defines. */
1672 current_sym_code = DBX_STATIC_CONST_VAR_CODE;
1675 /* Ultrix `as' seems to need this. */
1676 #ifdef DBX_STATIC_STAB_DATA_SECTION
1679 current_sym_code = N_STSYM;
1683 else if (regno >= 0)
1686 current_sym_code = N_RSYM;
1687 current_sym_value = DBX_REGISTER_NUMBER (regno);
1689 else if (GET_CODE (DECL_RTL (decl)) == MEM
1690 && (GET_CODE (XEXP (DECL_RTL (decl), 0)) == MEM
1691 || (GET_CODE (XEXP (DECL_RTL (decl), 0)) == REG
1692 && REGNO (XEXP (DECL_RTL (decl), 0)) != FRAME_POINTER_REGNUM)))
1693 /* If the value is indirect by memory or by a register
1694 that isn't the frame pointer
1695 then it means the object is variable-sized and address through
1696 that register or stack slot. DBX has no way to represent this
1697 so all we can do is output the variable as a pointer.
1698 If it's not a parameter, ignore it.
1699 (VAR_DECLs like this can be made by integrate.c.) */
1701 if (GET_CODE (XEXP (DECL_RTL (decl), 0)) == REG)
1704 current_sym_code = N_RSYM;
1705 current_sym_value = DBX_REGISTER_NUMBER (REGNO (XEXP (DECL_RTL (decl), 0)));
1709 current_sym_code = N_LSYM;
1710 /* DECL_RTL looks like (MEM (MEM (PLUS (REG...) (CONST_INT...)))).
1711 We want the value of that CONST_INT. */
1713 = DEBUGGER_AUTO_OFFSET (XEXP (XEXP (DECL_RTL (decl), 0), 0));
1716 /* Effectively do build_pointer_type, but don't cache this type,
1717 since it might be temporary whereas the type it points to
1718 might have been saved for inlining. */
1719 /* Don't use REFERENCE_TYPE because dbx can't handle that. */
1720 type = make_node (POINTER_TYPE);
1721 TREE_TYPE (type) = TREE_TYPE (decl);
1723 else if (GET_CODE (DECL_RTL (decl)) == MEM
1724 && GET_CODE (XEXP (DECL_RTL (decl), 0)) == REG)
1726 current_sym_code = N_LSYM;
1727 current_sym_value = DEBUGGER_AUTO_OFFSET (XEXP (DECL_RTL (decl), 0));
1729 else if (GET_CODE (DECL_RTL (decl)) == MEM
1730 && GET_CODE (XEXP (DECL_RTL (decl), 0)) == PLUS
1731 && GET_CODE (XEXP (XEXP (DECL_RTL (decl), 0), 1)) == CONST_INT)
1733 current_sym_code = N_LSYM;
1734 /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...)))
1735 We want the value of that CONST_INT. */
1736 current_sym_value = DEBUGGER_AUTO_OFFSET (XEXP (DECL_RTL (decl), 0));
1738 else if (GET_CODE (DECL_RTL (decl)) == MEM
1739 && GET_CODE (XEXP (DECL_RTL (decl), 0)) == CONST)
1741 /* Handle an obscure case which can arise when optimizing and
1742 when there are few available registers. (This is *always*
1743 the case for i386/i486 targets). The DECL_RTL looks like
1744 (MEM (CONST ...)) even though this variable is a local `auto'
1745 or a local `register' variable. In effect, what has happened
1746 is that the reload pass has seen that all assignments and
1747 references for one such a local variable can be replaced by
1748 equivalent assignments and references to some static storage
1749 variable, thereby avoiding the need for a register. In such
1750 cases we're forced to lie to debuggers and tell them that
1751 this variable was itself `static'. */
1752 current_sym_code = N_LCSYM;
1754 current_sym_addr = XEXP (XEXP (DECL_RTL (decl), 0), 0);
1757 /* Address might be a MEM, when DECL is a variable-sized object.
1758 Or it might be const0_rtx, meaning previous passes
1759 want us to ignore this variable. */
1762 /* Ok, start a symtab entry and output the variable name. */
1765 #ifdef DBX_STATIC_BLOCK_START
1766 DBX_STATIC_BLOCK_START (asmfile, current_sym_code);
1769 /* One slight hitch: if this is a VAR_DECL which is a static
1770 class member, we must put out the mangled name instead of the
1774 /* Note also that static member (variable) names DO NOT begin
1775 with underscores in .stabs directives. */
1776 if (DECL_LANG_SPECIFIC (decl))
1777 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
1779 name = IDENTIFIER_POINTER (DECL_NAME (decl));
1780 fprintf (asmfile, "%s \"%s:", ASM_STABS_OP, name);
1782 if (letter) putc (letter, asmfile);
1783 dbxout_type (type, 0, 0);
1784 dbxout_finish_symbol (decl);
1786 #ifdef DBX_STATIC_BLOCK_END
1787 DBX_STATIC_BLOCK_END (asmfile, current_sym_code);
1794 dbxout_prepare_symbol (decl)
1798 char *filename = DECL_SOURCE_FILE (decl);
1800 dbxout_source_file (asmfile, filename);
1805 dbxout_finish_symbol (sym)
1808 #ifdef DBX_FINISH_SYMBOL
1809 DBX_FINISH_SYMBOL (sym);
1814 line = DECL_SOURCE_LINE (sym);
1817 fprintf (asmfile, "\",%d,0,%d,", current_sym_code, line);
1818 if (current_sym_addr)
1819 output_addr_const (asmfile, current_sym_addr);
1821 fprintf (asmfile, "%d", current_sym_value);
1822 putc ('\n', asmfile);
1826 /* Output definitions of all the decls in a chain. */
1834 dbxout_symbol (syms, 1);
1835 syms = TREE_CHAIN (syms);
1839 /* The following two functions output definitions of function parameters.
1840 Each parameter gets a definition locating it in the parameter list.
1841 Each parameter that is a register variable gets a second definition
1842 locating it in the register.
1844 Printing or argument lists in gdb uses the definitions that
1845 locate in the parameter list. But reference to the variable in
1846 expressions uses preferentially the definition as a register. */
1848 /* Output definitions, referring to storage in the parmlist,
1849 of all the parms in PARMS, which is a chain of PARM_DECL nodes. */
1852 dbxout_parms (parms)
1855 for (; parms; parms = TREE_CHAIN (parms))
1856 if (DECL_NAME (parms) && TREE_TYPE (parms) != error_mark_node)
1858 dbxout_prepare_symbol (parms);
1860 /* Perform any necessary register eliminations on the parameter's rtl,
1861 so that the debugging output will be accurate. */
1862 DECL_INCOMING_RTL (parms)
1863 = eliminate_regs (DECL_INCOMING_RTL (parms), 0, NULL_RTX);
1864 DECL_RTL (parms) = eliminate_regs (DECL_RTL (parms), 0, NULL_RTX);
1865 #ifdef LEAF_REG_REMAP
1868 leaf_renumber_regs_insn (DECL_INCOMING_RTL (parms));
1869 leaf_renumber_regs_insn (DECL_RTL (parms));
1873 if (PARM_PASSED_IN_MEMORY (parms))
1875 rtx addr = XEXP (DECL_INCOMING_RTL (parms), 0);
1877 /* ??? Here we assume that the parm address is indexed
1878 off the frame pointer or arg pointer.
1879 If that is not true, we produce meaningless results,
1880 but do not crash. */
1881 if (GET_CODE (addr) == PLUS
1882 && GET_CODE (XEXP (addr, 1)) == CONST_INT)
1883 current_sym_value = INTVAL (XEXP (addr, 1));
1885 current_sym_value = 0;
1887 current_sym_code = N_PSYM;
1888 current_sym_addr = 0;
1891 if (DECL_NAME (parms))
1893 current_sym_nchars = 2 + IDENTIFIER_LENGTH (DECL_NAME (parms));
1895 fprintf (asmfile, "%s \"%s:%c", ASM_STABS_OP,
1896 IDENTIFIER_POINTER (DECL_NAME (parms)),
1897 DBX_MEMPARM_STABS_LETTER);
1901 current_sym_nchars = 8;
1902 fprintf (asmfile, "%s \"(anon):%c", ASM_STABS_OP,
1903 DBX_MEMPARM_STABS_LETTER);
1906 if (GET_CODE (DECL_RTL (parms)) == REG
1907 && REGNO (DECL_RTL (parms)) >= 0
1908 && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
1909 dbxout_type (DECL_ARG_TYPE (parms), 0, 0);
1912 int original_value = current_sym_value;
1914 /* This is the case where the parm is passed as an int or double
1915 and it is converted to a char, short or float and stored back
1916 in the parmlist. In this case, describe the parm
1917 with the variable's declared type, and adjust the address
1918 if the least significant bytes (which we are using) are not
1920 #if BYTES_BIG_ENDIAN
1921 if (TREE_TYPE (parms) != DECL_ARG_TYPE (parms))
1922 current_sym_value += (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parms)))
1923 - GET_MODE_SIZE (GET_MODE (DECL_RTL (parms))));
1926 if (GET_CODE (DECL_RTL (parms)) == MEM
1927 && GET_CODE (XEXP (DECL_RTL (parms), 0)) == PLUS
1928 && GET_CODE (XEXP (XEXP (DECL_RTL (parms), 0), 1)) == CONST_INT
1929 && INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1)) == current_sym_value)
1930 dbxout_type (TREE_TYPE (parms), 0, 0);
1933 current_sym_value = original_value;
1934 dbxout_type (DECL_ARG_TYPE (parms), 0, 0);
1937 current_sym_value = DEBUGGER_ARG_OFFSET (current_sym_value, addr);
1938 dbxout_finish_symbol (parms);
1940 else if (GET_CODE (DECL_RTL (parms)) == REG)
1943 char regparm_letter;
1944 /* Parm passed in registers and lives in registers or nowhere. */
1946 current_sym_code = DBX_REGPARM_STABS_CODE;
1947 regparm_letter = DBX_REGPARM_STABS_LETTER;
1948 current_sym_addr = 0;
1950 /* If parm lives in a register, use that register;
1951 pretend the parm was passed there. It would be more consistent
1952 to describe the register where the parm was passed,
1953 but in practice that register usually holds something else. */
1954 if (REGNO (DECL_RTL (parms)) >= 0
1955 && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
1956 best_rtl = DECL_RTL (parms);
1957 /* If the parm lives nowhere,
1958 use the register where it was passed. */
1960 best_rtl = DECL_INCOMING_RTL (parms);
1961 current_sym_value = DBX_REGISTER_NUMBER (REGNO (best_rtl));
1964 if (DECL_NAME (parms))
1966 current_sym_nchars = 2 + IDENTIFIER_LENGTH (DECL_NAME (parms));
1967 fprintf (asmfile, "%s \"%s:%c", ASM_STABS_OP,
1968 IDENTIFIER_POINTER (DECL_NAME (parms)),
1973 current_sym_nchars = 8;
1974 fprintf (asmfile, "%s \"(anon):%c", ASM_STABS_OP,
1978 dbxout_type (DECL_ARG_TYPE (parms), 0, 0);
1979 dbxout_finish_symbol (parms);
1981 else if (GET_CODE (DECL_RTL (parms)) == MEM
1982 && GET_CODE (XEXP (DECL_RTL (parms), 0)) == REG)
1983 /* && rtx_equal_p (XEXP (DECL_RTL (parms), 0),
1984 DECL_INCOMING_RTL (parms))) */
1986 /* Parm was passed via invisible reference.
1987 That is, its address was passed in a register.
1988 Output it as if it lived in that register.
1989 The debugger will know from the type
1990 that it was actually passed by invisible reference. */
1992 char regparm_letter;
1993 /* Parm passed in registers and lives in registers or nowhere. */
1995 current_sym_code = DBX_REGPARM_STABS_CODE;
1996 regparm_letter = DBX_REGPARM_STABS_LETTER;
1998 /* DECL_RTL looks like (MEM (REG...). Get the register number. */
1999 current_sym_value = REGNO (XEXP (DECL_RTL (parms), 0));
2000 current_sym_addr = 0;
2003 if (DECL_NAME (parms))
2005 current_sym_nchars = 2 + strlen (IDENTIFIER_POINTER (DECL_NAME (parms)));
2007 fprintf (asmfile, "%s \"%s:%c", ASM_STABS_OP,
2008 IDENTIFIER_POINTER (DECL_NAME (parms)),
2009 DBX_REGPARM_STABS_LETTER);
2013 current_sym_nchars = 8;
2014 fprintf (asmfile, "%s \"(anon):%c", ASM_STABS_OP,
2015 DBX_REGPARM_STABS_LETTER);
2018 dbxout_type (TREE_TYPE (parms), 0, 0);
2019 dbxout_finish_symbol (parms);
2021 else if (GET_CODE (DECL_RTL (parms)) == MEM
2022 && XEXP (DECL_RTL (parms), 0) != const0_rtx)
2024 /* Parm was passed in registers but lives on the stack. */
2026 current_sym_code = N_PSYM;
2027 /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))),
2028 in which case we want the value of that CONST_INT,
2029 or (MEM (REG ...)) or (MEM (MEM ...)),
2030 in which case we use a value of zero. */
2031 if (GET_CODE (XEXP (DECL_RTL (parms), 0)) == REG
2032 || GET_CODE (XEXP (DECL_RTL (parms), 0)) == MEM)
2033 current_sym_value = 0;
2035 current_sym_value = INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1));
2036 current_sym_addr = 0;
2039 if (DECL_NAME (parms))
2041 current_sym_nchars = 2 + strlen (IDENTIFIER_POINTER (DECL_NAME (parms)));
2043 fprintf (asmfile, "%s \"%s:%c", ASM_STABS_OP,
2044 IDENTIFIER_POINTER (DECL_NAME (parms)),
2045 DBX_MEMPARM_STABS_LETTER);
2049 current_sym_nchars = 8;
2050 fprintf (asmfile, "%s \"(anon):%c", ASM_STABS_OP,
2051 DBX_MEMPARM_STABS_LETTER);
2055 = DEBUGGER_ARG_OFFSET (current_sym_value,
2056 XEXP (DECL_RTL (parms), 0));
2057 dbxout_type (TREE_TYPE (parms), 0, 0);
2058 dbxout_finish_symbol (parms);
2063 /* Output definitions for the places where parms live during the function,
2064 when different from where they were passed, when the parms were passed
2067 It is not useful to do this for parms passed in registers
2068 that live during the function in different registers, because it is
2069 impossible to look in the passed register for the passed value,
2070 so we use the within-the-function register to begin with.
2072 PARMS is a chain of PARM_DECL nodes. */
2075 dbxout_reg_parms (parms)
2078 for (; parms; parms = TREE_CHAIN (parms))
2079 if (DECL_NAME (parms))
2081 dbxout_prepare_symbol (parms);
2083 /* Report parms that live in registers during the function
2084 but were passed in memory. */
2085 if (GET_CODE (DECL_RTL (parms)) == REG
2086 && REGNO (DECL_RTL (parms)) >= 0
2087 && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER
2088 && PARM_PASSED_IN_MEMORY (parms))
2090 current_sym_code = N_RSYM;
2091 current_sym_value = DBX_REGISTER_NUMBER (REGNO (DECL_RTL (parms)));
2092 current_sym_addr = 0;
2095 if (DECL_NAME (parms))
2097 current_sym_nchars = 2 + IDENTIFIER_LENGTH (DECL_NAME (parms));
2098 fprintf (asmfile, "%s \"%s:r", ASM_STABS_OP,
2099 IDENTIFIER_POINTER (DECL_NAME (parms)));
2103 current_sym_nchars = 8;
2104 fprintf (asmfile, "%s \"(anon):r", ASM_STABS_OP);
2106 dbxout_type (TREE_TYPE (parms), 0, 0);
2107 dbxout_finish_symbol (parms);
2109 /* Report parms that live in memory but not where they were passed. */
2110 else if (GET_CODE (DECL_RTL (parms)) == MEM
2111 && GET_CODE (XEXP (DECL_RTL (parms), 0)) == PLUS
2112 && GET_CODE (XEXP (XEXP (DECL_RTL (parms), 0), 1)) == CONST_INT
2113 && PARM_PASSED_IN_MEMORY (parms)
2114 && ! rtx_equal_p (DECL_RTL (parms), DECL_INCOMING_RTL (parms)))
2116 #if 0 /* ??? It is not clear yet what should replace this. */
2117 int offset = DECL_OFFSET (parms) / BITS_PER_UNIT;
2118 /* A parm declared char is really passed as an int,
2119 so it occupies the least significant bytes.
2120 On a big-endian machine those are not the low-numbered ones. */
2121 #if BYTES_BIG_ENDIAN
2122 if (offset != -1 && TREE_TYPE (parms) != DECL_ARG_TYPE (parms))
2123 offset += (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parms)))
2124 - GET_MODE_SIZE (GET_MODE (DECL_RTL (parms))));
2126 if (INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1)) != offset) {...}
2128 current_sym_code = N_LSYM;
2129 current_sym_value = DEBUGGER_AUTO_OFFSET (XEXP (DECL_RTL (parms), 0));
2130 current_sym_addr = 0;
2132 if (DECL_NAME (parms))
2134 current_sym_nchars = 2 + IDENTIFIER_LENGTH (DECL_NAME (parms));
2135 fprintf (asmfile, "%s \"%s:", ASM_STABS_OP,
2136 IDENTIFIER_POINTER (DECL_NAME (parms)));
2140 current_sym_nchars = 8;
2141 fprintf (asmfile, "%s \"(anon):", ASM_STABS_OP);
2143 dbxout_type (TREE_TYPE (parms), 0, 0);
2144 dbxout_finish_symbol (parms);
2147 else if (GET_CODE (DECL_RTL (parms)) == MEM
2148 && GET_CODE (XEXP (DECL_RTL (parms), 0)) == REG)
2150 /* Parm was passed via invisible reference.
2151 That is, its address was passed in a register.
2152 Output it as if it lived in that register.
2153 The debugger will know from the type
2154 that it was actually passed by invisible reference. */
2156 current_sym_code = N_RSYM;
2158 /* DECL_RTL looks like (MEM (REG...). Get the register number. */
2159 current_sym_value = REGNO (XEXP (DECL_RTL (parms), 0));
2160 current_sym_addr = 0;
2163 if (DECL_NAME (parms))
2165 current_sym_nchars = 2 + strlen (IDENTIFIER_POINTER (DECL_NAME (parms)));
2167 fprintf (asmfile, "%s \"%s:r", ASM_STABS_OP,
2168 IDENTIFIER_POINTER (DECL_NAME (parms)));
2172 current_sym_nchars = 8;
2173 fprintf (asmfile, "%s \"(anon):r", ASM_STABS_OP);
2176 dbxout_type (TREE_TYPE (parms), 0, 0);
2177 dbxout_finish_symbol (parms);
2183 /* Given a chain of ..._TYPE nodes (as come in a parameter list),
2184 output definitions of those names, in raw form */
2192 putc (',', asmfile);
2193 dbxout_type (TREE_VALUE (args), 0, 0);
2195 args = TREE_CHAIN (args);
2199 /* Given a chain of ..._TYPE nodes,
2200 find those which have typedef names and output those names.
2201 This is to ensure those types get output. */
2204 dbxout_types (types)
2205 register tree types;
2209 if (TYPE_NAME (types)
2210 && TREE_CODE (TYPE_NAME (types)) == TYPE_DECL
2211 && ! TREE_ASM_WRITTEN (TYPE_NAME (types)))
2212 dbxout_symbol (TYPE_NAME (types), 1);
2213 types = TREE_CHAIN (types);
2217 /* Output everything about a symbol block (a BLOCK node
2218 that represents a scope level),
2219 including recursive output of contained blocks.
2221 BLOCK is the BLOCK node.
2222 DEPTH is its depth within containing symbol blocks.
2223 ARGS is usually zero; but for the outermost block of the
2224 body of a function, it is a chain of PARM_DECLs for the function parameters.
2225 We output definitions of all the register parms
2226 as if they were local variables of that block.
2228 If -g1 was used, we count blocks just the same, but output nothing
2229 except for the outermost block.
2231 Actually, BLOCK may be several blocks chained together.
2232 We handle them all in sequence. */
2235 dbxout_block (block, depth, args)
2236 register tree block;
2244 /* Ignore blocks never expanded or otherwise marked as real. */
2245 if (TREE_USED (block))
2247 #ifndef DBX_LBRAC_FIRST
2248 /* In dbx format, the syms of a block come before the N_LBRAC. */
2249 if (debug_info_level != DINFO_LEVEL_TERSE || depth == 0)
2250 dbxout_syms (BLOCK_VARS (block));
2252 dbxout_reg_parms (args);
2255 /* Now output an N_LBRAC symbol to represent the beginning of
2256 the block. Use the block's tree-walk order to generate
2257 the assembler symbols LBBn and LBEn
2258 that final will define around the code in this block. */
2259 if (depth > 0 && debug_info_level != DINFO_LEVEL_TERSE)
2262 blocknum = next_block_number++;
2263 ASM_GENERATE_INTERNAL_LABEL (buf, "LBB", blocknum);
2265 if (BLOCK_HANDLER_BLOCK (block))
2267 /* A catch block. Must precede N_LBRAC. */
2268 tree decl = BLOCK_VARS (block);
2271 #ifdef DBX_OUTPUT_CATCH
2272 DBX_OUTPUT_CATCH (asmfile, decl, buf);
2274 fprintf (asmfile, "%s \"%s:C1\",%d,0,0,", ASM_STABS_OP,
2275 IDENTIFIER_POINTER (DECL_NAME (decl)), N_CATCH);
2276 assemble_name (asmfile, buf);
2277 fprintf (asmfile, "\n");
2279 decl = TREE_CHAIN (decl);
2283 #ifdef DBX_OUTPUT_LBRAC
2284 DBX_OUTPUT_LBRAC (asmfile, buf);
2286 fprintf (asmfile, "%s %d,0,0,", ASM_STABN_OP, N_LBRAC);
2287 assemble_name (asmfile, buf);
2288 #if DBX_BLOCKS_FUNCTION_RELATIVE
2289 fputc ('-', asmfile);
2290 assemble_name (asmfile, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl)));
2292 fprintf (asmfile, "\n");
2296 /* Count blocks the same way regardless of debug_info_level. */
2297 next_block_number++;
2299 #ifdef DBX_LBRAC_FIRST
2300 /* On some weird machines, the syms of a block
2301 come after the N_LBRAC. */
2302 if (debug_info_level != DINFO_LEVEL_TERSE || depth == 0)
2303 dbxout_syms (BLOCK_VARS (block));
2305 dbxout_reg_parms (args);
2308 /* Output the subblocks. */
2309 dbxout_block (BLOCK_SUBBLOCKS (block), depth + 1, NULL_TREE);
2311 /* Refer to the marker for the end of the block. */
2312 if (depth > 0 && debug_info_level != DINFO_LEVEL_TERSE)
2315 ASM_GENERATE_INTERNAL_LABEL (buf, "LBE", blocknum);
2316 #ifdef DBX_OUTPUT_RBRAC
2317 DBX_OUTPUT_RBRAC (asmfile, buf);
2319 fprintf (asmfile, "%s %d,0,0,", ASM_STABN_OP, N_RBRAC);
2320 assemble_name (asmfile, buf);
2321 #if DBX_BLOCKS_FUNCTION_RELATIVE
2322 fputc ('-', asmfile);
2323 assemble_name (asmfile, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl)));
2325 fprintf (asmfile, "\n");
2329 block = BLOCK_CHAIN (block);
2333 /* Output the information about a function and its arguments and result.
2334 Usually this follows the function's code,
2335 but on some systems, it comes before. */
2338 dbxout_really_begin_function (decl)
2341 dbxout_symbol (decl, 0);
2342 dbxout_parms (DECL_ARGUMENTS (decl));
2343 if (DECL_NAME (DECL_RESULT (decl)) != 0)
2344 dbxout_symbol (DECL_RESULT (decl), 1);
2347 /* Called at beginning of output of function definition. */
2350 dbxout_begin_function (decl)
2353 #ifdef DBX_FUNCTION_FIRST
2354 dbxout_really_begin_function (decl);
2358 /* Output dbx data for a function definition.
2359 This includes a definition of the function name itself (a symbol),
2360 definitions of the parameters (locating them in the parameter list)
2361 and then output the block that makes up the function's body
2362 (including all the auto variables of the function). */
2365 dbxout_function (decl)
2368 #ifndef DBX_FUNCTION_FIRST
2369 dbxout_really_begin_function (decl);
2371 dbxout_block (DECL_INITIAL (decl), 0, DECL_ARGUMENTS (decl));
2372 #ifdef DBX_OUTPUT_FUNCTION_END
2373 DBX_OUTPUT_FUNCTION_END (asmfile, decl);
2376 #endif /* DBX_DEBUGGING_INFO */