]> gcc.gnu.org Git - gcc.git/blame - gcc/sdbout.c
install.texi: Remove i386-*-isc, i860-*-bsd, m68k-altos-sysv, m68k-isi-bsd, m68k...
[gcc.git] / gcc / sdbout.c
CommitLineData
37ba3390 1/* Output sdb-format symbol table information from GNU compiler.
c913b6f1 2 Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
cf403648 3 2000, 2001, 2002 Free Software Foundation, Inc.
37ba3390 4
1322177d 5This file is part of GCC.
37ba3390 6
1322177d
LB
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 2, or (at your option) any later
10version.
37ba3390 11
1322177d
LB
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
37ba3390
RS
16
17You should have received a copy of the GNU General Public License
1322177d
LB
18along with GCC; see the file COPYING. If not, write to the Free
19Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2002111-1307, USA. */
37ba3390
RS
21
22/* mike@tredysvr.Tredydev.Unisys.COM says:
23I modified the struct.c example and have a nm of a .o resulting from the
24AT&T C compiler. From the example below I would conclude the following:
25
261. All .defs from structures are emitted as scanned. The example below
27 clearly shows the symbol table entries for BoxRec2 are after the first
28 function.
29
302. All functions and their locals (including statics) are emitted as scanned.
31
323. 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.
35
364. All structure .defs are emitted before the typedefs that refer to them.
37
385. All top level static and external variable definitions are moved to the
6dc42e49 39 end of file with all top level statics occurring first before externs.
37ba3390
RS
40
416. All undefined references are at the end of the file.
42*/
43
44#include "config.h"
e2500fed 45#include "system.h"
4977bab6
ZW
46#include "coretypes.h"
47#include "tm.h"
e2500fed
GK
48#include "debug.h"
49#include "tree.h"
50#include "ggc.h"
51
52static GTY(()) tree anonymous_types;
37ba3390
RS
53
54#ifdef SDB_DEBUGGING_INFO
55
37ba3390 56#include "rtl.h"
37ba3390
RS
57#include "regs.h"
58#include "flags.h"
59#include "insn-config.h"
60#include "reload.h"
e016950d
KG
61#include "output.h"
62#include "toplev.h"
d0af450d 63#include "tm_p.h"
37ba3390 64#include "gsyms.h"
43577e6b 65#include "langhooks.h"
4977bab6 66#include "target.h"
37ba3390
RS
67
68/* 1 if PARM is passed to this function in memory. */
69
70#define PARM_PASSED_IN_MEMORY(PARM) \
71 (GET_CODE (DECL_INCOMING_RTL (PARM)) == MEM)
72
73/* A C expression for the integer offset value of an automatic variable
74 (C_AUTO) having address X (an RTX). */
75#ifndef DEBUGGER_AUTO_OFFSET
76#define DEBUGGER_AUTO_OFFSET(X) \
77 (GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0)
78#endif
79
80/* A C expression for the integer offset value of an argument (C_ARG)
81 having address X (an RTX). The nominal offset is OFFSET. */
82#ifndef DEBUGGER_ARG_OFFSET
83#define DEBUGGER_ARG_OFFSET(OFFSET, X) (OFFSET)
84#endif
85
86/* Line number of beginning of current function, minus one.
87 Negative means not in a function or not using sdb. */
88
f4dc8d96 89int sdb_begin_function_line = -1;
37ba3390
RS
90
91/* Counter to generate unique "names" for nameless struct members. */
92
93static int unnamed_struct_number = 0;
94
95extern FILE *asm_out_file;
96
97extern tree current_function_decl;
98
76ead72b 99#include "sdbout.h"
37ba3390 100
e2a12aca 101static void sdbout_init PARAMS ((const char *));
3914abb4 102static void sdbout_finish PARAMS ((const char *));
5197bd50
RK
103static void sdbout_start_source_file PARAMS ((unsigned int, const char *));
104static void sdbout_end_source_file PARAMS ((unsigned int));
105static void sdbout_begin_block PARAMS ((unsigned int, unsigned int));
106static void sdbout_end_block PARAMS ((unsigned int, unsigned int));
653e276c 107static void sdbout_source_line PARAMS ((unsigned int, const char *));
702ada3d 108static void sdbout_end_epilogue PARAMS ((unsigned int, const char *));
2b85879e 109static void sdbout_global_decl PARAMS ((tree));
653e276c
NB
110#ifndef MIPS_DEBUGGING_INFO
111static void sdbout_begin_prologue PARAMS ((unsigned int, const char *));
112#endif
702ada3d 113static void sdbout_end_prologue PARAMS ((unsigned int, const char *));
653e276c 114static void sdbout_begin_function PARAMS ((tree));
e2a12aca 115static void sdbout_end_function PARAMS ((unsigned int));
e1772ac0
NB
116static void sdbout_toplevel_data PARAMS ((tree));
117static void sdbout_label PARAMS ((rtx));
cdadb1dd
KG
118static char *gen_fake_label PARAMS ((void));
119static int plain_type PARAMS ((tree));
120static int template_name_p PARAMS ((tree));
121static void sdbout_record_type_name PARAMS ((tree));
122static int plain_type_1 PARAMS ((tree, int));
123static void sdbout_block PARAMS ((tree));
124static void sdbout_syms PARAMS ((tree));
7bdb32b9 125#ifdef SDB_ALLOW_FORWARD_REFERENCES
cdadb1dd
KG
126static void sdbout_queue_anonymous_type PARAMS ((tree));
127static void sdbout_dequeue_anonymous_types PARAMS ((void));
7bdb32b9 128#endif
cdadb1dd
KG
129static void sdbout_type PARAMS ((tree));
130static void sdbout_field_types PARAMS ((tree));
131static void sdbout_one_type PARAMS ((tree));
132static void sdbout_parms PARAMS ((tree));
133static void sdbout_reg_parms PARAMS ((tree));
3914abb4 134static void sdbout_global_decl PARAMS ((tree));
37ba3390 135\f
37ba3390
RS
136/* Random macros describing parts of SDB data. */
137
138/* Put something here if lines get too long */
139#define CONTIN
140
141/* Default value of delimiter is ";". */
142#ifndef SDB_DELIM
143#define SDB_DELIM ";"
144#endif
145
146/* Maximum number of dimensions the assembler will allow. */
147#ifndef SDB_MAX_DIM
148#define SDB_MAX_DIM 4
149#endif
150
151#ifndef PUT_SDB_SCL
152#define PUT_SDB_SCL(a) fprintf(asm_out_file, "\t.scl\t%d%s", (a), SDB_DELIM)
153#endif
154
155#ifndef PUT_SDB_INT_VAL
e016950d
KG
156#define PUT_SDB_INT_VAL(a) \
157 do { \
158 fputs ("\t.val\t", asm_out_file); \
cf403648 159 fprintf (asm_out_file, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) (a)); \
e016950d
KG
160 fprintf (asm_out_file, "%s", SDB_DELIM); \
161 } while (0)
162
37ba3390
RS
163#endif
164
165#ifndef PUT_SDB_VAL
166#define PUT_SDB_VAL(a) \
167( fputs ("\t.val\t", asm_out_file), \
168 output_addr_const (asm_out_file, (a)), \
169 fprintf (asm_out_file, SDB_DELIM))
170#endif
171
172#ifndef PUT_SDB_DEF
173#define PUT_SDB_DEF(a) \
174do { fprintf (asm_out_file, "\t.def\t"); \
800a6a0c 175 assemble_name (asm_out_file, a); \
37ba3390
RS
176 fprintf (asm_out_file, SDB_DELIM); } while (0)
177#endif
178
179#ifndef PUT_SDB_PLAIN_DEF
180#define PUT_SDB_PLAIN_DEF(a) fprintf(asm_out_file,"\t.def\t.%s%s",a, SDB_DELIM)
181#endif
182
183#ifndef PUT_SDB_ENDEF
184#define PUT_SDB_ENDEF fputs("\t.endef\n", asm_out_file)
185#endif
186
187#ifndef PUT_SDB_TYPE
188#define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\t.type\t0%o%s", a, SDB_DELIM)
189#endif
190
191#ifndef PUT_SDB_SIZE
e016950d
KG
192#define PUT_SDB_SIZE(a) \
193 do { \
194 fputs ("\t.size\t", asm_out_file); \
cf403648 195 fprintf (asm_out_file, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) (a)); \
e016950d
KG
196 fprintf (asm_out_file, "%s", SDB_DELIM); \
197 } while(0)
37ba3390
RS
198#endif
199
200#ifndef PUT_SDB_START_DIM
201#define PUT_SDB_START_DIM fprintf(asm_out_file, "\t.dim\t")
202#endif
203
204#ifndef PUT_SDB_NEXT_DIM
205#define PUT_SDB_NEXT_DIM(a) fprintf(asm_out_file, "%d,", a)
206#endif
207
208#ifndef PUT_SDB_LAST_DIM
209#define PUT_SDB_LAST_DIM(a) fprintf(asm_out_file, "%d%s", a, SDB_DELIM)
210#endif
211
212#ifndef PUT_SDB_TAG
213#define PUT_SDB_TAG(a) \
214do { fprintf (asm_out_file, "\t.tag\t"); \
800a6a0c 215 assemble_name (asm_out_file, a); \
37ba3390
RS
216 fprintf (asm_out_file, SDB_DELIM); } while (0)
217#endif
218
219#ifndef PUT_SDB_BLOCK_START
220#define PUT_SDB_BLOCK_START(LINE) \
221 fprintf (asm_out_file, \
222 "\t.def\t.bb%s\t.val\t.%s\t.scl\t100%s\t.line\t%d%s\t.endef\n", \
223 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
224#endif
225
226#ifndef PUT_SDB_BLOCK_END
227#define PUT_SDB_BLOCK_END(LINE) \
228 fprintf (asm_out_file, \
229 "\t.def\t.eb%s\t.val\t.%s\t.scl\t100%s\t.line\t%d%s\t.endef\n", \
230 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
231#endif
232
233#ifndef PUT_SDB_FUNCTION_START
234#define PUT_SDB_FUNCTION_START(LINE) \
235 fprintf (asm_out_file, \
236 "\t.def\t.bf%s\t.val\t.%s\t.scl\t101%s\t.line\t%d%s\t.endef\n", \
237 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
238#endif
239
240#ifndef PUT_SDB_FUNCTION_END
241#define PUT_SDB_FUNCTION_END(LINE) \
242 fprintf (asm_out_file, \
243 "\t.def\t.ef%s\t.val\t.%s\t.scl\t101%s\t.line\t%d%s\t.endef\n", \
244 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
245#endif
246
37ba3390
RS
247#ifndef SDB_GENERATE_FAKE
248#define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
249 sprintf ((BUFFER), ".%dfake", (NUMBER));
250#endif
251
252/* Return the sdb tag identifier string for TYPE
6d2f8887 253 if TYPE has already been defined; otherwise return a null pointer. */
37ba3390 254
6fb2e346 255#define KNOWN_TYPE_TAG(type) TYPE_SYMTAB_POINTER (type)
37ba3390
RS
256
257/* Set the sdb tag identifier string for TYPE to NAME. */
258
259#define SET_KNOWN_TYPE_TAG(TYPE, NAME) \
6fb2e346 260 TYPE_SYMTAB_POINTER (TYPE) = (NAME)
37ba3390
RS
261
262/* Return the name (a string) of the struct, union or enum tag
263 described by the TREE_LIST node LINK. This is 0 for an anonymous one. */
264
265#define TAG_NAME(link) \
266 (((link) && TREE_PURPOSE ((link)) \
267 && IDENTIFIER_POINTER (TREE_PURPOSE ((link)))) \
268 ? IDENTIFIER_POINTER (TREE_PURPOSE ((link))) : (char *) 0)
269
270/* Ensure we don't output a negative line number. */
271#define MAKE_LINE_SAFE(line) \
5197bd50
RK
272 if ((int) line <= sdb_begin_function_line) \
273 line = sdb_begin_function_line + 1
cc694a81
DE
274
275/* Perform linker optimization of merging header file definitions together
276 for targets with MIPS_DEBUGGING_INFO defined. This won't work without a
277 post 960826 version of GAS. Nothing breaks with earlier versions of GAS,
278 the optimization just won't be done. The native assembler already has the
279 necessary support. */
280
281#ifdef MIPS_DEBUGGING_INFO
282
283#ifndef PUT_SDB_SRC_FILE
284#define PUT_SDB_SRC_FILE(FILENAME) \
285output_file_directive (asm_out_file, (FILENAME))
286#endif
287
288/* ECOFF linkers have an optimization that does the same kind of thing as
289 N_BINCL/E_INCL in stabs: eliminate duplicate debug information in the
290 executable. To achieve this, GCC must output a .file for each file
291 name change. */
292
293/* This is a stack of input files. */
294
295struct sdb_file
296{
297 struct sdb_file *next;
df07dc5b 298 const char *name;
cc694a81
DE
299};
300
301/* This is the top of the stack. */
302
303static struct sdb_file *current_file;
304
305#endif /* MIPS_DEBUGGING_INFO */
37ba3390 306\f
7f905405 307/* The debug hooks structure. */
54b6670a 308const struct gcc_debug_hooks sdb_debug_hooks =
a51d908e 309{
3914abb4
NB
310 sdbout_init, /* init */
311 sdbout_finish, /* finish */
312 debug_nothing_int_charstar, /* define */
313 debug_nothing_int_charstar, /* undef */
314 sdbout_start_source_file, /* start_source_file */
315 sdbout_end_source_file, /* end_source_file */
316 sdbout_begin_block, /* begin_block */
317 sdbout_end_block, /* end_block */
e1772ac0 318 debug_true_tree, /* ignore_block */
3914abb4 319 sdbout_source_line, /* source_line */
653e276c
NB
320#ifdef MIPS_DEBUGGING_INFO
321 /* Defer on MIPS systems so that parameter descriptions follow
322 function entry. */
323 debug_nothing_int_charstar, /* begin_prologue */
324 sdbout_end_prologue, /* end_prologue */
325#else
326 sdbout_begin_prologue, /* begin_prologue */
702ada3d 327 debug_nothing_int_charstar, /* end_prologue */
653e276c 328#endif
3914abb4
NB
329 sdbout_end_epilogue, /* end_epilogue */
330 sdbout_begin_function, /* begin_function */
331 sdbout_end_function, /* end_function */
2b85879e 332 debug_nothing_tree, /* function_decl */
3914abb4 333 sdbout_global_decl, /* global_decl */
e1772ac0
NB
334 debug_nothing_tree, /* deferred_inline_function */
335 debug_nothing_tree, /* outlining_inline_function */
336 sdbout_label
a51d908e
NB
337};
338\f
37ba3390
RS
339#if 0
340
341/* return the tag identifier for type
342 */
343
344char *
345tag_of_ru_type (type,link)
346 tree type,link;
347{
348 if (TYPE_SYMTAB_ADDRESS (type))
6fb2e346 349 return TYPE_SYMTAB_ADDRESS (type);
37ba3390
RS
350 if (link && TREE_PURPOSE (link)
351 && IDENTIFIER_POINTER (TREE_PURPOSE (link)))
6fb2e346 352 TYPE_SYMTAB_ADDRESS (type) = IDENTIFIER_POINTER (TREE_PURPOSE (link));
37ba3390
RS
353 else
354 return (char *) TYPE_SYMTAB_ADDRESS (type);
355}
356#endif
357
358/* Return a unique string to name an anonymous type. */
359
360static char *
361gen_fake_label ()
362{
363 char label[10];
364 char *labelstr;
365 SDB_GENERATE_FAKE (label, unnamed_struct_number);
366 unnamed_struct_number++;
6d9f628e 367 labelstr = xstrdup (label);
37ba3390
RS
368 return labelstr;
369}
370\f
371/* Return the number which describes TYPE for SDB.
372 For pointers, etc., this function is recursive.
373 Each record, union or enumeral type must already have had a
374 tag number output. */
375
376/* The number is given by d6d5d4d3d2d1bbbb
377 where bbbb is 4 bit basic type, and di indicate one of notype,ptr,fn,array.
378 Thus, char *foo () has bbbb=T_CHAR
379 d1=D_FCN
380 d2=D_PTR
381 N_BTMASK= 017 1111 basic type field.
382 N_TSHIFT= 2 derived type shift
383 N_BTSHFT= 4 Basic type shift */
384
385/* Produce the number that describes a pointer, function or array type.
386 PREV is the number describing the target, value or element type.
387 DT_type describes how to transform that type. */
aa7a5913 388#define PUSH_DERIVED_LEVEL(DT_type,PREV) \
cf403648
KH
389 ((((PREV) & ~(int) N_BTMASK) << (int) N_TSHIFT) \
390 | ((int) DT_type << (int) N_BTSHFT) \
391 | ((PREV) & (int) N_BTMASK))
37ba3390
RS
392
393/* Number of elements used in sdb_dims. */
394static int sdb_n_dims = 0;
395
396/* Table of array dimensions of current type. */
397static int sdb_dims[SDB_MAX_DIM];
398
399/* Size of outermost array currently being processed. */
400static int sdb_type_size = -1;
401
402static int
403plain_type (type)
404 tree type;
405{
1a625283 406 int val = plain_type_1 (type, 0);
37ba3390
RS
407
408 /* If we have already saved up some array dimensions, print them now. */
409 if (sdb_n_dims > 0)
410 {
411 int i;
412 PUT_SDB_START_DIM;
413 for (i = sdb_n_dims - 1; i > 0; i--)
414 PUT_SDB_NEXT_DIM (sdb_dims[i]);
415 PUT_SDB_LAST_DIM (sdb_dims[0]);
416 sdb_n_dims = 0;
417
418 sdb_type_size = int_size_in_bytes (type);
419 /* Don't kill sdb if type is not laid out or has variable size. */
420 if (sdb_type_size < 0)
421 sdb_type_size = 0;
422 }
423 /* If we have computed the size of an array containing this type,
424 print it now. */
425 if (sdb_type_size >= 0)
426 {
427 PUT_SDB_SIZE (sdb_type_size);
428 sdb_type_size = -1;
429 }
430 return val;
431}
432
4be2397b
RS
433static int
434template_name_p (name)
435 tree name;
436{
b3694847 437 const char *ptr = IDENTIFIER_POINTER (name);
4be2397b
RS
438 while (*ptr && *ptr != '<')
439 ptr++;
440
441 return *ptr != '\0';
442}
443
37ba3390
RS
444static void
445sdbout_record_type_name (type)
446 tree type;
447{
bb93b973 448 const char *name = 0;
37ba3390
RS
449 int no_name;
450
451 if (KNOWN_TYPE_TAG (type))
452 return;
453
454 if (TYPE_NAME (type) != 0)
455 {
456 tree t = 0;
bb93b973 457
37ba3390
RS
458 /* Find the IDENTIFIER_NODE for the type name. */
459 if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
95b2ff8b 460 t = TYPE_NAME (type);
12357e42 461 else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL)
37ba3390
RS
462 {
463 t = DECL_NAME (TYPE_NAME (type));
4be2397b
RS
464 /* The DECL_NAME for templates includes "<>", which breaks
465 most assemblers. Use its assembler name instead, which
466 has been mangled into being safe. */
467 if (t && template_name_p (t))
468 t = DECL_ASSEMBLER_NAME (TYPE_NAME (type));
37ba3390 469 }
37ba3390
RS
470
471 /* Now get the name as a string, or invent one. */
4be2397b 472 if (t != NULL_TREE)
37ba3390
RS
473 name = IDENTIFIER_POINTER (t);
474 }
475
476 no_name = (name == 0 || *name == 0);
477 if (no_name)
478 name = gen_fake_label ();
479
480 SET_KNOWN_TYPE_TAG (type, name);
481#ifdef SDB_ALLOW_FORWARD_REFERENCES
482 if (no_name)
483 sdbout_queue_anonymous_type (type);
484#endif
485}
486
1a625283
JW
487/* Return the .type value for type TYPE.
488
489 LEVEL indicates how many levels deep we have recursed into the type.
490 The SDB debug format can only represent 6 derived levels of types.
491 After that, we must output inaccurate debug info. We deliberately
492 stop before the 7th level, so that ADA recursive types will not give an
493 infinite loop. */
494
37ba3390 495static int
1a625283 496plain_type_1 (type, level)
37ba3390 497 tree type;
1a625283 498 int level;
37ba3390
RS
499{
500 if (type == 0)
501 type = void_type_node;
1a625283 502 else if (type == error_mark_node)
37ba3390 503 type = integer_type_node;
1a625283
JW
504 else
505 type = TYPE_MAIN_VARIANT (type);
37ba3390
RS
506
507 switch (TREE_CODE (type))
508 {
509 case VOID_TYPE:
510 return T_VOID;
a0587d56 511 case BOOLEAN_TYPE:
37ba3390
RS
512 case INTEGER_TYPE:
513 {
514 int size = int_size_in_bytes (type) * BITS_PER_UNIT;
aed0ae9b
JW
515
516 /* Carefully distinguish all the standard types of C,
517 without messing up if the language is not C.
518 Note that we check only for the names that contain spaces;
519 other names might occur by coincidence in other languages. */
520 if (TYPE_NAME (type) != 0
521 && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
522 && DECL_NAME (TYPE_NAME (type)) != 0
523 && TREE_CODE (DECL_NAME (TYPE_NAME (type))) == IDENTIFIER_NODE)
524 {
83182544 525 const char *const name
ebb13e7e 526 = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
aed0ae9b 527
c85f7c16
JL
528 if (!strcmp (name, "char"))
529 return T_CHAR;
aed0ae9b
JW
530 if (!strcmp (name, "unsigned char"))
531 return T_UCHAR;
532 if (!strcmp (name, "signed char"))
533 return T_CHAR;
c85f7c16
JL
534 if (!strcmp (name, "int"))
535 return T_INT;
aed0ae9b
JW
536 if (!strcmp (name, "unsigned int"))
537 return T_UINT;
538 if (!strcmp (name, "short int"))
539 return T_SHORT;
540 if (!strcmp (name, "short unsigned int"))
541 return T_USHORT;
542 if (!strcmp (name, "long int"))
543 return T_LONG;
544 if (!strcmp (name, "long unsigned int"))
545 return T_ULONG;
546 }
547
c85f7c16
JL
548 if (size == INT_TYPE_SIZE)
549 return (TREE_UNSIGNED (type) ? T_UINT : T_INT);
37ba3390
RS
550 if (size == CHAR_TYPE_SIZE)
551 return (TREE_UNSIGNED (type) ? T_UCHAR : T_CHAR);
552 if (size == SHORT_TYPE_SIZE)
553 return (TREE_UNSIGNED (type) ? T_USHORT : T_SHORT);
580b8ee2
RS
554 if (size == LONG_TYPE_SIZE)
555 return (TREE_UNSIGNED (type) ? T_ULONG : T_LONG);
7726fc45
RK
556 if (size == LONG_LONG_TYPE_SIZE) /* better than nothing */
557 return (TREE_UNSIGNED (type) ? T_ULONG : T_LONG);
37ba3390
RS
558 return 0;
559 }
560
561 case REAL_TYPE:
562 {
64c6526a
JW
563 int precision = TYPE_PRECISION (type);
564 if (precision == FLOAT_TYPE_SIZE)
37ba3390 565 return T_FLOAT;
64c6526a 566 if (precision == DOUBLE_TYPE_SIZE)
37ba3390 567 return T_DOUBLE;
64c6526a
JW
568#ifdef EXTENDED_SDB_BASIC_TYPES
569 if (precision == LONG_DOUBLE_TYPE_SIZE)
570 return T_LNGDBL;
e5e809f4
JL
571#else
572 if (precision == LONG_DOUBLE_TYPE_SIZE)
573 return T_DOUBLE; /* better than nothing */
64c6526a 574#endif
37ba3390
RS
575 return 0;
576 }
577
578 case ARRAY_TYPE:
579 {
580 int m;
1a625283
JW
581 if (level >= 6)
582 return T_VOID;
583 else
584 m = plain_type_1 (TREE_TYPE (type), level+1);
37ba3390
RS
585 if (sdb_n_dims < SDB_MAX_DIM)
586 sdb_dims[sdb_n_dims++]
587 = (TYPE_DOMAIN (type)
665f2503
RK
588 && TYPE_MIN_VALUE (TYPE_DOMAIN (type)) != 0
589 && TYPE_MAX_VALUE (TYPE_DOMAIN (type)) != 0
590 && host_integerp (TYPE_MAX_VALUE (TYPE_DOMAIN (type)), 0)
591 && host_integerp (TYPE_MIN_VALUE (TYPE_DOMAIN (type)), 0)
592 ? (tree_low_cst (TYPE_MAX_VALUE (TYPE_DOMAIN (type)), 0)
593 - tree_low_cst (TYPE_MIN_VALUE (TYPE_DOMAIN (type)), 0) + 1)
37ba3390 594 : 0);
665f2503 595
37ba3390
RS
596 return PUSH_DERIVED_LEVEL (DT_ARY, m);
597 }
598
599 case RECORD_TYPE:
600 case UNION_TYPE:
c1b98a95 601 case QUAL_UNION_TYPE:
37ba3390
RS
602 case ENUMERAL_TYPE:
603 {
604 char *tag;
605#ifdef SDB_ALLOW_FORWARD_REFERENCES
606 sdbout_record_type_name (type);
607#endif
608#ifndef SDB_ALLOW_UNKNOWN_REFERENCES
609 if ((TREE_ASM_WRITTEN (type) && KNOWN_TYPE_TAG (type) != 0)
610#ifdef SDB_ALLOW_FORWARD_REFERENCES
611 || TYPE_MODE (type) != VOIDmode
612#endif
613 )
614#endif
615 {
616 /* Output the referenced structure tag name
617 only if the .def has already been finished.
618 At least on 386, the Unix assembler
619 cannot handle forward references to tags. */
0f41302f
MS
620 /* But the 88100, it requires them, sigh... */
621 /* And the MIPS requires unknown refs as well... */
37ba3390
RS
622 tag = KNOWN_TYPE_TAG (type);
623 PUT_SDB_TAG (tag);
624 /* These 3 lines used to follow the close brace.
625 However, a size of 0 without a tag implies a tag of 0,
626 so if we don't know a tag, we can't mention the size. */
627 sdb_type_size = int_size_in_bytes (type);
628 if (sdb_type_size < 0)
629 sdb_type_size = 0;
630 }
631 return ((TREE_CODE (type) == RECORD_TYPE) ? T_STRUCT
632 : (TREE_CODE (type) == UNION_TYPE) ? T_UNION
c1b98a95 633 : (TREE_CODE (type) == QUAL_UNION_TYPE) ? T_UNION
37ba3390
RS
634 : T_ENUM);
635 }
636 case POINTER_TYPE:
637 case REFERENCE_TYPE:
638 {
1a625283
JW
639 int m;
640 if (level >= 6)
641 return T_VOID;
642 else
643 m = plain_type_1 (TREE_TYPE (type), level+1);
37ba3390
RS
644 return PUSH_DERIVED_LEVEL (DT_PTR, m);
645 }
646 case FUNCTION_TYPE:
647 case METHOD_TYPE:
648 {
1a625283
JW
649 int m;
650 if (level >= 6)
651 return T_VOID;
652 else
653 m = plain_type_1 (TREE_TYPE (type), level+1);
37ba3390
RS
654 return PUSH_DERIVED_LEVEL (DT_FCN, m);
655 }
656 default:
657 return 0;
658 }
659}
660\f
661/* Output the symbols defined in block number DO_BLOCK.
37ba3390
RS
662
663 This function works by walking the tree structure of blocks,
664 counting blocks until it finds the desired block. */
665
666static int do_block = 0;
667
37ba3390
RS
668static void
669sdbout_block (block)
b3694847 670 tree block;
37ba3390
RS
671{
672 while (block)
673 {
674 /* Ignore blocks never expanded or otherwise marked as real. */
675 if (TREE_USED (block))
676 {
677 /* When we reach the specified block, output its symbols. */
18c038b9
MM
678 if (BLOCK_NUMBER (block) == do_block)
679 sdbout_syms (BLOCK_VARS (block));
37ba3390
RS
680
681 /* If we are past the specified block, stop the scan. */
18c038b9 682 if (BLOCK_NUMBER (block) > do_block)
37ba3390
RS
683 return;
684
37ba3390
RS
685 /* Scan the blocks within this block. */
686 sdbout_block (BLOCK_SUBBLOCKS (block));
687 }
688
689 block = BLOCK_CHAIN (block);
690 }
691}
692\f
693/* Call sdbout_symbol on each decl in the chain SYMS. */
694
695static void
696sdbout_syms (syms)
697 tree syms;
698{
699 while (syms)
700 {
5b7f1820
RS
701 if (TREE_CODE (syms) != LABEL_DECL)
702 sdbout_symbol (syms, 1);
37ba3390
RS
703 syms = TREE_CHAIN (syms);
704 }
705}
706
707/* Output SDB information for a symbol described by DECL.
708 LOCAL is nonzero if the symbol is not file-scope. */
709
710void
711sdbout_symbol (decl, local)
712 tree decl;
713 int local;
714{
37ba3390
RS
715 tree type = TREE_TYPE (decl);
716 tree context = NULL_TREE;
717 rtx value;
718 int regno = -1;
ebb13e7e 719 const char *name;
37ba3390 720
16d90796
RS
721 sdbout_one_type (type);
722
723#if 0 /* This loses when functions are marked to be ignored,
724 which happens in the C++ front end. */
5e32e83b
RS
725 if (DECL_IGNORED_P (decl))
726 return;
16d90796 727#endif
37ba3390
RS
728
729 switch (TREE_CODE (decl))
730 {
731 case CONST_DECL:
732 /* Enum values are defined by defining the enum type. */
733 return;
734
735 case FUNCTION_DECL:
736 /* Don't mention a nested function under its parent. */
737 context = decl_function_context (decl);
738 if (context == current_function_decl)
739 return;
b01a1fdb
JW
740 /* Check DECL_INITIAL to distinguish declarations from definitions.
741 Don't output debug info here for declarations; they will have
742 a DECL_INITIAL value of 0. */
743 if (! DECL_INITIAL (decl))
37ba3390
RS
744 return;
745 if (GET_CODE (DECL_RTL (decl)) != MEM
746 || GET_CODE (XEXP (DECL_RTL (decl), 0)) != SYMBOL_REF)
747 return;
748 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
749 PUT_SDB_VAL (XEXP (DECL_RTL (decl), 0));
750 PUT_SDB_SCL (TREE_PUBLIC (decl) ? C_EXT : C_STAT);
751 break;
752
753 case TYPE_DECL:
754 /* Done with tagged types. */
755 if (DECL_NAME (decl) == 0)
756 return;
16d90796
RS
757 if (DECL_IGNORED_P (decl))
758 return;
37ba3390
RS
759
760 /* Output typedef name. */
4be2397b
RS
761 if (template_name_p (DECL_NAME (decl)))
762 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
763 else
764 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_NAME (decl)));
37ba3390
RS
765 PUT_SDB_SCL (C_TPDEF);
766 break;
767
768 case PARM_DECL:
769 /* Parm decls go in their own separate chains
770 and are output by sdbout_reg_parms and sdbout_parms. */
771 abort ();
772
773 case VAR_DECL:
774 /* Don't mention a variable that is external.
775 Let the file that defines it describe it. */
216d5cdd 776 if (DECL_EXTERNAL (decl))
37ba3390
RS
777 return;
778
16d90796
RS
779 /* Ignore __FUNCTION__, etc. */
780 if (DECL_IGNORED_P (decl))
781 return;
782
37ba3390
RS
783 /* If there was an error in the declaration, don't dump core
784 if there is no RTL associated with the variable doesn't
785 exist. */
d975d8c3 786 if (!DECL_RTL_SET_P (decl))
37ba3390
RS
787 return;
788
786de7eb 789 SET_DECL_RTL (decl,
d975d8c3 790 eliminate_regs (DECL_RTL (decl), 0, NULL_RTX));
bf1e8c4d 791#ifdef LEAF_REG_REMAP
54ff41b7 792 if (current_function_uses_only_leaf_regs)
bf1e8c4d
RS
793 leaf_renumber_regs_insn (DECL_RTL (decl));
794#endif
795 value = DECL_RTL (decl);
37ba3390
RS
796
797 /* Don't mention a variable at all
798 if it was completely optimized into nothingness.
799
800 If DECL was from an inline function, then its rtl
801 is not identically the rtl that was used in this
802 particular compilation. */
803 if (GET_CODE (value) == REG)
804 {
69deb6e0 805 regno = REGNO (value);
37ba3390 806 if (regno >= FIRST_PSEUDO_REGISTER)
37ba3390
RS
807 return;
808 }
bf1e8c4d 809 else if (GET_CODE (value) == SUBREG)
37ba3390 810 {
37ba3390 811 while (GET_CODE (value) == SUBREG)
ddef6bc7 812 value = SUBREG_REG (value);
37ba3390
RS
813 if (GET_CODE (value) == REG)
814 {
ddef6bc7 815 if (REGNO (value) >= FIRST_PSEUDO_REGISTER)
bf1e8c4d 816 return;
37ba3390 817 }
69deb6e0
RK
818 regno = REGNO (alter_subreg (&value));
819 SET_DECL_RTL (decl, value);
37ba3390 820 }
39eae9f4
RS
821 /* Don't output anything if an auto variable
822 gets RTL that is static.
823 GAS version 2.2 can't handle such output. */
824 else if (GET_CODE (value) == MEM && CONSTANT_P (XEXP (value, 0))
825 && ! TREE_STATIC (decl))
826 return;
37ba3390
RS
827
828 /* Emit any structure, union, or enum type that has not been output.
829 This occurs for tag-less structs (et al) used to declare variables
830 within functions. */
831 if (TREE_CODE (type) == ENUMERAL_TYPE
832 || TREE_CODE (type) == RECORD_TYPE
c1b98a95
RK
833 || TREE_CODE (type) == UNION_TYPE
834 || TREE_CODE (type) == QUAL_UNION_TYPE)
37ba3390 835 {
d0f062fb 836 if (COMPLETE_TYPE_P (type) /* not a forward reference */
37ba3390
RS
837 && KNOWN_TYPE_TAG (type) == 0) /* not yet declared */
838 sdbout_one_type (type);
839 }
840
841 /* Defer SDB information for top-level initialized variables! */
842 if (! local
843 && GET_CODE (value) == MEM
844 && DECL_INITIAL (decl))
845 return;
846
ed5f8355
RS
847 /* C++ in 2.3 makes nameless symbols. That will be fixed later.
848 For now, avoid crashing. */
849 if (DECL_NAME (decl) == NULL_TREE)
850 return;
851
37ba3390 852 /* Record the name for, starting a symtab entry. */
4eadbbd5
RK
853 if (local)
854 name = IDENTIFIER_POINTER (DECL_NAME (decl));
855 else
856 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
37ba3390
RS
857
858 if (GET_CODE (value) == MEM
859 && GET_CODE (XEXP (value, 0)) == SYMBOL_REF)
860 {
861 PUT_SDB_DEF (name);
862 if (TREE_PUBLIC (decl))
863 {
864 PUT_SDB_VAL (XEXP (value, 0));
786de7eb 865 PUT_SDB_SCL (C_EXT);
37ba3390
RS
866 }
867 else
868 {
869 PUT_SDB_VAL (XEXP (value, 0));
786de7eb 870 PUT_SDB_SCL (C_STAT);
37ba3390
RS
871 }
872 }
873 else if (regno >= 0)
874 {
875 PUT_SDB_DEF (name);
876 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (regno));
877 PUT_SDB_SCL (C_REG);
878 }
879 else if (GET_CODE (value) == MEM
880 && (GET_CODE (XEXP (value, 0)) == MEM
881 || (GET_CODE (XEXP (value, 0)) == REG
d8a0edf4 882 && REGNO (XEXP (value, 0)) != HARD_FRAME_POINTER_REGNUM
5b7f1820 883 && REGNO (XEXP (value, 0)) != STACK_POINTER_REGNUM)))
37ba3390
RS
884 /* If the value is indirect by memory or by a register
885 that isn't the frame pointer
886 then it means the object is variable-sized and address through
887 that register or stack slot. COFF has no way to represent this
888 so all we can do is output the variable as a pointer. */
889 {
890 PUT_SDB_DEF (name);
891 if (GET_CODE (XEXP (value, 0)) == REG)
892 {
893 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (XEXP (value, 0))));
894 PUT_SDB_SCL (C_REG);
895 }
896 else
897 {
898 /* DECL_RTL looks like (MEM (MEM (PLUS (REG...)
899 (CONST_INT...)))).
900 We want the value of that CONST_INT. */
901 /* Encore compiler hates a newline in a macro arg, it seems. */
902 PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET
903 (XEXP (XEXP (value, 0), 0)));
904 PUT_SDB_SCL (C_AUTO);
905 }
906
a51a5234
JL
907 /* Effectively do build_pointer_type, but don't cache this type,
908 since it might be temporary whereas the type it points to
909 might have been saved for inlining. */
910 /* Don't use REFERENCE_TYPE because dbx can't handle that. */
911 type = make_node (POINTER_TYPE);
912 TREE_TYPE (type) = TREE_TYPE (decl);
37ba3390
RS
913 }
914 else if (GET_CODE (value) == MEM
6d55e0ab
JW
915 && ((GET_CODE (XEXP (value, 0)) == PLUS
916 && GET_CODE (XEXP (XEXP (value, 0), 0)) == REG
917 && GET_CODE (XEXP (XEXP (value, 0), 1)) == CONST_INT)
918 /* This is for variables which are at offset zero from
919 the frame pointer. This happens on the Alpha.
920 Non-frame pointer registers are excluded above. */
921 || (GET_CODE (XEXP (value, 0)) == REG)))
37ba3390 922 {
6d55e0ab
JW
923 /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...)))
924 or (MEM (REG...)). We want the value of that CONST_INT
925 or zero. */
37ba3390
RS
926 PUT_SDB_DEF (name);
927 PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET (XEXP (value, 0)));
928 PUT_SDB_SCL (C_AUTO);
929 }
930 else
931 {
932 /* It is something we don't know how to represent for SDB. */
933 return;
934 }
935 break;
1d300e19
KG
936
937 default:
938 break;
37ba3390
RS
939 }
940 PUT_SDB_TYPE (plain_type (type));
941 PUT_SDB_ENDEF;
942}
943\f
944/* Output SDB information for a top-level initialized variable
945 that has been delayed. */
946
e1772ac0 947static void
37ba3390
RS
948sdbout_toplevel_data (decl)
949 tree decl;
950{
951 tree type = TREE_TYPE (decl);
952
5e32e83b
RS
953 if (DECL_IGNORED_P (decl))
954 return;
955
37ba3390
RS
956 if (! (TREE_CODE (decl) == VAR_DECL
957 && GET_CODE (DECL_RTL (decl)) == MEM
958 && DECL_INITIAL (decl)))
959 abort ();
960
961 PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
962 PUT_SDB_VAL (XEXP (DECL_RTL (decl), 0));
963 if (TREE_PUBLIC (decl))
964 {
965 PUT_SDB_SCL (C_EXT);
966 }
967 else
968 {
969 PUT_SDB_SCL (C_STAT);
970 }
971 PUT_SDB_TYPE (plain_type (type));
972 PUT_SDB_ENDEF;
973}
974\f
975#ifdef SDB_ALLOW_FORWARD_REFERENCES
976
0f41302f 977/* Machinery to record and output anonymous types. */
37ba3390 978
37ba3390
RS
979static void
980sdbout_queue_anonymous_type (type)
981 tree type;
982{
1f8f4a0b 983 anonymous_types = tree_cons (NULL_TREE, type, anonymous_types);
37ba3390
RS
984}
985
986static void
987sdbout_dequeue_anonymous_types ()
988{
b3694847 989 tree types, link;
37ba3390
RS
990
991 while (anonymous_types)
992 {
993 types = nreverse (anonymous_types);
994 anonymous_types = NULL_TREE;
995
996 for (link = types; link; link = TREE_CHAIN (link))
997 {
b3694847 998 tree type = TREE_VALUE (link);
37ba3390 999
c325abbd 1000 if (type && ! TREE_ASM_WRITTEN (type))
37ba3390
RS
1001 sdbout_one_type (type);
1002 }
1003 }
1004}
1005
1006#endif
1007\f
1008/* Given a chain of ..._TYPE nodes, all of which have names,
1009 output definitions of those names, as typedefs. */
1010
1011void
1012sdbout_types (types)
b3694847 1013 tree types;
37ba3390 1014{
b3694847 1015 tree link;
37ba3390
RS
1016
1017 for (link = types; link; link = TREE_CHAIN (link))
1018 sdbout_one_type (link);
1019
1020#ifdef SDB_ALLOW_FORWARD_REFERENCES
1021 sdbout_dequeue_anonymous_types ();
1022#endif
1023}
1024
1025static void
1026sdbout_type (type)
1027 tree type;
1028{
37ba3390
RS
1029 if (type == error_mark_node)
1030 type = integer_type_node;
1031 PUT_SDB_TYPE (plain_type (type));
1032}
1033
1034/* Output types of the fields of type TYPE, if they are structs.
1035
1036 Formerly did not chase through pointer types, since that could be circular.
1037 They must come before TYPE, since forward refs are not allowed.
1038 Now james@bigtex.cactus.org says to try them. */
1039
1040static void
1041sdbout_field_types (type)
1042 tree type;
1043{
1044 tree tail;
e5e809f4 1045
37ba3390 1046 for (tail = TYPE_FIELDS (type); tail; tail = TREE_CHAIN (tail))
1270a9b3
LB
1047 /* This condition should match the one for emitting the actual
1048 members below. */
0dbb7a10 1049 if (TREE_CODE (tail) == FIELD_DECL
1270a9b3
LB
1050 && DECL_NAME (tail)
1051 && DECL_SIZE (tail)
1052 && host_integerp (DECL_SIZE (tail), 1)
1053 && host_integerp (bit_position (tail), 0))
0dbb7a10
JM
1054 {
1055 if (POINTER_TYPE_P (TREE_TYPE (tail)))
1056 sdbout_one_type (TREE_TYPE (TREE_TYPE (tail)));
1057 else
1058 sdbout_one_type (TREE_TYPE (tail));
1059 }
37ba3390
RS
1060}
1061
1062/* Use this to put out the top level defined record and union types
1063 for later reference. If this is a struct with a name, then put that
1064 name out. Other unnamed structs will have .xxfake labels generated so
1065 that they may be referred to later.
1066 The label will be stored in the KNOWN_TYPE_TAG slot of a type.
1067 It may NOT be called recursively. */
1068
1069static void
1070sdbout_one_type (type)
1071 tree type;
1072{
509b12e0
JW
1073 if (current_function_decl != NULL_TREE
1074 && DECL_SECTION_NAME (current_function_decl) != NULL_TREE)
1075 ; /* Don't change section amid function. */
1076 else
1077 text_section ();
37ba3390
RS
1078
1079 switch (TREE_CODE (type))
1080 {
1081 case RECORD_TYPE:
1082 case UNION_TYPE:
c1b98a95 1083 case QUAL_UNION_TYPE:
37ba3390
RS
1084 case ENUMERAL_TYPE:
1085 type = TYPE_MAIN_VARIANT (type);
1086 /* Don't output a type twice. */
1087 if (TREE_ASM_WRITTEN (type))
1088 /* James said test TREE_ASM_BEING_WRITTEN here. */
1089 return;
1090
1091 /* Output nothing if type is not yet defined. */
d0f062fb 1092 if (!COMPLETE_TYPE_P (type))
37ba3390
RS
1093 return;
1094
1095 TREE_ASM_WRITTEN (type) = 1;
1096#if 1
1097 /* This is reputed to cause trouble with the following case,
638e2294 1098 but perhaps checking TYPE_SIZE above will fix it. */
37ba3390
RS
1099
1100 /* Here is a test case:
1101
1102 struct foo {
1103 struct badstr *bbb;
1104 } forwardref;
1105
1106 typedef struct intermediate {
1107 int aaaa;
1108 } intermediate_ref;
1109
1110 typedef struct badstr {
1111 int ccccc;
1112 } badtype; */
1113
1114#if 0
1115 TREE_ASM_BEING_WRITTEN (type) = 1;
1116#endif
1117 /* This change, which ought to make better output,
1118 used to make the COFF assembler unhappy.
1119 Changes involving KNOWN_TYPE_TAG may fix the problem. */
1120 /* Before really doing anything, output types we want to refer to. */
1121 /* Note that in version 1 the following two lines
1122 are not used if forward references are in use. */
1123 if (TREE_CODE (type) != ENUMERAL_TYPE)
1124 sdbout_field_types (type);
1125#if 0
1126 TREE_ASM_WRITTEN (type) = 1;
1127#endif
1128#endif
1129
1130 /* Output a structure type. */
1131 {
1132 int size = int_size_in_bytes (type);
a544cfd2 1133 int member_scl = 0;
37ba3390 1134 tree tem;
5b7f1820 1135 int i, n_baseclasses = 0;
37ba3390
RS
1136
1137 /* Record the type tag, but not in its permanent place just yet. */
1138 sdbout_record_type_name (type);
1139
1140 PUT_SDB_DEF (KNOWN_TYPE_TAG (type));
1141
1142 switch (TREE_CODE (type))
1143 {
1144 case UNION_TYPE:
c1b98a95 1145 case QUAL_UNION_TYPE:
37ba3390
RS
1146 PUT_SDB_SCL (C_UNTAG);
1147 PUT_SDB_TYPE (T_UNION);
1148 member_scl = C_MOU;
1149 break;
1150
1151 case RECORD_TYPE:
1152 PUT_SDB_SCL (C_STRTAG);
1153 PUT_SDB_TYPE (T_STRUCT);
1154 member_scl = C_MOS;
1155 break;
1156
1157 case ENUMERAL_TYPE:
1158 PUT_SDB_SCL (C_ENTAG);
1159 PUT_SDB_TYPE (T_ENUM);
1160 member_scl = C_MOE;
1161 break;
1d300e19
KG
1162
1163 default:
1164 break;
37ba3390
RS
1165 }
1166
1167 PUT_SDB_SIZE (size);
1168 PUT_SDB_ENDEF;
1169
5b7f1820
RS
1170 /* Print out the base class information with fields
1171 named after the types they hold. */
684d9f3b 1172 /* This is only relevant to aggregate types. TYPE_BINFO is used
46fb0d7d
JW
1173 for other purposes in an ENUMERAL_TYPE, so we must exclude that
1174 case. */
1175 if (TREE_CODE (type) != ENUMERAL_TYPE)
5b7f1820 1176 {
46fb0d7d
JW
1177 if (TYPE_BINFO (type)
1178 && TYPE_BINFO_BASETYPES (type))
1179 n_baseclasses = TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (type));
1180 for (i = 0; i < n_baseclasses; i++)
ee3e2d3d 1181 {
46fb0d7d
JW
1182 tree child = TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (type)),
1183 i);
1184 tree child_type = BINFO_TYPE (child);
1185 tree child_type_name;
1186 if (TYPE_NAME (child_type) == 0)
1187 continue;
1188 if (TREE_CODE (TYPE_NAME (child_type)) == IDENTIFIER_NODE)
1189 child_type_name = TYPE_NAME (child_type);
1190 else if (TREE_CODE (TYPE_NAME (child_type)) == TYPE_DECL)
1191 {
1192 child_type_name = DECL_NAME (TYPE_NAME (child_type));
1193 if (child_type_name && template_name_p (child_type_name))
1194 child_type_name
1195 = DECL_ASSEMBLER_NAME (TYPE_NAME (child_type));
1196 }
1197 else
1198 continue;
1199
1200 CONTIN;
1201 PUT_SDB_DEF (IDENTIFIER_POINTER (child_type_name));
665f2503 1202 PUT_SDB_INT_VAL (tree_low_cst (BINFO_OFFSET (child), 0));
46fb0d7d
JW
1203 PUT_SDB_SCL (member_scl);
1204 sdbout_type (BINFO_TYPE (child));
1205 PUT_SDB_ENDEF;
ee3e2d3d 1206 }
5b7f1820
RS
1207 }
1208
37ba3390
RS
1209 /* output the individual fields */
1210
1211 if (TREE_CODE (type) == ENUMERAL_TYPE)
bf5e8d0c
AJ
1212 {
1213 for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
1214 if (host_integerp (TREE_VALUE (tem), 0))
1215 {
1216 PUT_SDB_DEF (IDENTIFIER_POINTER (TREE_PURPOSE (tem)));
1217 PUT_SDB_INT_VAL (tree_low_cst (TREE_VALUE (tem), 0));
1218 PUT_SDB_SCL (C_MOE);
1219 PUT_SDB_TYPE (T_MOE);
1220 PUT_SDB_ENDEF;
1221 }
1222 }
37ba3390
RS
1223 else /* record or union type */
1224 for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
1225 /* Output the name, type, position (in bits), size (in bits)
1226 of each field. */
1227
1228 /* Omit here the nameless fields that are used to skip bits.
1229 Also omit fields with variable size or position.
1230 Also omit non FIELD_DECL nodes that GNU C++ may put here. */
1231 if (TREE_CODE (tem) == FIELD_DECL
1270a9b3
LB
1232 && DECL_NAME (tem)
1233 && DECL_SIZE (tem)
665f2503
RK
1234 && host_integerp (DECL_SIZE (tem), 1)
1235 && host_integerp (bit_position (tem), 0))
37ba3390 1236 {
ebb13e7e 1237 const char *name;
0eb111c2 1238
37ba3390 1239 CONTIN;
4eadbbd5 1240 name = IDENTIFIER_POINTER (DECL_NAME (tem));
0eb111c2 1241 PUT_SDB_DEF (name);
37ba3390
RS
1242 if (DECL_BIT_FIELD_TYPE (tem))
1243 {
665f2503 1244 PUT_SDB_INT_VAL (int_bit_position (tem));
37ba3390
RS
1245 PUT_SDB_SCL (C_FIELD);
1246 sdbout_type (DECL_BIT_FIELD_TYPE (tem));
665f2503 1247 PUT_SDB_SIZE (tree_low_cst (DECL_SIZE (tem), 1));
37ba3390
RS
1248 }
1249 else
1250 {
665f2503 1251 PUT_SDB_INT_VAL (int_bit_position (tem) / BITS_PER_UNIT);
37ba3390
RS
1252 PUT_SDB_SCL (member_scl);
1253 sdbout_type (TREE_TYPE (tem));
1254 }
1255 PUT_SDB_ENDEF;
1256 }
1257 /* output end of a structure,union, or enumeral definition */
1258
1259 PUT_SDB_PLAIN_DEF ("eos");
1260 PUT_SDB_INT_VAL (size);
1261 PUT_SDB_SCL (C_EOS);
1262 PUT_SDB_TAG (KNOWN_TYPE_TAG (type));
1263 PUT_SDB_SIZE (size);
1264 PUT_SDB_ENDEF;
1265 break;
1d300e19
KG
1266
1267 default:
1268 break;
37ba3390
RS
1269 }
1270 }
1271}
1272\f
1273/* The following two functions output definitions of function parameters.
1274 Each parameter gets a definition locating it in the parameter list.
1275 Each parameter that is a register variable gets a second definition
1276 locating it in the register.
1277
1278 Printing or argument lists in gdb uses the definitions that
1279 locate in the parameter list. But reference to the variable in
1280 expressions uses preferentially the definition as a register. */
1281
1282/* Output definitions, referring to storage in the parmlist,
1283 of all the parms in PARMS, which is a chain of PARM_DECL nodes. */
1284
1285static void
1286sdbout_parms (parms)
1287 tree parms;
1288{
1289 for (; parms; parms = TREE_CHAIN (parms))
1290 if (DECL_NAME (parms))
1291 {
1292 int current_sym_value = 0;
ebb13e7e 1293 const char *name = IDENTIFIER_POINTER (DECL_NAME (parms));
37ba3390
RS
1294
1295 if (name == 0 || *name == 0)
1296 name = gen_fake_label ();
1297
1298 /* Perform any necessary register eliminations on the parameter's rtl,
1299 so that the debugging output will be accurate. */
db3cf6fb 1300 DECL_INCOMING_RTL (parms)
1914f5da 1301 = eliminate_regs (DECL_INCOMING_RTL (parms), 0, NULL_RTX);
d975d8c3
MM
1302 SET_DECL_RTL (parms,
1303 eliminate_regs (DECL_RTL (parms), 0, NULL_RTX));
37ba3390
RS
1304
1305 if (PARM_PASSED_IN_MEMORY (parms))
1306 {
1307 rtx addr = XEXP (DECL_INCOMING_RTL (parms), 0);
1308 tree type;
1309
1310 /* ??? Here we assume that the parm address is indexed
1311 off the frame pointer or arg pointer.
1312 If that is not true, we produce meaningless results,
1313 but do not crash. */
1314 if (GET_CODE (addr) == PLUS
1315 && GET_CODE (XEXP (addr, 1)) == CONST_INT)
1316 current_sym_value = INTVAL (XEXP (addr, 1));
1317 else
1318 current_sym_value = 0;
1319
1320 if (GET_CODE (DECL_RTL (parms)) == REG
37ba3390
RS
1321 && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
1322 type = DECL_ARG_TYPE (parms);
1323 else
1324 {
1325 int original_sym_value = current_sym_value;
1326
1327 /* This is the case where the parm is passed as an int or
1328 double and it is converted to a char, short or float
1329 and stored back in the parmlist. In this case, describe
1330 the parm with the variable's declared type, and adjust
1331 the address if the least significant bytes (which we are
1332 using) are not the first ones. */
f76b9db2
ILT
1333 if (BYTES_BIG_ENDIAN
1334 && TREE_TYPE (parms) != DECL_ARG_TYPE (parms))
37ba3390
RS
1335 current_sym_value +=
1336 (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parms)))
1337 - GET_MODE_SIZE (GET_MODE (DECL_RTL (parms))));
f76b9db2 1338
37ba3390
RS
1339 if (GET_CODE (DECL_RTL (parms)) == MEM
1340 && GET_CODE (XEXP (DECL_RTL (parms), 0)) == PLUS
1341 && (GET_CODE (XEXP (XEXP (DECL_RTL (parms), 0), 1))
1342 == CONST_INT)
1343 && (INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1))
1344 == current_sym_value))
1345 type = TREE_TYPE (parms);
1346 else
1347 {
1348 current_sym_value = original_sym_value;
1349 type = DECL_ARG_TYPE (parms);
1350 }
1351 }
1352
1353 PUT_SDB_DEF (name);
1354 PUT_SDB_INT_VAL (DEBUGGER_ARG_OFFSET (current_sym_value, addr));
1355 PUT_SDB_SCL (C_ARG);
1356 PUT_SDB_TYPE (plain_type (type));
1357 PUT_SDB_ENDEF;
1358 }
1359 else if (GET_CODE (DECL_RTL (parms)) == REG)
1360 {
1361 rtx best_rtl;
1362 /* Parm passed in registers and lives in registers or nowhere. */
1363
1364 /* If parm lives in a register, use that register;
1365 pretend the parm was passed there. It would be more consistent
1366 to describe the register where the parm was passed,
1367 but in practice that register usually holds something else. */
770ae6cc 1368 if (REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
37ba3390
RS
1369 best_rtl = DECL_RTL (parms);
1370 /* If the parm lives nowhere,
1371 use the register where it was passed. */
1372 else
1373 best_rtl = DECL_INCOMING_RTL (parms);
1374
1375 PUT_SDB_DEF (name);
1376 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (best_rtl)));
1377 PUT_SDB_SCL (C_REGPARM);
21abd7a6 1378 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
37ba3390
RS
1379 PUT_SDB_ENDEF;
1380 }
1381 else if (GET_CODE (DECL_RTL (parms)) == MEM
1382 && XEXP (DECL_RTL (parms), 0) != const0_rtx)
1383 {
1384 /* Parm was passed in registers but lives on the stack. */
1385
1386 /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))),
1387 in which case we want the value of that CONST_INT,
1388 or (MEM (REG ...)) or (MEM (MEM ...)),
1389 in which case we use a value of zero. */
1390 if (GET_CODE (XEXP (DECL_RTL (parms), 0)) == REG
1391 || GET_CODE (XEXP (DECL_RTL (parms), 0)) == MEM)
1392 current_sym_value = 0;
1393 else
1394 current_sym_value = INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1));
1395
1396 /* Again, this assumes the offset is based on the arg pointer. */
1397 PUT_SDB_DEF (name);
1398 PUT_SDB_INT_VAL (DEBUGGER_ARG_OFFSET (current_sym_value,
1399 XEXP (DECL_RTL (parms), 0)));
1400 PUT_SDB_SCL (C_ARG);
21abd7a6 1401 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
37ba3390
RS
1402 PUT_SDB_ENDEF;
1403 }
1404 }
1405}
1406
1407/* Output definitions for the places where parms live during the function,
1408 when different from where they were passed, when the parms were passed
1409 in memory.
1410
1411 It is not useful to do this for parms passed in registers
1412 that live during the function in different registers, because it is
1413 impossible to look in the passed register for the passed value,
1414 so we use the within-the-function register to begin with.
1415
1416 PARMS is a chain of PARM_DECL nodes. */
1417
1418static void
1419sdbout_reg_parms (parms)
1420 tree parms;
1421{
1422 for (; parms; parms = TREE_CHAIN (parms))
1423 if (DECL_NAME (parms))
1424 {
ebb13e7e 1425 const char *name = IDENTIFIER_POINTER (DECL_NAME (parms));
37ba3390
RS
1426
1427 /* Report parms that live in registers during the function
1428 but were passed in memory. */
1429 if (GET_CODE (DECL_RTL (parms)) == REG
37ba3390
RS
1430 && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER
1431 && PARM_PASSED_IN_MEMORY (parms))
1432 {
1433 if (name == 0 || *name == 0)
1434 name = gen_fake_label ();
1435 PUT_SDB_DEF (name);
1436 PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (DECL_RTL (parms))));
1437 PUT_SDB_SCL (C_REG);
21abd7a6 1438 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
37ba3390
RS
1439 PUT_SDB_ENDEF;
1440 }
1441 /* Report parms that live in memory but not where they were passed. */
1442 else if (GET_CODE (DECL_RTL (parms)) == MEM
1443 && GET_CODE (XEXP (DECL_RTL (parms), 0)) == PLUS
1444 && GET_CODE (XEXP (XEXP (DECL_RTL (parms), 0), 1)) == CONST_INT
1445 && PARM_PASSED_IN_MEMORY (parms)
1446 && ! rtx_equal_p (DECL_RTL (parms), DECL_INCOMING_RTL (parms)))
1447 {
1448#if 0 /* ??? It is not clear yet what should replace this. */
1449 int offset = DECL_OFFSET (parms) / BITS_PER_UNIT;
1450 /* A parm declared char is really passed as an int,
1451 so it occupies the least significant bytes.
1452 On a big-endian machine those are not the low-numbered ones. */
f76b9db2
ILT
1453 if (BYTES_BIG_ENDIAN
1454 && offset != -1
1455 && TREE_TYPE (parms) != DECL_ARG_TYPE (parms))
37ba3390
RS
1456 offset += (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parms)))
1457 - GET_MODE_SIZE (GET_MODE (DECL_RTL (parms))));
37ba3390
RS
1458 if (INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1)) != offset) {...}
1459#endif
1460 {
1461 if (name == 0 || *name == 0)
1462 name = gen_fake_label ();
1463 PUT_SDB_DEF (name);
1464 PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET
1465 (XEXP (DECL_RTL (parms), 0)));
1466 PUT_SDB_SCL (C_AUTO);
1467 PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
1468 PUT_SDB_ENDEF;
1469 }
1470 }
1471 }
1472}
1473\f
2b85879e
NB
1474/* Output debug information for a global DECL. Called from toplev.c
1475 after compilation proper has finished. */
1476
1477static void
1478sdbout_global_decl (decl)
1479 tree decl;
1480{
1481 if (TREE_CODE (decl) == VAR_DECL
3914abb4
NB
1482 && !DECL_EXTERNAL (decl)
1483 && DECL_RTL_SET_P (decl))
2b85879e
NB
1484 {
1485 /* The COFF linker can move initialized global vars to the end.
3914abb4
NB
1486 And that can screw up the symbol ordering. Defer those for
1487 sdbout_finish (). */
1488 if (!DECL_INITIAL (decl) || !TREE_PUBLIC (decl))
2b85879e
NB
1489 sdbout_symbol (decl, 0);
1490
1491 /* Output COFF information for non-global file-scope initialized
1492 variables. */
3914abb4 1493 if (DECL_INITIAL (decl) && GET_CODE (DECL_RTL (decl)) == MEM)
2b85879e
NB
1494 sdbout_toplevel_data (decl);
1495 }
1496}
3914abb4
NB
1497
1498/* Output initialized global vars at the end, in the order of
1499 definition. See comment in sdbout_global_decl. */
1500
1501static void
1502sdbout_finish (main_filename)
1503 const char *main_filename ATTRIBUTE_UNUSED;
1504{
43577e6b 1505 tree decl = (*lang_hooks.decls.getdecls) ();
3914abb4
NB
1506 unsigned int len = list_length (decl);
1507 tree *vec = (tree *) xmalloc (sizeof (tree) * len);
1508 unsigned int i;
1509
1510 /* Process the decls in reverse order--earliest first. Put them
1511 into VEC from back to front, then take out from front. */
1512
1513 for (i = 0; i < len; i++, decl = TREE_CHAIN (decl))
1514 vec[len - i - 1] = decl;
1515
1516 for (i = 0; i < len; i++)
1517 {
1518 decl = vec[i];
1519 if (TREE_CODE (decl) == VAR_DECL
1520 && ! DECL_EXTERNAL (decl)
1521 && DECL_INITIAL (decl)
1522 && TREE_PUBLIC (decl)
1523 && DECL_RTL_SET_P (decl))
1524 sdbout_symbol (decl, 0);
1525 }
1526
1527 free (vec);
1528}
2b85879e 1529\f
37ba3390
RS
1530/* Describe the beginning of an internal block within a function.
1531 Also output descriptions of variables defined in this block.
1532
1533 N is the number of the block, by order of beginning, counting from 1,
1534 and not counting the outermost (function top-level) block.
1535 The blocks match the BLOCKs in DECL_INITIAL (current_function_decl),
1536 if the count starts at 0 for the outermost one. */
1537
a5a42b92 1538static void
e2a12aca 1539sdbout_begin_block (line, n)
a5a42b92
NB
1540 unsigned int line;
1541 unsigned int n;
37ba3390
RS
1542{
1543 tree decl = current_function_decl;
1544 MAKE_LINE_SAFE (line);
9f27ca8b
JW
1545
1546 /* The SCO compiler does not emit a separate block for the function level
1547 scope, so we avoid it here also. However, mips ECOFF compilers do emit
1548 a separate block, so we retain it when MIPS_DEBUGGING_INFO is defined. */
1549#ifndef MIPS_DEBUGGING_INFO
1550 if (n != 1)
1551#endif
1552 PUT_SDB_BLOCK_START (line - sdb_begin_function_line);
1553
37ba3390
RS
1554 if (n == 1)
1555 {
1556 /* Include the outermost BLOCK's variables in block 1. */
18c038b9 1557 do_block = BLOCK_NUMBER (DECL_INITIAL (decl));
37ba3390
RS
1558 sdbout_block (DECL_INITIAL (decl));
1559 }
1560 /* If -g1, suppress all the internal symbols of functions
1561 except for arguments. */
1562 if (debug_info_level != DINFO_LEVEL_TERSE)
1563 {
37ba3390
RS
1564 do_block = n;
1565 sdbout_block (DECL_INITIAL (decl));
1566 }
1567
1568#ifdef SDB_ALLOW_FORWARD_REFERENCES
1569 sdbout_dequeue_anonymous_types ();
1570#endif
1571}
1572
1573/* Describe the end line-number of an internal block within a function. */
1574
e2a12aca
NB
1575static void
1576sdbout_end_block (line, n)
a5a42b92
NB
1577 unsigned int line;
1578 unsigned int n ATTRIBUTE_UNUSED;
37ba3390
RS
1579{
1580 MAKE_LINE_SAFE (line);
9f27ca8b
JW
1581
1582 /* The SCO compiler does not emit a separate block for the function level
1583 scope, so we avoid it here also. However, mips ECOFF compilers do emit
1584 a separate block, so we retain it when MIPS_DEBUGGING_INFO is defined. */
1585#ifndef MIPS_DEBUGGING_INFO
1586 if (n != 1)
1587#endif
37ba3390
RS
1588 PUT_SDB_BLOCK_END (line - sdb_begin_function_line);
1589}
1590
e2a12aca 1591static void
653e276c
NB
1592sdbout_source_line (line, filename)
1593 unsigned int line;
e2a12aca 1594 const char *filename ATTRIBUTE_UNUSED;
e2a12aca 1595{
e2a12aca 1596 /* COFF relative line numbers must be positive. */
5197bd50 1597 if ((int) line > sdb_begin_function_line)
e2a12aca
NB
1598 {
1599#ifdef ASM_OUTPUT_SOURCE_LINE
1600 ASM_OUTPUT_SOURCE_LINE (asm_out_file, line);
1601#else
1602 fprintf (asm_out_file, "\t.ln\t%d\n",
1603 ((sdb_begin_function_line > -1)
1604 ? line - sdb_begin_function_line : 1));
1605#endif
1606 }
1607}
1608
37ba3390
RS
1609/* Output sdb info for the current function name.
1610 Called from assemble_start_function. */
1611
653e276c
NB
1612static void
1613sdbout_begin_function (decl)
1614 tree decl ATTRIBUTE_UNUSED;
37ba3390
RS
1615{
1616 sdbout_symbol (current_function_decl, 0);
1617}
1618
653e276c
NB
1619/* Called at beginning of function body (before or after prologue,
1620 depending on MIPS_DEBUGGING_INFO). Record the function's starting
1621 line number, so we can output relative line numbers for the other
1622 lines. Describe beginning of outermost block. Also describe the
1623 parameter list. */
37ba3390 1624
653e276c
NB
1625#ifndef MIPS_DEBUGGING_INFO
1626static void
1627sdbout_begin_prologue (line, file)
1628 unsigned int line;
1629 const char *file ATTRIBUTE_UNUSED;
1630{
702ada3d 1631 sdbout_end_prologue (line, file);
653e276c
NB
1632}
1633#endif
1634
1635static void
702ada3d 1636sdbout_end_prologue (line, file)
653e276c 1637 unsigned int line;
702ada3d 1638 const char *file ATTRIBUTE_UNUSED;
37ba3390
RS
1639{
1640 sdb_begin_function_line = line - 1;
1641 PUT_SDB_FUNCTION_START (line);
1642 sdbout_parms (DECL_ARGUMENTS (current_function_decl));
1643 sdbout_reg_parms (DECL_ARGUMENTS (current_function_decl));
1644}
1645
1646/* Called at end of function (before epilogue).
1647 Describe end of outermost block. */
1648
e2a12aca 1649static void
37ba3390 1650sdbout_end_function (line)
e2a12aca 1651 unsigned int line;
37ba3390
RS
1652{
1653#ifdef SDB_ALLOW_FORWARD_REFERENCES
1654 sdbout_dequeue_anonymous_types ();
1655#endif
1656
1657 MAKE_LINE_SAFE (line);
1658 PUT_SDB_FUNCTION_END (line - sdb_begin_function_line);
1659
1660 /* Indicate we are between functions, for line-number output. */
1661 sdb_begin_function_line = -1;
1662}
1663
1664/* Output sdb info for the absolute end of a function.
1665 Called after the epilogue is output. */
1666
e2a12aca 1667static void
702ada3d
DR
1668sdbout_end_epilogue (line, file)
1669 unsigned int line ATTRIBUTE_UNUSED;
1670 const char *file ATTRIBUTE_UNUSED;
37ba3390 1671{
e59f7d3d 1672 const char *const name ATTRIBUTE_UNUSED
e2a12aca
NB
1673 = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl));
1674
1675#ifdef PUT_SDB_EPILOGUE_END
1676 PUT_SDB_EPILOGUE_END (name);
1677#else
1678 fprintf (asm_out_file, "\t.def\t");
1679 assemble_name (asm_out_file, name);
1680 fprintf (asm_out_file, "%s\t.val\t.%s\t.scl\t-1%s\t.endef\n",
1681 SDB_DELIM, SDB_DELIM, SDB_DELIM);
1682#endif
37ba3390
RS
1683}
1684
1685/* Output sdb info for the given label. Called only if LABEL_NAME (insn)
1686 is present. */
1687
e1772ac0 1688static void
37ba3390 1689sdbout_label (insn)
b3694847 1690 rtx insn;
37ba3390
RS
1691{
1692 PUT_SDB_DEF (LABEL_NAME (insn));
1693 PUT_SDB_VAL (insn);
1694 PUT_SDB_SCL (C_LABEL);
1695 PUT_SDB_TYPE (T_NULL);
1696 PUT_SDB_ENDEF;
1697}
1698
cc694a81
DE
1699/* Change to reading from a new source file. */
1700
7f905405
NB
1701static void
1702sdbout_start_source_file (line, filename)
1703 unsigned int line ATTRIBUTE_UNUSED;
df07dc5b 1704 const char *filename ATTRIBUTE_UNUSED;
cc694a81
DE
1705{
1706#ifdef MIPS_DEBUGGING_INFO
1707 struct sdb_file *n = (struct sdb_file *) xmalloc (sizeof *n);
1708
1709 n->next = current_file;
1710 n->name = filename;
1711 current_file = n;
1712 PUT_SDB_SRC_FILE (filename);
1713#endif
1714}
1715
1716/* Revert to reading a previous source file. */
1717
7f905405
NB
1718static void
1719sdbout_end_source_file (line)
1720 unsigned int line ATTRIBUTE_UNUSED;
cc694a81
DE
1721{
1722#ifdef MIPS_DEBUGGING_INFO
1723 struct sdb_file *next;
1724
1725 next = current_file->next;
1726 free (current_file);
1727 current_file = next;
1728 PUT_SDB_SRC_FILE (current_file->name);
1729#endif
1730}
1731
4eadbbd5
RK
1732/* Set up for SDB output at the start of compilation. */
1733
a51d908e 1734static void
e2a12aca 1735sdbout_init (input_file_name)
4eadbbd5 1736 const char *input_file_name ATTRIBUTE_UNUSED;
4eadbbd5
RK
1737{
1738#ifdef MIPS_DEBUGGING_INFO
1739 current_file = (struct sdb_file *) xmalloc (sizeof *current_file);
1740 current_file->next = NULL;
1741 current_file->name = input_file_name;
1742#endif
1743
1744#ifdef RMS_QUICK_HACK_1
1745 tree t;
43577e6b 1746 for (t = (*lang_hooks.decls.getdecls) (); t; t = TREE_CHAIN (t))
4eadbbd5
RK
1747 if (DECL_NAME (t) && IDENTIFIER_POINTER (DECL_NAME (t)) != 0
1748 && !strcmp (IDENTIFIER_POINTER (DECL_NAME (t)), "__vtbl_ptr_type"))
1749 sdbout_symbol (t, 0);
e2500fed 1750#endif
4eadbbd5
RK
1751}
1752
e2500fed
GK
1753#else /* SDB_DEBUGGING_INFO */
1754
1755/* This should never be used, but its address is needed for comparisons. */
1756const struct gcc_debug_hooks sdb_debug_hooks;
1757
37ba3390 1758#endif /* SDB_DEBUGGING_INFO */
e2500fed
GK
1759
1760#include "gt-sdbout.h"
This page took 2.207131 seconds and 5 git commands to generate.