From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) by sourceware.org (Postfix) with ESMTPS id B61003858C51 for ; Mon, 21 Mar 2022 23:10:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B61003858C51 Received: by mail-qt1-x82f.google.com with SMTP id bp39so1496162qtb.6 for ; Mon, 21 Mar 2022 16:10:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=3sunQnvLJm70ddl48fBMtPFm7LdjnGg2FOZMEpjhC/U=; b=UEyYxb5wMPSs7fPh7uxJEML4rl/T7vh8KOP6lAJuUXyiKUAwJAlNEjyIEykFkN3wi5 Pu3FGlSMXWcwRYyEGED4Ih6HO7ZgxXKDSJT67/YhMlVFcOAdJDhHWvW08ufxGffbZRh/ 7b5tXj3eUZNdAvLOj462dHDJgeXm5YLPU3H7F4dn/LdtVyzx1bYozb+v24Ho0Vl3TCu3 u0rJfpFQH+l5YBAEvESJTQbxCpuvLpUZz2IVg4t+OSpLnPzW3Y0kKV5d81xa2vFifyVy XdPTGSbWbgXXtauVPg0oxNohCVgItgTYWXNz8ZhANlen98AbMMtC3SRGubOlKGH4tGpr d8TQ== X-Gm-Message-State: AOAM531txdRiFNGMQ5hAsXMFT7o6HY5ih2kJvqye5ipHrK6Mup7nzR5p pTIQe2F5T3nXijNIoGojEyfbquP2DZI= X-Google-Smtp-Source: ABdhPJx3en6WHtSbA0a1uZjUapxh7Xs72RzufiBGGqyBpZnxigQIMDfZsJyYg7YVa+lGWfBbqP/nnw== X-Received: by 2002:a05:622a:1749:b0:2e1:b971:f404 with SMTP id l9-20020a05622a174900b002e1b971f404mr17989705qtk.662.1647904209607; Mon, 21 Mar 2022 16:10:09 -0700 (PDT) Received: from [192.168.1.127] (173-246-5-136.qc.cable.ebox.net. [173.246.5.136]) by smtp.gmail.com with ESMTPSA id p16-20020a05620a22b000b0067b7b158985sm7947992qkh.128.2022.03.21.16.10.08 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Mar 2022 16:10:09 -0700 (PDT) To: gdb@sourceware.org From: Philippe Blain Subject: "No symbol name in current context" for conditional breakpoint on linked list item "name", under -O0 Message-ID: Date: Mon, 21 Mar 2022 19:10:08 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Mar 2022 23:10:12 -0000 Hi, I'm trying to set a conditional breakpoint in a loop on a linked list, something like this code in git.git which I copy here [1] /* pick the remainder */ for (ref = src; ref; ref = ref->next) { struct string_list_item *dst_item; struct ref *dst_peer; const struct refspec_item *pat = NULL; char *dst_name; dst_name = get_ref_match(rs, ref, send_mirror, FROM_SRC, &pat); if (!dst_name) continue; I'm on the line 'if (!dst_name)' which is line 1592 and I do b 1592 if $_streq(ref->name, "refs/heads/test") and I get: No symbol "ref" in current context. My git is compiled with (among other flags) '-O0 -g'. Is this expected ? Are there other flags I should set when compiling (this is GCC 7.4.0) or when running in GDB so that GDB can "see" the 'ref' variable in the condition ? If I do 'p *ref' I do get the correct output, it's just when I want to use it in a conditional breakpoint that it seems to not work... This is using GDB 10.2 (self-compiled) on Ubuntu 18.04... Please keep me in CC's as I'm not subscribed, thanks! Philippe. [1] https://github.com/git/git/blob/74cc1aa55f30ed76424a0e7226ab519aa6265061/remote.c#L1584-L1593