"No symbol name in current context" for conditional breakpoint on linked list item "name", under -O0
Philippe Blain via Gdb <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <[email protected]> |
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