1 /* Output sdb-format symbol table information from GNU compiler.
2 Copyright (C) 1988, 92-97, 1998 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* mike@tredysvr.Tredydev.Unisys.COM says:
22 I modified the struct.c example and have a nm of a .o resulting from the
23 AT&T C compiler. From the example below I would conclude the following:
25 1. All .defs from structures are emitted as scanned. The example below
26 clearly shows the symbol table entries for BoxRec2 are after the first
29 2. All functions and their locals (including statics) are emitted as scanned.
31 3. All nested unnamed union and structure .defs must be emitted before
32 the structure in which they are nested. The AT&T assembler is a
33 one pass beast as far as symbolics are concerned.
35 4. All structure .defs are emitted before the typedefs that refer to them.
37 5. All top level static and external variable definitions are moved to the
38 end of file with all top level statics occurring first before externs.
40 6. All undefined references are at the end of the file.
45 #ifdef SDB_DEBUGGING_INFO
53 #include "insn-config.h"
56 /* Mips systems use the SDB functions to dump out symbols, but do not
57 supply usable syms.h include files. Which syms.h file to use is a
58 target parameter so don't use the native one if we're cross compiling. */
60 #if defined(USG) && !defined(MIPS) && !defined (hpux) && !defined(_WIN32) && !defined(__linux__) && !defined(CROSS_COMPILE)
62 /* Use T_INT if we don't have T_VOID. */
70 /* #include <storclass.h> used to be this instead of syms.h. */
72 /* 1 if PARM is passed to this function in memory. */
74 #define PARM_PASSED_IN_MEMORY(PARM) \
75 (GET_CODE (DECL_INCOMING_RTL (PARM)) == MEM)
77 /* A C expression for the integer offset value of an automatic variable
78 (C_AUTO) having address X (an RTX). */
79 #ifndef DEBUGGER_AUTO_OFFSET
80 #define DEBUGGER_AUTO_OFFSET(X) \
81 (GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0)
84 /* A C expression for the integer offset value of an argument (C_ARG)
85 having address X (an RTX). The nominal offset is OFFSET. */
86 #ifndef DEBUGGER_ARG_OFFSET
87 #define DEBUGGER_ARG_OFFSET(OFFSET, X) (OFFSET)
90 /* Line number of beginning of current function, minus one.
91 Negative means not in a function or not using sdb. */
93 int sdb_begin_function_line = -1;
95 /* Counter to generate unique "names" for nameless struct members. */
97 static int unnamed_struct_number = 0;
99 extern FILE *asm_out_file;
101 extern tree current_function_decl;
104 void sdbout_symbol ();
107 static char *gen_fake_label PROTO((void));
108 static int plain_type PROTO((tree));
109 static int template_name_p PROTO((tree));
110 static void sdbout_record_type_name PROTO((tree));
111 static int plain_type_1 PROTO((tree, int));
112 static void sdbout_block PROTO((tree));
113 static void sdbout_syms PROTO((tree));
114 static void sdbout_queue_anonymous_type PROTO((tree));
115 static void sdbout_dequeue_anonymous_types PROTO((void));
116 static void sdbout_type PROTO((tree));
117 static void sdbout_field_types PROTO((tree));
118 static void sdbout_one_type PROTO((tree));
119 static void sdbout_parms PROTO((tree));
120 static void sdbout_reg_parms PROTO((tree));
122 /* Define the default sizes for various types. */
124 #ifndef CHAR_TYPE_SIZE
125 #define CHAR_TYPE_SIZE BITS_PER_UNIT
128 #ifndef SHORT_TYPE_SIZE
129 #define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))
132 #ifndef INT_TYPE_SIZE
133 #define INT_TYPE_SIZE BITS_PER_WORD
136 #ifndef LONG_TYPE_SIZE
137 #define LONG_TYPE_SIZE BITS_PER_WORD
140 #ifndef LONG_LONG_TYPE_SIZE
141 #define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
144 #ifndef FLOAT_TYPE_SIZE
145 #define FLOAT_TYPE_SIZE BITS_PER_WORD
148 #ifndef DOUBLE_TYPE_SIZE
149 #define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
152 #ifndef LONG_DOUBLE_TYPE_SIZE
153 #define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
156 /* Random macros describing parts of SDB data. */
158 /* Put something here if lines get too long */
161 /* Default value of delimiter is ";". */
163 #define SDB_DELIM ";"
166 /* Maximum number of dimensions the assembler will allow. */
168 #define SDB_MAX_DIM 4
172 #define PUT_SDB_SCL(a) fprintf(asm_out_file, "\t.scl\t%d%s", (a), SDB_DELIM)
175 #ifndef PUT_SDB_INT_VAL
176 #define PUT_SDB_INT_VAL(a) fprintf (asm_out_file, "\t.val\t%d%s", (a), SDB_DELIM)
180 #define PUT_SDB_VAL(a) \
181 ( fputs ("\t.val\t", asm_out_file), \
182 output_addr_const (asm_out_file, (a)), \
183 fprintf (asm_out_file, SDB_DELIM))
187 #define PUT_SDB_DEF(a) \
188 do { fprintf (asm_out_file, "\t.def\t"); \
189 ASM_OUTPUT_LABELREF (asm_out_file, a); \
190 fprintf (asm_out_file, SDB_DELIM); } while (0)
193 #ifndef PUT_SDB_PLAIN_DEF
194 #define PUT_SDB_PLAIN_DEF(a) fprintf(asm_out_file,"\t.def\t.%s%s",a, SDB_DELIM)
197 #ifndef PUT_SDB_ENDEF
198 #define PUT_SDB_ENDEF fputs("\t.endef\n", asm_out_file)
202 #define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\t.type\t0%o%s", a, SDB_DELIM)
206 #define PUT_SDB_SIZE(a) fprintf(asm_out_file, "\t.size\t%d%s", a, SDB_DELIM)
209 #ifndef PUT_SDB_START_DIM
210 #define PUT_SDB_START_DIM fprintf(asm_out_file, "\t.dim\t")
213 #ifndef PUT_SDB_NEXT_DIM
214 #define PUT_SDB_NEXT_DIM(a) fprintf(asm_out_file, "%d,", a)
217 #ifndef PUT_SDB_LAST_DIM
218 #define PUT_SDB_LAST_DIM(a) fprintf(asm_out_file, "%d%s", a, SDB_DELIM)
222 #define PUT_SDB_TAG(a) \
223 do { fprintf (asm_out_file, "\t.tag\t"); \
224 ASM_OUTPUT_LABELREF (asm_out_file, a); \
225 fprintf (asm_out_file, SDB_DELIM); } while (0)
228 #ifndef PUT_SDB_BLOCK_START
229 #define PUT_SDB_BLOCK_START(LINE) \
230 fprintf (asm_out_file, \
231 "\t.def\t.bb%s\t.val\t.%s\t.scl\t100%s\t.line\t%d%s\t.endef\n", \
232 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
235 #ifndef PUT_SDB_BLOCK_END
236 #define PUT_SDB_BLOCK_END(LINE) \
237 fprintf (asm_out_file, \
238 "\t.def\t.eb%s\t.val\t.%s\t.scl\t100%s\t.line\t%d%s\t.endef\n", \
239 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
242 #ifndef PUT_SDB_FUNCTION_START
243 #define PUT_SDB_FUNCTION_START(LINE) \
244 fprintf (asm_out_file, \
245 "\t.def\t.bf%s\t.val\t.%s\t.scl\t101%s\t.line\t%d%s\t.endef\n", \
246 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
249 #ifndef PUT_SDB_FUNCTION_END
250 #define PUT_SDB_FUNCTION_END(LINE) \
251 fprintf (asm_out_file, \
252 "\t.def\t.ef%s\t.val\t.%s\t.scl\t101%s\t.line\t%d%s\t.endef\n", \
253 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
256 #ifndef PUT_SDB_EPILOGUE_END
257 #define PUT_SDB_EPILOGUE_END(NAME) \
258 do { fprintf (asm_out_file, "\t.def\t"); \
259 ASM_OUTPUT_LABELREF (asm_out_file, NAME); \
260 fprintf (asm_out_file, \
261 "%s\t.val\t.%s\t.scl\t-1%s\t.endef\n", \
262 SDB_DELIM, SDB_DELIM, SDB_DELIM); } while (0)
265 #ifndef SDB_GENERATE_FAKE
266 #define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
267 sprintf ((BUFFER), ".%dfake", (NUMBER));
270 /* Return the sdb tag identifier string for TYPE
271 if TYPE has already been defined; otherwise return a null pointer. */
273 #define KNOWN_TYPE_TAG(type) TYPE_SYMTAB_POINTER (type)
275 /* Set the sdb tag identifier string for TYPE to NAME. */
277 #define SET_KNOWN_TYPE_TAG(TYPE, NAME) \
278 TYPE_SYMTAB_POINTER (TYPE) = (NAME)
280 /* Return the name (a string) of the struct, union or enum tag
281 described by the TREE_LIST node LINK. This is 0 for an anonymous one. */
283 #define TAG_NAME(link) \
284 (((link) && TREE_PURPOSE ((link)) \
285 && IDENTIFIER_POINTER (TREE_PURPOSE ((link)))) \
286 ? IDENTIFIER_POINTER (TREE_PURPOSE ((link))) : (char *) 0)
288 /* Ensure we don't output a negative line number. */
289 #define MAKE_LINE_SAFE(line) \
290 if (line <= sdb_begin_function_line) line = sdb_begin_function_line + 1
292 /* Perform linker optimization of merging header file definitions together
293 for targets with MIPS_DEBUGGING_INFO defined. This won't work without a
294 post 960826 version of GAS. Nothing breaks with earlier versions of GAS,
295 the optimization just won't be done. The native assembler already has the
296 necessary support. */
298 #ifdef MIPS_DEBUGGING_INFO
300 #ifndef PUT_SDB_SRC_FILE
301 #define PUT_SDB_SRC_FILE(FILENAME) \
302 output_file_directive (asm_out_file, (FILENAME))
305 /* ECOFF linkers have an optimization that does the same kind of thing as
306 N_BINCL/E_INCL in stabs: eliminate duplicate debug information in the
307 executable. To achieve this, GCC must output a .file for each file
310 /* This is a stack of input files. */
314 struct sdb_file *next;
318 /* This is the top of the stack. */
320 static struct sdb_file *current_file;
322 #endif /* MIPS_DEBUGGING_INFO */
324 /* Set up for SDB output at the start of compilation. */
327 sdbout_init (asm_file, input_file_name, syms)
329 char *input_file_name;
332 #ifdef MIPS_DEBUGGING_INFO
333 current_file = (struct sdb_file *) xmalloc (sizeof *current_file);
334 current_file->next = NULL;
335 current_file->name = input_file_name;
338 #ifdef RMS_QUICK_HACK_1
340 for (t = syms; t; t = TREE_CHAIN (t))
341 if (DECL_NAME (t) && IDENTIFIER_POINTER (DECL_NAME (t)) != 0
342 && !strcmp (IDENTIFIER_POINTER (DECL_NAME (t)), "__vtbl_ptr_type"))
343 sdbout_symbol (t, 0);
349 /* return the tag identifier for type
353 tag_of_ru_type (type,link)
356 if (TYPE_SYMTAB_ADDRESS (type))
357 return TYPE_SYMTAB_ADDRESS (type);
358 if (link && TREE_PURPOSE (link)
359 && IDENTIFIER_POINTER (TREE_PURPOSE (link)))
360 TYPE_SYMTAB_ADDRESS (type) = IDENTIFIER_POINTER (TREE_PURPOSE (link));
362 return (char *) TYPE_SYMTAB_ADDRESS (type);
366 /* Return a unique string to name an anonymous type. */
373 SDB_GENERATE_FAKE (label, unnamed_struct_number);
374 unnamed_struct_number++;
375 labelstr = (char *) permalloc (strlen (label) + 1);
376 strcpy (labelstr, label);
380 /* Return the number which describes TYPE for SDB.
381 For pointers, etc., this function is recursive.
382 Each record, union or enumeral type must already have had a
383 tag number output. */
385 /* The number is given by d6d5d4d3d2d1bbbb
386 where bbbb is 4 bit basic type, and di indicate one of notype,ptr,fn,array.
387 Thus, char *foo () has bbbb=T_CHAR
390 N_BTMASK= 017 1111 basic type field.
391 N_TSHIFT= 2 derived type shift
392 N_BTSHFT= 4 Basic type shift */
394 /* Produce the number that describes a pointer, function or array type.
395 PREV is the number describing the target, value or element type.
396 DT_type describes how to transform that type. */
397 #define PUSH_DERIVED_LEVEL(DT_type,PREV) \
398 ((((PREV) & ~(int)N_BTMASK) << (int)N_TSHIFT) \
399 | ((int)DT_type << (int)N_BTSHFT) \
400 | ((PREV) & (int)N_BTMASK))
402 /* Number of elements used in sdb_dims. */
403 static int sdb_n_dims = 0;
405 /* Table of array dimensions of current type. */
406 static int sdb_dims[SDB_MAX_DIM];
408 /* Size of outermost array currently being processed. */
409 static int sdb_type_size = -1;
415 int val = plain_type_1 (type, 0);
417 /* If we have already saved up some array dimensions, print them now. */
422 for (i = sdb_n_dims - 1; i > 0; i--)
423 PUT_SDB_NEXT_DIM (sdb_dims[i]);
424 PUT_SDB_LAST_DIM (sdb_dims[0]);
427 sdb_type_size = int_size_in_bytes (type);
428 /* Don't kill sdb if type is not laid out or has variable size. */
429 if (sdb_type_size < 0)
432 /* If we have computed the size of an array containing this type,
434 if (sdb_type_size >= 0)
436 PUT_SDB_SIZE (sdb_type_size);
443 template_name_p (name)
446 register char *ptr = IDENTIFIER_POINTER (name);
447 while (*ptr && *ptr != '<')
454 sdbout_record_type_name (type)
460 if (KNOWN_TYPE_TAG (type))
463 if (TYPE_NAME (type) != 0)
466 /* Find the IDENTIFIER_NODE for the type name. */
467 if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
468 t = TYPE_NAME (type);
469 else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL)
471 t = DECL_NAME (TYPE_NAME (type));
472 /* The DECL_NAME for templates includes "<>", which breaks
473 most assemblers. Use its assembler name instead, which
474 has been mangled into being safe. */
475 if (t && template_name_p (t))
476 t = DECL_ASSEMBLER_NAME (TYPE_NAME (type));
479 /* Now get the name as a string, or invent one. */
481 name = IDENTIFIER_POINTER (t);
484 no_name = (name == 0 || *name == 0);
486 name = gen_fake_label ();
488 SET_KNOWN_TYPE_TAG (type, name);
489 #ifdef SDB_ALLOW_FORWARD_REFERENCES
491 sdbout_queue_anonymous_type (type);
495 /* Return the .type value for type TYPE.
497 LEVEL indicates how many levels deep we have recursed into the type.
498 The SDB debug format can only represent 6 derived levels of types.
499 After that, we must output inaccurate debug info. We deliberately
500 stop before the 7th level, so that ADA recursive types will not give an
504 plain_type_1 (type, level)
509 type = void_type_node;
510 else if (type == error_mark_node)
511 type = integer_type_node;
513 type = TYPE_MAIN_VARIANT (type);
515 switch (TREE_CODE (type))
521 int size = int_size_in_bytes (type) * BITS_PER_UNIT;
523 /* Carefully distinguish all the standard types of C,
524 without messing up if the language is not C.
525 Note that we check only for the names that contain spaces;
526 other names might occur by coincidence in other languages. */
527 if (TYPE_NAME (type) != 0
528 && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
529 && DECL_NAME (TYPE_NAME (type)) != 0
530 && TREE_CODE (DECL_NAME (TYPE_NAME (type))) == IDENTIFIER_NODE)
532 char *name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
534 if (!strcmp (name, "char"))
536 if (!strcmp (name, "unsigned char"))
538 if (!strcmp (name, "signed char"))
540 if (!strcmp (name, "int"))
542 if (!strcmp (name, "unsigned int"))
544 if (!strcmp (name, "short int"))
546 if (!strcmp (name, "short unsigned int"))
548 if (!strcmp (name, "long int"))
550 if (!strcmp (name, "long unsigned int"))
554 if (size == INT_TYPE_SIZE)
555 return (TREE_UNSIGNED (type) ? T_UINT : T_INT);
556 if (size == CHAR_TYPE_SIZE)
557 return (TREE_UNSIGNED (type) ? T_UCHAR : T_CHAR);
558 if (size == SHORT_TYPE_SIZE)
559 return (TREE_UNSIGNED (type) ? T_USHORT : T_SHORT);
560 if (size == LONG_TYPE_SIZE)
561 return (TREE_UNSIGNED (type) ? T_ULONG : T_LONG);
562 if (size == LONG_LONG_TYPE_SIZE) /* better than nothing */
563 return (TREE_UNSIGNED (type) ? T_ULONG : T_LONG);
569 int precision = TYPE_PRECISION (type);
570 if (precision == FLOAT_TYPE_SIZE)
572 if (precision == DOUBLE_TYPE_SIZE)
574 #ifdef EXTENDED_SDB_BASIC_TYPES
575 if (precision == LONG_DOUBLE_TYPE_SIZE)
578 if (precision == LONG_DOUBLE_TYPE_SIZE)
579 return T_DOUBLE; /* better than nothing */
590 m = plain_type_1 (TREE_TYPE (type), level+1);
591 if (sdb_n_dims < SDB_MAX_DIM)
592 sdb_dims[sdb_n_dims++]
593 = (TYPE_DOMAIN (type)
594 && TYPE_MAX_VALUE (TYPE_DOMAIN (type))
595 && TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) == INTEGER_CST
596 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (type))) == INTEGER_CST
597 ? (TREE_INT_CST_LOW (TYPE_MAX_VALUE (TYPE_DOMAIN (type)))
598 - TREE_INT_CST_LOW (TYPE_MIN_VALUE (TYPE_DOMAIN (type))) + 1)
600 return PUSH_DERIVED_LEVEL (DT_ARY, m);
605 case QUAL_UNION_TYPE:
609 #ifdef SDB_ALLOW_FORWARD_REFERENCES
610 sdbout_record_type_name (type);
612 #ifndef SDB_ALLOW_UNKNOWN_REFERENCES
613 if ((TREE_ASM_WRITTEN (type) && KNOWN_TYPE_TAG (type) != 0)
614 #ifdef SDB_ALLOW_FORWARD_REFERENCES
615 || TYPE_MODE (type) != VOIDmode
620 /* Output the referenced structure tag name
621 only if the .def has already been finished.
622 At least on 386, the Unix assembler
623 cannot handle forward references to tags. */
624 /* But the 88100, it requires them, sigh... */
625 /* And the MIPS requires unknown refs as well... */
626 tag = KNOWN_TYPE_TAG (type);
628 /* These 3 lines used to follow the close brace.
629 However, a size of 0 without a tag implies a tag of 0,
630 so if we don't know a tag, we can't mention the size. */
631 sdb_type_size = int_size_in_bytes (type);
632 if (sdb_type_size < 0)
635 return ((TREE_CODE (type) == RECORD_TYPE) ? T_STRUCT
636 : (TREE_CODE (type) == UNION_TYPE) ? T_UNION
637 : (TREE_CODE (type) == QUAL_UNION_TYPE) ? T_UNION
647 m = plain_type_1 (TREE_TYPE (type), level+1);
648 return PUSH_DERIVED_LEVEL (DT_PTR, m);
657 m = plain_type_1 (TREE_TYPE (type), level+1);
658 return PUSH_DERIVED_LEVEL (DT_FCN, m);
665 /* Output the symbols defined in block number DO_BLOCK.
666 Set NEXT_BLOCK_NUMBER to 0 before calling.
668 This function works by walking the tree structure of blocks,
669 counting blocks until it finds the desired block. */
671 static int do_block = 0;
673 static int next_block_number;
681 /* Ignore blocks never expanded or otherwise marked as real. */
682 if (TREE_USED (block))
684 /* When we reach the specified block, output its symbols. */
685 if (next_block_number == do_block)
687 sdbout_syms (BLOCK_VARS (block));
690 /* If we are past the specified block, stop the scan. */
691 if (next_block_number > do_block)
696 /* Scan the blocks within this block. */
697 sdbout_block (BLOCK_SUBBLOCKS (block));
700 block = BLOCK_CHAIN (block);
704 /* Call sdbout_symbol on each decl in the chain SYMS. */
712 if (TREE_CODE (syms) != LABEL_DECL)
713 sdbout_symbol (syms, 1);
714 syms = TREE_CHAIN (syms);
718 /* Output SDB information for a symbol described by DECL.
719 LOCAL is nonzero if the symbol is not file-scope. */
722 sdbout_symbol (decl, local)
726 tree type = TREE_TYPE (decl);
727 tree context = NULL_TREE;
732 sdbout_one_type (type);
734 #if 0 /* This loses when functions are marked to be ignored,
735 which happens in the C++ front end. */
736 if (DECL_IGNORED_P (decl))
740 switch (TREE_CODE (decl))
743 /* Enum values are defined by defining the enum type. */
747 /* Don't mention a nested function under its parent. */
748 context = decl_function_context (decl);
749 if (context == current_function_decl)
751 /* Check DECL_INITIAL to distinguish declarations from definitions.
752 Don't output debug info here for declarations; they will have
753 a DECL_INITIAL value of 0. */
754 if (! DECL_INITIAL (decl))
756 if (GET_CODE (DECL_RTL (decl)) != MEM
757 || GET_CODE (XEXP (DECL_RTL (decl), 0)) != SYMBOL_REF)
759 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
760 PUT_SDB_VAL (XEXP (DECL_RTL (decl), 0));
761 PUT_SDB_SCL (TREE_PUBLIC (decl) ? C_EXT : C_STAT);
765 /* Done with tagged types. */
766 if (DECL_NAME (decl) == 0)
768 if (DECL_IGNORED_P (decl))
771 /* Output typedef name. */
772 if (template_name_p (DECL_NAME (decl)))
773 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
775 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_NAME (decl)));
776 PUT_SDB_SCL (C_TPDEF);
780 /* Parm decls go in their own separate chains
781 and are output by sdbout_reg_parms and sdbout_parms. */
785 /* Don't mention a variable that is external.
786 Let the file that defines it describe it. */
787 if (DECL_EXTERNAL (decl))
790 /* Ignore __FUNCTION__, etc. */
791 if (DECL_IGNORED_P (decl))
794 /* If there was an error in the declaration, don't dump core
795 if there is no RTL associated with the variable doesn't
797 if (DECL_RTL (decl) == 0)
800 DECL_RTL (decl) = eliminate_regs (DECL_RTL (decl), 0, NULL_RTX);
801 #ifdef LEAF_REG_REMAP
803 leaf_renumber_regs_insn (DECL_RTL (decl));
805 value = DECL_RTL (decl);
807 /* Don't mention a variable at all
808 if it was completely optimized into nothingness.
810 If DECL was from an inline function, then its rtl
811 is not identically the rtl that was used in this
812 particular compilation. */
813 if (GET_CODE (value) == REG)
815 regno = REGNO (DECL_RTL (decl));
816 if (regno >= FIRST_PSEUDO_REGISTER)
819 else if (GET_CODE (value) == SUBREG)
822 while (GET_CODE (value) == SUBREG)
824 offset += SUBREG_WORD (value);
825 value = SUBREG_REG (value);
827 if (GET_CODE (value) == REG)
829 regno = REGNO (value);
830 if (regno >= FIRST_PSEUDO_REGISTER)
834 alter_subreg (DECL_RTL (decl));
835 value = DECL_RTL (decl);
837 /* Don't output anything if an auto variable
838 gets RTL that is static.
839 GAS version 2.2 can't handle such output. */
840 else if (GET_CODE (value) == MEM && CONSTANT_P (XEXP (value, 0))
841 && ! TREE_STATIC (decl))
844 /* Emit any structure, union, or enum type that has not been output.
845 This occurs for tag-less structs (et al) used to declare variables
847 if (TREE_CODE (type) == ENUMERAL_TYPE
848 || TREE_CODE (type) == RECORD_TYPE
849 || TREE_CODE (type) == UNION_TYPE
850 || TREE_CODE (type) == QUAL_UNION_TYPE)
852 if (TYPE_SIZE (type) != 0 /* not a forward reference */
853 && KNOWN_TYPE_TAG (type) == 0) /* not yet declared */
854 sdbout_one_type (type);
857 /* Defer SDB information for top-level initialized variables! */
859 && GET_CODE (value) == MEM
860 && DECL_INITIAL (decl))
863 /* C++ in 2.3 makes nameless symbols. That will be fixed later.
864 For now, avoid crashing. */
865 if (DECL_NAME (decl) == NULL_TREE)
868 /* Record the name for, starting a symtab entry. */
869 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
871 if (GET_CODE (value) == MEM
872 && GET_CODE (XEXP (value, 0)) == SYMBOL_REF)
875 if (TREE_PUBLIC (decl))
877 PUT_SDB_VAL (XEXP (value, 0));
882 PUT_SDB_VAL (XEXP (value, 0));
883 PUT_SDB_SCL (C_STAT);
889 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (regno));
892 else if (GET_CODE (value) == MEM
893 && (GET_CODE (XEXP (value, 0)) == MEM
894 || (GET_CODE (XEXP (value, 0)) == REG
895 && REGNO (XEXP (value, 0)) != HARD_FRAME_POINTER_REGNUM
896 && REGNO (XEXP (value, 0)) != STACK_POINTER_REGNUM)))
897 /* If the value is indirect by memory or by a register
898 that isn't the frame pointer
899 then it means the object is variable-sized and address through
900 that register or stack slot. COFF has no way to represent this
901 so all we can do is output the variable as a pointer. */
904 if (GET_CODE (XEXP (value, 0)) == REG)
906 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (XEXP (value, 0))));
911 /* DECL_RTL looks like (MEM (MEM (PLUS (REG...)
913 We want the value of that CONST_INT. */
914 /* Encore compiler hates a newline in a macro arg, it seems. */
915 PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET
916 (XEXP (XEXP (value, 0), 0)));
917 PUT_SDB_SCL (C_AUTO);
920 type = build_pointer_type (TREE_TYPE (decl));
922 else if (GET_CODE (value) == MEM
923 && ((GET_CODE (XEXP (value, 0)) == PLUS
924 && GET_CODE (XEXP (XEXP (value, 0), 0)) == REG
925 && GET_CODE (XEXP (XEXP (value, 0), 1)) == CONST_INT)
926 /* This is for variables which are at offset zero from
927 the frame pointer. This happens on the Alpha.
928 Non-frame pointer registers are excluded above. */
929 || (GET_CODE (XEXP (value, 0)) == REG)))
931 /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...)))
932 or (MEM (REG...)). We want the value of that CONST_INT
935 PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET (XEXP (value, 0)));
936 PUT_SDB_SCL (C_AUTO);
938 else if (GET_CODE (value) == MEM && GET_CODE (XEXP (value, 0)) == CONST)
940 /* Handle an obscure case which can arise when optimizing and
941 when there are few available registers. (This is *always*
942 the case for i386/i486 targets). The DECL_RTL looks like
943 (MEM (CONST ...)) even though this variable is a local `auto'
944 or a local `register' variable. In effect, what has happened
945 is that the reload pass has seen that all assignments and
946 references for one such a local variable can be replaced by
947 equivalent assignments and references to some static storage
948 variable, thereby avoiding the need for a register. In such
949 cases we're forced to lie to debuggers and tell them that
950 this variable was itself `static'. */
952 PUT_SDB_VAL (XEXP (XEXP (value, 0), 0));
953 PUT_SDB_SCL (C_STAT);
957 /* It is something we don't know how to represent for SDB. */
965 PUT_SDB_TYPE (plain_type (type));
969 /* Output SDB information for a top-level initialized variable
970 that has been delayed. */
973 sdbout_toplevel_data (decl)
976 tree type = TREE_TYPE (decl);
978 if (DECL_IGNORED_P (decl))
981 if (! (TREE_CODE (decl) == VAR_DECL
982 && GET_CODE (DECL_RTL (decl)) == MEM
983 && DECL_INITIAL (decl)))
986 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
987 PUT_SDB_VAL (XEXP (DECL_RTL (decl), 0));
988 if (TREE_PUBLIC (decl))
994 PUT_SDB_SCL (C_STAT);
996 PUT_SDB_TYPE (plain_type (type));
1000 #ifdef SDB_ALLOW_FORWARD_REFERENCES
1002 /* Machinery to record and output anonymous types. */
1004 static tree anonymous_types;
1007 sdbout_queue_anonymous_type (type)
1010 anonymous_types = saveable_tree_cons (NULL_TREE, type, anonymous_types);
1014 sdbout_dequeue_anonymous_types ()
1016 register tree types, link;
1018 while (anonymous_types)
1020 types = nreverse (anonymous_types);
1021 anonymous_types = NULL_TREE;
1023 for (link = types; link; link = TREE_CHAIN (link))
1025 register tree type = TREE_VALUE (link);
1027 if (type && ! TREE_ASM_WRITTEN (type))
1028 sdbout_one_type (type);
1035 /* Given a chain of ..._TYPE nodes, all of which have names,
1036 output definitions of those names, as typedefs. */
1039 sdbout_types (types)
1040 register tree types;
1044 for (link = types; link; link = TREE_CHAIN (link))
1045 sdbout_one_type (link);
1047 #ifdef SDB_ALLOW_FORWARD_REFERENCES
1048 sdbout_dequeue_anonymous_types ();
1056 if (type == error_mark_node)
1057 type = integer_type_node;
1058 PUT_SDB_TYPE (plain_type (type));
1061 /* Output types of the fields of type TYPE, if they are structs.
1063 Formerly did not chase through pointer types, since that could be circular.
1064 They must come before TYPE, since forward refs are not allowed.
1065 Now james@bigtex.cactus.org says to try them. */
1068 sdbout_field_types (type)
1073 for (tail = TYPE_FIELDS (type); tail; tail = TREE_CHAIN (tail))
1074 if (POINTER_TYPE_P (TREE_TYPE (tail)))
1075 sdbout_one_type (TREE_TYPE (TREE_TYPE (tail)));
1077 sdbout_one_type (TREE_TYPE (tail));
1080 /* Use this to put out the top level defined record and union types
1081 for later reference. If this is a struct with a name, then put that
1082 name out. Other unnamed structs will have .xxfake labels generated so
1083 that they may be referred to later.
1084 The label will be stored in the KNOWN_TYPE_TAG slot of a type.
1085 It may NOT be called recursively. */
1088 sdbout_one_type (type)
1091 if (current_function_decl != NULL_TREE
1092 && DECL_SECTION_NAME (current_function_decl) != NULL_TREE)
1093 ; /* Don't change section amid function. */
1097 switch (TREE_CODE (type))
1101 case QUAL_UNION_TYPE:
1103 type = TYPE_MAIN_VARIANT (type);
1104 /* Don't output a type twice. */
1105 if (TREE_ASM_WRITTEN (type))
1106 /* James said test TREE_ASM_BEING_WRITTEN here. */
1109 /* Output nothing if type is not yet defined. */
1110 if (TYPE_SIZE (type) == 0)
1113 TREE_ASM_WRITTEN (type) = 1;
1115 /* This is reputed to cause trouble with the following case,
1116 but perhaps checking TYPE_SIZE above will fix it. */
1118 /* Here is a test case:
1124 typedef struct intermediate {
1128 typedef struct badstr {
1133 TREE_ASM_BEING_WRITTEN (type) = 1;
1135 /* This change, which ought to make better output,
1136 used to make the COFF assembler unhappy.
1137 Changes involving KNOWN_TYPE_TAG may fix the problem. */
1138 /* Before really doing anything, output types we want to refer to. */
1139 /* Note that in version 1 the following two lines
1140 are not used if forward references are in use. */
1141 if (TREE_CODE (type) != ENUMERAL_TYPE)
1142 sdbout_field_types (type);
1144 TREE_ASM_WRITTEN (type) = 1;
1148 /* Output a structure type. */
1150 int size = int_size_in_bytes (type);
1153 int i, n_baseclasses = 0;
1155 /* Record the type tag, but not in its permanent place just yet. */
1156 sdbout_record_type_name (type);
1158 PUT_SDB_DEF (KNOWN_TYPE_TAG (type));
1160 switch (TREE_CODE (type))
1163 case QUAL_UNION_TYPE:
1164 PUT_SDB_SCL (C_UNTAG);
1165 PUT_SDB_TYPE (T_UNION);
1170 PUT_SDB_SCL (C_STRTAG);
1171 PUT_SDB_TYPE (T_STRUCT);
1176 PUT_SDB_SCL (C_ENTAG);
1177 PUT_SDB_TYPE (T_ENUM);
1185 PUT_SDB_SIZE (size);
1188 /* Print out the base class information with fields
1189 named after the types they hold. */
1190 if (TYPE_BINFO (type)
1191 && TYPE_BINFO_BASETYPES (type))
1192 n_baseclasses = TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (type));
1193 for (i = 0; i < n_baseclasses; i++)
1195 tree child = TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (type)), i);
1196 tree child_type = BINFO_TYPE (child);
1197 tree child_type_name;
1198 if (TYPE_NAME (child_type) == 0)
1200 if (TREE_CODE (TYPE_NAME (child_type)) == IDENTIFIER_NODE)
1201 child_type_name = TYPE_NAME (child_type);
1202 else if (TREE_CODE (TYPE_NAME (child_type)) == TYPE_DECL)
1204 child_type_name = DECL_NAME (TYPE_NAME (child_type));
1205 if (child_type_name && template_name_p (child_type_name))
1207 = DECL_ASSEMBLER_NAME (TYPE_NAME (child_type));
1213 PUT_SDB_DEF (IDENTIFIER_POINTER (child_type_name));
1214 PUT_SDB_INT_VAL (TREE_INT_CST_LOW (BINFO_OFFSET (child)));
1215 PUT_SDB_SCL (member_scl);
1216 sdbout_type (BINFO_TYPE (child));
1220 /* output the individual fields */
1222 if (TREE_CODE (type) == ENUMERAL_TYPE)
1223 for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
1225 PUT_SDB_DEF (IDENTIFIER_POINTER (TREE_PURPOSE (tem)));
1226 PUT_SDB_INT_VAL (TREE_INT_CST_LOW (TREE_VALUE (tem)));
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 && TREE_CODE (DECL_SIZE (tem)) == INTEGER_CST
1243 && TREE_CODE (DECL_FIELD_BITPOS (tem)) == INTEGER_CST)
1248 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (tem));
1250 if (DECL_BIT_FIELD_TYPE (tem))
1252 PUT_SDB_INT_VAL (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (tem)));
1253 PUT_SDB_SCL (C_FIELD);
1254 sdbout_type (DECL_BIT_FIELD_TYPE (tem));
1255 PUT_SDB_SIZE (TREE_INT_CST_LOW (DECL_SIZE (tem)));
1259 PUT_SDB_INT_VAL (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (tem))
1261 PUT_SDB_SCL (member_scl);
1262 sdbout_type (TREE_TYPE (tem));
1266 /* output end of a structure,union, or enumeral definition */
1268 PUT_SDB_PLAIN_DEF ("eos");
1269 PUT_SDB_INT_VAL (size);
1270 PUT_SDB_SCL (C_EOS);
1271 PUT_SDB_TAG (KNOWN_TYPE_TAG (type));
1272 PUT_SDB_SIZE (size);
1282 /* The following two functions output definitions of function parameters.
1283 Each parameter gets a definition locating it in the parameter list.
1284 Each parameter that is a register variable gets a second definition
1285 locating it in the register.
1287 Printing or argument lists in gdb uses the definitions that
1288 locate in the parameter list. But reference to the variable in
1289 expressions uses preferentially the definition as a register. */
1291 /* Output definitions, referring to storage in the parmlist,
1292 of all the parms in PARMS, which is a chain of PARM_DECL nodes. */
1295 sdbout_parms (parms)
1298 for (; parms; parms = TREE_CHAIN (parms))
1299 if (DECL_NAME (parms))
1301 int current_sym_value = 0;
1302 char *name = IDENTIFIER_POINTER (DECL_NAME (parms));
1304 if (name == 0 || *name == 0)
1305 name = gen_fake_label ();
1307 /* Perform any necessary register eliminations on the parameter's rtl,
1308 so that the debugging output will be accurate. */
1309 DECL_INCOMING_RTL (parms)
1310 = eliminate_regs (DECL_INCOMING_RTL (parms), 0, NULL_RTX);
1311 DECL_RTL (parms) = eliminate_regs (DECL_RTL (parms), 0, NULL_RTX);
1313 if (PARM_PASSED_IN_MEMORY (parms))
1315 rtx addr = XEXP (DECL_INCOMING_RTL (parms), 0);
1318 /* ??? Here we assume that the parm address is indexed
1319 off the frame pointer or arg pointer.
1320 If that is not true, we produce meaningless results,
1321 but do not crash. */
1322 if (GET_CODE (addr) == PLUS
1323 && GET_CODE (XEXP (addr, 1)) == CONST_INT)
1324 current_sym_value = INTVAL (XEXP (addr, 1));
1326 current_sym_value = 0;
1328 if (GET_CODE (DECL_RTL (parms)) == REG
1329 && REGNO (DECL_RTL (parms)) >= 0
1330 && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
1331 type = DECL_ARG_TYPE (parms);
1334 int original_sym_value = current_sym_value;
1336 /* This is the case where the parm is passed as an int or
1337 double and it is converted to a char, short or float
1338 and stored back in the parmlist. In this case, describe
1339 the parm with the variable's declared type, and adjust
1340 the address if the least significant bytes (which we are
1341 using) are not the first ones. */
1342 if (BYTES_BIG_ENDIAN
1343 && TREE_TYPE (parms) != DECL_ARG_TYPE (parms))
1344 current_sym_value +=
1345 (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parms)))
1346 - GET_MODE_SIZE (GET_MODE (DECL_RTL (parms))));
1348 if (GET_CODE (DECL_RTL (parms)) == MEM
1349 && GET_CODE (XEXP (DECL_RTL (parms), 0)) == PLUS
1350 && (GET_CODE (XEXP (XEXP (DECL_RTL (parms), 0), 1))
1352 && (INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1))
1353 == current_sym_value))
1354 type = TREE_TYPE (parms);
1357 current_sym_value = original_sym_value;
1358 type = DECL_ARG_TYPE (parms);
1363 PUT_SDB_INT_VAL (DEBUGGER_ARG_OFFSET (current_sym_value, addr));
1364 PUT_SDB_SCL (C_ARG);
1365 PUT_SDB_TYPE (plain_type (type));
1368 else if (GET_CODE (DECL_RTL (parms)) == REG)
1371 /* Parm passed in registers and lives in registers or nowhere. */
1373 /* If parm lives in a register, use that register;
1374 pretend the parm was passed there. It would be more consistent
1375 to describe the register where the parm was passed,
1376 but in practice that register usually holds something else. */
1377 if (REGNO (DECL_RTL (parms)) >= 0
1378 && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
1379 best_rtl = DECL_RTL (parms);
1380 /* If the parm lives nowhere,
1381 use the register where it was passed. */
1383 best_rtl = DECL_INCOMING_RTL (parms);
1386 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (best_rtl)));
1387 PUT_SDB_SCL (C_REGPARM);
1388 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
1391 else if (GET_CODE (DECL_RTL (parms)) == MEM
1392 && XEXP (DECL_RTL (parms), 0) != const0_rtx)
1394 /* Parm was passed in registers but lives on the stack. */
1396 /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))),
1397 in which case we want the value of that CONST_INT,
1398 or (MEM (REG ...)) or (MEM (MEM ...)),
1399 in which case we use a value of zero. */
1400 if (GET_CODE (XEXP (DECL_RTL (parms), 0)) == REG
1401 || GET_CODE (XEXP (DECL_RTL (parms), 0)) == MEM)
1402 current_sym_value = 0;
1404 current_sym_value = INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1));
1406 /* Again, this assumes the offset is based on the arg pointer. */
1408 PUT_SDB_INT_VAL (DEBUGGER_ARG_OFFSET (current_sym_value,
1409 XEXP (DECL_RTL (parms), 0)));
1410 PUT_SDB_SCL (C_ARG);
1411 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
1417 /* Output definitions for the places where parms live during the function,
1418 when different from where they were passed, when the parms were passed
1421 It is not useful to do this for parms passed in registers
1422 that live during the function in different registers, because it is
1423 impossible to look in the passed register for the passed value,
1424 so we use the within-the-function register to begin with.
1426 PARMS is a chain of PARM_DECL nodes. */
1429 sdbout_reg_parms (parms)
1432 for (; parms; parms = TREE_CHAIN (parms))
1433 if (DECL_NAME (parms))
1435 char *name = IDENTIFIER_POINTER (DECL_NAME (parms));
1437 /* Report parms that live in registers during the function
1438 but were passed in memory. */
1439 if (GET_CODE (DECL_RTL (parms)) == REG
1440 && REGNO (DECL_RTL (parms)) >= 0
1441 && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER
1442 && PARM_PASSED_IN_MEMORY (parms))
1444 if (name == 0 || *name == 0)
1445 name = gen_fake_label ();
1447 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (DECL_RTL (parms))));
1448 PUT_SDB_SCL (C_REG);
1449 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
1452 /* Report parms that live in memory but not where they were passed. */
1453 else if (GET_CODE (DECL_RTL (parms)) == MEM
1454 && GET_CODE (XEXP (DECL_RTL (parms), 0)) == PLUS
1455 && GET_CODE (XEXP (XEXP (DECL_RTL (parms), 0), 1)) == CONST_INT
1456 && PARM_PASSED_IN_MEMORY (parms)
1457 && ! rtx_equal_p (DECL_RTL (parms), DECL_INCOMING_RTL (parms)))
1459 #if 0 /* ??? It is not clear yet what should replace this. */
1460 int offset = DECL_OFFSET (parms) / BITS_PER_UNIT;
1461 /* A parm declared char is really passed as an int,
1462 so it occupies the least significant bytes.
1463 On a big-endian machine those are not the low-numbered ones. */
1464 if (BYTES_BIG_ENDIAN
1466 && TREE_TYPE (parms) != DECL_ARG_TYPE (parms))
1467 offset += (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parms)))
1468 - GET_MODE_SIZE (GET_MODE (DECL_RTL (parms))));
1469 if (INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1)) != offset) {...}
1472 if (name == 0 || *name == 0)
1473 name = gen_fake_label ();
1475 PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET
1476 (XEXP (DECL_RTL (parms), 0)));
1477 PUT_SDB_SCL (C_AUTO);
1478 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
1485 /* Describe the beginning of an internal block within a function.
1486 Also output descriptions of variables defined in this block.
1488 N is the number of the block, by order of beginning, counting from 1,
1489 and not counting the outermost (function top-level) block.
1490 The blocks match the BLOCKs in DECL_INITIAL (current_function_decl),
1491 if the count starts at 0 for the outermost one. */
1494 sdbout_begin_block (file, line, n)
1499 tree decl = current_function_decl;
1500 MAKE_LINE_SAFE (line);
1502 /* The SCO compiler does not emit a separate block for the function level
1503 scope, so we avoid it here also. However, mips ECOFF compilers do emit
1504 a separate block, so we retain it when MIPS_DEBUGGING_INFO is defined. */
1505 #ifndef MIPS_DEBUGGING_INFO
1508 PUT_SDB_BLOCK_START (line - sdb_begin_function_line);
1512 /* Include the outermost BLOCK's variables in block 1. */
1513 next_block_number = 0;
1515 sdbout_block (DECL_INITIAL (decl));
1517 /* If -g1, suppress all the internal symbols of functions
1518 except for arguments. */
1519 if (debug_info_level != DINFO_LEVEL_TERSE)
1521 next_block_number = 0;
1523 sdbout_block (DECL_INITIAL (decl));
1526 #ifdef SDB_ALLOW_FORWARD_REFERENCES
1527 sdbout_dequeue_anonymous_types ();
1531 /* Describe the end line-number of an internal block within a function. */
1534 sdbout_end_block (file, line, n)
1539 MAKE_LINE_SAFE (line);
1541 /* The SCO compiler does not emit a separate block for the function level
1542 scope, so we avoid it here also. However, mips ECOFF compilers do emit
1543 a separate block, so we retain it when MIPS_DEBUGGING_INFO is defined. */
1544 #ifndef MIPS_DEBUGGING_INFO
1547 PUT_SDB_BLOCK_END (line - sdb_begin_function_line);
1550 /* Output sdb info for the current function name.
1551 Called from assemble_start_function. */
1554 sdbout_mark_begin_function ()
1556 sdbout_symbol (current_function_decl, 0);
1559 /* Called at beginning of function body (after prologue).
1560 Record the function's starting line number, so we can output
1561 relative line numbers for the other lines.
1562 Describe beginning of outermost block.
1563 Also describe the parameter list. */
1566 sdbout_begin_function (line)
1569 sdb_begin_function_line = line - 1;
1570 PUT_SDB_FUNCTION_START (line);
1571 sdbout_parms (DECL_ARGUMENTS (current_function_decl));
1572 sdbout_reg_parms (DECL_ARGUMENTS (current_function_decl));
1575 /* Called at end of function (before epilogue).
1576 Describe end of outermost block. */
1579 sdbout_end_function (line)
1582 #ifdef SDB_ALLOW_FORWARD_REFERENCES
1583 sdbout_dequeue_anonymous_types ();
1586 MAKE_LINE_SAFE (line);
1587 PUT_SDB_FUNCTION_END (line - sdb_begin_function_line);
1589 /* Indicate we are between functions, for line-number output. */
1590 sdb_begin_function_line = -1;
1593 /* Output sdb info for the absolute end of a function.
1594 Called after the epilogue is output. */
1597 sdbout_end_epilogue ()
1599 char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl));
1600 PUT_SDB_EPILOGUE_END (name);
1603 /* Output sdb info for the given label. Called only if LABEL_NAME (insn)
1610 PUT_SDB_DEF (LABEL_NAME (insn));
1612 PUT_SDB_SCL (C_LABEL);
1613 PUT_SDB_TYPE (T_NULL);
1617 /* Change to reading from a new source file. */
1620 sdbout_start_new_source_file (filename)
1623 #ifdef MIPS_DEBUGGING_INFO
1624 struct sdb_file *n = (struct sdb_file *) xmalloc (sizeof *n);
1626 n->next = current_file;
1629 PUT_SDB_SRC_FILE (filename);
1633 /* Revert to reading a previous source file. */
1636 sdbout_resume_previous_source_file ()
1638 #ifdef MIPS_DEBUGGING_INFO
1639 struct sdb_file *next;
1641 next = current_file->next;
1642 free (current_file);
1643 current_file = next;
1644 PUT_SDB_SRC_FILE (current_file->name);
1648 #endif /* SDB_DEBUGGING_INFO */