public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
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 12:22:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.44.0710241752020.17206-100000@linux42.sankhya.com> (raw)
In-Reply-To: <20071024115310.GA19251@caradoc.them.org>


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.

> operators by calling the operators, and it evaluates strings by
> calling malloc in the program.  I believe there are three function
> calls in s == "hello" - one for malloc(6), one for char * to string
> conversion, and one to operator==.
> 
> I see that it's GDB segfaulting, not your program.  If this still
> happens with a newer version of GDB, we could look into it.  But
> I get:
> 
> Error in testing breakpoint condition:
> Invalid cast.
> 
> GDB probably doesn't support the char* -> string constructor.  That's
> one of the parts of C++ that's very hard to support in the debugger.
> 
> 

This is quite interesting. Maybe I would just look into its internals.
Generally speaking, why is this char*->string so hard ? 

-- 
Regards,
Anitha B
@S A N K H Y A

  reply	other threads:[~2007-10-24 12:22 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 [this message]
2007-10-24 12:36     ` Daniel Jacobowitz
2007-10-24 13:05       ` Anitha Boyapati
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.0710241752020.17206-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).