From: Anitha Boyapati <anithab@sankhya.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb@sourceware.org
Subject: Re: conditional breakpoints for strings
Date: Wed, 24 Oct 2007 13:05:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.44.0710241839110.6017-100000@linux42.sankhya.com> (raw)
In-Reply-To: <20071024123559.GA21751@caradoc.them.org>
Hi,
On Wed, 24 Oct 2007, Daniel Jacobowitz wrote:
> On Wed, Oct 24, 2007 at 05:58:56PM +0530, Anitha Boyapati wrote:
> >
> > Hi,
> >
> > On Wed, 24 Oct 2007, Daniel Jacobowitz wrote:
> >
> > > You probably want to use at least one temporary variable to do this
> > > sort of thing. GDB evaluates C++ expressions with user defined
> >
> > I did it with (strcmp(...) == 0). It worked that way probably because
> > strcmp() takes care of memory alloc and type casting issues. I think this
> > is fine for me now. Thanks.
>
> If you expect the breakpoint to hit more than a few times, I still
> recommend a temporary variable.
>
> (gdb) set $str = "hello"
> (gdb) cond 1 strcmp (s.whatever, $str) == 0
>
> Otherwise you will call malloc at every breakpoint.
Point taken.
>
> > This is quite interesting. Maybe I would just look into its internals.
> > Generally speaking, why is this char*->string so hard ?
>
> Two parts. One is that GDB does not know how to construct new
> objects. The other is that figuring out which constructors or
> operators to call is complicated; do you convert std::string to
> char * or char * to std::string, for instance. The C++ language
> standard has pages and pages of rules for this sort of thing.
>
>
Thanks. That gives a basic idea.
--
Regards,
Anitha B
@S A N K H Y A
next prev parent reply other threads:[~2007-10-24 13:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-24 6:51 Anitha Boyapati
2007-10-24 11:53 ` Daniel Jacobowitz
2007-10-24 12:22 ` Anitha Boyapati
2007-10-24 12:36 ` Daniel Jacobowitz
2007-10-24 13:05 ` Anitha Boyapati [this message]
2007-10-24 14:26 ` Dave Korn
2007-10-24 14:35 ` 'Daniel Jacobowitz'
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.44.0710241839110.6017-100000@linux42.sankhya.com \
--to=anithab@sankhya.com \
--cc=drow@false.org \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).