5 . "${srcdir=.}/init.sh"
12 $STRACE $args 2> "$LOG" ||
13 dump_log_and_fail_with "$STRACE $args failed"
15 len="$(sed -n 's/^\[[[:xdigit:]]\+\] write(-1, NULL, \([[:digit:]]\{1,2\}\))[[:space:]]\+= -1 .*/\1/p' "$LOG")" &&
17 pid="$(sed -n 's/^\[[[:xdigit:]]\{'"$len"'\}\] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_\(KILLED\|DUMPED\), si_pid=\([[:digit:]]\+\), .*/\2/p' "$LOG")" &&
19 ip="$(sed -n 's/^\[pid \+'"$pid"'\] \[\([[:xdigit:]]\{'"$len"'\}\)] --- SIGSEGV {.*} ---$/\1/p' "$LOG")" &&
21 addr="$(echo "$ip" |sed 's/^0\+//')" &&
23 dump_log_and_fail_with
25 EXPECTED="$LOG.expected"
26 cat > "$EXPECTED" << __EOF__
27 \\[[[:xdigit:]]{$len}\\] munmap\\(0x[[:xdigit:]]+, 0\\) += -1 .*
28 \\[pid +$pid\\] \\[$ip\\] --- SIGSEGV \\{si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x$addr\\} ---
29 \\[pid +$pid\\] \\[\\?{$len}\\] \\+\\+\\+ killed by SIGSEGV( \\(core dumped\\))? \\+\\+\\+
30 \\[\\?{$len}\\] \\+\\+\\+ exited with 0 \\+\\+\\+
33 match_grep "$LOG" "$EXPECTED"