public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Anitha Boyapati <anithab@sankhya.com>
To: gdb@sourceware.org
Subject: conditional breakpoints for strings
Date: Wed, 24 Oct 2007 06:51:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.44.0710241217020.1037-100000@linux42.sankhya.com> (raw)


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 <iostream>
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

             reply	other threads:[~2007-10-24  6:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-24  6:51 Anitha Boyapati [this message]
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
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.0710241217020.1037-100000@linux42.sankhya.com \
    --to=anithab@sankhya.com \
    --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).