mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-11-21 23:27:39 +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
|
||||
|
||||
TESTDIR=`pwd`
|
||||
TEMPDIR=`mktemp -d`
|
||||
TEMPDIR=`mktemp --tmpdir -d libunwind-test-XXXXXXXXXX`
|
||||
trap "rm -r -- $TEMPDIR" EXIT
|
||||
|
||||
# create core dump
|
||||
(
|
||||
|
@ -11,10 +12,5 @@ TEMPDIR=`mktemp -d`
|
|||
) 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
|
||||
|
|
|
@ -269,9 +269,11 @@ main(int argc, char **argv)
|
|||
int ret;
|
||||
|
||||
#define TEST_FRAMES 4
|
||||
#define TEST_NAME_LEN 16
|
||||
int testcase = 0;
|
||||
int test_cur = 0;
|
||||
long test_start_ips[TEST_FRAMES];
|
||||
char test_names[TEST_FRAMES][TEST_NAME_LEN];
|
||||
|
||||
install_sigsegv_handler();
|
||||
|
||||
|
@ -338,7 +340,13 @@ main(int argc, char **argv)
|
|||
|
||||
if (testcase && test_cur < TEST_FRAMES)
|
||||
{
|
||||
unw_word_t off;
|
||||
|
||||
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++;
|
||||
}
|
||||
|
||||
|
@ -366,6 +374,18 @@ main(int argc, char **argv)
|
|||
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);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue