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

C++ Programmer's Cookbook

{C++ 基礎} {C++ 高級} {C#界面,C++核心算法} {設計模式} {C#基礎}

調試breakpoint高級

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 夢在天涯 閱讀(3050) 評論(0)  編輯 收藏 引用 所屬分類: CPlusPlusC#/.NETVS2005/2008

公告

EMail:itech001#126.com

導航

統計

  • 隨筆 - 461
  • 文章 - 4
  • 評論 - 746
  • 引用 - 0

常用鏈接

隨筆分類

隨筆檔案

收藏夾

Blogs

c#(csharp)

C++(cpp)

Enlish

Forums(bbs)

My self

Often go

Useful Webs

Xml/Uml/html

搜索

  •  

積分與排名

  • 積分 - 1811733
  • 排名 - 5

最新評論

閱讀排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
              91久久在线播放| 欧美电影在线观看完整版| 国产精品v日韩精品| 欧美黄色精品| 日韩视频中文字幕| 亚洲人成人99网站| 美国十次成人| 一区二区三区国产在线| 久久经典综合| 亚洲国产片色| 欧美视频观看一区| 久久久www成人免费毛片麻豆| 蜜桃av一区| 欧美肥婆在线| 激情视频一区| 亚洲精品一二| 国一区二区在线观看| 亚洲第一区在线观看| 国产精品盗摄久久久| 亚洲人精品午夜| 久久久久国产精品一区| 一区二区三区 在线观看视| 国产精品视频1区| 欧美福利电影在线观看| 国产精品美女久久久久aⅴ国产馆| 亚洲欧洲在线一区| 一区二区三区国产精品| 在线观看国产欧美| 亚洲神马久久| 亚洲免费观看在线观看| 欧美一站二站| 国产日韩欧美a| 午夜精品视频网站| 欧美国产一区二区三区激情无套| 国产一区二区三区在线观看免费视频| 宅男精品视频| 久久久久久9999| 午夜精品美女久久久久av福利| 99成人精品| 伊人久久噜噜噜躁狠狠躁| 在线亚洲欧美| 日韩午夜免费| 久久久爽爽爽美女图片| 欧美中文在线观看国产| 欧美日韩伊人| 亚洲全黄一级网站| 影音先锋久久| 久久久www| 久久久久一区二区三区| 久久国产主播| 久久福利影视| 国产精品一区二区三区乱码 | 一二美女精品欧洲| 亚洲电影免费观看高清| 欧美在线看片| 久久精品盗摄| 久久这里有精品视频| 亚洲国产成人一区| 亚洲在线第一页| 亚洲欧美日韩综合| 国产精品成人一区二区三区夜夜夜| 午夜视频一区二区| 亚洲欧美日韩在线播放| 亚洲视频在线二区| 欧美调教视频| 亚洲午夜视频| 性欧美1819性猛交| 国产亚洲成精品久久| 校园激情久久| 亚洲精品一区二区三区99| 日韩视频永久免费| 一本久久综合亚洲鲁鲁五月天| 午夜精品在线| 欧美伊人精品成人久久综合97| 久久婷婷成人综合色| 久久久亚洲一区| 亚洲国产高清一区| 欧美精品免费视频| 一区二区三区四区五区在线| 亚洲女优在线| 国模吧视频一区| 开心色5月久久精品| 亚洲国产天堂久久综合| 国产手机视频一区二区| 久久久久一区| 欧美va天堂| 亚洲先锋成人| 美女视频网站黄色亚洲| 午夜精品久久久久久久99水蜜桃| 久久久久久久91| 亚洲精华国产欧美| 亚洲一区二区不卡免费| 国产农村妇女毛片精品久久麻豆 | 亚洲一区亚洲| 国产欧美日韩视频在线观看| 欧美激情黄色片| 在线视频亚洲| 国内精品国语自产拍在线观看| 最新中文字幕一区二区三区| 国产噜噜噜噜噜久久久久久久久| 欧美电影资源| 中文日韩在线| 国产午夜精品理论片a级大结局| 亚洲三级色网| 久久久久久久97| 亚洲精品久久久久久久久久久久久| 欧美一区亚洲一区| 亚洲国产日韩综合一区| 亚洲欧美在线另类| 在线免费观看一区二区三区| 欧美精品激情在线| 久久动漫亚洲| 日韩视频中文字幕| 免费不卡亚洲欧美| 欧美在线不卡| 欧美视频一区二区三区…| 久久国产成人| 在线亚洲精品福利网址导航| 欧美激情在线播放| 久久久噜噜噜久久人人看| 国产欧美日韩免费看aⅴ视频| 亚洲美女视频在线免费观看| 久久久久国产免费免费| 国产区亚洲区欧美区| 欧美华人在线视频| 美女亚洲精品| 久久成人资源| 性做久久久久久| 一区二区欧美亚洲| 亚洲国产一区在线| 亚洲美女一区| 在线观看欧美日韩| 激情婷婷欧美| 国产综合激情| 国产一区二三区| 国产精品毛片va一区二区三区| 亚洲在线第一页| 亚洲精品久久视频| 亚洲精品偷拍| 亚洲精品久久久久| 亚洲人体一区| 亚洲精品在线观看视频| 亚洲精品国精品久久99热| 欧美成人午夜免费视在线看片| 亚洲激情在线观看视频免费| 在线观看视频一区二区欧美日韩| 麻豆视频一区二区| 久久精品一区二区三区四区| 性视频1819p久久| 午夜在线视频一区二区区别| 亚洲免费精品| 亚洲一区二区三区四区中文| 亚洲综合视频1区| 中文在线资源观看网站视频免费不卡 | 亚洲欧美日韩国产一区二区| 国产亚洲欧美激情| 国产欧美日韩视频| 欧美xxxx在线观看| 欧美精品色综合| 国产精品高清网站| 国产区精品在线观看| 激情综合在线| 欧美视频福利| 国产亚洲精品自拍| 亚洲国产高清视频| 一本色道久久综合亚洲精品高清| 国产欧美日韩亚洲| 欧美国产丝袜视频| 欧美日韩一区二区在线观看视频| 欧美与欧洲交xxxx免费观看| 久久人人爽人人爽| 欧美日本高清一区| 国产毛片一区二区| 亚洲茄子视频| 亚洲欧美日本国产专区一区| 亚洲欧洲综合另类在线| 亚洲少妇自拍| 久久综合99re88久久爱| 午夜精品999| 日韩视频一区| 久久av老司机精品网站导航 | 欧美视频一区二| 狠狠色狠狠色综合人人| 国产精品久久久久久久久久妞妞| 久久久久国色av免费观看性色| 99亚洲伊人久久精品影院红桃| 欧美freesex交免费视频| 亚洲精品国产视频| 亚洲高清免费视频| 亚洲一区久久| 欧美黄色aaaa| 国内精品久久久久久久97牛牛| 国产精品久久一区主播| 亚洲第一精品在线| 亚洲电影免费观看高清| 亚洲一区二区三区国产| 欧美成人影音| 欧美在线日韩精品| 国产精品实拍| 亚洲性夜色噜噜噜7777|