mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2025-02-16 18:21:41 +01:00
Make coredump test also test unw_get_proc_name
Signed-off-by: Martin Milata <mmilata@redhat.com>
This commit is contained in:
parent
e11a6a4fdf
commit
2dbc26dde8
2 changed files with 22 additions and 6 deletions
|
@ -1,7 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
TESTDIR=`pwd`
|
TESTDIR=`pwd`
|
||||||
TEMPDIR=`mktemp -d`
|
TEMPDIR=`mktemp --tmpdir -d libunwind-test-XXXXXXXXXX`
|
||||||
|
trap "rm -r -- $TEMPDIR" EXIT
|
||||||
|
|
||||||
# create core dump
|
# create core dump
|
||||||
(
|
(
|
||||||
|
@ -11,10 +12,5 @@ TEMPDIR=`mktemp -d`
|
||||||
) 2>/dev/null
|
) 2>/dev/null
|
||||||
COREFILE=$TEMPDIR/core*
|
COREFILE=$TEMPDIR/core*
|
||||||
|
|
||||||
# fail if any command fails
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# magic option -testcase enables checking for the specific contents of the stack
|
# magic option -testcase enables checking for the specific contents of the stack
|
||||||
./test-coredump-unwind $COREFILE -testcase `cat $TEMPDIR/backing_files`
|
./test-coredump-unwind $COREFILE -testcase `cat $TEMPDIR/backing_files`
|
||||||
|
|
||||||
rm -r -- $TEMPDIR
|
|
||||||
|
|
|
@ -269,9 +269,11 @@ main(int argc, char **argv)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
#define TEST_FRAMES 4
|
#define TEST_FRAMES 4
|
||||||
|
#define TEST_NAME_LEN 16
|
||||||
int testcase = 0;
|
int testcase = 0;
|
||||||
int test_cur = 0;
|
int test_cur = 0;
|
||||||
long test_start_ips[TEST_FRAMES];
|
long test_start_ips[TEST_FRAMES];
|
||||||
|
char test_names[TEST_FRAMES][TEST_NAME_LEN];
|
||||||
|
|
||||||
install_sigsegv_handler();
|
install_sigsegv_handler();
|
||||||
|
|
||||||
|
@ -338,7 +340,13 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
if (testcase && test_cur < TEST_FRAMES)
|
if (testcase && test_cur < TEST_FRAMES)
|
||||||
{
|
{
|
||||||
|
unw_word_t off;
|
||||||
|
|
||||||
test_start_ips[test_cur] = (long) pi.start_ip;
|
test_start_ips[test_cur] = (long) pi.start_ip;
|
||||||
|
if (unw_get_proc_name(&c, test_names[test_cur], sizeof(test_names[0]), &off) != 0)
|
||||||
|
{
|
||||||
|
test_names[test_cur][0] = '\0';
|
||||||
|
}
|
||||||
test_cur++;
|
test_cur++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,6 +374,18 @@ main(int argc, char **argv)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (testcase &&
|
||||||
|
( strcmp(test_names[0], "a")
|
||||||
|
|| strcmp(test_names[1], "b")
|
||||||
|
|| strcmp(test_names[2], "b")
|
||||||
|
|| strcmp(test_names[3], "main")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "FAILURE: procedure names are missing/incorrect\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
_UCD_destroy(ui);
|
_UCD_destroy(ui);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue