This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: conditional breakpoint with (char* ) string condition
- From: Daniel Jacobowitz <drow at false dot org>
- To: Fabio De Bona <Auslieferator at gmx dot net>, Eli Zaretskii <eliz at gnu dot org>
- Cc: gdb at sources dot redhat dot com
- Date: Fri, 12 May 2006 08:45:27 -0400
- Subject: Re: conditional breakpoint with (char* ) string condition
- References: <44645774.8060503@gmx.net> <uy7x77akz.fsf@gnu.org> <44645774.8060503@gmx.net>
On Fri, May 12, 2006 at 11:37:56AM +0200, Fabio De Bona wrote:
> Hi everyone,
> I would like to set a conditional breakpoint with a condition that
> depends on the value of
> a char* string, i.e. something like
>
> b gui/R.cpp:190 if cmd=="train" (doesn't work of course)
>
> resp.
>
> b gui/R.cpp:190 if strcmp(cmd,"train")
This should actually work - although it's a bit slow to implement.
On Fri, May 12, 2006 at 02:21:16PM +0300, Eli Zaretskii wrote:
> > Date: Fri, 12 May 2006 11:37:56 +0200
> > From: Fabio De Bona <Auslieferator@gmx.net>
> >
> > b gui/R.cpp:190 if cmd=="train" (doesn't work of course)
>
> But this should:
>
> b gui/R.cpp:190 if cmd[0]=='t' && cmd[1]=='r' && cmd[2]=='a' && cmd[3]=='i'
>
> etc., you get the point.
I wonder. Should we add some common builtin functions to GDB?
b gui/R.cpp:190 if $gdb_strcmp (cmd, "train")
[This might be quite a lot of work, since right now parsing "train"
will cause us to malloc() in the program.]
--
Daniel Jacobowitz
CodeSourcery