|
From: <sv...@va...> - 2005-11-08 00:45:55
|
Author: sewardj
Date: 2005-11-08 00:45:47 +0000 (Tue, 08 Nov 2005)
New Revision: 5033
Log:
Second try at getting rid of the is_self() hack used to decide when to
load debug info from the V executable.
Modified:
trunk/coregrind/m_debuginfo/symtab.c
trunk/coregrind/m_main.c
trunk/coregrind/m_syswrap/syswrap-generic.c
trunk/coregrind/pub_core_debuginfo.h
Modified: trunk/coregrind/m_debuginfo/symtab.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_debuginfo/symtab.c 2005-11-07 18:06:10 UTC (rev 503=
2)
+++ trunk/coregrind/m_debuginfo/symtab.c 2005-11-08 00:45:47 UTC (rev 503=
3)
@@ -130,14 +130,6 @@
that third segment, which is wrong and causes crashes.
*/
=20
-/* 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 )
-{=20
- return VG_(strstr)( filename, "/lib/valgrind/" ) !=3D NULL
- || VG_(strstr)( filename, ".in_place/" ) !=3D NULL;
-}
-
static void nuke_syms_in_range ( Addr start, SizeT length )
{
/* Repeatedly scan the segInfo list, looking for segInfos in this
@@ -168,7 +160,14 @@
}
}
=20
-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;
@@ -183,13 +182,13 @@
=20
filename =3D VG_(arena_strdup)( VG_AR_SYMTAB, filename );
=20
- ok =3D (seg->kind =3D=3D SkFileC || (seg->kind =3D=3D SkFileV && is_s=
elf(filename)))
- && seg->offset =3D=3D 0
- && seg->fnIdx !=3D -1
- && seg->hasR
- && seg->hasX
- && !seg->hasW
- && is_elf_object_file( (const void*)seg->start );
+ ok =3D (seg->kind =3D=3D SkFileC || (seg->kind =3D=3D SkFileV && allo=
w_SkFileV))
+ && seg->offset =3D=3D 0
+ && seg->fnIdx !=3D -1
+ && seg->hasR
+ && seg->hasX
+ && !seg->hasW
+ && is_elf_object_file( (const void*)seg->start );
=20
if (!ok) {
VG_(arena_free)(VG_AR_SYMTAB, filename);
Modified: trunk/coregrind/m_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_main.c 2005-11-07 18:06:10 UTC (rev 5032)
+++ trunk/coregrind/m_main.c 2005-11-08 00:45:47 UTC (rev 5033)
@@ -2321,9 +2321,11 @@
seg_starts =3D get_seg_starts( &n_seg_starts );
vg_assert(seg_starts && n_seg_starts > 0);
=20
- /* 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 =3D 0; i < n_seg_starts; i++)
- VG_(di_notify_mmap)( seg_starts[i] );
+ VG_(di_notify_mmap)( seg_starts[i], True/*allow_SkFileV*/ );
=20
VG_(free)( seg_starts );
}
Modified: trunk/coregrind/m_syswrap/syswrap-generic.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syswrap/syswrap-generic.c 2005-11-07 18:06:10 UTC (=
rev 5032)
+++ trunk/coregrind/m_syswrap/syswrap-generic.c 2005-11-08 00:45:47 UTC (=
rev 5033)
@@ -1854,7 +1854,7 @@
arg5, arg6=20
);
/* Load symbols? */
- VG_(di_notify_mmap)( (Addr)sres.val );
+ VG_(di_notify_mmap)( (Addr)sres.val, False/*allow_SkFileV*/ );
}
=20
/* Stay sane */
Modified: trunk/coregrind/pub_core_debuginfo.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/pub_core_debuginfo.h 2005-11-07 18:06:10 UTC (rev 503=
2)
+++ trunk/coregrind/pub_core_debuginfo.h 2005-11-08 00:45:47 UTC (rev 503=
3)
@@ -41,8 +41,16 @@
=20
#include "pub_tool_debuginfo.h"
=20
-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 );
=20
extern SegInfo *VG_(read_seg_symbols) ( Addr addr, SizeT len,
|