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 /* Define the default sizes for various types. */
128 #ifndef CHAR_TYPE_SIZE
129 #define CHAR_TYPE_SIZE BITS_PER_UNIT
132 #ifndef SHORT_TYPE_SIZE
133 #define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))
136 #ifndef INT_TYPE_SIZE
137 #define INT_TYPE_SIZE BITS_PER_WORD
140 #ifndef LONG_TYPE_SIZE
141 #define LONG_TYPE_SIZE BITS_PER_WORD
144 #ifndef LONG_LONG_TYPE_SIZE
145 #define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
148 #ifndef FLOAT_TYPE_SIZE
149 #define FLOAT_TYPE_SIZE BITS_PER_WORD
152 #ifndef DOUBLE_TYPE_SIZE
153 #define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
156 #ifndef LONG_DOUBLE_TYPE_SIZE
157 #define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
160 /* Random macros describing parts of SDB data. */
162 /* Put something here if lines get too long */
165 /* Default value of delimiter is ";". */
167 #define SDB_DELIM ";"
170 /* Maximum number of dimensions the assembler will allow. */
172 #define SDB_MAX_DIM 4
176 #define PUT_SDB_SCL(a) fprintf(asm_out_file, "\t.scl\t%d%s", (a), SDB_DELIM)
179 #ifndef PUT_SDB_INT_VAL
180 #define PUT_SDB_INT_VAL(a) \
182 fputs ("\t.val\t", asm_out_file); \
183 fprintf (asm_out_file, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT)(a)); \
184 fprintf (asm_out_file, "%s", SDB_DELIM); \
190 #define PUT_SDB_VAL(a) \
191 ( fputs ("\t.val\t", asm_out_file), \
192 output_addr_const (asm_out_file, (a)), \
193 fprintf (asm_out_file, SDB_DELIM))
197 #define PUT_SDB_DEF(a) \
198 do { fprintf (asm_out_file, "\t.def\t"); \
199 ASM_OUTPUT_LABELREF (asm_out_file, a); \
200 fprintf (asm_out_file, SDB_DELIM); } while (0)
203 #ifndef PUT_SDB_PLAIN_DEF
204 #define PUT_SDB_PLAIN_DEF(a) fprintf(asm_out_file,"\t.def\t.%s%s",a, SDB_DELIM)
207 #ifndef PUT_SDB_ENDEF
208 #define PUT_SDB_ENDEF fputs("\t.endef\n", asm_out_file)
212 #define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\t.type\t0%o%s", a, SDB_DELIM)
216 #define PUT_SDB_SIZE(a) \
218 fputs ("\t.size\t", asm_out_file); \
219 fprintf (asm_out_file, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT)(a)); \
220 fprintf (asm_out_file, "%s", SDB_DELIM); \
224 #ifndef PUT_SDB_START_DIM
225 #define PUT_SDB_START_DIM fprintf(asm_out_file, "\t.dim\t")
228 #ifndef PUT_SDB_NEXT_DIM
229 #define PUT_SDB_NEXT_DIM(a) fprintf(asm_out_file, "%d,", a)
232 #ifndef PUT_SDB_LAST_DIM
233 #define PUT_SDB_LAST_DIM(a) fprintf(asm_out_file, "%d%s", a, SDB_DELIM)
237 #define PUT_SDB_TAG(a) \
238 do { fprintf (asm_out_file, "\t.tag\t"); \
239 ASM_OUTPUT_LABELREF (asm_out_file, a); \
240 fprintf (asm_out_file, SDB_DELIM); } while (0)
243 #ifndef PUT_SDB_BLOCK_START
244 #define PUT_SDB_BLOCK_START(LINE) \
245 fprintf (asm_out_file, \
246 "\t.def\t.bb%s\t.val\t.%s\t.scl\t100%s\t.line\t%d%s\t.endef\n", \
247 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
250 #ifndef PUT_SDB_BLOCK_END
251 #define PUT_SDB_BLOCK_END(LINE) \
252 fprintf (asm_out_file, \
253 "\t.def\t.eb%s\t.val\t.%s\t.scl\t100%s\t.line\t%d%s\t.endef\n", \
254 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
257 #ifndef PUT_SDB_FUNCTION_START
258 #define PUT_SDB_FUNCTION_START(LINE) \
259 fprintf (asm_out_file, \
260 "\t.def\t.bf%s\t.val\t.%s\t.scl\t101%s\t.line\t%d%s\t.endef\n", \
261 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
264 #ifndef PUT_SDB_FUNCTION_END
265 #define PUT_SDB_FUNCTION_END(LINE) \
266 fprintf (asm_out_file, \
267 "\t.def\t.ef%s\t.val\t.%s\t.scl\t101%s\t.line\t%d%s\t.endef\n", \
268 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
271 #ifndef PUT_SDB_EPILOGUE_END
272 #define PUT_SDB_EPILOGUE_END(NAME) \
273 do { fprintf (asm_out_file, "\t.def\t"); \
274 ASM_OUTPUT_LABELREF (asm_out_file, NAME); \
275 fprintf (asm_out_file, \
276 "%s\t.val\t.%s\t.scl\t-1%s\t.endef\n", \
277 SDB_DELIM, SDB_DELIM, SDB_DELIM); } while (0)
280 #ifndef SDB_GENERATE_FAKE
281 #define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
282 sprintf ((BUFFER), ".%dfake", (NUMBER));
285 /* Return the sdb tag identifier string for TYPE
286 if TYPE has already been defined; otherwise return a null pointer. */
288 #define KNOWN_TYPE_TAG(type) TYPE_SYMTAB_POINTER (type)
290 /* Set the sdb tag identifier string for TYPE to NAME. */
292 #define SET_KNOWN_TYPE_TAG(TYPE, NAME) \
293 TYPE_SYMTAB_POINTER (TYPE) = (NAME)
295 /* Return the name (a string) of the struct, union or enum tag
296 described by the TREE_LIST node LINK. This is 0 for an anonymous one. */
298 #define TAG_NAME(link) \
299 (((link) && TREE_PURPOSE ((link)) \
300 && IDENTIFIER_POINTER (TREE_PURPOSE ((link)))) \
301 ? IDENTIFIER_POINTER (TREE_PURPOSE ((link))) : (char *) 0)
303 /* Ensure we don't output a negative line number. */
304 #define MAKE_LINE_SAFE(line) \
305 if (line <= sdb_begin_function_line) line = sdb_begin_function_line + 1
307 /* Perform linker optimization of merging header file definitions together
308 for targets with MIPS_DEBUGGING_INFO defined. This won't work without a
309 post 960826 version of GAS. Nothing breaks with earlier versions of GAS,
310 the optimization just won't be done. The native assembler already has the
311 necessary support. */
313 #ifdef MIPS_DEBUGGING_INFO
315 #ifndef PUT_SDB_SRC_FILE
316 #define PUT_SDB_SRC_FILE(FILENAME) \
317 output_file_directive (asm_out_file, (FILENAME))
320 /* ECOFF linkers have an optimization that does the same kind of thing as
321 N_BINCL/E_INCL in stabs: eliminate duplicate debug information in the
322 executable. To achieve this, GCC must output a .file for each file
325 /* This is a stack of input files. */
329 struct sdb_file
*next
;
333 /* This is the top of the stack. */
335 static struct sdb_file
*current_file
;
337 #endif /* MIPS_DEBUGGING_INFO */
339 /* Set up for SDB output at the start of compilation. */
342 sdbout_init (asm_file
, input_file_name
, syms
)
343 FILE *asm_file ATTRIBUTE_UNUSED
;
344 char *input_file_name ATTRIBUTE_UNUSED
;
345 tree syms ATTRIBUTE_UNUSED
;
347 #ifdef MIPS_DEBUGGING_INFO
348 current_file
= (struct sdb_file
*) xmalloc (sizeof *current_file
);
349 current_file
->next
= NULL
;
350 current_file
->name
= input_file_name
;
353 #ifdef RMS_QUICK_HACK_1
355 for (t
= syms
; t
; t
= TREE_CHAIN (t
))
356 if (DECL_NAME (t
) && IDENTIFIER_POINTER (DECL_NAME (t
)) != 0
357 && !strcmp (IDENTIFIER_POINTER (DECL_NAME (t
)), "__vtbl_ptr_type"))
358 sdbout_symbol (t
, 0);
364 /* return the tag identifier for type
368 tag_of_ru_type (type
,link
)
371 if (TYPE_SYMTAB_ADDRESS (type
))
372 return TYPE_SYMTAB_ADDRESS (type
);
373 if (link
&& TREE_PURPOSE (link
)
374 && IDENTIFIER_POINTER (TREE_PURPOSE (link
)))
375 TYPE_SYMTAB_ADDRESS (type
) = IDENTIFIER_POINTER (TREE_PURPOSE (link
));
377 return (char *) TYPE_SYMTAB_ADDRESS (type
);
381 /* Return a unique string to name an anonymous type. */
388 SDB_GENERATE_FAKE (label
, unnamed_struct_number
);
389 unnamed_struct_number
++;
390 labelstr
= (char *) permalloc (strlen (label
) + 1);
391 strcpy (labelstr
, label
);
395 /* Return the number which describes TYPE for SDB.
396 For pointers, etc., this function is recursive.
397 Each record, union or enumeral type must already have had a
398 tag number output. */
400 /* The number is given by d6d5d4d3d2d1bbbb
401 where bbbb is 4 bit basic type, and di indicate one of notype,ptr,fn,array.
402 Thus, char *foo () has bbbb=T_CHAR
405 N_BTMASK= 017 1111 basic type field.
406 N_TSHIFT= 2 derived type shift
407 N_BTSHFT= 4 Basic type shift */
409 /* Produce the number that describes a pointer, function or array type.
410 PREV is the number describing the target, value or element type.
411 DT_type describes how to transform that type. */
412 #define PUSH_DERIVED_LEVEL(DT_type,PREV) \
413 ((((PREV) & ~(int)N_BTMASK) << (int)N_TSHIFT) \
414 | ((int)DT_type << (int)N_BTSHFT) \
415 | ((PREV) & (int)N_BTMASK))
417 /* Number of elements used in sdb_dims. */
418 static int sdb_n_dims
= 0;
420 /* Table of array dimensions of current type. */
421 static int sdb_dims
[SDB_MAX_DIM
];
423 /* Size of outermost array currently being processed. */
424 static int sdb_type_size
= -1;
430 int val
= plain_type_1 (type
, 0);
432 /* If we have already saved up some array dimensions, print them now. */
437 for (i
= sdb_n_dims
- 1; i
> 0; i
--)
438 PUT_SDB_NEXT_DIM (sdb_dims
[i
]);
439 PUT_SDB_LAST_DIM (sdb_dims
[0]);
442 sdb_type_size
= int_size_in_bytes (type
);
443 /* Don't kill sdb if type is not laid out or has variable size. */
444 if (sdb_type_size
< 0)
447 /* If we have computed the size of an array containing this type,
449 if (sdb_type_size
>= 0)
451 PUT_SDB_SIZE (sdb_type_size
);
458 template_name_p (name
)
461 register char *ptr
= IDENTIFIER_POINTER (name
);
462 while (*ptr
&& *ptr
!= '<')
469 sdbout_record_type_name (type
)
475 if (KNOWN_TYPE_TAG (type
))
478 if (TYPE_NAME (type
) != 0)
481 /* Find the IDENTIFIER_NODE for the type name. */
482 if (TREE_CODE (TYPE_NAME (type
)) == IDENTIFIER_NODE
)
483 t
= TYPE_NAME (type
);
484 else if (TREE_CODE (TYPE_NAME (type
)) == TYPE_DECL
)
486 t
= DECL_NAME (TYPE_NAME (type
));
487 /* The DECL_NAME for templates includes "<>", which breaks
488 most assemblers. Use its assembler name instead, which
489 has been mangled into being safe. */
490 if (t
&& template_name_p (t
))
491 t
= DECL_ASSEMBLER_NAME (TYPE_NAME (type
));
494 /* Now get the name as a string, or invent one. */
496 name
= IDENTIFIER_POINTER (t
);
499 no_name
= (name
== 0 || *name
== 0);
501 name
= gen_fake_label ();
503 SET_KNOWN_TYPE_TAG (type
, name
);
504 #ifdef SDB_ALLOW_FORWARD_REFERENCES
506 sdbout_queue_anonymous_type (type
);
510 /* Return the .type value for type TYPE.
512 LEVEL indicates how many levels deep we have recursed into the type.
513 The SDB debug format can only represent 6 derived levels of types.
514 After that, we must output inaccurate debug info. We deliberately
515 stop before the 7th level, so that ADA recursive types will not give an
519 plain_type_1 (type
, level
)
524 type
= void_type_node
;
525 else if (type
== error_mark_node
)
526 type
= integer_type_node
;
528 type
= TYPE_MAIN_VARIANT (type
);
530 switch (TREE_CODE (type
))
537 int size
= int_size_in_bytes (type
) * BITS_PER_UNIT
;
539 /* Carefully distinguish all the standard types of C,
540 without messing up if the language is not C.
541 Note that we check only for the names that contain spaces;
542 other names might occur by coincidence in other languages. */
543 if (TYPE_NAME (type
) != 0
544 && TREE_CODE (TYPE_NAME (type
)) == TYPE_DECL
545 && DECL_NAME (TYPE_NAME (type
)) != 0
546 && TREE_CODE (DECL_NAME (TYPE_NAME (type
))) == IDENTIFIER_NODE
)
548 char *name
= IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type
)));
550 if (!strcmp (name
, "char"))
552 if (!strcmp (name
, "unsigned char"))
554 if (!strcmp (name
, "signed char"))
556 if (!strcmp (name
, "int"))
558 if (!strcmp (name
, "unsigned int"))
560 if (!strcmp (name
, "short int"))
562 if (!strcmp (name
, "short unsigned int"))
564 if (!strcmp (name
, "long int"))
566 if (!strcmp (name
, "long unsigned int"))
570 if (size
== INT_TYPE_SIZE
)
571 return (TREE_UNSIGNED (type
) ? T_UINT
: T_INT
);
572 if (size
== CHAR_TYPE_SIZE
)
573 return (TREE_UNSIGNED (type
) ? T_UCHAR
: T_CHAR
);
574 if (size
== SHORT_TYPE_SIZE
)
575 return (TREE_UNSIGNED (type
) ? T_USHORT
: T_SHORT
);
576 if (size
== LONG_TYPE_SIZE
)
577 return (TREE_UNSIGNED (type
) ? T_ULONG
: T_LONG
);
578 if (size
== LONG_LONG_TYPE_SIZE
) /* better than nothing */
579 return (TREE_UNSIGNED (type
) ? T_ULONG
: T_LONG
);
585 int precision
= TYPE_PRECISION (type
);
586 if (precision
== FLOAT_TYPE_SIZE
)
588 if (precision
== DOUBLE_TYPE_SIZE
)
590 #ifdef EXTENDED_SDB_BASIC_TYPES
591 if (precision
== LONG_DOUBLE_TYPE_SIZE
)
594 if (precision
== LONG_DOUBLE_TYPE_SIZE
)
595 return T_DOUBLE
; /* better than nothing */
606 m
= plain_type_1 (TREE_TYPE (type
), level
+1);
607 if (sdb_n_dims
< SDB_MAX_DIM
)
608 sdb_dims
[sdb_n_dims
++]
609 = (TYPE_DOMAIN (type
)
610 && TYPE_MAX_VALUE (TYPE_DOMAIN (type
))
611 && TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (type
))) == INTEGER_CST
612 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (type
))) == INTEGER_CST
613 ? (TREE_INT_CST_LOW (TYPE_MAX_VALUE (TYPE_DOMAIN (type
)))
614 - TREE_INT_CST_LOW (TYPE_MIN_VALUE (TYPE_DOMAIN (type
))) + 1)
616 return PUSH_DERIVED_LEVEL (DT_ARY
, m
);
621 case QUAL_UNION_TYPE
:
625 #ifdef SDB_ALLOW_FORWARD_REFERENCES
626 sdbout_record_type_name (type
);
628 #ifndef SDB_ALLOW_UNKNOWN_REFERENCES
629 if ((TREE_ASM_WRITTEN (type
) && KNOWN_TYPE_TAG (type
) != 0)
630 #ifdef SDB_ALLOW_FORWARD_REFERENCES
631 || TYPE_MODE (type
) != VOIDmode
636 /* Output the referenced structure tag name
637 only if the .def has already been finished.
638 At least on 386, the Unix assembler
639 cannot handle forward references to tags. */
640 /* But the 88100, it requires them, sigh... */
641 /* And the MIPS requires unknown refs as well... */
642 tag
= KNOWN_TYPE_TAG (type
);
644 /* These 3 lines used to follow the close brace.
645 However, a size of 0 without a tag implies a tag of 0,
646 so if we don't know a tag, we can't mention the size. */
647 sdb_type_size
= int_size_in_bytes (type
);
648 if (sdb_type_size
< 0)
651 return ((TREE_CODE (type
) == RECORD_TYPE
) ? T_STRUCT
652 : (TREE_CODE (type
) == UNION_TYPE
) ? T_UNION
653 : (TREE_CODE (type
) == QUAL_UNION_TYPE
) ? T_UNION
663 m
= plain_type_1 (TREE_TYPE (type
), level
+1);
664 return PUSH_DERIVED_LEVEL (DT_PTR
, m
);
673 m
= plain_type_1 (TREE_TYPE (type
), level
+1);
674 return PUSH_DERIVED_LEVEL (DT_FCN
, m
);
681 /* Output the symbols defined in block number DO_BLOCK.
682 Set NEXT_BLOCK_NUMBER to 0 before calling.
684 This function works by walking the tree structure of blocks,
685 counting blocks until it finds the desired block. */
687 static int do_block
= 0;
689 static int next_block_number
;
697 /* Ignore blocks never expanded or otherwise marked as real. */
698 if (TREE_USED (block
))
700 /* When we reach the specified block, output its symbols. */
701 if (next_block_number
== do_block
)
703 sdbout_syms (BLOCK_VARS (block
));
706 /* If we are past the specified block, stop the scan. */
707 if (next_block_number
> do_block
)
712 /* Scan the blocks within this block. */
713 sdbout_block (BLOCK_SUBBLOCKS (block
));
716 block
= BLOCK_CHAIN (block
);
720 /* Call sdbout_symbol on each decl in the chain SYMS. */
728 if (TREE_CODE (syms
) != LABEL_DECL
)
729 sdbout_symbol (syms
, 1);
730 syms
= TREE_CHAIN (syms
);
734 /* Output SDB information for a symbol described by DECL.
735 LOCAL is nonzero if the symbol is not file-scope. */
738 sdbout_symbol (decl
, local
)
742 tree type
= TREE_TYPE (decl
);
743 tree context
= NULL_TREE
;
748 sdbout_one_type (type
);
750 #if 0 /* This loses when functions are marked to be ignored,
751 which happens in the C++ front end. */
752 if (DECL_IGNORED_P (decl
))
756 switch (TREE_CODE (decl
))
759 /* Enum values are defined by defining the enum type. */
763 /* Don't mention a nested function under its parent. */
764 context
= decl_function_context (decl
);
765 if (context
== current_function_decl
)
767 /* Check DECL_INITIAL to distinguish declarations from definitions.
768 Don't output debug info here for declarations; they will have
769 a DECL_INITIAL value of 0. */
770 if (! DECL_INITIAL (decl
))
772 if (GET_CODE (DECL_RTL (decl
)) != MEM
773 || GET_CODE (XEXP (DECL_RTL (decl
), 0)) != SYMBOL_REF
)
775 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
)));
776 PUT_SDB_VAL (XEXP (DECL_RTL (decl
), 0));
777 PUT_SDB_SCL (TREE_PUBLIC (decl
) ? C_EXT
: C_STAT
);
781 /* Done with tagged types. */
782 if (DECL_NAME (decl
) == 0)
784 if (DECL_IGNORED_P (decl
))
787 /* Output typedef name. */
788 if (template_name_p (DECL_NAME (decl
)))
789 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
)));
791 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_NAME (decl
)));
792 PUT_SDB_SCL (C_TPDEF
);
796 /* Parm decls go in their own separate chains
797 and are output by sdbout_reg_parms and sdbout_parms. */
801 /* Don't mention a variable that is external.
802 Let the file that defines it describe it. */
803 if (DECL_EXTERNAL (decl
))
806 /* Ignore __FUNCTION__, etc. */
807 if (DECL_IGNORED_P (decl
))
810 /* If there was an error in the declaration, don't dump core
811 if there is no RTL associated with the variable doesn't
813 if (DECL_RTL (decl
) == 0)
816 DECL_RTL (decl
) = eliminate_regs (DECL_RTL (decl
), 0, NULL_RTX
);
817 #ifdef LEAF_REG_REMAP
818 if (current_function_uses_only_leaf_regs
)
819 leaf_renumber_regs_insn (DECL_RTL (decl
));
821 value
= DECL_RTL (decl
);
823 /* Don't mention a variable at all
824 if it was completely optimized into nothingness.
826 If DECL was from an inline function, then its rtl
827 is not identically the rtl that was used in this
828 particular compilation. */
829 if (GET_CODE (value
) == REG
)
831 regno
= REGNO (DECL_RTL (decl
));
832 if (regno
>= FIRST_PSEUDO_REGISTER
)
835 else if (GET_CODE (value
) == SUBREG
)
838 while (GET_CODE (value
) == SUBREG
)
840 offset
+= SUBREG_WORD (value
);
841 value
= SUBREG_REG (value
);
843 if (GET_CODE (value
) == REG
)
845 regno
= REGNO (value
);
846 if (regno
>= FIRST_PSEUDO_REGISTER
)
850 alter_subreg (DECL_RTL (decl
));
851 value
= DECL_RTL (decl
);
853 /* Don't output anything if an auto variable
854 gets RTL that is static.
855 GAS version 2.2 can't handle such output. */
856 else if (GET_CODE (value
) == MEM
&& CONSTANT_P (XEXP (value
, 0))
857 && ! TREE_STATIC (decl
))
860 /* Emit any structure, union, or enum type that has not been output.
861 This occurs for tag-less structs (et al) used to declare variables
863 if (TREE_CODE (type
) == ENUMERAL_TYPE
864 || TREE_CODE (type
) == RECORD_TYPE
865 || TREE_CODE (type
) == UNION_TYPE
866 || TREE_CODE (type
) == QUAL_UNION_TYPE
)
868 if (TYPE_SIZE (type
) != 0 /* not a forward reference */
869 && KNOWN_TYPE_TAG (type
) == 0) /* not yet declared */
870 sdbout_one_type (type
);
873 /* Defer SDB information for top-level initialized variables! */
875 && GET_CODE (value
) == MEM
876 && DECL_INITIAL (decl
))
879 /* C++ in 2.3 makes nameless symbols. That will be fixed later.
880 For now, avoid crashing. */
881 if (DECL_NAME (decl
) == NULL_TREE
)
884 /* Record the name for, starting a symtab entry. */
885 name
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
));
887 if (GET_CODE (value
) == MEM
888 && GET_CODE (XEXP (value
, 0)) == SYMBOL_REF
)
891 if (TREE_PUBLIC (decl
))
893 PUT_SDB_VAL (XEXP (value
, 0));
898 PUT_SDB_VAL (XEXP (value
, 0));
899 PUT_SDB_SCL (C_STAT
);
905 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (regno
));
908 else if (GET_CODE (value
) == MEM
909 && (GET_CODE (XEXP (value
, 0)) == MEM
910 || (GET_CODE (XEXP (value
, 0)) == REG
911 && REGNO (XEXP (value
, 0)) != HARD_FRAME_POINTER_REGNUM
912 && REGNO (XEXP (value
, 0)) != STACK_POINTER_REGNUM
)))
913 /* If the value is indirect by memory or by a register
914 that isn't the frame pointer
915 then it means the object is variable-sized and address through
916 that register or stack slot. COFF has no way to represent this
917 so all we can do is output the variable as a pointer. */
920 if (GET_CODE (XEXP (value
, 0)) == REG
)
922 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (XEXP (value
, 0))));
927 /* DECL_RTL looks like (MEM (MEM (PLUS (REG...)
929 We want the value of that CONST_INT. */
930 /* Encore compiler hates a newline in a macro arg, it seems. */
931 PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET
932 (XEXP (XEXP (value
, 0), 0)));
933 PUT_SDB_SCL (C_AUTO
);
936 /* Effectively do build_pointer_type, but don't cache this type,
937 since it might be temporary whereas the type it points to
938 might have been saved for inlining. */
939 /* Don't use REFERENCE_TYPE because dbx can't handle that. */
940 type
= make_node (POINTER_TYPE
);
941 TREE_TYPE (type
) = TREE_TYPE (decl
);
943 else if (GET_CODE (value
) == MEM
944 && ((GET_CODE (XEXP (value
, 0)) == PLUS
945 && GET_CODE (XEXP (XEXP (value
, 0), 0)) == REG
946 && GET_CODE (XEXP (XEXP (value
, 0), 1)) == CONST_INT
)
947 /* This is for variables which are at offset zero from
948 the frame pointer. This happens on the Alpha.
949 Non-frame pointer registers are excluded above. */
950 || (GET_CODE (XEXP (value
, 0)) == REG
)))
952 /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...)))
953 or (MEM (REG...)). We want the value of that CONST_INT
956 PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET (XEXP (value
, 0)));
957 PUT_SDB_SCL (C_AUTO
);
959 else if (GET_CODE (value
) == MEM
&& GET_CODE (XEXP (value
, 0)) == CONST
)
961 /* Handle an obscure case which can arise when optimizing and
962 when there are few available registers. (This is *always*
963 the case for i386/i486 targets). The DECL_RTL looks like
964 (MEM (CONST ...)) even though this variable is a local `auto'
965 or a local `register' variable. In effect, what has happened
966 is that the reload pass has seen that all assignments and
967 references for one such a local variable can be replaced by
968 equivalent assignments and references to some static storage
969 variable, thereby avoiding the need for a register. In such
970 cases we're forced to lie to debuggers and tell them that
971 this variable was itself `static'. */
973 PUT_SDB_VAL (XEXP (XEXP (value
, 0), 0));
974 PUT_SDB_SCL (C_STAT
);
978 /* It is something we don't know how to represent for SDB. */
986 PUT_SDB_TYPE (plain_type (type
));
990 /* Output SDB information for a top-level initialized variable
991 that has been delayed. */
994 sdbout_toplevel_data (decl
)
997 tree type
= TREE_TYPE (decl
);
999 if (DECL_IGNORED_P (decl
))
1002 if (! (TREE_CODE (decl
) == VAR_DECL
1003 && GET_CODE (DECL_RTL (decl
)) == MEM
1004 && DECL_INITIAL (decl
)))
1007 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
)));
1008 PUT_SDB_VAL (XEXP (DECL_RTL (decl
), 0));
1009 if (TREE_PUBLIC (decl
))
1011 PUT_SDB_SCL (C_EXT
);
1015 PUT_SDB_SCL (C_STAT
);
1017 PUT_SDB_TYPE (plain_type (type
));
1021 #ifdef SDB_ALLOW_FORWARD_REFERENCES
1023 /* Machinery to record and output anonymous types. */
1025 static tree anonymous_types
;
1028 sdbout_queue_anonymous_type (type
)
1031 anonymous_types
= saveable_tree_cons (NULL_TREE
, type
, anonymous_types
);
1035 sdbout_dequeue_anonymous_types ()
1037 register tree types
, link
;
1039 while (anonymous_types
)
1041 types
= nreverse (anonymous_types
);
1042 anonymous_types
= NULL_TREE
;
1044 for (link
= types
; link
; link
= TREE_CHAIN (link
))
1046 register tree type
= TREE_VALUE (link
);
1048 if (type
&& ! TREE_ASM_WRITTEN (type
))
1049 sdbout_one_type (type
);
1056 /* Given a chain of ..._TYPE nodes, all of which have names,
1057 output definitions of those names, as typedefs. */
1060 sdbout_types (types
)
1061 register tree types
;
1065 for (link
= types
; link
; link
= TREE_CHAIN (link
))
1066 sdbout_one_type (link
);
1068 #ifdef SDB_ALLOW_FORWARD_REFERENCES
1069 sdbout_dequeue_anonymous_types ();
1077 if (type
== error_mark_node
)
1078 type
= integer_type_node
;
1079 PUT_SDB_TYPE (plain_type (type
));
1082 /* Output types of the fields of type TYPE, if they are structs.
1084 Formerly did not chase through pointer types, since that could be circular.
1085 They must come before TYPE, since forward refs are not allowed.
1086 Now james@bigtex.cactus.org says to try them. */
1089 sdbout_field_types (type
)
1094 for (tail
= TYPE_FIELDS (type
); tail
; tail
= TREE_CHAIN (tail
))
1095 /* This condition should match the one for emitting the actual members
1097 if (TREE_CODE (tail
) == FIELD_DECL
1098 && DECL_NAME (tail
) != 0
1099 && TREE_CODE (DECL_SIZE (tail
)) == INTEGER_CST
1100 && TREE_CODE (DECL_FIELD_BITPOS (tail
)) == INTEGER_CST
)
1102 if (POINTER_TYPE_P (TREE_TYPE (tail
)))
1103 sdbout_one_type (TREE_TYPE (TREE_TYPE (tail
)));
1105 sdbout_one_type (TREE_TYPE (tail
));
1109 /* Use this to put out the top level defined record and union types
1110 for later reference. If this is a struct with a name, then put that
1111 name out. Other unnamed structs will have .xxfake labels generated so
1112 that they may be referred to later.
1113 The label will be stored in the KNOWN_TYPE_TAG slot of a type.
1114 It may NOT be called recursively. */
1117 sdbout_one_type (type
)
1120 if (current_function_decl
!= NULL_TREE
1121 && DECL_SECTION_NAME (current_function_decl
) != NULL_TREE
)
1122 ; /* Don't change section amid function. */
1126 switch (TREE_CODE (type
))
1130 case QUAL_UNION_TYPE
:
1132 type
= TYPE_MAIN_VARIANT (type
);
1133 /* Don't output a type twice. */
1134 if (TREE_ASM_WRITTEN (type
))
1135 /* James said test TREE_ASM_BEING_WRITTEN here. */
1138 /* Output nothing if type is not yet defined. */
1139 if (TYPE_SIZE (type
) == 0)
1142 TREE_ASM_WRITTEN (type
) = 1;
1144 /* This is reputed to cause trouble with the following case,
1145 but perhaps checking TYPE_SIZE above will fix it. */
1147 /* Here is a test case:
1153 typedef struct intermediate {
1157 typedef struct badstr {
1162 TREE_ASM_BEING_WRITTEN (type
) = 1;
1164 /* This change, which ought to make better output,
1165 used to make the COFF assembler unhappy.
1166 Changes involving KNOWN_TYPE_TAG may fix the problem. */
1167 /* Before really doing anything, output types we want to refer to. */
1168 /* Note that in version 1 the following two lines
1169 are not used if forward references are in use. */
1170 if (TREE_CODE (type
) != ENUMERAL_TYPE
)
1171 sdbout_field_types (type
);
1173 TREE_ASM_WRITTEN (type
) = 1;
1177 /* Output a structure type. */
1179 int size
= int_size_in_bytes (type
);
1182 int i
, n_baseclasses
= 0;
1184 /* Record the type tag, but not in its permanent place just yet. */
1185 sdbout_record_type_name (type
);
1187 PUT_SDB_DEF (KNOWN_TYPE_TAG (type
));
1189 switch (TREE_CODE (type
))
1192 case QUAL_UNION_TYPE
:
1193 PUT_SDB_SCL (C_UNTAG
);
1194 PUT_SDB_TYPE (T_UNION
);
1199 PUT_SDB_SCL (C_STRTAG
);
1200 PUT_SDB_TYPE (T_STRUCT
);
1205 PUT_SDB_SCL (C_ENTAG
);
1206 PUT_SDB_TYPE (T_ENUM
);
1214 PUT_SDB_SIZE (size
);
1217 /* Print out the base class information with fields
1218 named after the types they hold. */
1219 /* This is only relevent to aggregate types. TYPE_BINFO is used
1220 for other purposes in an ENUMERAL_TYPE, so we must exclude that
1222 if (TREE_CODE (type
) != ENUMERAL_TYPE
)
1224 if (TYPE_BINFO (type
)
1225 && TYPE_BINFO_BASETYPES (type
))
1226 n_baseclasses
= TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (type
));
1227 for (i
= 0; i
< n_baseclasses
; i
++)
1229 tree child
= TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (type
)),
1231 tree child_type
= BINFO_TYPE (child
);
1232 tree child_type_name
;
1233 if (TYPE_NAME (child_type
) == 0)
1235 if (TREE_CODE (TYPE_NAME (child_type
)) == IDENTIFIER_NODE
)
1236 child_type_name
= TYPE_NAME (child_type
);
1237 else if (TREE_CODE (TYPE_NAME (child_type
)) == TYPE_DECL
)
1239 child_type_name
= DECL_NAME (TYPE_NAME (child_type
));
1240 if (child_type_name
&& template_name_p (child_type_name
))
1242 = DECL_ASSEMBLER_NAME (TYPE_NAME (child_type
));
1248 PUT_SDB_DEF (IDENTIFIER_POINTER (child_type_name
));
1249 PUT_SDB_INT_VAL (TREE_INT_CST_LOW (BINFO_OFFSET (child
)));
1250 PUT_SDB_SCL (member_scl
);
1251 sdbout_type (BINFO_TYPE (child
));
1256 /* output the individual fields */
1258 if (TREE_CODE (type
) == ENUMERAL_TYPE
)
1259 for (tem
= TYPE_FIELDS (type
); tem
; tem
= TREE_CHAIN (tem
))
1261 PUT_SDB_DEF (IDENTIFIER_POINTER (TREE_PURPOSE (tem
)));
1262 PUT_SDB_INT_VAL (TREE_INT_CST_LOW (TREE_VALUE (tem
)));
1263 PUT_SDB_SCL (C_MOE
);
1264 PUT_SDB_TYPE (T_MOE
);
1268 else /* record or union type */
1269 for (tem
= TYPE_FIELDS (type
); tem
; tem
= TREE_CHAIN (tem
))
1270 /* Output the name, type, position (in bits), size (in bits)
1273 /* Omit here the nameless fields that are used to skip bits.
1274 Also omit fields with variable size or position.
1275 Also omit non FIELD_DECL nodes that GNU C++ may put here. */
1276 if (TREE_CODE (tem
) == FIELD_DECL
1277 && DECL_NAME (tem
) != 0
1278 && TREE_CODE (DECL_SIZE (tem
)) == INTEGER_CST
1279 && TREE_CODE (DECL_FIELD_BITPOS (tem
)) == INTEGER_CST
)
1284 name
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (tem
));
1286 if (DECL_BIT_FIELD_TYPE (tem
))
1288 PUT_SDB_INT_VAL (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (tem
)));
1289 PUT_SDB_SCL (C_FIELD
);
1290 sdbout_type (DECL_BIT_FIELD_TYPE (tem
));
1291 PUT_SDB_SIZE (TREE_INT_CST_LOW (DECL_SIZE (tem
)));
1295 PUT_SDB_INT_VAL (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (tem
))
1297 PUT_SDB_SCL (member_scl
);
1298 sdbout_type (TREE_TYPE (tem
));
1302 /* output end of a structure,union, or enumeral definition */
1304 PUT_SDB_PLAIN_DEF ("eos");
1305 PUT_SDB_INT_VAL (size
);
1306 PUT_SDB_SCL (C_EOS
);
1307 PUT_SDB_TAG (KNOWN_TYPE_TAG (type
));
1308 PUT_SDB_SIZE (size
);
1318 /* The following two functions output definitions of function parameters.
1319 Each parameter gets a definition locating it in the parameter list.
1320 Each parameter that is a register variable gets a second definition
1321 locating it in the register.
1323 Printing or argument lists in gdb uses the definitions that
1324 locate in the parameter list. But reference to the variable in
1325 expressions uses preferentially the definition as a register. */
1327 /* Output definitions, referring to storage in the parmlist,
1328 of all the parms in PARMS, which is a chain of PARM_DECL nodes. */
1331 sdbout_parms (parms
)
1334 for (; parms
; parms
= TREE_CHAIN (parms
))
1335 if (DECL_NAME (parms
))
1337 int current_sym_value
= 0;
1338 char *name
= IDENTIFIER_POINTER (DECL_NAME (parms
));
1340 if (name
== 0 || *name
== 0)
1341 name
= gen_fake_label ();
1343 /* Perform any necessary register eliminations on the parameter's rtl,
1344 so that the debugging output will be accurate. */
1345 DECL_INCOMING_RTL (parms
)
1346 = eliminate_regs (DECL_INCOMING_RTL (parms
), 0, NULL_RTX
);
1347 DECL_RTL (parms
) = eliminate_regs (DECL_RTL (parms
), 0, NULL_RTX
);
1349 if (PARM_PASSED_IN_MEMORY (parms
))
1351 rtx addr
= XEXP (DECL_INCOMING_RTL (parms
), 0);
1354 /* ??? Here we assume that the parm address is indexed
1355 off the frame pointer or arg pointer.
1356 If that is not true, we produce meaningless results,
1357 but do not crash. */
1358 if (GET_CODE (addr
) == PLUS
1359 && GET_CODE (XEXP (addr
, 1)) == CONST_INT
)
1360 current_sym_value
= INTVAL (XEXP (addr
, 1));
1362 current_sym_value
= 0;
1364 if (GET_CODE (DECL_RTL (parms
)) == REG
1365 && REGNO (DECL_RTL (parms
)) >= 0
1366 && REGNO (DECL_RTL (parms
)) < FIRST_PSEUDO_REGISTER
)
1367 type
= DECL_ARG_TYPE (parms
);
1370 int original_sym_value
= current_sym_value
;
1372 /* This is the case where the parm is passed as an int or
1373 double and it is converted to a char, short or float
1374 and stored back in the parmlist. In this case, describe
1375 the parm with the variable's declared type, and adjust
1376 the address if the least significant bytes (which we are
1377 using) are not the first ones. */
1378 if (BYTES_BIG_ENDIAN
1379 && TREE_TYPE (parms
) != DECL_ARG_TYPE (parms
))
1380 current_sym_value
+=
1381 (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parms
)))
1382 - GET_MODE_SIZE (GET_MODE (DECL_RTL (parms
))));
1384 if (GET_CODE (DECL_RTL (parms
)) == MEM
1385 && GET_CODE (XEXP (DECL_RTL (parms
), 0)) == PLUS
1386 && (GET_CODE (XEXP (XEXP (DECL_RTL (parms
), 0), 1))
1388 && (INTVAL (XEXP (XEXP (DECL_RTL (parms
), 0), 1))
1389 == current_sym_value
))
1390 type
= TREE_TYPE (parms
);
1393 current_sym_value
= original_sym_value
;
1394 type
= DECL_ARG_TYPE (parms
);
1399 PUT_SDB_INT_VAL (DEBUGGER_ARG_OFFSET (current_sym_value
, addr
));
1400 PUT_SDB_SCL (C_ARG
);
1401 PUT_SDB_TYPE (plain_type (type
));
1404 else if (GET_CODE (DECL_RTL (parms
)) == REG
)
1407 /* Parm passed in registers and lives in registers or nowhere. */
1409 /* If parm lives in a register, use that register;
1410 pretend the parm was passed there. It would be more consistent
1411 to describe the register where the parm was passed,
1412 but in practice that register usually holds something else. */
1413 if (REGNO (DECL_RTL (parms
)) >= 0
1414 && REGNO (DECL_RTL (parms
)) < FIRST_PSEUDO_REGISTER
)
1415 best_rtl
= DECL_RTL (parms
);
1416 /* If the parm lives nowhere,
1417 use the register where it was passed. */
1419 best_rtl
= DECL_INCOMING_RTL (parms
);
1422 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (best_rtl
)));
1423 PUT_SDB_SCL (C_REGPARM
);
1424 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms
)));
1427 else if (GET_CODE (DECL_RTL (parms
)) == MEM
1428 && XEXP (DECL_RTL (parms
), 0) != const0_rtx
)
1430 /* Parm was passed in registers but lives on the stack. */
1432 /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))),
1433 in which case we want the value of that CONST_INT,
1434 or (MEM (REG ...)) or (MEM (MEM ...)),
1435 in which case we use a value of zero. */
1436 if (GET_CODE (XEXP (DECL_RTL (parms
), 0)) == REG
1437 || GET_CODE (XEXP (DECL_RTL (parms
), 0)) == MEM
)
1438 current_sym_value
= 0;
1440 current_sym_value
= INTVAL (XEXP (XEXP (DECL_RTL (parms
), 0), 1));
1442 /* Again, this assumes the offset is based on the arg pointer. */
1444 PUT_SDB_INT_VAL (DEBUGGER_ARG_OFFSET (current_sym_value
,
1445 XEXP (DECL_RTL (parms
), 0)));
1446 PUT_SDB_SCL (C_ARG
);
1447 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms
)));
1453 /* Output definitions for the places where parms live during the function,
1454 when different from where they were passed, when the parms were passed
1457 It is not useful to do this for parms passed in registers
1458 that live during the function in different registers, because it is
1459 impossible to look in the passed register for the passed value,
1460 so we use the within-the-function register to begin with.
1462 PARMS is a chain of PARM_DECL nodes. */
1465 sdbout_reg_parms (parms
)
1468 for (; parms
; parms
= TREE_CHAIN (parms
))
1469 if (DECL_NAME (parms
))
1471 char *name
= IDENTIFIER_POINTER (DECL_NAME (parms
));
1473 /* Report parms that live in registers during the function
1474 but were passed in memory. */
1475 if (GET_CODE (DECL_RTL (parms
)) == REG
1476 && REGNO (DECL_RTL (parms
)) >= 0
1477 && REGNO (DECL_RTL (parms
)) < FIRST_PSEUDO_REGISTER
1478 && PARM_PASSED_IN_MEMORY (parms
))
1480 if (name
== 0 || *name
== 0)
1481 name
= gen_fake_label ();
1483 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (DECL_RTL (parms
))));
1484 PUT_SDB_SCL (C_REG
);
1485 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms
)));
1488 /* Report parms that live in memory but not where they were passed. */
1489 else if (GET_CODE (DECL_RTL (parms
)) == MEM
1490 && GET_CODE (XEXP (DECL_RTL (parms
), 0)) == PLUS
1491 && GET_CODE (XEXP (XEXP (DECL_RTL (parms
), 0), 1)) == CONST_INT
1492 && PARM_PASSED_IN_MEMORY (parms
)
1493 && ! rtx_equal_p (DECL_RTL (parms
), DECL_INCOMING_RTL (parms
)))
1495 #if 0 /* ??? It is not clear yet what should replace this. */
1496 int offset
= DECL_OFFSET (parms
) / BITS_PER_UNIT
;
1497 /* A parm declared char is really passed as an int,
1498 so it occupies the least significant bytes.
1499 On a big-endian machine those are not the low-numbered ones. */
1500 if (BYTES_BIG_ENDIAN
1502 && TREE_TYPE (parms
) != DECL_ARG_TYPE (parms
))
1503 offset
+= (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parms
)))
1504 - GET_MODE_SIZE (GET_MODE (DECL_RTL (parms
))));
1505 if (INTVAL (XEXP (XEXP (DECL_RTL (parms
), 0), 1)) != offset
) {...}
1508 if (name
== 0 || *name
== 0)
1509 name
= gen_fake_label ();
1511 PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET
1512 (XEXP (DECL_RTL (parms
), 0)));
1513 PUT_SDB_SCL (C_AUTO
);
1514 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms
)));
1521 /* Describe the beginning of an internal block within a function.
1522 Also output descriptions of variables defined in this block.
1524 N is the number of the block, by order of beginning, counting from 1,
1525 and not counting the outermost (function top-level) block.
1526 The blocks match the BLOCKs in DECL_INITIAL (current_function_decl),
1527 if the count starts at 0 for the outermost one. */
1530 sdbout_begin_block (file
, line
, n
)
1531 FILE *file ATTRIBUTE_UNUSED
;
1535 tree decl
= current_function_decl
;
1536 MAKE_LINE_SAFE (line
);
1538 /* The SCO compiler does not emit a separate block for the function level
1539 scope, so we avoid it here also. However, mips ECOFF compilers do emit
1540 a separate block, so we retain it when MIPS_DEBUGGING_INFO is defined. */
1541 #ifndef MIPS_DEBUGGING_INFO
1544 PUT_SDB_BLOCK_START (line
- sdb_begin_function_line
);
1548 /* Include the outermost BLOCK's variables in block 1. */
1549 next_block_number
= 0;
1551 sdbout_block (DECL_INITIAL (decl
));
1553 /* If -g1, suppress all the internal symbols of functions
1554 except for arguments. */
1555 if (debug_info_level
!= DINFO_LEVEL_TERSE
)
1557 next_block_number
= 0;
1559 sdbout_block (DECL_INITIAL (decl
));
1562 #ifdef SDB_ALLOW_FORWARD_REFERENCES
1563 sdbout_dequeue_anonymous_types ();
1567 /* Describe the end line-number of an internal block within a function. */
1570 sdbout_end_block (file
, line
, n
)
1571 FILE *file ATTRIBUTE_UNUSED
;
1573 int n ATTRIBUTE_UNUSED
;
1575 MAKE_LINE_SAFE (line
);
1577 /* The SCO compiler does not emit a separate block for the function level
1578 scope, so we avoid it here also. However, mips ECOFF compilers do emit
1579 a separate block, so we retain it when MIPS_DEBUGGING_INFO is defined. */
1580 #ifndef MIPS_DEBUGGING_INFO
1583 PUT_SDB_BLOCK_END (line
- sdb_begin_function_line
);
1586 /* Output sdb info for the current function name.
1587 Called from assemble_start_function. */
1590 sdbout_mark_begin_function ()
1592 sdbout_symbol (current_function_decl
, 0);
1595 /* Called at beginning of function body (after prologue).
1596 Record the function's starting line number, so we can output
1597 relative line numbers for the other lines.
1598 Describe beginning of outermost block.
1599 Also describe the parameter list. */
1602 sdbout_begin_function (line
)
1605 sdb_begin_function_line
= line
- 1;
1606 PUT_SDB_FUNCTION_START (line
);
1607 sdbout_parms (DECL_ARGUMENTS (current_function_decl
));
1608 sdbout_reg_parms (DECL_ARGUMENTS (current_function_decl
));
1611 /* Called at end of function (before epilogue).
1612 Describe end of outermost block. */
1615 sdbout_end_function (line
)
1618 #ifdef SDB_ALLOW_FORWARD_REFERENCES
1619 sdbout_dequeue_anonymous_types ();
1622 MAKE_LINE_SAFE (line
);
1623 PUT_SDB_FUNCTION_END (line
- sdb_begin_function_line
);
1625 /* Indicate we are between functions, for line-number output. */
1626 sdb_begin_function_line
= -1;
1629 /* Output sdb info for the absolute end of a function.
1630 Called after the epilogue is output. */
1633 sdbout_end_epilogue ()
1635 char *name
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl
));
1636 PUT_SDB_EPILOGUE_END (name
);
1639 /* Output sdb info for the given label. Called only if LABEL_NAME (insn)
1646 PUT_SDB_DEF (LABEL_NAME (insn
));
1648 PUT_SDB_SCL (C_LABEL
);
1649 PUT_SDB_TYPE (T_NULL
);
1653 /* Change to reading from a new source file. */
1656 sdbout_start_new_source_file (filename
)
1657 char *filename ATTRIBUTE_UNUSED
;
1659 #ifdef MIPS_DEBUGGING_INFO
1660 struct sdb_file
*n
= (struct sdb_file
*) xmalloc (sizeof *n
);
1662 n
->next
= current_file
;
1665 PUT_SDB_SRC_FILE (filename
);
1669 /* Revert to reading a previous source file. */
1672 sdbout_resume_previous_source_file ()
1674 #ifdef MIPS_DEBUGGING_INFO
1675 struct sdb_file
*next
;
1677 next
= current_file
->next
;
1678 free (current_file
);
1679 current_file
= next
;
1680 PUT_SDB_SRC_FILE (current_file
->name
);
1684 #endif /* SDB_DEBUGGING_INFO */