1 /* This exercises the code that was causing this bug: 2 3 valgrind: vg_cachesim.c:389 (get_BBCC): Assertion `((Bool)0) == remove' 4 failed. 5 6 in Cachegrind 1.0.0 and 1.0.1, that was caused by unloading symbols before 7 invalidating translations. 8 */ 9 10 #include <stdio.h> 11 #include <stdlib.h> 12 #include <dlfcn.h> 13 main(int argc,char ** argv)14int main(int argc, char **argv) { 15 void *handle; 16 void (*myprint)(void); 17 char *error; 18 19 handle = dlopen ("./myprint.so", RTLD_LAZY); 20 if (!handle) { 21 fputs (dlerror(), stderr); 22 exit(1); 23 } 24 25 myprint = dlsym(handle, "myprint"); 26 if ((error = dlerror()) != NULL) { 27 fprintf (stderr, "%s\n", error); 28 exit(1); 29 } 30 31 (*myprint)(); 32 33 /* Assertion failure was happening here */ 34 dlclose(handle); 35 36 return 0; 37 } 38 39