Parse a stacktrace.
(self, stacktrace: str)
| 421 | return stacktrace.splitlines() |
| 422 | |
| 423 | def parse(self, stacktrace: str) -> CrashInfo: |
| 424 | """Parse a stacktrace.""" |
| 425 | state = CrashInfo() |
| 426 | state.crash_stacktrace = stacktrace |
| 427 | state.is_kasan = 'KASAN' in stacktrace |
| 428 | state.is_lkl = lkl_constants.LINUX_KERNEL_MODULE_STACK_TRACE in stacktrace |
| 429 | state.is_golang = '.go:' in stacktrace |
| 430 | state.is_python = '.py", line' in stacktrace |
| 431 | state.is_js = 'Uncaught Exception: Jazzer.js' in stacktrace |
| 432 | state.is_trusty = 'Trusted App crash stacktrace' in stacktrace |
| 433 | |
| 434 | # For Android LKL (and potentially kernel output), the KASAN crash may start |
| 435 | # with the time since boot. We need to remove this so that our regexes |
| 436 | # match. |
| 437 | # We also want to set the kernel build id here since we are already walking |
| 438 | # line by line. |
| 439 | if state.is_lkl: |
| 440 | stacktrace = self.remove_lkl_kernel_times_and_set_params( |
| 441 | state, stacktrace) |
| 442 | |
| 443 | split_crash_stacktrace = StackParser.split_stacktrace(stacktrace) |
| 444 | |
| 445 | if state.is_python: |
| 446 | split_crash_stacktrace = reverse_python_stacktrace(split_crash_stacktrace) |
| 447 | |
| 448 | for line in split_crash_stacktrace: |
| 449 | if should_ignore_line_for_crash_processing(line, state): |
| 450 | continue |
| 451 | |
| 452 | # Bail out from crash paramater parsing if we detect this is a |
| 453 | # out-of-memory signature. |
| 454 | if not self.detect_ooms_and_hangs and OUT_OF_MEMORY_REGEX.match(line): |
| 455 | return CrashInfo() |
| 456 | |
| 457 | # Ignore aborts, breakpoints, ills and traps after certain crash types |
| 458 | # listed in IGNORE_CRASH_TYPES_FOR_ABRT_BREAKPOINT_AND_ILLS. The first |
| 459 | # crash type is more specific and should be kept. |
| 460 | if (SAN_ABRT_REGEX.match(line) or SAN_BREAKPOINT_REGEX.match(line) or |
| 461 | SAN_ILL_REGEX.match(line) or SAN_TRAP_REGEX.match(line)): |
| 462 | if state.crash_type in IGNORE_CRASH_TYPES_FOR_ABRT_BREAKPOINT_AND_ILLS: |
| 463 | continue |
| 464 | |
| 465 | # Assertions always come first, before the actual crash stacktrace. |
| 466 | # However if we already have a kernel crash, we don't want to |
| 467 | # replace it with the ASSERT. |
| 468 | if not state.crash_type.startswith('Kernel failure'): |
| 469 | self.match_assert(line, state, ASSERT_REGEX) |
| 470 | self.match_assert(line, state, ASSERT_REGEX_GOOGLE, group=2) |
| 471 | self.match_assert(line, state, ASSERT_REGEX_GLIBC) |
| 472 | self.match_assert(line, state, ASSERT_REGEX_GLIBC_SUFFIXED) |
| 473 | self.match_assert(line, state, RUST_ASSERT_REGEX) |
| 474 | |
| 475 | # ASSERT_NOT_REACHED prints a single line error then triggers a crash. We |
| 476 | # set the crash state here, but look for the stack after a crash on an |
| 477 | # unknown address. |
| 478 | self.update_state_on_match( |
| 479 | ASSERT_NOT_REACHED_REGEX, |
| 480 | line, |