Thu, 04 Jul 2013 21:10:17 -0700
8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
Summary: Dl_info struct should only be used if dladdr() has returned non-zero (no errors) and always check the dladdr() return value; Dl_info.dli_sname and Dl_info.dli_saddr fields should only be used if non-NULL; update/improve runtime/6888954/vmerrors.sh test
Reviewed-by: dsamersoff, zgu, hseigel, coleenp
1 # @test
2 # @bug 6888954
3 # @bug 8015884
4 # @summary exercise HotSpot error handling code
5 # @author John Coomes
6 # @run shell vmerrors.sh
8 # Repeatedly invoke java with a command-line option that causes HotSpot to
9 # produce an error report and terminate just after initialization. Each
10 # invocation is identified by a small integer, <n>, which provokes a different
11 # error (assertion failure, guarantee failure, fatal error, etc.). The output
12 # from stdout/stderr is written to <n>.out and the hs_err_pidXXX.log file is
13 # renamed to <n>.log.
14 #
15 # The automated checking done by this script is minimal. When updating the
16 # fatal error handler it is more useful to run it manually or to use the -retain
17 # option with the jtreg so that test directories are not removed automatically.
18 # To run stand-alone:
19 #
20 # TESTJAVA=/java/home/dir
21 # TESTVMOPTS=...
22 # export TESTJAVA TESTVMOPTS
23 # sh test/runtime/6888954/vmerrors.sh
25 ulimit -c 0 # no core files
27 i=1
28 rc=0
30 assert_re='(assert|guarantee)[(](str|num).*failed: *'
31 # for bad_data_ptr_re:
32 # EXCEPTION_ACCESS_VIOLATION - Win-*
33 # SIGILL - MacOS X
34 # SIGSEGV - Linux-*, Solaris SPARC-*, Solaris X86-*
35 #
36 bad_data_ptr_re='(SIGILL|SIGSEGV|EXCEPTION_ACCESS_VIOLATION).* at pc='
37 #
38 # for bad_func_ptr_re:
39 # EXCEPTION_ACCESS_VIOLATION - Win-*
40 # SIGBUS - Solaris SPARC-64
41 # SIGSEGV - Linux-*, Solaris SPARC-32, Solaris X86-*
42 #
43 # Note: would like to use "pc=0x00*0f," in the pattern, but Solaris SPARC-*
44 # gets its signal at a PC in test_error_handler().
45 #
46 bad_func_ptr_re='(SIGBUS|SIGSEGV|EXCEPTION_ACCESS_VIOLATION).* at pc='
47 guarantee_re='guarantee[(](str|num).*failed: *'
48 fatal_re='fatal error: *'
49 tail_1='.*expected null'
50 tail_2='.*num='
52 for re in \
53 "${assert_re}${tail_1}" "${assert_re}${tail_2}" \
54 "${guarantee_re}${tail_1}" "${guarantee_re}${tail_2}" \
55 "${fatal_re}${tail_1}" "${fatal_re}${tail_2}" \
56 "${fatal_re}.*truncated" "ChunkPool::allocate" \
57 "ShouldNotCall" "ShouldNotReachHere" \
58 "Unimplemented" "$bad_data_ptr_re" \
59 "$bad_func_ptr_re"
61 do
62 i2=$i
63 [ $i -lt 10 ] && i2=0$i
65 "$TESTJAVA/bin/java" $TESTVMOPTS -XX:+IgnoreUnrecognizedVMOptions \
66 -XX:ErrorHandlerTest=${i} -version > ${i2}.out 2>&1
68 # If ErrorHandlerTest is ignored (product build), stop.
69 #
70 # Using the built-in variable $! to get the pid does not work reliably on
71 # windows; use a wildcard instead.
72 mv hs_err_pid*.log ${i2}.log || exit $rc
74 for f in ${i2}.log ${i2}.out
75 do
76 egrep -- "$re" $f > $$
77 if [ $? -ne 0 ]
78 then
79 echo "ErrorHandlerTest=$i failed ($f)"
80 rc=1
81 fi
82 done
83 rm -f $$
85 i=`expr $i + 1`
86 done
88 exit $rc