Add a frame to the crash state if we have a match on this line.
(self,
compiled_regex: re.Pattern,
line: str,
state: CrashInfo,
group=0,
frame_filter=_filter_stack_frame,
demangle=False,
can_ignore=True,
frame_spec=None,
frame_override_func=None)
| 218 | return match |
| 219 | |
| 220 | def add_frame_on_match(self, |
| 221 | compiled_regex: re.Pattern, |
| 222 | line: str, |
| 223 | state: CrashInfo, |
| 224 | group=0, |
| 225 | frame_filter=_filter_stack_frame, |
| 226 | demangle=False, |
| 227 | can_ignore=True, |
| 228 | frame_spec=None, |
| 229 | frame_override_func=None): |
| 230 | """Add a frame to the crash state if we have a match on this line.""" |
| 231 | match = compiled_regex.match(line) |
| 232 | if not match: |
| 233 | return None |
| 234 | |
| 235 | frame = match.group(group).strip() |
| 236 | |
| 237 | # Strip out unneeded structure. Remove this hack after modularizing tools. |
| 238 | for regex in STRIP_STRUCTURE_REGEXES: |
| 239 | structure_match = regex.match(frame) |
| 240 | if structure_match: |
| 241 | frame = structure_match.group(1) |
| 242 | break |
| 243 | |
| 244 | if demangle and environment.is_posix(): |
| 245 | if '\x00' in frame: |
| 246 | # We can't pass the frame as an argument (will be a ValueError) and if |
| 247 | # there's a NULL in the "frame" it's probably not actually a frame. |
| 248 | return None |
| 249 | pipe = subprocess.Popen( |
| 250 | ['c++filt', '-n', frame], |
| 251 | stdin=subprocess.PIPE, |
| 252 | stdout=subprocess.PIPE) |
| 253 | frame, _ = pipe.communicate() |
| 254 | frame = frame.decode('utf-8') |
| 255 | |
| 256 | # Try to parse the frame with the various stackframes. |
| 257 | frame_struct = None |
| 258 | if frame_spec is not None: |
| 259 | frame_struct = frame_spec.parse_stack_frame(match) |
| 260 | |
| 261 | # Account for case when we have no symbols and hence don't want to strip |
| 262 | # anonymous namespaces in the crash state. |
| 263 | if (frame_struct and frame_struct.module_offset and |
| 264 | not frame_struct.function_name): |
| 265 | |
| 266 | def new_frame_filter(s): |
| 267 | return s |
| 268 | |
| 269 | frame_filter = new_frame_filter |
| 270 | |
| 271 | # Update stacktrace frames list with frame struct. |
| 272 | new_thread = state.last_frame_id < 0 |
| 273 | try: |
| 274 | # We have a 'frame_id' group, so pull the ID and check if we need to |
| 275 | # start a new thread. Also update last_frame_id accordingly. |
| 276 | frame_id = int(match.group('frame_id').strip()) |
| 277 | if frame_id < state.last_frame_id: |
no test coverage detected