From patchwork Wed Nov 16 14:13:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guinevere Larsen X-Patchwork-Id: 55300 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DA42A395B414 for ; Wed, 16 Nov 2022 14:19:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DA42A395B414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668608343; bh=DDZt6A4xwqOLpyqCruUgDL86iw0R56kYxpq6+2SDpaQ=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=r1dmMEkajm+U2jYMNjhXp1LG752POobl2BzfIi1AqVf4S+D7FR7wIndE+ecPW99d7 YCEic4JL3s/t8rXIXaS0GrkknRLPaZbvewpa50M6qavkkflXQJGIEpqpAcj0ccMzG/ zjLrs/nZPbvuzZkH+gDiEc+L9EceHOgviE8aVJE8= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 1CA553947434 for ; Wed, 16 Nov 2022 14:18:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1CA553947434 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-408-wSNqxDegPCKfzyuskk7ykA-1; Wed, 16 Nov 2022 09:18:37 -0500 X-MC-Unique: wSNqxDegPCKfzyuskk7ykA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E7C8D806001; Wed, 16 Nov 2022 14:18:36 +0000 (UTC) Received: from fedora.redhat.com (ovpn-193-156.brq.redhat.com [10.40.193.156]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 144872024CC8; Wed, 16 Nov 2022 14:18:35 +0000 (UTC) To: gdb-patches@sourceware.org Cc: tom@tromey.com, Bruno Larsen Subject: [PATCH v2 0/2] Improve handling of using directives Date: Wed, 16 Nov 2022 15:13:35 +0100 Message-Id: <20221116141336.1160869-1-blarsen@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Bruno Larsen via Gdb-patches From: Guinevere Larsen Reply-To: Bruno Larsen Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" This series tries to fix two of the main issues I saw when trying to get gdb.cp/nsusing.exp working with clang. The first issue was that GDB wouldn't care about when the 'using' directive happened in the code, even if we were stopped before it, it was considered valid. The second was that GDB would find the first reasonable variable in the imported declarations and leave early, not caring about whether that variable was ambiguous or not. Each of my patches fixes one of those issues. Changelog for v2: * factored out some code to avoid unnecessary repetition. * made it so ambiguous variables are explicitly reported * fixed formatting issues. Bruno Larsen (2): gdb/c++: validate 'using' directives based on the current line gdb/c++: Detect ambiguous variables in imported namespaces gdb/cp-namespace.c | 82 ++++++++++++++++++++++++-------- gdb/dwarf2/read.c | 25 +++++++++- gdb/namespace.c | 25 ++++++++++ gdb/namespace.h | 16 ++++++- gdb/testsuite/gdb.cp/nsusing.cc | 3 +- gdb/testsuite/gdb.cp/nsusing.exp | 25 ++++++++-- 6 files changed, 149 insertions(+), 27 deletions(-)