Every game has a function that half the engine calls: an asset cache, the logging code that turns a fatal log message into a crash, the helper that checks a graphics API's return code. A naive crash reporter groups crashes by the function at the top of the call stack, so every crash that stops in that function lands in one group, no matter which code called it. Open that group and you'll see one function at the top of the stack and a crash count that keeps climbing.

BugSplat's grouping rules skip shared code that isn't relevant to the actual bug, and the default rules already skip common frames from popular game engines, operating systems and frameworks. Rules only help once you know which frames to skip, though, and until you do, a group whose top frame is called from all over the game usually hides more than one bug. The texture streamer, the network code and the save system can each break the same shared function in their own way. Filing the whole group as "fix the asset cache" sends a developer to code that may be fine, while the real bugs sit in the callers further down the call stack.

At BugSplat, we wanted to give developers better tools for visualizing crash groups and improving their grouping rules, so we redesigned the Stack Explorer. The Stack Explorer shows you which caller is behind most of a group's crashes, opens exactly those crash reports, and points out the parts of your code that reach a failure from many different places. This article takes a crash group from a sample game, finds the caller behind more than half of its crashes, opens just those reports on the Crashes page, spots a subsystem that needs a redesign, and shows how to read deep call stacks in the tree.

What's New

  • A treemap of every call stack. Each distinct call stack in the group gets a box sized by its crash count and colored by the caller it comes from, with a legend that ranks those callers.
  • View crashes for any frame. Select a box, a caller or a row and click View crashes to open the Crashes page filtered to the crashes whose call stack passed through that frame.
  • A tree that indents only where call stacks branch. A stretch of the stack with a single caller reads like an ordinary call stack, and the frames below a stack's last branch point fold into one quiet row such as 19 more frames.
  • Controls that stay in view. On a wide screen, the treemap, the selected frame and the tree's toolbar stay at the top of the page while you scroll through deep stacks.

One Crash Group Can Hide Several Bugs

To show the Stack Explorer at work, we built a small sample game with a shared asset cache and sent its crashes to BugSplat. All 86 crashes in the sample's crash group stop in AssetCache.acquire with the error "asset handle released while in use", so the Crash Group page shows one top frame for the whole group.

Here is the same crash group in the Stack Explorer, with the texture streaming caller selected:

The Stack Explorer for crash group 1232, AssetCache.acquire, with 86 crashes and 12 distinct stacks. The treemap shows one large box for StreamingJob.run, a cluster of small boxes for the network replicators, and two small boxes for the save game and inventory code. TextureStreamer.uploadMip is selected, with 48 crashes, 55.8% of the group

The treemap tells a different story than the top frame does. The legend ranks four callers. TextureStreamer.uploadMip accounts for 48 crashes, more than half the group, and ReplicatedComponent.bindAsset accounts for 31. The save game and inventory code account for the last 7 crashes.

Finding the Call Stack to Fix First

The biggest box is where to start. In the sample group, StreamingJob.run alone covers 38 crashes. Click that box and the tree opens to the frame, with the 19 frames below it folded into one row. The bar under the treemap shows the frame's file and line, its crash count, its share of the group, and how many distinct stacks pass through it.

Click View crashes in that bar to open the Crashes page filtered to those 38 crashes, for the same date range. The developer who picks up the fix starts with the reports for the bug they're fixing and doesn't have to sort them out of the whole group.

Stepping the tree's Depth, selecting the network replication caller, then clicking the StreamingJob.run box, unfolding its 19 more frames, and clicking View crashes to open the 38 matching crashes on the Crashes page

Spotting Code That Needs a Redesign

The network replication boxes tell you something different. No single network call stack crashes very often. Seven replicators, for cosmetics, projectiles, vehicles, doors, ragdolls, pickups and weather, each reach the asset cache through ReplicatedComponent.applyField, with 2 to 8 crashes apiece. Together they make up 36% of the group.

Here are the network replication callers in the tree:

The Stack Explorer tree opened to ReplicatedComponent.applyField, with seven replicators below it, each with 2 to 8 crashes and its remaining frames folded into a 17 more frames row

Many small callers failing the same way in one shared function usually point at how a subsystem uses the shared code. Fixing the cosmetics replicator alone would leave the other six crashing. When one color in the treemap breaks into many small boxes, look at the design of that area of your code before you file individual fixes.

Reading Deep Call Stacks

Game call stacks are deep, so the tree keeps the frames that matter on screen:

  • The tree indents only at branch points. A frame with one caller sits at the same indent as that caller, joined by a thin line, so a long chain of calls reads top to bottom like the call stack on a Crash page.
  • The bottom of each call stack folds away. Below a stack's last branch point, the tree shows the first frame and folds the rest into a row such as 17 more frames. Click the row when you need those frames.
  • Depth opens branch points a step at a time. Depth sets how many branch points to open along each call stack, All opens every one, and Expand busiest path opens the call stack with the most crashes all the way to the bottom.
  • Search finds a function anywhere in the group. Type in Search functions to highlight every matching frame. The tree opens to each match, and the treemap fades the stacks that don't pass through one.

Get Started

Open a crash group from the Summary page and click Call Stack Explorer on the Crash Group page. The Stack Explorer guide covers the treemap, the tree and the controls in detail.

If the Stack Explorer shows a crash group in a way that's hard to read, email support@bugsplat.com and tell us which group it was.