Debug VC + + code with call stack more

Source: Internet
Author: User

Time is tighter, just remember! Jot down small successes with small failures and keep moving forward.


 Story

More than a day more time, (in fact, in the last few days vaguely appeared this BUG, only then did not systematically or frequently debug run and so did not find) was a BUG tortured!


Now, in summary, the root cause is not skilled in development tools. This BUGappears again today because the code is too long and there is no way to analyze the diagnosis roughly based on the code execution process and its own experience.


Today's rest room (temporarily tortured by bugs, have to rest!) ), I suddenly remembered that there had been several observations of the call stack before. So, seize the time to try it, sure enough success--a very big BUG was dug out!


Summarize


The main reasons for this error are: The code is very long (nearly 5000 lines), and repeatedly modified, sometimes a lot of content inadvertently modified incomplete (this is a typical unintentional, and many people will appear errors), resulting in a lot of wasted time.


One of the conclusions is this: use of the system-provided "refactoring" functionality later on (The VS2012 integrated development Environment I use today supports personal feeling that is already very good), even for longer sub-functions as much as possible, so as to minimize the above problem! (Sometimes, the individual is a bit proud, in the longer function inside the modification will not use "refactoring"!) This is the cause of the above bug. )


  The second conclusion is: When the system is running wrong , use the call stack a lot. Today's call stacks can help you get closer to the source of the bug lately, VERY good! Look at this one of mine.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/48/6C/wKioL1QH5UvTGqyHAAEqzDQm034210.jpg "title=" capture. JPG "alt=" Wkiol1qh5uvtgqyhaaeqzdqm034210.jpg "/>

Just double-click the line in the appropriate call stack, the source immediately appears in front of it. Almost the first time to help you catch the BUG !

  

This article is from the "Green Peak" blog, please make sure to keep this source http://zhuxianzhong.blog.51cto.com/157061/1548665

Debug VC + + code with call stack more

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.