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