From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 8CNOJZyOhF+qbwAAWB0awg (envelope-from ) for ; Mon, 12 Oct 2020 13:13:00 -0400 Received: by simark.ca (Postfix, from userid 112) id 96E381EF79; Mon, 12 Oct 2020 13:13:00 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 2EF811EF6F for ; Mon, 12 Oct 2020 13:12:59 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BDDC4384403D; Mon, 12 Oct 2020 17:12:58 +0000 (GMT) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by sourceware.org (Postfix) with ESMTPS id 87F643857C45 for ; Mon, 12 Oct 2020 17:12:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 87F643857C45 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=alves.ped@gmail.com Received: by mail-wr1-f67.google.com with SMTP id x7so11434102wrl.3 for ; Mon, 12 Oct 2020 10:12:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:cc:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=FEDWiqk6ALO2W/gy333iprjPTy4udXu3rBnbcfBO0Sc=; b=fJqJH2v+CFVZ8VSt9uyRuRHsQI1oSwjoVQy2IzgYAmJNjuDbuP8t6fnfa8R5psd9UC +QE3n7M3o22bNqcjPNYKF4FQDRCThdiZl2oh8DjiMED8sEfvNED4DqHXXjtgP1Yatcjy Bc5dRGgfyQb97rzWvCzsPiWBE56CPZIKOBNXPwu95c7NlJm7qFlCxYHM0rWEjIWpQRFM WlO1+OYlO6Z/1d9T4IwsnJSneaptxn/LQTIFiD/vywuwHasa27wC12znQvXURqa20qoh bOCbzybgZArGto97aojV58abtgdd7o4E9AOgBs3kHeQqnK0JG7EqTgrEFIwAOSdyALAk 9zfw== X-Gm-Message-State: AOAM532n+B4c7ZHwztnQ3NS139T9ofs8QYfHpB0ENwSgR3B/DBYt+kLV NgaYRQNtXTO6fTzemKZU5LOoMAzrBgBGs6Lg X-Google-Smtp-Source: ABdhPJyqBw9OLfxC/XDs1dZr6IiOtg1l2FUEpsVGaIQwlYvoFKc8Sbc0AX9M1FXdSYhedLBfgZ6MjA== X-Received: by 2002:adf:ba4f:: with SMTP id t15mr30018064wrg.335.1602522774884; Mon, 12 Oct 2020 10:12:54 -0700 (PDT) Received: from ?IPv6:2001:8a0:f91e:6d00:c80a:ea25:47ef:5f73? ([2001:8a0:f91e:6d00:c80a:ea25:47ef:5f73]) by smtp.gmail.com with ESMTPSA id u195sm1850741wmu.18.2020.10.12.10.12.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Oct 2020 10:12:53 -0700 (PDT) Subject: Re: [PATCH v2] Reject ambiguous C++ field accesses From: Pedro Alves To: Gary Benson , Luis Machado References: <20200827180251.20244-1-pedro@palves.net> <20200828143556.GA15596@blade.nx> <517539b0-54de-7196-9ef6-81c88a0b5f0b@palves.net> Message-ID: <4485500b-c151-225c-ff46-9842b5fbc2f0@palves.net> Date: Mon, 12 Oct 2020 18:12:51 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <517539b0-54de-7196-9ef6-81c88a0b5f0b@palves.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: , Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" 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 Alves