Sheerpower Logo

Built-in Crash Analysis


If your program encounters a fatal exception, Sheerpower automatically writes a crash file in the same folder as the program. The filename is <source>_error_<timestamp>.txt.

Each crash report contains:

  • Source file where the error occurred
  • Error message and routine name
  • Source line number and code snippet
  • Full routine call stack trace
  • All global variables and values
  • Final values of parameters and locals
  • List of open tables and files at crash

Example output:

amount = 45 count = 0 do_main stop routine do_main print 'average:'; amount/count end routine end
---- Sheerpower V011.020 debug output on MRDAN-BEAT-IT 04-AUG-2025 22:00:25 Filename: c:\test\sptest.spsrc 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

This built-in crash report helps you quickly pinpoint fatal issues in your Sheerpower program.

Live Debugging with SHOW ALL

The SHOW ALL statement generates a full debug report while the program is still running. It creates a file named <source>_debug_<timestamp>.txt.

  • Current values of all variables
  • Final values from completed routines
  • Live call stack at that moment
  • List of open files and tables

This is useful for tricky bugs, test snapshots, or state checkpoints:

if bad_data? then show all // capture diagnostic state

SHOW ALL captures program state with high precision— without halting execution.

External Debug Triggering

You can also trigger a debug report from outside the program using its Process ID (PID). Useful if the program is frozen or looping.

Sheerpower includes a background thread that listens for external debug commands—even when the main thread is stuck or blocked.
sp4gl debug 12345678

This saves a full snapshot to <source>_show_all_<timestamp>.txt, with the same diagnostics as SHOW ALL.

When to Use External Triggering

  • Deadlock: capture state during freeze
  • Infinite loop: inspect where it's stuck
  • Production debug: no source changes needed
  • System monitor: auto trigger on timeout

Finding the Process ID (PID)

  • Windows: Use Task Manager or:
    tasklist /fi "imagename eq sp4gl.exe"

External dumps include the same data as crash or internal dumps, making them great for diagnosing live systems.

Abort with Exit Code

If you must terminate early, use abort to exit and optionally return an error code.

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

The OS receives exit code 5, which can be used by scripts or automated checks.

Final Values from Completed Routines

Sheerpower keeps final values of local and parameter variables even after a routine finishes. Traditional debuggers discard them.

This is done via name munging, where variables are renamed by routine:

// completed validation validate_order$item_count = 5 validate_order$error_flag = false // completed tax calculation calculate_tax$local_rate = 8.5 calculate_tax$tax_amount = 127.50 // current crashing routine print_invoice$line_count = 47

This preserves historical context and avoids name conflicts—perfect for debugging multi-step business logic.


Protecting Sensitive Data with NODUMP

Business applications often process confidential information— such as passwords, API tokens, or personal identifiers—that must not appear in crash dumps or debug logs.

Use the nodump declaration modifier to keep sensitive values out of all diagnostic output. Variables marked nodump are excluded from automatic crash files, SHOW ALL listings, and external PID-based dump triggers.

Within clusters, you can mix nodump and dump on a field-by-field basis.

Cluster Example:

cluster customer: string name$, string nodump password$, string nodump api_token$, string dump public_id$

Simple Example:

type nodump string secret // a custom data type of "secret" declare secret password$ declare string nodump api_token$ declare string nodump ssn$ cluster list: a, b, nodump c, d, dump e, f // Mixes nodump and the default (dump)

In debug output, these variables appear as:

API_TOKEN$ = <nodump> PASSWORD$ = <nodump> SSN$ = <nodump> --- Dump of variables --- LIST->A = [uninitialized] LIST->B = [uninitialized] LIST->C = <nodump> LIST->D = <nodump> LIST->E = [uninitialized] LIST->F = [uninitialized] --- End of variables ---

Benefits of nodump

  • Declare once, protected everywhere
    No need to scrub crash dumps manually.
  • Zero performance overhead
    The exclusion is handled by the dump engine itself.
  • Audit-friendly
    Reviewers can easily verify that sensitive fields are protected.
  • Team-safe
    Crash files can be safely shared with developers and support staff.
  • Compliance-ready
    Meets requirements for handling sensitive data in regulated industries.

The nodump attribute keeps sensitive data hidden while preserving full visibility into all other program state during debugging.

VS Code Integration

Visual Studio Code users: Sheerpower provides a debugging extension with interactive features like breakpoints, line-by-line stepping, and watch windows for live variable inspection. This modern interface enhances Sheerpower’s diagnostic tools and supports efficient debugging directly in the IDE.

Example Output Files

  • invoice_error_2025-08-04_2200.txt — crash
  • invoice_debug_2025-08-04_2215.txt — SHOW ALL
  • invoice_show_all_2025-08-04_2220.txt — external

Summary: Built-in Crash Analysis

Sheerpower automatically generates a detailed crash file when fatal errors occur. It captures source location, call stack, variable state, open resources, and routine context.

Debugging is simplified through crash dumps, internal SHOW ALL, or external triggers using sp4gl debug.

Final values of local and parameter variables are retained across completed routines—providing deep insight for diagnosing bugs in complex workflows.

This rich diagnostic support makes Sheerpower especially strong for building reliable business applications.

(Show/Hide Sheerpower Crash Analysis Takeaways)

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.