Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Bob Rossi <bob@brasko.net>
To: Christopher Nebergall <ct-nebergall@wiu.edu>
Cc: gdb@sources.redhat.com
Subject: Re: Non-interactive stepping
Date: Sun, 02 May 2004 13:04:00 -0000	[thread overview]
Message-ID: <20040502130357.GA1487@white> (raw)
In-Reply-To: <000101c42fc4$0f9d0260$6401a8c0@raven>

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


  reply	other threads:[~2004-05-02 13:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-01 21:34 Christopher Nebergall
2004-05-02 13:04 ` Bob Rossi [this message]
2004-05-02 16:03   ` Kip Macy
2004-05-02 21:27 Nick Roberts
2004-05-03  2:54 ` C T Nebergall

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=20040502130357.GA1487@white \
    --to=bob@brasko.net \
    --cc=ct-nebergall@wiu.edu \
    --cc=gdb@sources.redhat.com \
    /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