Further to the other thread on valgrind-dev I've got a couple of small
problems with stack handling on valgrind. With medium sized stacks
(10Mb) it's reporting false positives and incorrect line numbers.
The code I'm using is
### Cut here
#include <sys/types.h>
#include <stdint.h>
int function(uint64_t arg)
{
static uint64_t store;
store = arg; /* Line 8 */
if ( 0 )
;
} /* Line 12 */
int main () {
unsigned long eqs[1309732];
function(0); /* line 16 */
return 0;
}
### Cut here.
When I run this on i686 I get a stack warning and two errors, one from
line 16 and one from line 8.
==8093== Warning: client switching stacks? SP change: 0xBEE58928 -->
0xBE95987C
==8093== to suppress, use: --max-stackframe=5238956 or greater
==8093== Invalid write of size 4
==8093== at 0x8048369: main (big.c:16)
==8093== Address 0xBE95987C is on thread 1's stack
==8093==
==8093== Invalid read of size 4
==8093== at 0x804833A: function (big.c:8)
==8093== Address 0xBE95987C is on thread 1's stack
==8093== Warning: client switching stacks? SP change: 0xBE959878 -->
0xBEE58928
==8093== to suppress, use: --max-stackframe=5238960 or greater
When I run it on x86_64 I also get a stack warning and two errors, one
from line 16 and one from line 12. The problem here (aside from the
false positive) is the line number is wrong.
==23653== Warning: client switching stacks? SP change: 0x7FF0007F0 -->
0x7FE6026C8
==23653== to suppress, use: --max-stackframe=10477864 or
greater
==23653== Invalid write of size 8
==23653== at 0x40048D: main (big.c:16)
==23653== Address 0x7FE6026C8 is on thread 1's stack
==23653==
==23653== Invalid read of size 8
==23653== at 0x40047C: function (big.c:12)
==23653== Address 0x7FE6026C8 is on thread 1's stack
==23653== Warning: client switching stacks? SP change: 0x7FE6026D0 -->
0x7FF0007F0
==23653== to suppress, use: --max-stackframe=10477856 or
greater
I have to use the larger of the two --max-stackframe= parameters to
avoid the warnings, in this case the code runs cleanly.
The code is compiled with "gcc -g big.c" and the gcc version is "gcc
version 3.4.6 20060404 (Red Hat 3.4.6-3)" in both cases.
The valgrind version is reported as valgrind-3.3.0.SVN, I'm not sure of
the exact revision number as svnversion is timing out on me :(
Ashley,
|