From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 978543857003 for ; Tue, 13 Oct 2020 08:47:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 978543857003 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-269-FJ-NCdisN9OYTn7FZL4YYA-1; Tue, 13 Oct 2020 04:47:36 -0400 X-MC-Unique: FJ-NCdisN9OYTn7FZL4YYA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4EC3B10866A2; Tue, 13 Oct 2020 08:47:34 +0000 (UTC) Received: from blade.nx (ovpn-115-18.ams2.redhat.com [10.36.115.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0814F10013D0; Tue, 13 Oct 2020 08:47:34 +0000 (UTC) Received: by blade.nx (Postfix, from userid 1000) id 0992D816CD2E; Tue, 13 Oct 2020 09:47:32 +0100 (BST) Date: Tue, 13 Oct 2020 09:47:32 +0100 From: Gary Benson To: Pedro Alves Cc: Luis Machado , gdb-patches@sourceware.org Subject: Re: [PATCH v2] Reject ambiguous C++ field accesses Message-ID: <20201013084732.GA9883@blade.nx> References: <20200827180251.20244-1-pedro@palves.net> <20200828143556.GA15596@blade.nx> <517539b0-54de-7196-9ef6-81c88a0b5f0b@palves.net> <4485500b-c151-225c-ff46-9842b5fbc2f0@palves.net> MIME-Version: 1.0 In-Reply-To: <4485500b-c151-225c-ff46-9842b5fbc2f0@palves.net> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-7.3 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_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Tue, 13 Oct 2020 08:47:40 -0000 Pedro Alves wrote: > On 8/28/20 9:22 PM, Pedro Alves wrote: > > gdb/ChangeLog: > > > > * valops.c (struct struct_field_searcher): New. > > (update_search_result): Rename to ... > > (struct_field_searcher::update_result): ... this. Simplify > > prototype. Record all found fields. > > (do_search_struct_field): Rename to ... > > (struct_field_searcher::search): ... this. Simplify prototype. > > Maintain stack of visited baseclass path. Call update_result for > > fields too. Keep searching fields in baseclasses instead of > > stopping at the first found field. > > (search_struct_field): Use struct_field_searcher. When looking > > for fields, report ambiguous access attempts. > > > > gdb/testsuite/ChangeLog: > > > > PR c++/26550 > > * gdb.cp/ambiguous.cc (marker1): Delete. > > (main): Initialize all the fields of the locals. Replace marker1 > > call with a "set breakpoint here" marker. > > * gdb.cp/ambiguous.exp: Modernize. Use gdb_continue_to_breakpoint > > instead of running to marker1. Add tests printing all the > > variables and all the fields of the variables. > > (test_ambiguous): New proc, expecting the new GDB output when a > > field access is ambiguous. Change all "warning: X ambiguous" > > tests to use it. > > I've merged this now. Thanks Pedro. Cheers, Gary -- Gary Benson - he / him / his Principal Software Engineer, Red Hat