|
From: Emre C. S. <ec...@nc...> - 2006-07-21 20:36:56
|
I'm using valgrind v2.4.0 with a tool I'm developing that instruments the
code and also captures malloc family calls. The error I got is:
/*******************************************************/
==32244== malloc(364)
--32244-- si_code=1 Fault EIP: 0xB0029E17; Faulting address: 0x2A64BC46
--32244-- esp=0xB06F6E98
valgrind: the `impossible' happened:
Killed by fatal signal
Basic block ctr is approximately 81481
==32244== at 0xB0029E17: unlinkBlock (vg_malloc2.c:260)
==32244== by 0xB002A085: vgPlain_arena_malloc (vg_malloc2.c:1013)
==32244== by 0xB002AAC9: vgPlain_cli_malloc (vg_malloc2.c:1387)
==32244== by 0xB101A4E1: vgSkin_malloc (dl_main.c:332)
==32244== by 0xB005A3C2: vgSkinInternal_malloc (vg_toolint.c:519)
==32244== by 0xB0015F57: do_client_request (vg_scheduler.c:862)
==32244== by 0xB0015BF5: vgPlain_scheduler (vg_scheduler.c:746)
==32244== by 0xB006E8B1: vgArch_thread_wrapper (core_os.c:69)
sched status:
running_tid=1
Thread 1: status = VgTs_Runnable
==32244== at 0x3A9841F4: malloc (vg_replace_malloc.c:130)
==32244== by 0x3AA4AA32: __fopen_internal (in /lib/libc-2.3.2.so)
==32244== by 0x3AA4AAFD: fopen@@GLIBC_2.1 (in /lib/libc-2.3.2.so)
==32244== by 0x804F008: logaccess (server.c:495)
==32244== by 0x804ED42: dorequest (main.c:200)
==32244== by 0x8050E41: htloop (server.c:1556)
==32244== by 0x8051263: accept_loop (server.c:1698)
==32244== by 0x804EF95: main (main.c:263)
/*******************************************************/
The instruction that causes the crash is the fopen() call in the following
code:
void logaccess(int loglevel , char const *format , ...)
{
char file[200] ;
FILE *fp ;
char *mem_12 ;
mem_12 = config.server_etc_dir;
snprintf(file, sizeof(file) - 1U, "%s/access.log", mem_12);
fixslashes(file);
fp = fopen(file, "a");
...
}
I've defined the malloc in my tool as:
void* SK_(malloc)(SizeT n)
{
void * p;
p = (void *) VG_(cli_malloc)(VG_(clo_alignment), n);
return p;
}
Also this is not the first time this instruction is executed. Previous
calls to malloc successfully return. I'd welcome any help.
Thank you in advance,
John
PS. As for upgrading to a newer version, I have extended dullard to mainly
track memory operations. I do this by instrumenting the code via
SK_(instrument). Can this be accomplished in version 3 or higher? Either
by instrumenting code or by other hooks to the core?
|
|
From: Nicholas N. <nj...@cs...> - 2006-07-23 10:35:09
|
On Fri, 21 Jul 2006, Emre Can Sezer wrote: > PS. As for upgrading to a newer version, I have extended dullard to mainly > track memory operations. I do this by instrumenting the code via > SK_(instrument). Can this be accomplished in version 3 or higher? Either > by instrumenting code or by other hooks to the core? Yes, as of Valgrind 3.2.0, Dullard's functionality is now present in "Lackey", one of the tools that is in the distro. Look at the --trace-mem=yes option. Nick |