top of page

Top | Madexceptbpl

If you suspect the top in your stack trace is causing incomplete reports:

This prevents duplicate MadExcept instances inside BPLs and clarifies the stack trace – you'll no longer see madexceptbpl top as an ambiguous token.

The term "top" in this context refers to the highest level of the exception chain. madExcept installs its own exception filter at the TApplication.HandleException level and the OS-level unhandled exception filter. By sitting at the "top" of the execution hierarchy, it ensures that no exception—whether triggered in the main executable or a linked BPL—escapes without being logged.

MadExcept BPL is a package file that contains the MadExcept library, which provides a robust exception handling mechanism for Delphi and C++Builder applications. It allows developers to handle exceptions in a centralized manner, making it easier to diagnose and fix errors. madexceptbpl top

You load a plugin BPL dynamically at runtime. The plugin overruns its stack. The crash report will show: Exception address: $12345678 Module: MyPlugin.bpl ($12000000 - $12400000 madexceptbpl top)

If the address is $12400001, that is one byte above the defined top. This immediately tells you that the BPL jumped its memory fence—a clear sign of corruption or a multi-threading race condition.

For developers running CI/CD pipelines, you need deterministic behavior. Open your .mes file (it's just an INI file). Under the [DebugInfo] section, you can fine-tune the "top" logic. If you suspect the top in your stack

[DebugInfo]
; Force madExcept to treat any address within 4096 bytes of the top as "inside"
NearTopTolerance=4096
; Required for BPLs loaded with SetParent/UnloadPackage
IgnoreDynamicallyUnloadedBPLs=false
; Explicitly set top for a specific BPL (emergency override)
ExplicitBPLBoundary=MyLegacyBPL.bpl, 0x400000-0x420000

Note: The ExplicitBPLBoundary setting is undocumented but supported in madExcept 5.1.2 and later.

Symptom: A developer posts on a forum: “My Delphi app crashes after loading Plugin1.bpl. MadExcept shows only ‘madexceptbpl top’ in the call stack, no line numbers.”

Root cause: Plugin1.bpl was compiled with MadExcept enabled (embedding its own copy). The main EXE also had MadExcept. The two copies conflicted, and the stack trace was overwritten. This prevents duplicate MadExcept instances inside BPLs and

Solution:

The term madexceptbpl top vanished from the report.


© Sutton's Sanctuary 2026. All Rights Reserved..

bottom of page