From patchwork Tue Nov 22 11:33:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guinevere Larsen X-Patchwork-Id: 55315 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 5870B3858005 for ; Tue, 22 Nov 2022 11:51:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5870B3858005 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669117890; bh=OIi165bCaRAh7PSUS8lCIo5LxLKq6hafNcptgvkOgFY=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=uBeEOLGkQ0KiKQt/fcbenG70rg3TBXTw+s5FIqf4oKwSrz4nwPNJ5IBXBMSQt4p4a hPlsGKlvBRu0Z3p8e4c1LxaXlNArvOfLTSrm5vvnqaAUnG/vmkgJcf4uW317i/MiGI Avkcb5S23WOcRdLFtk2hBrWNlGkRI+LlzzLtLSQU= 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.129.124]) by sourceware.org (Postfix) with ESMTPS id EA9983858C54 for ; Tue, 22 Nov 2022 11:51:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EA9983858C54 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-381-KUqu4s9PMkyZNypZDvoHzg-1; Tue, 22 Nov 2022 06:51:01 -0500 X-MC-Unique: KUqu4s9PMkyZNypZDvoHzg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B2A283C0F663 for ; Tue, 22 Nov 2022 11:51:00 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.105]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3E0381415102; Tue, 22 Nov 2022 11:51:00 +0000 (UTC) To: gdb-patches@sourceware.org Cc: Bruno Larsen Subject: [PATCH v3 0/2] Improve handling of using directives Date: Tue, 22 Nov 2022 12:33:18 +0100 Message-Id: <20221122113319.1760546-1-blarsen@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, 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 v3: * changed map key to use std::string, so we get an ordered output. * Improved documentation on some spots * Fix bug where gdb could return a partial list of the ambiguous symbols 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 | 99 ++++++++++++++++++++++++-------- gdb/dwarf2/read.c | 30 +++++++++- 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, 167 insertions(+), 31 deletions(-)