diff --git a/utils/backtrace-check b/utils/backtrace-check
index a304f68bc22ed..a8058cff27b46 100755
--- a/utils/backtrace-check
+++ b/utils/backtrace-check
@@ -1,54 +1,82 @@
#!/usr/bin/env python
-# This script uses a regex to validate the output of our backtraces.
-# The layout we assume is:
-#
-# +
-#
-# It currently just checks that the backtrace results in at least one correctly
-# formatted entry. It does not directly validate the input since the output
-# would not be robust against standard library changes.
-#
-# TODO: We could have the user pass in the frame number, library name, and
-# demangled name. These we can always validate as true in a robust way. On the
-# other hand, address and offset are more difficult to validate in a robust way
-# in the face of small codegen differences, so without any further thought I
-# imagine we can just check the format.
-#
-# 11 libswiftCore.dylib 0x000000000dce84d0l _fatalErrorMessage(StaticString,
-# StaticString, StaticString, UInt, flags : UInt32) -> () + 444
-
-from __future__ import print_function
+
+"""
+This script uses a regex to validate the output of our backtraces.
+The layout we assume is:
+
+ +
+
+It currently just checks that the backtrace results in at least one correctly
+formatted entry. It does not directly validate the input since the output
+would not be robust against standard library changes.
+
+TODO: We could have the user pass in the frame number, library name, and
+demangled name. These we can always validate as true in a robust way. On the
+other hand, address and offset are more difficult to validate in a robust way
+in the face of small codegen differences, so without any further thought I
+imagine we can just check the format.
+
+11 libswiftCore.dylib 0x000000000dce84d0l _fatalErrorMessage(StaticString,
+StaticString, StaticString, UInt, flags : UInt32) -> () + 444
+"""
+
+
+from __future__ import absolute_import, print_function, unicode_literals
import argparse
import re
import sys
-def main():
+# -----------------------------------------------------------------------------
+# Constants
+
+DESCRIPTION = """
+Checks that a stacktrace dump follows canonical formatting.
+"""
+
+TARGET_PATTERN = re.compile(
+ r'(?P\d+) +(?P