This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: conditional breakpoints for strings
- From: Anitha Boyapati <anithab at sankhya dot com>
- To: Daniel Jacobowitz <drow at false dot org>
- Cc: gdb at sourceware dot org
- Date: Wed, 24 Oct 2007 17:58:56 +0530 (IST)
- Subject: Re: conditional breakpoints for strings
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