Skip to content

Commit

Permalink
bug #1688249: remove lambda number from signature
Browse files Browse the repository at this point in the history
This changes things like $_52 to $ in signatures so that they group
better.
  • Loading branch information
willkg committed Jan 26, 2021
1 parent 8838291 commit 5b7b9e8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions socorro/signature/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def __init__(self):
self.fixup_space = re.compile(r" (?=[\*&,])")
self.fixup_comma = re.compile(r",(?! )")
self.fixup_hash = re.compile(r"::h[0-9a-fA-F]+$")
self.fixup_lambda_numbers = re.compile(r"::\$_\d+::")

def normalize_rust_function(self, function, line):
"""Normalizes a single Rust frame with a function."""
Expand Down Expand Up @@ -162,6 +163,9 @@ def normalize_cpp_function(self, function, line):
# Normalize `anonymous namespace' to (anonymous namespace). bug #1672847
function = function.replace("`anonymous namespace'", "(anonymous namespace)")

# Remove lambda number from frames. bug #1688249
function = self.fixup_lambda_numbers.sub("::$::", function)

# Collapse types
#
# NOTE(willkg): The " in " is for handling "<unknown in foobar.dll>". bug
Expand Down
6 changes: 6 additions & 0 deletions socorro/signature/tests/test_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ def test_normalize_frame(self):
# Normalize anonymous namespace
("`anonymous namespace'::foo", "23", "(anonymous namespace)::foo"),
("(anonymous namespace)::foo", "23", "(anonymous namespace)::foo"),
# Normalize lambda numbers
(
"ShutdownWorkThreads::$_52::__invoke",
"23",
"ShutdownWorkThreads::$::__invoke",
),
],
)
def test_normalize_cpp_function(self, function, line, expected):
Expand Down

0 comments on commit 5b7b9e8

Please sign in to comment.