dwarf2out.c (259947) | dwarf2out.c (260395) |
---|---|
1/* Output Dwarf2 format symbol table information from GCC. 2 Copyright (C) 1992, 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 3 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 4 Contributed by Gary Funck (gary@intrepid.com). 5 Derived from DWARF 1 implementation of Ron Guilmette (rfg@monkeys.com). 6 Extensively modified by Jason Merrill (jason@cygnus.com). 7 8This file is part of GCC. --- 142 unchanged lines hidden (view full) --- 151/* Pointers to various DWARF2 sections. */ 152static GTY(()) section *debug_info_section; 153static GTY(()) section *debug_abbrev_section; 154static GTY(()) section *debug_aranges_section; 155static GTY(()) section *debug_macinfo_section; 156static GTY(()) section *debug_line_section; 157static GTY(()) section *debug_loc_section; 158static GTY(()) section *debug_pubnames_section; | 1/* Output Dwarf2 format symbol table information from GCC. 2 Copyright (C) 1992, 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 3 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 4 Contributed by Gary Funck (gary@intrepid.com). 5 Derived from DWARF 1 implementation of Ron Guilmette (rfg@monkeys.com). 6 Extensively modified by Jason Merrill (jason@cygnus.com). 7 8This file is part of GCC. --- 142 unchanged lines hidden (view full) --- 151/* Pointers to various DWARF2 sections. */ 152static GTY(()) section *debug_info_section; 153static GTY(()) section *debug_abbrev_section; 154static GTY(()) section *debug_aranges_section; 155static GTY(()) section *debug_macinfo_section; 156static GTY(()) section *debug_line_section; 157static GTY(()) section *debug_loc_section; 158static GTY(()) section *debug_pubnames_section; |
159static GTY(()) section *debug_pubtypes_section; |
|
159static GTY(()) section *debug_str_section; 160static GTY(()) section *debug_ranges_section; 161static GTY(()) section *debug_frame_section; 162 163/* How to start an assembler comment. */ 164#ifndef ASM_COMMENT_START 165#define ASM_COMMENT_START ";#" 166#endif --- 3587 unchanged lines hidden (view full) --- 3754 3755typedef struct pubname_struct GTY(()) 3756{ 3757 dw_die_ref die; 3758 char *name; 3759} 3760pubname_entry; 3761 | 160static GTY(()) section *debug_str_section; 161static GTY(()) section *debug_ranges_section; 162static GTY(()) section *debug_frame_section; 163 164/* How to start an assembler comment. */ 165#ifndef ASM_COMMENT_START 166#define ASM_COMMENT_START ";#" 167#endif --- 3587 unchanged lines hidden (view full) --- 3755 3756typedef struct pubname_struct GTY(()) 3757{ 3758 dw_die_ref die; 3759 char *name; 3760} 3761pubname_entry; 3762 |
3763DEF_VEC_O(pubname_entry); 3764DEF_VEC_ALLOC_O(pubname_entry, gc); 3765 |
|
3762struct dw_ranges_struct GTY(()) 3763{ 3764 int block_num; 3765}; 3766 3767/* The limbo die list structure. */ 3768typedef struct limbo_die_struct GTY(()) 3769{ --- 165 unchanged lines hidden (view full) --- 3935static GTY(()) unsigned separate_line_info_table_in_use; 3936 3937/* Size (in elements) of increments by which we may expand the 3938 line_info_table. */ 3939#define LINE_INFO_TABLE_INCREMENT 1024 3940 3941/* A pointer to the base of a table that contains a list of publicly 3942 accessible names. */ | 3766struct dw_ranges_struct GTY(()) 3767{ 3768 int block_num; 3769}; 3770 3771/* The limbo die list structure. */ 3772typedef struct limbo_die_struct GTY(()) 3773{ --- 165 unchanged lines hidden (view full) --- 3939static GTY(()) unsigned separate_line_info_table_in_use; 3940 3941/* Size (in elements) of increments by which we may expand the 3942 line_info_table. */ 3943#define LINE_INFO_TABLE_INCREMENT 1024 3944 3945/* A pointer to the base of a table that contains a list of publicly 3946 accessible names. */ |
3943static GTY ((length ("pubname_table_allocated"))) pubname_ref pubname_table; | 3947static GTY (()) VEC (pubname_entry, gc) * pubname_table; |
3944 | 3948 |
3945/* Number of elements currently allocated for pubname_table. */ 3946static GTY(()) unsigned pubname_table_allocated; | 3949/* A pointer to the base of a table that contains a list of publicly 3950 accessible types. */ 3951static GTY (()) VEC (pubname_entry, gc) * pubtype_table; |
3947 | 3952 |
3948/* Number of elements in pubname_table currently in use. */ 3949static GTY(()) unsigned pubname_table_in_use; 3950 3951/* Size (in elements) of increments by which we may expand the 3952 pubname_table. */ 3953#define PUBNAME_TABLE_INCREMENT 64 3954 | |
3955/* Array of dies for which we should generate .debug_arange info. */ 3956static GTY((length ("arange_table_allocated"))) dw_die_ref *arange_table; 3957 3958/* Number of elements currently allocated for arange_table. */ 3959static GTY(()) unsigned arange_table_allocated; 3960 3961/* Number of elements in arange_table currently in use. */ 3962static GTY(()) unsigned arange_table_in_use; --- 147 unchanged lines hidden (view full) --- 4110static void build_abbrev_table (dw_die_ref); 4111static void output_location_lists (dw_die_ref); 4112static int constant_size (long unsigned); 4113static unsigned long size_of_die (dw_die_ref); 4114static void calc_die_sizes (dw_die_ref); 4115static void mark_dies (dw_die_ref); 4116static void unmark_dies (dw_die_ref); 4117static void unmark_all_dies (dw_die_ref); | 3953/* Array of dies for which we should generate .debug_arange info. */ 3954static GTY((length ("arange_table_allocated"))) dw_die_ref *arange_table; 3955 3956/* Number of elements currently allocated for arange_table. */ 3957static GTY(()) unsigned arange_table_allocated; 3958 3959/* Number of elements in arange_table currently in use. */ 3960static GTY(()) unsigned arange_table_in_use; --- 147 unchanged lines hidden (view full) --- 4108static void build_abbrev_table (dw_die_ref); 4109static void output_location_lists (dw_die_ref); 4110static int constant_size (long unsigned); 4111static unsigned long size_of_die (dw_die_ref); 4112static void calc_die_sizes (dw_die_ref); 4113static void mark_dies (dw_die_ref); 4114static void unmark_dies (dw_die_ref); 4115static void unmark_all_dies (dw_die_ref); |
4118static unsigned long size_of_pubnames (void); | 4116static unsigned long size_of_pubnames (VEC (pubname_entry,gc) *); |
4119static unsigned long size_of_aranges (void); 4120static enum dwarf_form value_format (dw_attr_ref); 4121static void output_value_format (dw_attr_ref); 4122static void output_abbrev_section (void); 4123static void output_die_symbol (dw_die_ref); 4124static void output_die (dw_die_ref); 4125static void output_compilation_unit_header (void); 4126static void output_comp_unit (dw_die_ref, int); 4127static const char *dwarf2_name (tree, int); 4128static void add_pubname (tree, dw_die_ref); | 4117static unsigned long size_of_aranges (void); 4118static enum dwarf_form value_format (dw_attr_ref); 4119static void output_value_format (dw_attr_ref); 4120static void output_abbrev_section (void); 4121static void output_die_symbol (dw_die_ref); 4122static void output_die (dw_die_ref); 4123static void output_compilation_unit_header (void); 4124static void output_comp_unit (dw_die_ref, int); 4125static const char *dwarf2_name (tree, int); 4126static void add_pubname (tree, dw_die_ref); |
4129static void output_pubnames (void); | 4127static void add_pubtype (tree, dw_die_ref); 4128static void output_pubnames (VEC (pubname_entry,gc) *); |
4130static void add_arange (tree, dw_die_ref); 4131static void output_aranges (void); 4132static unsigned int add_ranges (tree); 4133static void output_ranges (void); 4134static void output_line_info (void); 4135static void output_file_names (void); 4136static dw_die_ref base_type_die (tree); 4137static tree root_type (tree); --- 2607 unchanged lines hidden (view full) --- 6745 6746 FOR_EACH_CHILD (die, c, unmark_all_dies (c)); 6747 6748 for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++) 6749 if (AT_class (a) == dw_val_class_die_ref) 6750 unmark_all_dies (AT_ref (a)); 6751} 6752 | 4129static void add_arange (tree, dw_die_ref); 4130static void output_aranges (void); 4131static unsigned int add_ranges (tree); 4132static void output_ranges (void); 4133static void output_line_info (void); 4134static void output_file_names (void); 4135static dw_die_ref base_type_die (tree); 4136static tree root_type (tree); --- 2607 unchanged lines hidden (view full) --- 6744 6745 FOR_EACH_CHILD (die, c, unmark_all_dies (c)); 6746 6747 for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++) 6748 if (AT_class (a) == dw_val_class_die_ref) 6749 unmark_all_dies (AT_ref (a)); 6750} 6751 |
6753/* Return the size of the .debug_pubnames table generated for the 6754 compilation unit. */ | 6752/* Return the size of the .debug_pubnames or .debug_pubtypes table 6753 generated for the compilation unit. */ |
6755 6756static unsigned long | 6754 6755static unsigned long |
6757size_of_pubnames (void) | 6756size_of_pubnames (VEC (pubname_entry, gc) * names) |
6758{ 6759 unsigned long size; 6760 unsigned i; | 6757{ 6758 unsigned long size; 6759 unsigned i; |
6760 pubname_ref p; |
|
6761 6762 size = DWARF_PUBNAMES_HEADER_SIZE; | 6761 6762 size = DWARF_PUBNAMES_HEADER_SIZE; |
6763 for (i = 0; i < pubname_table_in_use; i++) 6764 { 6765 pubname_ref p = &pubname_table[i]; 6766 size += DWARF_OFFSET_SIZE + strlen (p->name) + 1; 6767 } | 6763 for (i = 0; VEC_iterate (pubname_entry, names, i, p); i++) 6764 if (names != pubtype_table 6765 || p->die->die_offset != 0 6766 || !flag_eliminate_unused_debug_types) 6767 size += strlen (p->name) + DWARF_OFFSET_SIZE + 1; |
6768 6769 size += DWARF_OFFSET_SIZE; 6770 return size; 6771} 6772 6773/* Return the size of the information in the .debug_aranges section. */ 6774 6775static unsigned long --- 551 unchanged lines hidden (view full) --- 7327 return lang_hooks.dwarf_name (decl, scope ? 1 : 0); 7328} 7329 7330/* Add a new entry to .debug_pubnames if appropriate. */ 7331 7332static void 7333add_pubname (tree decl, dw_die_ref die) 7334{ | 6768 6769 size += DWARF_OFFSET_SIZE; 6770 return size; 6771} 6772 6773/* Return the size of the information in the .debug_aranges section. */ 6774 6775static unsigned long --- 551 unchanged lines hidden (view full) --- 7327 return lang_hooks.dwarf_name (decl, scope ? 1 : 0); 7328} 7329 7330/* Add a new entry to .debug_pubnames if appropriate. */ 7331 7332static void 7333add_pubname (tree decl, dw_die_ref die) 7334{ |
7335 pubname_ref p; | 7335 pubname_entry e; |
7336 7337 if (! TREE_PUBLIC (decl)) 7338 return; 7339 | 7336 7337 if (! TREE_PUBLIC (decl)) 7338 return; 7339 |
7340 if (pubname_table_in_use == pubname_table_allocated) | 7340 e.die = die; 7341 e.name = xstrdup (dwarf2_name (decl, 1)); 7342 VEC_safe_push (pubname_entry, gc, pubname_table, &e); 7343} 7344 7345/* Add a new entry to .debug_pubtypes if appropriate. */ 7346 7347static void 7348add_pubtype (tree decl, dw_die_ref die) 7349{ 7350 pubname_entry e; 7351 7352 e.name = NULL; 7353 if ((TREE_PUBLIC (decl) 7354 || die->die_parent == comp_unit_die) 7355 && (die->die_tag == DW_TAG_typedef || COMPLETE_TYPE_P (decl))) |
7341 { | 7356 { |
7342 pubname_table_allocated += PUBNAME_TABLE_INCREMENT; 7343 pubname_table 7344 = ggc_realloc (pubname_table, 7345 (pubname_table_allocated * sizeof (pubname_entry))); 7346 memset (pubname_table + pubname_table_in_use, 0, 7347 PUBNAME_TABLE_INCREMENT * sizeof (pubname_entry)); 7348 } | 7357 e.die = die; 7358 if (TYPE_P (decl)) 7359 { 7360 if (TYPE_NAME (decl)) 7361 { 7362 if (TREE_CODE (TYPE_NAME (decl)) == IDENTIFIER_NODE) 7363 e.name = xstrdup ((const char *) IDENTIFIER_POINTER 7364 (TYPE_NAME (decl))); 7365 else if (TREE_CODE (TYPE_NAME (decl)) == TYPE_DECL 7366 && DECL_NAME (TYPE_NAME (decl))) 7367 e.name = xstrdup ((const char *) IDENTIFIER_POINTER 7368 (DECL_NAME (TYPE_NAME (decl)))); 7369 else 7370 e.name = xstrdup ((const char *) get_AT_string (die, DW_AT_name)); 7371 } 7372 } 7373 else 7374 e.name = xstrdup (dwarf2_name (decl, 1)); |
7349 | 7375 |
7350 p = &pubname_table[pubname_table_in_use++]; 7351 p->die = die; 7352 p->name = xstrdup (dwarf2_name (decl, 1)); | 7376 /* If we don't have a name for the type, there's no point in adding 7377 it to the table. */ 7378 if (e.name && e.name[0] != '\0') 7379 VEC_safe_push (pubname_entry, gc, pubtype_table, &e); 7380 } |
7353} 7354 7355/* Output the public names table used to speed up access to externally | 7381} 7382 7383/* Output the public names table used to speed up access to externally |
7356 visible names. For now, only generate entries for externally 7357 visible procedures. */ | 7384 visible names; or the public types table used to find type definitions. */ |
7358 7359static void | 7385 7386static void |
7360output_pubnames (void) | 7387output_pubnames (VEC (pubname_entry, gc) * names) |
7361{ 7362 unsigned i; | 7388{ 7389 unsigned i; |
7363 unsigned long pubnames_length = size_of_pubnames (); | 7390 unsigned long pubnames_length = size_of_pubnames (names); 7391 pubname_ref pub; |
7364 7365 if (DWARF_INITIAL_LENGTH_SIZE - DWARF_OFFSET_SIZE == 4) 7366 dw2_asm_output_data (4, 0xffffffff, 7367 "Initial length escape value indicating 64-bit DWARF extension"); | 7392 7393 if (DWARF_INITIAL_LENGTH_SIZE - DWARF_OFFSET_SIZE == 4) 7394 dw2_asm_output_data (4, 0xffffffff, 7395 "Initial length escape value indicating 64-bit DWARF extension"); |
7368 dw2_asm_output_data (DWARF_OFFSET_SIZE, pubnames_length, 7369 "Length of Public Names Info"); | 7396 if (names == pubname_table) 7397 dw2_asm_output_data (DWARF_OFFSET_SIZE, pubnames_length, 7398 "Length of Public Names Info"); 7399 else 7400 dw2_asm_output_data (DWARF_OFFSET_SIZE, pubnames_length, 7401 "Length of Public Type Names Info"); |
7370 dw2_asm_output_data (2, DWARF_VERSION, "DWARF Version"); 7371 dw2_asm_output_offset (DWARF_OFFSET_SIZE, debug_info_section_label, 7372 debug_info_section, 7373 "Offset of Compilation Unit Info"); 7374 dw2_asm_output_data (DWARF_OFFSET_SIZE, next_die_offset, 7375 "Compilation Unit Length"); 7376 | 7402 dw2_asm_output_data (2, DWARF_VERSION, "DWARF Version"); 7403 dw2_asm_output_offset (DWARF_OFFSET_SIZE, debug_info_section_label, 7404 debug_info_section, 7405 "Offset of Compilation Unit Info"); 7406 dw2_asm_output_data (DWARF_OFFSET_SIZE, next_die_offset, 7407 "Compilation Unit Length"); 7408 |
7377 for (i = 0; i < pubname_table_in_use; i++) | 7409 for (i = 0; VEC_iterate (pubname_entry, names, i, pub); i++) |
7378 { | 7410 { |
7379 pubname_ref pub = &pubname_table[i]; | 7411 /* We shouldn't see pubnames for DIEs outside of the main CU. */ 7412 if (names == pubname_table) 7413 gcc_assert (pub->die->die_mark); |
7380 | 7414 |
7381 /* We shouldn't see pubnames for DIEs outside of the main CU. */ 7382 gcc_assert (pub->die->die_mark); | 7415 if (names != pubtype_table 7416 || pub->die->die_offset != 0 7417 || !flag_eliminate_unused_debug_types) 7418 { 7419 dw2_asm_output_data (DWARF_OFFSET_SIZE, pub->die->die_offset, 7420 "DIE offset"); |
7383 | 7421 |
7384 dw2_asm_output_data (DWARF_OFFSET_SIZE, pub->die->die_offset, 7385 "DIE offset"); 7386 7387 dw2_asm_output_nstring (pub->name, -1, "external name"); | 7422 dw2_asm_output_nstring (pub->name, -1, "external name"); 7423 } |
7388 } 7389 7390 dw2_asm_output_data (DWARF_OFFSET_SIZE, 0, NULL); 7391} 7392 7393/* Add a new entry to .debug_aranges if appropriate. */ 7394 7395static void --- 3897 unchanged lines hidden (view full) --- 11293#ifndef MIPS_DEBUGGING_INFO 11294 while (TREE_CODE (element_type) == ARRAY_TYPE) 11295 element_type = TREE_TYPE (element_type); 11296 11297 gen_type_die (element_type, context_die); 11298#endif 11299 11300 add_type_attribute (array_die, element_type, 0, 0, context_die); | 7424 } 7425 7426 dw2_asm_output_data (DWARF_OFFSET_SIZE, 0, NULL); 7427} 7428 7429/* Add a new entry to .debug_aranges if appropriate. */ 7430 7431static void --- 3897 unchanged lines hidden (view full) --- 11329#ifndef MIPS_DEBUGGING_INFO 11330 while (TREE_CODE (element_type) == ARRAY_TYPE) 11331 element_type = TREE_TYPE (element_type); 11332 11333 gen_type_die (element_type, context_die); 11334#endif 11335 11336 add_type_attribute (array_die, element_type, 0, 0, context_die); |
11337 11338 if (get_AT (array_die, DW_AT_name)) 11339 add_pubtype (type, array_die); |
|
11301} 11302 11303#if 0 11304static void 11305gen_entry_point_die (tree decl, dw_die_ref context_die) 11306{ 11307 tree origin = decl_ultimate_origin (decl); 11308 dw_die_ref decl_die = new_die (DW_TAG_entry_point, context_die, decl); --- 119 unchanged lines hidden (view full) --- 11428 will appear to have negative values in the debugger. */ 11429 add_AT_int (enum_die, DW_AT_const_value, 11430 tree_low_cst (value, tree_int_cst_sgn (value) > 0)); 11431 } 11432 } 11433 else 11434 add_AT_flag (type_die, DW_AT_declaration, 1); 11435 | 11340} 11341 11342#if 0 11343static void 11344gen_entry_point_die (tree decl, dw_die_ref context_die) 11345{ 11346 tree origin = decl_ultimate_origin (decl); 11347 dw_die_ref decl_die = new_die (DW_TAG_entry_point, context_die, decl); --- 119 unchanged lines hidden (view full) --- 11467 will appear to have negative values in the debugger. */ 11468 add_AT_int (enum_die, DW_AT_const_value, 11469 tree_low_cst (value, tree_int_cst_sgn (value) > 0)); 11470 } 11471 } 11472 else 11473 add_AT_flag (type_die, DW_AT_declaration, 1); 11474 |
11475 if (get_AT (type_die, DW_AT_name)) 11476 add_pubtype (type, type_die); 11477 |
|
11436 return type_die; 11437} 11438 11439/* Generate a DIE to represent either a real live formal parameter decl or to 11440 represent just the type of some formal parameter position in some function 11441 type. 11442 11443 Note that this routine is a bit unusual because its argument may be a --- 1104 unchanged lines hidden (view full) --- 12548 { 12549 add_AT_flag (type_die, DW_AT_declaration, 1); 12550 12551 /* We don't need to do this for function-local types. */ 12552 if (TYPE_STUB_DECL (type) 12553 && ! decl_function_context (TYPE_STUB_DECL (type))) 12554 VEC_safe_push (tree, gc, incomplete_types, type); 12555 } | 11478 return type_die; 11479} 11480 11481/* Generate a DIE to represent either a real live formal parameter decl or to 11482 represent just the type of some formal parameter position in some function 11483 type. 11484 11485 Note that this routine is a bit unusual because its argument may be a --- 1104 unchanged lines hidden (view full) --- 12590 { 12591 add_AT_flag (type_die, DW_AT_declaration, 1); 12592 12593 /* We don't need to do this for function-local types. */ 12594 if (TYPE_STUB_DECL (type) 12595 && ! decl_function_context (TYPE_STUB_DECL (type))) 12596 VEC_safe_push (tree, gc, incomplete_types, type); 12597 } |
12598 12599 if (get_AT (type_die, DW_AT_name)) 12600 add_pubtype (type, type_die); |
|
12556} 12557 12558/* Generate a DIE for a subroutine _type_. */ 12559 12560static void 12561gen_subroutine_type_die (tree type, dw_die_ref context_die) 12562{ 12563 tree return_type = TREE_TYPE (type); 12564 dw_die_ref subr_die 12565 = new_die (DW_TAG_subroutine_type, 12566 scope_die_for (type, context_die), type); 12567 12568 equate_type_number_to_die (type, subr_die); 12569 add_prototyped_attribute (subr_die, type); 12570 add_type_attribute (subr_die, return_type, 0, 0, context_die); 12571 gen_formal_types_die (type, subr_die); | 12601} 12602 12603/* Generate a DIE for a subroutine _type_. */ 12604 12605static void 12606gen_subroutine_type_die (tree type, dw_die_ref context_die) 12607{ 12608 tree return_type = TREE_TYPE (type); 12609 dw_die_ref subr_die 12610 = new_die (DW_TAG_subroutine_type, 12611 scope_die_for (type, context_die), type); 12612 12613 equate_type_number_to_die (type, subr_die); 12614 add_prototyped_attribute (subr_die, type); 12615 add_type_attribute (subr_die, return_type, 0, 0, context_die); 12616 gen_formal_types_die (type, subr_die); |
12617 12618 if (get_AT (subr_die, DW_AT_name)) 12619 add_pubtype (type, subr_die); |
|
12572} 12573 12574/* Generate a DIE for a type definition. */ 12575 12576static void 12577gen_typedef_die (tree decl, dw_die_ref context_die) 12578{ 12579 dw_die_ref type_die; --- 23 unchanged lines hidden (view full) --- 12603 type = TREE_TYPE (decl); 12604 12605 add_type_attribute (type_die, type, TREE_READONLY (decl), 12606 TREE_THIS_VOLATILE (decl), context_die); 12607 } 12608 12609 if (DECL_ABSTRACT (decl)) 12610 equate_decl_number_to_die (decl, type_die); | 12620} 12621 12622/* Generate a DIE for a type definition. */ 12623 12624static void 12625gen_typedef_die (tree decl, dw_die_ref context_die) 12626{ 12627 dw_die_ref type_die; --- 23 unchanged lines hidden (view full) --- 12651 type = TREE_TYPE (decl); 12652 12653 add_type_attribute (type_die, type, TREE_READONLY (decl), 12654 TREE_THIS_VOLATILE (decl), context_die); 12655 } 12656 12657 if (DECL_ABSTRACT (decl)) 12658 equate_decl_number_to_die (decl, type_die); |
12659 12660 if (get_AT (type_die, DW_AT_name)) 12661 add_pubtype (decl, type_die); |
|
12611} 12612 12613/* Generate a type description DIE. */ 12614 12615static void 12616gen_type_die_with_usage (tree type, dw_die_ref context_die, 12617 enum debug_info_usage usage) 12618{ --- 1308 unchanged lines hidden (view full) --- 13927 /* Allocate the initial hunk of the line_info_table. */ 13928 line_info_table = ggc_alloc_cleared (LINE_INFO_TABLE_INCREMENT 13929 * sizeof (dw_line_info_entry)); 13930 line_info_table_allocated = LINE_INFO_TABLE_INCREMENT; 13931 13932 /* Zero-th entry is allocated, but unused. */ 13933 line_info_table_in_use = 1; 13934 | 12662} 12663 12664/* Generate a type description DIE. */ 12665 12666static void 12667gen_type_die_with_usage (tree type, dw_die_ref context_die, 12668 enum debug_info_usage usage) 12669{ --- 1308 unchanged lines hidden (view full) --- 13978 /* Allocate the initial hunk of the line_info_table. */ 13979 line_info_table = ggc_alloc_cleared (LINE_INFO_TABLE_INCREMENT 13980 * sizeof (dw_line_info_entry)); 13981 line_info_table_allocated = LINE_INFO_TABLE_INCREMENT; 13982 13983 /* Zero-th entry is allocated, but unused. */ 13984 line_info_table_in_use = 1; 13985 |
13986 /* Allocate the pubtypes and pubnames vectors. */ 13987 pubname_table = VEC_alloc (pubname_entry, gc, 32); 13988 pubtype_table = VEC_alloc (pubname_entry, gc, 32); 13989 |
|
13935 /* Generate the initial DIE for the .debug section. Note that the (string) 13936 value given in the DW_AT_name attribute of the DW_TAG_compile_unit DIE 13937 will (typically) be a relative pathname and that this pathname should be 13938 taken as being relative to the directory from which the compiler was 13939 invoked when the given (base) source file was compiled. We will fill 13940 in this value in dwarf2out_finish. */ 13941 comp_unit_die = gen_compile_unit_die (NULL); 13942 --- 10 unchanged lines hidden (view full) --- 13953 debug_macinfo_section = get_section (DEBUG_MACINFO_SECTION, 13954 SECTION_DEBUG, NULL); 13955 debug_line_section = get_section (DEBUG_LINE_SECTION, 13956 SECTION_DEBUG, NULL); 13957 debug_loc_section = get_section (DEBUG_LOC_SECTION, 13958 SECTION_DEBUG, NULL); 13959 debug_pubnames_section = get_section (DEBUG_PUBNAMES_SECTION, 13960 SECTION_DEBUG, NULL); | 13990 /* Generate the initial DIE for the .debug section. Note that the (string) 13991 value given in the DW_AT_name attribute of the DW_TAG_compile_unit DIE 13992 will (typically) be a relative pathname and that this pathname should be 13993 taken as being relative to the directory from which the compiler was 13994 invoked when the given (base) source file was compiled. We will fill 13995 in this value in dwarf2out_finish. */ 13996 comp_unit_die = gen_compile_unit_die (NULL); 13997 --- 10 unchanged lines hidden (view full) --- 14008 debug_macinfo_section = get_section (DEBUG_MACINFO_SECTION, 14009 SECTION_DEBUG, NULL); 14010 debug_line_section = get_section (DEBUG_LINE_SECTION, 14011 SECTION_DEBUG, NULL); 14012 debug_loc_section = get_section (DEBUG_LOC_SECTION, 14013 SECTION_DEBUG, NULL); 14014 debug_pubnames_section = get_section (DEBUG_PUBNAMES_SECTION, 14015 SECTION_DEBUG, NULL); |
14016#ifdef DEBUG_PUBTYPES_SECTION 14017 debug_pubtypes_section = get_section (DEBUG_PUBTYPES_SECTION, 14018 SECTION_DEBUG, NULL); 14019#endif |
|
13961 debug_str_section = get_section (DEBUG_STR_SECTION, 13962 DEBUG_STR_SECTION_FLAGS, NULL); 13963 debug_ranges_section = get_section (DEBUG_RANGES_SECTION, 13964 SECTION_DEBUG, NULL); 13965 debug_frame_section = get_section (DEBUG_FRAME_SECTION, 13966 SECTION_DEBUG, NULL); 13967 13968 ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0); --- 266 unchanged lines hidden (view full) --- 14235 14236/* Remove dies representing declarations that we never use. */ 14237 14238static void 14239prune_unused_types (void) 14240{ 14241 unsigned int i; 14242 limbo_die_node *node; | 14020 debug_str_section = get_section (DEBUG_STR_SECTION, 14021 DEBUG_STR_SECTION_FLAGS, NULL); 14022 debug_ranges_section = get_section (DEBUG_RANGES_SECTION, 14023 SECTION_DEBUG, NULL); 14024 debug_frame_section = get_section (DEBUG_FRAME_SECTION, 14025 SECTION_DEBUG, NULL); 14026 14027 ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0); --- 266 unchanged lines hidden (view full) --- 14294 14295/* Remove dies representing declarations that we never use. */ 14296 14297static void 14298prune_unused_types (void) 14299{ 14300 unsigned int i; 14301 limbo_die_node *node; |
14302 pubname_ref pub; |
|
14243 14244#if ENABLE_ASSERT_CHECKING 14245 /* All the marks should already be clear. */ 14246 verify_marks_clear (comp_unit_die); 14247 for (node = limbo_die_list; node; node = node->next) 14248 verify_marks_clear (node->die); 14249#endif /* ENABLE_ASSERT_CHECKING */ 14250 14251 /* Set the mark on nodes that are actually used. */ 14252 prune_unused_types_walk (comp_unit_die); 14253 for (node = limbo_die_list; node; node = node->next) 14254 prune_unused_types_walk (node->die); 14255 14256 /* Also set the mark on nodes referenced from the 14257 pubname_table or arange_table. */ | 14303 14304#if ENABLE_ASSERT_CHECKING 14305 /* All the marks should already be clear. */ 14306 verify_marks_clear (comp_unit_die); 14307 for (node = limbo_die_list; node; node = node->next) 14308 verify_marks_clear (node->die); 14309#endif /* ENABLE_ASSERT_CHECKING */ 14310 14311 /* Set the mark on nodes that are actually used. */ 14312 prune_unused_types_walk (comp_unit_die); 14313 for (node = limbo_die_list; node; node = node->next) 14314 prune_unused_types_walk (node->die); 14315 14316 /* Also set the mark on nodes referenced from the 14317 pubname_table or arange_table. */ |
14258 for (i = 0; i < pubname_table_in_use; i++) 14259 prune_unused_types_mark (pubname_table[i].die, 1); | 14318 for (i = 0; VEC_iterate (pubname_entry, pubname_table, i, pub); i++) 14319 prune_unused_types_mark (pub->die, 1); |
14260 for (i = 0; i < arange_table_in_use; i++) 14261 prune_unused_types_mark (arange_table[i], 1); 14262 14263 /* Get rid of nodes that aren't marked; and update the string counts. */ 14264 if (debug_str_hash) 14265 htab_empty (debug_str_hash); 14266 prune_unused_types_prune (comp_unit_die); 14267 for (node = limbo_die_list; node; node = node->next) --- 164 unchanged lines hidden (view full) --- 14432 14433 output_comp_unit (comp_unit_die, 0); 14434 14435 /* Output the abbreviation table. */ 14436 switch_to_section (debug_abbrev_section); 14437 output_abbrev_section (); 14438 14439 /* Output public names table if necessary. */ | 14320 for (i = 0; i < arange_table_in_use; i++) 14321 prune_unused_types_mark (arange_table[i], 1); 14322 14323 /* Get rid of nodes that aren't marked; and update the string counts. */ 14324 if (debug_str_hash) 14325 htab_empty (debug_str_hash); 14326 prune_unused_types_prune (comp_unit_die); 14327 for (node = limbo_die_list; node; node = node->next) --- 164 unchanged lines hidden (view full) --- 14492 14493 output_comp_unit (comp_unit_die, 0); 14494 14495 /* Output the abbreviation table. */ 14496 switch_to_section (debug_abbrev_section); 14497 output_abbrev_section (); 14498 14499 /* Output public names table if necessary. */ |
14440 if (pubname_table_in_use) | 14500 if (!VEC_empty (pubname_entry, pubname_table)) |
14441 { 14442 switch_to_section (debug_pubnames_section); | 14501 { 14502 switch_to_section (debug_pubnames_section); |
14443 output_pubnames (); | 14503 output_pubnames (pubname_table); |
14444 } 14445 | 14504 } 14505 |
14506#ifdef DEBUG_PUBTYPES_SECTION 14507 /* Output public types table if necessary. */ 14508 if (!VEC_empty (pubname_entry, pubtype_table)) 14509 { 14510 switch_to_section (debug_pubtypes_section); 14511 output_pubnames (pubtype_table); 14512 } 14513#endif 14514 |
|
14446 /* Output the address range information. We only put functions in the arange 14447 table, so don't write it out if we don't have any. */ 14448 if (fde_table_in_use) 14449 { 14450 switch_to_section (debug_aranges_section); 14451 output_aranges (); 14452 } 14453 --- 40 unchanged lines hidden --- | 14515 /* Output the address range information. We only put functions in the arange 14516 table, so don't write it out if we don't have any. */ 14517 if (fde_table_in_use) 14518 { 14519 switch_to_section (debug_aranges_section); 14520 output_aranges (); 14521 } 14522 --- 40 unchanged lines hidden --- |