如何学习调试? [英] How to learn debugging?

查看:115
本文介绍了如何学习调试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是上级CS专业,我不知道如何做调试。没有在我的课程中,他们正在教授/显示调试,我所有的课程作品都是这样的 - 这里是项目,在C中编写一个程序,并且使用GZD调试器。



目前,我正在进行汇编语言课程,教师需要使用GDB调试器,我甚至不知道如何在Visual Studio中进行调试。而且我们很快将要完成的所有项目都需要我们使用GDB骇客可执行文件。



有关如何开始/学习调试的任何建议非常感谢。

解决方案

没有任何替代方法:




  • 编写一个非常简单的程序。


  • 在调试器中打开它。


  • 运行您的程序,每行


  • 使用调试器的命令检查
    你的变量和程序状态。


  • 编写一个更复杂的程序...
    重复...




如果您在课程中编写了项目,而不是调试,则您正在编写单元测试的负载(这是一件好事),或者您的程序第一次工作。



VS2010(和2008)中最重要的调试快捷方式是:




  • 开始调试F5


  • 开始无需调试Ctrl + F5


  • 退出调试Shift + F5


  • 步入F11


  • 超过F10


  • Shift + F11


  • 切换断点F9



I am upper level CS major, and I have no idea how to do debugging. No where in my courses they are teaching/showing debugging, and all my course works goes like this - here is the project, write a program in C that does XYZ, and by the way use GDB debugger.

Currently, I am taking Assembly language course, and instructor requires use of GDB debugger, hell I don't even know how to do debugging in Visual Studio. And all the projects we are going to do very soon, will require us to "hack" executable using GDB.

Any advice on how to get started/learn debugging, would be highly appreciated.

解决方案

There is no substitue for just doing it:

  • Write a very simple program.

  • Open it in a debugger.

  • Run your program and step through each line.

  • Use the debugger's commands to inspect your variables and program state.

  • Write a more complicated program... Repeat...

If you have written projects on your course and not debugging at all, either you are writing loads of unit tests (that's a good thing), or your programs work first time.

The most important shortcuts for debugging in VS2010 (and 2008) are:

  • Start Debugging F5

  • Start without Debugging Ctrl + F5

  • Quit debugging Shift + F5

  • Step Into F11

  • Step Over F10

  • Step Out Shift + F11

  • Toggle Breakpoint F9

这篇关于如何学习调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆