mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-11-22 15:47:37 +01:00
0f9a540c8c
Program test-coredump-unwind was modified to map backing files based on virtual addresses instead of segment numbers. The crasher.c is a program that essentially calls some functions and then writes to invalid address causing a crash. Before that, it detects which executables are mapped to which virtual addresses and writes this information to a file suitable for consumption by test-coredump-unwind. The mapping information is obtained form /proc/self/maps, so currently it only works on linux. The test itself is a shell script, which first runs the program and then runs test-coredump-unwind on the resulting core and address space map file to check whether the stack trace obtained from the dump roughly corresponds to what it should look like. Signed-off-by: Martin Milata <mmilata@redhat.com>
20 lines
394 B
Bash
Executable file
20 lines
394 B
Bash
Executable file
#!/bin/sh
|
|
|
|
TESTDIR=`pwd`
|
|
TEMPDIR=`mktemp -d`
|
|
|
|
# create core dump
|
|
(
|
|
cd $TEMPDIR
|
|
ulimit -c 10000
|
|
$TESTDIR/crasher $TEMPDIR/backing_files
|
|
) 2>/dev/null
|
|
COREFILE=$TEMPDIR/core*
|
|
|
|
# fail if any command fails
|
|
set -e
|
|
|
|
# magic option -testcase enables checking for the specific contents of the stack
|
|
./test-coredump-unwind $COREFILE -testcase `cat $TEMPDIR/backing_files`
|
|
|
|
rm -r -- $TEMPDIR
|