This is the place where people typically slip up in debugging. They don't think in advance what they expect the result to be.
实验就推翻了你的假设了,人们在做调试的时候往往忽略了这一点,他们做实验之前并没有想想。
The two best debugging tools are the same now that they have almost always been.
最好的两个调试工具一直,以来基本没怎么变过。
But just so you've been teased with them, "-ggdb" is a flag that's going to enable what are going to be called "debugging symbols."
但是你们刚才被他们忽悠了,“-ggdb“是用来使能“调试标志“功能,的一个标记“
See if we can find it here. And notice, by the way, that I commented out the previous debugging line, rather than got rid of it.
我们再去从它们的中间开始尝试,看看我们能不能发现问题源,顺便说一下,请注意。
I emphasize this because it often leads to a different debugging strategy.
因为这会导致不同的调试策略,所以我要强调这一点。
So one of the things I want you to notice here is that testing and debugging are not the same thing. When we test, we compare an input output pair to a specification.
这里我想大家注意的一件事,就是测试和调试是不同的两件事情,我们测试的时候,我们把输入输出,跟程序的规格说明书对比下。
Does it give you the answer that you expected it to give? Often, in practical problems, you'll spend just as much time doing performance debugging. Why is it slow?
它返回了期待中的结果了么?通常,在实际的问题中你会花,同样多的时间在性能调试上,它为什么运行这么慢?
And I've put it in my debugging code.
调试的代码中去,然后运行看看结果。
Patience is an important part of the debugging process. I have not rushed.
耐心是调试过程中的一个重要部分,我没有着急,我冷静的慢慢的。
There's a lecture I've given several times at hospitals, to doctors, on doing diagnosis of complex multi illnesses. And I go through it and almost the same kind of stuff I'm going to talk to you about, about debugging.
一个实验室内的实验,为什么实验不对呢?,我也在医院给医生关于,诊断复杂的多种疾病做过很多讲座,我想了想,那和我给你们讲的,关于调试其实都是一回事。
So a word about debugging.
关于调试我们来说几句。
They didn't apparently call it debugging.
在编号70的传送带那。
That gets us to debugging.
这就需要我们去调试了。
Typically, even though they don't breed, there are many bugs. And keep in mind that the bug goal of debugging is not to eliminate one bug.
这是件好事,其实即使bugs不会繁殖,也会有很多,并且请记住调试的目的,并不是去消除一个。
应用推荐