From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22689 invoked by alias); 2 May 2004 16:03: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 22682 invoked from network); 2 May 2004 16:03:18 -0000 Received: from unknown (HELO demos.bsdclusters.com) (69.55.225.36) by sources.redhat.com with SMTP; 2 May 2004 16:03:18 -0000 Received: from demos.bsdclusters.com (demos [69.55.225.36]) by demos.bsdclusters.com (8.12.8p1/8.12.8) with ESMTP id i42G3C8C051185; Sun, 2 May 2004 09:03:12 -0700 (PDT) (envelope-from kmacy@fsmware.com) Received: from localhost (kmacy@localhost) by demos.bsdclusters.com (8.12.8p1/8.12.8/Submit) with ESMTP id i42G3CDw051180; Sun, 2 May 2004 09:03:12 -0700 (PDT) X-Authentication-Warning: demos.bsdclusters.com: kmacy owned process doing -bs Date: Sun, 02 May 2004 16:03:00 -0000 From: Kip Macy X-X-Sender: kmacy@demos.bsdclusters.com To: Bob Rossi cc: Christopher Nebergall , gdb@sources.redhat.com Subject: Re: Non-interactive stepping In-Reply-To: <20040502130357.GA1487@white> Message-ID: <20040502090241.K50397@demos.bsdclusters.com> References: <000101c42fc4$0f9d0260$6401a8c0@raven> <20040502130357.GA1487@white> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2004-05/txt/msg00009.txt.bz2 That would tell him what lines the program executed, not the order in which they were executed. -Kip On Sun, 2 May 2004, Bob Rossi wrote: > On Sat, May 01, 2004 at 03:34:19PM -0600, Christopher Nebergall wrote: > > Is it possible to use GDB (or another app) to print out the executing source > > code file name, line number, function name etc, for an application (compiled > > with -g) in a non-interactive manner (print the output to stdout)? I used a > > similar type of debugging in basica years ago and miss having something > > similar in modern debuggers. > > > > I want to do something similar to > > > > gdb -[Some command line argument] a.out > > a.out: main.c:5 main() May 1 16:18:07 CDT 2004 > > a.out: main.c:6 main() May 1 16:18:08 CDT 2004 > > a.out: main.c:7 main() May 1 16:18:09 CDT 2004 > > a.out: main.c:25 print() May 1 16:18:09 CDT 2004 > > a.out: main.c:28 print() May 1 16:18:09 CDT 2004 > > a.out: source2.c:10 echo() May 1 16:18:10 CDT 2004 > > a.out: source2.c:11 echo() May 1 16:18:10 CDT 2004 > > a.out: source2.c:11 echo() May 1 16:18:12 CDT 2004 > > a.out: main.c:29 print() May 1 16:18:13 CDT 2004 > > a.out: main.c:8 main() May 1 16:18:14 CDT 2004 > > etc... > > > > The main reason I want this is to record program flow during real execution > > of the program without having to step through it line by line in the > > debugger. If there is a segfault, it's pretty easy to determine the program > > flow which caused it. It would also be useful to discover how a large > > program works, and what operations in a program's GUI or command line touch > > which lines of source code. It could also be used for very crude profiling. > > I don't think you should be using a debugger to do this. > > Have you considered a code coverage tool? > I think gcov might do what you want. > > Bob Rossi >