From: Florian Krohm Date: Tue, 4 Oct 2011 20:14:59 +0000 (+0000) Subject: Rewrite badjump and badjump2 such that the error occurs now on the X-Git-Tag: svn/VALGRIND_3_7_0~140 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d6e98bdfd4eff56fb919a6f6ea6f0c57cecb5f3;p=thirdparty%2Fvalgrind.git Rewrite badjump and badjump2 such that the error occurs now on the same line for all architectures. Promote the s390x exp file to be the golden one because it has the correct result. Add exp-kfail files for those platforms where the testcases fail (x86). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12097 --- diff --git a/memcheck/tests/badjump.c b/memcheck/tests/badjump.c index b02c49397c..9cf52670c9 100644 --- a/memcheck/tests/badjump.c +++ b/memcheck/tests/badjump.c @@ -7,14 +7,13 @@ int main ( void ) descriptor, not to the function's entry point. Hence to get uniform behaviour on all supported targets - a jump to an unmapped page - the following is needed. */ - unsigned long long int fake_fndescr[3]; - fake_fndescr[0] = (unsigned long long int)get_unmapped_page(); - fake_fndescr[1] = 0; - fake_fndescr[2] = 0; - return ((int(*)(void)) fake_fndescr) (); + unsigned long long int p[3]; + p[0] = (unsigned long long int)get_unmapped_page(); + p[1] = 0; + p[2] = 0; #else char* p = get_unmapped_page(); - return ((int(*)(void)) p) (); #endif + return ((int(*)(void)) p) (); } diff --git a/memcheck/tests/badjump.stderr.exp b/memcheck/tests/badjump.stderr.exp index 1cecc0a9ca..e2659dee6e 100644 --- a/memcheck/tests/badjump.stderr.exp +++ b/memcheck/tests/badjump.stderr.exp @@ -1,12 +1,14 @@ Jump to the invalid address stated on the next line ... + by 0x........: main (badjump.c:17) Address 0x........ is not stack'd, malloc'd or (recently) free'd Process terminating with default action of signal 11 (SIGSEGV) Access not within mapped region at address 0x........ ... + by 0x........: main (badjump.c:17) If you believe this happened as a result of a stack overflow in your program's main thread (unlikely but possible), you can try to increase the size of the diff --git a/memcheck/tests/badjump.stderr.exp-s390x b/memcheck/tests/badjump.stderr.exp-kfail similarity index 91% rename from memcheck/tests/badjump.stderr.exp-s390x rename to memcheck/tests/badjump.stderr.exp-kfail index e2659dee6e..1cecc0a9ca 100644 --- a/memcheck/tests/badjump.stderr.exp-s390x +++ b/memcheck/tests/badjump.stderr.exp-kfail @@ -1,14 +1,12 @@ Jump to the invalid address stated on the next line ... - by 0x........: main (badjump.c:17) Address 0x........ is not stack'd, malloc'd or (recently) free'd Process terminating with default action of signal 11 (SIGSEGV) Access not within mapped region at address 0x........ ... - by 0x........: main (badjump.c:17) If you believe this happened as a result of a stack overflow in your program's main thread (unlikely but possible), you can try to increase the size of the diff --git a/memcheck/tests/badjump2.c b/memcheck/tests/badjump2.c index 648872492e..47a6829861 100644 --- a/memcheck/tests/badjump2.c +++ b/memcheck/tests/badjump2.c @@ -36,15 +36,14 @@ int main(void) if (__builtin_setjmp(myjmpbuf) == 0) { // Jump to zero; will cause seg fault #if defined(__powerpc64__) - unsigned long int fake_fndescr[3]; - fake_fndescr[0] = 0; - fake_fndescr[1] = 0; - fake_fndescr[2] = 0; - ((void(*)(void)) fake_fndescr) (); + unsigned long int fn[3]; + fn[0] = 0; + fn[1] = 0; + fn[2] = 0; #else void (*fn)(void) = 0; - fn(); #endif + ((void(*)(void)) fn) (); fprintf(stderr, "Got here??\n"); } else { fprintf(stderr, "Signal caught, as expected\n"); diff --git a/memcheck/tests/badjump2.stderr.exp b/memcheck/tests/badjump2.stderr.exp index 35ce6f0cc1..7033e69d7e 100644 --- a/memcheck/tests/badjump2.stderr.exp +++ b/memcheck/tests/badjump2.stderr.exp @@ -1,5 +1,6 @@ Jump to the invalid address stated on the next line ... + by 0x........: main (badjump2.c:46) Address 0x........ is not stack'd, malloc'd or (recently) free'd Signal caught, as expected diff --git a/memcheck/tests/badjump2.stderr.exp-s390x b/memcheck/tests/badjump2.stderr.exp-kfail similarity index 79% rename from memcheck/tests/badjump2.stderr.exp-s390x rename to memcheck/tests/badjump2.stderr.exp-kfail index 7033e69d7e..35ce6f0cc1 100644 --- a/memcheck/tests/badjump2.stderr.exp-s390x +++ b/memcheck/tests/badjump2.stderr.exp-kfail @@ -1,6 +1,5 @@ Jump to the invalid address stated on the next line ... - by 0x........: main (badjump2.c:46) Address 0x........ is not stack'd, malloc'd or (recently) free'd Signal caught, as expected