青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

C++ Programmer's Cookbook

{C++ 基礎(chǔ)} {C++ 高級(jí)} {C#界面,C++核心算法} {設(shè)計(jì)模式} {C#基礎(chǔ)}

調(diào)試breakpoint高級(jí)

breakpoint的右鍵菜單:
o_tiaoshi2.jpg

Tracepoints

When you have a "mystery" bug to solve, tracepoints are a vital part of your debugging arsenal. Single stepping and looking through code can be S-L-O-O-O-O-W and if you don't even know what you're looking for, it can consume hours and hours of effort. Tracepoints really speed things up. They're like breakpoints that don't break. In a way, they go back to the old "printf debugging" -- but you don't need to make code changes and recompile to change them.

To set a tracepoint, first set a breakpoint, then right-click on the red dot that appears in the margin and choose When Hit:

In the dialog that appears, click the Print A Message box and edit the starter message you are given. You can include any expression in braces and it will be evaluated when control reaches the tracepoint:

Leave the Continue Execution box checked so that you don't break. Tracepoints are identified by red diamonds instead of red dots:

The output from the tracepoints appears in the output window of your debug session:

You can set up something suspicious, let it run, then pore through the tracepoint output and see what you learn. It's a huge timesaver when you're tackling a "we don't even know where to start" bug. Plus, if the issue is related to threading or async issues in any way (and you know me, I keep preaching we will all be facing async issues eventually) then you don't have to worry that pausing execution suppresses the collisions. I recently helped a client solve a big hairy this-stuff-fails-for-our-biggest-customer-only bug using tracepoints... and a few other tricks I will cover in upcoming posts.

Conditional breakpoints

Conditional breakpoints were another really important tool in solving a recent "only happens at the big installations" bug in a big and complicated C++ application. We wanted to debug the code with as few rebuilds as possible and we really didn't know how parts of it worked at all. Tracepoints helped us to figure out a lot of it in a short time. We didn't have a decent repro case though, so here's what we did:

  • created a script to add an audit table and some triggers that write to it
  • created a script to remove those triggers and the table
  • created a batch file to run a server in verbose mode, and redirect the output to a text file (remembering DOS commands sure can be helpful...   myapp.exe -verbose >logfile.txt was the magic phrase.)
  • wrote some instructions for the support guy to grab a backup of the database, run the first script, run the batch file, let it run all night, then in the morning grab another backup of the database, run the second script, and stop the batch file.

Now we ran some queries on the morning version of the database to confirm that at least one X was missing a Y that should have been calculated overnight. We even had the Xid. Thanks to the tracepoint work of the previous day we knew where to be suspicious. A little digging in the trigger output told us whether the problem was "didn't get added" or "got added, but then got deleted". The last step was conditional breakpoints. These let us say "only stop here when you're processing the X with this Xid."

This really saves time when you just need to drill into what's happening in the case that is going wrong. You get to it by right clicking the red dot or diamond and choosing Condition.


One more breakpoint tip - hit count

Conditional breakpoints are cool when you know the value of one variable that is associated with trouble: this only blows up when Xid is 1234. They can also be used to reduce the boredom of single stepping. Say you've got some loop that goes around a few hundred times building up some string or array or something. You don't want to keep going round and round and round... it would be nice to jump ahead to halfway through, for example, and see how things are looking. Now if this is a for loop with a handy named variable, say

 

for (int i = 0; i<1000; i++)

 

Then you can use a conditional breakpoint and say "stop when i is 200". Or you could be clever and stop when i % 200 is 0 -- so that's every 200 times. But what if there's no i? What if you're going through a file or a recordset/dataset/resultset and you're going until the end? You don't want to add some fake variable that gets incremented each time through the loop, just so you can set a breakpoint that breaks on certain values of that variable. Instead you want to use the hit count property of the breakpoint. Just right click the red dot and choose Hit Count. There you can set the breakpoint to break whenever it's hit, just the 10th time it's hit, every tenth time (10, 20, 30 etc) or every time after the 10th time Or, of course, whatever number you want instead of 10:

Don't debug the slow way when there are tools to make you so much faster!

Filter   下次再介紹:

o_tiaoshi.jpg


注意:c#的也可以用的啊....



來自:http://www.gregcons.com/KateBlog/CategoryView.aspx?category=C%2B%2B

posted on 2006-08-16 14:47 夢在天涯 閱讀(3062) 評(píng)論(0)  編輯 收藏 引用 所屬分類: CPlusPlus 、C#/.NET 、VS2005/2008

公告

EMail:itech001#126.com

導(dǎo)航

統(tǒng)計(jì)

  • 隨筆 - 461
  • 文章 - 4
  • 評(píng)論 - 746
  • 引用 - 0

常用鏈接

隨筆分類

隨筆檔案

收藏夾

Blogs

c#(csharp)

C++(cpp)

Enlish

Forums(bbs)

My self

Often go

Useful Webs

Xml/Uml/html

搜索

  •  

積分與排名

  • 積分 - 1816544
  • 排名 - 5

最新評(píng)論

閱讀排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
      <noscript id="pjuwb"></noscript>
            <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
              <dd id="pjuwb"></dd>
              <abbr id="pjuwb"></abbr>
              久久综合久久美利坚合众国| 国产亚洲激情| 亚洲人成小说网站色在线| 欧美日韩另类国产亚洲欧美一级| 一区在线影院| 欧美国产激情| 欧美日韩蜜桃| 香港久久久电影| 亚洲欧美日韩精品在线| 国内精品久久久| 欧美国产日韩在线| 欧美激情一区二区三区不卡| 亚洲视频999| 亚洲欧美国产va在线影院| 国产日韩欧美精品一区| 久久久蜜臀国产一区二区| 久久这里只有| 亚洲桃花岛网站| 篠田优中文在线播放第一区| 一区二区三区在线观看欧美| 亚洲欧洲三级电影| 国产精品porn| 麻豆91精品91久久久的内涵| 久久精品国产96久久久香蕉| 久久精品男女| 一区二区三区四区国产| 香蕉成人久久| 亚洲免费观看高清在线观看| 亚洲一区二区三区免费观看| 在线播放亚洲| 99视频有精品| 在线成人激情视频| 亚洲午夜视频| 亚洲久久在线| 久久精品视频免费| 亚洲一区二区黄色| 久热这里只精品99re8久| 日韩视频不卡| 久久先锋影音av| 午夜精品一区二区三区在线视| 久久一区视频| 久久成人18免费观看| 欧美日韩蜜桃| 欧美激情一区二区三区不卡| 国产深夜精品福利| 一本色道久久综合一区| 亚洲欧洲精品一区二区| 久久精品国产91精品亚洲| 亚洲伊人伊色伊影伊综合网| 欧美大片网址| 免费视频亚洲| 一区在线免费| 久久精品国产清高在天天线| 亚洲欧美一区二区精品久久久| 欧美激情精品久久久六区热门 | 欧美日韩免费视频| 欧美高清在线播放| 一区二区三区在线高清| 久久国产福利国产秒拍| 欧美中文字幕久久| 国产午夜精品视频| 久久爱www| 久久久亚洲精品一区二区三区 | 国自产拍偷拍福利精品免费一| 9色porny自拍视频一区二区| 日韩一二三区视频| 欧美成人一区二区| 亚洲韩国日本中文字幕| 亚洲欧洲偷拍精品| 欧美国产一区在线| 亚洲青色在线| 老司机久久99久久精品播放免费| 久久国产精品99精品国产| 国产精品青草久久| 亚洲欧美日韩国产一区二区三区| 先锋影音国产精品| 国产精品亚洲一区二区三区在线| 亚洲伊人一本大道中文字幕| 香蕉成人伊视频在线观看| 国产农村妇女精品| 欧美在线视频观看免费网站| 久久久久久久久久久久久9999| 精品成人免费| 欧美国产日韩a欧美在线观看| 亚洲精品日韩精品| 午夜精品一区二区三区在线视| 国产视频在线观看一区二区三区| 久久黄金**| 亚洲日韩视频| 性色av一区二区三区在线观看| 国产乱子伦一区二区三区国色天香| 久久不射中文字幕| 亚洲福利电影| 欧美一区二区女人| 亚洲大片精品永久免费| 欧美日韩xxxxx| 欧美一区二区三区四区夜夜大片 | 欧美亚洲综合另类| 在线 亚洲欧美在线综合一区| 欧美激情中文字幕一区二区| 亚洲一区免费| 欧美国产成人在线| 亚洲欧美在线高清| 最新国产成人在线观看| 欧美少妇一区二区| 久久久久久久国产| 一本一本久久a久久精品牛牛影视| 久久久久99精品国产片| 99视频精品| 在线日韩欧美| 国产精品视频999| 欧美大胆人体视频| 欧美伊人久久大香线蕉综合69| 亚洲国产精品女人久久久| 久久国产色av| 正在播放亚洲| 亚洲国产精品一区| 国产日韩一区二区三区| 欧美日韩中文字幕精品| 久久亚洲精选| 欧美主播一区二区三区美女 久久精品人 | 欧美日韩高清区| 欧美亚洲在线观看| 正在播放欧美一区| 亚洲丰满在线| 久热综合在线亚洲精品| 亚洲欧美日韩在线一区| 亚洲人精品午夜在线观看| 国产一区二区三区在线观看视频 | 一本久道综合久久精品| 在线成人国产| 一区在线影院| 在线观看欧美一区| 国模私拍视频一区| 国产真实乱子伦精品视频| 国产精品每日更新| 国产精品家庭影院| 国产精品久久91| 欧美视频第二页| 欧美视频免费在线观看| 欧美激情亚洲国产| 欧美激情麻豆| 欧美日韩国产欧| 欧美日韩在线播| 欧美性大战久久久久| 国产精品v欧美精品∨日韩| 欧美人成在线| 欧美三级电影一区| 国产精品大片wwwwww| 国产精品看片你懂得| 国产欧美日韩精品a在线观看| 国产精品综合| 激情文学综合丁香| 亚洲黑丝一区二区| 日韩午夜在线视频| 亚洲线精品一区二区三区八戒| 亚洲综合色激情五月| 午夜欧美理论片| 欧美在线一二三区| 美国成人毛片| 亚洲人成人一区二区在线观看| 亚洲精品麻豆| 亚洲欧美日韩国产中文| 久久精品国产精品| 欧美成人一区二免费视频软件| 欧美日韩久久精品| 国产精品一区二区三区久久| 国产日韩欧美在线播放| 亚洲国产日韩美| 在线综合亚洲| 久久亚洲国产成人| 亚洲精美视频| 午夜精品久久久久久久| 久久亚洲高清| 国产精品久久久久久户外露出| 国产婷婷精品| 一区二区91| 久久久噜噜噜久噜久久| 亚洲欧洲综合另类| 小黄鸭精品密入口导航| 欧美精品一区在线播放| 国产午夜精品美女毛片视频| 亚洲激情社区| 欧美在线视频网站| 亚洲国产精品一区制服丝袜| 一本色道久久综合亚洲精品不卡 | 国产精品尤物| 亚洲全部视频| 久久精品在线| 亚洲深夜福利在线| 欧美国产91| 在线免费高清一区二区三区| 在线亚洲国产精品网站| 美女视频网站黄色亚洲| 亚洲欧美国产毛片在线| 欧美日韩18| 亚洲欧洲日产国产综合网| 久久久噜噜噜久噜久久 | 久久综合久久综合久久| 一区二区三区四区国产|