import sys

path = sys.argv[1]
lines = open(path, encoding="utf-8", errors="ignore").read().splitlines()
keys = (
    "Runtime aborting", "Aborting", "stack corruption", "blocked __stack",
    "vhvlnqgy.u", "UserRegistration", "F libc", "has died",
)
for i, line in enumerate(lines):
    if any(k in line for k in keys):
        start = max(0, i - 2)
        end = min(len(lines), i + 6)
        print("---")
        print("\n".join(lines[start:end]))
