public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* "No symbol name in current context" for conditional breakpoint on linked list item "name", under -O0
@ 2022-03-21 23:10 Philippe Blain
  0 siblings, 0 replies; only message in thread
From: Philippe Blain @ 2022-03-21 23:10 UTC (permalink / raw)
  To: gdb

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-21 23:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-21 23:10 "No symbol name in current context" for conditional breakpoint on linked list item "name", under -O0 Philippe Blain

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).