1 /* Output sdb-format symbol table information from GNU compiler.
2 Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 2000, 2001 Free Software Foundation, Inc.
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 /* mike@tredysvr.Tredydev.Unisys.COM says:
23 I modified the struct.c example and have a nm of a .o resulting from the
24 AT&T C compiler. From the example below I would conclude the following:
26 1. All .defs from structures are emitted as scanned. The example below
27 clearly shows the symbol table entries for BoxRec2 are after the first
30 2. All functions and their locals (including statics) are emitted as scanned.
32 3. All nested unnamed union and structure .defs must be emitted before
33 the structure in which they are nested. The AT&T assembler is a
34 one pass beast as far as symbolics are concerned.
36 4. All structure .defs are emitted before the typedefs that refer to them.
38 5. All top level static and external variable definitions are moved to the
39 end of file with all top level statics occurring first before externs.
41 6. All undefined references are at the end of the file.
46 #ifdef SDB_DEBUGGING_INFO
53 #include "insn-config.h"
62 /* 1 if PARM is passed to this function in memory. */
64 #define PARM_PASSED_IN_MEMORY(PARM) \
65 (GET_CODE (DECL_INCOMING_RTL (PARM)) == MEM)
67 /* A C expression for the integer offset value of an automatic variable
68 (C_AUTO) having address X (an RTX). */
69 #ifndef DEBUGGER_AUTO_OFFSET
70 #define DEBUGGER_AUTO_OFFSET(X) \
71 (GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0)
74 /* A C expression for the integer offset value of an argument (C_ARG)
75 having address X (an RTX). The nominal offset is OFFSET. */
76 #ifndef DEBUGGER_ARG_OFFSET
77 #define DEBUGGER_ARG_OFFSET(OFFSET, X) (OFFSET)
80 /* Line number of beginning of current function, minus one.
81 Negative means not in a function or not using sdb. */
83 int sdb_begin_function_line = -1;
85 /* Counter to generate unique "names" for nameless struct members. */
87 static int unnamed_struct_number = 0;
89 extern FILE *asm_out_file;
91 extern tree current_function_decl;
95 static void sdbout_init PARAMS ((FILE *, const char *));
96 static void sdbout_start_source_file PARAMS ((unsigned, const char *));
97 static void sdbout_end_source_file PARAMS ((unsigned));
98 static char *gen_fake_label PARAMS ((void));
99 static int plain_type PARAMS ((tree));
100 static int template_name_p PARAMS ((tree));
101 static void sdbout_record_type_name PARAMS ((tree));
102 static int plain_type_1 PARAMS ((tree, int));
103 static void sdbout_block PARAMS ((tree));
104 static void sdbout_syms PARAMS ((tree));
105 #ifdef SDB_ALLOW_FORWARD_REFERENCES
106 static void sdbout_queue_anonymous_type PARAMS ((tree));
107 static void sdbout_dequeue_anonymous_types PARAMS ((void));
109 static void sdbout_type PARAMS ((tree));
110 static void sdbout_field_types PARAMS ((tree));
111 static void sdbout_one_type PARAMS ((tree));
112 static void sdbout_parms PARAMS ((tree));
113 static void sdbout_reg_parms PARAMS ((tree));
115 /* Random macros describing parts of SDB data. */
117 /* Put something here if lines get too long */
120 /* Default value of delimiter is ";". */
122 #define SDB_DELIM ";"
125 /* Maximum number of dimensions the assembler will allow. */
127 #define SDB_MAX_DIM 4
131 #define PUT_SDB_SCL(a) fprintf(asm_out_file, "\t.scl\t%d%s", (a), SDB_DELIM)
134 #ifndef PUT_SDB_INT_VAL
135 #define PUT_SDB_INT_VAL(a) \
137 fputs ("\t.val\t", asm_out_file); \
138 fprintf (asm_out_file, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT)(a)); \
139 fprintf (asm_out_file, "%s", SDB_DELIM); \
145 #define PUT_SDB_VAL(a) \
146 ( fputs ("\t.val\t", asm_out_file), \
147 output_addr_const (asm_out_file, (a)), \
148 fprintf (asm_out_file, SDB_DELIM))
152 #define PUT_SDB_DEF(a) \
153 do { fprintf (asm_out_file, "\t.def\t"); \
154 assemble_name (asm_out_file, a); \
155 fprintf (asm_out_file, SDB_DELIM); } while (0)
158 #ifndef PUT_SDB_PLAIN_DEF
159 #define PUT_SDB_PLAIN_DEF(a) fprintf(asm_out_file,"\t.def\t.%s%s",a, SDB_DELIM)
162 #ifndef PUT_SDB_ENDEF
163 #define PUT_SDB_ENDEF fputs("\t.endef\n", asm_out_file)
167 #define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\t.type\t0%o%s", a, SDB_DELIM)
171 #define PUT_SDB_SIZE(a) \
173 fputs ("\t.size\t", asm_out_file); \
174 fprintf (asm_out_file, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT)(a)); \
175 fprintf (asm_out_file, "%s", SDB_DELIM); \
179 #ifndef PUT_SDB_START_DIM
180 #define PUT_SDB_START_DIM fprintf(asm_out_file, "\t.dim\t")
183 #ifndef PUT_SDB_NEXT_DIM
184 #define PUT_SDB_NEXT_DIM(a) fprintf(asm_out_file, "%d,", a)
187 #ifndef PUT_SDB_LAST_DIM
188 #define PUT_SDB_LAST_DIM(a) fprintf(asm_out_file, "%d%s", a, SDB_DELIM)
192 #define PUT_SDB_TAG(a) \
193 do { fprintf (asm_out_file, "\t.tag\t"); \
194 assemble_name (asm_out_file, a); \
195 fprintf (asm_out_file, SDB_DELIM); } while (0)
198 #ifndef PUT_SDB_BLOCK_START
199 #define PUT_SDB_BLOCK_START(LINE) \
200 fprintf (asm_out_file, \
201 "\t.def\t.bb%s\t.val\t.%s\t.scl\t100%s\t.line\t%d%s\t.endef\n", \
202 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
205 #ifndef PUT_SDB_BLOCK_END
206 #define PUT_SDB_BLOCK_END(LINE) \
207 fprintf (asm_out_file, \
208 "\t.def\t.eb%s\t.val\t.%s\t.scl\t100%s\t.line\t%d%s\t.endef\n", \
209 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
212 #ifndef PUT_SDB_FUNCTION_START
213 #define PUT_SDB_FUNCTION_START(LINE) \
214 fprintf (asm_out_file, \
215 "\t.def\t.bf%s\t.val\t.%s\t.scl\t101%s\t.line\t%d%s\t.endef\n", \
216 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
219 #ifndef PUT_SDB_FUNCTION_END
220 #define PUT_SDB_FUNCTION_END(LINE) \
221 fprintf (asm_out_file, \
222 "\t.def\t.ef%s\t.val\t.%s\t.scl\t101%s\t.line\t%d%s\t.endef\n", \
223 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
226 #ifndef PUT_SDB_EPILOGUE_END
227 #define PUT_SDB_EPILOGUE_END(NAME) \
228 do { fprintf (asm_out_file, "\t.def\t"); \
229 assemble_name (asm_out_file, NAME); \
230 fprintf (asm_out_file, \
231 "%s\t.val\t.%s\t.scl\t-1%s\t.endef\n", \
232 SDB_DELIM, SDB_DELIM, SDB_DELIM); } while (0)
235 #ifndef SDB_GENERATE_FAKE
236 #define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
237 sprintf ((BUFFER), ".%dfake", (NUMBER));
240 /* Return the sdb tag identifier string for TYPE
241 if TYPE has already been defined; otherwise return a null pointer. */
243 #define KNOWN_TYPE_TAG(type) TYPE_SYMTAB_POINTER (type)
245 /* Set the sdb tag identifier string for TYPE to NAME. */
247 #define SET_KNOWN_TYPE_TAG(TYPE, NAME) \
248 TYPE_SYMTAB_POINTER (TYPE) = (NAME)
250 /* Return the name (a string) of the struct, union or enum tag
251 described by the TREE_LIST node LINK. This is 0 for an anonymous one. */
253 #define TAG_NAME(link) \
254 (((link) && TREE_PURPOSE ((link)) \
255 && IDENTIFIER_POINTER (TREE_PURPOSE ((link)))) \
256 ? IDENTIFIER_POINTER (TREE_PURPOSE ((link))) : (char *) 0)
258 /* Ensure we don't output a negative line number. */
259 #define MAKE_LINE_SAFE(line) \
260 if (line <= sdb_begin_function_line) line = sdb_begin_function_line + 1
262 /* Perform linker optimization of merging header file definitions together
263 for targets with MIPS_DEBUGGING_INFO defined. This won't work without a
264 post 960826 version of GAS. Nothing breaks with earlier versions of GAS,
265 the optimization just won't be done. The native assembler already has the
266 necessary support. */
268 #ifdef MIPS_DEBUGGING_INFO
270 #ifndef PUT_SDB_SRC_FILE
271 #define PUT_SDB_SRC_FILE(FILENAME) \
272 output_file_directive (asm_out_file, (FILENAME))
275 /* ECOFF linkers have an optimization that does the same kind of thing as
276 N_BINCL/E_INCL in stabs: eliminate duplicate debug information in the
277 executable. To achieve this, GCC must output a .file for each file
280 /* This is a stack of input files. */
284 struct sdb_file *next;
288 /* This is the top of the stack. */
290 static struct sdb_file *current_file;
292 #endif /* MIPS_DEBUGGING_INFO */
294 /* The debug hooks structure. */
295 struct gcc_debug_hooks sdb_debug_hooks =
298 debug_nothing_file_charstar,
299 debug_nothing_int_charstar,
300 debug_nothing_int_charstar,
301 sdbout_start_source_file,
302 sdbout_end_source_file
307 /* return the tag identifier for type
311 tag_of_ru_type (type,link)
314 if (TYPE_SYMTAB_ADDRESS (type))
315 return TYPE_SYMTAB_ADDRESS (type);
316 if (link && TREE_PURPOSE (link)
317 && IDENTIFIER_POINTER (TREE_PURPOSE (link)))
318 TYPE_SYMTAB_ADDRESS (type) = IDENTIFIER_POINTER (TREE_PURPOSE (link));
320 return (char *) TYPE_SYMTAB_ADDRESS (type);
324 /* Return a unique string to name an anonymous type. */
331 SDB_GENERATE_FAKE (label, unnamed_struct_number);
332 unnamed_struct_number++;
333 labelstr = (char *) permalloc (strlen (label) + 1);
334 strcpy (labelstr, label);
338 /* Return the number which describes TYPE for SDB.
339 For pointers, etc., this function is recursive.
340 Each record, union or enumeral type must already have had a
341 tag number output. */
343 /* The number is given by d6d5d4d3d2d1bbbb
344 where bbbb is 4 bit basic type, and di indicate one of notype,ptr,fn,array.
345 Thus, char *foo () has bbbb=T_CHAR
348 N_BTMASK= 017 1111 basic type field.
349 N_TSHIFT= 2 derived type shift
350 N_BTSHFT= 4 Basic type shift */
352 /* Produce the number that describes a pointer, function or array type.
353 PREV is the number describing the target, value or element type.
354 DT_type describes how to transform that type. */
355 #define PUSH_DERIVED_LEVEL(DT_type,PREV) \
356 ((((PREV) & ~(int)N_BTMASK) << (int)N_TSHIFT) \
357 | ((int)DT_type << (int)N_BTSHFT) \
358 | ((PREV) & (int)N_BTMASK))
360 /* Number of elements used in sdb_dims. */
361 static int sdb_n_dims = 0;
363 /* Table of array dimensions of current type. */
364 static int sdb_dims[SDB_MAX_DIM];
366 /* Size of outermost array currently being processed. */
367 static int sdb_type_size = -1;
373 int val = plain_type_1 (type, 0);
375 /* If we have already saved up some array dimensions, print them now. */
380 for (i = sdb_n_dims - 1; i > 0; i--)
381 PUT_SDB_NEXT_DIM (sdb_dims[i]);
382 PUT_SDB_LAST_DIM (sdb_dims[0]);
385 sdb_type_size = int_size_in_bytes (type);
386 /* Don't kill sdb if type is not laid out or has variable size. */
387 if (sdb_type_size < 0)
390 /* If we have computed the size of an array containing this type,
392 if (sdb_type_size >= 0)
394 PUT_SDB_SIZE (sdb_type_size);
401 template_name_p (name)
404 register const char *ptr = IDENTIFIER_POINTER (name);
405 while (*ptr && *ptr != '<')
412 sdbout_record_type_name (type)
415 const char *name = 0;
418 if (KNOWN_TYPE_TAG (type))
421 if (TYPE_NAME (type) != 0)
424 /* Find the IDENTIFIER_NODE for the type name. */
425 if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
426 t = TYPE_NAME (type);
427 else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL)
429 t = DECL_NAME (TYPE_NAME (type));
430 /* The DECL_NAME for templates includes "<>", which breaks
431 most assemblers. Use its assembler name instead, which
432 has been mangled into being safe. */
433 if (t && template_name_p (t))
434 t = DECL_ASSEMBLER_NAME (TYPE_NAME (type));
437 /* Now get the name as a string, or invent one. */
439 name = IDENTIFIER_POINTER (t);
442 no_name = (name == 0 || *name == 0);
444 name = gen_fake_label ();
446 SET_KNOWN_TYPE_TAG (type, name);
447 #ifdef SDB_ALLOW_FORWARD_REFERENCES
449 sdbout_queue_anonymous_type (type);
453 /* Return the .type value for type TYPE.
455 LEVEL indicates how many levels deep we have recursed into the type.
456 The SDB debug format can only represent 6 derived levels of types.
457 After that, we must output inaccurate debug info. We deliberately
458 stop before the 7th level, so that ADA recursive types will not give an
462 plain_type_1 (type, level)
467 type = void_type_node;
468 else if (type == error_mark_node)
469 type = integer_type_node;
471 type = TYPE_MAIN_VARIANT (type);
473 switch (TREE_CODE (type))
480 int size = int_size_in_bytes (type) * BITS_PER_UNIT;
482 /* Carefully distinguish all the standard types of C,
483 without messing up if the language is not C.
484 Note that we check only for the names that contain spaces;
485 other names might occur by coincidence in other languages. */
486 if (TYPE_NAME (type) != 0
487 && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
488 && DECL_NAME (TYPE_NAME (type)) != 0
489 && TREE_CODE (DECL_NAME (TYPE_NAME (type))) == IDENTIFIER_NODE)
492 = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
494 if (!strcmp (name, "char"))
496 if (!strcmp (name, "unsigned char"))
498 if (!strcmp (name, "signed char"))
500 if (!strcmp (name, "int"))
502 if (!strcmp (name, "unsigned int"))
504 if (!strcmp (name, "short int"))
506 if (!strcmp (name, "short unsigned int"))
508 if (!strcmp (name, "long int"))
510 if (!strcmp (name, "long unsigned int"))
514 if (size == INT_TYPE_SIZE)
515 return (TREE_UNSIGNED (type) ? T_UINT : T_INT);
516 if (size == CHAR_TYPE_SIZE)
517 return (TREE_UNSIGNED (type) ? T_UCHAR : T_CHAR);
518 if (size == SHORT_TYPE_SIZE)
519 return (TREE_UNSIGNED (type) ? T_USHORT : T_SHORT);
520 if (size == LONG_TYPE_SIZE)
521 return (TREE_UNSIGNED (type) ? T_ULONG : T_LONG);
522 if (size == LONG_LONG_TYPE_SIZE) /* better than nothing */
523 return (TREE_UNSIGNED (type) ? T_ULONG : T_LONG);
529 int precision = TYPE_PRECISION (type);
530 if (precision == FLOAT_TYPE_SIZE)
532 if (precision == DOUBLE_TYPE_SIZE)
534 #ifdef EXTENDED_SDB_BASIC_TYPES
535 if (precision == LONG_DOUBLE_TYPE_SIZE)
538 if (precision == LONG_DOUBLE_TYPE_SIZE)
539 return T_DOUBLE; /* better than nothing */
550 m = plain_type_1 (TREE_TYPE (type), level+1);
551 if (sdb_n_dims < SDB_MAX_DIM)
552 sdb_dims[sdb_n_dims++]
553 = (TYPE_DOMAIN (type)
554 && TYPE_MIN_VALUE (TYPE_DOMAIN (type)) != 0
555 && TYPE_MAX_VALUE (TYPE_DOMAIN (type)) != 0
556 && host_integerp (TYPE_MAX_VALUE (TYPE_DOMAIN (type)), 0)
557 && host_integerp (TYPE_MIN_VALUE (TYPE_DOMAIN (type)), 0)
558 ? (tree_low_cst (TYPE_MAX_VALUE (TYPE_DOMAIN (type)), 0)
559 - tree_low_cst (TYPE_MIN_VALUE (TYPE_DOMAIN (type)), 0) + 1)
562 return PUSH_DERIVED_LEVEL (DT_ARY, m);
567 case QUAL_UNION_TYPE:
571 #ifdef SDB_ALLOW_FORWARD_REFERENCES
572 sdbout_record_type_name (type);
574 #ifndef SDB_ALLOW_UNKNOWN_REFERENCES
575 if ((TREE_ASM_WRITTEN (type) && KNOWN_TYPE_TAG (type) != 0)
576 #ifdef SDB_ALLOW_FORWARD_REFERENCES
577 || TYPE_MODE (type) != VOIDmode
582 /* Output the referenced structure tag name
583 only if the .def has already been finished.
584 At least on 386, the Unix assembler
585 cannot handle forward references to tags. */
586 /* But the 88100, it requires them, sigh... */
587 /* And the MIPS requires unknown refs as well... */
588 tag = KNOWN_TYPE_TAG (type);
590 /* These 3 lines used to follow the close brace.
591 However, a size of 0 without a tag implies a tag of 0,
592 so if we don't know a tag, we can't mention the size. */
593 sdb_type_size = int_size_in_bytes (type);
594 if (sdb_type_size < 0)
597 return ((TREE_CODE (type) == RECORD_TYPE) ? T_STRUCT
598 : (TREE_CODE (type) == UNION_TYPE) ? T_UNION
599 : (TREE_CODE (type) == QUAL_UNION_TYPE) ? T_UNION
609 m = plain_type_1 (TREE_TYPE (type), level+1);
610 return PUSH_DERIVED_LEVEL (DT_PTR, m);
619 m = plain_type_1 (TREE_TYPE (type), level+1);
620 return PUSH_DERIVED_LEVEL (DT_FCN, m);
627 /* Output the symbols defined in block number DO_BLOCK.
629 This function works by walking the tree structure of blocks,
630 counting blocks until it finds the desired block. */
632 static int do_block = 0;
640 /* Ignore blocks never expanded or otherwise marked as real. */
641 if (TREE_USED (block))
643 /* When we reach the specified block, output its symbols. */
644 if (BLOCK_NUMBER (block) == do_block)
645 sdbout_syms (BLOCK_VARS (block));
647 /* If we are past the specified block, stop the scan. */
648 if (BLOCK_NUMBER (block) > do_block)
651 /* Scan the blocks within this block. */
652 sdbout_block (BLOCK_SUBBLOCKS (block));
655 block = BLOCK_CHAIN (block);
659 /* Call sdbout_symbol on each decl in the chain SYMS. */
667 if (TREE_CODE (syms) != LABEL_DECL)
668 sdbout_symbol (syms, 1);
669 syms = TREE_CHAIN (syms);
673 /* Output SDB information for a symbol described by DECL.
674 LOCAL is nonzero if the symbol is not file-scope. */
677 sdbout_symbol (decl, local)
681 tree type = TREE_TYPE (decl);
682 tree context = NULL_TREE;
687 sdbout_one_type (type);
689 #if 0 /* This loses when functions are marked to be ignored,
690 which happens in the C++ front end. */
691 if (DECL_IGNORED_P (decl))
695 switch (TREE_CODE (decl))
698 /* Enum values are defined by defining the enum type. */
702 /* Don't mention a nested function under its parent. */
703 context = decl_function_context (decl);
704 if (context == current_function_decl)
706 /* Check DECL_INITIAL to distinguish declarations from definitions.
707 Don't output debug info here for declarations; they will have
708 a DECL_INITIAL value of 0. */
709 if (! DECL_INITIAL (decl))
711 if (GET_CODE (DECL_RTL (decl)) != MEM
712 || GET_CODE (XEXP (DECL_RTL (decl), 0)) != SYMBOL_REF)
714 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
715 PUT_SDB_VAL (XEXP (DECL_RTL (decl), 0));
716 PUT_SDB_SCL (TREE_PUBLIC (decl) ? C_EXT : C_STAT);
720 /* Done with tagged types. */
721 if (DECL_NAME (decl) == 0)
723 if (DECL_IGNORED_P (decl))
726 /* Output typedef name. */
727 if (template_name_p (DECL_NAME (decl)))
728 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
730 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_NAME (decl)));
731 PUT_SDB_SCL (C_TPDEF);
735 /* Parm decls go in their own separate chains
736 and are output by sdbout_reg_parms and sdbout_parms. */
740 /* Don't mention a variable that is external.
741 Let the file that defines it describe it. */
742 if (DECL_EXTERNAL (decl))
745 /* Ignore __FUNCTION__, etc. */
746 if (DECL_IGNORED_P (decl))
749 /* If there was an error in the declaration, don't dump core
750 if there is no RTL associated with the variable doesn't
752 if (!DECL_RTL_SET_P (decl))
756 eliminate_regs (DECL_RTL (decl), 0, NULL_RTX));
757 #ifdef LEAF_REG_REMAP
758 if (current_function_uses_only_leaf_regs)
759 leaf_renumber_regs_insn (DECL_RTL (decl));
761 value = DECL_RTL (decl);
763 /* Don't mention a variable at all
764 if it was completely optimized into nothingness.
766 If DECL was from an inline function, then its rtl
767 is not identically the rtl that was used in this
768 particular compilation. */
769 if (GET_CODE (value) == REG)
771 regno = REGNO (DECL_RTL (decl));
772 if (regno >= FIRST_PSEUDO_REGISTER)
775 else if (GET_CODE (value) == SUBREG)
779 while (GET_CODE (value) == SUBREG)
780 value = SUBREG_REG (value);
781 if (GET_CODE (value) == REG)
783 if (REGNO (value) >= FIRST_PSEUDO_REGISTER)
786 regno = REGNO (alter_subreg (DECL_RTL (decl)));
787 value = DECL_RTL (decl);
789 /* Don't output anything if an auto variable
790 gets RTL that is static.
791 GAS version 2.2 can't handle such output. */
792 else if (GET_CODE (value) == MEM && CONSTANT_P (XEXP (value, 0))
793 && ! TREE_STATIC (decl))
796 /* Emit any structure, union, or enum type that has not been output.
797 This occurs for tag-less structs (et al) used to declare variables
799 if (TREE_CODE (type) == ENUMERAL_TYPE
800 || TREE_CODE (type) == RECORD_TYPE
801 || TREE_CODE (type) == UNION_TYPE
802 || TREE_CODE (type) == QUAL_UNION_TYPE)
804 if (COMPLETE_TYPE_P (type) /* not a forward reference */
805 && KNOWN_TYPE_TAG (type) == 0) /* not yet declared */
806 sdbout_one_type (type);
809 /* Defer SDB information for top-level initialized variables! */
811 && GET_CODE (value) == MEM
812 && DECL_INITIAL (decl))
815 /* C++ in 2.3 makes nameless symbols. That will be fixed later.
816 For now, avoid crashing. */
817 if (DECL_NAME (decl) == NULL_TREE)
820 /* Record the name for, starting a symtab entry. */
822 name = IDENTIFIER_POINTER (DECL_NAME (decl));
824 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
826 if (GET_CODE (value) == MEM
827 && GET_CODE (XEXP (value, 0)) == SYMBOL_REF)
830 if (TREE_PUBLIC (decl))
832 PUT_SDB_VAL (XEXP (value, 0));
837 PUT_SDB_VAL (XEXP (value, 0));
838 PUT_SDB_SCL (C_STAT);
844 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (regno));
847 else if (GET_CODE (value) == MEM
848 && (GET_CODE (XEXP (value, 0)) == MEM
849 || (GET_CODE (XEXP (value, 0)) == REG
850 && REGNO (XEXP (value, 0)) != HARD_FRAME_POINTER_REGNUM
851 && REGNO (XEXP (value, 0)) != STACK_POINTER_REGNUM)))
852 /* If the value is indirect by memory or by a register
853 that isn't the frame pointer
854 then it means the object is variable-sized and address through
855 that register or stack slot. COFF has no way to represent this
856 so all we can do is output the variable as a pointer. */
859 if (GET_CODE (XEXP (value, 0)) == REG)
861 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (XEXP (value, 0))));
866 /* DECL_RTL looks like (MEM (MEM (PLUS (REG...)
868 We want the value of that CONST_INT. */
869 /* Encore compiler hates a newline in a macro arg, it seems. */
870 PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET
871 (XEXP (XEXP (value, 0), 0)));
872 PUT_SDB_SCL (C_AUTO);
875 /* Effectively do build_pointer_type, but don't cache this type,
876 since it might be temporary whereas the type it points to
877 might have been saved for inlining. */
878 /* Don't use REFERENCE_TYPE because dbx can't handle that. */
879 type = make_node (POINTER_TYPE);
880 TREE_TYPE (type) = TREE_TYPE (decl);
882 else if (GET_CODE (value) == MEM
883 && ((GET_CODE (XEXP (value, 0)) == PLUS
884 && GET_CODE (XEXP (XEXP (value, 0), 0)) == REG
885 && GET_CODE (XEXP (XEXP (value, 0), 1)) == CONST_INT)
886 /* This is for variables which are at offset zero from
887 the frame pointer. This happens on the Alpha.
888 Non-frame pointer registers are excluded above. */
889 || (GET_CODE (XEXP (value, 0)) == REG)))
891 /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...)))
892 or (MEM (REG...)). We want the value of that CONST_INT
895 PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET (XEXP (value, 0)));
896 PUT_SDB_SCL (C_AUTO);
898 else if (GET_CODE (value) == MEM && GET_CODE (XEXP (value, 0)) == CONST)
900 /* Handle an obscure case which can arise when optimizing and
901 when there are few available registers. (This is *always*
902 the case for i386/i486 targets). The DECL_RTL looks like
903 (MEM (CONST ...)) even though this variable is a local `auto'
904 or a local `register' variable. In effect, what has happened
905 is that the reload pass has seen that all assignments and
906 references for one such a local variable can be replaced by
907 equivalent assignments and references to some static storage
908 variable, thereby avoiding the need for a register. In such
909 cases we're forced to lie to debuggers and tell them that
910 this variable was itself `static'. */
912 PUT_SDB_VAL (XEXP (XEXP (value, 0), 0));
913 PUT_SDB_SCL (C_STAT);
917 /* It is something we don't know how to represent for SDB. */
925 PUT_SDB_TYPE (plain_type (type));
929 /* Output SDB information for a top-level initialized variable
930 that has been delayed. */
933 sdbout_toplevel_data (decl)
936 tree type = TREE_TYPE (decl);
938 if (DECL_IGNORED_P (decl))
941 if (! (TREE_CODE (decl) == VAR_DECL
942 && GET_CODE (DECL_RTL (decl)) == MEM
943 && DECL_INITIAL (decl)))
946 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
947 PUT_SDB_VAL (XEXP (DECL_RTL (decl), 0));
948 if (TREE_PUBLIC (decl))
954 PUT_SDB_SCL (C_STAT);
956 PUT_SDB_TYPE (plain_type (type));
960 #ifdef SDB_ALLOW_FORWARD_REFERENCES
962 /* Machinery to record and output anonymous types. */
964 static tree anonymous_types;
967 sdbout_queue_anonymous_type (type)
970 anonymous_types = tree_cons (NULL_TREE, type, anonymous_types);
974 sdbout_dequeue_anonymous_types ()
976 register tree types, link;
978 while (anonymous_types)
980 types = nreverse (anonymous_types);
981 anonymous_types = NULL_TREE;
983 for (link = types; link; link = TREE_CHAIN (link))
985 register tree type = TREE_VALUE (link);
987 if (type && ! TREE_ASM_WRITTEN (type))
988 sdbout_one_type (type);
995 /* Given a chain of ..._TYPE nodes, all of which have names,
996 output definitions of those names, as typedefs. */
1000 register tree types;
1004 for (link = types; link; link = TREE_CHAIN (link))
1005 sdbout_one_type (link);
1007 #ifdef SDB_ALLOW_FORWARD_REFERENCES
1008 sdbout_dequeue_anonymous_types ();
1016 if (type == error_mark_node)
1017 type = integer_type_node;
1018 PUT_SDB_TYPE (plain_type (type));
1021 /* Output types of the fields of type TYPE, if they are structs.
1023 Formerly did not chase through pointer types, since that could be circular.
1024 They must come before TYPE, since forward refs are not allowed.
1025 Now james@bigtex.cactus.org says to try them. */
1028 sdbout_field_types (type)
1033 for (tail = TYPE_FIELDS (type); tail; tail = TREE_CHAIN (tail))
1034 /* This condition should match the one for emitting the actual
1036 if (TREE_CODE (tail) == FIELD_DECL
1039 && host_integerp (DECL_SIZE (tail), 1)
1040 && host_integerp (bit_position (tail), 0))
1042 if (POINTER_TYPE_P (TREE_TYPE (tail)))
1043 sdbout_one_type (TREE_TYPE (TREE_TYPE (tail)));
1045 sdbout_one_type (TREE_TYPE (tail));
1049 /* Use this to put out the top level defined record and union types
1050 for later reference. If this is a struct with a name, then put that
1051 name out. Other unnamed structs will have .xxfake labels generated so
1052 that they may be referred to later.
1053 The label will be stored in the KNOWN_TYPE_TAG slot of a type.
1054 It may NOT be called recursively. */
1057 sdbout_one_type (type)
1060 if (current_function_decl != NULL_TREE
1061 && DECL_SECTION_NAME (current_function_decl) != NULL_TREE)
1062 ; /* Don't change section amid function. */
1066 switch (TREE_CODE (type))
1070 case QUAL_UNION_TYPE:
1072 type = TYPE_MAIN_VARIANT (type);
1073 /* Don't output a type twice. */
1074 if (TREE_ASM_WRITTEN (type))
1075 /* James said test TREE_ASM_BEING_WRITTEN here. */
1078 /* Output nothing if type is not yet defined. */
1079 if (!COMPLETE_TYPE_P (type))
1082 TREE_ASM_WRITTEN (type) = 1;
1084 /* This is reputed to cause trouble with the following case,
1085 but perhaps checking TYPE_SIZE above will fix it. */
1087 /* Here is a test case:
1093 typedef struct intermediate {
1097 typedef struct badstr {
1102 TREE_ASM_BEING_WRITTEN (type) = 1;
1104 /* This change, which ought to make better output,
1105 used to make the COFF assembler unhappy.
1106 Changes involving KNOWN_TYPE_TAG may fix the problem. */
1107 /* Before really doing anything, output types we want to refer to. */
1108 /* Note that in version 1 the following two lines
1109 are not used if forward references are in use. */
1110 if (TREE_CODE (type) != ENUMERAL_TYPE)
1111 sdbout_field_types (type);
1113 TREE_ASM_WRITTEN (type) = 1;
1117 /* Output a structure type. */
1119 int size = int_size_in_bytes (type);
1122 int i, n_baseclasses = 0;
1124 /* Record the type tag, but not in its permanent place just yet. */
1125 sdbout_record_type_name (type);
1127 PUT_SDB_DEF (KNOWN_TYPE_TAG (type));
1129 switch (TREE_CODE (type))
1132 case QUAL_UNION_TYPE:
1133 PUT_SDB_SCL (C_UNTAG);
1134 PUT_SDB_TYPE (T_UNION);
1139 PUT_SDB_SCL (C_STRTAG);
1140 PUT_SDB_TYPE (T_STRUCT);
1145 PUT_SDB_SCL (C_ENTAG);
1146 PUT_SDB_TYPE (T_ENUM);
1154 PUT_SDB_SIZE (size);
1157 /* Print out the base class information with fields
1158 named after the types they hold. */
1159 /* This is only relevent to aggregate types. TYPE_BINFO is used
1160 for other purposes in an ENUMERAL_TYPE, so we must exclude that
1162 if (TREE_CODE (type) != ENUMERAL_TYPE)
1164 if (TYPE_BINFO (type)
1165 && TYPE_BINFO_BASETYPES (type))
1166 n_baseclasses = TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (type));
1167 for (i = 0; i < n_baseclasses; i++)
1169 tree child = TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (type)),
1171 tree child_type = BINFO_TYPE (child);
1172 tree child_type_name;
1173 if (TYPE_NAME (child_type) == 0)
1175 if (TREE_CODE (TYPE_NAME (child_type)) == IDENTIFIER_NODE)
1176 child_type_name = TYPE_NAME (child_type);
1177 else if (TREE_CODE (TYPE_NAME (child_type)) == TYPE_DECL)
1179 child_type_name = DECL_NAME (TYPE_NAME (child_type));
1180 if (child_type_name && template_name_p (child_type_name))
1182 = DECL_ASSEMBLER_NAME (TYPE_NAME (child_type));
1188 PUT_SDB_DEF (IDENTIFIER_POINTER (child_type_name));
1189 PUT_SDB_INT_VAL (tree_low_cst (BINFO_OFFSET (child), 0));
1190 PUT_SDB_SCL (member_scl);
1191 sdbout_type (BINFO_TYPE (child));
1196 /* output the individual fields */
1198 if (TREE_CODE (type) == ENUMERAL_TYPE)
1200 for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
1201 if (host_integerp (TREE_VALUE (tem), 0))
1203 PUT_SDB_DEF (IDENTIFIER_POINTER (TREE_PURPOSE (tem)));
1204 PUT_SDB_INT_VAL (tree_low_cst (TREE_VALUE (tem), 0));
1205 PUT_SDB_SCL (C_MOE);
1206 PUT_SDB_TYPE (T_MOE);
1210 else /* record or union type */
1211 for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
1212 /* Output the name, type, position (in bits), size (in bits)
1215 /* Omit here the nameless fields that are used to skip bits.
1216 Also omit fields with variable size or position.
1217 Also omit non FIELD_DECL nodes that GNU C++ may put here. */
1218 if (TREE_CODE (tem) == FIELD_DECL
1221 && host_integerp (DECL_SIZE (tem), 1)
1222 && host_integerp (bit_position (tem), 0))
1227 name = IDENTIFIER_POINTER (DECL_NAME (tem));
1229 if (DECL_BIT_FIELD_TYPE (tem))
1231 PUT_SDB_INT_VAL (int_bit_position (tem));
1232 PUT_SDB_SCL (C_FIELD);
1233 sdbout_type (DECL_BIT_FIELD_TYPE (tem));
1234 PUT_SDB_SIZE (tree_low_cst (DECL_SIZE (tem), 1));
1238 PUT_SDB_INT_VAL (int_bit_position (tem) / BITS_PER_UNIT);
1239 PUT_SDB_SCL (member_scl);
1240 sdbout_type (TREE_TYPE (tem));
1244 /* output end of a structure,union, or enumeral definition */
1246 PUT_SDB_PLAIN_DEF ("eos");
1247 PUT_SDB_INT_VAL (size);
1248 PUT_SDB_SCL (C_EOS);
1249 PUT_SDB_TAG (KNOWN_TYPE_TAG (type));
1250 PUT_SDB_SIZE (size);
1260 /* The following two functions output definitions of function parameters.
1261 Each parameter gets a definition locating it in the parameter list.
1262 Each parameter that is a register variable gets a second definition
1263 locating it in the register.
1265 Printing or argument lists in gdb uses the definitions that
1266 locate in the parameter list. But reference to the variable in
1267 expressions uses preferentially the definition as a register. */
1269 /* Output definitions, referring to storage in the parmlist,
1270 of all the parms in PARMS, which is a chain of PARM_DECL nodes. */
1273 sdbout_parms (parms)
1276 for (; parms; parms = TREE_CHAIN (parms))
1277 if (DECL_NAME (parms))
1279 int current_sym_value = 0;
1280 const char *name = IDENTIFIER_POINTER (DECL_NAME (parms));
1282 if (name == 0 || *name == 0)
1283 name = gen_fake_label ();
1285 /* Perform any necessary register eliminations on the parameter's rtl,
1286 so that the debugging output will be accurate. */
1287 DECL_INCOMING_RTL (parms)
1288 = eliminate_regs (DECL_INCOMING_RTL (parms), 0, NULL_RTX);
1289 SET_DECL_RTL (parms,
1290 eliminate_regs (DECL_RTL (parms), 0, NULL_RTX));
1292 if (PARM_PASSED_IN_MEMORY (parms))
1294 rtx addr = XEXP (DECL_INCOMING_RTL (parms), 0);
1297 /* ??? Here we assume that the parm address is indexed
1298 off the frame pointer or arg pointer.
1299 If that is not true, we produce meaningless results,
1300 but do not crash. */
1301 if (GET_CODE (addr) == PLUS
1302 && GET_CODE (XEXP (addr, 1)) == CONST_INT)
1303 current_sym_value = INTVAL (XEXP (addr, 1));
1305 current_sym_value = 0;
1307 if (GET_CODE (DECL_RTL (parms)) == REG
1308 && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
1309 type = DECL_ARG_TYPE (parms);
1312 int original_sym_value = current_sym_value;
1314 /* This is the case where the parm is passed as an int or
1315 double and it is converted to a char, short or float
1316 and stored back in the parmlist. In this case, describe
1317 the parm with the variable's declared type, and adjust
1318 the address if the least significant bytes (which we are
1319 using) are not the first ones. */
1320 if (BYTES_BIG_ENDIAN
1321 && TREE_TYPE (parms) != DECL_ARG_TYPE (parms))
1322 current_sym_value +=
1323 (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parms)))
1324 - GET_MODE_SIZE (GET_MODE (DECL_RTL (parms))));
1326 if (GET_CODE (DECL_RTL (parms)) == MEM
1327 && GET_CODE (XEXP (DECL_RTL (parms), 0)) == PLUS
1328 && (GET_CODE (XEXP (XEXP (DECL_RTL (parms), 0), 1))
1330 && (INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1))
1331 == current_sym_value))
1332 type = TREE_TYPE (parms);
1335 current_sym_value = original_sym_value;
1336 type = DECL_ARG_TYPE (parms);
1341 PUT_SDB_INT_VAL (DEBUGGER_ARG_OFFSET (current_sym_value, addr));
1342 PUT_SDB_SCL (C_ARG);
1343 PUT_SDB_TYPE (plain_type (type));
1346 else if (GET_CODE (DECL_RTL (parms)) == REG)
1349 /* Parm passed in registers and lives in registers or nowhere. */
1351 /* If parm lives in a register, use that register;
1352 pretend the parm was passed there. It would be more consistent
1353 to describe the register where the parm was passed,
1354 but in practice that register usually holds something else. */
1355 if (REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
1356 best_rtl = DECL_RTL (parms);
1357 /* If the parm lives nowhere,
1358 use the register where it was passed. */
1360 best_rtl = DECL_INCOMING_RTL (parms);
1363 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (best_rtl)));
1364 PUT_SDB_SCL (C_REGPARM);
1365 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
1368 else if (GET_CODE (DECL_RTL (parms)) == MEM
1369 && XEXP (DECL_RTL (parms), 0) != const0_rtx)
1371 /* Parm was passed in registers but lives on the stack. */
1373 /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))),
1374 in which case we want the value of that CONST_INT,
1375 or (MEM (REG ...)) or (MEM (MEM ...)),
1376 in which case we use a value of zero. */
1377 if (GET_CODE (XEXP (DECL_RTL (parms), 0)) == REG
1378 || GET_CODE (XEXP (DECL_RTL (parms), 0)) == MEM)
1379 current_sym_value = 0;
1381 current_sym_value = INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1));
1383 /* Again, this assumes the offset is based on the arg pointer. */
1385 PUT_SDB_INT_VAL (DEBUGGER_ARG_OFFSET (current_sym_value,
1386 XEXP (DECL_RTL (parms), 0)));
1387 PUT_SDB_SCL (C_ARG);
1388 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
1394 /* Output definitions for the places where parms live during the function,
1395 when different from where they were passed, when the parms were passed
1398 It is not useful to do this for parms passed in registers
1399 that live during the function in different registers, because it is
1400 impossible to look in the passed register for the passed value,
1401 so we use the within-the-function register to begin with.
1403 PARMS is a chain of PARM_DECL nodes. */
1406 sdbout_reg_parms (parms)
1409 for (; parms; parms = TREE_CHAIN (parms))
1410 if (DECL_NAME (parms))
1412 const char *name = IDENTIFIER_POINTER (DECL_NAME (parms));
1414 /* Report parms that live in registers during the function
1415 but were passed in memory. */
1416 if (GET_CODE (DECL_RTL (parms)) == REG
1417 && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER
1418 && PARM_PASSED_IN_MEMORY (parms))
1420 if (name == 0 || *name == 0)
1421 name = gen_fake_label ();
1423 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (DECL_RTL (parms))));
1424 PUT_SDB_SCL (C_REG);
1425 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
1428 /* Report parms that live in memory but not where they were passed. */
1429 else if (GET_CODE (DECL_RTL (parms)) == MEM
1430 && GET_CODE (XEXP (DECL_RTL (parms), 0)) == PLUS
1431 && GET_CODE (XEXP (XEXP (DECL_RTL (parms), 0), 1)) == CONST_INT
1432 && PARM_PASSED_IN_MEMORY (parms)
1433 && ! rtx_equal_p (DECL_RTL (parms), DECL_INCOMING_RTL (parms)))
1435 #if 0 /* ??? It is not clear yet what should replace this. */
1436 int offset = DECL_OFFSET (parms) / BITS_PER_UNIT;
1437 /* A parm declared char is really passed as an int,
1438 so it occupies the least significant bytes.
1439 On a big-endian machine those are not the low-numbered ones. */
1440 if (BYTES_BIG_ENDIAN
1442 && TREE_TYPE (parms) != DECL_ARG_TYPE (parms))
1443 offset += (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parms)))
1444 - GET_MODE_SIZE (GET_MODE (DECL_RTL (parms))));
1445 if (INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1)) != offset) {...}
1448 if (name == 0 || *name == 0)
1449 name = gen_fake_label ();
1451 PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET
1452 (XEXP (DECL_RTL (parms), 0)));
1453 PUT_SDB_SCL (C_AUTO);
1454 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
1461 /* Describe the beginning of an internal block within a function.
1462 Also output descriptions of variables defined in this block.
1464 N is the number of the block, by order of beginning, counting from 1,
1465 and not counting the outermost (function top-level) block.
1466 The blocks match the BLOCKs in DECL_INITIAL (current_function_decl),
1467 if the count starts at 0 for the outermost one. */
1470 sdbout_begin_block (file, line, n)
1471 FILE *file ATTRIBUTE_UNUSED;
1475 tree decl = current_function_decl;
1476 MAKE_LINE_SAFE (line);
1478 /* The SCO compiler does not emit a separate block for the function level
1479 scope, so we avoid it here also. However, mips ECOFF compilers do emit
1480 a separate block, so we retain it when MIPS_DEBUGGING_INFO is defined. */
1481 #ifndef MIPS_DEBUGGING_INFO
1484 PUT_SDB_BLOCK_START (line - sdb_begin_function_line);
1488 /* Include the outermost BLOCK's variables in block 1. */
1489 do_block = BLOCK_NUMBER (DECL_INITIAL (decl));
1490 sdbout_block (DECL_INITIAL (decl));
1492 /* If -g1, suppress all the internal symbols of functions
1493 except for arguments. */
1494 if (debug_info_level != DINFO_LEVEL_TERSE)
1497 sdbout_block (DECL_INITIAL (decl));
1500 #ifdef SDB_ALLOW_FORWARD_REFERENCES
1501 sdbout_dequeue_anonymous_types ();
1505 /* Describe the end line-number of an internal block within a function. */
1508 sdbout_end_block (file, line, n)
1509 FILE *file ATTRIBUTE_UNUSED;
1511 int n ATTRIBUTE_UNUSED;
1513 MAKE_LINE_SAFE (line);
1515 /* The SCO compiler does not emit a separate block for the function level
1516 scope, so we avoid it here also. However, mips ECOFF compilers do emit
1517 a separate block, so we retain it when MIPS_DEBUGGING_INFO is defined. */
1518 #ifndef MIPS_DEBUGGING_INFO
1521 PUT_SDB_BLOCK_END (line - sdb_begin_function_line);
1524 /* Output sdb info for the current function name.
1525 Called from assemble_start_function. */
1528 sdbout_mark_begin_function ()
1530 sdbout_symbol (current_function_decl, 0);
1533 /* Called at beginning of function body (after prologue).
1534 Record the function's starting line number, so we can output
1535 relative line numbers for the other lines.
1536 Describe beginning of outermost block.
1537 Also describe the parameter list. */
1540 sdbout_begin_function (line)
1543 sdb_begin_function_line = line - 1;
1544 PUT_SDB_FUNCTION_START (line);
1545 sdbout_parms (DECL_ARGUMENTS (current_function_decl));
1546 sdbout_reg_parms (DECL_ARGUMENTS (current_function_decl));
1549 /* Called at end of function (before epilogue).
1550 Describe end of outermost block. */
1553 sdbout_end_function (line)
1556 #ifdef SDB_ALLOW_FORWARD_REFERENCES
1557 sdbout_dequeue_anonymous_types ();
1560 MAKE_LINE_SAFE (line);
1561 PUT_SDB_FUNCTION_END (line - sdb_begin_function_line);
1563 /* Indicate we are between functions, for line-number output. */
1564 sdb_begin_function_line = -1;
1567 /* Output sdb info for the absolute end of a function.
1568 Called after the epilogue is output. */
1571 sdbout_end_epilogue ()
1573 PUT_SDB_EPILOGUE_END
1574 (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl)));
1577 /* Output sdb info for the given label. Called only if LABEL_NAME (insn)
1584 PUT_SDB_DEF (LABEL_NAME (insn));
1586 PUT_SDB_SCL (C_LABEL);
1587 PUT_SDB_TYPE (T_NULL);
1591 /* Change to reading from a new source file. */
1594 sdbout_start_source_file (line, filename)
1595 unsigned int line ATTRIBUTE_UNUSED;
1596 const char *filename ATTRIBUTE_UNUSED;
1598 #ifdef MIPS_DEBUGGING_INFO
1599 struct sdb_file *n = (struct sdb_file *) xmalloc (sizeof *n);
1601 n->next = current_file;
1604 PUT_SDB_SRC_FILE (filename);
1608 /* Revert to reading a previous source file. */
1611 sdbout_end_source_file (line)
1612 unsigned int line ATTRIBUTE_UNUSED;
1614 #ifdef MIPS_DEBUGGING_INFO
1615 struct sdb_file *next;
1617 next = current_file->next;
1618 free (current_file);
1619 current_file = next;
1620 PUT_SDB_SRC_FILE (current_file->name);
1624 /* Set up for SDB output at the start of compilation. */
1627 sdbout_init (asm_file, input_file_name)
1628 FILE *asm_file ATTRIBUTE_UNUSED;
1629 const char *input_file_name ATTRIBUTE_UNUSED;
1631 #ifdef MIPS_DEBUGGING_INFO
1632 current_file = (struct sdb_file *) xmalloc (sizeof *current_file);
1633 current_file->next = NULL;
1634 current_file->name = input_file_name;
1637 #ifdef RMS_QUICK_HACK_1
1639 for (t = getdecls (); t; t = TREE_CHAIN (t))
1640 if (DECL_NAME (t) && IDENTIFIER_POINTER (DECL_NAME (t)) != 0
1641 && !strcmp (IDENTIFIER_POINTER (DECL_NAME (t)), "__vtbl_ptr_type"))
1642 sdbout_symbol (t, 0);
1645 #ifdef SDB_ALLOW_FORWARD_REFERENCES
1646 ggc_add_tree_root (&anonymous_types, 1);
1650 #endif /* SDB_DEBUGGING_INFO */