This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Non-interactive stepping


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.

Thanks,
Christopher



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]