Printing a complete control flow through gdb, including variable values

The idea is that, given the specific input to the program, I want to automatically enter the full program and unload its control flow along with all the data that is used as classes and their variables. Is this their easy way to do this? Or can this be done with some gdb scripts, or is modification required in gdb?

Well, the reason for this question is related to the idea of ​​a debugging tool. What he does is this. Given two different entries in the program, one of which causes an incorrect output, and the other is correct, it will tell you what part of the control flow is different for them.

So, it seems to me that you will need a complete dump of these two control flows going to the differential engine. And if two inputs correspond to similar control flows, then their diff (in many cases) will give a good idea of ​​why the error exists.

This can be done in a very attractive tool with many features built on top of it.

+3
source share
3 answers

Tell us a little about the environment. For example, dtrace will do the job in Solaris or Leopard. gprof is another feature.

The boxed version of this can be done with yes (1) or expected (1).

If you want a fantasy, some versions of GDB can be written using Python .

+2
source

Check it out, unlike Coverity, Fenris is free and widely used.

How to print the following N completed lines automatically in GDB?

+1
source

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

Unfortunately, this feature is not currently implemented for Native debugging, but I believe that CodeSourcery does some work on it.

+1
source

Source: https://habr.com/ru/post/886865/


All Articles