1/* Output Dwarf2 format symbol table information from the GNU C compiler. |
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 |
21the Free Software Foundation, 59 Temple Place - Suite 330, 22Boston, MA 02111-1307, USA. */ |
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 |
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 |
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; |
645 --n_ranges; 646 t = build_int_2 (ranges[n_ranges].size, 0); |
647 do |
648 { |
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) |
654 abort (); |
655 last_end = end; 656 if (end - beg != ranges[n_ranges].end - ranges[n_ranges].beg) |
657 abort (); |
658 t2 = fold (build (LE_EXPR, integer_type_node, reg_tree, |
659 build_int_2 (end, 0))); |
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); |
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{ |
1040 unsigned int reg = (unsigned int) -1; |
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 |
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 |
1196 sets SP or FP (adjusting how we calculate the frame address) or saves a |
1197 register to the stack. */ |
1198 |
1199static void 1200dwarf2out_frame_debug_expr (expr, label) 1201 rtx expr; 1202 char *label; |
1203{ |
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. */ |
1212 |
1213 if (GET_CODE (expr) == PARALLEL) 1214 { 1215 int par_index; 1216 int limit = XVECLEN (expr, 0); |
1217 |
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 } |
1226 return; 1227 } |
1228 1229 if (GET_CODE (expr) != SET) |
1230 abort (); 1231 |
1232 src = SET_SRC (expr); 1233 dest = SET_DEST (expr); |
1234 1235 switch (GET_CODE (dest)) 1236 { 1237 case REG: 1238 /* Update the CFA rule wrt SP or FP. Make sure src is |
1239 relative to the current CFA register. */ |
1240 switch (GET_CODE (src)) |
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; |
1252 |
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 } |
1271 |
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 (); |
1281 |
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 } |
1289 else if (dest == hard_frame_pointer_rtx) 1290 { |
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 (); |
1296 |
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 } |
1318 |
1319 else 1320 abort(); |
1321 } |
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; |
1336 |
1337 case CONST_INT: 1338 cfa_temp_reg = REGNO (dest); 1339 cfa_temp_value = INTVAL (src); 1340 break; |
1341 |
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; |
1350 |
1351 default: 1352 abort (); 1353 } |
1354 dwarf2out_def_cfa (label, cfa_reg, cfa_offset); |
1355 break; |
1356 |
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; |
1370 |
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; |
1377 |
1378 offset = -cfa_store_offset; 1379 break; |
1380 |
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; |
1387 |
1388 if (cfa_store_reg != (unsigned) REGNO (XEXP (XEXP (dest, 0), 0))) 1389 abort (); 1390 offset -= cfa_store_offset; 1391 break; |
1392 |
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; |
1399 |
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; |
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); |
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 |
1726 force_data_section (); |
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. */ |
1872 if (for_eh) |
1873 ASM_OUTPUT_DWARF_DELTA4 (asm_out_file, l1, "__FRAME_BEGIN__"); |
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, |
2051 dw_val_class_lbl_offset, |
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; |
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 |
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 *)); |
2504static void add_AT_lbl_offset PROTO((dw_die_ref, |
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. */ |
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 |
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]; |
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 |
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 } \ |
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{ |
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 |
3632 |
3633 return DECL_ABSTRACT_ORIGIN (decl); |
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 |
3906add_AT_lbl_offset (die, attr_kind, label) |
3907 register dw_die_ref die; 3908 register enum dwarf_attribute attr_kind; |
3909 register char *label; |
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; |
3915 attr->dw_attr_val.val_class = dw_val_class_lbl_offset; 3916 attr->dw_attr_val.v.val_lbl_id = label; |
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: |
4380 fprintf (outfile, "label: %s", a->dw_attr_val.v.val_lbl_id); 4381 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; |
4745 case dw_val_class_lbl_offset: |
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 |
4847 current_file = 1; 4848 current_line = 1; 4849 for (lt_index = 1; lt_index < line_info_table_in_use; ++lt_index) 4850 { |
4851 register dw_line_info_ref line_info = &line_info_table[lt_index]; |
4852 |
4853 if (line_info->dw_line_num == current_line 4854 && line_info->dw_file_num == current_file) 4855 continue; 4856 |
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 |
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 |
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: |
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; |
5065 case dw_val_class_lbl_offset: |
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); |
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; |
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: |
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)); |
5401 |
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); |
5410 |
5411 fputc ('\n', asm_out_file); 5412 } |
5413 break; |
5414 } |
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 |
5445 case dw_val_class_lbl_offset: 5446 ASM_OUTPUT_DWARF_OFFSET (asm_out_file, a->dw_attr_val.v.val_lbl_id); |
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, |
5455 (int) strlen (a->dw_attr_val.v.val_str) + 1); |
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); |
5506 ASM_OUTPUT_DWARF_OFFSET (asm_out_file, abbrev_section_label); |
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); |
5579 ASM_OUTPUT_DWARF_OFFSET (asm_out_file, debug_info_section_label); |
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 { |
5607 ASM_OUTPUT_ASCII (asm_out_file, pub->name, 5608 (int) strlen (pub->name) + 1); |
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); |
5660 ASM_OUTPUT_DWARF_OFFSET (asm_out_file, debug_info_section_label); |
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); |
5686 ASM_OUTPUT_DWARF_ADDR (asm_out_file, text_section_label); |
5687 if (flag_debug_asm) 5688 fprintf (asm_out_file, "\t%s Address", ASM_COMMENT_START); 5689 5690 fputc ('\n', asm_out_file); |
5691 ASM_OUTPUT_DWARF_ADDR_DELTA (asm_out_file, text_end_label, 5692 text_section_label); |
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], |
5845 (int) strlen (file_table[ft_index]) + 1); |
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 |
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. */ |
5870 |
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; |
5875 strcpy (prev_line_label, text_section_label); |
5876 for (lt_index = 1; lt_index < line_info_table_in_use; ++lt_index) 5877 { |
5878 register dw_line_info_ref line_info = &line_info_table[lt_index]; |
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 |
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. */ |
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. */ |
5946 if (line_info->dw_line_num != current_line) |
5947 { |
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); |
5961 |
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 } |
5981 } 5982 else 5983 { |
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); |
5986 if (flag_debug_asm) |
5987 fprintf (asm_out_file, "\t%s DW_LNS_copy", ASM_COMMENT_START); |
5988 fputc ('\n', asm_out_file); |
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 |
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); |
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 } |
6156 |
6157 cont: |
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 |
7191 && (GET_MODE_SIZE (TYPE_MODE (declared_type)) 7192 <= GET_MODE_SIZE (TYPE_MODE (passed_type)))) |
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 } |
7227 } 7228 7229 if (rtl == NULL_RTX) 7230 return; 7231 7232 rtl = eliminate_regs (rtl, 0, NULL_RTX); 7233#ifdef LEAF_REG_REMAP |
7234 if (current_function_uses_only_leaf_regs) |
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 |
7699 if (AGGREGATE_TYPE_P (scope)) |
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 |
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 { |
7793 if (TREE_CODE_CLASS (TREE_CODE (containing_scope)) != 't') |
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; |
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 |
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) |
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 } |
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); |
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))) |
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 |
9025 && AGGREGATE_TYPE_P (TYPE_CONTEXT (type))) |
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 |
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 } |
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) |
9244 && AGGREGATE_TYPE_P (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) |
9263 && AGGREGATE_TYPE_P (TYPE_CONTEXT (type)) |
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 |
9643 && DECL_INITIAL (decl) != NULL) |
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); |
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 |
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 { |
10095 add_AT_lbl_id (comp_unit_die, DW_AT_low_pc, text_section_label); |
10096 add_AT_lbl_id (comp_unit_die, DW_AT_high_pc, text_end_label); 10097 } 10098 |
10099 add_AT_lbl_offset (comp_unit_die, DW_AT_stmt_list, 10100 debug_line_section_label); |
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 --- |