打印通过gdb的完整控制流,包括变量的值 [英] Print complete control flow through gdb including values of variables
问题描述
确定这个问题的原因是因为有关调试工具的想法。这是什么呢给定一个程序的两个不同的输入,一个导致错误的输出,另一个是正确的输入,它会告诉他们控制流的哪一部分是不同的。
所以我认为需要的是将这两个控制流完全转储到diff引擎中。如果这两个输入是相似的控制流,那么它们的差异(在许多情况下)会给出一个关于为什么存在错误的好主意。
这可以被做成
详细了解环境。例如,dtrace将在Solaris或Leopard中做出奇妙的工作。 gprof是另一种可能性。
可以使用 yes(1)或 expect(1)。
如果你想得到喜欢, GDB可以在某些版本中使用Python脚本。
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.
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.
这篇关于打印通过gdb的完整控制流,包括变量的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!