Record stack information in program exceptions

Source: Internet
Author: User

When writing a program, we can capture exceptions through the debugging environment provided by the IDE, and view relevant information so that we can fix problems in the program. However, after the software is released, the Environment deployed and running is very different from the debugging environment. Even if the debugging environment has tested a perfect program, it is also difficult to ensure that there are no errors in the actual operation. When a program encounters an error, it often throws a Red Cross warning box to tell us that the program has an error, but this is like a child who does not understand the expression, it just tells you how it hurts, but does not know how it hurts. Fortunately, there is a component called exwatcher that can teach your child how to say the pain in it.

 

The exwatcher component is used to capture program exceptions and record the location and call stack information of exceptions. onexception is different. It replaces program exception handling functions and classifies exceptions into delphiexception, delphisafecallexception, systemexception, and systemsafecallexception. It also provides different callback functions for these four types of exceptions. At the same time, it is based on Seh (structured exception handling), you need to use the dbg file, that is, you need to publish the dbg file with the same name as the program.

 

For the implementation principle of exwatcher, see the following article:
Advanced exception handler to find the exception source file name, call stack and all other related information

Advanced exception handler to find the exception source, call stack and more

 

 

Http://www.clevercomponents.com/articles/article012/ExWatcher.zip for exwatcher
Demo download: http://www.clevercomponents.com/articles/article012/Demo.zip

 

To generate a dbg file, you need a small tool, map2dbg, which can convert the map file of dephi to a file in dbg format, to generate a map file, modify project-> options-> linker-> map file and select detailed, or add the compilation command {$ D +, L +} as needed }.

 

Map2dbg: http://code.google.com/p/map2dbg/

 

When the map cannot be generated, delete the dproj file, open DPR with IDE, and re-build dproj by IDE.

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.