Chinaunix首页 | 论坛 | 博客
  • 博客访问: 9472622
  • 博文数量: 1293
  • 博客积分: 13501
  • 博客等级: 上将
  • 技术积分: 17974
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-08 18:11











分类: C/C++

2011-04-09 23:44:00

We never debug our code, because we don't put bugs破坏正常运转能力的问题或者缺陷 in. Okay, you want some real stuff. Sam still uses printf() to find out where it crashes崩溃. For real programmers, here is a summarywps_clip_image1 of what you can do if you have problems.

Where does it crash ?

The best way to know that is to use gdb. You can start using it with good chances by configuring with --enable-debug . It will add -g to the compiler CFLAGS, and activatewps_clip_image2 some additional safety checks. Just run gdb vlc, type run myfile.vob, and wait until it crashes. You can view where it stopped with bt, and print variables with print .

If you run into troubles, you may want to turn the optimizationswps_clip_image3wps_clip_image4 off. Optimizations (especially inline functions) may confuse混淆 the debugger(调试器). Use --disable-optimizations in that casewps_clip_image5.

Other problems

It may be more complicatedwps_clip_image6 than that, for instance unpredictablewps_clip_image7 behaviour, random bug or performance issue. You have several options to deal with this. If you experience unpredictable behaviour, I hope you don't have a heap or stack corruptionwps_clip_image8 (eg. writing in an unallocated space), because they are hard to find. If you are really desperatewps_clip_image9, have a look at something like ElectricFence障碍 or dmalloc. Under GNU/Linux, an easy check is to type export MALLOC_CHECK_=2 before launching vlc (see malloc(3) for more information).

VLC offerswps_clip_image10 a "trace-mode". It can create a log file with very accurate dates and messages of what it does, so it is useful to detect performance issues or lock-ups. Compile with --enable-trace and tune the TRACE_* flags in include/config.h to enable certain某些 types of messages (log file writing can take up(占用) a lot of time, and will have side effects).



Appendix A.  Ports 


Appendix C.  Project history

阅读(1445) | 评论(0) | 转发(0) |