public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Philippe Blain <levraiphilippeblain@gmail.com>
To: gdb@sourceware.org
Subject: "No symbol name in current context" for conditional breakpoint on linked list item "name", under -O0
Date: Mon, 21 Mar 2022 19:10:08 -0400	[thread overview]
Message-ID: <cc60bb2b-4470-c4ab-3995-a49c1f8035f2@gmail.com> (raw)

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

                 reply	other threads:[~2022-03-21 23:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cc60bb2b-4470-c4ab-3995-a49c1f8035f2@gmail.com \
    --to=levraiphilippeblain@gmail.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).