Delphi wrapper for sentry-native

We’ve written a Delphi wrapper for the sentry-native API and I thought I’d share it here.

This is part of the Keyman project, at https://github.com/keymanapp/keyman/tree/master/windows/src/ext/sentry; it’s still in alpha so expect changes.

The code is MIT licensed. It works with Windows x86 and x64, console and VCL apps. It is in sync with sentry 0.2.3.

Because Delphi does not produce .pdb files, and it has its own exception management anyway, we’ve opted not to use the Crashpad handler for Delphi exceptions. (Delphi’s debug format is Borland’s own very old .tds, which is definitely not trivial to convert to .pdb.)

Here’s what we have:

  • sentry.pas is a straight translation of sentry.h.
  • Sentry.Client.pas is a class wrapper – with console and VCL subclasses – and last-chance exception reporting.
  • sentrytool is a command line tool that converts Delphi .map into .sym for symbolication, and adds a null.pdb reference to the executable so it will be correctly processed.
  • Keyman.System.KeymanSentryClient.pas is an example of how we instantiate it for our projects.
2 Likes