Creating Debug-Ready Code
来源:互联网 发布:c语言多个文件编写 编辑:程序博客网 时间:2024/05/09 07:46
Normally, when we write a program, we want to be able to debug it - that is, test it using a debugger that allows running it step by step, setting a break point before a given command is executed, looking at contents of variables during program execution, and so on. In order for the debugger to be able to relate between the executable program and the original source code, we need to tell the compiler to insert information to the resulting executable program that'll help the debugger. This information is called "debug information". In order to add that to our program, lets compile it differently:cc -g single_main.c -o single_main
The '-g' flag tells the compiler to use debug info, and is recognized by mostly any compiler out there. You will note that the resulting file is much larger than that created without usage of the '-g' flag. The difference in size is due to the debug information. We may still remove this debug information using the strip
command, like this:strip single_main
You'll note that the size of the file now is even smaller than if we didn't use the '-g' flag in the first place. This is because even a program compiled without the '-g' flag contains some symbol information (function names, for instance), that thestrip
command removes. You may want to read strip
's manual page (man strip) to understand more about what this command does.
- Creating Debug-Ready Code
- Creating CentOS images ready for Openstack
- Uart debug before console ready low level debug
- code::blocks debug dll
- Android source code debug
- Debug Android native code
- microsoft source code debug
- Code Debug and Inject
- X-code Debug技巧
- HAL code debug
- tensorflow debug c++ code
- Debug Android NDK code
- Code::Blocks和Debug
- AVI example code for creating AVI files
- AVI example code for creating AVI files
- Creating a K2 Deployment Package from code
- Code Examples For Creating SSL Sockets
- 5-tips-for-creating-good-code-every
- 速查网站
- 国家旅游局发布导游IC卡管理办法
- 社保卡扩容之后:一卡通背后的博弈
- List of Free Programming books
- 广州“全能”社保卡计划年底发放
- Creating Debug-Ready Code
- [Android实例] 如何成为Android高手第一篇
- qsort用法
- VIM
- [Android实例] 如何成为Android高手第二篇
- [Android实例] 如何成为Android高手第三篇
- 书写Debug版和Release版的程序
- C++ 对象的内存布局
- 程序员需要具备的基本技能