From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7251 invoked by alias); 20 May 2004 03:11:20 -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 7224 invoked from network); 20 May 2004 03:11:19 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 20 May 2004 03:11:19 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i4K3BJGG023116 for ; Wed, 19 May 2004 23:11:19 -0400 Received: from zenia.home.redhat.com (porkchop.devel.redhat.com [172.16.58.2]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i4JNKl031309; Wed, 19 May 2004 19:20:48 -0400 To: Alexandre Courbot Cc: gdb@sources.redhat.com Subject: Re: GDB as a program analyzer - some thoughts References: <40AA23FD.6040103@lifl.fr> From: Jim Blandy Date: Thu, 20 May 2004 03:11:00 -0000 In-Reply-To: <40AA23FD.6040103@lifl.fr> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2004-05/txt/msg00137.txt.bz2 Alexandre Courbot writes: > So, I wonder if some breakpoint settings would be implementable with > gdb (or if they can already be expressed and I missed them): > - Setting a breakpoint at the returning of a function I think this would be a great feature. Stan Shebs and I looked into implementing a long time ago, and decided that it couldn't be done without further help from the compiler. The first problem is that it's hard to decide where to put the breakpoint: the function return code could be replicated many times in the function's body. But even then, you need to set the breakpoint before the code that restores the caller's registers and frame pointer, or else you won't be able to find your local variables. So this is harder than it looks. I think it might need help from the compiler. > - Setting a breakpoint at some fixed point of a function (for > instance, a C label) This would be nice, too. At the moment, GCC does produce debugging information for labels when the Dwarf 2 debug format is used, but GDB's support for them is incomplete. > - Any other breakpoint setting that is not line-number based and would > support source modification GDB's 'search' command sets the convenience variable $_ to the number of the matching line. So you can do stuff like this: (gdb) search marker 6 i--; /* marker */ (gdb) break $_ Breakpoint 1 at 0x804837b: file label.c, line 6. (gdb) I think that's your best bet at the moment.