|
From: Emre C. S. <ec...@nc...> - 2006-05-25 18:53:29
|
Hi, I've been writing a tool for Valgrind that instruments code to track and analyze memory writes. I'm using Valgrind 2.4.0. During tool initialization my tool reads an input file and allocates memory for internal data structures. If I provide VG_(read) with a large number (1 MB) for the max characters to read, I get the following error: valgrind: vg_main.c:2162 (build_segment_map_callback): Assertion `vgPlain_is_addressable(start, size, 0x0)' failed. ==15613== at 0xB002E18C: vgPlain_skin_assert_fail (vg_mylibc.c:1170) sched status: running_tid=0 The problem goes away at 1K and is intermittent at 5K. The problem does not occur if I exit right after initialization is complete. I've also googled the error and couldn't find any relavent hits. The release notes of v3.0 mentioned some fixes to memory management problems so I tried porting my tool to v3.1.1, but I haven't been able to find documentation or example tools to do instrumentation with the new VEX libraries. I'd appreciate any pointers to how I may fix this problem. Thanks, --John |
|
From: Nicholas N. <nj...@cs...> - 2006-05-25 22:37:46
|
On Thu, 25 May 2006, Emre Can Sezer wrote: > I've been writing a tool for Valgrind that instruments code to track and > analyze memory writes. I'm using Valgrind 2.4.0. > > During tool initialization my tool reads an input file and allocates > memory for internal data structures. If I provide VG_(read) with a large > number (1 MB) for the max characters to read, I get the following error: > > valgrind: vg_main.c:2162 (build_segment_map_callback): Assertion > `vgPlain_is_addressable(start, size, 0x0)' failed. > ==15613== at 0xB002E18C: vgPlain_skin_assert_fail (vg_mylibc.c:1170) > > sched status: > running_tid=0 > > > The problem goes away at 1K and is intermittent at 5K. The problem does > not occur if I exit right after initialization is complete. > > I've also googled the error and couldn't find any relavent hits. The > release notes of v3.0 mentioned some fixes to memory management problems > so I tried porting my tool to v3.1.1, but I haven't been able to find > documentation or example tools to do instrumentation with the new VEX > libraries. The recent version are much more likely to avoid this problem. If you update to the current SVN code (or wait until 3.2.0 is released, which should be in the next couple of days) things might be easier. Look at the example tool Lackey (lackey/lk_main.c) which has examples of various kinds of Vex instrumentation. Also look at VEX/pub/libvex_ir.h which is the header that contains all the Vex IR types and stuff. If you port from 2.4.0 to 3.2.0, there will be various small changes necessary as well as the big changes to the instrumentation. I'd do the small changes, comment out your instrumentation code (just make instrument() return the BB unchanged), and try the large VG_(read) to make sure it works before porting instrument() to use Vex. Nick |