views:

327

answers:

3

The idea is that given a specific input to the program, somehow I want to automatically step-in through the complete program and dump its control flow along with all the data being used like classes and their variables. Is their a straightforward way to do this? Or can this be done by some scripting over gdb or does it require modification in gdb?

Ok the reason for this question is because of an idea regarding a debugging tool. What it does is this. Given two different inputs to a program, one causing an incorrect output and the other a correct one, it will tell what part of the control flow differ for them.

So What I think will be needed is a complete dump of these 2 control flows going into a diff engine. And if the two inputs are following similar control flows then their diff would (in many cases) give a good idea about why the bug exist.

This can be made into a very engaging tool with many features build on top of this.

+1  A: 

Tell us a little more about the environment. dtrace, for example, will do a marvelous job of this in Solaris or Leopard. gprof is another possibility.

A bumpo version of this could be done with yes(1), or expect(1).

If you want to get fancy, GDB can be scripted with Python in some versions.

Charlie Martin
A: 

Check this out, unlike Coverity, Fenris is free and widly used..

http://stackoverflow.com/questions/764382/automate-tracing-in-gdb/1123188#1123188

RandomNickName42
A: 

What you are describing sounds a bit like gdb's "tracepoint debugging". See gdb's internal help "help tracepoint". You can also see a whitepaper here: http://sourceware.org/gdb/talks/esc-west-1999/

Unfortunately, this functionality is not currently implemented for native debugging, but I believe that CodeSourcery is doing some work on it.

Michael Snyder