Announcing support for automatic C++ exception tracking

Callum GavinProduct Updates, Provider Updates5 Comments

Today we’d like to highlight a currently undocumented feature of Raygun that is available for use – C++ exception tracking!

While we currently don’t have an official provider for the language, the Raygun backend does feature support for automatic grouping of C++ exceptions. Due to platform, compiler and implementation concerns only the raw entries API endpoint is supported, but this allows you to POST to Raygun with the exception data in a manner that best suits your application.

What you get with C++ exception tracking

Just like the other languages we support, instances of C++ exceptions are grouped according to their actual code path, which doesn’t use potentially instance-specific data to construct the group. For instance, differing line numbers and paths are ignored, and the message can contain random user data which will be ignored so similar exceptions can be grouped together.

This stops you from drowning in log files by having your team focusing on individual bugs while ignoring data that isn’t relevant.

Creating the stack/back trace

One known good implementation for walking the callstack to reconstruct the stack trace with Visual C++ environments is StackWalker. A variety of other approaches for systems with GCC, LLVM and others are detailed here. In particular look into backtrace() from execinfo.h, then demangle the output with abi::__cxa_demangle() and sscanf() or dladdr().

POSTing your C++ exception to Raygun

If the resulting JSON payload contains the following client name the included C++ exception will be automatically grouped according to its code path:

The version and URL can be of your choosing. That client value should be placed beneath the top-level details object. As for the rest of the payload, it should follow the structure of the entries API as outlined in the docs. After your application has constructed the stack trace for a caught exception (see below), it should include the class name and message as strings, and an array of stack trace frames containing the line number, class name, file name and method name. You can then implement other supported features if you desire, such as environment data, user tracking, custom data or tags. That JSON payload should then be POSTed to, with an X-ApiKey header key set to your key (available from the Raygun dashboard).

If you would like a complete example JSON payload you can contact us via email (or add a comment below), or you can grab one of our other providers (for instance the C#, Java or JavaScript providers), then throw a test exception to see how they manage the sending.

Interested? We’re here to help

We’d like to hear about your experiences if you are implementing this in your code. The automatic grouping logic for C++ is ready to go on our backend, so have at it! When you’re ready to send exceptions to Raygun start your 30-day free trial here. And if you have any questions or comments, let us know below.

Next level software intelligence across your entire stack.

5 Comments on “Announcing support for automatic C++ exception tracking”

  1. Vaclav

    This is potentially nice (I still didn’t find any truly universal solution, most focus on only iOS or OS X and Windows support is abysmal), but leaves more questions than it answers:

    How is symbolification handled? You support uploading of dSYMs for iOS, does the same work for OS X apps? What about Windows and Visual C++ that you mention? Is there a way to upload PDBs and will Raygun symbolicate the stacktrace? Do you support uploading minidumps (the de facto standard for crash data on Windows that all tools, including Breakpad and VC++, can work with)? Because if there’s no way to get *symbolicated* backtraces, it’s not very useful – and you can’t very well create those on client side without including debug symbols with the shipped binaries.

  2. Giridhari

    Can we use this software to Automatic crash reporting and monitoring for QT based software on Windows / Linux and Mac.?

    1. Freyja Spaven

      Hi Giridhari, thanks for your comment. In answer to your question, in short, yes, as we have an API you can use to manually send errors to the Raygun platform. However, we don’t support automatic reporting in Qt, so you would need to write your own code to catch errors and call the Raygun API with the correct data to report the error.

      I hope this answers your question? Thanks, Freyja

  3. Pingback: Product update: Google Breakpad center and Raygun Crash Reporting

  4. Pingback: How to locate your InnerErrors and track them in Raygun Crash Reporting

Leave a Reply

Your email address will not be published. Required fields are marked *