5656MAX_LATEST = 20
5757
5858# Bump this when the parsing changes, so that all persisted summaries are regenerated.
59- PARSER_VERSION = 1
59+ PARSER_VERSION = 2
6060
6161# A cached report is reused as long as no new data arrived. When new data has arrived, the
6262# cached report is still reused if it is younger than this (in seconds).
@@ -112,6 +112,21 @@ def is_url(line: str) -> bool:
112112]
113113
114114
115+ # Assertion failure message that donate-cpu puts before the ' received signal ' line (glibc format without the
116+ # program name): build/token.cpp:123: void Token::foo(): Assertion `x' failed.
117+ _ASSERTION_FAILURE_RE = re .compile (r"^[^:\s]+:\d+: .+: Assertion `.+' failed\.$" )
118+
119+
120+ def _parse_assertion_failures (lines : List [str ], i : int ) -> List [str ]:
121+ """Assertion failure messages just before lines[i] (the ' received signal ' line)."""
122+ assertions : List [str ] = []
123+ j = i - 1
124+ while j >= 0 and _ASSERTION_FAILURE_RE .match (lines [j ].strip ()):
125+ assertions .insert (0 , lines [j ].strip ())
126+ j -= 1
127+ return assertions
128+
129+
115130def _parse_stack_frame (line : str ) -> Optional [str ]:
116131 for pattern , sep in _STACK_FRAME_PATTERNS :
117132 m = pattern .search (line )
@@ -122,6 +137,7 @@ def _parse_stack_frame(line: str) -> Optional[str]:
122137
123138def _parse_crash (lines : List [str ], i : int ) -> Tuple [Dict [str , Any ], int ]:
124139 """lines[i] is the line after the ' received signal ' line."""
140+ assertions = _parse_assertion_failures (lines , i - 1 )
125141 crash_line = lines [i ].strip () if i < len (lines ) else ''
126142 i += 1
127143 code_line = ''
@@ -138,7 +154,7 @@ def _parse_crash(lines: List[str], i: int) -> Tuple[Dict[str, Any], int]:
138154 if frame is None :
139155 break
140156 stack .append (frame )
141- return {'crash_line' : crash_line , 'code_line' : code_line , 'stack_trace' : stack }, i
157+ return {'assertions' : assertions , ' crash_line' : crash_line , 'code_line' : code_line , 'stack_trace' : stack }, i
142158
143159
144160def message_id_of (line : str ) -> Optional [str ]:
@@ -604,7 +620,7 @@ def crash_report(entries: Dict[str, Dict[str, Any]]) -> Dict[str, Any]:
604620 rows .append (dict (package_row (package , entry ), head_crash = head_crash , old_crash = old_crash ))
605621 crash = entry .get ('crash' )
606622 if head_crash and crash :
607- key = '\n ' .join (crash ['stack_trace' ])
623+ key = '\n ' .join (crash . get ( 'assertions' , []) + crash ['stack_trace' ])
608624 group = stack_traces .get (key )
609625 if group is None :
610626 stack_traces [key ] = dict (crash , packages = [package ])
@@ -1402,7 +1418,7 @@ def html_crash(pkgs: Optional[str] = None):
14021418 blocks .append ({
14031419 'heading' : '#{}: {} package{}' .format (n , len (g ['packages' ]), '' if len (g ['packages' ]) == 1 else 's' ),
14041420 'links' : [(p , package_href (p )) for p in g ['packages' ]],
1405- 'text' : '\n ' .join ([g ['crash_line' ], g ['code_line' ]] + g ['stack_trace' ]),
1421+ 'text' : '\n ' .join (g . get ( 'assertions' , []) + [g ['crash_line' ], g ['code_line' ]] + g ['stack_trace' ]),
14061422 })
14071423 sections = [
14081424 {'columns' : ['Package' , 'Date' , OLD_VERSION , 'Head' ], 'rows' : rows },
0 commit comments