亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 編程 > C++ > 正文

Debugging Tips and Tricks for C++ in Visual Studio

2019-11-06 06:18:43
字體:
供稿:網(wǎng)友

Visual C++ Team Blog

July 11, 2016 by Andrew B Hall - MSFT // 33 Comments

When we write software our goal is to create correctly functioning applications the first time. Unfortunately, it rarely works that way and we spend a significant amount of time and effort debugging PRoblems in the code rather than adding new value. Fortunately, when issues arise that need investigation Visual Studio ships a world class debugging experience to help find the issue quickly. However, many of us don’t take full advantage of the debugger because we don’t know or simply forget about many of the capabilities it offers to speed up problem solving.

In this post I’ll provide a brief overview the debugging features I showed in a recent C++ Debugging Tips and Tricks video. It certainly doesn’t cover everything but each capability is linked to more detailed information if you want to dive deeper. Additionally, each tip contains a direct link to the exact point in the video I show it.

So go through the following 22 tips and let us know how many of these are new to you – is there anybody that knew all of them? Which one is your favorite?

Finally, before you continue please take a minute to sign up to help us continue to improve the debugger to better meet your needs.

Tips and Tricks

Configuring launch options from project properties (1:25). One common pattern when developing software is to add configuration options to change behavior or test alternate designs based on either command line or environment variable settings. You can configure both command line parameters and set environment variables for the target application on the “Debugging” tab of the Project Properties page (Right click on the project in Solution Explorer and choose “Properties” from the context menu.

Function return values (2:34). When stepping through code in the debugger, the Autos window shows you the values returned by all functions called on the previous line of code.

clip_image002

Set next statement (3:16) enables you to change the next instruction in the application that will execute. This is great for going back and re-running a piece of that that just executed, or can be useful for forcing the application down different code paths to test functionality (e.g. you can move execution inside of a conditional block even if the condition evaluates to false). You can change the next statement by either click and dragging the yellow instruction pointer in the left margin to the desired line, access it through the context menu by right clicking on the desired line and choosing “Set Next Statement” from the context menu, or by using the keyboard shortcut Ctrl+Shift+F10 to set the next statement to line the cursor is on. It is important to note that this simply changes the next instruction that will execute, it does not undo anything that happened previously or run code if you move it forward, for example, if you skip a line of code that initializes a variable using set next statement, the application will crash since the variable will remain initialized.

Step into specific (4:07) allows you to step directly into a function when there are multiple function calls on the same line without the need to navigate to the definition, set a breakpoint, and then continue execution to hit the breakpoint. Step Into Specific can be access from the editor’s context menu by right clicking on the current line, or using the keyboard shortcut Shift+Alt+F11

Run to cursor (5:05) functions as a onetime use breakpoint, by running the debugger to that line and then stopping at that point. Run to cursor can be accessed from both the editor context menu or by using the keyboard shortcut Ctrl+F10 to run to the line the cursor is on. Another useful tip for Run To Cursor is even at design time (when you’re not debugging) the keyboard shortcut Ctrl+F10 will start debugging and run the application to that line of code just like you set a breakpoint and hit F5.

Edit and Continue (6:57) is one of the great productivity time savers when debugging code. If you notice a simple mistake you can correct it while stopped in the debugger without the need to stop debugging, recompile, and run the application back to that location. In Visual Studio 2015 we added support for Edit and Continue into the default C++ debug engine including support for x64 debugging.

Exception Settings (8:31) configure the debugger to stop when specified exceptions are thrown, even if they will later be caught in the application. This is useful when debugging issues where the application is handling the exception but you need to debug why the exception is happening.

Conditional, Hit Count, and Filter Breakpoints (13:44). A Conditional Expression tells the debugger to stop only when a certain condition in the application is met (e.g. when a variable matches a certain string). A Hit Count enables you to break based on the number of times the breakpoint has been hit when equal to an absolute number, equal to or greater, or when the count is a multiple of the number; which is useful if you need to take a sampling based approach to solving an issue (e.g. only show every 100th value). Filter conditions are designed for parallel processing scenarios and enable you to stop when executing on a certain thread, process, or machine.

clip_image004

Pinning DataTips (19:17) when working inside an iterative code path (e.g. for loop) you’re often focused on a single value. Inspecting variables by hovering over them in the editor is great but the DataTips disappear when you move the mouse. By clicking the “pin icon” on the far right side of the DataTip you can “stick” it to the editor so it stays visible on that line of source code until you choose to close it.

clip_image006

Parallel Stacks window (19:42) shows you the call stacks of all of the threads in the process in a concise view. The Parallel Stacks window is opened through the Debug -> Windows menu.

clip_image008

Show External Code (20:30). Visual Studio by default enables a feature we call Just My Code that helps you focus on the code you control by collapsing Operating system and runtime frames on the call stack into a single [External Code] frame. I you want or need to see the complete stack, you can right click in either the Call Stack or Parallel Stacks window to show the complete call stack. If you prefer to debug with this always off, you can permanently disable Just My Code under Debug -> Options

Parallel Watch window (22:00) shows the value of a variable across all threads executing in the current function. It also will show the value of the same variable across stack frames in the case of a recursive method.

clip_image010

Freeze and Thaw threads (23:13) gives you fine grained control over the execution of individual threads. If a particular thread is problematic but you don’t want other threads running while your debugging a single thread you can freeze the threads you don’t want running. When frozen they do not execute any code even when you resume execution of the application.

Flag Threads and Run Flagged Threads to Cursor (24:18) flagging threads enables you to create groups of threads, and then just like Run to Cursor enables you to run the application to a specific line of code, Run Flagged Threads to Cursor enables you to move a group of threads to a specific line. This can be very useful in situations where you need to control the location of certain threads (e.g. to make sure that none of them are holding a lock and then freeze them).

Show Threads in Source (26:13) is a setting that enables you to see what threads are executing with a small glyph in the breakpoint margin. To turn it on, click the “Show Threads in Source” button the debugger toolbar (shown below).

clip_image012

This feature is incredibly powerful when working in code that is running in parallel, but does come at a small performance cost so shouldn’t be left on indefinitely when you’re not using it.

clip_image014

Debug Location toolbar (28:09) is a toolbar that gives you access to the current call stack and the ability to quickly switch between threads among other capabilities. It is visible by default if you use the “General Settings” profile, otherwise you’ll need to manually enable it through View -> Toolbars.

Debugging Heap Corruption with PageHeap (29:43). Heap corruption can be one of the most difficult types of bugs to solve, since the logic error that resulted in the corruption usually occurs long before the application crashes or behaves strangely making it hard to diagnose the location the issue occurs at. PageHeap is a capability in Windows that causes in the operating system to raise an exception if the application either writes to or reads from memory it no longer owns resulting in heap corruption causing the debugger to stop at the location causing the heap corruption. Enabling page heap currently requires using the gflags utility built into the Debugging Tools for Windows as part of the Windows SDK. Once you’ve installed the Debugging Tools for Windows, open an administrative command prompt and run gflags /p /enable [executable name] to enable PageHeap, then debug the application in Visual Studio like normal. A quick Word of caution, PageHeap causes Windows to do more memory tracking, so it slows down the speed of the application it is enabled for, so you shouldn’t leave this on indefinitely if not debugging heap corruption.

clip_image016

PerfTips (33:32) shows you the time your code was executing between stops in the debugger (both when stepping over code and running between breakpoints).

clip_image018

Integrated CPU Profiling (35:53) when writing code, often we do all we can to get it working correctly and it can be difficult or impossible to take the time to profile it separately. To improve the convenience of quickly finding major issues in performance we’ve integrated a CPU profiler into the debugger, that can be access through the Diagnostic Tools window.

Integrated Memory Profiling (38:01) tracking down memory leaks can be hard. To make this easy as possible we’ve integrated memory profiling tools designed to help find and fix leaks directly in to the debugger through the Diagnostic Tools window. By integrating it directly into the debugger, you have fine grained control over where you take snapshots, meaning you look at the memory changes introduced by a single function call or a single line of code.

clip_image020

Natvis (41:03) lets you customize the way Visual Studio displays native types in the debugger. In Visual Studio 2015 we added support for adding project local natvis files, that take effect in the debugger as soon as they are updated, no need to restart debugging.

Showing what source code causes an Access Violation (42:43) frequently a single line of code will deference multiple pointers, which results in hunting for exactly which pointer triggered an access violation. In Visual Studio 2015 Update 1 we added analysis logic into the debugger to show you the exact source expression that triggered the Access Violation.

clip_image022


發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表

圖片精選

成人一级片在线观看| 日本欧美一级片| 欧美精品自拍视频| 免费av一区二区三区四区| 亚洲五月婷婷| 欧洲成人在线视频| 天堂av在线8| 五月天婷婷色综合| 女同性恋一区二区三区| 青青九九免费视频在线| 亚洲欧美另类久久久精品2019| 欧美一级大片在线免费观看| 美女网站在线免费欧美精品| 啊啊啊啊啊好爽| 亚洲永久网站| 日本成人激情视频| 欧美日韩一区二区在线播放| 欧美精品日韩在线| 尤蜜粉嫩av国产一区二区三区| 国产精品国模大尺度私拍| 国产一区二区三区精品在线| 高清中文字幕一区二区三区| 欧美三级电影在线看| 尤物tv国产一区| 亚洲精品国产一区二区在线| 中文字幕无码乱码人妻日韩精品| 97在线免费观看| 99久久精品国产一区二区三区| 亚洲有码转帖| 亚洲欧美小说国产图片| 亚洲精品免费观看| 成人午夜电影小说| 国产亚洲欧美一区在线观看| 亚洲靠逼com| 久久久99国产精品免费| 老司机在线看片网av| 在线观看国产一区| 国产亚洲一区二区在线| 久久99精品久久久久久久青青日本| a级免费视频| 亚洲欧美日韩中文在线| 在线中文字幕不卡| 国产伊人网av.| 视频在线观看免费影院欧美meiju| 欧美激情网友自拍| 国产欧美自拍视频| 成人午夜伦理影院| 久久亚洲私人国产精品va媚药| 日日摸夜夜添夜夜添亚洲女人| 欧美精选一区二区| 成人免费看片视频在线观看| a'aaa级片在线观看| 黄色在线网站噜噜噜| 色国产精品一区在线观看| 欧美日韩国产999| 久久久久久一二三区| 老牛影视精品| 久久精品这里都是精品| 秋霞欧美一区二区三区视频免费| 99精品黄色片免费大全| 日韩视频在线视频| 成视频免费观看在线看| 91精品国产91久久久久久黑人| 成人日日夜夜| 91亚洲国产成人精品一区| 最近2019中文字幕大全第二页| 国产二级c片l毛片| 日本高清不卡在线| 国产一级二级三级在线观看| 亚洲综合网av| 成人77777| 色狼人综合干| 四虎成人精品永久免费av九九| 在线观看视频你懂的| 日韩制服丝袜先锋影音| 亚洲自拍偷拍区| 日韩成人中文电影| 卡一卡2卡三精品| 国产精品视频一区二区三| 男人添女荫道口喷水视频| 欧美在线观看视频在线| 成人黄视频在线观看| 51精品国产人成在线观看| 久久一区二区三| 少妇愉情理伦片bd| 国产美女www爽爽爽| 色成人亚洲网| 尤物精品国产第一福利三区| 国产超级av在线| 99pao成人国产永久免费视频| 国产美女精品人人做人人爽| 久久久久久国产精品免费播放| 五月激情五月婷婷| 97品白浆高清久久久久久| 国产成人精品视频在线观看| www夜片内射视频日韩精品成人| 伊人久久99| 91久久精品一区| 国产成人亚洲综合无码| 国产一区二区三区在线看麻豆| 国产综合网站| 欧美一区二区三区免费在线看| 国产精品麻豆一区| 经典三级在线一区| 午夜在线观看视频| 精品无人区太爽高潮在线播放| 国产高清不卡| 中文字幕视频在线免费| 欧类av怡春院| 欧美黄色免费网站| 国产裸体歌舞团一区二区| 人妻偷人精品一区二区三区| 丁香婷婷在线| 国产精品久久久久久久av电影| 久久香蕉综合色| 91美剧网在线播放| 亚洲一级高清| 久久高清无码视频| 日韩视频在线观看| 国产精品视频一区视频二区| 夜夜骚av一区二区三区| 四虎4hu新地址入口2023| 成人黄色小视频| 久久无码精品丰满人妻| 欧美xxxx在线观看| 欧美国产日韩免费| 999在线免费观看视频| 国产又粗又猛又爽又黄的视频一| 欧美另类网站| 免费人成又黄又爽又色| 国外亚洲成av人片在线观看| 欧美一级成年大片在线观看| 中文字幕日韩欧美精品在线观看| 久色视频在线| 婷婷在线精品视频| 穿情趣内衣被c到高潮视频| 国产高清一区| 日本一本高清视频| 大片免费在线看视频| 国产精品你懂的在线欣赏| 国产日韩视频一区二区三区| 2020国产在线视频| 精品国产一区二区三区不卡蜜臂| 欧美久久综合网| 精品一区二区免费在线观看| 波多野结衣视频一区| 国产在线视频在线| 激情小视频网站| 国产又大又粗又爽| 69精品久久久| 乱亲女秽乱长久久久| 777a∨成人精品桃花网| 韩国三级电影一区二区| 中文字幕欧美激情极品| 亚洲a级精品| 久久精品国产亚洲av久| 视频区小说区图片区| 美女又爽又黄免费| 久久这里只有精品免费| 欧美xxxxxxxx| 视频免费裸体网站| 91精品国产91久久久| 日韩高清中文字幕一区| 性色av一区二区三区在线观看| 日韩av一二三| 一区二区日韩av| 久久国产精品一区二区三区| 福利在线视频网站| 中文字幕av久久爽av| 亚洲一区二区三区成人在线视频精品| 亚洲精品aa| 日韩精品一区二区三区四区视频| 不卡一卡二卡三乱码免费网站| 久久久av一区| 国产欧美一区二区三区在线看蜜臀| 国内av一区二区三区| 在线国产欧美| 色婷婷久久久综合中文字幕| 亚洲日本视频在线| 性生活黄色大片| 顶级嫩模一区二区三区| 亚洲精品欧美日韩| 欧美极品一区二区三区| 97超碰人人模人人人爽人人爱| 欧美成人高清手机在线视频| 性爱视频在线播放| 精品福利免费观看| 久久久久久久少妇| 亚洲a∨精品一区二区三区导航| 欧美一区二区精品| 国产一区二区三区观看| 国产精品普通话| 欧美一区二区三区成人精品| 女王人厕视频2ⅴk| 99精品在线免费在线观看| 成人午夜在线观看视频| 精品一区电影| 二区三区在线播放| 在线观看av的网站| 国产天堂av在线| 蜜臀av无码一区二区三区| 日本tube24xxxxx| 亚洲91精品在线观看| 国产精品一区二区性色av| 国产精品国产三级国产aⅴ| 亚洲一区二区三区视频在线| 在线视频你懂| 亚洲欧美一区二区激情| 中文字幕亚洲一区二区三区五十路| 日韩天堂在线视频| 国产又黄又粗又爽| 成午夜精品一区二区三区软件| 午夜诱惑痒痒网| 国产馆在线观看| 在线观看免费av网| 成人久久精品| 97一区二区国产好的精华液| 成人久久18免费网站麻豆| 91一区在线观看| 欧美性潮喷xxxxx免费视频看| 欧美专区亚洲专区| 亚洲精选av| 北条麻妃亚洲一区| 黄色日韩在线| 偷拍一区二区三区| 日韩中文字幕在线精品| 中文字幕无码人妻少妇免费| 青草热久免费精品视频| 欧美成人video| 日韩精品中文字幕吗一区二区| 亚洲高清视频中文字幕| 欧美日韩一区中文字幕| 理论片影音先锋| 538任你躁在线精品免费| 在线观看天堂av| 欧美经典影片视频网站| 成人黄网18免费观看的网站| www日本在线| 亚洲精品v天堂中文字幕| www.91香蕉视频| 欧美美女黄色网| 九九九九九精品| 精品一区二区三区蜜桃| 久久久精品人妻无码专区| 桃乃木香奈和黑人aⅴ在线播放| 黄色成年人视频在线观看| av 日韩 人妻 黑人 综合 无码| www.com久久久| 黄色免费视频观看| 你懂的国产在线| 国产精品丝袜白浆摸在线| 国产精品手机在线| 136福利视频| 欧美最新另类人妖| 久久国内精品自在自线400部| 青青草娱乐视频| 国产熟妇一区二区三区四区| 少妇av一区二区三区无码| 99精品全国免费观看视频软件| 国产在线不卡一卡二卡三卡四卡| 成人免费毛片在线观看| 欧美性潮喷xxxxx免费视频看| 欧美这里只有精品| 欧美精品日日操| 91精品又粗又猛又爽| 日韩高清在线电影| 一本一道dvd在线观看免费视频| 91碰在线视频| 久久久国产精品成人免费| 国产高清一区| 国产成人高潮免费观看精品| 中文字幕一区二区在线播放| 国产精品密蕾丝袜| 欧美成人福利视频| 自拍偷拍亚洲| 男人日女人逼逼| 男人资源在线播放| 日韩精品无码一区二区三区久久久| 久久精品亚洲国产| 亚洲精品乱码久久久久久9色| 99久久激情视频| 精品一区二区三区电影| 色婷婷久久久久swag精品| 欧美图片一区二区| 9色视频在线观看| 成人做爰66片免费看网站| 国产精品v日韩精品v在线观看| 91精产国品一二三| 欧美色图免费看| 中国黄色录像片| 一区二区三区欧美久久| 天天影视色香欲综合网天天录日日录| 成人av在线播放网站| 精品亚洲国产成人av制服丝袜| 国产在线观看免费视频今夜| 97天天综合网| 国产精品99久久久精品无码| 欧美日韩黄色一级片| 久久久五月天| 成人3d动漫一区二区三区| 美女国产精品| h视频在线观看免费| 青春草国产视频| 亚洲一级电影| 91精品国产美女浴室洗澡无遮挡| 在线免费一区二区| 精品人妻一区二区三区换脸明星| av影音在线| 免费yellow网站| 一色道久久88加勒比一| 7777久久香蕉成人影院| 亚洲欧美高清视频| 亚洲免费成人av| 最好2018中文免费视频| 一区二区三区视频免费看| 中文字幕在线播放| 国产河南妇女毛片精品久久久| 最近中文字幕在线观看视频| 蜜桃导航-精品导航| 国产午夜亚洲精品羞羞网站| 色综合亚洲欧洲| 亚洲国产精品久久久久秋霞影院| 亚洲一区二区三区四区在线播放| 91麻豆成人精品国产免费网站| 国内自拍视频在线观看| 日韩美女激情视频| 亚洲欧洲日韩一区二区三区| 成人444kkkk在线观看|