From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32276 invoked by alias); 15 Jun 2003 14:04:03 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 32221 invoked from network); 15 Jun 2003 14:04:02 -0000 Received: from unknown (HELO baradas.org) (66.166.225.55) by sources.redhat.com with SMTP; 15 Jun 2003 14:04:02 -0000 Received: by baradas.org (Postfix, from userid 500) id 76BCF98DFD; Sun, 15 Jun 2003 10:04:01 -0400 (EDT) From: Peter Barada To: crawford@goingware.com Cc: gdb@sources.redhat.com In-reply-to: <3EEC2751.8040201@goingware.com> (crawford@goingware.com) Subject: Re: touch and go breakpoints? References: <3EEC2751.8040201@goingware.com> Message-Id: <20030615140401.76BCF98DFD@baradas.org> Date: Sun, 15 Jun 2003 14:04:00 -0000 X-SW-Source: 2003-06/txt/msg00299.txt.bz2 >Is there a way I can set a breakpoint, where if it is hit, gdb will execute >some command, and then continue? Yes. Look up the 'command' command syntax. Here's an example using the simple testfile: #include int foo(x) { return x+x+1; } int main(int argc, char *argv[]) { int i, val, lim; val = atoi(argv[1]); lim = atoi(argv[2]); for (i=0; ip x >c >end (gdb) run 1 10 Starting program: /tmp/a.out 1 5 Breakpoint 1, foo (x=1) at test.c:4 $1 = 1 Breakpoint 1, foo (x=3) at test.c:4 $2 = 3 Breakpoint 1, foo (x=7) at test.c:4 $3 = 7 Breakpoint 1, foo (x=15) at test.c:4 $4 = 15 Breakpoint 1, foo (x=31) at test.c:4 $5 = 31 Program exited with code 014. (gdb) -- Peter Barada peter@baradas.org