From patchwork Wed Mar 18 19:39:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 5687 Received: (qmail 104854 invoked by alias); 18 Mar 2015 19:39:53 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 104781 invoked by uid 89); 18 Mar 2015 19:39:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-pa0-f74.google.com Received: from mail-pa0-f74.google.com (HELO mail-pa0-f74.google.com) (209.85.220.74) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 18 Mar 2015 19:39:46 +0000 Received: by padet14 with SMTP id et14so3255183pad.1 for ; Wed, 18 Mar 2015 12:39:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-type; bh=h6YiLaE/JgWMVm75RPs4lsJWT7P1QB+xgqsPhk8YRMo=; b=aSFbB6bl9s9I2NtwbiFzuornLEE5j9LqpZBjDV+Bx2sEMPoaVYyM69BDEYFfORElEs aQE8BVdWEWHeTEt/6cr7/+GVBYebuJ0NT9PpW2pEQsj5Ptoc3qRTRh2E3AB24jk1GFvt c4hx3V7jNqg/6q6jwPZijKx6fCwL+PLcYpUF/JxJSMqloM4rW7P7cjb9XveGVyHX09W5 PSFzt5pvtGDByetqo3Bqiyu/M/28qF8T7X7QQa2XDMqj3sIA8e5pJzeGnX3xCZQfG/oD v78KI1n/c9xizn7f3Scpxsrn8HIcXZ7N0gd/lAcXwdk017Xb/oo6z54qeaKhOsxoJBz6 N3bg== X-Gm-Message-State: ALoCoQlqbBPfjJpXw4HzVWckESRbgtdQR7hkSsOEcr70XD1QG0y31e4kkzifUNoWcAeenmxllGP9oekv8y3WKzsG5Ztyi70V23YjuN4noHac1MO5UrPbRSXugV/VyC8lGI7ksPQbwqi+QbtqLJ7pONEQOwPxY9I86z3ROJd8m7uGylKUho88RL4= X-Received: by 10.66.141.104 with SMTP id rn8mr25091226pab.42.1426707584726; Wed, 18 Mar 2015 12:39:44 -0700 (PDT) Received: from corpmail-nozzle1-2.hot.corp.google.com ([100.108.1.103]) by gmr-mx.google.com with ESMTPS id a11si110244yho.7.2015.03.18.12.39.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Mar 2015 12:39:44 -0700 (PDT) Received: from ruffy.mtv.corp.google.com ([172.17.128.44]) by corpmail-nozzle1-2.hot.corp.google.com with ESMTPS id Ni1KGhYI.1; Wed, 18 Mar 2015 12:39:44 -0700 From: Doug Evans To: gdb-patches@sourceware.org Subject: [PATCH] [c++/18141] Fix perf issue Date: Wed, 18 Mar 2015 12:39:43 -0700 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Hi. The bug report explains the issue hopefully sufficiently: https://sourceware.org/bugzilla/show_bug.cgi?id=18141 Basically, gdb is looking up "std" in .gdb_index, the index saying it's present, gdb expanding the containing CU, but then the final lookup not finding it. This leads to expanding one CU in every objfile that has an entry for "std". A followup patch will add a complaint for this case. In this case it's really an internal error, but I'm not sure it'll always be an internal error, nor whether one can adequately distinguish them. Regression tested on amd64-linux. Before: (gdb) print foo .... Command execution time: 297.609072 (cpu), 761.008252 (wall) Space used: 25874649088 (+20380094464 for this command) #symtabs: 622313 (+621693), #compunits: 8782 (+8774), #blocks: 4377936 (+4373024) After: (gdb) print foo .... Command execution time: 0.605912 (cpu), 0.971609 (wall) Space used: 5538639872 (+42561536 for this command) #symtabs: 924 (+304), #compunits: 10 (+2), #blocks: 8950 (+4038) 2015-03-18 Doug Evans PR c++/18141 * cp-namespace.c (cp_search_static_and_baseclasses): Always look for klass in VAR_DOMAIN. diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index 4a00cb6..0feeb35 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -355,8 +355,11 @@ cp_search_static_and_baseclasses (const char *name, make_cleanup (xfree, nested); /* Lookup a class named KLASS. If none is found, there is nothing - more that can be done. */ - klass_sym = lookup_global_symbol (klass, block, domain); + more that can be done. KLASS could be a namespace, so always look + in VAR_DOMAIN. This works for classes too because of + symbol_matches_domain (which should be replaced with something else, + but it's what we have today). */ + klass_sym = lookup_global_symbol (klass, block, VAR_DOMAIN); if (klass_sym == NULL) { do_cleanups (cleanup);