Deleted Added
full compact
dwarf2out.c (50397) dwarf2out.c (52284)
1/* Output Dwarf2 format symbol table information from the GNU C compiler.
1/* Output Dwarf2 format symbol table information from the GNU C compiler.
2 Copyright (C) 1992, 93, 95, 96, 97, 1998 Free Software Foundation, Inc.
2 Copyright (C) 1992, 93, 95-98, 1999 Free Software Foundation, Inc.
3 Contributed by Gary Funck (gary@intrepid.com).
4 Derived from DWARF 1 implementation of Ron Guilmette (rfg@monkeys.com).
5 Extensively modified by Jason Merrill (jason@cygnus.com).
6
7This file is part of GNU CC.
8
9GNU CC is free software; you can redistribute it and/or modify
10it under the terms of the GNU General Public License as published by
11the Free Software Foundation; either version 2, or (at your option)
12any later version.
13
14GNU CC is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with GNU CC; see the file COPYING. If not, write to
3 Contributed by Gary Funck (gary@intrepid.com).
4 Derived from DWARF 1 implementation of Ron Guilmette (rfg@monkeys.com).
5 Extensively modified by Jason Merrill (jason@cygnus.com).
6
7This file is part of GNU CC.
8
9GNU CC is free software; you can redistribute it and/or modify
10it under the terms of the GNU General Public License as published by
11the Free Software Foundation; either version 2, or (at your option)
12any later version.
13
14GNU CC is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with GNU CC; see the file COPYING. If not, write to
21the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
21the Free Software Foundation, 59 Temple Place - Suite 330,
22Boston, MA 02111-1307, USA. */
22
23/* The first part of this file deals with the DWARF 2 frame unwind
24 information, which is also used by the GCC efficient exception handling
25 mechanism. The second part, controlled only by an #ifdef
26 DWARF2_DEBUGGING_INFO, deals with the other DWARF 2 debugging
27 information. */
28
29#include "config.h"

--- 36 unchanged lines hidden (view full) ---

66#ifdef DWARF2_UNWIND_INFO
67 || (flag_exceptions && ! exceptions_via_longjmp)
68#endif
69 );
70}
71
72#if defined (DWARF2_DEBUGGING_INFO) || defined (DWARF2_UNWIND_INFO)
73
23
24/* The first part of this file deals with the DWARF 2 frame unwind
25 information, which is also used by the GCC efficient exception handling
26 mechanism. The second part, controlled only by an #ifdef
27 DWARF2_DEBUGGING_INFO, deals with the other DWARF 2 debugging
28 information. */
29
30#include "config.h"

--- 36 unchanged lines hidden (view full) ---

67#ifdef DWARF2_UNWIND_INFO
68 || (flag_exceptions && ! exceptions_via_longjmp)
69#endif
70 );
71}
72
73#if defined (DWARF2_DEBUGGING_INFO) || defined (DWARF2_UNWIND_INFO)
74
74#ifndef __GNUC__
75#define inline
76#endif
77
78/* How to start an assembler comment. */
79#ifndef ASM_COMMENT_START
80#define ASM_COMMENT_START ";#"
81#endif
82
83typedef struct dw_cfi_struct *dw_cfi_ref;
84typedef struct dw_fde_struct *dw_fde_ref;
85typedef union dw_cfi_oprnd_struct *dw_cfi_oprnd_ref;

--- 255 unchanged lines hidden (view full) ---

341
342#ifndef ASM_OUTPUT_DWARF_ADDR
343#define ASM_OUTPUT_DWARF_ADDR(FILE,LABEL) \
344 do { fprintf ((FILE), "\t%s\t", UNALIGNED_WORD_ASM_OP); \
345 assemble_name (FILE, LABEL); \
346 } while (0)
347#endif
348
75/* How to start an assembler comment. */
76#ifndef ASM_COMMENT_START
77#define ASM_COMMENT_START ";#"
78#endif
79
80typedef struct dw_cfi_struct *dw_cfi_ref;
81typedef struct dw_fde_struct *dw_fde_ref;
82typedef union dw_cfi_oprnd_struct *dw_cfi_oprnd_ref;

--- 255 unchanged lines hidden (view full) ---

338
339#ifndef ASM_OUTPUT_DWARF_ADDR
340#define ASM_OUTPUT_DWARF_ADDR(FILE,LABEL) \
341 do { fprintf ((FILE), "\t%s\t", UNALIGNED_WORD_ASM_OP); \
342 assemble_name (FILE, LABEL); \
343 } while (0)
344#endif
345
346/* ??? This macro takes an RTX in dwarfout.c and a string in dwarf2out.c.
347 We resolve the conflict by creating a new macro ASM_OUTPUT_DWARF2_ADDR_CONST
348 for ports that want to support both DWARF1 and DWARF2. This needs a better
349 solution. See also the comments in sparc/sp64-elf.h. */
350#ifdef ASM_OUTPUT_DWARF2_ADDR_CONST
351#undef ASM_OUTPUT_DWARF_ADDR_CONST
352#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,ADDR) \
353 ASM_OUTPUT_DWARF2_ADDR_CONST (FILE, ADDR)
354#endif
355
349#ifndef ASM_OUTPUT_DWARF_ADDR_CONST
350#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,ADDR) \
351 fprintf ((FILE), "\t%s\t%s", UNALIGNED_WORD_ASM_OP, (ADDR))
352#endif
353
354#ifndef ASM_OUTPUT_DWARF_OFFSET4
355#define ASM_OUTPUT_DWARF_OFFSET4(FILE,LABEL) \
356 do { fprintf ((FILE), "\t%s\t", UNALIGNED_INT_ASM_OP); \

--- 270 unchanged lines hidden (view full) ---

627 build_int_2 (DWARF_FRAME_REGNUM (ranges[1].end), 0)));
628 t = fold (build (TRUTH_ANDIF_EXPR, integer_type_node, t, t2));
629 t = fold (build (COND_EXPR, integer_type_node, t,
630 build_int_2 (ranges[1].size, 0),
631 build_int_2 (ranges[0].size, 0)));
632 }
633 else
634 {
356#ifndef ASM_OUTPUT_DWARF_ADDR_CONST
357#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,ADDR) \
358 fprintf ((FILE), "\t%s\t%s", UNALIGNED_WORD_ASM_OP, (ADDR))
359#endif
360
361#ifndef ASM_OUTPUT_DWARF_OFFSET4
362#define ASM_OUTPUT_DWARF_OFFSET4(FILE,LABEL) \
363 do { fprintf ((FILE), "\t%s\t", UNALIGNED_INT_ASM_OP); \

--- 270 unchanged lines hidden (view full) ---

634 build_int_2 (DWARF_FRAME_REGNUM (ranges[1].end), 0)));
635 t = fold (build (TRUTH_ANDIF_EXPR, integer_type_node, t, t2));
636 t = fold (build (COND_EXPR, integer_type_node, t,
637 build_int_2 (ranges[1].size, 0),
638 build_int_2 (ranges[0].size, 0)));
639 }
640 else
641 {
642 /* Initialize last_end to be larger than any possible
643 DWARF_FRAME_REGNUM. */
644 int last_end = 0x7fffffff;
635 --n_ranges;
636 t = build_int_2 (ranges[n_ranges].size, 0);
645 --n_ranges;
646 t = build_int_2 (ranges[n_ranges].size, 0);
637 size = DWARF_FRAME_REGNUM (ranges[n_ranges].beg);
638 for (; n_ranges--; )
647 do
639 {
648 {
640 if ((DWARF_FRAME_REGNUM (ranges[n_ranges].end)
641 - DWARF_FRAME_REGNUM (ranges[n_ranges].beg))
642 != ranges[n_ranges].end - ranges[n_ranges].beg)
649 int beg = DWARF_FRAME_REGNUM (ranges[n_ranges].beg);
650 int end = DWARF_FRAME_REGNUM (ranges[n_ranges].end);
651 if (beg < 0)
652 continue;
653 if (end >= last_end)
643 abort ();
654 abort ();
644 if (DWARF_FRAME_REGNUM (ranges[n_ranges].beg) >= size)
655 last_end = end;
656 if (end - beg != ranges[n_ranges].end - ranges[n_ranges].beg)
645 abort ();
657 abort ();
646 size = DWARF_FRAME_REGNUM (ranges[n_ranges].beg);
647 t2 = fold (build (LE_EXPR, integer_type_node, reg_tree,
658 t2 = fold (build (LE_EXPR, integer_type_node, reg_tree,
648 build_int_2 (DWARF_FRAME_REGNUM
649 (ranges[n_ranges].end), 0)));
659 build_int_2 (end, 0)));
650 t = fold (build (COND_EXPR, integer_type_node, t2,
651 build_int_2 (ranges[n_ranges].size, 0), t));
652 }
660 t = fold (build (COND_EXPR, integer_type_node, t2,
661 build_int_2 (ranges[n_ranges].size, 0), t));
662 }
663 while (--n_ranges >= 0);
653 }
654 return expand_expr (t, target, Pmode, 0);
655}
656
657/* Convert a DWARF call frame info. operation to its string name */
658
659static char *
660dwarf_cfi_name (cfi_opc)

--- 360 unchanged lines hidden (view full) ---

1021
1022/* Record the initial position of the return address. RTL is
1023 INCOMING_RETURN_ADDR_RTX. */
1024
1025static void
1026initial_return_save (rtl)
1027 register rtx rtl;
1028{
664 }
665 return expand_expr (t, target, Pmode, 0);
666}
667
668/* Convert a DWARF call frame info. operation to its string name */
669
670static char *
671dwarf_cfi_name (cfi_opc)

--- 360 unchanged lines hidden (view full) ---

1032
1033/* Record the initial position of the return address. RTL is
1034 INCOMING_RETURN_ADDR_RTX. */
1035
1036static void
1037initial_return_save (rtl)
1038 register rtx rtl;
1039{
1029 unsigned reg = -1;
1040 unsigned int reg = (unsigned int) -1;
1030 long offset = 0;
1031
1032 switch (GET_CODE (rtl))
1033 {
1034 case REG:
1035 /* RA is in a register. */
1036 reg = reg_number (rtl);
1037 break;

--- 132 unchanged lines hidden (view full) ---

1170 if (args_size < 0)
1171 args_size = 0;
1172
1173 label = dwarf2out_cfi_label ();
1174 dwarf2out_def_cfa (label, cfa_reg, cfa_offset);
1175 dwarf2out_args_size (label, args_size);
1176}
1177
1041 long offset = 0;
1042
1043 switch (GET_CODE (rtl))
1044 {
1045 case REG:
1046 /* RA is in a register. */
1047 reg = reg_number (rtl);
1048 break;

--- 132 unchanged lines hidden (view full) ---

1181 if (args_size < 0)
1182 args_size = 0;
1183
1184 label = dwarf2out_cfi_label ();
1185 dwarf2out_def_cfa (label, cfa_reg, cfa_offset);
1186 dwarf2out_args_size (label, args_size);
1187}
1188
1178/* Record call frame debugging information for INSN, which either
1189/* A temporary register used in adjusting SP or setting up the store_reg. */
1190static unsigned cfa_temp_reg;
1191
1192/* A temporary value used in adjusting SP or setting up the store_reg. */
1193static long cfa_temp_value;
1194
1195/* Record call frame debugging information for an expression, which either
1179 sets SP or FP (adjusting how we calculate the frame address) or saves a
1196 sets SP or FP (adjusting how we calculate the frame address) or saves a
1180 register to the stack. If INSN is NULL_RTX, initialize our state. */
1197 register to the stack. */
1181
1198
1182void
1183dwarf2out_frame_debug (insn)
1184 rtx insn;
1199static void
1200dwarf2out_frame_debug_expr (expr, label)
1201 rtx expr;
1202 char *label;
1185{
1203{
1186 char *label;
1187 rtx src, dest;
1188 long offset;
1204 rtx src, dest;
1205 long offset;
1206
1207 /* If RTX_FRAME_RELATED_P is set on a PARALLEL, process each member of
1208 the PARALLEL independantly. The first element is always processed if
1209 it is a SET. This is for backward compatability. Other elements
1210 are processed only if they are SETs and the RTX_FRAME_RELATED_P
1211 flag is set in them. */
1189
1212
1190 /* A temporary register used in adjusting SP or setting up the store_reg. */
1191 static unsigned cfa_temp_reg;
1192 static long cfa_temp_value;
1213 if (GET_CODE (expr) == PARALLEL)
1214 {
1215 int par_index;
1216 int limit = XVECLEN (expr, 0);
1193
1217
1194 if (insn == NULL_RTX)
1195 {
1196 /* Set up state for generating call frame debug info. */
1197 lookup_cfa (&cfa_reg, &cfa_offset);
1198 if (cfa_reg != DWARF_FRAME_REGNUM (STACK_POINTER_REGNUM))
1199 abort ();
1200 cfa_reg = STACK_POINTER_REGNUM;
1201 cfa_store_reg = cfa_reg;
1202 cfa_store_offset = cfa_offset;
1203 cfa_temp_reg = -1;
1204 cfa_temp_value = 0;
1218 for (par_index = 0; par_index < limit; par_index++)
1219 {
1220 rtx x = XVECEXP (expr, 0, par_index);
1221
1222 if (GET_CODE (x) == SET &&
1223 (RTX_FRAME_RELATED_P (x) || par_index == 0))
1224 dwarf2out_frame_debug_expr (x, label);
1225 }
1205 return;
1206 }
1226 return;
1227 }
1207
1208 if (! RTX_FRAME_RELATED_P (insn))
1209 {
1210 dwarf2out_stack_adjust (insn);
1211 return;
1212 }
1213
1214 label = dwarf2out_cfi_label ();
1215
1216 insn = PATTERN (insn);
1217 /* Assume that in a PARALLEL prologue insn, only the first elt is
1218 significant. Currently this is true. */
1219 if (GET_CODE (insn) == PARALLEL)
1220 insn = XVECEXP (insn, 0, 0);
1221 if (GET_CODE (insn) != SET)
1228
1229 if (GET_CODE (expr) != SET)
1222 abort ();
1223
1230 abort ();
1231
1224 src = SET_SRC (insn);
1225 dest = SET_DEST (insn);
1232 src = SET_SRC (expr);
1233 dest = SET_DEST (expr);
1226
1227 switch (GET_CODE (dest))
1228 {
1229 case REG:
1230 /* Update the CFA rule wrt SP or FP. Make sure src is
1234
1235 switch (GET_CODE (dest))
1236 {
1237 case REG:
1238 /* Update the CFA rule wrt SP or FP. Make sure src is
1231 relative to the current CFA register. */
1239 relative to the current CFA register. */
1232 switch (GET_CODE (src))
1240 switch (GET_CODE (src))
1233 {
1234 /* Setting FP from SP. */
1235 case REG:
1236 if (cfa_reg != REGNO (src))
1237 abort ();
1238 if (REGNO (dest) != STACK_POINTER_REGNUM
1239 && !(frame_pointer_needed
1240 && REGNO (dest) == HARD_FRAME_POINTER_REGNUM))
1241 abort ();
1242 cfa_reg = REGNO (dest);
1243 break;
1241 {
1242 /* Setting FP from SP. */
1243 case REG:
1244 if (cfa_reg != (unsigned) REGNO (src))
1245 abort ();
1246 if (REGNO (dest) != STACK_POINTER_REGNUM
1247 && !(frame_pointer_needed
1248 && REGNO (dest) == HARD_FRAME_POINTER_REGNUM))
1249 abort ();
1250 cfa_reg = REGNO (dest);
1251 break;
1244
1252
1245 case PLUS:
1246 case MINUS:
1247 if (dest == stack_pointer_rtx)
1248 {
1249 /* Adjusting SP. */
1250 switch (GET_CODE (XEXP (src, 1)))
1251 {
1252 case CONST_INT:
1253 offset = INTVAL (XEXP (src, 1));
1254 break;
1255 case REG:
1256 if (REGNO (XEXP (src, 1)) != cfa_temp_reg)
1257 abort ();
1258 offset = cfa_temp_value;
1259 break;
1260 default:
1261 abort ();
1262 }
1253 case PLUS:
1254 case MINUS:
1255 if (dest == stack_pointer_rtx)
1256 {
1257 /* Adjusting SP. */
1258 switch (GET_CODE (XEXP (src, 1)))
1259 {
1260 case CONST_INT:
1261 offset = INTVAL (XEXP (src, 1));
1262 break;
1263 case REG:
1264 if ((unsigned) REGNO (XEXP (src, 1)) != cfa_temp_reg)
1265 abort ();
1266 offset = cfa_temp_value;
1267 break;
1268 default:
1269 abort ();
1270 }
1263
1271
1264 if (XEXP (src, 0) == hard_frame_pointer_rtx)
1265 {
1266 /* Restoring SP from FP in the epilogue. */
1267 if (cfa_reg != HARD_FRAME_POINTER_REGNUM)
1268 abort ();
1269 cfa_reg = STACK_POINTER_REGNUM;
1270 }
1271 else if (XEXP (src, 0) != stack_pointer_rtx)
1272 abort ();
1272 if (XEXP (src, 0) == hard_frame_pointer_rtx)
1273 {
1274 /* Restoring SP from FP in the epilogue. */
1275 if (cfa_reg != (unsigned) HARD_FRAME_POINTER_REGNUM)
1276 abort ();
1277 cfa_reg = STACK_POINTER_REGNUM;
1278 }
1279 else if (XEXP (src, 0) != stack_pointer_rtx)
1280 abort ();
1273
1281
1274 if (GET_CODE (src) == PLUS)
1275 offset = -offset;
1276 if (cfa_reg == STACK_POINTER_REGNUM)
1277 cfa_offset += offset;
1278 if (cfa_store_reg == STACK_POINTER_REGNUM)
1279 cfa_store_offset += offset;
1280 }
1282 if (GET_CODE (src) == PLUS)
1283 offset = -offset;
1284 if (cfa_reg == STACK_POINTER_REGNUM)
1285 cfa_offset += offset;
1286 if (cfa_store_reg == STACK_POINTER_REGNUM)
1287 cfa_store_offset += offset;
1288 }
1281 else if (dest == hard_frame_pointer_rtx)
1282 {
1289 else if (dest == hard_frame_pointer_rtx)
1290 {
1283 /* Either setting the FP from an offset of the SP,
1284 or adjusting the FP */
1285 if (! frame_pointer_needed
1286 || REGNO (dest) != HARD_FRAME_POINTER_REGNUM)
1287 abort ();
1291 /* Either setting the FP from an offset of the SP,
1292 or adjusting the FP */
1293 if (! frame_pointer_needed
1294 || REGNO (dest) != HARD_FRAME_POINTER_REGNUM)
1295 abort ();
1288
1296
1289 if (XEXP (src, 0) == stack_pointer_rtx
1290 && GET_CODE (XEXP (src, 1)) == CONST_INT)
1291 {
1292 if (cfa_reg != STACK_POINTER_REGNUM)
1293 abort ();
1294 offset = INTVAL (XEXP (src, 1));
1295 if (GET_CODE (src) == PLUS)
1296 offset = -offset;
1297 cfa_offset += offset;
1298 cfa_reg = HARD_FRAME_POINTER_REGNUM;
1299 }
1300 else if (XEXP (src, 0) == hard_frame_pointer_rtx
1301 && GET_CODE (XEXP (src, 1)) == CONST_INT)
1302 {
1303 if (cfa_reg != HARD_FRAME_POINTER_REGNUM)
1304 abort ();
1305 offset = INTVAL (XEXP (src, 1));
1306 if (GET_CODE (src) == PLUS)
1307 offset = -offset;
1308 cfa_offset += offset;
1309 }
1297 if (XEXP (src, 0) == stack_pointer_rtx
1298 && GET_CODE (XEXP (src, 1)) == CONST_INT)
1299 {
1300 if (cfa_reg != STACK_POINTER_REGNUM)
1301 abort ();
1302 offset = INTVAL (XEXP (src, 1));
1303 if (GET_CODE (src) == PLUS)
1304 offset = -offset;
1305 cfa_offset += offset;
1306 cfa_reg = HARD_FRAME_POINTER_REGNUM;
1307 }
1308 else if (XEXP (src, 0) == hard_frame_pointer_rtx
1309 && GET_CODE (XEXP (src, 1)) == CONST_INT)
1310 {
1311 if (cfa_reg != (unsigned) HARD_FRAME_POINTER_REGNUM)
1312 abort ();
1313 offset = INTVAL (XEXP (src, 1));
1314 if (GET_CODE (src) == PLUS)
1315 offset = -offset;
1316 cfa_offset += offset;
1317 }
1310
1318
1311 else
1312 abort();
1319 else
1320 abort();
1313 }
1321 }
1314 else
1315 {
1316 if (GET_CODE (src) != PLUS
1317 || XEXP (src, 1) != stack_pointer_rtx)
1318 abort ();
1319 if (GET_CODE (XEXP (src, 0)) != REG
1320 || REGNO (XEXP (src, 0)) != cfa_temp_reg)
1321 abort ();
1322 if (cfa_reg != STACK_POINTER_REGNUM)
1323 abort ();
1324 cfa_store_reg = REGNO (dest);
1325 cfa_store_offset = cfa_offset - cfa_temp_value;
1326 }
1327 break;
1322 else
1323 {
1324 if (GET_CODE (src) != PLUS
1325 || XEXP (src, 1) != stack_pointer_rtx)
1326 abort ();
1327 if (GET_CODE (XEXP (src, 0)) != REG
1328 || (unsigned) REGNO (XEXP (src, 0)) != cfa_temp_reg)
1329 abort ();
1330 if (cfa_reg != STACK_POINTER_REGNUM)
1331 abort ();
1332 cfa_store_reg = REGNO (dest);
1333 cfa_store_offset = cfa_offset - cfa_temp_value;
1334 }
1335 break;
1328
1336
1329 case CONST_INT:
1330 cfa_temp_reg = REGNO (dest);
1331 cfa_temp_value = INTVAL (src);
1332 break;
1337 case CONST_INT:
1338 cfa_temp_reg = REGNO (dest);
1339 cfa_temp_value = INTVAL (src);
1340 break;
1333
1341
1334 case IOR:
1335 if (GET_CODE (XEXP (src, 0)) != REG
1336 || REGNO (XEXP (src, 0)) != cfa_temp_reg
1337 || REGNO (dest) != cfa_temp_reg
1338 || GET_CODE (XEXP (src, 1)) != CONST_INT)
1339 abort ();
1340 cfa_temp_value |= INTVAL (XEXP (src, 1));
1341 break;
1342 case IOR:
1343 if (GET_CODE (XEXP (src, 0)) != REG
1344 || (unsigned) REGNO (XEXP (src, 0)) != cfa_temp_reg
1345 || (unsigned) REGNO (dest) != cfa_temp_reg
1346 || GET_CODE (XEXP (src, 1)) != CONST_INT)
1347 abort ();
1348 cfa_temp_value |= INTVAL (XEXP (src, 1));
1349 break;
1342
1350
1343 default:
1344 abort ();
1345 }
1351 default:
1352 abort ();
1353 }
1346 dwarf2out_def_cfa (label, cfa_reg, cfa_offset);
1354 dwarf2out_def_cfa (label, cfa_reg, cfa_offset);
1347 break;
1355 break;
1348
1356
1349 case MEM:
1350 /* Saving a register to the stack. Make sure dest is relative to the
1351 CFA register. */
1352 if (GET_CODE (src) != REG)
1353 abort ();
1354 switch (GET_CODE (XEXP (dest, 0)))
1355 {
1356 /* With a push. */
1357 case PRE_INC:
1358 case PRE_DEC:
1359 offset = GET_MODE_SIZE (GET_MODE (dest));
1360 if (GET_CODE (XEXP (dest, 0)) == PRE_INC)
1361 offset = -offset;
1357 case MEM:
1358 /* Saving a register to the stack. Make sure dest is relative to the
1359 CFA register. */
1360 if (GET_CODE (src) != REG)
1361 abort ();
1362 switch (GET_CODE (XEXP (dest, 0)))
1363 {
1364 /* With a push. */
1365 case PRE_INC:
1366 case PRE_DEC:
1367 offset = GET_MODE_SIZE (GET_MODE (dest));
1368 if (GET_CODE (XEXP (dest, 0)) == PRE_INC)
1369 offset = -offset;
1362
1370
1363 if (REGNO (XEXP (XEXP (dest, 0), 0)) != STACK_POINTER_REGNUM
1364 || cfa_store_reg != STACK_POINTER_REGNUM)
1365 abort ();
1366 cfa_store_offset += offset;
1367 if (cfa_reg == STACK_POINTER_REGNUM)
1368 cfa_offset = cfa_store_offset;
1371 if (REGNO (XEXP (XEXP (dest, 0), 0)) != STACK_POINTER_REGNUM
1372 || cfa_store_reg != STACK_POINTER_REGNUM)
1373 abort ();
1374 cfa_store_offset += offset;
1375 if (cfa_reg == STACK_POINTER_REGNUM)
1376 cfa_offset = cfa_store_offset;
1369
1377
1370 offset = -cfa_store_offset;
1371 break;
1378 offset = -cfa_store_offset;
1379 break;
1372
1380
1373 /* With an offset. */
1374 case PLUS:
1375 case MINUS:
1376 offset = INTVAL (XEXP (XEXP (dest, 0), 1));
1377 if (GET_CODE (src) == MINUS)
1378 offset = -offset;
1381 /* With an offset. */
1382 case PLUS:
1383 case MINUS:
1384 offset = INTVAL (XEXP (XEXP (dest, 0), 1));
1385 if (GET_CODE (XEXP (dest, 0)) == MINUS)
1386 offset = -offset;
1379
1387
1380 if (cfa_store_reg != REGNO (XEXP (XEXP (dest, 0), 0)))
1381 abort ();
1382 offset -= cfa_store_offset;
1383 break;
1388 if (cfa_store_reg != (unsigned) REGNO (XEXP (XEXP (dest, 0), 0)))
1389 abort ();
1390 offset -= cfa_store_offset;
1391 break;
1384
1392
1385 default:
1386 abort ();
1387 }
1388 dwarf2out_def_cfa (label, cfa_reg, cfa_offset);
1389 dwarf2out_reg_save (label, REGNO (src), offset);
1390 break;
1393 /* Without an offset. */
1394 case REG:
1395 if (cfa_store_reg != (unsigned) REGNO (XEXP (dest, 0)))
1396 abort();
1397 offset = -cfa_store_offset;
1398 break;
1391
1399
1392 default:
1393 abort ();
1400 default:
1401 abort ();
1402 }
1403 dwarf2out_def_cfa (label, cfa_reg, cfa_offset);
1404 dwarf2out_reg_save (label, REGNO (src), offset);
1405 break;
1406
1407 default:
1408 abort ();
1409 }
1410}
1411
1412
1413/* Record call frame debugging information for INSN, which either
1414 sets SP or FP (adjusting how we calculate the frame address) or saves a
1415 register to the stack. If INSN is NULL_RTX, initialize our state. */
1416
1417void
1418dwarf2out_frame_debug (insn)
1419 rtx insn;
1420{
1421 char *label;
1422 rtx src;
1423
1424 if (insn == NULL_RTX)
1425 {
1426 /* Set up state for generating call frame debug info. */
1427 lookup_cfa (&cfa_reg, &cfa_offset);
1428 if (cfa_reg != DWARF_FRAME_REGNUM (STACK_POINTER_REGNUM))
1429 abort ();
1430 cfa_reg = STACK_POINTER_REGNUM;
1431 cfa_store_reg = cfa_reg;
1432 cfa_store_offset = cfa_offset;
1433 cfa_temp_reg = -1;
1434 cfa_temp_value = 0;
1435 return;
1394 }
1436 }
1437
1438 if (! RTX_FRAME_RELATED_P (insn))
1439 {
1440 dwarf2out_stack_adjust (insn);
1441 return;
1442 }
1443
1444 label = dwarf2out_cfi_label ();
1445
1446 src = find_reg_note (insn, REG_FRAME_RELATED_EXPR, NULL_RTX);
1447 if (src)
1448 insn = XEXP (src, 0);
1449 else
1450 insn = PATTERN (insn);
1451
1452 dwarf2out_frame_debug_expr (insn, label);
1395}
1396
1397/* Return the size of an unsigned LEB128 quantity. */
1398
1399static inline unsigned long
1400size_of_uleb128 (value)
1401 register unsigned long value;
1402{

--- 257 unchanged lines hidden (view full) ---

1660
1661 if (for_eh)
1662 {
1663#ifdef EH_FRAME_SECTION
1664 EH_FRAME_SECTION ();
1665#else
1666 tree label = get_file_function_name ('F');
1667
1453}
1454
1455/* Return the size of an unsigned LEB128 quantity. */
1456
1457static inline unsigned long
1458size_of_uleb128 (value)
1459 register unsigned long value;
1460{

--- 257 unchanged lines hidden (view full) ---

1718
1719 if (for_eh)
1720 {
1721#ifdef EH_FRAME_SECTION
1722 EH_FRAME_SECTION ();
1723#else
1724 tree label = get_file_function_name ('F');
1725
1668 data_section ();
1726 force_data_section ();
1669 ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (PTR_SIZE));
1670 ASM_GLOBALIZE_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
1671 ASM_OUTPUT_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
1672#endif
1673 assemble_label ("__FRAME_BEGIN__");
1674 }
1675 else
1676 ASM_OUTPUT_SECTION (asm_out_file, FRAME_SECTION);

--- 121 unchanged lines hidden (view full) ---

1798 else
1799 ASM_OUTPUT_DWARF_DELTA (asm_out_file, l2, l1);
1800#endif
1801 if (flag_debug_asm)
1802 fprintf (asm_out_file, "\t%s FDE Length", ASM_COMMENT_START);
1803 fputc ('\n', asm_out_file);
1804 ASM_OUTPUT_LABEL (asm_out_file, l1);
1805
1727 ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (PTR_SIZE));
1728 ASM_GLOBALIZE_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
1729 ASM_OUTPUT_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
1730#endif
1731 assemble_label ("__FRAME_BEGIN__");
1732 }
1733 else
1734 ASM_OUTPUT_SECTION (asm_out_file, FRAME_SECTION);

--- 121 unchanged lines hidden (view full) ---

1856 else
1857 ASM_OUTPUT_DWARF_DELTA (asm_out_file, l2, l1);
1858#endif
1859 if (flag_debug_asm)
1860 fprintf (asm_out_file, "\t%s FDE Length", ASM_COMMENT_START);
1861 fputc ('\n', asm_out_file);
1862 ASM_OUTPUT_LABEL (asm_out_file, l1);
1863
1864 /* ??? This always emits a 4 byte offset when for_eh is true, but it
1865 emits a target dependent sized offset when for_eh is not true.
1866 This inconsistency may confuse gdb. The only case where we need a
1867 non-4 byte offset is for the Irix6 N64 ABI, so we may lose SGI
1868 compatibility if we emit a 4 byte offset. We need a 4 byte offset
1869 though in order to be compatible with the dwarf_fde struct in frame.c.
1870 If the for_eh case is changed, then the struct in frame.c has
1871 to be adjusted appropriately. */
1806 if (for_eh)
1872 if (for_eh)
1807 ASM_OUTPUT_DWARF_DELTA (asm_out_file, l1, "__FRAME_BEGIN__");
1873 ASM_OUTPUT_DWARF_DELTA4 (asm_out_file, l1, "__FRAME_BEGIN__");
1808 else
1809 ASM_OUTPUT_DWARF_OFFSET (asm_out_file, stripattributes (FRAME_SECTION));
1810 if (flag_debug_asm)
1811 fprintf (asm_out_file, "\t%s FDE CIE offset", ASM_COMMENT_START);
1812
1813 fputc ('\n', asm_out_file);
1814 ASM_OUTPUT_DWARF_ADDR (asm_out_file, fde->dw_fde_begin);
1815 if (flag_debug_asm)

--- 161 unchanged lines hidden (view full) ---

1977 dw_val_class_const,
1978 dw_val_class_unsigned_const,
1979 dw_val_class_long_long,
1980 dw_val_class_float,
1981 dw_val_class_flag,
1982 dw_val_class_die_ref,
1983 dw_val_class_fde_ref,
1984 dw_val_class_lbl_id,
1874 else
1875 ASM_OUTPUT_DWARF_OFFSET (asm_out_file, stripattributes (FRAME_SECTION));
1876 if (flag_debug_asm)
1877 fprintf (asm_out_file, "\t%s FDE CIE offset", ASM_COMMENT_START);
1878
1879 fputc ('\n', asm_out_file);
1880 ASM_OUTPUT_DWARF_ADDR (asm_out_file, fde->dw_fde_begin);
1881 if (flag_debug_asm)

--- 161 unchanged lines hidden (view full) ---

2043 dw_val_class_const,
2044 dw_val_class_unsigned_const,
2045 dw_val_class_long_long,
2046 dw_val_class_float,
2047 dw_val_class_flag,
2048 dw_val_class_die_ref,
2049 dw_val_class_fde_ref,
2050 dw_val_class_lbl_id,
1985 dw_val_class_section_offset,
2051 dw_val_class_lbl_offset,
1986 dw_val_class_str
1987}
1988dw_val_class;
1989
1990/* Various DIE's use offsets relative to the beginning of the
1991 .debug_info section to refer to each other. */
1992
1993typedef long int dw_offset;

--- 62 unchanged lines hidden (view full) ---

2056 long int val_int;
2057 long unsigned val_unsigned;
2058 dw_long_long_const val_long_long;
2059 dw_float_const val_float;
2060 dw_die_ref val_die_ref;
2061 unsigned val_fde_index;
2062 char *val_str;
2063 char *val_lbl_id;
2052 dw_val_class_str
2053}
2054dw_val_class;
2055
2056/* Various DIE's use offsets relative to the beginning of the
2057 .debug_info section to refer to each other. */
2058
2059typedef long int dw_offset;

--- 62 unchanged lines hidden (view full) ---

2122 long int val_int;
2123 long unsigned val_unsigned;
2124 dw_long_long_const val_long_long;
2125 dw_float_const val_float;
2126 dw_die_ref val_die_ref;
2127 unsigned val_fde_index;
2128 char *val_str;
2129 char *val_lbl_id;
2064 char *val_section;
2065 unsigned char val_flag;
2066 }
2067 v;
2068}
2069dw_val_node;
2070
2071/* Locations in memory are described using a sequence of stack machine
2072 operations. */

--- 283 unchanged lines hidden (view full) ---

2356/* Number of elements of pending_types_list currently in use. */
2357static unsigned pending_types;
2358
2359/* Size (in elements) of increments by which we may expand the pending
2360 types list. Actually, a single hunk of space of this size should
2361 be enough for most typical programs. */
2362#define PENDING_TYPES_INCREMENT 64
2363
2130 unsigned char val_flag;
2131 }
2132 v;
2133}
2134dw_val_node;
2135
2136/* Locations in memory are described using a sequence of stack machine
2137 operations. */

--- 283 unchanged lines hidden (view full) ---

2421/* Number of elements of pending_types_list currently in use. */
2422static unsigned pending_types;
2423
2424/* Size (in elements) of increments by which we may expand the pending
2425 types list. Actually, a single hunk of space of this size should
2426 be enough for most typical programs. */
2427#define PENDING_TYPES_INCREMENT 64
2428
2429/* A pointer to the base of a list of incomplete types which might be
2430 completed at some later time. */
2431
2432static tree *incomplete_types_list;
2433
2434/* Number of elements currently allocated for the incomplete_types_list. */
2435static unsigned incomplete_types_allocated;
2436
2437/* Number of elements of incomplete_types_list currently in use. */
2438static unsigned incomplete_types;
2439
2440/* Size (in elements) of increments by which we may expand the incomplete
2441 types list. Actually, a single hunk of space of this size should
2442 be enough for most typical programs. */
2443#define INCOMPLETE_TYPES_INCREMENT 64
2444
2364/* Record whether the function being analyzed contains inlined functions. */
2365static int current_function_has_inlines;
2366#if 0 && defined (MIPS_DEBUGGING_INFO)
2367static int comp_unit_has_inlines;
2368#endif
2369
2370/* A pointer to the ..._DECL node which we have most recently been working
2371 on. We keep this around just in case something about it looks screwy and

--- 43 unchanged lines hidden (view full) ---

2415 unsigned));
2416static void add_AT_loc PROTO((dw_die_ref,
2417 enum dwarf_attribute,
2418 dw_loc_descr_ref));
2419static void add_AT_addr PROTO((dw_die_ref,
2420 enum dwarf_attribute, char *));
2421static void add_AT_lbl_id PROTO((dw_die_ref,
2422 enum dwarf_attribute, char *));
2445/* Record whether the function being analyzed contains inlined functions. */
2446static int current_function_has_inlines;
2447#if 0 && defined (MIPS_DEBUGGING_INFO)
2448static int comp_unit_has_inlines;
2449#endif
2450
2451/* A pointer to the ..._DECL node which we have most recently been working
2452 on. We keep this around just in case something about it looks screwy and

--- 43 unchanged lines hidden (view full) ---

2496 unsigned));
2497static void add_AT_loc PROTO((dw_die_ref,
2498 enum dwarf_attribute,
2499 dw_loc_descr_ref));
2500static void add_AT_addr PROTO((dw_die_ref,
2501 enum dwarf_attribute, char *));
2502static void add_AT_lbl_id PROTO((dw_die_ref,
2503 enum dwarf_attribute, char *));
2423static void add_AT_section_offset PROTO((dw_die_ref,
2504static void add_AT_lbl_offset PROTO((dw_die_ref,
2424 enum dwarf_attribute, char *));
2425static int is_extern_subr_die PROTO((dw_die_ref));
2426static dw_attr_ref get_AT PROTO((dw_die_ref,
2427 enum dwarf_attribute));
2428static char *get_AT_low_pc PROTO((dw_die_ref));
2429static char *get_AT_hi_pc PROTO((dw_die_ref));
2430static char *get_AT_string PROTO((dw_die_ref,
2431 enum dwarf_attribute));

--- 156 unchanged lines hidden (view full) ---

2588#endif
2589#ifndef DATA_SECTION
2590#define DATA_SECTION ".data"
2591#endif
2592#ifndef BSS_SECTION
2593#define BSS_SECTION ".bss"
2594#endif
2595
2505 enum dwarf_attribute, char *));
2506static int is_extern_subr_die PROTO((dw_die_ref));
2507static dw_attr_ref get_AT PROTO((dw_die_ref,
2508 enum dwarf_attribute));
2509static char *get_AT_low_pc PROTO((dw_die_ref));
2510static char *get_AT_hi_pc PROTO((dw_die_ref));
2511static char *get_AT_string PROTO((dw_die_ref,
2512 enum dwarf_attribute));

--- 156 unchanged lines hidden (view full) ---

2669#endif
2670#ifndef DATA_SECTION
2671#define DATA_SECTION ".data"
2672#endif
2673#ifndef BSS_SECTION
2674#define BSS_SECTION ".bss"
2675#endif
2676
2677/* Labels we insert at beginning sections we can reference instead of
2678 the section names themselves. */
2596
2679
2680#ifndef TEXT_SECTION_LABEL
2681#define TEXT_SECTION_LABEL "Ltext"
2682#endif
2683#ifndef DEBUG_LINE_SECTION_LABEL
2684#define DEBUG_LINE_SECTION_LABEL "Ldebug_line"
2685#endif
2686#ifndef DEBUG_INFO_SECTION_LABEL
2687#define DEBUG_INFO_SECTION_LABEL "Ldebug_info"
2688#endif
2689#ifndef ABBREV_SECTION_LABEL
2690#define ABBREV_SECTION_LABEL "Ldebug_abbrev"
2691#endif
2692
2693
2597/* Definitions of defaults for formats and names of various special
2598 (artificial) labels which may be generated within this file (when the -g
2599 options is used and DWARF_DEBUGGING_INFO is in effect.
2600 If necessary, these may be overridden from within the tm.h file, but
2601 typically, overriding these defaults is unnecessary. */
2602
2603static char text_end_label[MAX_ARTIFICIAL_LABEL_BYTES];
2694/* Definitions of defaults for formats and names of various special
2695 (artificial) labels which may be generated within this file (when the -g
2696 options is used and DWARF_DEBUGGING_INFO is in effect.
2697 If necessary, these may be overridden from within the tm.h file, but
2698 typically, overriding these defaults is unnecessary. */
2699
2700static char text_end_label[MAX_ARTIFICIAL_LABEL_BYTES];
2701static char text_section_label[MAX_ARTIFICIAL_LABEL_BYTES];
2702static char abbrev_section_label[MAX_ARTIFICIAL_LABEL_BYTES];
2703static char debug_info_section_label[MAX_ARTIFICIAL_LABEL_BYTES];
2704static char debug_line_section_label[MAX_ARTIFICIAL_LABEL_BYTES];
2604
2605#ifndef TEXT_END_LABEL
2606#define TEXT_END_LABEL "Letext"
2607#endif
2608#ifndef DATA_END_LABEL
2609#define DATA_END_LABEL "Ledata"
2610#endif
2611#ifndef BSS_END_LABEL

--- 20 unchanged lines hidden (view full) ---

2632#ifndef SEPARATE_LINE_CODE_LABEL
2633#define SEPARATE_LINE_CODE_LABEL "LSM"
2634#endif
2635
2636/* Convert a reference to the assembler name of a C-level name. This
2637 macro has the same effect as ASM_OUTPUT_LABELREF, but copies to
2638 a string rather than writing to a file. */
2639#ifndef ASM_NAME_TO_STRING
2705
2706#ifndef TEXT_END_LABEL
2707#define TEXT_END_LABEL "Letext"
2708#endif
2709#ifndef DATA_END_LABEL
2710#define DATA_END_LABEL "Ledata"
2711#endif
2712#ifndef BSS_END_LABEL

--- 20 unchanged lines hidden (view full) ---

2733#ifndef SEPARATE_LINE_CODE_LABEL
2734#define SEPARATE_LINE_CODE_LABEL "LSM"
2735#endif
2736
2737/* Convert a reference to the assembler name of a C-level name. This
2738 macro has the same effect as ASM_OUTPUT_LABELREF, but copies to
2739 a string rather than writing to a file. */
2740#ifndef ASM_NAME_TO_STRING
2640#define ASM_NAME_TO_STRING(STR, NAME) \
2641 do { \
2642 if ((NAME)[0] == '*') \
2643 dyn_string_append (STR, NAME + 1); \
2644 else \
2645 dyn_string_append (STR, NAME); \
2646 } \
2741#define ASM_NAME_TO_STRING(STR, NAME) \
2742 do { \
2743 if ((NAME)[0] == '*') \
2744 dyn_string_append (STR, NAME + 1); \
2745 else \
2746 { \
2747 char *newstr; \
2748 STRIP_NAME_ENCODING (newstr, NAME); \
2749 dyn_string_append (STR, user_label_prefix); \
2750 dyn_string_append (STR, newstr); \
2751 } \
2752 } \
2647 while (0)
2648#endif
2649
2650/* Convert an integer constant expression into assembler syntax. Addition
2651 and subtraction are the only arithmetic that may appear in these
2652 expressions. This is an adaptation of output_addr_const in final.c.
2653 Here, the target of the conversion is a string buffer. We can't use
2654 output_addr_const directly, because it writes to a file. */

--- 857 unchanged lines hidden (view full) ---

3512 function, so we have to trace all of the way back through the origin chain
3513 to find out what sort of node actually served as the original seed for the
3514 given block. */
3515
3516static tree
3517decl_ultimate_origin (decl)
3518 register tree decl;
3519{
2753 while (0)
2754#endif
2755
2756/* Convert an integer constant expression into assembler syntax. Addition
2757 and subtraction are the only arithmetic that may appear in these
2758 expressions. This is an adaptation of output_addr_const in final.c.
2759 Here, the target of the conversion is a string buffer. We can't use
2760 output_addr_const directly, because it writes to a file. */

--- 857 unchanged lines hidden (view full) ---

3618 function, so we have to trace all of the way back through the origin chain
3619 to find out what sort of node actually served as the original seed for the
3620 given block. */
3621
3622static tree
3623decl_ultimate_origin (decl)
3624 register tree decl;
3625{
3520 register tree immediate_origin = DECL_ABSTRACT_ORIGIN (decl);
3626#ifdef ENABLE_CHECKING
3627 if (DECL_FROM_INLINE (DECL_ORIGIN (decl)))
3628 /* Since the DECL_ABSTRACT_ORIGIN for a DECL is supposed to be the
3629 most distant ancestor, this should never happen. */
3630 abort ();
3631#endif
3521
3632
3522 if (immediate_origin == NULL_TREE)
3523 return NULL_TREE;
3524 else
3525 {
3526 register tree ret_val;
3527 register tree lookahead = immediate_origin;
3528
3529 do
3530 {
3531 ret_val = lookahead;
3532 lookahead = DECL_ABSTRACT_ORIGIN (ret_val);
3533 }
3534 while (lookahead != NULL && lookahead != ret_val);
3535
3536 return ret_val;
3537 }
3633 return DECL_ABSTRACT_ORIGIN (decl);
3538}
3539
3540/* Determine the "ultimate origin" of a block. The block may be an inlined
3541 instance of an inlined instance of a block which is local to an inline
3542 function, so we have to trace all of the way back through the origin chain
3543 to find out what sort of node actually served as the original seed for the
3544 given block. */
3545

--- 256 unchanged lines hidden (view full) ---

3802 attr->dw_attr_val.val_class = dw_val_class_lbl_id;
3803 attr->dw_attr_val.v.val_lbl_id = xstrdup (lbl_id);
3804 add_dwarf_attr (die, attr);
3805}
3806
3807/* Add a section offset attribute value to a DIE. */
3808
3809static inline void
3634}
3635
3636/* Determine the "ultimate origin" of a block. The block may be an inlined
3637 instance of an inlined instance of a block which is local to an inline
3638 function, so we have to trace all of the way back through the origin chain
3639 to find out what sort of node actually served as the original seed for the
3640 given block. */
3641

--- 256 unchanged lines hidden (view full) ---

3898 attr->dw_attr_val.val_class = dw_val_class_lbl_id;
3899 attr->dw_attr_val.v.val_lbl_id = xstrdup (lbl_id);
3900 add_dwarf_attr (die, attr);
3901}
3902
3903/* Add a section offset attribute value to a DIE. */
3904
3905static inline void
3810add_AT_section_offset (die, attr_kind, section)
3906add_AT_lbl_offset (die, attr_kind, label)
3811 register dw_die_ref die;
3812 register enum dwarf_attribute attr_kind;
3907 register dw_die_ref die;
3908 register enum dwarf_attribute attr_kind;
3813 register char *section;
3909 register char *label;
3814{
3815 register dw_attr_ref attr = (dw_attr_ref) xmalloc (sizeof (dw_attr_node));
3816
3817 attr->dw_attr_next = NULL;
3818 attr->dw_attr = attr_kind;
3910{
3911 register dw_attr_ref attr = (dw_attr_ref) xmalloc (sizeof (dw_attr_node));
3912
3913 attr->dw_attr_next = NULL;
3914 attr->dw_attr = attr_kind;
3819 attr->dw_attr_val.val_class = dw_val_class_section_offset;
3820 attr->dw_attr_val.v.val_section = section;
3915 attr->dw_attr_val.val_class = dw_val_class_lbl_offset;
3916 attr->dw_attr_val.v.val_lbl_id = label;
3821 add_dwarf_attr (die, attr);
3822
3823}
3824
3825/* Test if die refers to an external subroutine. */
3826
3827static inline int
3828is_extern_subr_die (die)

--- 446 unchanged lines hidden (view full) ---

4275 case dw_val_class_die_ref:
4276 if (a->dw_attr_val.v.val_die_ref != NULL)
4277 fprintf (outfile, "die -> %lu",
4278 a->dw_attr_val.v.val_die_ref->die_offset);
4279 else
4280 fprintf (outfile, "die -> <null>");
4281 break;
4282 case dw_val_class_lbl_id:
3917 add_dwarf_attr (die, attr);
3918
3919}
3920
3921/* Test if die refers to an external subroutine. */
3922
3923static inline int
3924is_extern_subr_die (die)

--- 446 unchanged lines hidden (view full) ---

4371 case dw_val_class_die_ref:
4372 if (a->dw_attr_val.v.val_die_ref != NULL)
4373 fprintf (outfile, "die -> %lu",
4374 a->dw_attr_val.v.val_die_ref->die_offset);
4375 else
4376 fprintf (outfile, "die -> <null>");
4377 break;
4378 case dw_val_class_lbl_id:
4379 case dw_val_class_lbl_offset:
4283 fprintf (outfile, "label: %s", a->dw_attr_val.v.val_lbl_id);
4284 break;
4380 fprintf (outfile, "label: %s", a->dw_attr_val.v.val_lbl_id);
4381 break;
4285 case dw_val_class_section_offset:
4286 fprintf (outfile, "section: %s", a->dw_attr_val.v.val_section);
4287 break;
4288 case dw_val_class_str:
4289 if (a->dw_attr_val.v.val_str != NULL)
4290 fprintf (outfile, "\"%s\"", a->dw_attr_val.v.val_str);
4291 else
4292 fprintf (outfile, "<null>");
4293 break;
4294 default:
4295 break;

--- 347 unchanged lines hidden (view full) ---

4643 size += DWARF_OFFSET_SIZE;
4644 break;
4645 case dw_val_class_fde_ref:
4646 size += DWARF_OFFSET_SIZE;
4647 break;
4648 case dw_val_class_lbl_id:
4649 size += PTR_SIZE;
4650 break;
4382 case dw_val_class_str:
4383 if (a->dw_attr_val.v.val_str != NULL)
4384 fprintf (outfile, "\"%s\"", a->dw_attr_val.v.val_str);
4385 else
4386 fprintf (outfile, "<null>");
4387 break;
4388 default:
4389 break;

--- 347 unchanged lines hidden (view full) ---

4737 size += DWARF_OFFSET_SIZE;
4738 break;
4739 case dw_val_class_fde_ref:
4740 size += DWARF_OFFSET_SIZE;
4741 break;
4742 case dw_val_class_lbl_id:
4743 size += PTR_SIZE;
4744 break;
4651 case dw_val_class_section_offset:
4745 case dw_val_class_lbl_offset:
4652 size += DWARF_OFFSET_SIZE;
4653 break;
4654 case dw_val_class_str:
4655 size += size_of_string (a->dw_attr_val.v.val_str);
4656 break;
4657 default:
4658 abort ();
4659 }

--- 85 unchanged lines hidden (view full) ---

4745 size = 2;
4746
4747 /* Prolog length specifier. */
4748 size += DWARF_OFFSET_SIZE;
4749
4750 /* Prolog. */
4751 size += size_of_line_prolog ();
4752
4746 size += DWARF_OFFSET_SIZE;
4747 break;
4748 case dw_val_class_str:
4749 size += size_of_string (a->dw_attr_val.v.val_str);
4750 break;
4751 default:
4752 abort ();
4753 }

--- 85 unchanged lines hidden (view full) ---

4839 size = 2;
4840
4841 /* Prolog length specifier. */
4842 size += DWARF_OFFSET_SIZE;
4843
4844 /* Prolog. */
4845 size += size_of_line_prolog ();
4846
4753 /* Set address register instruction. */
4754 size += size_of_set_address;
4755
4756 current_file = 1;
4757 current_line = 1;
4758 for (lt_index = 1; lt_index < line_info_table_in_use; ++lt_index)
4759 {
4847 current_file = 1;
4848 current_line = 1;
4849 for (lt_index = 1; lt_index < line_info_table_in_use; ++lt_index)
4850 {
4760 register dw_line_info_ref line_info;
4851 register dw_line_info_ref line_info = &line_info_table[lt_index];
4761
4852
4853 if (line_info->dw_line_num == current_line
4854 && line_info->dw_file_num == current_file)
4855 continue;
4856
4762 /* Advance pc instruction. */
4763 /* ??? See the DW_LNS_advance_pc comment in output_line_info. */
4764 if (0)
4765 size += 1 + 2;
4766 else
4767 size += size_of_set_address;
4768
4857 /* Advance pc instruction. */
4858 /* ??? See the DW_LNS_advance_pc comment in output_line_info. */
4859 if (0)
4860 size += 1 + 2;
4861 else
4862 size += size_of_set_address;
4863
4769 line_info = &line_info_table[lt_index];
4770 if (line_info->dw_file_num != current_file)
4771 {
4772 /* Set file number instruction. */
4773 size += 1;
4774 current_file = line_info->dw_file_num;
4775 size += size_of_uleb128 (current_file);
4776 }
4777

--- 27 unchanged lines hidden (view full) ---

4805
4806 function = 0;
4807 current_file = 1;
4808 current_line = 1;
4809 for (lt_index = 0; lt_index < separate_line_info_table_in_use; )
4810 {
4811 register dw_separate_line_info_ref line_info
4812 = &separate_line_info_table[lt_index];
4864 if (line_info->dw_file_num != current_file)
4865 {
4866 /* Set file number instruction. */
4867 size += 1;
4868 current_file = line_info->dw_file_num;
4869 size += size_of_uleb128 (current_file);
4870 }
4871

--- 27 unchanged lines hidden (view full) ---

4899
4900 function = 0;
4901 current_file = 1;
4902 current_line = 1;
4903 for (lt_index = 0; lt_index < separate_line_info_table_in_use; )
4904 {
4905 register dw_separate_line_info_ref line_info
4906 = &separate_line_info_table[lt_index];
4907
4908 if (line_info->dw_line_num == current_line
4909 && line_info->dw_file_num == current_file
4910 && line_info->function == function)
4911 goto cont;
4912
4813 if (function != line_info->function)
4814 {
4815 function = line_info->function;
4816 /* Set address register instruction. */
4817 size += size_of_set_address;
4818 }
4819 else
4820 {

--- 26 unchanged lines hidden (view full) ---

4847 size += 1;
4848 size += size_of_sleb128 (line_offset);
4849
4850 /* Generate line entry instruction. */
4851 size += 1;
4852 }
4853 }
4854
4913 if (function != line_info->function)
4914 {
4915 function = line_info->function;
4916 /* Set address register instruction. */
4917 size += size_of_set_address;
4918 }
4919 else
4920 {

--- 26 unchanged lines hidden (view full) ---

4947 size += 1;
4948 size += size_of_sleb128 (line_offset);
4949
4950 /* Generate line entry instruction. */
4951 size += 1;
4952 }
4953 }
4954
4955 cont:
4855 ++lt_index;
4856
4857 /* If we're done with a function, end its sequence. */
4858 if (lt_index == separate_line_info_table_in_use
4859 || separate_line_info_table[lt_index].function != function)
4860 {
4861 current_file = 1;
4862 current_line = 1;

--- 93 unchanged lines hidden (view full) ---

4956 case dw_val_class_flag:
4957 return DW_FORM_flag;
4958 case dw_val_class_die_ref:
4959 return DW_FORM_ref;
4960 case dw_val_class_fde_ref:
4961 return DW_FORM_data;
4962 case dw_val_class_lbl_id:
4963 return DW_FORM_addr;
4956 ++lt_index;
4957
4958 /* If we're done with a function, end its sequence. */
4959 if (lt_index == separate_line_info_table_in_use
4960 || separate_line_info_table[lt_index].function != function)
4961 {
4962 current_file = 1;
4963 current_line = 1;

--- 93 unchanged lines hidden (view full) ---

5057 case dw_val_class_flag:
5058 return DW_FORM_flag;
5059 case dw_val_class_die_ref:
5060 return DW_FORM_ref;
5061 case dw_val_class_fde_ref:
5062 return DW_FORM_data;
5063 case dw_val_class_lbl_id:
5064 return DW_FORM_addr;
4964 case dw_val_class_section_offset:
5065 case dw_val_class_lbl_offset:
4965 return DW_FORM_data;
4966 case dw_val_class_str:
4967 return DW_FORM_string;
4968 default:
4969 abort ();
4970 }
4971}
4972

--- 56 unchanged lines hidden (view full) ---

5029 dwarf_attr_name (a_attr->dw_attr));
5030
5031 fputc ('\n', asm_out_file);
5032 output_value_format (&a_attr->dw_attr_val);
5033 }
5034
5035 fprintf (asm_out_file, "\t%s\t0,0\n", ASM_BYTE_OP);
5036 }
5066 return DW_FORM_data;
5067 case dw_val_class_str:
5068 return DW_FORM_string;
5069 default:
5070 abort ();
5071 }
5072}
5073

--- 56 unchanged lines hidden (view full) ---

5130 dwarf_attr_name (a_attr->dw_attr));
5131
5132 fputc ('\n', asm_out_file);
5133 output_value_format (&a_attr->dw_attr_val);
5134 }
5135
5136 fprintf (asm_out_file, "\t%s\t0,0\n", ASM_BYTE_OP);
5137 }
5138
5139 /* We need to properly terminate the abbrev table for this
5140 compilation unit, as per the standard, and not rely on
5141 workarounds in e.g. gdb. */
5142 fprintf (asm_out_file, "\t%s\t0\n", ASM_BYTE_OP);
5037}
5038
5039/* Output location description stack opcode's operands (if any). */
5040
5041static void
5042output_loc_operands (loc)
5043 register dw_loc_descr_ref loc;
5044{

--- 133 unchanged lines hidden (view full) ---

5178output_die (die)
5179 register dw_die_ref die;
5180{
5181 register dw_attr_ref a;
5182 register dw_die_ref c;
5183 register unsigned long ref_offset;
5184 register unsigned long size;
5185 register dw_loc_descr_ref loc;
5143}
5144
5145/* Output location description stack opcode's operands (if any). */
5146
5147static void
5148output_loc_operands (loc)
5149 register dw_loc_descr_ref loc;
5150{

--- 133 unchanged lines hidden (view full) ---

5284output_die (die)
5285 register dw_die_ref die;
5286{
5287 register dw_attr_ref a;
5288 register dw_die_ref c;
5289 register unsigned long ref_offset;
5290 register unsigned long size;
5291 register dw_loc_descr_ref loc;
5186 register int i;
5187
5188 output_uleb128 (die->die_abbrev);
5189 if (flag_debug_asm)
5190 fprintf (asm_out_file, " (DIE (0x%lx) %s)",
5191 die->die_offset, dwarf_tag_name (die->die_tag));
5192
5193 fputc ('\n', asm_out_file);
5194

--- 86 unchanged lines hidden (view full) ---

5281 if (flag_debug_asm)
5282 fprintf (asm_out_file,
5283 "\t%s long long constant", ASM_COMMENT_START);
5284
5285 fputc ('\n', asm_out_file);
5286 break;
5287
5288 case dw_val_class_float:
5292
5293 output_uleb128 (die->die_abbrev);
5294 if (flag_debug_asm)
5295 fprintf (asm_out_file, " (DIE (0x%lx) %s)",
5296 die->die_offset, dwarf_tag_name (die->die_tag));
5297
5298 fputc ('\n', asm_out_file);
5299

--- 86 unchanged lines hidden (view full) ---

5386 if (flag_debug_asm)
5387 fprintf (asm_out_file,
5388 "\t%s long long constant", ASM_COMMENT_START);
5389
5390 fputc ('\n', asm_out_file);
5391 break;
5392
5393 case dw_val_class_float:
5289 ASM_OUTPUT_DWARF_DATA1 (asm_out_file,
5290 a->dw_attr_val.v.val_float.length * 4);
5291 if (flag_debug_asm)
5292 fprintf (asm_out_file, "\t%s %s",
5293 ASM_COMMENT_START, dwarf_attr_name (a->dw_attr));
5394 {
5395 register unsigned int i;
5396 ASM_OUTPUT_DWARF_DATA1 (asm_out_file,
5397 a->dw_attr_val.v.val_float.length * 4);
5398 if (flag_debug_asm)
5399 fprintf (asm_out_file, "\t%s %s",
5400 ASM_COMMENT_START, dwarf_attr_name (a->dw_attr));
5294
5401
5295 fputc ('\n', asm_out_file);
5296 for (i = 0; i < a->dw_attr_val.v.val_float.length; ++i)
5297 {
5298 ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
5299 a->dw_attr_val.v.val_float.array[i]);
5300 if (flag_debug_asm)
5301 fprintf (asm_out_file, "\t%s fp constant word %d",
5302 ASM_COMMENT_START, i);
5402 fputc ('\n', asm_out_file);
5403 for (i = 0; i < a->dw_attr_val.v.val_float.length; ++i)
5404 {
5405 ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
5406 a->dw_attr_val.v.val_float.array[i]);
5407 if (flag_debug_asm)
5408 fprintf (asm_out_file, "\t%s fp constant word %u",
5409 ASM_COMMENT_START, i);
5303
5410
5304 fputc ('\n', asm_out_file);
5305 }
5411 fputc ('\n', asm_out_file);
5412 }
5306 break;
5413 break;
5414 }
5307
5308 case dw_val_class_flag:
5309 ASM_OUTPUT_DWARF_DATA1 (asm_out_file, a->dw_attr_val.v.val_flag);
5310 break;
5311
5312 case dw_val_class_die_ref:
5313 if (a->dw_attr_val.v.val_die_ref != NULL)
5314 ref_offset = a->dw_attr_val.v.val_die_ref->die_offset;

--- 14 unchanged lines hidden (view full) ---

5329 fprintf (asm_out_file, " - %d", DWARF_OFFSET_SIZE);
5330 }
5331 break;
5332
5333 case dw_val_class_lbl_id:
5334 ASM_OUTPUT_DWARF_ADDR (asm_out_file, a->dw_attr_val.v.val_lbl_id);
5335 break;
5336
5415
5416 case dw_val_class_flag:
5417 ASM_OUTPUT_DWARF_DATA1 (asm_out_file, a->dw_attr_val.v.val_flag);
5418 break;
5419
5420 case dw_val_class_die_ref:
5421 if (a->dw_attr_val.v.val_die_ref != NULL)
5422 ref_offset = a->dw_attr_val.v.val_die_ref->die_offset;

--- 14 unchanged lines hidden (view full) ---

5437 fprintf (asm_out_file, " - %d", DWARF_OFFSET_SIZE);
5438 }
5439 break;
5440
5441 case dw_val_class_lbl_id:
5442 ASM_OUTPUT_DWARF_ADDR (asm_out_file, a->dw_attr_val.v.val_lbl_id);
5443 break;
5444
5337 case dw_val_class_section_offset:
5338 ASM_OUTPUT_DWARF_OFFSET (asm_out_file,
5339 stripattributes
5340 (a->dw_attr_val.v.val_section));
5445 case dw_val_class_lbl_offset:
5446 ASM_OUTPUT_DWARF_OFFSET (asm_out_file, a->dw_attr_val.v.val_lbl_id);
5341 break;
5342
5343 case dw_val_class_str:
5344 if (flag_debug_asm)
5345 ASM_OUTPUT_DWARF_STRING (asm_out_file, a->dw_attr_val.v.val_str);
5346 else
5347 ASM_OUTPUT_ASCII (asm_out_file,
5348 a->dw_attr_val.v.val_str,
5447 break;
5448
5449 case dw_val_class_str:
5450 if (flag_debug_asm)
5451 ASM_OUTPUT_DWARF_STRING (asm_out_file, a->dw_attr_val.v.val_str);
5452 else
5453 ASM_OUTPUT_ASCII (asm_out_file,
5454 a->dw_attr_val.v.val_str,
5349 strlen (a->dw_attr_val.v.val_str) + 1);
5455 (int) strlen (a->dw_attr_val.v.val_str) + 1);
5350 break;
5351
5352 default:
5353 abort ();
5354 }
5355
5356 if (a->dw_attr_val.val_class != dw_val_class_loc
5357 && a->dw_attr_val.val_class != dw_val_class_long_long

--- 34 unchanged lines hidden (view full) ---

5392 ASM_COMMENT_START);
5393
5394 fputc ('\n', asm_out_file);
5395 ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION);
5396 if (flag_debug_asm)
5397 fprintf (asm_out_file, "\t%s DWARF version number", ASM_COMMENT_START);
5398
5399 fputc ('\n', asm_out_file);
5456 break;
5457
5458 default:
5459 abort ();
5460 }
5461
5462 if (a->dw_attr_val.val_class != dw_val_class_loc
5463 && a->dw_attr_val.val_class != dw_val_class_long_long

--- 34 unchanged lines hidden (view full) ---

5498 ASM_COMMENT_START);
5499
5500 fputc ('\n', asm_out_file);
5501 ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION);
5502 if (flag_debug_asm)
5503 fprintf (asm_out_file, "\t%s DWARF version number", ASM_COMMENT_START);
5504
5505 fputc ('\n', asm_out_file);
5400 ASM_OUTPUT_DWARF_OFFSET (asm_out_file, stripattributes (ABBREV_SECTION));
5506 ASM_OUTPUT_DWARF_OFFSET (asm_out_file, abbrev_section_label);
5401 if (flag_debug_asm)
5402 fprintf (asm_out_file, "\t%s Offset Into Abbrev. Section",
5403 ASM_COMMENT_START);
5404
5405 fputc ('\n', asm_out_file);
5406 ASM_OUTPUT_DWARF_DATA1 (asm_out_file, PTR_SIZE);
5407 if (flag_debug_asm)
5408 fprintf (asm_out_file, "\t%s Pointer Size (in bytes)", ASM_COMMENT_START);

--- 56 unchanged lines hidden (view full) ---

5465
5466 fputc ('\n', asm_out_file);
5467 ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION);
5468
5469 if (flag_debug_asm)
5470 fprintf (asm_out_file, "\t%s DWARF Version", ASM_COMMENT_START);
5471
5472 fputc ('\n', asm_out_file);
5507 if (flag_debug_asm)
5508 fprintf (asm_out_file, "\t%s Offset Into Abbrev. Section",
5509 ASM_COMMENT_START);
5510
5511 fputc ('\n', asm_out_file);
5512 ASM_OUTPUT_DWARF_DATA1 (asm_out_file, PTR_SIZE);
5513 if (flag_debug_asm)
5514 fprintf (asm_out_file, "\t%s Pointer Size (in bytes)", ASM_COMMENT_START);

--- 56 unchanged lines hidden (view full) ---

5571
5572 fputc ('\n', asm_out_file);
5573 ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION);
5574
5575 if (flag_debug_asm)
5576 fprintf (asm_out_file, "\t%s DWARF Version", ASM_COMMENT_START);
5577
5578 fputc ('\n', asm_out_file);
5473 ASM_OUTPUT_DWARF_OFFSET (asm_out_file, stripattributes (DEBUG_INFO_SECTION));
5579 ASM_OUTPUT_DWARF_OFFSET (asm_out_file, debug_info_section_label);
5474 if (flag_debug_asm)
5475 fprintf (asm_out_file, "\t%s Offset of Compilation Unit Info.",
5476 ASM_COMMENT_START);
5477
5478 fputc ('\n', asm_out_file);
5479 ASM_OUTPUT_DWARF_DATA (asm_out_file, next_die_offset);
5480 if (flag_debug_asm)
5481 fprintf (asm_out_file, "\t%s Compilation Unit Length", ASM_COMMENT_START);

--- 11 unchanged lines hidden (view full) ---

5493
5494 if (flag_debug_asm)
5495 {
5496 ASM_OUTPUT_DWARF_STRING (asm_out_file, pub->name);
5497 fprintf (asm_out_file, "%s external name", ASM_COMMENT_START);
5498 }
5499 else
5500 {
5580 if (flag_debug_asm)
5581 fprintf (asm_out_file, "\t%s Offset of Compilation Unit Info.",
5582 ASM_COMMENT_START);
5583
5584 fputc ('\n', asm_out_file);
5585 ASM_OUTPUT_DWARF_DATA (asm_out_file, next_die_offset);
5586 if (flag_debug_asm)
5587 fprintf (asm_out_file, "\t%s Compilation Unit Length", ASM_COMMENT_START);

--- 11 unchanged lines hidden (view full) ---

5599
5600 if (flag_debug_asm)
5601 {
5602 ASM_OUTPUT_DWARF_STRING (asm_out_file, pub->name);
5603 fprintf (asm_out_file, "%s external name", ASM_COMMENT_START);
5604 }
5605 else
5606 {
5501 ASM_OUTPUT_ASCII (asm_out_file, pub->name, strlen (pub->name) + 1);
5607 ASM_OUTPUT_ASCII (asm_out_file, pub->name,
5608 (int) strlen (pub->name) + 1);
5502 }
5503
5504 fputc ('\n', asm_out_file);
5505 }
5506
5507 ASM_OUTPUT_DWARF_DATA (asm_out_file, 0);
5508 fputc ('\n', asm_out_file);
5509}

--- 35 unchanged lines hidden (view full) ---

5545 ASM_COMMENT_START);
5546
5547 fputc ('\n', asm_out_file);
5548 ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION);
5549 if (flag_debug_asm)
5550 fprintf (asm_out_file, "\t%s DWARF Version", ASM_COMMENT_START);
5551
5552 fputc ('\n', asm_out_file);
5609 }
5610
5611 fputc ('\n', asm_out_file);
5612 }
5613
5614 ASM_OUTPUT_DWARF_DATA (asm_out_file, 0);
5615 fputc ('\n', asm_out_file);
5616}

--- 35 unchanged lines hidden (view full) ---

5652 ASM_COMMENT_START);
5653
5654 fputc ('\n', asm_out_file);
5655 ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION);
5656 if (flag_debug_asm)
5657 fprintf (asm_out_file, "\t%s DWARF Version", ASM_COMMENT_START);
5658
5659 fputc ('\n', asm_out_file);
5553 ASM_OUTPUT_DWARF_OFFSET (asm_out_file, stripattributes (DEBUG_INFO_SECTION));
5660 ASM_OUTPUT_DWARF_OFFSET (asm_out_file, debug_info_section_label);
5554 if (flag_debug_asm)
5555 fprintf (asm_out_file, "\t%s Offset of Compilation Unit Info.",
5556 ASM_COMMENT_START);
5557
5558 fputc ('\n', asm_out_file);
5559 ASM_OUTPUT_DWARF_DATA1 (asm_out_file, PTR_SIZE);
5560 if (flag_debug_asm)
5561 fprintf (asm_out_file, "\t%s Size of Address", ASM_COMMENT_START);

--- 9 unchanged lines hidden (view full) ---

5571 if (PTR_SIZE == 8)
5572 fprintf (asm_out_file, ",0,0");
5573
5574 if (flag_debug_asm)
5575 fprintf (asm_out_file, "\t%s Pad to %d byte boundary",
5576 ASM_COMMENT_START, 2 * PTR_SIZE);
5577
5578 fputc ('\n', asm_out_file);
5661 if (flag_debug_asm)
5662 fprintf (asm_out_file, "\t%s Offset of Compilation Unit Info.",
5663 ASM_COMMENT_START);
5664
5665 fputc ('\n', asm_out_file);
5666 ASM_OUTPUT_DWARF_DATA1 (asm_out_file, PTR_SIZE);
5667 if (flag_debug_asm)
5668 fprintf (asm_out_file, "\t%s Size of Address", ASM_COMMENT_START);

--- 9 unchanged lines hidden (view full) ---

5678 if (PTR_SIZE == 8)
5679 fprintf (asm_out_file, ",0,0");
5680
5681 if (flag_debug_asm)
5682 fprintf (asm_out_file, "\t%s Pad to %d byte boundary",
5683 ASM_COMMENT_START, 2 * PTR_SIZE);
5684
5685 fputc ('\n', asm_out_file);
5579 ASM_OUTPUT_DWARF_ADDR (asm_out_file, TEXT_SECTION);
5686 ASM_OUTPUT_DWARF_ADDR (asm_out_file, text_section_label);
5580 if (flag_debug_asm)
5581 fprintf (asm_out_file, "\t%s Address", ASM_COMMENT_START);
5582
5583 fputc ('\n', asm_out_file);
5687 if (flag_debug_asm)
5688 fprintf (asm_out_file, "\t%s Address", ASM_COMMENT_START);
5689
5690 fputc ('\n', asm_out_file);
5584 ASM_OUTPUT_DWARF_ADDR_DELTA (asm_out_file, text_end_label, TEXT_SECTION);
5691 ASM_OUTPUT_DWARF_ADDR_DELTA (asm_out_file, text_end_label,
5692 text_section_label);
5585 if (flag_debug_asm)
5586 fprintf (asm_out_file, "%s Length", ASM_COMMENT_START);
5587
5588 fputc ('\n', asm_out_file);
5589 for (i = 0; i < arange_table_in_use; ++i)
5590 {
5591 dw_die_ref a = arange_table[i];
5592

--- 136 unchanged lines hidden (view full) ---

5729 ASM_OUTPUT_DWARF_STRING (asm_out_file, file_table[ft_index]);
5730 fprintf (asm_out_file, "%s File Entry: 0x%lx",
5731 ASM_COMMENT_START, ft_index);
5732 }
5733 else
5734 {
5735 ASM_OUTPUT_ASCII (asm_out_file,
5736 file_table[ft_index],
5693 if (flag_debug_asm)
5694 fprintf (asm_out_file, "%s Length", ASM_COMMENT_START);
5695
5696 fputc ('\n', asm_out_file);
5697 for (i = 0; i < arange_table_in_use; ++i)
5698 {
5699 dw_die_ref a = arange_table[i];
5700

--- 136 unchanged lines hidden (view full) ---

5837 ASM_OUTPUT_DWARF_STRING (asm_out_file, file_table[ft_index]);
5838 fprintf (asm_out_file, "%s File Entry: 0x%lx",
5839 ASM_COMMENT_START, ft_index);
5840 }
5841 else
5842 {
5843 ASM_OUTPUT_ASCII (asm_out_file,
5844 file_table[ft_index],
5737 strlen (file_table[ft_index]) + 1);
5845 (int) strlen (file_table[ft_index]) + 1);
5738 }
5739
5740 fputc ('\n', asm_out_file);
5741
5742 /* Include directory index */
5743 output_uleb128 (0);
5744 fputc ('\n', asm_out_file);
5745

--- 5 unchanged lines hidden (view full) ---

5751 output_uleb128 (0);
5752 fputc ('\n', asm_out_file);
5753 }
5754
5755 /* Terminate the file name table */
5756 ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
5757 fputc ('\n', asm_out_file);
5758
5846 }
5847
5848 fputc ('\n', asm_out_file);
5849
5850 /* Include directory index */
5851 output_uleb128 (0);
5852 fputc ('\n', asm_out_file);
5853

--- 5 unchanged lines hidden (view full) ---

5859 output_uleb128 (0);
5860 fputc ('\n', asm_out_file);
5861 }
5862
5863 /* Terminate the file name table */
5864 ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
5865 fputc ('\n', asm_out_file);
5866
5759 /* Set the address register to the first location in the text section */
5760 ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
5761 if (flag_debug_asm)
5762 fprintf (asm_out_file, "\t%s DW_LNE_set_address", ASM_COMMENT_START);
5867 /* We used to set the address register to the first location in the text
5868 section here, but that didn't accomplish anything since we already
5869 have a line note for the opening brace of the first function. */
5763
5870
5764 fputc ('\n', asm_out_file);
5765 output_uleb128 (1 + PTR_SIZE);
5766 fputc ('\n', asm_out_file);
5767 ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNE_set_address);
5768 fputc ('\n', asm_out_file);
5769 ASM_OUTPUT_DWARF_ADDR (asm_out_file, TEXT_SECTION);
5770 fputc ('\n', asm_out_file);
5771
5772 /* Generate the line number to PC correspondence table, encoded as
5773 a series of state machine operations. */
5774 current_file = 1;
5775 current_line = 1;
5871 /* Generate the line number to PC correspondence table, encoded as
5872 a series of state machine operations. */
5873 current_file = 1;
5874 current_line = 1;
5776 strcpy (prev_line_label, TEXT_SECTION);
5875 strcpy (prev_line_label, text_section_label);
5777 for (lt_index = 1; lt_index < line_info_table_in_use; ++lt_index)
5778 {
5876 for (lt_index = 1; lt_index < line_info_table_in_use; ++lt_index)
5877 {
5779 register dw_line_info_ref line_info;
5878 register dw_line_info_ref line_info = &line_info_table[lt_index];
5780
5879
5880 /* Don't emit anything for redundant notes. Just updating the
5881 address doesn't accomplish anything, because we already assume
5882 that anything after the last address is this line. */
5883 if (line_info->dw_line_num == current_line
5884 && line_info->dw_file_num == current_file)
5885 continue;
5886
5781 /* Emit debug info for the address of the current line, choosing
5782 the encoding that uses the least amount of space. */
5783 /* ??? Unfortunately, we have little choice here currently, and must
5784 always use the most general form. Gcc does not know the address
5785 delta itself, so we can't use DW_LNS_advance_pc. There are no known
5786 dwarf2 aware assemblers at this time, so we can't use any special
5787 pseudo ops that would allow the assembler to optimally encode this for
5788 us. Many ports do have length attributes which will give an upper

--- 26 unchanged lines hidden (view full) ---

5815 fputc ('\n', asm_out_file);
5816 ASM_OUTPUT_DWARF_ADDR (asm_out_file, line_label);
5817 fputc ('\n', asm_out_file);
5818 }
5819 strcpy (prev_line_label, line_label);
5820
5821 /* Emit debug info for the source file of the current line, if
5822 different from the previous line. */
5887 /* Emit debug info for the address of the current line, choosing
5888 the encoding that uses the least amount of space. */
5889 /* ??? Unfortunately, we have little choice here currently, and must
5890 always use the most general form. Gcc does not know the address
5891 delta itself, so we can't use DW_LNS_advance_pc. There are no known
5892 dwarf2 aware assemblers at this time, so we can't use any special
5893 pseudo ops that would allow the assembler to optimally encode this for
5894 us. Many ports do have length attributes which will give an upper

--- 26 unchanged lines hidden (view full) ---

5921 fputc ('\n', asm_out_file);
5922 ASM_OUTPUT_DWARF_ADDR (asm_out_file, line_label);
5923 fputc ('\n', asm_out_file);
5924 }
5925 strcpy (prev_line_label, line_label);
5926
5927 /* Emit debug info for the source file of the current line, if
5928 different from the previous line. */
5823 line_info = &line_info_table[lt_index];
5824 if (line_info->dw_file_num != current_file)
5825 {
5826 current_file = line_info->dw_file_num;
5827 ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_set_file);
5828 if (flag_debug_asm)
5829 fprintf (asm_out_file, "\t%s DW_LNS_set_file", ASM_COMMENT_START);
5830
5831 fputc ('\n', asm_out_file);
5832 output_uleb128 (current_file);
5833 if (flag_debug_asm)
5834 fprintf (asm_out_file, " (\"%s\")", file_table[current_file]);
5835
5836 fputc ('\n', asm_out_file);
5837 }
5838
5839 /* Emit debug info for the current line number, choosing the encoding
5840 that uses the least amount of space. */
5929 if (line_info->dw_file_num != current_file)
5930 {
5931 current_file = line_info->dw_file_num;
5932 ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_set_file);
5933 if (flag_debug_asm)
5934 fprintf (asm_out_file, "\t%s DW_LNS_set_file", ASM_COMMENT_START);
5935
5936 fputc ('\n', asm_out_file);
5937 output_uleb128 (current_file);
5938 if (flag_debug_asm)
5939 fprintf (asm_out_file, " (\"%s\")", file_table[current_file]);
5940
5941 fputc ('\n', asm_out_file);
5942 }
5943
5944 /* Emit debug info for the current line number, choosing the encoding
5945 that uses the least amount of space. */
5841 line_offset = line_info->dw_line_num - current_line;
5842 line_delta = line_offset - DWARF_LINE_BASE;
5843 current_line = line_info->dw_line_num;
5844 if (line_delta >= 0 && line_delta < (DWARF_LINE_RANGE - 1))
5946 if (line_info->dw_line_num != current_line)
5845 {
5947 {
5846 /* This can handle deltas from -10 to 234, using the current
5847 definitions of DWARF_LINE_BASE and DWARF_LINE_RANGE. This
5848 takes 1 byte. */
5849 ASM_OUTPUT_DWARF_DATA1 (asm_out_file,
5850 DWARF_LINE_OPCODE_BASE + line_delta);
5851 if (flag_debug_asm)
5852 fprintf (asm_out_file,
5853 "\t%s line %ld", ASM_COMMENT_START, current_line);
5948 line_offset = line_info->dw_line_num - current_line;
5949 line_delta = line_offset - DWARF_LINE_BASE;
5950 current_line = line_info->dw_line_num;
5951 if (line_delta >= 0 && line_delta < (DWARF_LINE_RANGE - 1))
5952 {
5953 /* This can handle deltas from -10 to 234, using the current
5954 definitions of DWARF_LINE_BASE and DWARF_LINE_RANGE. This
5955 takes 1 byte. */
5956 ASM_OUTPUT_DWARF_DATA1 (asm_out_file,
5957 DWARF_LINE_OPCODE_BASE + line_delta);
5958 if (flag_debug_asm)
5959 fprintf (asm_out_file,
5960 "\t%s line %ld", ASM_COMMENT_START, current_line);
5854
5961
5855 fputc ('\n', asm_out_file);
5962 fputc ('\n', asm_out_file);
5963 }
5964 else
5965 {
5966 /* This can handle any delta. This takes at least 4 bytes,
5967 depending on the value being encoded. */
5968 ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_advance_line);
5969 if (flag_debug_asm)
5970 fprintf (asm_out_file, "\t%s advance to line %ld",
5971 ASM_COMMENT_START, current_line);
5972
5973 fputc ('\n', asm_out_file);
5974 output_sleb128 (line_offset);
5975 fputc ('\n', asm_out_file);
5976 ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_copy);
5977 if (flag_debug_asm)
5978 fprintf (asm_out_file, "\t%s DW_LNS_copy", ASM_COMMENT_START);
5979 fputc ('\n', asm_out_file);
5980 }
5856 }
5857 else
5858 {
5981 }
5982 else
5983 {
5859 /* This can handle any delta. This takes at least 4 bytes, depending
5860 on the value being encoded. */
5861 ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_advance_line);
5984 /* We still need to start a new row, so output a copy insn. */
5985 ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_copy);
5862 if (flag_debug_asm)
5986 if (flag_debug_asm)
5863 fprintf (asm_out_file, "\t%s advance to line %ld",
5864 ASM_COMMENT_START, current_line);
5865
5987 fprintf (asm_out_file, "\t%s DW_LNS_copy", ASM_COMMENT_START);
5866 fputc ('\n', asm_out_file);
5988 fputc ('\n', asm_out_file);
5867 output_sleb128 (line_offset);
5868 fputc ('\n', asm_out_file);
5869 ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_copy);
5870 fputc ('\n', asm_out_file);
5871 }
5872 }
5873
5874 /* Emit debug info for the address of the end of the function. */
5875 if (0)
5876 {
5877 ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_fixed_advance_pc);
5878 if (flag_debug_asm)

--- 32 unchanged lines hidden (view full) ---

5911 function = 0;
5912 current_file = 1;
5913 current_line = 1;
5914 for (lt_index = 0; lt_index < separate_line_info_table_in_use; )
5915 {
5916 register dw_separate_line_info_ref line_info
5917 = &separate_line_info_table[lt_index];
5918
5989 }
5990 }
5991
5992 /* Emit debug info for the address of the end of the function. */
5993 if (0)
5994 {
5995 ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_fixed_advance_pc);
5996 if (flag_debug_asm)

--- 32 unchanged lines hidden (view full) ---

6029 function = 0;
6030 current_file = 1;
6031 current_line = 1;
6032 for (lt_index = 0; lt_index < separate_line_info_table_in_use; )
6033 {
6034 register dw_separate_line_info_ref line_info
6035 = &separate_line_info_table[lt_index];
6036
6037 /* Don't emit anything for redundant notes. */
6038 if (line_info->dw_line_num == current_line
6039 && line_info->dw_file_num == current_file
6040 && line_info->function == function)
6041 goto cont;
6042
5919 /* Emit debug info for the address of the current line. If this is
5920 a new function, or the first line of a function, then we need
5921 to handle it differently. */
5922 ASM_GENERATE_INTERNAL_LABEL (line_label, SEPARATE_LINE_CODE_LABEL,
5923 lt_index);
5924 if (function != line_info->function)
5925 {
5926 function = line_info->function;

--- 84 unchanged lines hidden (view full) ---

6011 if (flag_debug_asm)
6012 fprintf (asm_out_file, "\t%s advance to line %ld",
6013 ASM_COMMENT_START, current_line);
6014
6015 fputc ('\n', asm_out_file);
6016 output_sleb128 (line_offset);
6017 fputc ('\n', asm_out_file);
6018 ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_copy);
6043 /* Emit debug info for the address of the current line. If this is
6044 a new function, or the first line of a function, then we need
6045 to handle it differently. */
6046 ASM_GENERATE_INTERNAL_LABEL (line_label, SEPARATE_LINE_CODE_LABEL,
6047 lt_index);
6048 if (function != line_info->function)
6049 {
6050 function = line_info->function;

--- 84 unchanged lines hidden (view full) ---

6135 if (flag_debug_asm)
6136 fprintf (asm_out_file, "\t%s advance to line %ld",
6137 ASM_COMMENT_START, current_line);
6138
6139 fputc ('\n', asm_out_file);
6140 output_sleb128 (line_offset);
6141 fputc ('\n', asm_out_file);
6142 ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_copy);
6143 if (flag_debug_asm)
6144 fprintf (asm_out_file, "\t%s DW_LNS_copy", ASM_COMMENT_START);
6019 fputc ('\n', asm_out_file);
6020 }
6021 }
6145 fputc ('\n', asm_out_file);
6146 }
6147 }
6148 else
6149 {
6150 /* We still need to start a new row, so output a copy insn. */
6151 ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_copy);
6152 if (flag_debug_asm)
6153 fprintf (asm_out_file, "\t%s DW_LNS_copy", ASM_COMMENT_START);
6154 fputc ('\n', asm_out_file);
6155 }
6022
6156
6157 cont:
6023 ++lt_index;
6024
6025 /* If we're done with a function, end its sequence. */
6026 if (lt_index == separate_line_info_table_in_use
6027 || separate_line_info_table[lt_index].function != function)
6028 {
6029 current_file = 1;
6030 current_line = 1;

--- 1017 unchanged lines hidden (view full) ---

7048
7049 /* This decl represents a formal parameter which was optimized out.
7050 Note that DECL_INCOMING_RTL may be NULL in here, but we handle
7051 all* cases where (rtl == NULL_RTX) just below. */
7052 if (declared_type == passed_type)
7053 rtl = DECL_INCOMING_RTL (decl);
7054 else if (! BYTES_BIG_ENDIAN
7055 && TREE_CODE (declared_type) == INTEGER_TYPE
6158 ++lt_index;
6159
6160 /* If we're done with a function, end its sequence. */
6161 if (lt_index == separate_line_info_table_in_use
6162 || separate_line_info_table[lt_index].function != function)
6163 {
6164 current_file = 1;
6165 current_line = 1;

--- 1017 unchanged lines hidden (view full) ---

7183
7184 /* This decl represents a formal parameter which was optimized out.
7185 Note that DECL_INCOMING_RTL may be NULL in here, but we handle
7186 all* cases where (rtl == NULL_RTX) just below. */
7187 if (declared_type == passed_type)
7188 rtl = DECL_INCOMING_RTL (decl);
7189 else if (! BYTES_BIG_ENDIAN
7190 && TREE_CODE (declared_type) == INTEGER_TYPE
7056 && TYPE_SIZE (declared_type) <= TYPE_SIZE (passed_type))
7191 && (GET_MODE_SIZE (TYPE_MODE (declared_type))
7192 <= GET_MODE_SIZE (TYPE_MODE (passed_type))))
7057 rtl = DECL_INCOMING_RTL (decl);
7058 }
7193 rtl = DECL_INCOMING_RTL (decl);
7194 }
7195
7196 /* If the parm was passed in registers, but lives on the stack, then
7197 make a big endian correction if the mode of the type of the
7198 parameter is not the same as the mode of the rtl. */
7199 /* ??? This is the same series of checks that are made in dbxout.c before
7200 we reach the big endian correction code there. It isn't clear if all
7201 of these checks are necessary here, but keeping them all is the safe
7202 thing to do. */
7203 else if (GET_CODE (rtl) == MEM
7204 && XEXP (rtl, 0) != const0_rtx
7205 && ! CONSTANT_P (XEXP (rtl, 0))
7206 /* Not passed in memory. */
7207 && GET_CODE (DECL_INCOMING_RTL (decl)) != MEM
7208 /* Not passed by invisible reference. */
7209 && (GET_CODE (XEXP (rtl, 0)) != REG
7210 || REGNO (XEXP (rtl, 0)) == HARD_FRAME_POINTER_REGNUM
7211 || REGNO (XEXP (rtl, 0)) == STACK_POINTER_REGNUM
7212#if ARG_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
7213 || REGNO (XEXP (rtl, 0)) == ARG_POINTER_REGNUM
7214#endif
7215 )
7216 /* Big endian correction check. */
7217 && BYTES_BIG_ENDIAN
7218 && TYPE_MODE (TREE_TYPE (decl)) != GET_MODE (rtl)
7219 && (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (decl)))
7220 < UNITS_PER_WORD))
7221 {
7222 int offset = (UNITS_PER_WORD
7223 - GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (decl))));
7224 rtl = gen_rtx_MEM (TYPE_MODE (TREE_TYPE (decl)),
7225 plus_constant (XEXP (rtl, 0), offset));
7226 }
7059 }
7060
7061 if (rtl == NULL_RTX)
7062 return;
7063
7064 rtl = eliminate_regs (rtl, 0, NULL_RTX);
7065#ifdef LEAF_REG_REMAP
7227 }
7228
7229 if (rtl == NULL_RTX)
7230 return;
7231
7232 rtl = eliminate_regs (rtl, 0, NULL_RTX);
7233#ifdef LEAF_REG_REMAP
7066 if (leaf_function)
7234 if (current_function_uses_only_leaf_regs)
7067 leaf_renumber_regs_insn (rtl);
7068#endif
7069
7070 switch (GET_CODE (rtl))
7071 {
7072 case ADDRESSOF:
7073 /* The address of a variable that was optimized away; don't emit
7074 anything. */

--- 448 unchanged lines hidden (view full) ---

7523
7524 decl_scope_table[decl_scope_depth].scope = scope;
7525
7526 /* Sometimes, while recursively emitting subtypes within a class type,
7527 we end up recuring on a subtype at a higher level then the current
7528 subtype. In such a case, we need to search the decl_scope_table to
7529 find the parent of this subtype. */
7530
7235 leaf_renumber_regs_insn (rtl);
7236#endif
7237
7238 switch (GET_CODE (rtl))
7239 {
7240 case ADDRESSOF:
7241 /* The address of a variable that was optimized away; don't emit
7242 anything. */

--- 448 unchanged lines hidden (view full) ---

7691
7692 decl_scope_table[decl_scope_depth].scope = scope;
7693
7694 /* Sometimes, while recursively emitting subtypes within a class type,
7695 we end up recuring on a subtype at a higher level then the current
7696 subtype. In such a case, we need to search the decl_scope_table to
7697 find the parent of this subtype. */
7698
7531 if (TREE_CODE_CLASS (TREE_CODE (scope)) == 't')
7699 if (AGGREGATE_TYPE_P (scope))
7532 containing_scope = TYPE_CONTEXT (scope);
7533 else
7534 containing_scope = NULL_TREE;
7535
7536 /* The normal case. */
7537 if (decl_scope_depth == 0
7538 || containing_scope == NULL_TREE
7539 /* Ignore namespaces for the moment. */

--- 35 unchanged lines hidden (view full) ---

7575 containing_scope = decl_class_context (t);
7576 else
7577 containing_scope = DECL_CONTEXT (t);
7578
7579 /* Ignore namespaces for the moment. */
7580 if (containing_scope && TREE_CODE (containing_scope) == NAMESPACE_DECL)
7581 containing_scope = NULL_TREE;
7582
7700 containing_scope = TYPE_CONTEXT (scope);
7701 else
7702 containing_scope = NULL_TREE;
7703
7704 /* The normal case. */
7705 if (decl_scope_depth == 0
7706 || containing_scope == NULL_TREE
7707 /* Ignore namespaces for the moment. */

--- 35 unchanged lines hidden (view full) ---

7743 containing_scope = decl_class_context (t);
7744 else
7745 containing_scope = DECL_CONTEXT (t);
7746
7747 /* Ignore namespaces for the moment. */
7748 if (containing_scope && TREE_CODE (containing_scope) == NAMESPACE_DECL)
7749 containing_scope = NULL_TREE;
7750
7751 /* Ignore function type "scopes" from the C frontend. They mean that
7752 a tagged type is local to a parmlist of a function declarator, but
7753 that isn't useful to DWARF. */
7754 if (containing_scope && TREE_CODE (containing_scope) == FUNCTION_TYPE)
7755 containing_scope = NULL_TREE;
7756
7583 /* Function-local tags and functions get stuck in limbo until they are
7584 fixed up by decls_for_scope. */
7585 if (context_die == NULL && containing_scope != NULL_TREE
7586 && (TREE_CODE (t) == FUNCTION_DECL || is_tagged_type (t)))
7587 return NULL;
7588
7589 if (containing_scope == NULL_TREE)
7590 scope_die = comp_unit_die;

--- 20 unchanged lines hidden (view full) ---

7611 {
7612 scope_die = context_die;
7613 /* Since the checks below are no longer applicable. */
7614 i = 0;
7615 }
7616
7617 if (i < 0)
7618 {
7757 /* Function-local tags and functions get stuck in limbo until they are
7758 fixed up by decls_for_scope. */
7759 if (context_die == NULL && containing_scope != NULL_TREE
7760 && (TREE_CODE (t) == FUNCTION_DECL || is_tagged_type (t)))
7761 return NULL;
7762
7763 if (containing_scope == NULL_TREE)
7764 scope_die = comp_unit_die;

--- 20 unchanged lines hidden (view full) ---

7785 {
7786 scope_die = context_die;
7787 /* Since the checks below are no longer applicable. */
7788 i = 0;
7789 }
7790
7791 if (i < 0)
7792 {
7619 if (scope_die != comp_unit_die
7620 || TREE_CODE_CLASS (TREE_CODE (containing_scope)) != 't')
7793 if (TREE_CODE_CLASS (TREE_CODE (containing_scope)) != 't')
7621 abort ();
7622 if (debug_info_level > DINFO_LEVEL_TERSE
7623 && !TREE_ASM_WRITTEN (containing_scope))
7624 abort ();
7794 abort ();
7795 if (debug_info_level > DINFO_LEVEL_TERSE
7796 && !TREE_ASM_WRITTEN (containing_scope))
7797 abort ();
7798
7799 /* If none of the current dies are suitable, we get file scope. */
7800 scope_die = comp_unit_die;
7625 }
7626 }
7627
7628 return scope_die;
7629}
7630
7631/* Pop a declaration scope. */
7632static inline void

--- 243 unchanged lines hidden (view full) ---

7876 --pending_types;
7877 type = pending_types_list[pending_types];
7878 gen_type_die (type, context_die);
7879 if (!TREE_ASM_WRITTEN (type))
7880 abort ();
7881 }
7882}
7883
7801 }
7802 }
7803
7804 return scope_die;
7805}
7806
7807/* Pop a declaration scope. */
7808static inline void

--- 243 unchanged lines hidden (view full) ---

8052 --pending_types;
8053 type = pending_types_list[pending_types];
8054 gen_type_die (type, context_die);
8055 if (!TREE_ASM_WRITTEN (type))
8056 abort ();
8057 }
8058}
8059
8060/* Remember a type in the incomplete_types_list. */
8061
8062static void
8063add_incomplete_type (type)
8064 tree type;
8065{
8066 if (incomplete_types == incomplete_types_allocated)
8067 {
8068 incomplete_types_allocated += INCOMPLETE_TYPES_INCREMENT;
8069 incomplete_types_list
8070 = (tree *) xrealloc (incomplete_types_list,
8071 sizeof (tree) * incomplete_types_allocated);
8072 }
8073
8074 incomplete_types_list[incomplete_types++] = type;
8075}
8076
8077/* Walk through the list of incomplete types again, trying once more to
8078 emit full debugging info for them. */
8079
8080static void
8081retry_incomplete_types ()
8082{
8083 register tree type;
8084
8085 while (incomplete_types)
8086 {
8087 --incomplete_types;
8088 type = incomplete_types_list[incomplete_types];
8089 gen_type_die (type, comp_unit_die);
8090 }
8091}
8092
7884/* Generate a DIE to represent an inlined instance of an enumeration type. */
7885
7886static void
7887gen_inlined_enumeration_type_die (type, context_die)
7888 register tree type;
7889 register dw_die_ref context_die;
7890{
7891 register dw_die_ref type_die = new_die (DW_TAG_enumeration_type,

--- 265 unchanged lines hidden (view full) ---

8157 remove_children (subr_die);
8158 }
8159 else if (old_die)
8160 {
8161 register unsigned file_index
8162 = lookup_filename (DECL_SOURCE_FILE (decl));
8163
8164 if (get_AT_flag (old_die, DW_AT_declaration) != 1)
8093/* Generate a DIE to represent an inlined instance of an enumeration type. */
8094
8095static void
8096gen_inlined_enumeration_type_die (type, context_die)
8097 register tree type;
8098 register dw_die_ref context_die;
8099{
8100 register dw_die_ref type_die = new_die (DW_TAG_enumeration_type,

--- 265 unchanged lines hidden (view full) ---

8366 remove_children (subr_die);
8367 }
8368 else if (old_die)
8369 {
8370 register unsigned file_index
8371 = lookup_filename (DECL_SOURCE_FILE (decl));
8372
8373 if (get_AT_flag (old_die, DW_AT_declaration) != 1)
8165 abort ();
8374 {
8375 /* ??? This can happen if there is a bug in the program, for
8376 instance, if it has duplicate function definitions. Ideally,
8377 we should detect this case and ignore it. For now, if we have
8378 already reported an error, any error at all, then assume that
8379 we got here because of a input error, not a dwarf2 bug. */
8380 extern int errorcount;
8381 if (errorcount)
8382 return;
8383 abort ();
8384 }
8166
8167 /* If the definition comes from the same place as the declaration,
8168 maybe use the old DIE. We always want the DIE for this function
8169 that has the *_pc attributes to be under comp_unit_die so the
8170 debugger can find it. For inlines, that is the concrete instance,
8171 so we can use the old DIE here. For non-inline methods, we want a
8172 specification DIE at toplevel, so we need a new DIE. For local
8173 class methods, this does not apply. */

--- 311 unchanged lines hidden (view full) ---

8485 else
8486 add_name_and_src_coords_attributes (lbl_die, decl);
8487
8488 if (DECL_ABSTRACT (decl))
8489 equate_decl_number_to_die (decl, lbl_die);
8490 else
8491 {
8492 insn = DECL_RTL (decl);
8385
8386 /* If the definition comes from the same place as the declaration,
8387 maybe use the old DIE. We always want the DIE for this function
8388 that has the *_pc attributes to be under comp_unit_die so the
8389 debugger can find it. For inlines, that is the concrete instance,
8390 so we can use the old DIE here. For non-inline methods, we want a
8391 specification DIE at toplevel, so we need a new DIE. For local
8392 class methods, this does not apply. */

--- 311 unchanged lines hidden (view full) ---

8704 else
8705 add_name_and_src_coords_attributes (lbl_die, decl);
8706
8707 if (DECL_ABSTRACT (decl))
8708 equate_decl_number_to_die (decl, lbl_die);
8709 else
8710 {
8711 insn = DECL_RTL (decl);
8493 if (GET_CODE (insn) == CODE_LABEL)
8712
8713 /* Deleted labels are programmer specified labels which have been
8714 eliminated because of various optimisations. We still emit them
8715 here so that it is possible to put breakpoints on them. */
8716 if (GET_CODE (insn) == CODE_LABEL
8717 || ((GET_CODE (insn) == NOTE
8718 && NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED_LABEL)))
8494 {
8495 /* When optimization is enabled (via -O) some parts of the compiler
8496 (e.g. jump.c and cse.c) may try to delete CODE_LABEL insns which
8497 represent source-level labels which were explicitly declared by
8498 the user. This really shouldn't be happening though, so catch
8499 it if it ever does happen. */
8500 if (INSN_DELETED_P (insn))
8501 abort ();

--- 290 unchanged lines hidden (view full) ---

8792 register dw_die_ref type_die = lookup_type_die (type);
8793 register dw_die_ref scope_die = 0;
8794 register int nested = 0;
8795
8796 if (type_die && ! TYPE_SIZE (type))
8797 return;
8798
8799 if (TYPE_CONTEXT (type) != NULL_TREE
8719 {
8720 /* When optimization is enabled (via -O) some parts of the compiler
8721 (e.g. jump.c and cse.c) may try to delete CODE_LABEL insns which
8722 represent source-level labels which were explicitly declared by
8723 the user. This really shouldn't be happening though, so catch
8724 it if it ever does happen. */
8725 if (INSN_DELETED_P (insn))
8726 abort ();

--- 290 unchanged lines hidden (view full) ---

9017 register dw_die_ref type_die = lookup_type_die (type);
9018 register dw_die_ref scope_die = 0;
9019 register int nested = 0;
9020
9021 if (type_die && ! TYPE_SIZE (type))
9022 return;
9023
9024 if (TYPE_CONTEXT (type) != NULL_TREE
8800 && TREE_CODE_CLASS (TREE_CODE (TYPE_CONTEXT (type))) == 't')
9025 && AGGREGATE_TYPE_P (TYPE_CONTEXT (type)))
8801 nested = 1;
8802
8803 scope_die = scope_die_for (type, context_die);
8804
8805 if (! type_die || (nested && scope_die == comp_unit_die))
8806 /* First occurrence of type or toplevel definition of nested class. */
8807 {
8808 register dw_die_ref old_die = type_die;

--- 42 unchanged lines hidden (view full) ---

8851 tree vtype = DECL_FCONTEXT (TYPE_VFIELD (type));
8852
8853 gen_type_die (vtype, context_die);
8854 add_AT_die_ref (type_die, DW_AT_containing_type,
8855 lookup_type_die (vtype));
8856 }
8857 }
8858 else
9026 nested = 1;
9027
9028 scope_die = scope_die_for (type, context_die);
9029
9030 if (! type_die || (nested && scope_die == comp_unit_die))
9031 /* First occurrence of type or toplevel definition of nested class. */
9032 {
9033 register dw_die_ref old_die = type_die;

--- 42 unchanged lines hidden (view full) ---

9076 tree vtype = DECL_FCONTEXT (TYPE_VFIELD (type));
9077
9078 gen_type_die (vtype, context_die);
9079 add_AT_die_ref (type_die, DW_AT_containing_type,
9080 lookup_type_die (vtype));
9081 }
9082 }
9083 else
8859 add_AT_flag (type_die, DW_AT_declaration, 1);
9084 {
9085 add_AT_flag (type_die, DW_AT_declaration, 1);
9086
9087 /* We can't do this for function-local types, and we don't need to. */
9088 if (TREE_PERMANENT (type))
9089 add_incomplete_type (type);
9090 }
8860}
8861
8862/* Generate a DIE for a subroutine _type_. */
8863
8864static void
8865gen_subroutine_type_die (type, context_die)
8866 register tree type;
8867 register dw_die_ref context_die;

--- 137 unchanged lines hidden (view full) ---

9005
9006 case ENUMERAL_TYPE:
9007 case RECORD_TYPE:
9008 case UNION_TYPE:
9009 case QUAL_UNION_TYPE:
9010 /* If this is a nested type whose containing class hasn't been
9011 written out yet, writing it out will cover this one, too. */
9012 if (TYPE_CONTEXT (type)
9091}
9092
9093/* Generate a DIE for a subroutine _type_. */
9094
9095static void
9096gen_subroutine_type_die (type, context_die)
9097 register tree type;
9098 register dw_die_ref context_die;

--- 137 unchanged lines hidden (view full) ---

9236
9237 case ENUMERAL_TYPE:
9238 case RECORD_TYPE:
9239 case UNION_TYPE:
9240 case QUAL_UNION_TYPE:
9241 /* If this is a nested type whose containing class hasn't been
9242 written out yet, writing it out will cover this one, too. */
9243 if (TYPE_CONTEXT (type)
9013 && TREE_CODE_CLASS (TREE_CODE (TYPE_CONTEXT (type))) == 't'
9244 && AGGREGATE_TYPE_P (TYPE_CONTEXT (type))
9014 && ! TREE_ASM_WRITTEN (TYPE_CONTEXT (type)))
9015 {
9016 gen_type_die (TYPE_CONTEXT (type), context_die);
9017
9018 if (TREE_ASM_WRITTEN (TYPE_CONTEXT (type)))
9019 return;
9020
9021 /* If that failed, attach ourselves to the stub. */
9022 push_decl_scope (TYPE_CONTEXT (type));
9023 context_die = lookup_type_die (TYPE_CONTEXT (type));
9024 }
9025
9026 if (TREE_CODE (type) == ENUMERAL_TYPE)
9027 gen_enumeration_type_die (type, context_die);
9028 else
9029 gen_struct_or_union_type_die (type, context_die);
9030
9031 if (TYPE_CONTEXT (type)
9245 && ! TREE_ASM_WRITTEN (TYPE_CONTEXT (type)))
9246 {
9247 gen_type_die (TYPE_CONTEXT (type), context_die);
9248
9249 if (TREE_ASM_WRITTEN (TYPE_CONTEXT (type)))
9250 return;
9251
9252 /* If that failed, attach ourselves to the stub. */
9253 push_decl_scope (TYPE_CONTEXT (type));
9254 context_die = lookup_type_die (TYPE_CONTEXT (type));
9255 }
9256
9257 if (TREE_CODE (type) == ENUMERAL_TYPE)
9258 gen_enumeration_type_die (type, context_die);
9259 else
9260 gen_struct_or_union_type_die (type, context_die);
9261
9262 if (TYPE_CONTEXT (type)
9032 && TREE_CODE_CLASS (TREE_CODE (TYPE_CONTEXT (type))) == 't'
9263 && AGGREGATE_TYPE_P (TYPE_CONTEXT (type))
9033 && ! TREE_ASM_WRITTEN (TYPE_CONTEXT (type)))
9034 pop_decl_scope ();
9035
9036 /* Don't set TREE_ASM_WRITTEN on an incomplete struct; we want to fix
9037 it up if it is ever completed. gen_*_type_die will set it for us
9038 when appropriate. */
9039 return;
9040

--- 363 unchanged lines hidden (view full) ---

9404 If it does, then totally ignoring it is bound to screw up our count of
9405 blocks, and that in turn will completely screw up the labels we will
9406 reference in subsequent DW_AT_low_pc and DW_AT_high_pc attributes (for
9407 subsequent blocks). (It's too bad that BLOCK nodes don't carry their
9408 own sequence numbers with them!) */
9409 if (DECL_IGNORED_P (decl))
9410 {
9411 if (TREE_CODE (decl) == FUNCTION_DECL
9264 && ! TREE_ASM_WRITTEN (TYPE_CONTEXT (type)))
9265 pop_decl_scope ();
9266
9267 /* Don't set TREE_ASM_WRITTEN on an incomplete struct; we want to fix
9268 it up if it is ever completed. gen_*_type_die will set it for us
9269 when appropriate. */
9270 return;
9271

--- 363 unchanged lines hidden (view full) ---

9635 If it does, then totally ignoring it is bound to screw up our count of
9636 blocks, and that in turn will completely screw up the labels we will
9637 reference in subsequent DW_AT_low_pc and DW_AT_high_pc attributes (for
9638 subsequent blocks). (It's too bad that BLOCK nodes don't carry their
9639 own sequence numbers with them!) */
9640 if (DECL_IGNORED_P (decl))
9641 {
9642 if (TREE_CODE (decl) == FUNCTION_DECL
9412 && DECL_INITIAL (decl) != NULL)
9643 && DECL_INITIAL (decl) != NULL)
9413 abort ();
9414
9415 return;
9416 }
9417
9418 switch (TREE_CODE (decl))
9419 {
9420 case FUNCTION_DECL:

--- 349 unchanged lines hidden (view full) ---

9770 /* Generate the initial DIE for the .debug section. Note that the (string)
9771 value given in the DW_AT_name attribute of the DW_TAG_compile_unit DIE
9772 will (typically) be a relative pathname and that this pathname should be
9773 taken as being relative to the directory from which the compiler was
9774 invoked when the given (base) source file was compiled. */
9775 gen_compile_unit_die (main_input_filename);
9776
9777 ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0);
9644 abort ();
9645
9646 return;
9647 }
9648
9649 switch (TREE_CODE (decl))
9650 {
9651 case FUNCTION_DECL:

--- 349 unchanged lines hidden (view full) ---

10001 /* Generate the initial DIE for the .debug section. Note that the (string)
10002 value given in the DW_AT_name attribute of the DW_TAG_compile_unit DIE
10003 will (typically) be a relative pathname and that this pathname should be
10004 taken as being relative to the directory from which the compiler was
10005 invoked when the given (base) source file was compiled. */
10006 gen_compile_unit_die (main_input_filename);
10007
10008 ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0);
10009 ASM_GENERATE_INTERNAL_LABEL (abbrev_section_label, ABBREV_SECTION_LABEL, 0);
10010 ASM_GENERATE_INTERNAL_LABEL (text_section_label, TEXT_SECTION_LABEL, 0);
10011 ASM_GENERATE_INTERNAL_LABEL (debug_info_section_label,
10012 DEBUG_INFO_SECTION_LABEL, 0);
10013 ASM_GENERATE_INTERNAL_LABEL (debug_line_section_label,
10014 DEBUG_LINE_SECTION_LABEL, 0);
10015
10016 ASM_OUTPUT_SECTION (asm_out_file, ABBREV_SECTION);
10017 ASM_OUTPUT_LABEL (asm_out_file, abbrev_section_label);
10018 ASM_OUTPUT_SECTION (asm_out_file, TEXT_SECTION);
10019 ASM_OUTPUT_LABEL (asm_out_file, text_section_label);
10020 ASM_OUTPUT_SECTION (asm_out_file, DEBUG_INFO_SECTION);
10021 ASM_OUTPUT_LABEL (asm_out_file, debug_info_section_label);
10022 ASM_OUTPUT_SECTION (asm_out_file, DEBUG_LINE_SECTION);
10023 ASM_OUTPUT_LABEL (asm_out_file, debug_line_section_label);
9778}
9779
9780/* Output stuff that dwarf requires at the end of every file,
9781 and generate the DWARF-2 debugging info. */
9782
9783void
9784dwarf2out_finish ()
9785{

--- 19 unchanged lines hidden (view full) ---

9805 else if (die == comp_unit_die)
9806 ;
9807 else
9808 abort ();
9809 }
9810 free (node);
9811 }
9812
10024}
10025
10026/* Output stuff that dwarf requires at the end of every file,
10027 and generate the DWARF-2 debugging info. */
10028
10029void
10030dwarf2out_finish ()
10031{

--- 19 unchanged lines hidden (view full) ---

10051 else if (die == comp_unit_die)
10052 ;
10053 else
10054 abort ();
10055 }
10056 free (node);
10057 }
10058
10059 /* Walk through the list of incomplete types again, trying once more to
10060 emit full debugging info for them. */
10061 retry_incomplete_types ();
10062
9813 /* Traverse the DIE tree and add sibling attributes to those DIE's
9814 that have children. */
9815 add_sibling_attributes (comp_unit_die);
9816
9817 /* Output a terminator label for the .text section. */
9818 fputc ('\n', asm_out_file);
9819 ASM_OUTPUT_SECTION (asm_out_file, TEXT_SECTION);
9820 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, TEXT_END_LABEL, 0);

--- 16 unchanged lines hidden (view full) ---

9837 fputc ('\n', asm_out_file);
9838 ASM_OUTPUT_SECTION (asm_out_file, DEBUG_LINE_SECTION);
9839 output_line_info ();
9840
9841 /* We can only use the low/high_pc attributes if all of the code
9842 was in .text. */
9843 if (separate_line_info_table_in_use == 0)
9844 {
10063 /* Traverse the DIE tree and add sibling attributes to those DIE's
10064 that have children. */
10065 add_sibling_attributes (comp_unit_die);
10066
10067 /* Output a terminator label for the .text section. */
10068 fputc ('\n', asm_out_file);
10069 ASM_OUTPUT_SECTION (asm_out_file, TEXT_SECTION);
10070 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, TEXT_END_LABEL, 0);

--- 16 unchanged lines hidden (view full) ---

10087 fputc ('\n', asm_out_file);
10088 ASM_OUTPUT_SECTION (asm_out_file, DEBUG_LINE_SECTION);
10089 output_line_info ();
10090
10091 /* We can only use the low/high_pc attributes if all of the code
10092 was in .text. */
10093 if (separate_line_info_table_in_use == 0)
10094 {
9845 add_AT_lbl_id (comp_unit_die, DW_AT_low_pc, TEXT_SECTION);
10095 add_AT_lbl_id (comp_unit_die, DW_AT_low_pc, text_section_label);
9846 add_AT_lbl_id (comp_unit_die, DW_AT_high_pc, text_end_label);
9847 }
9848
10096 add_AT_lbl_id (comp_unit_die, DW_AT_high_pc, text_end_label);
10097 }
10098
9849 add_AT_section_offset (comp_unit_die, DW_AT_stmt_list, DEBUG_LINE_SECTION);
10099 add_AT_lbl_offset (comp_unit_die, DW_AT_stmt_list,
10100 debug_line_section_label);
9850 }
9851
9852 /* Output the abbreviation table. */
9853 fputc ('\n', asm_out_file);
9854 ASM_OUTPUT_SECTION (asm_out_file, ABBREV_SECTION);
9855 build_abbrev_table (comp_unit_die);
9856 output_abbrev_section ();
9857

--- 27 unchanged lines hidden ---
10101 }
10102
10103 /* Output the abbreviation table. */
10104 fputc ('\n', asm_out_file);
10105 ASM_OUTPUT_SECTION (asm_out_file, ABBREV_SECTION);
10106 build_abbrev_table (comp_unit_die);
10107 output_abbrev_section ();
10108

--- 27 unchanged lines hidden ---