This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: conditional breakpoint with (char* ) string condition


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]