|
|
1.1 root 1: /* Output dbx-format symbol table information from GNU compiler.
1.1.1.6 root 2: Copyright (C) 1987, 1988 Free Software Foundation, Inc.
1.1 root 3:
4: This file is part of GNU CC.
5:
1.1.1.12 root 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 1, or (at your option)
9: any later version.
10:
1.1 root 11: GNU CC is distributed in the hope that it will be useful,
1.1.1.12 root 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
18: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
1.1 root 19:
20:
21: /* Output dbx-format symbol table data.
22: This consists of many symbol table entries, each of them
23: a .stabs assembler pseudo-op with four operands:
24: a "name" which is really a description of one symbol and its type,
25: a "code", which is a symbol defined in stab.h whose name starts with N_,
26: an unused operand always 0,
27: and a "value" which is an address or an offset.
28: The name is enclosed in doublequote characters.
29:
30: Each function, variable, typedef, and structure tag
31: has a symbol table entry to define it.
32: The beginning and end of each level of name scoping within
33: a function are also marked by special symbol table entries.
34:
35: The "name" consists of the symbol name, a colon, a kind-of-symbol letter,
36: and a data type number. The data type number may be followed by
37: "=" and a type definition; normally this will happen the first time
38: the type number is mentioned. The type definition may refer to
39: other types by number, and those type numbers may be followed
40: by "=" and nested definitions.
41:
42: This can make the "name" quite long.
43: When a name is more than 80 characters, we split the .stabs pseudo-op
44: into two .stabs pseudo-ops, both sharing the same "code" and "value".
45: The first one is marked as continued with a double-backslash at the
46: end of its "name".
47:
48: The kind-of-symbol letter distinguished function names from global
49: variables from file-scope variables from parameters from auto
50: variables in memory from typedef names from register variables.
51: See `dbxout_symbol'.
52:
53: The "code" is mostly redundant with the kind-of-symbol letter
54: that goes in the "name", but not entirely: for symbols located
55: in static storage, the "code" says which segment the address is in,
56: which controls how it is relocated.
57:
58: The "value" for a symbol in static storage
59: is the core address of the symbol (actually, the assembler
60: label for the symbol). For a symbol located in a stack slot
61: it is the stack offset; for one in a register, the register number.
62: For a typedef symbol, it is zero.
63:
1.1.1.9 root 64: If DEBUG_SYMS_TEXT is defined, all debugging symbols must be
65: output while in the text section.
66:
1.1 root 67: For more on data type definitions, see `dbxout_type'. */
68:
69: #include "config.h"
70: #include "tree.h"
71: #include "rtl.h"
1.1.1.6 root 72: #include "flags.h"
1.1 root 73: #include <stdio.h>
1.1.1.17! root 74: #include <sys/param.h>
! 75: #include <errno.h>
! 76:
! 77: #ifndef errno
! 78: extern int errno;
! 79: #endif
! 80:
! 81: /* Virtually every UN*X system now in common use (except for pre-4.3-tahoe
! 82: BSD systems) now provides getcwd as called for by POSIX. Allow for
! 83: the few exceptions to the general rule here. */
! 84:
! 85: #if !(defined (USG) || defined (VMS))
! 86: extern char *getwd ();
! 87: #define getcwd(buf,len) getwd(buf)
! 88: #define GUESSPATHLEN (MAXPATHLEN + 1)
! 89: #else /* (defined (USG) || defined (VMS)) */
! 90: extern char *getcwd ();
! 91: /* We actually use this as a starting point, not a limit. */
! 92: #define GUESSPATHLEN 100
! 93: #endif /* (defined (USG) || defined (VMS)) */
1.1.1.2 root 94:
95: /* Typical USG systems don't have stab.h, and they also have
96: no use for DBX-format debugging info. */
97:
1.1.1.4 root 98: #ifdef DBX_DEBUGGING_INFO
1.1.1.2 root 99:
1.1.1.9 root 100: #ifdef DEBUG_SYMS_TEXT
101: #define FORCE_TEXT text_section ();
102: #else
103: #define FORCE_TEXT
104: #endif
105:
1.1.1.11 root 106: #ifdef USG
1.1.1.16 root 107: #include "gstab.h" /* If doing DBX on sysV, use our own stab.h. */
1.1.1.11 root 108: #else
109: #include <stab.h> /* On BSD, use the system's stab.h. */
110: #endif /* not USG */
1.1.1.2 root 111:
1.1 root 112: /* Stream for writing to assembler file. */
113:
114: static FILE *asmfile;
115:
116: enum typestatus {TYPE_UNSEEN, TYPE_XREF, TYPE_DEFINED};
117:
118: /* Vector recording the status of describing C data types.
119: When we first notice a data type (a tree node),
120: we assign it a number using next_type_number.
121: That is its index in this vector.
122: The vector element says whether we have yet output
123: the definition of the type. TYPE_XREF says we have
124: output it as a cross-reference only. */
125:
126: enum typestatus *typevec;
127:
128: /* Number of elements of space allocated in `typevec'. */
129:
130: static int typevec_len;
131:
132: /* In dbx output, each type gets a unique number.
133: This is the number for the next type output.
134: The number, once assigned, is in the TYPE_SYMTAB_ADDRESS field. */
135:
136: static int next_type_number;
137:
138: /* In dbx output, we must assign symbol-blocks id numbers
139: in the order in which their beginnings are encountered.
140: We output debugging info that refers to the beginning and
141: end of the ranges of code in each block
142: with assembler labels LBBn and LBEn, where n is the block number.
143: The labels are generated in final, which assigns numbers to the
144: blocks in the same way. */
145:
146: static int next_block_number;
147:
148: /* These variables are for dbxout_symbol to communicate to
149: dbxout_finish_symbol.
150: current_sym_code is the symbol-type-code, a symbol N_... define in stab.h.
151: current_sym_value and current_sym_addr are two ways to address the
152: value to store in the symtab entry.
153: current_sym_addr if nonzero represents the value as an rtx.
154: If that is zero, current_sym_value is used. This is used
155: when the value is an offset (such as for auto variables,
156: register variables and parms). */
157:
158: static int current_sym_code;
159: static int current_sym_value;
160: static rtx current_sym_addr;
161:
162: /* Number of chars of symbol-description generated so far for the
163: current symbol. Used by CHARS and CONTIN. */
164:
165: static int current_sym_nchars;
166:
167: /* Report having output N chars of the current symbol-description. */
168:
169: #define CHARS(N) (current_sym_nchars += (N))
170:
171: /* Break the current symbol-description, generating a continuation,
172: if it has become long. */
173:
1.1.1.2 root 174: #ifndef DBX_CONTIN_LENGTH
175: #define DBX_CONTIN_LENGTH 80
176: #endif
177:
178: #if DBX_CONTIN_LENGTH > 0
1.1 root 179: #define CONTIN \
1.1.1.2 root 180: do {if (current_sym_nchars > DBX_CONTIN_LENGTH) dbxout_continue ();} while (0)
181: #else
182: #define CONTIN
183: #endif
1.1 root 184:
185: void dbxout_types ();
186: void dbxout_tags ();
1.1.1.6 root 187: void dbxout_args ();
1.1.1.7 root 188: void dbxout_symbol ();
1.1 root 189: static void dbxout_type_name ();
190: static void dbxout_type ();
191: static void dbxout_finish_symbol ();
192: static void dbxout_continue ();
193:
194: /* At the beginning of compilation, start writing the symbol table.
195: Initialize `typevec' and output the standard data types of C. */
196:
197: void
198: dbxout_init (asm_file, input_file_name)
199: FILE *asm_file;
200: char *input_file_name;
201: {
202: asmfile = asm_file;
203:
204: typevec_len = 100;
205: typevec = (enum typestatus *) xmalloc (typevec_len * sizeof typevec[0]);
206: bzero (typevec, typevec_len * sizeof typevec[0]);
1.1.1.6 root 207:
1.1.1.17! root 208: /* Put the current working directory in an N_SO symbol. */
! 209: {
! 210: static char *cwd;
! 211: static enum {not_gotten, gotten, error_getting} cwd_status = not_gotten;
! 212: int size;
! 213:
! 214: if (cwd_status == not_gotten)
! 215: {
! 216: char *value;
! 217:
! 218: /* Read the working directory, avoiding arbitrary limit. */
! 219: size = GUESSPATHLEN;
! 220: while (1)
! 221: {
! 222: cwd = (char *) xmalloc (size);
! 223: value = getcwd (cwd, size);
! 224: if (value != 0 || errno != ERANGE)
! 225: break;
! 226: free (cwd);
! 227: size *= 2;
! 228: }
! 229:
! 230: if (value != 0)
! 231: cwd_status = gotten;
! 232: else
! 233: cwd_status = error_getting;
! 234: }
! 235:
! 236: if (cwd_status == gotten)
! 237: {
! 238: #ifdef ASM_OUTPUT_MAIN_SOURCE_DIRECTORY
! 239: ASM_OUTPUT_MAIN_SOURCE_DIRECTORY (asmfile, cwd);
! 240: #else /* no ASM_OUTPUT_MAIN_SOURCE_DIRECTORY */
! 241: fprintf (asmfile, "%s \"%s/\",%d,0,0,%s\n", ".stabs",
! 242: cwd, N_SO, "Ltext");
! 243: #endif /* no ASM_OUTPUT_MAIN_SOURCE_DIRECTORY */
! 244: }
! 245: }
! 246:
1.1.1.5 root 247: /* Used to put `Ltext:' before the reference, but that loses on sun 4. */
1.1 root 248: fprintf (asmfile,
1.1.1.5 root 249: "\t.stabs \"%s\",%d,0,0,Ltext\nLtext:\n",
1.1.1.2 root 250: input_file_name, N_SO);
1.1 root 251:
252: next_type_number = 1;
253: next_block_number = 2;
254:
255: /* Make sure that types `int' and `char' have numbers 1 and 2.
256: Definitions of other integer types will refer to those numbers. */
257:
1.1.1.10 root 258: dbxout_symbol (TYPE_NAME (integer_type_node), 0);
259: dbxout_symbol (TYPE_NAME (char_type_node), 0);
1.1 root 260:
1.1.1.2 root 261: /* Get all permanent types not yet gotten, and output them. */
1.1 root 262:
263: dbxout_types (get_permanent_types ());
264: }
265:
266: /* Continue a symbol-description that gets too big.
267: End one symbol table entry with a double-backslash
268: and start a new one, eventually producing something like
269: .stabs "start......\\",code,0,value
270: .stabs "...rest",code,0,value */
271:
272: static void
273: dbxout_continue ()
274: {
1.1.1.2 root 275: #ifdef DBX_CONTIN_CHAR
276: fprintf (asmfile, "%c", DBX_CONTIN_CHAR);
277: #else
1.1 root 278: fprintf (asmfile, "\\\\");
1.1.1.2 root 279: #endif
1.1 root 280: dbxout_finish_symbol ();
281: fprintf (asmfile, ".stabs \"");
282: current_sym_nchars = 0;
283: }
284:
285: /* Output a reference to a type. If the type has not yet been
286: described in the dbx output, output its definition now.
287: For a type already defined, just refer to its definition
288: using the type number.
289:
290: If FULL is nonzero, and the type has been described only with
291: a forward-reference, output the definition now.
292: If FULL is zero in this case, just refer to the forward-reference
293: using the number previously allocated. */
294:
295: static void
296: dbxout_type (type, full)
297: tree type;
298: int full;
299: {
300: register tree tem;
301:
1.1.1.2 root 302: /* If there was an input error and we don't really have a type,
303: avoid crashing and write something that is at least valid
304: by assuming `int'. */
305: if (type == error_mark_node)
306: type = integer_type_node;
1.1.1.15 root 307: else
1.1.1.2 root 308: type = TYPE_MAIN_VARIANT (type);
309:
1.1 root 310: if (TYPE_SYMTAB_ADDRESS (type) == 0)
311: {
312: /* Type has no dbx number assigned. Assign next available number. */
313: TYPE_SYMTAB_ADDRESS (type) = next_type_number++;
314:
315: /* Make sure type vector is long enough to record about this type. */
316:
317: if (next_type_number == typevec_len)
318: {
319: typevec = (enum typestatus *) xrealloc (typevec, typevec_len * 2 * sizeof typevec[0]);
320: bzero (typevec + typevec_len, typevec_len * sizeof typevec[0]);
321: typevec_len *= 2;
322: }
323: }
324:
325: /* Output the number of this type, to refer to it. */
326: fprintf (asmfile, "%d", TYPE_SYMTAB_ADDRESS (type));
327: CHARS (3);
328:
329: /* If this type's definition has been output or is now being output,
330: that is all. */
331:
332: switch (typevec[TYPE_SYMTAB_ADDRESS (type)])
333: {
334: case TYPE_UNSEEN:
335: break;
336: case TYPE_XREF:
337: if (! full)
338: return;
339: break;
340: case TYPE_DEFINED:
341: return;
342: }
343:
1.1.1.2 root 344: #ifdef DBX_NO_XREFS
345: /* For systems where dbx output does not allow the `=xsNAME:' syntax,
346: leave the type-number completely undefined rather than output
347: a cross-reference. */
348: if (TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE
349: || TREE_CODE (type) == ENUMERAL_TYPE)
350:
351: if ((TYPE_NAME (type) != 0 && !full)
352: || TYPE_SIZE (type) == 0)
353: {
354: typevec[TYPE_SYMTAB_ADDRESS (type)] = TYPE_XREF;
355: return;
356: }
357: #endif
358:
1.1 root 359: /* Output a definition now. */
360:
361: fprintf (asmfile, "=");
362: CHARS (1);
363:
364: /* Mark it as defined, so that if it is self-referent
365: we will not get into an infinite recursion of definitions. */
366:
367: typevec[TYPE_SYMTAB_ADDRESS (type)] = TYPE_DEFINED;
368:
369: switch (TREE_CODE (type))
370: {
371: case VOID_TYPE:
372: /* For a void type, just define it as itself; ie, "5=5".
373: This makes us consider it defined
374: without saying what it is. The debugger will make it
375: a void type when the reference is seen, and nothing will
376: ever override that default. */
377: fprintf (asmfile, "%d", TYPE_SYMTAB_ADDRESS (type));
378: CHARS (3);
379: break;
380:
381: case INTEGER_TYPE:
1.1.1.2 root 382: if (type == char_type_node && ! TREE_UNSIGNED (type))
1.1 root 383: /* Output the type `char' as a subrange of itself!
384: I don't understand this definition, just copied it
385: from the output of pcc. */
386: fprintf (asmfile, "r2;0;127;");
387: else
388: /* Output other integer types as subranges of `int'. */
389: fprintf (asmfile, "r1;%d;%d;",
390: TREE_INT_CST_LOW (TYPE_MIN_VALUE (type)),
391: TREE_INT_CST_LOW (TYPE_MAX_VALUE (type)));
392: CHARS (25);
393: break;
394:
395: case REAL_TYPE:
396: /* This must be magic. */
397: fprintf (asmfile, "r1;%d;0;",
398: TREE_INT_CST_LOW (size_in_bytes (type)));
399: CHARS (16);
400: break;
401:
402: case ARRAY_TYPE:
403: /* Output "a" followed by a range type definition
404: for the index type of the array
405: followed by a reference to the target-type.
406: ar1;0;N;M for an array of type M and size N. */
407: fprintf (asmfile, "ar1;0;%d;",
1.1.1.2 root 408: (TYPE_DOMAIN (type)
409: ? TREE_INT_CST_LOW (TYPE_MAX_VALUE (TYPE_DOMAIN (type)))
410: : -1));
1.1 root 411: CHARS (17);
412: dbxout_type (TREE_TYPE (type), 0);
413: break;
414:
415: case RECORD_TYPE:
416: case UNION_TYPE:
417: /* Output a structure type. */
418: if ((TYPE_NAME (type) != 0 && !full)
419: || TYPE_SIZE (type) == 0)
420: {
421: /* If the type is just a cross reference, output one
422: and mark the type as partially described.
423: If it later becomes defined, we will output
1.1.1.2 root 424: its real definition.
1.1.1.7 root 425: If the type has a name, don't nest its definition within
1.1.1.2 root 426: another type's definition; instead, output an xref
427: and let the definition come when the name is defined. */
1.1 root 428: fprintf (asmfile, (TREE_CODE (type) == RECORD_TYPE) ? "xs" : "xu");
429: CHARS (3);
1.1.1.10 root 430: #if 0 /* This assertion is legitimately false in C++. */
1.1.1.7 root 431: /* We shouldn't be outputting a reference to a type before its
432: definition unless the type has a tag name.
433: A typedef name without a tag name should be impossible. */
434: if (TREE_CODE (TYPE_NAME (type)) != IDENTIFIER_NODE)
435: abort ();
1.1.1.10 root 436: #endif
1.1 root 437: dbxout_type_name (type);
438: fprintf (asmfile, ":");
439: typevec[TYPE_SYMTAB_ADDRESS (type)] = TYPE_XREF;
440: break;
441: }
442: tem = size_in_bytes (type);
443: fprintf (asmfile, (TREE_CODE (type) == RECORD_TYPE) ? "s%d" : "u%d",
444: TREE_INT_CST_LOW (tem));
1.1.1.6 root 445:
446: if (TYPE_BASETYPES (type) && use_gdb_dbx_extensions)
447: {
448: putc ('!', asmfile);
449: putc ((TREE_PUBLIC (TYPE_BASETYPES (type)) ? '2' : '0'),
450: asmfile);
451: dbxout_type (TREE_VALUE (TYPE_BASETYPES (type)), 0);
452: putc (',', asmfile);
453: CHARS (3);
454: }
1.1 root 455: CHARS (11);
1.1.1.6 root 456:
1.1 root 457: for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
458: /* Output the name, type, position (in bits), size (in bits)
459: of each field. */
460: /* Omit here the nameless fields that are used to skip bits. */
461: if (DECL_NAME (tem) != 0)
462: {
1.1.1.2 root 463: /* Continue the line if necessary,
464: but not before the first field. */
465: if (tem != TYPE_FIELDS (type))
466: CONTIN;
1.1 root 467: fprintf (asmfile, "%s:", IDENTIFIER_POINTER (DECL_NAME (tem)));
1.1.1.6 root 468: CHARS (2 + IDENTIFIER_LENGTH (DECL_NAME (tem)));
1.1.1.14 root 469: #ifdef TREE_PRIVATE
470: if (use_gdb_dbx_extensions
471: && (TREE_PRIVATE (tem) || TREE_PROTECTED (tem)
472: || TREE_CODE (tem) != FIELD_DECL))
1.1.1.6 root 473: {
474: putc ('/', asmfile);
475: putc ((TREE_PRIVATE (tem) ? '0'
476: : TREE_PROTECTED (tem) ? '1' : '2'),
477: asmfile);
478: CHARS (2);
479: if (TREE_CODE (tem) == FUNCTION_DECL)
480: {
481: putc (':', asmfile);
482: CHARS (1);
483: dbxout_type (TREE_TYPE (tem), 0); /* FUNCTION_TYPE */
484: dbxout_args (TYPE_ARG_TYPES (TREE_TYPE (tem)));
485: #ifdef TREE_VIRTUAL
486: fprintf (asmfile, ":%s;%c",
487: XSTR (XEXP (DECL_RTL (tem), 0), 0),
488: TREE_VIRTUAL (tem) ? '*' : '.');
489: #endif
490: CHARS (3 + strlen (XSTR (XEXP (DECL_RTL (tem), 0), 0)));
491: }
492: else
493: dbxout_type (TREE_TYPE (tem), 0);
494: }
495: else
1.1.1.14 root 496: #endif
1.1.1.6 root 497: dbxout_type (TREE_TYPE (tem), 0);
498:
499: if (TREE_CODE (tem) == VAR_DECL)
500: {
501: if (use_gdb_dbx_extensions)
502: {
503: fprintf (asmfile, ":%s",
504: XSTR (XEXP (DECL_RTL (tem), 0), 0));
505: CHARS (2 + strlen (XSTR (XEXP (DECL_RTL (tem), 0), 0)));
506: }
507: else
508: {
509: fprintf (asmfile, ",0,0;");
510: CHARS (5);
511: }
512: }
513: else
514: {
515: fprintf (asmfile, ",%d,%d;", DECL_OFFSET (tem),
516: (TREE_INT_CST_LOW (DECL_SIZE (tem))
517: * DECL_SIZE_UNIT (tem)));
518: CHARS (23);
519: }
1.1 root 520: }
1.1.1.6 root 521:
1.1 root 522: putc (';', asmfile);
523: CHARS (1);
524: break;
525:
526: case ENUMERAL_TYPE:
527: if ((TYPE_NAME (type) != 0 && !full)
528: || TYPE_SIZE (type) == 0)
529: {
530: fprintf (asmfile, "xe");
531: CHARS (3);
532: dbxout_type_name (type);
533: typevec[TYPE_SYMTAB_ADDRESS (type)] = TYPE_XREF;
534: fprintf (asmfile, ":");
535: return;
536: }
537: putc ('e', asmfile);
538: CHARS (1);
539: for (tem = TYPE_VALUES (type); tem; tem = TREE_CHAIN (tem))
540: {
541: fprintf (asmfile, "%s:%d,", IDENTIFIER_POINTER (TREE_PURPOSE (tem)),
542: TREE_INT_CST_LOW (TREE_VALUE (tem)));
1.1.1.6 root 543: CHARS (11 + IDENTIFIER_LENGTH (TREE_PURPOSE (tem)));
1.1 root 544: if (TREE_CHAIN (tem) != 0)
545: CONTIN;
546: }
547: putc (';', asmfile);
548: CHARS (1);
549: break;
550:
551: case POINTER_TYPE:
552: putc ('*', asmfile);
553: CHARS (1);
554: dbxout_type (TREE_TYPE (type), 0);
555: break;
556:
1.1.1.6 root 557: case METHOD_TYPE:
558: if (use_gdb_dbx_extensions)
559: {
560: putc ('@', asmfile);
561: CHARS (1);
1.1.1.10 root 562: dbxout_type (TYPE_METHOD_BASETYPE (type), 0);
563: putc (',', asmfile);
564: CHARS (1);
565: dbxout_type (TREE_TYPE (type), 0);
566: }
567: else
568: {
569: /* Treat it as a function type. */
570: dbxout_type (TREE_TYPE (type), 0);
571: }
572: break;
573:
574: case OFFSET_TYPE:
575: if (use_gdb_dbx_extensions)
576: {
577: putc ('@', asmfile);
578: CHARS (1);
579: dbxout_type (TYPE_OFFSET_BASETYPE (type), 0);
1.1.1.6 root 580: putc (',', asmfile);
581: CHARS (1);
582: dbxout_type (TREE_TYPE (type), 0);
583: }
584: else
585: {
586: /* Treat it as a function type. */
587: dbxout_type (TREE_TYPE (type), 0);
588: }
589: break;
590:
591: case REFERENCE_TYPE:
592: putc (use_gdb_dbx_extensions ? '&' : '*', asmfile);
593: CHARS (1);
594: dbxout_type (TREE_TYPE (type), 0);
595: break;
596:
1.1 root 597: case FUNCTION_TYPE:
598: putc ('f', asmfile);
599: CHARS (1);
600: dbxout_type (TREE_TYPE (type), 0);
601: break;
1.1.1.6 root 602:
603: default:
604: abort ();
1.1 root 605: }
606: }
607:
608: /* Output the name of type TYPE, with no punctuation.
609: Such names can be set up either by typedef declarations
610: or by struct, enum and union tags. */
611:
612: static void
613: dbxout_type_name (type)
614: register tree type;
615: {
1.1.1.6 root 616: tree t;
1.1 root 617: if (TYPE_NAME (type) == 0)
618: abort ();
619: if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
1.1.1.6 root 620: {
621: t = TYPE_NAME (type);
622: }
1.1 root 623: else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL)
1.1.1.6 root 624: {
625: t = DECL_NAME (TYPE_NAME (type));
626: }
1.1 root 627: else
628: abort ();
629:
1.1.1.6 root 630: fprintf (asmfile, "%s", IDENTIFIER_POINTER (t));
631: CHARS (IDENTIFIER_LENGTH (t));
1.1 root 632: }
633:
634: /* Output a .stabs for the symbol defined by DECL,
635: which must be a ..._DECL node in the normal namespace.
636: It may be a CONST_DECL, a FUNCTION_DECL, a PARM_DECL or a VAR_DECL.
637: LOCAL is nonzero if the scope is less than the entire file. */
638:
639: void
640: dbxout_symbol (decl, local)
641: tree decl;
642: int local;
643: {
1.1.1.2 root 644: int letter = 0;
645: tree type = TREE_TYPE (decl);
1.1 root 646:
647: /* If global, first output all types and all
648: struct, enum and union tags that have been created
649: and not yet output. */
650:
651: if (local == 0)
652: {
653: dbxout_tags (gettags ());
654: dbxout_types (get_permanent_types ());
655: }
656:
657: current_sym_code = 0;
658: current_sym_value = 0;
659: current_sym_addr = 0;
660:
661: /* The output will always start with the symbol name,
662: so count that always in the length-output-so-far. */
663:
1.1.1.6 root 664: current_sym_nchars = 2 + IDENTIFIER_LENGTH (DECL_NAME (decl));
1.1 root 665:
666: switch (TREE_CODE (decl))
667: {
668: case CONST_DECL:
669: /* Enum values are defined by defining the enum type. */
670: break;
671:
672: case FUNCTION_DECL:
1.1.1.3 root 673: if (DECL_RTL (decl) == 0)
674: return;
1.1 root 675: if (TREE_EXTERNAL (decl))
676: break;
677: if (GET_CODE (DECL_RTL (decl)) != MEM
678: || GET_CODE (XEXP (DECL_RTL (decl), 0)) != SYMBOL_REF)
679: break;
1.1.1.9 root 680: FORCE_TEXT;
1.1 root 681: fprintf (asmfile, ".stabs \"%s:%c",
682: IDENTIFIER_POINTER (DECL_NAME (decl)),
683: TREE_PUBLIC (decl) ? 'F' : 'f');
684:
685: current_sym_code = N_FUN;
686: current_sym_addr = XEXP (DECL_RTL (decl), 0);
687:
688: if (TREE_TYPE (TREE_TYPE (decl)))
689: dbxout_type (TREE_TYPE (TREE_TYPE (decl)), 0);
690: else
691: dbxout_type (void_type_node, 0);
692: dbxout_finish_symbol ();
693: break;
694:
695: case TYPE_DECL:
1.1.1.7 root 696: #if 0
697: /* This seems all wrong. Outputting most kinds of types gives no name
698: at all. A true definition gives no name; a cross-ref for a
699: structure can give the tag name, but not a type name.
700: It seems that no typedef name is defined by outputting a type. */
701:
1.1.1.3 root 702: /* If this typedef name was defined by outputting the type,
703: don't duplicate it. */
704: if (typevec[TYPE_SYMTAB_ADDRESS (type)] == TYPE_DEFINED
705: && TYPE_NAME (TREE_TYPE (decl)) == decl)
706: return;
1.1.1.7 root 707: #endif
708: /* Don't output the same typedef twice. */
709: if (TREE_ASM_WRITTEN (decl))
710: return;
1.1.1.3 root 711:
1.1 root 712: /* Output typedef name. */
1.1.1.9 root 713: FORCE_TEXT;
1.1 root 714: fprintf (asmfile, ".stabs \"%s:t",
715: IDENTIFIER_POINTER (DECL_NAME (decl)));
716:
717: current_sym_code = N_LSYM;
718:
1.1.1.3 root 719: dbxout_type (TREE_TYPE (decl), 1);
1.1 root 720: dbxout_finish_symbol ();
1.1.1.7 root 721:
722: /* Prevent duplicate output of a typedef. */
723: TREE_ASM_WRITTEN (decl) = 1;
1.1 root 724: break;
725:
726: case PARM_DECL:
727: /* Parm decls go in their own separate chains
728: and are output by dbxout_reg_parms and dbxout_parms. */
729: abort ();
730:
731: case VAR_DECL:
1.1.1.3 root 732: if (DECL_RTL (decl) == 0)
733: return;
1.1 root 734: /* Don't mention a variable that is external.
735: Let the file that defines it describe it. */
736: if (TREE_EXTERNAL (decl))
737: break;
738:
739: /* Don't mention a variable at all
740: if it was completely optimized into nothingness. */
741: if (GET_CODE (DECL_RTL (decl)) == REG
1.1.1.2 root 742: && (REGNO (DECL_RTL (decl)) < 0
743: || REGNO (DECL_RTL (decl)) >= FIRST_PSEUDO_REGISTER))
1.1 root 744: break;
745:
746: /* The kind-of-variable letter depends on where
747: the variable is and on the scope of its name:
748: G and N_GSYM for static storage and global scope,
749: S for static storage and file scope,
1.1.1.4 root 750: V for static storage and local scope,
1.1 root 751: for those two, use N_LCSYM if data is in bss segment,
1.1.1.14 root 752: N_STSYM if in data segment, N_FUN otherwise.
753: (We used N_FUN originally, then changed to N_STSYM
754: to please GDB. However, it seems that confused ld.
755: Now GDB has been fixed to like N_FUN, says Kingdon.)
1.1 root 756: no letter at all, and N_LSYM, for auto variable,
757: r and N_RSYM for register variable. */
758:
759: if (GET_CODE (DECL_RTL (decl)) == MEM
760: && GET_CODE (XEXP (DECL_RTL (decl), 0)) == SYMBOL_REF)
761: {
762: if (TREE_PUBLIC (decl))
763: {
764: letter = 'G';
765: current_sym_code = N_GSYM;
766: }
767: else
768: {
769: current_sym_addr = XEXP (DECL_RTL (decl), 0);
770:
1.1.1.4 root 771: letter = TREE_PERMANENT (decl) ? 'S' : 'V';
1.1 root 772:
773: if (!DECL_INITIAL (decl))
774: current_sym_code = N_LCSYM;
775: else if (TREE_READONLY (decl) && ! TREE_VOLATILE (decl))
776: /* This is not quite right, but it's the closest
777: of all the codes that Unix defines. */
778: current_sym_code = N_FUN;
779: else
1.1.1.14 root 780: {
781: /* Ultrix `as' seems to need this. */
782: #ifdef DBX_STATIC_STAB_DATA_SECTION
783: data_section ();
784: #endif
785: current_sym_code = N_STSYM;
786: }
1.1 root 787: }
788: }
1.1.1.2 root 789: else if (GET_CODE (DECL_RTL (decl)) == REG)
790: {
791: letter = 'r';
792: current_sym_code = N_RSYM;
793: current_sym_value = DBX_REGISTER_NUMBER (REGNO (DECL_RTL (decl)));
794: }
1.1.1.15 root 795: else if (GET_CODE (DECL_RTL (decl)) == SUBREG)
796: {
797: rtx value = DECL_RTL (decl);
798: int offset = 0;
799: while (GET_CODE (value) == SUBREG)
800: {
801: offset += SUBREG_WORD (value);
802: value = SUBREG_REG (value);
803: }
804: letter = 'r';
805: current_sym_code = N_RSYM;
806: current_sym_value = DBX_REGISTER_NUMBER (REGNO (value) + offset);
807: }
1.1.1.2 root 808: else if (GET_CODE (DECL_RTL (decl)) == MEM
809: && (GET_CODE (XEXP (DECL_RTL (decl), 0)) == MEM
810: || (GET_CODE (XEXP (DECL_RTL (decl), 0)) == REG
811: && REGNO (XEXP (DECL_RTL (decl), 0)) != FRAME_POINTER_REGNUM)))
1.1.1.6 root 812: /* If the value is indirect by memory or by a register
813: that isn't the frame pointer
1.1.1.2 root 814: then it means the object is variable-sized and address through
815: that register or stack slot. DBX has no way to represent this
1.1.1.5 root 816: so all we can do is output the variable as a pointer.
817: If it's not a parameter, ignore it.
818: (VAR_DECLs like this can be made by integrate.c.) */
1.1 root 819: {
1.1.1.2 root 820: if (GET_CODE (XEXP (DECL_RTL (decl), 0)) == REG)
1.1 root 821: {
822: letter = 'r';
823: current_sym_code = N_RSYM;
1.1.1.2 root 824: current_sym_value = DBX_REGISTER_NUMBER (REGNO (XEXP (DECL_RTL (decl), 0)));
1.1 root 825: }
826: else
827: {
828: current_sym_code = N_LSYM;
1.1.1.2 root 829: /* DECL_RTL looks like (MEM (MEM (PLUS (REG...) (CONST_INT...)))).
1.1 root 830: We want the value of that CONST_INT. */
1.1.1.2 root 831: current_sym_value = INTVAL (XEXP (XEXP (XEXP (DECL_RTL (decl), 0), 0), 1));
1.1 root 832: }
1.1.1.2 root 833:
1.1.1.14 root 834: /* Effectively do build_pointer_type, but don't cache this type,
835: since it might be temporary whereas the type it points to
836: might have been saved for inlining. */
837: type = make_node (POINTER_TYPE);
838: TREE_TYPE (type) = TREE_TYPE (decl);
1.1 root 839: }
1.1.1.2 root 840: else if (GET_CODE (DECL_RTL (decl)) == MEM
1.1.1.8 root 841: && GET_CODE (XEXP (DECL_RTL (decl), 0)) == REG)
1.1.1.2 root 842: {
843: current_sym_code = N_LSYM;
1.1.1.8 root 844: current_sym_value = 0;
845: }
846: else if (GET_CODE (DECL_RTL (decl)) == MEM
847: && GET_CODE (XEXP (DECL_RTL (decl), 0)) == PLUS
848: && GET_CODE (XEXP (XEXP (DECL_RTL (decl), 0), 1)) == CONST_INT)
849: {
850: current_sym_code = N_LSYM;
851: /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...)))
852: We want the value of that CONST_INT. */
853: current_sym_value = INTVAL (XEXP (XEXP (DECL_RTL (decl), 0), 1));
1.1.1.2 root 854: }
1.1.1.8 root 855: else
856: /* Address might be a MEM, when DECL is a variable-sized object.
857: Or it might be const0_rtx, meaning previous passes
858: want us to ignore this variable. */
859: break;
860:
861: /* Ok, start a symtab entry and output the variable name. */
1.1.1.9 root 862: FORCE_TEXT;
1.1.1.8 root 863: fprintf (asmfile, ".stabs \"%s:",
864: IDENTIFIER_POINTER (DECL_NAME (decl)));
1.1.1.2 root 865: if (letter) putc (letter, asmfile);
866: dbxout_type (type, 0);
867: dbxout_finish_symbol ();
1.1 root 868: break;
869: }
870: }
871:
872: static void
873: dbxout_finish_symbol ()
874: {
875: fprintf (asmfile, "\",%d,0,0,", current_sym_code);
876: if (current_sym_addr)
877: output_addr_const (asmfile, current_sym_addr);
878: else
879: fprintf (asmfile, "%d", current_sym_value);
880: putc ('\n', asmfile);
881: }
882:
883: /* Output definitions of all the decls in a chain. */
884:
885: static void
886: dbxout_syms (syms)
887: tree syms;
888: {
889: while (syms)
890: {
891: dbxout_symbol (syms, 1);
892: syms = TREE_CHAIN (syms);
893: }
894: }
895:
896: /* The following two functions output definitions of function parameters.
897: Each parameter gets a definition locating it in the parameter list.
898: Each parameter that is a register variable gets a second definition
899: locating it in the register.
900:
901: Printing or argument lists in gdb uses the definitions that
902: locate in the parameter list. But reference to the variable in
903: expressions uses preferentially the definition as a register. */
904:
905: /* Output definitions, referring to storage in the parmlist,
906: of all the parms in PARMS, which is a chain of PARM_DECL nodes. */
907:
908: static void
909: dbxout_parms (parms)
910: tree parms;
911: {
912: for (; parms; parms = TREE_CHAIN (parms))
913: {
1.1.1.2 root 914: if (DECL_OFFSET (parms) >= 0)
915: {
916: current_sym_code = N_PSYM;
917: current_sym_value = DECL_OFFSET (parms) / BITS_PER_UNIT;
918: current_sym_addr = 0;
919: current_sym_nchars = 2 + strlen (IDENTIFIER_POINTER (DECL_NAME (parms)));
920:
1.1.1.9 root 921: FORCE_TEXT;
1.1.1.2 root 922: fprintf (asmfile, ".stabs \"%s:p",
923: IDENTIFIER_POINTER (DECL_NAME (parms)));
924:
925: if (GET_CODE (DECL_RTL (parms)) == REG
926: && REGNO (DECL_RTL (parms)) >= 0
927: && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
928: dbxout_type (DECL_ARG_TYPE (parms), 0);
929: else
930: {
931: /* This is the case where the parm is passed as an int or double
932: and it is converted to a char, short or float and stored back
933: in the parmlist. In this case, describe the parm
934: with the variable's declared type, and adjust the address
935: if the least significant bytes (which we are using) are not
936: the first ones. */
1.1 root 937: #ifdef BYTES_BIG_ENDIAN
1.1.1.2 root 938: if (TREE_TYPE (parms) != DECL_ARG_TYPE (parms))
939: current_sym_value += (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parms)))
940: - GET_MODE_SIZE (GET_MODE (DECL_RTL (parms))));
1.1 root 941: #endif
942:
1.1.1.2 root 943: if (GET_CODE (DECL_RTL (parms)) == MEM
944: && GET_CODE (XEXP (DECL_RTL (parms), 0)) == PLUS
945: && GET_CODE (XEXP (XEXP (DECL_RTL (parms), 0), 1)) == CONST_INT
946: && INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1)) == current_sym_value)
947: dbxout_type (TREE_TYPE (parms), 0);
948: else
949: {
950: current_sym_value = DECL_OFFSET (parms) / BITS_PER_UNIT;
951: dbxout_type (DECL_ARG_TYPE (parms), 0);
952: }
953: }
954: dbxout_finish_symbol ();
955: }
956: /* Parm was passed in registers.
1.1.1.4 root 957: If it lives in a hard register, output a "regparm" symbol
1.1.1.2 root 958: for the register it lives in. */
1.1.1.4 root 959: else if (GET_CODE (DECL_RTL (parms)) == REG
960: && REGNO (DECL_RTL (parms)) >= 0
961: && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
1.1.1.2 root 962: {
963: current_sym_code = N_RSYM;
964: current_sym_value = DBX_REGISTER_NUMBER (REGNO (DECL_RTL (parms)));
965: current_sym_addr = 0;
966: current_sym_nchars = 2 + strlen (IDENTIFIER_POINTER (DECL_NAME (parms)));
967:
1.1.1.9 root 968: FORCE_TEXT;
1.1.1.2 root 969: fprintf (asmfile, ".stabs \"%s:P",
970: IDENTIFIER_POINTER (DECL_NAME (parms)));
971:
972: dbxout_type (DECL_ARG_TYPE (parms), 0);
973: dbxout_finish_symbol ();
974: }
975: else if (GET_CODE (DECL_RTL (parms)) == MEM
976: && XEXP (DECL_RTL (parms), 0) != const0_rtx)
977: {
978: current_sym_code = N_LSYM;
979: /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))).
980: We want the value of that CONST_INT. */
981: current_sym_value = INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1));
982: current_sym_addr = 0;
983: current_sym_nchars = 2 + strlen (IDENTIFIER_POINTER (DECL_NAME (parms)));
984:
1.1.1.9 root 985: FORCE_TEXT;
1.1.1.2 root 986: fprintf (asmfile, ".stabs \"%s:p",
987: IDENTIFIER_POINTER (DECL_NAME (parms)));
988:
1.1.1.14 root 989: #if 0 /* This is actually the case in which a parameter
990: is passed in registers but lives on the stack in a local slot.
991: The address we are using is already correct, so don't change it. */
992:
1.1.1.2 root 993: /* This is the case where the parm is passed as an int or double
994: and it is converted to a char, short or float and stored back
995: in the parmlist. In this case, describe the parm
996: with the variable's declared type, and adjust the address
997: if the least significant bytes (which we are using) are not
998: the first ones. */
999: #ifdef BYTES_BIG_ENDIAN
1000: if (TREE_TYPE (parms) != DECL_ARG_TYPE (parms))
1001: current_sym_value += (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parms)))
1002: - GET_MODE_SIZE (GET_MODE (DECL_RTL (parms))));
1003: #endif
1.1.1.14 root 1004: #endif /* 0 */
1.1.1.2 root 1005:
1006: dbxout_type (TREE_TYPE (parms), 0);
1007: dbxout_finish_symbol ();
1008: }
1.1 root 1009: }
1010: }
1011:
1012: /* Output definitions, referring to registers,
1013: of all the parms in PARMS which are stored in registers during the function.
1014: PARMS is a chain of PARM_DECL nodes. */
1015:
1016: static void
1017: dbxout_reg_parms (parms)
1018: tree parms;
1019: {
1020: while (parms)
1021: {
1.1.1.2 root 1022: /* Report parms that live in registers during the function. */
1.1 root 1023: if (GET_CODE (DECL_RTL (parms)) == REG
1.1.1.2 root 1024: && REGNO (DECL_RTL (parms)) >= 0
1025: && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER
1026: && DECL_OFFSET (parms) >= 0)
1.1 root 1027: {
1028: current_sym_code = N_RSYM;
1029: current_sym_value = DBX_REGISTER_NUMBER (REGNO (DECL_RTL (parms)));
1030: current_sym_addr = 0;
1.1.1.6 root 1031: current_sym_nchars = 2 + IDENTIFIER_LENGTH (DECL_NAME (parms));
1.1.1.9 root 1032: FORCE_TEXT;
1.1 root 1033: fprintf (asmfile, ".stabs \"%s:r",
1034: IDENTIFIER_POINTER (DECL_NAME (parms)));
1035: dbxout_type (TREE_TYPE (parms), 0);
1036: dbxout_finish_symbol ();
1037: }
1.1.1.2 root 1038: /* Report parms that live in memory but outside the parmlist. */
1039: else if (GET_CODE (DECL_RTL (parms)) == MEM
1040: && GET_CODE (XEXP (DECL_RTL (parms), 0)) == PLUS
1041: && GET_CODE (XEXP (XEXP (DECL_RTL (parms), 0), 1)) == CONST_INT)
1042: {
1043: int offset = DECL_OFFSET (parms) / BITS_PER_UNIT;
1044: /* A parm declared char is really passed as an int,
1045: so it occupies the least significant bytes.
1046: On a big-endian machine those are not the low-numbered ones. */
1047: #ifdef BYTES_BIG_ENDIAN
1048: if (offset != -1 && TREE_TYPE (parms) != DECL_ARG_TYPE (parms))
1049: offset += (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parms)))
1050: - GET_MODE_SIZE (GET_MODE (DECL_RTL (parms))));
1051: #endif
1052: if (INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1)) != offset)
1053: {
1054: current_sym_code = N_LSYM;
1055: current_sym_value = INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1));
1056: current_sym_addr = 0;
1.1.1.6 root 1057: current_sym_nchars = 2 + IDENTIFIER_LENGTH (DECL_NAME (parms));
1.1.1.9 root 1058: FORCE_TEXT;
1.1.1.2 root 1059: fprintf (asmfile, ".stabs \"%s:",
1060: IDENTIFIER_POINTER (DECL_NAME (parms)));
1061: dbxout_type (TREE_TYPE (parms), 0);
1062: dbxout_finish_symbol ();
1063: }
1064: }
1.1 root 1065: parms = TREE_CHAIN (parms);
1066: }
1067: }
1068:
1.1.1.6 root 1069: /* Given a chain of ..._TYPE nodes (as come in a parameter list),
1070: output definitions of those names, in raw form */
1071:
1072: void
1073: dbxout_args (args)
1074: tree args;
1075: {
1076: while (args)
1077: {
1078: putc (',', asmfile);
1079: dbxout_type (TREE_VALUE (args), 0);
1080: CHARS (1);
1081: args = TREE_CHAIN (args);
1082: }
1083: }
1084:
1.1.1.7 root 1085: /* Given a chain of ..._TYPE nodes,
1086: find those which have typedef names and output those names.
1087: This is to ensure those types get output. */
1.1 root 1088:
1089: void
1090: dbxout_types (types)
1091: register tree types;
1092: {
1093: while (types)
1094: {
1095: if (TYPE_NAME (types)
1.1.1.7 root 1096: && TREE_CODE (TYPE_NAME (types)) == TYPE_DECL
1097: && ! TREE_ASM_WRITTEN (TYPE_NAME (types)))
1098: dbxout_symbol (TYPE_NAME (types), 1);
1.1 root 1099: types = TREE_CHAIN (types);
1100: }
1101: }
1102:
1103: /* Output the tags (struct, union and enum definitions with names) for a block,
1104: given a list of them (a chain of TREE_LIST nodes) in TAGS.
1105: We must check to include those that have been mentioned already with
1106: only a cross-reference. */
1107:
1108: void
1109: dbxout_tags (tags)
1110: tree tags;
1111: {
1112: register tree link;
1113: for (link = tags; link; link = TREE_CHAIN (link))
1114: {
1.1.1.2 root 1115: register tree type = TYPE_MAIN_VARIANT (TREE_VALUE (link));
1.1 root 1116: if (TREE_PURPOSE (link) != 0
1.1.1.2 root 1117: && ! TREE_ASM_WRITTEN (link)
1.1 root 1118: && TYPE_SIZE (type) != 0)
1119: {
1.1.1.2 root 1120: TREE_ASM_WRITTEN (link) = 1;
1.1 root 1121: current_sym_code = N_LSYM;
1122: current_sym_value = 0;
1123: current_sym_addr = 0;
1.1.1.6 root 1124: current_sym_nchars = 2 + IDENTIFIER_LENGTH (TREE_PURPOSE (link));
1.1 root 1125:
1.1.1.9 root 1126: FORCE_TEXT;
1.1 root 1127: fprintf (asmfile, ".stabs \"%s:T",
1128: IDENTIFIER_POINTER (TREE_PURPOSE (link)));
1129: dbxout_type (type, 1);
1130: dbxout_finish_symbol ();
1131: }
1132: }
1133: }
1134:
1135: /* Output everything about a symbol block (that is to say, a LET_STMT node
1136: that represents a scope level),
1137: including recursive output of contained blocks.
1138:
1139: STMT is the LET_STMT node.
1140: DEPTH is its depth within containing symbol blocks.
1141: ARGS is usually zero; but for the outermost block of the
1142: body of a function, it is a chain of PARM_DECLs for the function parameters.
1143: We output definitions of all the register parms
1144: as if they were local variables of that block.
1145:
1146: Actually, STMT may be several statements chained together.
1147: We handle them all in sequence. */
1148:
1149: static void
1150: dbxout_block (stmt, depth, args)
1151: register tree stmt;
1152: int depth;
1.1.1.2 root 1153: tree args;
1.1 root 1154: {
1155: int blocknum;
1156:
1157: while (stmt)
1158: {
1159: switch (TREE_CODE (stmt))
1160: {
1161: case COMPOUND_STMT:
1162: case LOOP_STMT:
1163: dbxout_block (STMT_BODY (stmt), depth, 0);
1164: break;
1165:
1166: case IF_STMT:
1167: dbxout_block (STMT_THEN (stmt), depth, 0);
1168: dbxout_block (STMT_ELSE (stmt), depth, 0);
1169: break;
1170:
1171: case LET_STMT:
1.1.1.14 root 1172: /* Ignore LET_STMTs for blocks never really used to make RTL. */
1173: if (! TREE_USED (stmt))
1174: break;
1.1 root 1175: /* In dbx format, the syms of a block come before the N_LBRAC. */
1176: dbxout_tags (STMT_TYPE_TAGS (stmt));
1.1.1.2 root 1177: dbxout_syms (STMT_VARS (stmt));
1.1 root 1178: if (args)
1179: dbxout_reg_parms (args);
1180:
1181: /* Now output an N_LBRAC symbol to represent the beginning of
1182: the block. Use the block's tree-walk order to generate
1183: the assembler symbols LBBn and LBEn
1184: that final will define around the code in this block. */
1185: if (depth > 0)
1186: {
1.1.1.13 root 1187: char buf[20];
1.1 root 1188: blocknum = next_block_number++;
1.1.1.13 root 1189: ASM_GENERATE_INTERNAL_LABEL (buf, "LBB", blocknum);
1190: fprintf (asmfile, ".stabn %d,0,0,", N_LBRAC);
1191: assemble_name (asmfile, buf);
1192: fprintf (asmfile, "\n");
1.1 root 1193: }
1194:
1.1.1.14 root 1195: /* Output the subblocks. */
1196: dbxout_block (STMT_SUBBLOCKS (stmt), depth + 1, 0);
1.1 root 1197:
1198: /* Refer to the marker for the end of the block. */
1199: if (depth > 0)
1.1.1.13 root 1200: {
1201: char buf[20];
1202: ASM_GENERATE_INTERNAL_LABEL (buf, "LBE", blocknum);
1203: fprintf (asmfile, ".stabn %d,0,0,", N_RBRAC);
1204: assemble_name (asmfile, buf);
1205: fprintf (asmfile, "\n");
1206: }
1.1 root 1207: }
1208: stmt = TREE_CHAIN (stmt);
1209: }
1210: }
1211:
1212: /* Output dbx data for a function definition.
1213: This includes a definition of the function name itself (a symbol),
1214: definitions of the parameters (locating them in the parameter list)
1215: and then output the block that makes up the function's body
1216: (including all the auto variables of the function). */
1217:
1218: void
1219: dbxout_function (decl)
1220: tree decl;
1221: {
1222: dbxout_symbol (decl, 0);
1223: dbxout_parms (DECL_ARGUMENTS (decl));
1224: dbxout_block (DECL_INITIAL (decl), 0, DECL_ARGUMENTS (decl));
1.1.1.13 root 1225:
1226: /* If we made any temporary types in this fn that weren't
1227: output, output them now. */
1228: dbxout_types (get_temporary_types ());
1.1 root 1229: }
1.1.1.2 root 1230:
1.1.1.4 root 1231: #else /* not DBX_DEBUGGING_INFO */
1.1.1.2 root 1232:
1233: void
1234: dbxout_init (asm_file, input_file_name)
1235: FILE *asm_file;
1236: char *input_file_name;
1237: {}
1238:
1239: void
1240: dbxout_symbol (decl, local)
1241: tree decl;
1242: int local;
1243: {}
1244:
1245: void
1246: dbxout_types (types)
1247: register tree types;
1248: {}
1249:
1250: void
1251: dbxout_tags (tags)
1252: tree tags;
1253: {}
1254:
1255: void
1256: dbxout_function (decl)
1257: tree decl;
1258: {}
1259:
1.1.1.4 root 1260: #endif /* DBX_DEBUGGING_INFO */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.