From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26444 invoked by alias); 24 Oct 2007 12:22:56 -0000 Received: (qmail 26422 invoked by uid 22791); 24 Oct 2007 12:22:55 -0000 X-Spam-Check-By: sourceware.org Received: from Unknown (HELO pdns.sankhya.co.in) (210.212.208.205) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 24 Oct 2007 12:22:53 +0000 Received: from sankhya.com (sankhya-external [192.168.1.2]) by pdns.sankhya.co.in (8.12.11/8.12.10) with ESMTP id l9OBc1b0005345; Wed, 24 Oct 2007 17:08:01 +0530 Received: from sankhya.com (localhost [127.0.0.1]) by sankhya.com (8.12.8/8.12.5) with ESMTP id l9OCSuIK004828; Wed, 24 Oct 2007 17:58:56 +0530 Received: from localhost (anithab@localhost) by sankhya.com (8.12.8/8.12.5/Submit) with ESMTP id l9OCSuS2004824; Wed, 24 Oct 2007 17:58:56 +0530 Date: Wed, 24 Oct 2007 12:22:00 -0000 From: Anitha Boyapati To: Daniel Jacobowitz cc: gdb@sourceware.org Subject: Re: conditional breakpoints for strings In-Reply-To: <20071024115310.GA19251@caradoc.them.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-10/txt/msg00195.txt.bz2 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