1 /* Output sdb-format symbol table information from GNU compiler.
2 Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
3 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
54 #include "insn-config.h"
60 /* Mips systems use the SDB functions to dump out symbols, but do not
61 supply usable syms.h include files. Which syms.h file to use is a
62 target parameter so don't use the native one if we're cross compiling. */
64 #if defined(USG) && !defined(MIPS) && !defined (hpux) && !defined(_WIN32) && !defined(__linux__) && !defined(__INTERIX) && !defined(CROSS_COMPILE)
66 /* Use T_INT if we don't have T_VOID. */
74 /* #include <storclass.h> used to be this instead of syms.h. */
76 /* 1 if PARM is passed to this function in memory. */
78 #define PARM_PASSED_IN_MEMORY(PARM) \
79 (GET_CODE (DECL_INCOMING_RTL (PARM)) == MEM)
81 /* A C expression for the integer offset value of an automatic variable
82 (C_AUTO) having address X (an RTX). */
83 #ifndef DEBUGGER_AUTO_OFFSET
84 #define DEBUGGER_AUTO_OFFSET(X) \
85 (GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0)
88 /* A C expression for the integer offset value of an argument (C_ARG)
89 having address X (an RTX). The nominal offset is OFFSET. */
90 #ifndef DEBUGGER_ARG_OFFSET
91 #define DEBUGGER_ARG_OFFSET(OFFSET, X) (OFFSET)
94 /* Line number of beginning of current function, minus one.
95 Negative means not in a function or not using sdb. */
97 int sdb_begin_function_line = -1;
99 /* Counter to generate unique "names" for nameless struct members. */
101 static int unnamed_struct_number = 0;
103 extern FILE *asm_out_file;
105 extern tree current_function_decl;
109 static char *gen_fake_label PARAMS ((void));
110 static int plain_type PARAMS ((tree));
111 static int template_name_p PARAMS ((tree));
112 static void sdbout_record_type_name PARAMS ((tree));
113 static int plain_type_1 PARAMS ((tree, int));
114 static void sdbout_block PARAMS ((tree));
115 static void sdbout_syms PARAMS ((tree));
116 #ifdef SDB_ALLOW_FORWARD_REFERENCES
117 static void sdbout_queue_anonymous_type PARAMS ((tree));
118 static void sdbout_dequeue_anonymous_types PARAMS ((void));
120 static void sdbout_type PARAMS ((tree));
121 static void sdbout_field_types PARAMS ((tree));
122 static void sdbout_one_type PARAMS ((tree));
123 static void sdbout_parms PARAMS ((tree));
124 static void sdbout_reg_parms PARAMS ((tree));
126 /* Random macros describing parts of SDB data. */
128 /* Put something here if lines get too long */
131 /* Default value of delimiter is ";". */
133 #define SDB_DELIM ";"
136 /* Maximum number of dimensions the assembler will allow. */
138 #define SDB_MAX_DIM 4
142 #define PUT_SDB_SCL(a) fprintf(asm_out_file, "\t.scl\t%d%s", (a), SDB_DELIM)
145 #ifndef PUT_SDB_INT_VAL
146 #define PUT_SDB_INT_VAL(a) \
148 fputs ("\t.val\t", asm_out_file); \
149 fprintf (asm_out_file, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT)(a)); \
150 fprintf (asm_out_file, "%s", SDB_DELIM); \
156 #define PUT_SDB_VAL(a) \
157 ( fputs ("\t.val\t", asm_out_file), \
158 output_addr_const (asm_out_file, (a)), \
159 fprintf (asm_out_file, SDB_DELIM))
163 #define PUT_SDB_DEF(a) \
164 do { fprintf (asm_out_file, "\t.def\t"); \
165 assemble_name (asm_out_file, a); \
166 fprintf (asm_out_file, SDB_DELIM); } while (0)
169 #ifndef PUT_SDB_PLAIN_DEF
170 #define PUT_SDB_PLAIN_DEF(a) fprintf(asm_out_file,"\t.def\t.%s%s",a, SDB_DELIM)
173 #ifndef PUT_SDB_ENDEF
174 #define PUT_SDB_ENDEF fputs("\t.endef\n", asm_out_file)
178 #define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\t.type\t0%o%s", a, SDB_DELIM)
182 #define PUT_SDB_SIZE(a) \
184 fputs ("\t.size\t", asm_out_file); \
185 fprintf (asm_out_file, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT)(a)); \
186 fprintf (asm_out_file, "%s", SDB_DELIM); \
190 #ifndef PUT_SDB_START_DIM
191 #define PUT_SDB_START_DIM fprintf(asm_out_file, "\t.dim\t")
194 #ifndef PUT_SDB_NEXT_DIM
195 #define PUT_SDB_NEXT_DIM(a) fprintf(asm_out_file, "%d,", a)
198 #ifndef PUT_SDB_LAST_DIM
199 #define PUT_SDB_LAST_DIM(a) fprintf(asm_out_file, "%d%s", a, SDB_DELIM)
203 #define PUT_SDB_TAG(a) \
204 do { fprintf (asm_out_file, "\t.tag\t"); \
205 assemble_name (asm_out_file, a); \
206 fprintf (asm_out_file, SDB_DELIM); } while (0)
209 #ifndef PUT_SDB_BLOCK_START
210 #define PUT_SDB_BLOCK_START(LINE) \
211 fprintf (asm_out_file, \
212 "\t.def\t.bb%s\t.val\t.%s\t.scl\t100%s\t.line\t%d%s\t.endef\n", \
213 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
216 #ifndef PUT_SDB_BLOCK_END
217 #define PUT_SDB_BLOCK_END(LINE) \
218 fprintf (asm_out_file, \
219 "\t.def\t.eb%s\t.val\t.%s\t.scl\t100%s\t.line\t%d%s\t.endef\n", \
220 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
223 #ifndef PUT_SDB_FUNCTION_START
224 #define PUT_SDB_FUNCTION_START(LINE) \
225 fprintf (asm_out_file, \
226 "\t.def\t.bf%s\t.val\t.%s\t.scl\t101%s\t.line\t%d%s\t.endef\n", \
227 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
230 #ifndef PUT_SDB_FUNCTION_END
231 #define PUT_SDB_FUNCTION_END(LINE) \
232 fprintf (asm_out_file, \
233 "\t.def\t.ef%s\t.val\t.%s\t.scl\t101%s\t.line\t%d%s\t.endef\n", \
234 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
237 #ifndef PUT_SDB_EPILOGUE_END
238 #define PUT_SDB_EPILOGUE_END(NAME) \
239 do { fprintf (asm_out_file, "\t.def\t"); \
240 assemble_name (asm_out_file, NAME); \
241 fprintf (asm_out_file, \
242 "%s\t.val\t.%s\t.scl\t-1%s\t.endef\n", \
243 SDB_DELIM, SDB_DELIM, SDB_DELIM); } while (0)
246 #ifndef SDB_GENERATE_FAKE
247 #define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
248 sprintf ((BUFFER), ".%dfake", (NUMBER));
251 /* Return the sdb tag identifier string for TYPE
252 if TYPE has already been defined; otherwise return a null pointer. */
254 #define KNOWN_TYPE_TAG(type) TYPE_SYMTAB_POINTER (type)
256 /* Set the sdb tag identifier string for TYPE to NAME. */
258 #define SET_KNOWN_TYPE_TAG(TYPE, NAME) \
259 TYPE_SYMTAB_POINTER (TYPE) = (NAME)
261 /* Return the name (a string) of the struct, union or enum tag
262 described by the TREE_LIST node LINK. This is 0 for an anonymous one. */
264 #define TAG_NAME(link) \
265 (((link) && TREE_PURPOSE ((link)) \
266 && IDENTIFIER_POINTER (TREE_PURPOSE ((link)))) \
267 ? IDENTIFIER_POINTER (TREE_PURPOSE ((link))) : (char *) 0)
269 /* Ensure we don't output a negative line number. */
270 #define MAKE_LINE_SAFE(line) \
271 if (line <= sdb_begin_function_line) line = sdb_begin_function_line + 1
273 /* Perform linker optimization of merging header file definitions together
274 for targets with MIPS_DEBUGGING_INFO defined. This won't work without a
275 post 960826 version of GAS. Nothing breaks with earlier versions of GAS,
276 the optimization just won't be done. The native assembler already has the
277 necessary support. */
279 #ifdef MIPS_DEBUGGING_INFO
281 #ifndef PUT_SDB_SRC_FILE
282 #define PUT_SDB_SRC_FILE(FILENAME) \
283 output_file_directive (asm_out_file, (FILENAME))
286 /* ECOFF linkers have an optimization that does the same kind of thing as
287 N_BINCL/E_INCL in stabs: eliminate duplicate debug information in the
288 executable. To achieve this, GCC must output a .file for each file
291 /* This is a stack of input files. */
295 struct sdb_file *next;
299 /* This is the top of the stack. */
301 static struct sdb_file *current_file;
303 #endif /* MIPS_DEBUGGING_INFO */
305 /* Set up for SDB output at the start of compilation. */
308 sdbout_init (asm_file, input_file_name, syms)
309 FILE *asm_file ATTRIBUTE_UNUSED;
310 const char *input_file_name ATTRIBUTE_UNUSED;
311 tree syms ATTRIBUTE_UNUSED;
313 #ifdef MIPS_DEBUGGING_INFO
314 current_file = (struct sdb_file *) xmalloc (sizeof *current_file);
315 current_file->next = NULL;
316 current_file->name = input_file_name;
319 #ifdef RMS_QUICK_HACK_1
321 for (t = syms; t; t = TREE_CHAIN (t))
322 if (DECL_NAME (t) && IDENTIFIER_POINTER (DECL_NAME (t)) != 0
323 && !strcmp (IDENTIFIER_POINTER (DECL_NAME (t)), "__vtbl_ptr_type"))
324 sdbout_symbol (t, 0);
330 /* return the tag identifier for type
334 tag_of_ru_type (type,link)
337 if (TYPE_SYMTAB_ADDRESS (type))
338 return TYPE_SYMTAB_ADDRESS (type);
339 if (link && TREE_PURPOSE (link)
340 && IDENTIFIER_POINTER (TREE_PURPOSE (link)))
341 TYPE_SYMTAB_ADDRESS (type) = IDENTIFIER_POINTER (TREE_PURPOSE (link));
343 return (char *) TYPE_SYMTAB_ADDRESS (type);
347 /* Return a unique string to name an anonymous type. */
354 SDB_GENERATE_FAKE (label, unnamed_struct_number);
355 unnamed_struct_number++;
356 labelstr = (char *) permalloc (strlen (label) + 1);
357 strcpy (labelstr, label);
361 /* Return the number which describes TYPE for SDB.
362 For pointers, etc., this function is recursive.
363 Each record, union or enumeral type must already have had a
364 tag number output. */
366 /* The number is given by d6d5d4d3d2d1bbbb
367 where bbbb is 4 bit basic type, and di indicate one of notype,ptr,fn,array.
368 Thus, char *foo () has bbbb=T_CHAR
371 N_BTMASK= 017 1111 basic type field.
372 N_TSHIFT= 2 derived type shift
373 N_BTSHFT= 4 Basic type shift */
375 /* Produce the number that describes a pointer, function or array type.
376 PREV is the number describing the target, value or element type.
377 DT_type describes how to transform that type. */
378 #define PUSH_DERIVED_LEVEL(DT_type,PREV) \
379 ((((PREV) & ~(int)N_BTMASK) << (int)N_TSHIFT) \
380 | ((int)DT_type << (int)N_BTSHFT) \
381 | ((PREV) & (int)N_BTMASK))
383 /* Number of elements used in sdb_dims. */
384 static int sdb_n_dims = 0;
386 /* Table of array dimensions of current type. */
387 static int sdb_dims[SDB_MAX_DIM];
389 /* Size of outermost array currently being processed. */
390 static int sdb_type_size = -1;
396 int val = plain_type_1 (type, 0);
398 /* If we have already saved up some array dimensions, print them now. */
403 for (i = sdb_n_dims - 1; i > 0; i--)
404 PUT_SDB_NEXT_DIM (sdb_dims[i]);
405 PUT_SDB_LAST_DIM (sdb_dims[0]);
408 sdb_type_size = int_size_in_bytes (type);
409 /* Don't kill sdb if type is not laid out or has variable size. */
410 if (sdb_type_size < 0)
413 /* If we have computed the size of an array containing this type,
415 if (sdb_type_size >= 0)
417 PUT_SDB_SIZE (sdb_type_size);
424 template_name_p (name)
427 register const char *ptr = IDENTIFIER_POINTER (name);
428 while (*ptr && *ptr != '<')
435 sdbout_record_type_name (type)
438 const char *name = 0;
441 if (KNOWN_TYPE_TAG (type))
444 if (TYPE_NAME (type) != 0)
447 /* Find the IDENTIFIER_NODE for the type name. */
448 if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
449 t = TYPE_NAME (type);
450 else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL)
452 t = DECL_NAME (TYPE_NAME (type));
453 /* The DECL_NAME for templates includes "<>", which breaks
454 most assemblers. Use its assembler name instead, which
455 has been mangled into being safe. */
456 if (t && template_name_p (t))
457 t = DECL_ASSEMBLER_NAME (TYPE_NAME (type));
460 /* Now get the name as a string, or invent one. */
462 name = IDENTIFIER_POINTER (t);
465 no_name = (name == 0 || *name == 0);
467 name = gen_fake_label ();
469 SET_KNOWN_TYPE_TAG (type, name);
470 #ifdef SDB_ALLOW_FORWARD_REFERENCES
472 sdbout_queue_anonymous_type (type);
476 /* Return the .type value for type TYPE.
478 LEVEL indicates how many levels deep we have recursed into the type.
479 The SDB debug format can only represent 6 derived levels of types.
480 After that, we must output inaccurate debug info. We deliberately
481 stop before the 7th level, so that ADA recursive types will not give an
485 plain_type_1 (type, level)
490 type = void_type_node;
491 else if (type == error_mark_node)
492 type = integer_type_node;
494 type = TYPE_MAIN_VARIANT (type);
496 switch (TREE_CODE (type))
503 int size = int_size_in_bytes (type) * BITS_PER_UNIT;
505 /* Carefully distinguish all the standard types of C,
506 without messing up if the language is not C.
507 Note that we check only for the names that contain spaces;
508 other names might occur by coincidence in other languages. */
509 if (TYPE_NAME (type) != 0
510 && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
511 && DECL_NAME (TYPE_NAME (type)) != 0
512 && TREE_CODE (DECL_NAME (TYPE_NAME (type))) == IDENTIFIER_NODE)
515 = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
517 if (!strcmp (name, "char"))
519 if (!strcmp (name, "unsigned char"))
521 if (!strcmp (name, "signed char"))
523 if (!strcmp (name, "int"))
525 if (!strcmp (name, "unsigned int"))
527 if (!strcmp (name, "short int"))
529 if (!strcmp (name, "short unsigned int"))
531 if (!strcmp (name, "long int"))
533 if (!strcmp (name, "long unsigned int"))
537 if (size == INT_TYPE_SIZE)
538 return (TREE_UNSIGNED (type) ? T_UINT : T_INT);
539 if (size == CHAR_TYPE_SIZE)
540 return (TREE_UNSIGNED (type) ? T_UCHAR : T_CHAR);
541 if (size == SHORT_TYPE_SIZE)
542 return (TREE_UNSIGNED (type) ? T_USHORT : T_SHORT);
543 if (size == LONG_TYPE_SIZE)
544 return (TREE_UNSIGNED (type) ? T_ULONG : T_LONG);
545 if (size == LONG_LONG_TYPE_SIZE) /* better than nothing */
546 return (TREE_UNSIGNED (type) ? T_ULONG : T_LONG);
552 int precision = TYPE_PRECISION (type);
553 if (precision == FLOAT_TYPE_SIZE)
555 if (precision == DOUBLE_TYPE_SIZE)
557 #ifdef EXTENDED_SDB_BASIC_TYPES
558 if (precision == LONG_DOUBLE_TYPE_SIZE)
561 if (precision == LONG_DOUBLE_TYPE_SIZE)
562 return T_DOUBLE; /* better than nothing */
573 m = plain_type_1 (TREE_TYPE (type), level+1);
574 if (sdb_n_dims < SDB_MAX_DIM)
575 sdb_dims[sdb_n_dims++]
576 = (TYPE_DOMAIN (type)
577 && TYPE_MIN_VALUE (TYPE_DOMAIN (type)) != 0
578 && TYPE_MAX_VALUE (TYPE_DOMAIN (type)) != 0
579 && host_integerp (TYPE_MAX_VALUE (TYPE_DOMAIN (type)), 0)
580 && host_integerp (TYPE_MIN_VALUE (TYPE_DOMAIN (type)), 0)
581 ? (tree_low_cst (TYPE_MAX_VALUE (TYPE_DOMAIN (type)), 0)
582 - tree_low_cst (TYPE_MIN_VALUE (TYPE_DOMAIN (type)), 0) + 1)
585 return PUSH_DERIVED_LEVEL (DT_ARY, m);
590 case QUAL_UNION_TYPE:
594 #ifdef SDB_ALLOW_FORWARD_REFERENCES
595 sdbout_record_type_name (type);
597 #ifndef SDB_ALLOW_UNKNOWN_REFERENCES
598 if ((TREE_ASM_WRITTEN (type) && KNOWN_TYPE_TAG (type) != 0)
599 #ifdef SDB_ALLOW_FORWARD_REFERENCES
600 || TYPE_MODE (type) != VOIDmode
605 /* Output the referenced structure tag name
606 only if the .def has already been finished.
607 At least on 386, the Unix assembler
608 cannot handle forward references to tags. */
609 /* But the 88100, it requires them, sigh... */
610 /* And the MIPS requires unknown refs as well... */
611 tag = KNOWN_TYPE_TAG (type);
613 /* These 3 lines used to follow the close brace.
614 However, a size of 0 without a tag implies a tag of 0,
615 so if we don't know a tag, we can't mention the size. */
616 sdb_type_size = int_size_in_bytes (type);
617 if (sdb_type_size < 0)
620 return ((TREE_CODE (type) == RECORD_TYPE) ? T_STRUCT
621 : (TREE_CODE (type) == UNION_TYPE) ? T_UNION
622 : (TREE_CODE (type) == QUAL_UNION_TYPE) ? T_UNION
632 m = plain_type_1 (TREE_TYPE (type), level+1);
633 return PUSH_DERIVED_LEVEL (DT_PTR, m);
642 m = plain_type_1 (TREE_TYPE (type), level+1);
643 return PUSH_DERIVED_LEVEL (DT_FCN, m);
650 /* Output the symbols defined in block number DO_BLOCK.
652 This function works by walking the tree structure of blocks,
653 counting blocks until it finds the desired block. */
655 static int do_block = 0;
663 /* Ignore blocks never expanded or otherwise marked as real. */
664 if (TREE_USED (block))
666 /* When we reach the specified block, output its symbols. */
667 if (BLOCK_NUMBER (block) == do_block)
668 sdbout_syms (BLOCK_VARS (block));
670 /* If we are past the specified block, stop the scan. */
671 if (BLOCK_NUMBER (block) > do_block)
674 /* Scan the blocks within this block. */
675 sdbout_block (BLOCK_SUBBLOCKS (block));
678 block = BLOCK_CHAIN (block);
682 /* Call sdbout_symbol on each decl in the chain SYMS. */
690 if (TREE_CODE (syms) != LABEL_DECL)
691 sdbout_symbol (syms, 1);
692 syms = TREE_CHAIN (syms);
696 /* Output SDB information for a symbol described by DECL.
697 LOCAL is nonzero if the symbol is not file-scope. */
700 sdbout_symbol (decl, local)
704 tree type = TREE_TYPE (decl);
705 tree context = NULL_TREE;
710 sdbout_one_type (type);
712 #if 0 /* This loses when functions are marked to be ignored,
713 which happens in the C++ front end. */
714 if (DECL_IGNORED_P (decl))
718 switch (TREE_CODE (decl))
721 /* Enum values are defined by defining the enum type. */
725 /* Don't mention a nested function under its parent. */
726 context = decl_function_context (decl);
727 if (context == current_function_decl)
729 /* Check DECL_INITIAL to distinguish declarations from definitions.
730 Don't output debug info here for declarations; they will have
731 a DECL_INITIAL value of 0. */
732 if (! DECL_INITIAL (decl))
734 if (GET_CODE (DECL_RTL (decl)) != MEM
735 || GET_CODE (XEXP (DECL_RTL (decl), 0)) != SYMBOL_REF)
737 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
738 PUT_SDB_VAL (XEXP (DECL_RTL (decl), 0));
739 PUT_SDB_SCL (TREE_PUBLIC (decl) ? C_EXT : C_STAT);
743 /* Done with tagged types. */
744 if (DECL_NAME (decl) == 0)
746 if (DECL_IGNORED_P (decl))
749 /* Output typedef name. */
750 if (template_name_p (DECL_NAME (decl)))
751 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
753 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_NAME (decl)));
754 PUT_SDB_SCL (C_TPDEF);
758 /* Parm decls go in their own separate chains
759 and are output by sdbout_reg_parms and sdbout_parms. */
763 /* Don't mention a variable that is external.
764 Let the file that defines it describe it. */
765 if (DECL_EXTERNAL (decl))
768 /* Ignore __FUNCTION__, etc. */
769 if (DECL_IGNORED_P (decl))
772 /* If there was an error in the declaration, don't dump core
773 if there is no RTL associated with the variable doesn't
775 if (DECL_RTL (decl) == 0)
778 DECL_RTL (decl) = eliminate_regs (DECL_RTL (decl), 0, NULL_RTX);
779 #ifdef LEAF_REG_REMAP
780 if (current_function_uses_only_leaf_regs)
781 leaf_renumber_regs_insn (DECL_RTL (decl));
783 value = DECL_RTL (decl);
785 /* Don't mention a variable at all
786 if it was completely optimized into nothingness.
788 If DECL was from an inline function, then its rtl
789 is not identically the rtl that was used in this
790 particular compilation. */
791 if (GET_CODE (value) == REG)
793 regno = REGNO (DECL_RTL (decl));
794 if (regno >= FIRST_PSEUDO_REGISTER)
797 else if (GET_CODE (value) == SUBREG)
800 while (GET_CODE (value) == SUBREG)
802 offset += SUBREG_WORD (value);
803 value = SUBREG_REG (value);
805 if (GET_CODE (value) == REG)
807 regno = REGNO (value);
808 if (regno >= FIRST_PSEUDO_REGISTER)
812 alter_subreg (DECL_RTL (decl));
813 value = DECL_RTL (decl);
815 /* Don't output anything if an auto variable
816 gets RTL that is static.
817 GAS version 2.2 can't handle such output. */
818 else if (GET_CODE (value) == MEM && CONSTANT_P (XEXP (value, 0))
819 && ! TREE_STATIC (decl))
822 /* Emit any structure, union, or enum type that has not been output.
823 This occurs for tag-less structs (et al) used to declare variables
825 if (TREE_CODE (type) == ENUMERAL_TYPE
826 || TREE_CODE (type) == RECORD_TYPE
827 || TREE_CODE (type) == UNION_TYPE
828 || TREE_CODE (type) == QUAL_UNION_TYPE)
830 if (COMPLETE_TYPE_P (type) /* not a forward reference */
831 && KNOWN_TYPE_TAG (type) == 0) /* not yet declared */
832 sdbout_one_type (type);
835 /* Defer SDB information for top-level initialized variables! */
837 && GET_CODE (value) == MEM
838 && DECL_INITIAL (decl))
841 /* C++ in 2.3 makes nameless symbols. That will be fixed later.
842 For now, avoid crashing. */
843 if (DECL_NAME (decl) == NULL_TREE)
846 /* Record the name for, starting a symtab entry. */
847 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
849 if (GET_CODE (value) == MEM
850 && GET_CODE (XEXP (value, 0)) == SYMBOL_REF)
853 if (TREE_PUBLIC (decl))
855 PUT_SDB_VAL (XEXP (value, 0));
860 PUT_SDB_VAL (XEXP (value, 0));
861 PUT_SDB_SCL (C_STAT);
867 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (regno));
870 else if (GET_CODE (value) == MEM
871 && (GET_CODE (XEXP (value, 0)) == MEM
872 || (GET_CODE (XEXP (value, 0)) == REG
873 && REGNO (XEXP (value, 0)) != HARD_FRAME_POINTER_REGNUM
874 && REGNO (XEXP (value, 0)) != STACK_POINTER_REGNUM)))
875 /* If the value is indirect by memory or by a register
876 that isn't the frame pointer
877 then it means the object is variable-sized and address through
878 that register or stack slot. COFF has no way to represent this
879 so all we can do is output the variable as a pointer. */
882 if (GET_CODE (XEXP (value, 0)) == REG)
884 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (XEXP (value, 0))));
889 /* DECL_RTL looks like (MEM (MEM (PLUS (REG...)
891 We want the value of that CONST_INT. */
892 /* Encore compiler hates a newline in a macro arg, it seems. */
893 PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET
894 (XEXP (XEXP (value, 0), 0)));
895 PUT_SDB_SCL (C_AUTO);
898 /* Effectively do build_pointer_type, but don't cache this type,
899 since it might be temporary whereas the type it points to
900 might have been saved for inlining. */
901 /* Don't use REFERENCE_TYPE because dbx can't handle that. */
902 type = make_node (POINTER_TYPE);
903 TREE_TYPE (type) = TREE_TYPE (decl);
905 else if (GET_CODE (value) == MEM
906 && ((GET_CODE (XEXP (value, 0)) == PLUS
907 && GET_CODE (XEXP (XEXP (value, 0), 0)) == REG
908 && GET_CODE (XEXP (XEXP (value, 0), 1)) == CONST_INT)
909 /* This is for variables which are at offset zero from
910 the frame pointer. This happens on the Alpha.
911 Non-frame pointer registers are excluded above. */
912 || (GET_CODE (XEXP (value, 0)) == REG)))
914 /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...)))
915 or (MEM (REG...)). We want the value of that CONST_INT
918 PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET (XEXP (value, 0)));
919 PUT_SDB_SCL (C_AUTO);
921 else if (GET_CODE (value) == MEM && GET_CODE (XEXP (value, 0)) == CONST)
923 /* Handle an obscure case which can arise when optimizing and
924 when there are few available registers. (This is *always*
925 the case for i386/i486 targets). The DECL_RTL looks like
926 (MEM (CONST ...)) even though this variable is a local `auto'
927 or a local `register' variable. In effect, what has happened
928 is that the reload pass has seen that all assignments and
929 references for one such a local variable can be replaced by
930 equivalent assignments and references to some static storage
931 variable, thereby avoiding the need for a register. In such
932 cases we're forced to lie to debuggers and tell them that
933 this variable was itself `static'. */
935 PUT_SDB_VAL (XEXP (XEXP (value, 0), 0));
936 PUT_SDB_SCL (C_STAT);
940 /* It is something we don't know how to represent for SDB. */
948 PUT_SDB_TYPE (plain_type (type));
952 /* Output SDB information for a top-level initialized variable
953 that has been delayed. */
956 sdbout_toplevel_data (decl)
959 tree type = TREE_TYPE (decl);
961 if (DECL_IGNORED_P (decl))
964 if (! (TREE_CODE (decl) == VAR_DECL
965 && GET_CODE (DECL_RTL (decl)) == MEM
966 && DECL_INITIAL (decl)))
969 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
970 PUT_SDB_VAL (XEXP (DECL_RTL (decl), 0));
971 if (TREE_PUBLIC (decl))
977 PUT_SDB_SCL (C_STAT);
979 PUT_SDB_TYPE (plain_type (type));
983 #ifdef SDB_ALLOW_FORWARD_REFERENCES
985 /* Machinery to record and output anonymous types. */
987 static tree anonymous_types;
990 sdbout_queue_anonymous_type (type)
993 anonymous_types = tree_cons (NULL_TREE, type, anonymous_types);
997 sdbout_dequeue_anonymous_types ()
999 register tree types, link;
1001 while (anonymous_types)
1003 types = nreverse (anonymous_types);
1004 anonymous_types = NULL_TREE;
1006 for (link = types; link; link = TREE_CHAIN (link))
1008 register tree type = TREE_VALUE (link);
1010 if (type && ! TREE_ASM_WRITTEN (type))
1011 sdbout_one_type (type);
1018 /* Given a chain of ..._TYPE nodes, all of which have names,
1019 output definitions of those names, as typedefs. */
1022 sdbout_types (types)
1023 register tree types;
1027 for (link = types; link; link = TREE_CHAIN (link))
1028 sdbout_one_type (link);
1030 #ifdef SDB_ALLOW_FORWARD_REFERENCES
1031 sdbout_dequeue_anonymous_types ();
1039 if (type == error_mark_node)
1040 type = integer_type_node;
1041 PUT_SDB_TYPE (plain_type (type));
1044 /* Output types of the fields of type TYPE, if they are structs.
1046 Formerly did not chase through pointer types, since that could be circular.
1047 They must come before TYPE, since forward refs are not allowed.
1048 Now james@bigtex.cactus.org says to try them. */
1051 sdbout_field_types (type)
1056 for (tail = TYPE_FIELDS (type); tail; tail = TREE_CHAIN (tail))
1057 /* This condition should match the one for emitting the actual members
1059 if (TREE_CODE (tail) == FIELD_DECL
1060 && DECL_NAME (tail) != 0
1061 && ! host_integerp (DECL_SIZE (tail), 1)
1062 && ! host_integerp (bit_position (tail), 0))
1064 if (POINTER_TYPE_P (TREE_TYPE (tail)))
1065 sdbout_one_type (TREE_TYPE (TREE_TYPE (tail)));
1067 sdbout_one_type (TREE_TYPE (tail));
1071 /* Use this to put out the top level defined record and union types
1072 for later reference. If this is a struct with a name, then put that
1073 name out. Other unnamed structs will have .xxfake labels generated so
1074 that they may be referred to later.
1075 The label will be stored in the KNOWN_TYPE_TAG slot of a type.
1076 It may NOT be called recursively. */
1079 sdbout_one_type (type)
1082 if (current_function_decl != NULL_TREE
1083 && DECL_SECTION_NAME (current_function_decl) != NULL_TREE)
1084 ; /* Don't change section amid function. */
1088 switch (TREE_CODE (type))
1092 case QUAL_UNION_TYPE:
1094 type = TYPE_MAIN_VARIANT (type);
1095 /* Don't output a type twice. */
1096 if (TREE_ASM_WRITTEN (type))
1097 /* James said test TREE_ASM_BEING_WRITTEN here. */
1100 /* Output nothing if type is not yet defined. */
1101 if (!COMPLETE_TYPE_P (type))
1104 TREE_ASM_WRITTEN (type) = 1;
1106 /* This is reputed to cause trouble with the following case,
1107 but perhaps checking TYPE_SIZE above will fix it. */
1109 /* Here is a test case:
1115 typedef struct intermediate {
1119 typedef struct badstr {
1124 TREE_ASM_BEING_WRITTEN (type) = 1;
1126 /* This change, which ought to make better output,
1127 used to make the COFF assembler unhappy.
1128 Changes involving KNOWN_TYPE_TAG may fix the problem. */
1129 /* Before really doing anything, output types we want to refer to. */
1130 /* Note that in version 1 the following two lines
1131 are not used if forward references are in use. */
1132 if (TREE_CODE (type) != ENUMERAL_TYPE)
1133 sdbout_field_types (type);
1135 TREE_ASM_WRITTEN (type) = 1;
1139 /* Output a structure type. */
1141 int size = int_size_in_bytes (type);
1144 int i, n_baseclasses = 0;
1146 /* Record the type tag, but not in its permanent place just yet. */
1147 sdbout_record_type_name (type);
1149 PUT_SDB_DEF (KNOWN_TYPE_TAG (type));
1151 switch (TREE_CODE (type))
1154 case QUAL_UNION_TYPE:
1155 PUT_SDB_SCL (C_UNTAG);
1156 PUT_SDB_TYPE (T_UNION);
1161 PUT_SDB_SCL (C_STRTAG);
1162 PUT_SDB_TYPE (T_STRUCT);
1167 PUT_SDB_SCL (C_ENTAG);
1168 PUT_SDB_TYPE (T_ENUM);
1176 PUT_SDB_SIZE (size);
1179 /* Print out the base class information with fields
1180 named after the types they hold. */
1181 /* This is only relevent to aggregate types. TYPE_BINFO is used
1182 for other purposes in an ENUMERAL_TYPE, so we must exclude that
1184 if (TREE_CODE (type) != ENUMERAL_TYPE)
1186 if (TYPE_BINFO (type)
1187 && TYPE_BINFO_BASETYPES (type))
1188 n_baseclasses = TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (type));
1189 for (i = 0; i < n_baseclasses; i++)
1191 tree child = TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (type)),
1193 tree child_type = BINFO_TYPE (child);
1194 tree child_type_name;
1195 if (TYPE_NAME (child_type) == 0)
1197 if (TREE_CODE (TYPE_NAME (child_type)) == IDENTIFIER_NODE)
1198 child_type_name = TYPE_NAME (child_type);
1199 else if (TREE_CODE (TYPE_NAME (child_type)) == TYPE_DECL)
1201 child_type_name = DECL_NAME (TYPE_NAME (child_type));
1202 if (child_type_name && template_name_p (child_type_name))
1204 = DECL_ASSEMBLER_NAME (TYPE_NAME (child_type));
1210 PUT_SDB_DEF (IDENTIFIER_POINTER (child_type_name));
1211 PUT_SDB_INT_VAL (tree_low_cst (BINFO_OFFSET (child), 0));
1212 PUT_SDB_SCL (member_scl);
1213 sdbout_type (BINFO_TYPE (child));
1218 /* output the individual fields */
1220 if (TREE_CODE (type) == ENUMERAL_TYPE)
1222 for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
1223 if (host_integerp (TREE_VALUE (tem), 0))
1225 PUT_SDB_DEF (IDENTIFIER_POINTER (TREE_PURPOSE (tem)));
1226 PUT_SDB_INT_VAL (tree_low_cst (TREE_VALUE (tem), 0));
1227 PUT_SDB_SCL (C_MOE);
1228 PUT_SDB_TYPE (T_MOE);
1232 else /* record or union type */
1233 for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
1234 /* Output the name, type, position (in bits), size (in bits)
1237 /* Omit here the nameless fields that are used to skip bits.
1238 Also omit fields with variable size or position.
1239 Also omit non FIELD_DECL nodes that GNU C++ may put here. */
1240 if (TREE_CODE (tem) == FIELD_DECL
1241 && DECL_NAME (tem) != 0
1242 && host_integerp (DECL_SIZE (tem), 1)
1243 && host_integerp (bit_position (tem), 0))
1248 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (tem));
1250 if (DECL_BIT_FIELD_TYPE (tem))
1252 PUT_SDB_INT_VAL (int_bit_position (tem));
1253 PUT_SDB_SCL (C_FIELD);
1254 sdbout_type (DECL_BIT_FIELD_TYPE (tem));
1255 PUT_SDB_SIZE (tree_low_cst (DECL_SIZE (tem), 1));
1259 PUT_SDB_INT_VAL (int_bit_position (tem) / BITS_PER_UNIT);
1260 PUT_SDB_SCL (member_scl);
1261 sdbout_type (TREE_TYPE (tem));
1265 /* output end of a structure,union, or enumeral definition */
1267 PUT_SDB_PLAIN_DEF ("eos");
1268 PUT_SDB_INT_VAL (size);
1269 PUT_SDB_SCL (C_EOS);
1270 PUT_SDB_TAG (KNOWN_TYPE_TAG (type));
1271 PUT_SDB_SIZE (size);
1281 /* The following two functions output definitions of function parameters.
1282 Each parameter gets a definition locating it in the parameter list.
1283 Each parameter that is a register variable gets a second definition
1284 locating it in the register.
1286 Printing or argument lists in gdb uses the definitions that
1287 locate in the parameter list. But reference to the variable in
1288 expressions uses preferentially the definition as a register. */
1290 /* Output definitions, referring to storage in the parmlist,
1291 of all the parms in PARMS, which is a chain of PARM_DECL nodes. */
1294 sdbout_parms (parms)
1297 for (; parms; parms = TREE_CHAIN (parms))
1298 if (DECL_NAME (parms))
1300 int current_sym_value = 0;
1301 const char *name = IDENTIFIER_POINTER (DECL_NAME (parms));
1303 if (name == 0 || *name == 0)
1304 name = gen_fake_label ();
1306 /* Perform any necessary register eliminations on the parameter's rtl,
1307 so that the debugging output will be accurate. */
1308 DECL_INCOMING_RTL (parms)
1309 = eliminate_regs (DECL_INCOMING_RTL (parms), 0, NULL_RTX);
1310 DECL_RTL (parms) = eliminate_regs (DECL_RTL (parms), 0, NULL_RTX);
1312 if (PARM_PASSED_IN_MEMORY (parms))
1314 rtx addr = XEXP (DECL_INCOMING_RTL (parms), 0);
1317 /* ??? Here we assume that the parm address is indexed
1318 off the frame pointer or arg pointer.
1319 If that is not true, we produce meaningless results,
1320 but do not crash. */
1321 if (GET_CODE (addr) == PLUS
1322 && GET_CODE (XEXP (addr, 1)) == CONST_INT)
1323 current_sym_value = INTVAL (XEXP (addr, 1));
1325 current_sym_value = 0;
1327 if (GET_CODE (DECL_RTL (parms)) == REG
1328 && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
1329 type = DECL_ARG_TYPE (parms);
1332 int original_sym_value = current_sym_value;
1334 /* This is the case where the parm is passed as an int or
1335 double and it is converted to a char, short or float
1336 and stored back in the parmlist. In this case, describe
1337 the parm with the variable's declared type, and adjust
1338 the address if the least significant bytes (which we are
1339 using) are not the first ones. */
1340 if (BYTES_BIG_ENDIAN
1341 && TREE_TYPE (parms) != DECL_ARG_TYPE (parms))
1342 current_sym_value +=
1343 (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parms)))
1344 - GET_MODE_SIZE (GET_MODE (DECL_RTL (parms))));
1346 if (GET_CODE (DECL_RTL (parms)) == MEM
1347 && GET_CODE (XEXP (DECL_RTL (parms), 0)) == PLUS
1348 && (GET_CODE (XEXP (XEXP (DECL_RTL (parms), 0), 1))
1350 && (INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1))
1351 == current_sym_value))
1352 type = TREE_TYPE (parms);
1355 current_sym_value = original_sym_value;
1356 type = DECL_ARG_TYPE (parms);
1361 PUT_SDB_INT_VAL (DEBUGGER_ARG_OFFSET (current_sym_value, addr));
1362 PUT_SDB_SCL (C_ARG);
1363 PUT_SDB_TYPE (plain_type (type));
1366 else if (GET_CODE (DECL_RTL (parms)) == REG)
1369 /* Parm passed in registers and lives in registers or nowhere. */
1371 /* If parm lives in a register, use that register;
1372 pretend the parm was passed there. It would be more consistent
1373 to describe the register where the parm was passed,
1374 but in practice that register usually holds something else. */
1375 if (REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
1376 best_rtl = DECL_RTL (parms);
1377 /* If the parm lives nowhere,
1378 use the register where it was passed. */
1380 best_rtl = DECL_INCOMING_RTL (parms);
1383 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (best_rtl)));
1384 PUT_SDB_SCL (C_REGPARM);
1385 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
1388 else if (GET_CODE (DECL_RTL (parms)) == MEM
1389 && XEXP (DECL_RTL (parms), 0) != const0_rtx)
1391 /* Parm was passed in registers but lives on the stack. */
1393 /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))),
1394 in which case we want the value of that CONST_INT,
1395 or (MEM (REG ...)) or (MEM (MEM ...)),
1396 in which case we use a value of zero. */
1397 if (GET_CODE (XEXP (DECL_RTL (parms), 0)) == REG
1398 || GET_CODE (XEXP (DECL_RTL (parms), 0)) == MEM)
1399 current_sym_value = 0;
1401 current_sym_value = INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1));
1403 /* Again, this assumes the offset is based on the arg pointer. */
1405 PUT_SDB_INT_VAL (DEBUGGER_ARG_OFFSET (current_sym_value,
1406 XEXP (DECL_RTL (parms), 0)));
1407 PUT_SDB_SCL (C_ARG);
1408 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
1414 /* Output definitions for the places where parms live during the function,
1415 when different from where they were passed, when the parms were passed
1418 It is not useful to do this for parms passed in registers
1419 that live during the function in different registers, because it is
1420 impossible to look in the passed register for the passed value,
1421 so we use the within-the-function register to begin with.
1423 PARMS is a chain of PARM_DECL nodes. */
1426 sdbout_reg_parms (parms)
1429 for (; parms; parms = TREE_CHAIN (parms))
1430 if (DECL_NAME (parms))
1432 const char *name = IDENTIFIER_POINTER (DECL_NAME (parms));
1434 /* Report parms that live in registers during the function
1435 but were passed in memory. */
1436 if (GET_CODE (DECL_RTL (parms)) == REG
1437 && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER
1438 && PARM_PASSED_IN_MEMORY (parms))
1440 if (name == 0 || *name == 0)
1441 name = gen_fake_label ();
1443 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (DECL_RTL (parms))));
1444 PUT_SDB_SCL (C_REG);
1445 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
1448 /* Report parms that live in memory but not where they were passed. */
1449 else if (GET_CODE (DECL_RTL (parms)) == MEM
1450 && GET_CODE (XEXP (DECL_RTL (parms), 0)) == PLUS
1451 && GET_CODE (XEXP (XEXP (DECL_RTL (parms), 0), 1)) == CONST_INT
1452 && PARM_PASSED_IN_MEMORY (parms)
1453 && ! rtx_equal_p (DECL_RTL (parms), DECL_INCOMING_RTL (parms)))
1455 #if 0 /* ??? It is not clear yet what should replace this. */
1456 int offset = DECL_OFFSET (parms) / BITS_PER_UNIT;
1457 /* A parm declared char is really passed as an int,
1458 so it occupies the least significant bytes.
1459 On a big-endian machine those are not the low-numbered ones. */
1460 if (BYTES_BIG_ENDIAN
1462 && TREE_TYPE (parms) != DECL_ARG_TYPE (parms))
1463 offset += (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parms)))
1464 - GET_MODE_SIZE (GET_MODE (DECL_RTL (parms))));
1465 if (INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1)) != offset) {...}
1468 if (name == 0 || *name == 0)
1469 name = gen_fake_label ();
1471 PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET
1472 (XEXP (DECL_RTL (parms), 0)));
1473 PUT_SDB_SCL (C_AUTO);
1474 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
1481 /* Describe the beginning of an internal block within a function.
1482 Also output descriptions of variables defined in this block.
1484 N is the number of the block, by order of beginning, counting from 1,
1485 and not counting the outermost (function top-level) block.
1486 The blocks match the BLOCKs in DECL_INITIAL (current_function_decl),
1487 if the count starts at 0 for the outermost one. */
1490 sdbout_begin_block (file, line, n)
1491 FILE *file ATTRIBUTE_UNUSED;
1495 tree decl = current_function_decl;
1496 MAKE_LINE_SAFE (line);
1498 /* The SCO compiler does not emit a separate block for the function level
1499 scope, so we avoid it here also. However, mips ECOFF compilers do emit
1500 a separate block, so we retain it when MIPS_DEBUGGING_INFO is defined. */
1501 #ifndef MIPS_DEBUGGING_INFO
1504 PUT_SDB_BLOCK_START (line - sdb_begin_function_line);
1508 /* Include the outermost BLOCK's variables in block 1. */
1509 do_block = BLOCK_NUMBER (DECL_INITIAL (decl));
1510 sdbout_block (DECL_INITIAL (decl));
1512 /* If -g1, suppress all the internal symbols of functions
1513 except for arguments. */
1514 if (debug_info_level != DINFO_LEVEL_TERSE)
1517 sdbout_block (DECL_INITIAL (decl));
1520 #ifdef SDB_ALLOW_FORWARD_REFERENCES
1521 sdbout_dequeue_anonymous_types ();
1525 /* Describe the end line-number of an internal block within a function. */
1528 sdbout_end_block (file, line, n)
1529 FILE *file ATTRIBUTE_UNUSED;
1531 int n ATTRIBUTE_UNUSED;
1533 MAKE_LINE_SAFE (line);
1535 /* The SCO compiler does not emit a separate block for the function level
1536 scope, so we avoid it here also. However, mips ECOFF compilers do emit
1537 a separate block, so we retain it when MIPS_DEBUGGING_INFO is defined. */
1538 #ifndef MIPS_DEBUGGING_INFO
1541 PUT_SDB_BLOCK_END (line - sdb_begin_function_line);
1544 /* Output sdb info for the current function name.
1545 Called from assemble_start_function. */
1548 sdbout_mark_begin_function ()
1550 sdbout_symbol (current_function_decl, 0);
1553 /* Called at beginning of function body (after prologue).
1554 Record the function's starting line number, so we can output
1555 relative line numbers for the other lines.
1556 Describe beginning of outermost block.
1557 Also describe the parameter list. */
1560 sdbout_begin_function (line)
1563 sdb_begin_function_line = line - 1;
1564 PUT_SDB_FUNCTION_START (line);
1565 sdbout_parms (DECL_ARGUMENTS (current_function_decl));
1566 sdbout_reg_parms (DECL_ARGUMENTS (current_function_decl));
1569 /* Called at end of function (before epilogue).
1570 Describe end of outermost block. */
1573 sdbout_end_function (line)
1576 #ifdef SDB_ALLOW_FORWARD_REFERENCES
1577 sdbout_dequeue_anonymous_types ();
1580 MAKE_LINE_SAFE (line);
1581 PUT_SDB_FUNCTION_END (line - sdb_begin_function_line);
1583 /* Indicate we are between functions, for line-number output. */
1584 sdb_begin_function_line = -1;
1587 /* Output sdb info for the absolute end of a function.
1588 Called after the epilogue is output. */
1591 sdbout_end_epilogue ()
1593 PUT_SDB_EPILOGUE_END
1594 (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl)));
1597 /* Output sdb info for the given label. Called only if LABEL_NAME (insn)
1604 PUT_SDB_DEF (LABEL_NAME (insn));
1606 PUT_SDB_SCL (C_LABEL);
1607 PUT_SDB_TYPE (T_NULL);
1611 /* Change to reading from a new source file. */
1614 sdbout_start_new_source_file (filename)
1615 const char *filename ATTRIBUTE_UNUSED;
1617 #ifdef MIPS_DEBUGGING_INFO
1618 struct sdb_file *n = (struct sdb_file *) xmalloc (sizeof *n);
1620 n->next = current_file;
1623 PUT_SDB_SRC_FILE (filename);
1627 /* Revert to reading a previous source file. */
1630 sdbout_resume_previous_source_file ()
1632 #ifdef MIPS_DEBUGGING_INFO
1633 struct sdb_file *next;
1635 next = current_file->next;
1636 free (current_file);
1637 current_file = next;
1638 PUT_SDB_SRC_FILE (current_file->name);
1642 #endif /* SDB_DEBUGGING_INFO */