that third segment, which is wrong and causes crashes.
*/
-/* Make a guess (doesn't have to be 100% correct) as to whether a path
- is that of the valgrind exe we're using. */
-static Bool is_self ( HChar* filename )
-{
- return VG_(strstr)( filename, "/lib/valgrind/" ) != NULL
- || VG_(strstr)( filename, ".in_place/" ) != NULL;
-}
-
static void nuke_syms_in_range ( Addr start, SizeT length )
{
/* Repeatedly scan the segInfo list, looking for segInfos in this
}
}
-void VG_(di_notify_mmap)( Addr a )
+/* Notify the debuginfo system about a new mapping. This is the way
+ new debug information gets loaded. If allow_SkFileV is True, it
+ will try load debug info if the mapping at 'a' belongs to Valgrind;
+ whereas normally (False) it will not do that. This allows us to
+ carefully control when the thing will read symbols from the
+ Valgrind executable itself. */
+
+void VG_(di_notify_mmap)( Addr a, Bool allow_SkFileV )
{
NSegment* seg;
HChar* filename;
filename = VG_(arena_strdup)( VG_AR_SYMTAB, filename );
- ok = (seg->kind == SkFileC || (seg->kind == SkFileV && is_self(filename)))
- && seg->offset == 0
- && seg->fnIdx != -1
- && seg->hasR
- && seg->hasX
- && !seg->hasW
- && is_elf_object_file( (const void*)seg->start );
+ ok = (seg->kind == SkFileC || (seg->kind == SkFileV && allow_SkFileV))
+ && seg->offset == 0
+ && seg->fnIdx != -1
+ && seg->hasR
+ && seg->hasX
+ && !seg->hasW
+ && is_elf_object_file( (const void*)seg->start );
if (!ok) {
VG_(arena_free)(VG_AR_SYMTAB, filename);
seg_starts = get_seg_starts( &n_seg_starts );
vg_assert(seg_starts && n_seg_starts > 0);
- /* show them all to the debug info reader */
+ /* show them all to the debug info reader. allow_SkFileV has to
+ be True here so that we read info from the valgrind executable
+ itself. */
for (i = 0; i < n_seg_starts; i++)
- VG_(di_notify_mmap)( seg_starts[i] );
+ VG_(di_notify_mmap)( seg_starts[i], True/*allow_SkFileV*/ );
VG_(free)( seg_starts );
}
#include "pub_tool_debuginfo.h"
-extern void VG_(di_notify_mmap)( Addr a );
+/* Notify the debuginfo system about a new mapping. This is the way
+ new debug information gets loaded. If allow_SkFileV is True, it
+ will try load debug info if the mapping at 'a' belongs to Valgrind;
+ whereas normally (False) it will not do that. This allows us to
+ carefully control when the thing will read symbols from the
+ Valgrind executable itself. */
+extern void VG_(di_notify_mmap)( Addr a, Bool allow_SkFileV );
+
extern void VG_(di_notify_munmap)( Addr a, SizeT len );
+
extern void VG_(di_notify_mprotect)( Addr a, SizeT len, UInt prot );
extern SegInfo *VG_(read_seg_symbols) ( Addr addr, SizeT len,