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 [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id DDB423858D39 for ; Fri, 11 Nov 2022 15:34:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DDB423858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668180896; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yVlz1XzsD0BwqLAzkgVb1mtvLu/IZHLawRd3ro6MQCY=; b=Ce1Py7sL51VKk3ohyoKd8O1Tq7s8KlUJ7pFjHVNjcxxGUFPWqBJ4oC58hsWu6mmUYcEdkA Kht+WaS9PjEacrLPcEOMYF4c4VbRu7YT/h0vutBrmhPDlVPHE+uiEUNAiCOTppChWhW5PF EngTlGQKQ+at0PFkCVshtKU9RwJ0kTc= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-564-9916UWDrMvCpjTSCV48Yzg-1; Fri, 11 Nov 2022 10:34:55 -0500 X-MC-Unique: 9916UWDrMvCpjTSCV48Yzg-1 Received: by mail-qk1-f200.google.com with SMTP id h8-20020a05620a284800b006b5c98f09fbso5014820qkp.21 for ; Fri, 11 Nov 2022 07:34:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yVlz1XzsD0BwqLAzkgVb1mtvLu/IZHLawRd3ro6MQCY=; b=N1iv0AWJdeXE8GJPFGcOlsEpCiE7KsBnibG7oHfB7Ve42+V9/7RLbOWsVv7mwgjzeD Qtkj7Bdaqh0D07ZI3ztLyIFUi3hc1LeHGAmtK23Qcz8jPDskRVrB/vM1i1qNp8TjdKUt wOtj/0d2OaVcw+ylHWggBVKbup9bv00tr6tgJV6ts9vNScfLtgCWKd+GIC4r2BEiIUxF mpDkssiA5vnwWv9aHqelSmKtZYZfvWj5onXD67LATFCLrOrepG6INMHY8DYE2lVKy/DS 9WujIJv6aymEpl1BF5qtpGYYEAXUxRhEkLo8pHymG+onelRiKLekDVZL8hzC/7KvyYot 42WA== X-Gm-Message-State: ANoB5pkiNFp1I2lo9599w4R4FAQnokutjTllnW0nq4XzU/YGqp+w9hm9 y6s7TOS0H9ggtqZ3/gQBo6BRW4QgRYCYmM9/65Fa82B3zJmNi7caEmUCUbbFjHKZIg0qxWgz9iX gkHkHzhM8peCXep5CIcWpTg== X-Received: by 2002:a05:6214:11a7:b0:4bc:1455:43c6 with SMTP id u7-20020a05621411a700b004bc145543c6mr2283126qvv.89.1668180894758; Fri, 11 Nov 2022 07:34:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf7BSiFY60mxIjSapsCGxM5x2T3WSr8tAoKPAhd6LaikLzgO+3W/XT/CAP274yXyly9tkMJC+w== X-Received: by 2002:a05:6214:11a7:b0:4bc:1455:43c6 with SMTP id u7-20020a05621411a700b004bc145543c6mr2283105qvv.89.1668180894464; Fri, 11 Nov 2022 07:34:54 -0800 (PST) Received: from [192.168.0.45] (ip-62-245-66-121.bb.vodafone.cz. [62.245.66.121]) by smtp.gmail.com with ESMTPSA id ay42-20020a05622a22aa00b0039a08c0a594sm1359571qtb.82.2022.11.11.07.34.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Nov 2022 07:34:53 -0800 (PST) Message-ID: Date: Fri, 11 Nov 2022 16:34:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: Re: [PATCH 2/2] gdb/c++: Detect ambiguous variables in imported namespaces To: Tom Tromey , Bruno Larsen via Gdb-patches References: <20221026155053.3394792-1-blarsen@redhat.com> <20221026155053.3394792-3-blarsen@redhat.com> <878rkk2gtt.fsf@tromey.com> From: Bruno Larsen In-Reply-To: <878rkk2gtt.fsf@tromey.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 09/11/2022 18:11, Tom Tromey wrote: >>>>>> "Bruno" == Bruno Larsen via Gdb-patches writes: > Bruno> This commit makes it so instead of exiting early when finding any symbol > Bruno> with the correct name, GDB continues searching through include > Bruno> directives until it finds another symbol with the same name but a > Bruno> different mangled name - returning an ambiguous variable - or goes > Bruno> through all imported namespaces and returns zero or one matching symbols. > > Thanks. This idea makes sense to me. > > Bruno> + const char* sym_name = nullptr; > > Wrong "*" placement. > > Bruno> + if(sym_name == nullptr) > > Missing space. > > Bruno> + { > Bruno> + saved_sym = sym; > Bruno> + sym_name = saved_sym.symbol->m_name; > Bruno> + sym = {}; > Bruno> + } > Bruno> + else if (strcmp(sym_name, sym.symbol->m_name) != 0) > > Here too. There is at least one more of these as well. > > Bruno> + error (_("reference to \"%s\" is ambiguous"), name); > > It would be more friendly to users if it printed the full names of the > ambiguous symbols... is that possible? Do you mean a message like the one below? reference to "x" is ambiguous, possiblities are M::x and N::x -- Cheers, Bruno > > Tom >