[调试技巧2]VC6的Debug用的Watch窗口的两个小技巧(英文未翻译) [zz]

来自网友blog:葡萄架下的牵牛花
Posted on Tuesday, May 17, 2005 8:04 AM #C & C++ href="http://blog.bcchinese.net/happyjet/Services/Pingback.aspx" rel="pingback"/>

If a pointer to an array only expands to a single item, the undocumented numerical format specifier will force the expansion. For example, if you have a LPDWORD pointer, pVals, that points to an array of 10 items, you can display all ten by entering "pVals,10" in the watch window. The number after the comma tells the watch window how many items to display.

  • 显示GetLastError的值及其对应的说明(原文出处:Programming Applications for Microsoft Windows / Jeffrey Richter)

you can configure the Watch window to always show you the thread's last error code number and the English text description of the error. This is done by selecting a row in the Watch window and typing "@err,hr".

The Visual C++ debugger has a very cool and seemingly undocumented AutoExpand feature. The AutoExpand allows the Variables window to automatically show the pertinent data for the different types in their commonly used format. For example, a CRect variable is automatically expanded to show each of the member fields. The file that controls autoexpansion is AUTOEXP.DAT, located in the MSDEV/Shared IDE/BIN directory. The comments at the top of the file list all of the rules for adding new types to the file. The format specifier section shows the items that can be used directly in the Variables window or Watch window. Some of the more useful items are: s to show strings, su to expand Unicode strings, and c to show character values. To use a format specifier, type in the variable or value followed by a comma, then the format specifier. For example, m_strData,su would view the value as a Unicode string. You can also use C/C++ cast operations in the Variables window or Watch Window to view different items. To view the value at address 0x00404410 as a character string, type in (char*)0x404410.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值