mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-14 06:48:06 +00:00
Memcheck, replacing the 9-bits-per-byte shadow memory representation to a 2-bits-per-byte representation (with possibly a little more on the side) by taking advantage of the fact that extremely few memory bytes are partially defined. For the SPEC2k benchmarks with "test" inputs, this speeds up Memcheck by a (geometric mean) factor of 1.20, and reduces the size of shadow memory by a (geometric mean) factor of 4.26. At the same time, Addrcheck is removed. It hadn't worked for quite some time, and with these improvements in Memcheck its raisons-d'etre have shrivelled so much that it's not worth the effort to keep around. Hooray! Nb: this code hasn't been tested on PPC. If things go wrong, look first in the fast stack-handling functions (eg. mc_new_mem_stack_160, MC_(helperc_MAKE_STACK_UNINIT)). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5791
32 lines
918 B
C
Executable File
32 lines
918 B
C
Executable File
// This test-case exposes a bug that was present in the compressed V bit
|
|
// handling for a while. The problem was that when
|
|
// copy_address_range_state() copied a VA_BITS2_OTHER value, it failed to
|
|
// also copy the corresponding entry in the sec-V-bits table. Then later on
|
|
// when we searched for the sec-V-bits entry for the copied-to location, it
|
|
// failed to find it:
|
|
//
|
|
// Memcheck: mc_main.c:766 (get_sec_vbits8): Assertion 'n' failed.
|
|
// Memcheck: get_sec_vbits8: no node for address 0x4017440 (0x4017441)
|
|
|
|
#include <stdlib.h>
|
|
|
|
int main(void)
|
|
{
|
|
int i, t;
|
|
char* x = malloc(1000);
|
|
|
|
// Write some PDBs (partially defined bytes)
|
|
for (i = 0; i < 1000; i++)
|
|
x[i] &= (i & 0xff);
|
|
|
|
// realloc them, invoking copy_address_range_state()
|
|
x = realloc(x, 10000);
|
|
|
|
// Read the PDBs -- this caused a sec-V-bits lookup failure.
|
|
for (i = 0; i < 1000; i++)
|
|
t += x[i];
|
|
|
|
return 0;
|
|
}
|
|
|