Sheerpower Logo

C.5  Comprehensive Built-in Crash Analysis


If your program has a fatal exception which stops it from running, SheerPower writes a crash error file into the folder where the program is located. The name of the file is: xxx_error.txt, where xxx is the name of the source file.

The crash error file contains:
  • Name of the source file where the error occurred
  • Error message
  • Specific routine involved
  • Source line number of the error
  • Relevant source code snippet
  • Stack trace showing recently called routines
  • Names and values of all variables in the program
  • List of all open tables and files at the time of the crash

amount = 45 count = 0 do_main stop routine do_main print 'average:'; amount/count end routine end
---- Division by zero at DO_MAIN.1 --- Call stack and recent routines --- DO_MAIN.1: print 'average:'; amount/count ---------- Call Stack Depth: 1 MAIN.3: do_main AMOUNT = 45 COUNT = 0

Using the built-in crash error file helps make debugging SheerPower programs quick and easy.

Aborting the Program with an Exit Code

If your program encounters a critical error and must halt immediately, you can use the ABORT statement. This closes all open files, terminates execution, and informs the operating system that the program exited with an error.

You can optionally provide a numeric exit code to indicate the nature of the failure:

if config$ = "" then print "Configuration missing. Aborting..." abort 5 end if

This will end the program and return the value 5 to the operating system, which is useful for scripts or automated processes that check return codes.

Summary: Comprehensive Built-in Crash Analysis

SheerPower provides a robust built-in crash analysis system to simplify debugging in the event of a fatal exception. When a program encounters a crash, it generates a detailed error file named xxx_error.txt, where xxx is the source file name. This file is stored in the same directory as the program.

The crash error file contains critical information about the program's state at the moment of the crash.

By pinpointing the exact cause of the error and providing a clear context, the crash analysis file enables developers to debug quickly and efficiently. This tool significantly reduces the time spent identifying and resolving issues, ensuring a smoother development process.

With its detailed and actionable insights, SheerPower’s crash analysis feature is an essential tool for building reliable and maintainable applications.


Hide Description

    

       


      

Enter or modify the code below, and then click on RUN

Looking for the full power of Sheerpower?
Check out the Sheerpower website. Free to download. Free to use.