blob: 022daccf72cda2958e5f7a4af7b822ccce9d6819 [file] [log] [blame]
#!/bin/sh
# Check -i option.
. "${srcdir=.}/init.sh"
check_prog sed
run_prog > /dev/null
args="-if $args"
$STRACE $args 2> "$LOG" ||
dump_log_and_fail_with "$STRACE $args failed"
len="$(sed -n 's/^\[[[:xdigit:]]\+\] write(-1, NULL, \([[:digit:]]\{1,2\}\))[[:space:]]\+= -1 .*/\1/p' "$LOG")" &&
[ -n "$len" ] &&
pid="$(sed -n 's/^\[[[:xdigit:]]\{'"$len"'\}\] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_\(KILLED\|DUMPED\), si_pid=\([[:digit:]]\+\), .*/\2/p' "$LOG")" &&
[ -n "$pid" ] &&
ip="$(sed -n 's/^\[pid \+'"$pid"'\] \[\([[:xdigit:]]\{'"$len"'\}\)] --- SIGSEGV {.*} ---$/\1/p' "$LOG")" &&
[ -n "$ip" ] &&
addr="$(echo "$ip" |sed 's/^0\+//')" &&
[ -n "$addr" ] ||
dump_log_and_fail_with
EXPECTED="$LOG.expected"
cat > "$EXPECTED" << __EOF__
\\[[[:xdigit:]]{$len}\\] munmap\\(0x[[:xdigit:]]+, 0\\) += -1 .*
\\[pid +$pid\\] \\[$ip\\] --- SIGSEGV \\{si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x$addr\\} ---
\\[pid +$pid\\] \\[\\?{$len}\\] \\+\\+\\+ killed by SIGSEGV( \\(core dumped\\))? \\+\\+\\+
\\[\\?{$len}\\] \\+\\+\\+ exited with 0 \\+\\+\\+
__EOF__
match_grep "$LOG" "$EXPECTED"
rm -f "$EXPECTED"
exit 0