From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11579 invoked by alias); 9 Aug 2010 18:38:39 -0000 Received: (qmail 11563 invoked by uid 22791); 9 Aug 2010 18:38:35 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_BJ,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 09 Aug 2010 18:38:30 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o79IcSTM016174 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 9 Aug 2010 14:38:28 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o79IcRv8018872 for ; Mon, 9 Aug 2010 14:38:28 -0400 Received: from [10.15.16.129] (dhcp-10-15-16-129.yyz.redhat.com [10.15.16.129]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o79IcRVi003358 for ; Mon, 9 Aug 2010 14:38:27 -0400 Message-ID: <4C604B22.4060904@redhat.com> Date: Mon, 09 Aug 2010 18:38:00 -0000 From: sami wagiaalla User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Thunderbird/3.0.5 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: Re: [patch] Defer symbol addition until construction is complete References: <4C446F09.50107@redhat.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------090008010000010003030100" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-08/txt/msg00108.txt.bz2 This is a multi-part message in MIME format. --------------090008010000010003030100 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 168 > Ok with those changes. > I am reposting since the rebase want trivial; I change the template symbol code to take advantage of this clean up. Is this cool ? Sami --------------090008010000010003030100 Content-Type: text/plain; name="defer_symbol_addtion.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="defer_symbol_addtion.patch" Content-length: 6842 Complete symbol construction before adding to pending list. 2010-08-09 Sami Wagiaalla * dwarf2read.c (new_symbol): Add symbol to variable list at end of function after symbol construction is complete. Do the same for template symbol addition to template_symbols list. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 5275c58..e7f7d19 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -9996,6 +9996,8 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, struct attribute *attr = NULL; struct attribute *attr2 = NULL; CORE_ADDR baseaddr; + struct pending **list_to_add = NULL; + int inlined_func = (die->tag == DW_TAG_inlined_subroutine); baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); @@ -10088,11 +10090,11 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, access them globally. For instance, we want to be able to break on a nested subprogram without having to specify the context. */ - add_symbol_to_list (sym, &global_symbols); + list_to_add = &global_symbols; } else { - add_symbol_to_list (sym, cu->list_in_scope); + list_to_add = cu->list_in_scope; } break; case DW_TAG_inlined_subroutine: @@ -10129,17 +10131,12 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, { dwarf2_const_value (attr, sym, cu); attr2 = dwarf2_attr (die, DW_AT_external, cu); - if (suppress_add) - { - sym->hash_next = objfile->template_symbols; - objfile->template_symbols = sym; - } - else + if (!suppress_add) { if (attr2 && (DW_UNSND (attr2) != 0)) - add_symbol_to_list (sym, &global_symbols); + list_to_add = &global_symbols; else - add_symbol_to_list (sym, cu->list_in_scope); + list_to_add = cu->list_in_scope; } break; } @@ -10159,8 +10156,6 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, } else if (attr2 && (DW_UNSND (attr2) != 0)) { - struct pending **list_to_add; - /* Workaround gfortran PR debug/40040 - it uses DW_AT_location for variables in -fPIC libraries which may get overriden by other libraries/executable and get @@ -10179,10 +10174,9 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, but it may be block-scoped. */ list_to_add = (cu->list_in_scope == &file_symbols ? &global_symbols : cu->list_in_scope); - add_symbol_to_list (sym, list_to_add); } else - add_symbol_to_list (sym, cu->list_in_scope); + list_to_add = cu->list_in_scope; } else { @@ -10196,33 +10190,19 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, if (attr2 && (DW_UNSND (attr2) != 0) && dwarf2_attr (die, DW_AT_type, cu) != NULL) { - struct pending **list_to_add; - /* A variable with DW_AT_external is never static, but it may be block-scoped. */ list_to_add = (cu->list_in_scope == &file_symbols ? &global_symbols : cu->list_in_scope); SYMBOL_CLASS (sym) = LOC_UNRESOLVED; - if (suppress_add) - { - sym->hash_next = objfile->template_symbols; - objfile->template_symbols = sym; - } - else - add_symbol_to_list (sym, list_to_add); } else if (!die_is_declaration (die, cu)) { /* Use the default LOC_OPTIMIZED_OUT class. */ gdb_assert (SYMBOL_CLASS (sym) == LOC_OPTIMIZED_OUT); - if (suppress_add) - { - sym->hash_next = objfile->template_symbols; - objfile->template_symbols = sym; - } - else - add_symbol_to_list (sym, cu->list_in_scope); + if (!suppress_add) + list_to_add = cu->list_in_scope; } } break; @@ -10254,7 +10234,7 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, SYMBOL_TYPE (sym) = ref_type; } - add_symbol_to_list (sym, cu->list_in_scope); + list_to_add = cu->list_in_scope; break; case DW_TAG_unspecified_parameters: /* From varargs functions; gdb doesn't seem to have any @@ -10282,21 +10262,12 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, saves you. See the OtherFileClass tests in gdb.c++/namespace.exp. */ - if (suppress_add) + if (!suppress_add) { - sym->hash_next = objfile->template_symbols; - objfile->template_symbols = sym; - } - else - { - struct pending **list_to_add; - list_to_add = (cu->list_in_scope == &file_symbols && (cu->language == language_cplus || cu->language == language_java) ? &global_symbols : cu->list_in_scope); - - add_symbol_to_list (sym, list_to_add); } /* The semantics of C++ state that "struct foo { ... }" also @@ -10317,13 +10288,13 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, case DW_TAG_typedef: SYMBOL_CLASS (sym) = LOC_TYPEDEF; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; - add_symbol_to_list (sym, cu->list_in_scope); + list_to_add = cu->list_in_scope; break; case DW_TAG_base_type: case DW_TAG_subrange_type: SYMBOL_CLASS (sym) = LOC_TYPEDEF; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; - add_symbol_to_list (sym, cu->list_in_scope); + list_to_add = cu->list_in_scope; break; case DW_TAG_enumerator: attr = dwarf2_attr (die, DW_AT_const_value, cu); @@ -10335,19 +10306,15 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, /* NOTE: carlton/2003-11-10: See comment above in the DW_TAG_class_type, etc. block. */ - struct pending **list_to_add; - list_to_add = (cu->list_in_scope == &file_symbols && (cu->language == language_cplus || cu->language == language_java) ? &global_symbols : cu->list_in_scope); - - add_symbol_to_list (sym, list_to_add); } break; case DW_TAG_namespace: SYMBOL_CLASS (sym) = LOC_TYPEDEF; - add_symbol_to_list (sym, &global_symbols); + list_to_add = &global_symbols; break; default: /* Not a tag we recognize. Hopefully we aren't processing @@ -10359,6 +10326,16 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, break; } + if (suppress_add) + { + sym->hash_next = objfile->template_symbols; + objfile->template_symbols = sym; + list_to_add = NULL; + } + + if (list_to_add != NULL) + add_symbol_to_list (sym, list_to_add); + /* For the benefit of old versions of GCC, check for anonymous namespaces based on the demangled name. */ if (!processing_has_namespace_info --------------090008010000010003030100--