关于调试的一些资料

 1   window下新手debug时常会遇到一变量值显示为一连串“烫烫烫”,“铪铪铪”,或者”屯屯屯“的特殊内容,这个是VC使用的Magic Number,用于辅助调试用的,常见的Magic Number,如下所示:

* 0xABABABAB : Used by Microsoft's HeapAlloc() to mark "no man's land" guard bytes after allocated heap memory
* 0xABADCAFE : A startup to this value to initialize all free memory to catch errant pointers
* 0xBAADF00D : Used by Microsoft's LocalAlloc(LMEM_FIXED) to mark uninitialised allocated heap memory
* 0xBADCAB1E : Error Code returned to the Microsoft eVC debugger when connection is severed to the debugger
* 0xBEEFCACE : Used by Microsoft .NET as a magic number in resource files
* 0xCCCCCCCC : Used by Microsoft's C++ debugging runtime library to mark uninitialised stack memory
* 0xCDCDCDCD : Used by Microsoft's C++ debugging runtime library to mark uninitialised heap memory
* 0xDEADDEAD : A Microsoft Windows STOP Error code used when the user manually initiates the crash.
* 0xFDFDFDFD : Used by Microsoft's C++ debugging heap to mark "no man's land" guard bytes before and after allocated heap memory
* 0xFEEEFEEE : Used by Microsoft's HeapFree() to mark freed heap memory

更详细的信息请移步Wiki:https://en.wikipedia.org/wiki/Magic_number_(programming)


2 函数调用过程详解:http://blog.csdn.net/lksodit_yiyi/article/details/8291876,知悉变量在内存中位置

预先储备的知识:

2.1 函数调用的方式:http://blog.csdn.net/yuzhiyuxia/article/details/7639387, 在调用第三方SDK的时候要注意其函数声明的方式,函数调用方式使用错误将导致栈损坏,具体原因可从函数调用过程中详解中找到(如果有兴趣可以搜下缓冲区溢出攻击).

2.2 函数传参方式 : http://blog.csdn.net/cocohufei/article/details/6143476,可以引申出:类拷贝构造函数 http://blog.csdn.net/lwbeyond/article/details/6202256,在该链接中也同时关注下深拷贝,浅拷贝; 可再引申出内存碎片: http://blog.csdn.net/xuzhonghai/article/details/7285821(程序设计时先思考怎样能访问到一个变量,进而决定该变量如何存放,数据结构如何设计) 内存池:http://blog.csdn.net/shawngucas/article/details/6574863,可以借鉴一下垃圾回收机制, java GC: http://blog.csdn.net/zhoudaxia/article/details/26579859,  如果想彻底解决资源访问,释放烦恼,看看智能指针的使用,与垃圾回收机制相同的设计思想 http://blog.csdn.net/hackbuteer1/article/details/7561235

3 理解指针:http://blog.csdn.net/mdx20072419/article/details/7814390。指针相关的四个概念:指针的类型; 指针指向的类型; 指针指向的内容; 指针本身所占据的内存区(可以思考引用的实现方式)

4 c++常见崩溃问题:http://qiusuoge.com/9870.html,简单来说崩溃问题就只有一种,越界访问


5 数据断点:程序崩溃的地方有时并不是因为所在的位置,此时如果关心某个变量何时何处被修改,可以使用该方法 http://blog.csdn.net/jphaoren/article/details/6270270

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值