This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Fix breakpoint condition that use member variables.
- From: Eli Zaretskii <eliz at gnu dot org>
- To: Vladimir Prus <vladimir at codesourcery dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Sat, 22 Mar 2008 14:06:35 +0200
- Subject: Re: [RFA] Fix breakpoint condition that use member variables.
- References: <200803221240.16230.vladimir@codesourcery.com>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> From: Vladimir Prus <vladimir@codesourcery.com>
> Date: Sat, 22 Mar 2008 12:40:15 +0300
>
> Suppose that foo.cpp:10 is a location inside member function of a class,
> and that said class has member variable i_, and that we've just started
> a program and are in main. Then:
>
> break foo.cpp:10 if i_ == 10
>
> will not work, claiming that i_ does not exist. The problem is that
> lookup_symbol_aux uses value_of_this, which uses value_of_local and
> that totally ignores the block that is passed to parse_exp_1 by
> the breakpoint code and uses the block of the selected frame. Of course,
> that either does not have "this", or has wrong "this".
>
> This patch fixes the problem by looking in the right block directly,
> and also by looking for the field in the type of "this", without
> trying to get the value.
What will happen after your patch if there's also a variable i_ in the
selected frame?