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"
61 /* 1 if PARM is passed to this function in memory. */
63 #define PARM_PASSED_IN_MEMORY(PARM) \
64 (GET_CODE (DECL_INCOMING_RTL (PARM)) == MEM)
66 /* A C expression for the integer offset value of an automatic variable
67 (C_AUTO) having address X (an RTX). */
68 #ifndef DEBUGGER_AUTO_OFFSET
69 #define DEBUGGER_AUTO_OFFSET(X) \
70 (GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0)
73 /* A C expression for the integer offset value of an argument (C_ARG)
74 having address X (an RTX). The nominal offset is OFFSET. */
75 #ifndef DEBUGGER_ARG_OFFSET
76 #define DEBUGGER_ARG_OFFSET(OFFSET, X) (OFFSET)
79 /* Line number of beginning of current function, minus one.
80 Negative means not in a function or not using sdb. */
82 int sdb_begin_function_line = -1;
84 /* Counter to generate unique "names" for nameless struct members. */
86 static int unnamed_struct_number = 0;
88 extern FILE *asm_out_file;
90 extern tree current_function_decl;
94 static char *gen_fake_label PARAMS ((void));
95 static int plain_type PARAMS ((tree));
96 static int template_name_p PARAMS ((tree));
97 static void sdbout_record_type_name PARAMS ((tree));
98 static int plain_type_1 PARAMS ((tree, int));
99 static void sdbout_block PARAMS ((tree));
100 static void sdbout_syms PARAMS ((tree));
101 #ifdef SDB_ALLOW_FORWARD_REFERENCES
102 static void sdbout_queue_anonymous_type PARAMS ((tree));
103 static void sdbout_dequeue_anonymous_types PARAMS ((void));
105 static void sdbout_type PARAMS ((tree));
106 static void sdbout_field_types PARAMS ((tree));
107 static void sdbout_one_type PARAMS ((tree));
108 static void sdbout_parms PARAMS ((tree));
109 static void sdbout_reg_parms PARAMS ((tree));
111 /* Random macros describing parts of SDB data. */
113 /* Put something here if lines get too long */
116 /* Default value of delimiter is ";". */
118 #define SDB_DELIM ";"
121 /* Maximum number of dimensions the assembler will allow. */
123 #define SDB_MAX_DIM 4
127 #define PUT_SDB_SCL(a) fprintf(asm_out_file, "\t.scl\t%d%s", (a), SDB_DELIM)
130 #ifndef PUT_SDB_INT_VAL
131 #define PUT_SDB_INT_VAL(a) \
133 fputs ("\t.val\t", asm_out_file); \
134 fprintf (asm_out_file, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT)(a)); \
135 fprintf (asm_out_file, "%s", SDB_DELIM); \
141 #define PUT_SDB_VAL(a) \
142 ( fputs ("\t.val\t", asm_out_file), \
143 output_addr_const (asm_out_file, (a)), \
144 fprintf (asm_out_file, SDB_DELIM))
148 #define PUT_SDB_DEF(a) \
149 do { fprintf (asm_out_file, "\t.def\t"); \
150 assemble_name (asm_out_file, a); \
151 fprintf (asm_out_file, SDB_DELIM); } while (0)
154 #ifndef PUT_SDB_PLAIN_DEF
155 #define PUT_SDB_PLAIN_DEF(a) fprintf(asm_out_file,"\t.def\t.%s%s",a, SDB_DELIM)
158 #ifndef PUT_SDB_ENDEF
159 #define PUT_SDB_ENDEF fputs("\t.endef\n", asm_out_file)
163 #define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\t.type\t0%o%s", a, SDB_DELIM)
167 #define PUT_SDB_SIZE(a) \
169 fputs ("\t.size\t", asm_out_file); \
170 fprintf (asm_out_file, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT)(a)); \
171 fprintf (asm_out_file, "%s", SDB_DELIM); \
175 #ifndef PUT_SDB_START_DIM
176 #define PUT_SDB_START_DIM fprintf(asm_out_file, "\t.dim\t")
179 #ifndef PUT_SDB_NEXT_DIM
180 #define PUT_SDB_NEXT_DIM(a) fprintf(asm_out_file, "%d,", a)
183 #ifndef PUT_SDB_LAST_DIM
184 #define PUT_SDB_LAST_DIM(a) fprintf(asm_out_file, "%d%s", a, SDB_DELIM)
188 #define PUT_SDB_TAG(a) \
189 do { fprintf (asm_out_file, "\t.tag\t"); \
190 assemble_name (asm_out_file, a); \
191 fprintf (asm_out_file, SDB_DELIM); } while (0)
194 #ifndef PUT_SDB_BLOCK_START
195 #define PUT_SDB_BLOCK_START(LINE) \
196 fprintf (asm_out_file, \
197 "\t.def\t.bb%s\t.val\t.%s\t.scl\t100%s\t.line\t%d%s\t.endef\n", \
198 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
201 #ifndef PUT_SDB_BLOCK_END
202 #define PUT_SDB_BLOCK_END(LINE) \
203 fprintf (asm_out_file, \
204 "\t.def\t.eb%s\t.val\t.%s\t.scl\t100%s\t.line\t%d%s\t.endef\n", \
205 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
208 #ifndef PUT_SDB_FUNCTION_START
209 #define PUT_SDB_FUNCTION_START(LINE) \
210 fprintf (asm_out_file, \
211 "\t.def\t.bf%s\t.val\t.%s\t.scl\t101%s\t.line\t%d%s\t.endef\n", \
212 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
215 #ifndef PUT_SDB_FUNCTION_END
216 #define PUT_SDB_FUNCTION_END(LINE) \
217 fprintf (asm_out_file, \
218 "\t.def\t.ef%s\t.val\t.%s\t.scl\t101%s\t.line\t%d%s\t.endef\n", \
219 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
222 #ifndef PUT_SDB_EPILOGUE_END
223 #define PUT_SDB_EPILOGUE_END(NAME) \
224 do { fprintf (asm_out_file, "\t.def\t"); \
225 assemble_name (asm_out_file, NAME); \
226 fprintf (asm_out_file, \
227 "%s\t.val\t.%s\t.scl\t-1%s\t.endef\n", \
228 SDB_DELIM, SDB_DELIM, SDB_DELIM); } while (0)
231 #ifndef SDB_GENERATE_FAKE
232 #define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
233 sprintf ((BUFFER), ".%dfake", (NUMBER));
236 /* Return the sdb tag identifier string for TYPE
237 if TYPE has already been defined; otherwise return a null pointer. */
239 #define KNOWN_TYPE_TAG(type) TYPE_SYMTAB_POINTER (type)
241 /* Set the sdb tag identifier string for TYPE to NAME. */
243 #define SET_KNOWN_TYPE_TAG(TYPE, NAME) \
244 TYPE_SYMTAB_POINTER (TYPE) = (NAME)
246 /* Return the name (a string) of the struct, union or enum tag
247 described by the TREE_LIST node LINK. This is 0 for an anonymous one. */
249 #define TAG_NAME(link) \
250 (((link) && TREE_PURPOSE ((link)) \
251 && IDENTIFIER_POINTER (TREE_PURPOSE ((link)))) \
252 ? IDENTIFIER_POINTER (TREE_PURPOSE ((link))) : (char *) 0)
254 /* Ensure we don't output a negative line number. */
255 #define MAKE_LINE_SAFE(line) \
256 if (line <= sdb_begin_function_line) line = sdb_begin_function_line + 1
258 /* Perform linker optimization of merging header file definitions together
259 for targets with MIPS_DEBUGGING_INFO defined. This won't work without a
260 post 960826 version of GAS. Nothing breaks with earlier versions of GAS,
261 the optimization just won't be done. The native assembler already has the
262 necessary support. */
264 #ifdef MIPS_DEBUGGING_INFO
266 #ifndef PUT_SDB_SRC_FILE
267 #define PUT_SDB_SRC_FILE(FILENAME) \
268 output_file_directive (asm_out_file, (FILENAME))
271 /* ECOFF linkers have an optimization that does the same kind of thing as
272 N_BINCL/E_INCL in stabs: eliminate duplicate debug information in the
273 executable. To achieve this, GCC must output a .file for each file
276 /* This is a stack of input files. */
280 struct sdb_file *next;
284 /* This is the top of the stack. */
286 static struct sdb_file *current_file;
288 #endif /* MIPS_DEBUGGING_INFO */
293 /* return the tag identifier for type
297 tag_of_ru_type (type,link)
300 if (TYPE_SYMTAB_ADDRESS (type))
301 return TYPE_SYMTAB_ADDRESS (type);
302 if (link && TREE_PURPOSE (link)
303 && IDENTIFIER_POINTER (TREE_PURPOSE (link)))
304 TYPE_SYMTAB_ADDRESS (type) = IDENTIFIER_POINTER (TREE_PURPOSE (link));
306 return (char *) TYPE_SYMTAB_ADDRESS (type);
310 /* Return a unique string to name an anonymous type. */
317 SDB_GENERATE_FAKE (label, unnamed_struct_number);
318 unnamed_struct_number++;
319 labelstr = (char *) permalloc (strlen (label) + 1);
320 strcpy (labelstr, label);
324 /* Return the number which describes TYPE for SDB.
325 For pointers, etc., this function is recursive.
326 Each record, union or enumeral type must already have had a
327 tag number output. */
329 /* The number is given by d6d5d4d3d2d1bbbb
330 where bbbb is 4 bit basic type, and di indicate one of notype,ptr,fn,array.
331 Thus, char *foo () has bbbb=T_CHAR
334 N_BTMASK= 017 1111 basic type field.
335 N_TSHIFT= 2 derived type shift
336 N_BTSHFT= 4 Basic type shift */
338 /* Produce the number that describes a pointer, function or array type.
339 PREV is the number describing the target, value or element type.
340 DT_type describes how to transform that type. */
341 #define PUSH_DERIVED_LEVEL(DT_type,PREV) \
342 ((((PREV) & ~(int)N_BTMASK) << (int)N_TSHIFT) \
343 | ((int)DT_type << (int)N_BTSHFT) \
344 | ((PREV) & (int)N_BTMASK))
346 /* Number of elements used in sdb_dims. */
347 static int sdb_n_dims = 0;
349 /* Table of array dimensions of current type. */
350 static int sdb_dims[SDB_MAX_DIM];
352 /* Size of outermost array currently being processed. */
353 static int sdb_type_size = -1;
359 int val = plain_type_1 (type, 0);
361 /* If we have already saved up some array dimensions, print them now. */
366 for (i = sdb_n_dims - 1; i > 0; i--)
367 PUT_SDB_NEXT_DIM (sdb_dims[i]);
368 PUT_SDB_LAST_DIM (sdb_dims[0]);
371 sdb_type_size = int_size_in_bytes (type);
372 /* Don't kill sdb if type is not laid out or has variable size. */
373 if (sdb_type_size < 0)
376 /* If we have computed the size of an array containing this type,
378 if (sdb_type_size >= 0)
380 PUT_SDB_SIZE (sdb_type_size);
387 template_name_p (name)
390 register const char *ptr = IDENTIFIER_POINTER (name);
391 while (*ptr && *ptr != '<')
398 sdbout_record_type_name (type)
401 const char *name = 0;
404 if (KNOWN_TYPE_TAG (type))
407 if (TYPE_NAME (type) != 0)
410 /* Find the IDENTIFIER_NODE for the type name. */
411 if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
412 t = TYPE_NAME (type);
413 else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL)
415 t = DECL_NAME (TYPE_NAME (type));
416 /* The DECL_NAME for templates includes "<>", which breaks
417 most assemblers. Use its assembler name instead, which
418 has been mangled into being safe. */
419 if (t && template_name_p (t))
420 t = DECL_ASSEMBLER_NAME (TYPE_NAME (type));
423 /* Now get the name as a string, or invent one. */
425 name = IDENTIFIER_POINTER (t);
428 no_name = (name == 0 || *name == 0);
430 name = gen_fake_label ();
432 SET_KNOWN_TYPE_TAG (type, name);
433 #ifdef SDB_ALLOW_FORWARD_REFERENCES
435 sdbout_queue_anonymous_type (type);
439 /* Return the .type value for type TYPE.
441 LEVEL indicates how many levels deep we have recursed into the type.
442 The SDB debug format can only represent 6 derived levels of types.
443 After that, we must output inaccurate debug info. We deliberately
444 stop before the 7th level, so that ADA recursive types will not give an
448 plain_type_1 (type, level)
453 type = void_type_node;
454 else if (type == error_mark_node)
455 type = integer_type_node;
457 type = TYPE_MAIN_VARIANT (type);
459 switch (TREE_CODE (type))
466 int size = int_size_in_bytes (type) * BITS_PER_UNIT;
468 /* Carefully distinguish all the standard types of C,
469 without messing up if the language is not C.
470 Note that we check only for the names that contain spaces;
471 other names might occur by coincidence in other languages. */
472 if (TYPE_NAME (type) != 0
473 && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
474 && DECL_NAME (TYPE_NAME (type)) != 0
475 && TREE_CODE (DECL_NAME (TYPE_NAME (type))) == IDENTIFIER_NODE)
478 = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
480 if (!strcmp (name, "char"))
482 if (!strcmp (name, "unsigned char"))
484 if (!strcmp (name, "signed char"))
486 if (!strcmp (name, "int"))
488 if (!strcmp (name, "unsigned int"))
490 if (!strcmp (name, "short int"))
492 if (!strcmp (name, "short unsigned int"))
494 if (!strcmp (name, "long int"))
496 if (!strcmp (name, "long unsigned int"))
500 if (size == INT_TYPE_SIZE)
501 return (TREE_UNSIGNED (type) ? T_UINT : T_INT);
502 if (size == CHAR_TYPE_SIZE)
503 return (TREE_UNSIGNED (type) ? T_UCHAR : T_CHAR);
504 if (size == SHORT_TYPE_SIZE)
505 return (TREE_UNSIGNED (type) ? T_USHORT : T_SHORT);
506 if (size == LONG_TYPE_SIZE)
507 return (TREE_UNSIGNED (type) ? T_ULONG : T_LONG);
508 if (size == LONG_LONG_TYPE_SIZE) /* better than nothing */
509 return (TREE_UNSIGNED (type) ? T_ULONG : T_LONG);
515 int precision = TYPE_PRECISION (type);
516 if (precision == FLOAT_TYPE_SIZE)
518 if (precision == DOUBLE_TYPE_SIZE)
520 #ifdef EXTENDED_SDB_BASIC_TYPES
521 if (precision == LONG_DOUBLE_TYPE_SIZE)
524 if (precision == LONG_DOUBLE_TYPE_SIZE)
525 return T_DOUBLE; /* better than nothing */
536 m = plain_type_1 (TREE_TYPE (type), level+1);
537 if (sdb_n_dims < SDB_MAX_DIM)
538 sdb_dims[sdb_n_dims++]
539 = (TYPE_DOMAIN (type)
540 && TYPE_MIN_VALUE (TYPE_DOMAIN (type)) != 0
541 && TYPE_MAX_VALUE (TYPE_DOMAIN (type)) != 0
542 && host_integerp (TYPE_MAX_VALUE (TYPE_DOMAIN (type)), 0)
543 && host_integerp (TYPE_MIN_VALUE (TYPE_DOMAIN (type)), 0)
544 ? (tree_low_cst (TYPE_MAX_VALUE (TYPE_DOMAIN (type)), 0)
545 - tree_low_cst (TYPE_MIN_VALUE (TYPE_DOMAIN (type)), 0) + 1)
548 return PUSH_DERIVED_LEVEL (DT_ARY, m);
553 case QUAL_UNION_TYPE:
557 #ifdef SDB_ALLOW_FORWARD_REFERENCES
558 sdbout_record_type_name (type);
560 #ifndef SDB_ALLOW_UNKNOWN_REFERENCES
561 if ((TREE_ASM_WRITTEN (type) && KNOWN_TYPE_TAG (type) != 0)
562 #ifdef SDB_ALLOW_FORWARD_REFERENCES
563 || TYPE_MODE (type) != VOIDmode
568 /* Output the referenced structure tag name
569 only if the .def has already been finished.
570 At least on 386, the Unix assembler
571 cannot handle forward references to tags. */
572 /* But the 88100, it requires them, sigh... */
573 /* And the MIPS requires unknown refs as well... */
574 tag = KNOWN_TYPE_TAG (type);
576 /* These 3 lines used to follow the close brace.
577 However, a size of 0 without a tag implies a tag of 0,
578 so if we don't know a tag, we can't mention the size. */
579 sdb_type_size = int_size_in_bytes (type);
580 if (sdb_type_size < 0)
583 return ((TREE_CODE (type) == RECORD_TYPE) ? T_STRUCT
584 : (TREE_CODE (type) == UNION_TYPE) ? T_UNION
585 : (TREE_CODE (type) == QUAL_UNION_TYPE) ? T_UNION
595 m = plain_type_1 (TREE_TYPE (type), level+1);
596 return PUSH_DERIVED_LEVEL (DT_PTR, m);
605 m = plain_type_1 (TREE_TYPE (type), level+1);
606 return PUSH_DERIVED_LEVEL (DT_FCN, m);
613 /* Output the symbols defined in block number DO_BLOCK.
615 This function works by walking the tree structure of blocks,
616 counting blocks until it finds the desired block. */
618 static int do_block = 0;
626 /* Ignore blocks never expanded or otherwise marked as real. */
627 if (TREE_USED (block))
629 /* When we reach the specified block, output its symbols. */
630 if (BLOCK_NUMBER (block) == do_block)
631 sdbout_syms (BLOCK_VARS (block));
633 /* If we are past the specified block, stop the scan. */
634 if (BLOCK_NUMBER (block) > do_block)
637 /* Scan the blocks within this block. */
638 sdbout_block (BLOCK_SUBBLOCKS (block));
641 block = BLOCK_CHAIN (block);
645 /* Call sdbout_symbol on each decl in the chain SYMS. */
653 if (TREE_CODE (syms) != LABEL_DECL)
654 sdbout_symbol (syms, 1);
655 syms = TREE_CHAIN (syms);
659 /* Output SDB information for a symbol described by DECL.
660 LOCAL is nonzero if the symbol is not file-scope. */
663 sdbout_symbol (decl, local)
667 tree type = TREE_TYPE (decl);
668 tree context = NULL_TREE;
673 sdbout_one_type (type);
675 #if 0 /* This loses when functions are marked to be ignored,
676 which happens in the C++ front end. */
677 if (DECL_IGNORED_P (decl))
681 switch (TREE_CODE (decl))
684 /* Enum values are defined by defining the enum type. */
688 /* Don't mention a nested function under its parent. */
689 context = decl_function_context (decl);
690 if (context == current_function_decl)
692 /* Check DECL_INITIAL to distinguish declarations from definitions.
693 Don't output debug info here for declarations; they will have
694 a DECL_INITIAL value of 0. */
695 if (! DECL_INITIAL (decl))
697 if (GET_CODE (DECL_RTL (decl)) != MEM
698 || GET_CODE (XEXP (DECL_RTL (decl), 0)) != SYMBOL_REF)
700 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
701 PUT_SDB_VAL (XEXP (DECL_RTL (decl), 0));
702 PUT_SDB_SCL (TREE_PUBLIC (decl) ? C_EXT : C_STAT);
706 /* Done with tagged types. */
707 if (DECL_NAME (decl) == 0)
709 if (DECL_IGNORED_P (decl))
712 /* Output typedef name. */
713 if (template_name_p (DECL_NAME (decl)))
714 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
716 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_NAME (decl)));
717 PUT_SDB_SCL (C_TPDEF);
721 /* Parm decls go in their own separate chains
722 and are output by sdbout_reg_parms and sdbout_parms. */
726 /* Don't mention a variable that is external.
727 Let the file that defines it describe it. */
728 if (DECL_EXTERNAL (decl))
731 /* Ignore __FUNCTION__, etc. */
732 if (DECL_IGNORED_P (decl))
735 /* If there was an error in the declaration, don't dump core
736 if there is no RTL associated with the variable doesn't
738 if (!DECL_RTL_SET_P (decl))
742 eliminate_regs (DECL_RTL (decl), 0, NULL_RTX));
743 #ifdef LEAF_REG_REMAP
744 if (current_function_uses_only_leaf_regs)
745 leaf_renumber_regs_insn (DECL_RTL (decl));
747 value = DECL_RTL (decl);
749 /* Don't mention a variable at all
750 if it was completely optimized into nothingness.
752 If DECL was from an inline function, then its rtl
753 is not identically the rtl that was used in this
754 particular compilation. */
755 if (GET_CODE (value) == REG)
757 regno = REGNO (DECL_RTL (decl));
758 if (regno >= FIRST_PSEUDO_REGISTER)
761 else if (GET_CODE (value) == SUBREG)
765 while (GET_CODE (value) == SUBREG)
766 value = SUBREG_REG (value);
767 if (GET_CODE (value) == REG)
769 if (REGNO (value) >= FIRST_PSEUDO_REGISTER)
772 regno = REGNO (alter_subreg (DECL_RTL (decl)));
773 value = DECL_RTL (decl);
775 /* Don't output anything if an auto variable
776 gets RTL that is static.
777 GAS version 2.2 can't handle such output. */
778 else if (GET_CODE (value) == MEM && CONSTANT_P (XEXP (value, 0))
779 && ! TREE_STATIC (decl))
782 /* Emit any structure, union, or enum type that has not been output.
783 This occurs for tag-less structs (et al) used to declare variables
785 if (TREE_CODE (type) == ENUMERAL_TYPE
786 || TREE_CODE (type) == RECORD_TYPE
787 || TREE_CODE (type) == UNION_TYPE
788 || TREE_CODE (type) == QUAL_UNION_TYPE)
790 if (COMPLETE_TYPE_P (type) /* not a forward reference */
791 && KNOWN_TYPE_TAG (type) == 0) /* not yet declared */
792 sdbout_one_type (type);
795 /* Defer SDB information for top-level initialized variables! */
797 && GET_CODE (value) == MEM
798 && DECL_INITIAL (decl))
801 /* C++ in 2.3 makes nameless symbols. That will be fixed later.
802 For now, avoid crashing. */
803 if (DECL_NAME (decl) == NULL_TREE)
806 /* Record the name for, starting a symtab entry. */
808 name = IDENTIFIER_POINTER (DECL_NAME (decl));
810 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
812 if (GET_CODE (value) == MEM
813 && GET_CODE (XEXP (value, 0)) == SYMBOL_REF)
816 if (TREE_PUBLIC (decl))
818 PUT_SDB_VAL (XEXP (value, 0));
823 PUT_SDB_VAL (XEXP (value, 0));
824 PUT_SDB_SCL (C_STAT);
830 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (regno));
833 else if (GET_CODE (value) == MEM
834 && (GET_CODE (XEXP (value, 0)) == MEM
835 || (GET_CODE (XEXP (value, 0)) == REG
836 && REGNO (XEXP (value, 0)) != HARD_FRAME_POINTER_REGNUM
837 && REGNO (XEXP (value, 0)) != STACK_POINTER_REGNUM)))
838 /* If the value is indirect by memory or by a register
839 that isn't the frame pointer
840 then it means the object is variable-sized and address through
841 that register or stack slot. COFF has no way to represent this
842 so all we can do is output the variable as a pointer. */
845 if (GET_CODE (XEXP (value, 0)) == REG)
847 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (XEXP (value, 0))));
852 /* DECL_RTL looks like (MEM (MEM (PLUS (REG...)
854 We want the value of that CONST_INT. */
855 /* Encore compiler hates a newline in a macro arg, it seems. */
856 PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET
857 (XEXP (XEXP (value, 0), 0)));
858 PUT_SDB_SCL (C_AUTO);
861 /* Effectively do build_pointer_type, but don't cache this type,
862 since it might be temporary whereas the type it points to
863 might have been saved for inlining. */
864 /* Don't use REFERENCE_TYPE because dbx can't handle that. */
865 type = make_node (POINTER_TYPE);
866 TREE_TYPE (type) = TREE_TYPE (decl);
868 else if (GET_CODE (value) == MEM
869 && ((GET_CODE (XEXP (value, 0)) == PLUS
870 && GET_CODE (XEXP (XEXP (value, 0), 0)) == REG
871 && GET_CODE (XEXP (XEXP (value, 0), 1)) == CONST_INT)
872 /* This is for variables which are at offset zero from
873 the frame pointer. This happens on the Alpha.
874 Non-frame pointer registers are excluded above. */
875 || (GET_CODE (XEXP (value, 0)) == REG)))
877 /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...)))
878 or (MEM (REG...)). We want the value of that CONST_INT
881 PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET (XEXP (value, 0)));
882 PUT_SDB_SCL (C_AUTO);
884 else if (GET_CODE (value) == MEM && GET_CODE (XEXP (value, 0)) == CONST)
886 /* Handle an obscure case which can arise when optimizing and
887 when there are few available registers. (This is *always*
888 the case for i386/i486 targets). The DECL_RTL looks like
889 (MEM (CONST ...)) even though this variable is a local `auto'
890 or a local `register' variable. In effect, what has happened
891 is that the reload pass has seen that all assignments and
892 references for one such a local variable can be replaced by
893 equivalent assignments and references to some static storage
894 variable, thereby avoiding the need for a register. In such
895 cases we're forced to lie to debuggers and tell them that
896 this variable was itself `static'. */
898 PUT_SDB_VAL (XEXP (XEXP (value, 0), 0));
899 PUT_SDB_SCL (C_STAT);
903 /* It is something we don't know how to represent for SDB. */
911 PUT_SDB_TYPE (plain_type (type));
915 /* Output SDB information for a top-level initialized variable
916 that has been delayed. */
919 sdbout_toplevel_data (decl)
922 tree type = TREE_TYPE (decl);
924 if (DECL_IGNORED_P (decl))
927 if (! (TREE_CODE (decl) == VAR_DECL
928 && GET_CODE (DECL_RTL (decl)) == MEM
929 && DECL_INITIAL (decl)))
932 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
933 PUT_SDB_VAL (XEXP (DECL_RTL (decl), 0));
934 if (TREE_PUBLIC (decl))
940 PUT_SDB_SCL (C_STAT);
942 PUT_SDB_TYPE (plain_type (type));
946 #ifdef SDB_ALLOW_FORWARD_REFERENCES
948 /* Machinery to record and output anonymous types. */
950 static tree anonymous_types;
953 sdbout_queue_anonymous_type (type)
956 anonymous_types = tree_cons (NULL_TREE, type, anonymous_types);
960 sdbout_dequeue_anonymous_types ()
962 register tree types, link;
964 while (anonymous_types)
966 types = nreverse (anonymous_types);
967 anonymous_types = NULL_TREE;
969 for (link = types; link; link = TREE_CHAIN (link))
971 register tree type = TREE_VALUE (link);
973 if (type && ! TREE_ASM_WRITTEN (type))
974 sdbout_one_type (type);
981 /* Given a chain of ..._TYPE nodes, all of which have names,
982 output definitions of those names, as typedefs. */
990 for (link = types; link; link = TREE_CHAIN (link))
991 sdbout_one_type (link);
993 #ifdef SDB_ALLOW_FORWARD_REFERENCES
994 sdbout_dequeue_anonymous_types ();
1002 if (type == error_mark_node)
1003 type = integer_type_node;
1004 PUT_SDB_TYPE (plain_type (type));
1007 /* Output types of the fields of type TYPE, if they are structs.
1009 Formerly did not chase through pointer types, since that could be circular.
1010 They must come before TYPE, since forward refs are not allowed.
1011 Now james@bigtex.cactus.org says to try them. */
1014 sdbout_field_types (type)
1019 for (tail = TYPE_FIELDS (type); tail; tail = TREE_CHAIN (tail))
1020 /* This condition should match the one for emitting the actual
1022 if (TREE_CODE (tail) == FIELD_DECL
1025 && host_integerp (DECL_SIZE (tail), 1)
1026 && host_integerp (bit_position (tail), 0))
1028 if (POINTER_TYPE_P (TREE_TYPE (tail)))
1029 sdbout_one_type (TREE_TYPE (TREE_TYPE (tail)));
1031 sdbout_one_type (TREE_TYPE (tail));
1035 /* Use this to put out the top level defined record and union types
1036 for later reference. If this is a struct with a name, then put that
1037 name out. Other unnamed structs will have .xxfake labels generated so
1038 that they may be referred to later.
1039 The label will be stored in the KNOWN_TYPE_TAG slot of a type.
1040 It may NOT be called recursively. */
1043 sdbout_one_type (type)
1046 if (current_function_decl != NULL_TREE
1047 && DECL_SECTION_NAME (current_function_decl) != NULL_TREE)
1048 ; /* Don't change section amid function. */
1052 switch (TREE_CODE (type))
1056 case QUAL_UNION_TYPE:
1058 type = TYPE_MAIN_VARIANT (type);
1059 /* Don't output a type twice. */
1060 if (TREE_ASM_WRITTEN (type))
1061 /* James said test TREE_ASM_BEING_WRITTEN here. */
1064 /* Output nothing if type is not yet defined. */
1065 if (!COMPLETE_TYPE_P (type))
1068 TREE_ASM_WRITTEN (type) = 1;
1070 /* This is reputed to cause trouble with the following case,
1071 but perhaps checking TYPE_SIZE above will fix it. */
1073 /* Here is a test case:
1079 typedef struct intermediate {
1083 typedef struct badstr {
1088 TREE_ASM_BEING_WRITTEN (type) = 1;
1090 /* This change, which ought to make better output,
1091 used to make the COFF assembler unhappy.
1092 Changes involving KNOWN_TYPE_TAG may fix the problem. */
1093 /* Before really doing anything, output types we want to refer to. */
1094 /* Note that in version 1 the following two lines
1095 are not used if forward references are in use. */
1096 if (TREE_CODE (type) != ENUMERAL_TYPE)
1097 sdbout_field_types (type);
1099 TREE_ASM_WRITTEN (type) = 1;
1103 /* Output a structure type. */
1105 int size = int_size_in_bytes (type);
1108 int i, n_baseclasses = 0;
1110 /* Record the type tag, but not in its permanent place just yet. */
1111 sdbout_record_type_name (type);
1113 PUT_SDB_DEF (KNOWN_TYPE_TAG (type));
1115 switch (TREE_CODE (type))
1118 case QUAL_UNION_TYPE:
1119 PUT_SDB_SCL (C_UNTAG);
1120 PUT_SDB_TYPE (T_UNION);
1125 PUT_SDB_SCL (C_STRTAG);
1126 PUT_SDB_TYPE (T_STRUCT);
1131 PUT_SDB_SCL (C_ENTAG);
1132 PUT_SDB_TYPE (T_ENUM);
1140 PUT_SDB_SIZE (size);
1143 /* Print out the base class information with fields
1144 named after the types they hold. */
1145 /* This is only relevent to aggregate types. TYPE_BINFO is used
1146 for other purposes in an ENUMERAL_TYPE, so we must exclude that
1148 if (TREE_CODE (type) != ENUMERAL_TYPE)
1150 if (TYPE_BINFO (type)
1151 && TYPE_BINFO_BASETYPES (type))
1152 n_baseclasses = TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (type));
1153 for (i = 0; i < n_baseclasses; i++)
1155 tree child = TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (type)),
1157 tree child_type = BINFO_TYPE (child);
1158 tree child_type_name;
1159 if (TYPE_NAME (child_type) == 0)
1161 if (TREE_CODE (TYPE_NAME (child_type)) == IDENTIFIER_NODE)
1162 child_type_name = TYPE_NAME (child_type);
1163 else if (TREE_CODE (TYPE_NAME (child_type)) == TYPE_DECL)
1165 child_type_name = DECL_NAME (TYPE_NAME (child_type));
1166 if (child_type_name && template_name_p (child_type_name))
1168 = DECL_ASSEMBLER_NAME (TYPE_NAME (child_type));
1174 PUT_SDB_DEF (IDENTIFIER_POINTER (child_type_name));
1175 PUT_SDB_INT_VAL (tree_low_cst (BINFO_OFFSET (child), 0));
1176 PUT_SDB_SCL (member_scl);
1177 sdbout_type (BINFO_TYPE (child));
1182 /* output the individual fields */
1184 if (TREE_CODE (type) == ENUMERAL_TYPE)
1186 for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
1187 if (host_integerp (TREE_VALUE (tem), 0))
1189 PUT_SDB_DEF (IDENTIFIER_POINTER (TREE_PURPOSE (tem)));
1190 PUT_SDB_INT_VAL (tree_low_cst (TREE_VALUE (tem), 0));
1191 PUT_SDB_SCL (C_MOE);
1192 PUT_SDB_TYPE (T_MOE);
1196 else /* record or union type */
1197 for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
1198 /* Output the name, type, position (in bits), size (in bits)
1201 /* Omit here the nameless fields that are used to skip bits.
1202 Also omit fields with variable size or position.
1203 Also omit non FIELD_DECL nodes that GNU C++ may put here. */
1204 if (TREE_CODE (tem) == FIELD_DECL
1207 && host_integerp (DECL_SIZE (tem), 1)
1208 && host_integerp (bit_position (tem), 0))
1213 name = IDENTIFIER_POINTER (DECL_NAME (tem));
1215 if (DECL_BIT_FIELD_TYPE (tem))
1217 PUT_SDB_INT_VAL (int_bit_position (tem));
1218 PUT_SDB_SCL (C_FIELD);
1219 sdbout_type (DECL_BIT_FIELD_TYPE (tem));
1220 PUT_SDB_SIZE (tree_low_cst (DECL_SIZE (tem), 1));
1224 PUT_SDB_INT_VAL (int_bit_position (tem) / BITS_PER_UNIT);
1225 PUT_SDB_SCL (member_scl);
1226 sdbout_type (TREE_TYPE (tem));
1230 /* output end of a structure,union, or enumeral definition */
1232 PUT_SDB_PLAIN_DEF ("eos");
1233 PUT_SDB_INT_VAL (size);
1234 PUT_SDB_SCL (C_EOS);
1235 PUT_SDB_TAG (KNOWN_TYPE_TAG (type));
1236 PUT_SDB_SIZE (size);
1246 /* The following two functions output definitions of function parameters.
1247 Each parameter gets a definition locating it in the parameter list.
1248 Each parameter that is a register variable gets a second definition
1249 locating it in the register.
1251 Printing or argument lists in gdb uses the definitions that
1252 locate in the parameter list. But reference to the variable in
1253 expressions uses preferentially the definition as a register. */
1255 /* Output definitions, referring to storage in the parmlist,
1256 of all the parms in PARMS, which is a chain of PARM_DECL nodes. */
1259 sdbout_parms (parms)
1262 for (; parms; parms = TREE_CHAIN (parms))
1263 if (DECL_NAME (parms))
1265 int current_sym_value = 0;
1266 const char *name = IDENTIFIER_POINTER (DECL_NAME (parms));
1268 if (name == 0 || *name == 0)
1269 name = gen_fake_label ();
1271 /* Perform any necessary register eliminations on the parameter's rtl,
1272 so that the debugging output will be accurate. */
1273 DECL_INCOMING_RTL (parms)
1274 = eliminate_regs (DECL_INCOMING_RTL (parms), 0, NULL_RTX);
1275 SET_DECL_RTL (parms,
1276 eliminate_regs (DECL_RTL (parms), 0, NULL_RTX));
1278 if (PARM_PASSED_IN_MEMORY (parms))
1280 rtx addr = XEXP (DECL_INCOMING_RTL (parms), 0);
1283 /* ??? Here we assume that the parm address is indexed
1284 off the frame pointer or arg pointer.
1285 If that is not true, we produce meaningless results,
1286 but do not crash. */
1287 if (GET_CODE (addr) == PLUS
1288 && GET_CODE (XEXP (addr, 1)) == CONST_INT)
1289 current_sym_value = INTVAL (XEXP (addr, 1));
1291 current_sym_value = 0;
1293 if (GET_CODE (DECL_RTL (parms)) == REG
1294 && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
1295 type = DECL_ARG_TYPE (parms);
1298 int original_sym_value = current_sym_value;
1300 /* This is the case where the parm is passed as an int or
1301 double and it is converted to a char, short or float
1302 and stored back in the parmlist. In this case, describe
1303 the parm with the variable's declared type, and adjust
1304 the address if the least significant bytes (which we are
1305 using) are not the first ones. */
1306 if (BYTES_BIG_ENDIAN
1307 && TREE_TYPE (parms) != DECL_ARG_TYPE (parms))
1308 current_sym_value +=
1309 (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parms)))
1310 - GET_MODE_SIZE (GET_MODE (DECL_RTL (parms))));
1312 if (GET_CODE (DECL_RTL (parms)) == MEM
1313 && GET_CODE (XEXP (DECL_RTL (parms), 0)) == PLUS
1314 && (GET_CODE (XEXP (XEXP (DECL_RTL (parms), 0), 1))
1316 && (INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1))
1317 == current_sym_value))
1318 type = TREE_TYPE (parms);
1321 current_sym_value = original_sym_value;
1322 type = DECL_ARG_TYPE (parms);
1327 PUT_SDB_INT_VAL (DEBUGGER_ARG_OFFSET (current_sym_value, addr));
1328 PUT_SDB_SCL (C_ARG);
1329 PUT_SDB_TYPE (plain_type (type));
1332 else if (GET_CODE (DECL_RTL (parms)) == REG)
1335 /* Parm passed in registers and lives in registers or nowhere. */
1337 /* If parm lives in a register, use that register;
1338 pretend the parm was passed there. It would be more consistent
1339 to describe the register where the parm was passed,
1340 but in practice that register usually holds something else. */
1341 if (REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
1342 best_rtl = DECL_RTL (parms);
1343 /* If the parm lives nowhere,
1344 use the register where it was passed. */
1346 best_rtl = DECL_INCOMING_RTL (parms);
1349 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (best_rtl)));
1350 PUT_SDB_SCL (C_REGPARM);
1351 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
1354 else if (GET_CODE (DECL_RTL (parms)) == MEM
1355 && XEXP (DECL_RTL (parms), 0) != const0_rtx)
1357 /* Parm was passed in registers but lives on the stack. */
1359 /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))),
1360 in which case we want the value of that CONST_INT,
1361 or (MEM (REG ...)) or (MEM (MEM ...)),
1362 in which case we use a value of zero. */
1363 if (GET_CODE (XEXP (DECL_RTL (parms), 0)) == REG
1364 || GET_CODE (XEXP (DECL_RTL (parms), 0)) == MEM)
1365 current_sym_value = 0;
1367 current_sym_value = INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1));
1369 /* Again, this assumes the offset is based on the arg pointer. */
1371 PUT_SDB_INT_VAL (DEBUGGER_ARG_OFFSET (current_sym_value,
1372 XEXP (DECL_RTL (parms), 0)));
1373 PUT_SDB_SCL (C_ARG);
1374 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
1380 /* Output definitions for the places where parms live during the function,
1381 when different from where they were passed, when the parms were passed
1384 It is not useful to do this for parms passed in registers
1385 that live during the function in different registers, because it is
1386 impossible to look in the passed register for the passed value,
1387 so we use the within-the-function register to begin with.
1389 PARMS is a chain of PARM_DECL nodes. */
1392 sdbout_reg_parms (parms)
1395 for (; parms; parms = TREE_CHAIN (parms))
1396 if (DECL_NAME (parms))
1398 const char *name = IDENTIFIER_POINTER (DECL_NAME (parms));
1400 /* Report parms that live in registers during the function
1401 but were passed in memory. */
1402 if (GET_CODE (DECL_RTL (parms)) == REG
1403 && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER
1404 && PARM_PASSED_IN_MEMORY (parms))
1406 if (name == 0 || *name == 0)
1407 name = gen_fake_label ();
1409 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (DECL_RTL (parms))));
1410 PUT_SDB_SCL (C_REG);
1411 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
1414 /* Report parms that live in memory but not where they were passed. */
1415 else if (GET_CODE (DECL_RTL (parms)) == MEM
1416 && GET_CODE (XEXP (DECL_RTL (parms), 0)) == PLUS
1417 && GET_CODE (XEXP (XEXP (DECL_RTL (parms), 0), 1)) == CONST_INT
1418 && PARM_PASSED_IN_MEMORY (parms)
1419 && ! rtx_equal_p (DECL_RTL (parms), DECL_INCOMING_RTL (parms)))
1421 #if 0 /* ??? It is not clear yet what should replace this. */
1422 int offset = DECL_OFFSET (parms) / BITS_PER_UNIT;
1423 /* A parm declared char is really passed as an int,
1424 so it occupies the least significant bytes.
1425 On a big-endian machine those are not the low-numbered ones. */
1426 if (BYTES_BIG_ENDIAN
1428 && TREE_TYPE (parms) != DECL_ARG_TYPE (parms))
1429 offset += (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parms)))
1430 - GET_MODE_SIZE (GET_MODE (DECL_RTL (parms))));
1431 if (INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1)) != offset) {...}
1434 if (name == 0 || *name == 0)
1435 name = gen_fake_label ();
1437 PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET
1438 (XEXP (DECL_RTL (parms), 0)));
1439 PUT_SDB_SCL (C_AUTO);
1440 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
1447 /* Describe the beginning of an internal block within a function.
1448 Also output descriptions of variables defined in this block.
1450 N is the number of the block, by order of beginning, counting from 1,
1451 and not counting the outermost (function top-level) block.
1452 The blocks match the BLOCKs in DECL_INITIAL (current_function_decl),
1453 if the count starts at 0 for the outermost one. */
1456 sdbout_begin_block (file, line, n)
1457 FILE *file ATTRIBUTE_UNUSED;
1461 tree decl = current_function_decl;
1462 MAKE_LINE_SAFE (line);
1464 /* The SCO compiler does not emit a separate block for the function level
1465 scope, so we avoid it here also. However, mips ECOFF compilers do emit
1466 a separate block, so we retain it when MIPS_DEBUGGING_INFO is defined. */
1467 #ifndef MIPS_DEBUGGING_INFO
1470 PUT_SDB_BLOCK_START (line - sdb_begin_function_line);
1474 /* Include the outermost BLOCK's variables in block 1. */
1475 do_block = BLOCK_NUMBER (DECL_INITIAL (decl));
1476 sdbout_block (DECL_INITIAL (decl));
1478 /* If -g1, suppress all the internal symbols of functions
1479 except for arguments. */
1480 if (debug_info_level != DINFO_LEVEL_TERSE)
1483 sdbout_block (DECL_INITIAL (decl));
1486 #ifdef SDB_ALLOW_FORWARD_REFERENCES
1487 sdbout_dequeue_anonymous_types ();
1491 /* Describe the end line-number of an internal block within a function. */
1494 sdbout_end_block (file, line, n)
1495 FILE *file ATTRIBUTE_UNUSED;
1497 int n ATTRIBUTE_UNUSED;
1499 MAKE_LINE_SAFE (line);
1501 /* The SCO compiler does not emit a separate block for the function level
1502 scope, so we avoid it here also. However, mips ECOFF compilers do emit
1503 a separate block, so we retain it when MIPS_DEBUGGING_INFO is defined. */
1504 #ifndef MIPS_DEBUGGING_INFO
1507 PUT_SDB_BLOCK_END (line - sdb_begin_function_line);
1510 /* Output sdb info for the current function name.
1511 Called from assemble_start_function. */
1514 sdbout_mark_begin_function ()
1516 sdbout_symbol (current_function_decl, 0);
1519 /* Called at beginning of function body (after prologue).
1520 Record the function's starting line number, so we can output
1521 relative line numbers for the other lines.
1522 Describe beginning of outermost block.
1523 Also describe the parameter list. */
1526 sdbout_begin_function (line)
1529 sdb_begin_function_line = line - 1;
1530 PUT_SDB_FUNCTION_START (line);
1531 sdbout_parms (DECL_ARGUMENTS (current_function_decl));
1532 sdbout_reg_parms (DECL_ARGUMENTS (current_function_decl));
1535 /* Called at end of function (before epilogue).
1536 Describe end of outermost block. */
1539 sdbout_end_function (line)
1542 #ifdef SDB_ALLOW_FORWARD_REFERENCES
1543 sdbout_dequeue_anonymous_types ();
1546 MAKE_LINE_SAFE (line);
1547 PUT_SDB_FUNCTION_END (line - sdb_begin_function_line);
1549 /* Indicate we are between functions, for line-number output. */
1550 sdb_begin_function_line = -1;
1553 /* Output sdb info for the absolute end of a function.
1554 Called after the epilogue is output. */
1557 sdbout_end_epilogue ()
1559 PUT_SDB_EPILOGUE_END
1560 (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl)));
1563 /* Output sdb info for the given label. Called only if LABEL_NAME (insn)
1570 PUT_SDB_DEF (LABEL_NAME (insn));
1572 PUT_SDB_SCL (C_LABEL);
1573 PUT_SDB_TYPE (T_NULL);
1577 /* Change to reading from a new source file. */
1580 sdbout_start_new_source_file (filename)
1581 const char *filename ATTRIBUTE_UNUSED;
1583 #ifdef MIPS_DEBUGGING_INFO
1584 struct sdb_file *n = (struct sdb_file *) xmalloc (sizeof *n);
1586 n->next = current_file;
1589 PUT_SDB_SRC_FILE (filename);
1593 /* Revert to reading a previous source file. */
1596 sdbout_resume_previous_source_file ()
1598 #ifdef MIPS_DEBUGGING_INFO
1599 struct sdb_file *next;
1601 next = current_file->next;
1602 free (current_file);
1603 current_file = next;
1604 PUT_SDB_SRC_FILE (current_file->name);
1608 /* Set up for SDB output at the start of compilation. */
1611 sdbout_init (asm_file, input_file_name, syms)
1612 FILE *asm_file ATTRIBUTE_UNUSED;
1613 const char *input_file_name ATTRIBUTE_UNUSED;
1614 tree syms ATTRIBUTE_UNUSED;
1616 #ifdef MIPS_DEBUGGING_INFO
1617 current_file = (struct sdb_file *) xmalloc (sizeof *current_file);
1618 current_file->next = NULL;
1619 current_file->name = input_file_name;
1622 #ifdef RMS_QUICK_HACK_1
1624 for (t = syms; t; t = TREE_CHAIN (t))
1625 if (DECL_NAME (t) && IDENTIFIER_POINTER (DECL_NAME (t)) != 0
1626 && !strcmp (IDENTIFIER_POINTER (DECL_NAME (t)), "__vtbl_ptr_type"))
1627 sdbout_symbol (t, 0);
1630 #ifdef SDB_ALLOW_FORWARD_REFERENCES
1631 ggc_add_tree_root (&anonymous_types, 1);
1635 #endif /* SDB_DEBUGGING_INFO */