From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18266 invoked by alias); 24 Oct 2007 06:51:41 -0000 Received: (qmail 18258 invoked by uid 22791); 24 Oct 2007 06:51:40 -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 06:51:36 +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 l9O66pjV002330 for ; Wed, 24 Oct 2007 11:36:51 +0530 Received: from sankhya.com (localhost [127.0.0.1]) by sankhya.com (8.12.8/8.12.5) with ESMTP id l9O6vdIK004537 for ; Wed, 24 Oct 2007 12:27:39 +0530 Received: from localhost (anithab@localhost) by sankhya.com (8.12.8/8.12.5/Submit) with ESMTP id l9O6vc8n004533 for ; Wed, 24 Oct 2007 12:27:39 +0530 Date: Wed, 24 Oct 2007 06:51:00 -0000 From: Anitha Boyapati To: gdb@sourceware.org Subject: conditional breakpoints for strings 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/msg00188.txt.bz2 Hi, Here's a sample program in C++ being debugged in GDB. It tries to stop if string matches "hello" in a breakpoint. Now I am getting a segmentation fault. But the same works fine for numerical comparisions(the code is slightly changed as int i = 10 and a conditional BP is set if i==10). Is this a bug or did I do something wrong ? gdb --version GNU gdb Red Hat Linux (5.3.90-0.20030710.40rh) This GDB was configured as "i386-redhat-linux-gnu". ----------------------------------------------------- (gdb) li 1 #include 2 3 using namespace std; 4 5 int main() { 6 string s("hello"); 7 return 1; 8 } (gdb) b hello.cc:7 Breakpoint 1 at 0x80486b0: file hello.cc, line 7. (gdb) condition 1 ( s == "hello" ) (gdb) r Starting program: /home/anithab/util/hello Segmentation fault -- Regards, Anitha B @S A N K H Y A