Deleted Added
sdiff udiff text old ( 245023 ) new ( 259269 )
full compact
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.

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

4210static void gen_label_die (tree, dw_die_ref);
4211static void gen_lexical_block_die (tree, dw_die_ref, int);
4212static void gen_inlined_subroutine_die (tree, dw_die_ref, int);
4213static void gen_field_die (tree, dw_die_ref);
4214static void gen_ptr_to_mbr_type_die (tree, dw_die_ref);
4215static dw_die_ref gen_compile_unit_die (const char *);
4216static void gen_inheritance_die (tree, tree, dw_die_ref);
4217static void gen_member_die (tree, dw_die_ref);
4218static void gen_struct_or_union_type_die (tree, dw_die_ref,
4219 enum debug_info_usage);
4220static void gen_subroutine_type_die (tree, dw_die_ref);
4221static void gen_typedef_die (tree, dw_die_ref);
4222static void gen_type_die (tree, dw_die_ref);
4223static void gen_tagged_type_instantiation_die (tree, dw_die_ref);
4224static void gen_block_die (tree, dw_die_ref, int);
4225static void decls_for_scope (tree, dw_die_ref, int);
4226static int is_redundant_typedef (tree);
4227static void gen_namespace_die (tree);

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

12469 }
12470}
12471
12472/* Generate a DIE for a structure or union type. If TYPE_DECL_SUPPRESS_DEBUG
12473 is set, we pretend that the type was never defined, so we only get the
12474 member DIEs needed by later specification DIEs. */
12475
12476static void
12477gen_struct_or_union_type_die (tree type, dw_die_ref context_die,
12478 enum debug_info_usage usage)
12479{
12480 dw_die_ref type_die = lookup_type_die (type);
12481 dw_die_ref scope_die = 0;
12482 int nested = 0;
12483 int complete = (TYPE_SIZE (type)
12484 && (! TYPE_STUB_DECL (type)
12485 || ! TYPE_DECL_SUPPRESS_DEBUG (TYPE_STUB_DECL (type))));
12486 int ns_decl = (context_die && context_die->die_tag == DW_TAG_namespace);
12487 complete = complete && should_emit_struct_debug (type, usage);
12488
12489 if (type_die && ! complete)
12490 return;
12491
12492 if (TYPE_CONTEXT (type) != NULL_TREE
12493 && (AGGREGATE_TYPE_P (TYPE_CONTEXT (type))
12494 || TREE_CODE (TYPE_CONTEXT (type)) == NAMESPACE_DECL))
12495 nested = 1;

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

12607
12608 if (DECL_ABSTRACT (decl))
12609 equate_decl_number_to_die (decl, type_die);
12610}
12611
12612/* Generate a type description DIE. */
12613
12614static void
12615gen_type_die_with_usage (tree type, dw_die_ref context_die,
12616 enum debug_info_usage usage)
12617{
12618 int need_pop;
12619
12620 if (type == NULL_TREE || type == error_mark_node)
12621 return;
12622
12623 if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
12624 && DECL_ORIGINAL_TYPE (TYPE_NAME (type)))

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

12656 ensures that the gen_type_die recursion will terminate even if the
12657 type is recursive. Recursive types are possible in Ada. */
12658 /* ??? We could perhaps do this for all types before the switch
12659 statement. */
12660 TREE_ASM_WRITTEN (type) = 1;
12661
12662 /* For these types, all that is required is that we output a DIE (or a
12663 set of DIEs) to represent the "basis" type. */
12664 gen_type_die_with_usage (TREE_TYPE (type), context_die,
12665 DINFO_USAGE_IND_USE);
12666 break;
12667
12668 case OFFSET_TYPE:
12669 /* This code is used for C++ pointer-to-data-member types.
12670 Output a description of the relevant class type. */
12671 gen_type_die_with_usage (TYPE_OFFSET_BASETYPE (type), context_die,
12672 DINFO_USAGE_IND_USE);
12673
12674 /* Output a description of the type of the object pointed to. */
12675 gen_type_die_with_usage (TREE_TYPE (type), context_die,
12676 DINFO_USAGE_IND_USE);
12677
12678 /* Now output a DIE to represent this pointer-to-data-member type
12679 itself. */
12680 gen_ptr_to_mbr_type_die (type, context_die);
12681 break;
12682
12683 case FUNCTION_TYPE:
12684 /* Force out return type (in case it wasn't forced out already). */
12685 gen_type_die_with_usage (TREE_TYPE (type), context_die,
12686 DINFO_USAGE_DIR_USE);
12687 gen_subroutine_type_die (type, context_die);
12688 break;
12689
12690 case METHOD_TYPE:
12691 /* Force out return type (in case it wasn't forced out already). */
12692 gen_type_die_with_usage (TREE_TYPE (type), context_die,
12693 DINFO_USAGE_DIR_USE);
12694 gen_subroutine_type_die (type, context_die);
12695 break;
12696
12697 case ARRAY_TYPE:
12698 gen_array_type_die (type, context_die);
12699 break;
12700
12701 case VECTOR_TYPE:

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

12711 to instantiations of member class templates; they need to be added to
12712 the containing class as they are generated. FIXME: This hurts the
12713 idea of combining type decls from multiple TUs, since we can't predict
12714 what set of template instantiations we'll get. */
12715 if (TYPE_CONTEXT (type)
12716 && AGGREGATE_TYPE_P (TYPE_CONTEXT (type))
12717 && ! TREE_ASM_WRITTEN (TYPE_CONTEXT (type)))
12718 {
12719 gen_type_die_with_usage (TYPE_CONTEXT (type), context_die, usage);
12720
12721 if (TREE_ASM_WRITTEN (type))
12722 return;
12723
12724 /* If that failed, attach ourselves to the stub. */
12725 push_decl_scope (TYPE_CONTEXT (type));
12726 context_die = lookup_type_die (TYPE_CONTEXT (type));
12727 need_pop = 1;

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

12735 if (TREE_CODE (type) == ENUMERAL_TYPE)
12736 {
12737 /* This might have been written out by the call to
12738 declare_in_namespace. */
12739 if (!TREE_ASM_WRITTEN (type))
12740 gen_enumeration_type_die (type, context_die);
12741 }
12742 else
12743 gen_struct_or_union_type_die (type, context_die, usage);
12744
12745 if (need_pop)
12746 pop_decl_scope ();
12747
12748 /* Don't set TREE_ASM_WRITTEN on an incomplete struct; we want to fix
12749 it up if it is ever completed. gen_*_type_die will set it for us
12750 when appropriate. */
12751 return;

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

12764
12765 default:
12766 gcc_unreachable ();
12767 }
12768
12769 TREE_ASM_WRITTEN (type) = 1;
12770}
12771
12772static void
12773gen_type_die (tree type, dw_die_ref context_die)
12774{
12775 gen_type_die_with_usage (type, context_die, DINFO_USAGE_DIR_USE);
12776}
12777
12778/* Generate a DIE for a tagged type instantiation. */
12779
12780static void
12781gen_tagged_type_instantiation_die (tree type, dw_die_ref context_die)
12782{
12783 if (type == NULL_TREE || type == error_mark_node)
12784 return;
12785

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

13367 We need decl DIE for reference and scope die. First, get DIE for the decl
13368 itself. */
13369
13370 /* Get the scope die for decl context. Use comp_unit_die for global module
13371 or decl. If die is not found for non globals, force new die. */
13372 if (!context)
13373 scope_die = comp_unit_die;
13374 else if (TYPE_P (context))
13375 {
13376 if (!should_emit_struct_debug (context, DINFO_USAGE_DIR_USE))
13377 return;
13378 scope_die = force_type_die (context);
13379 }
13380 else
13381 scope_die = force_decl_die (context);
13382
13383 /* For TYPE_DECL or CONST_DECL, lookup TREE_TYPE. */
13384 if (TREE_CODE (decl) == TYPE_DECL || TREE_CODE (decl) == CONST_DECL)
13385 {
13386 if (is_base_type (TREE_TYPE (decl)))
13387 at_import_die = base_type_die (TREE_TYPE (decl));

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

13397 emitted the member decl for this field. Emit it now. */
13398 if (TREE_CODE (decl) == FIELD_DECL)
13399 {
13400 tree type = DECL_CONTEXT (decl);
13401 dw_die_ref type_context_die;
13402
13403 if (TYPE_CONTEXT (type))
13404 if (TYPE_P (TYPE_CONTEXT (type)))
13405 {
13406 if (!should_emit_struct_debug (TYPE_CONTEXT (type),
13407 DINFO_USAGE_DIR_USE))
13408 return;
13409 type_context_die = force_type_die (TYPE_CONTEXT (type));
13410 }
13411 else
13412 type_context_die = force_decl_die (TYPE_CONTEXT (type));
13413 else
13414 type_context_die = comp_unit_die;
13415 gen_type_die_for_member (type, decl, type_context_die);
13416 }
13417 at_import_die = force_decl_die (decl);
13418 }

--- 1074 unchanged lines hidden ---