|
From: <sv...@va...> - 2005-06-28 22:14:56
|
Author: njn
Date: 2005-06-28 23:14:53 +0100 (Tue, 28 Jun 2005)
New Revision: 4045
Log:
Remove all the completely unused SF_* flags. I suspect some of the
remaining ones have no interesting effect, but I left them in.
Also simplify the signature for VG_(get_memory_from_mmap_for_client)().
Modified:
trunk/coregrind/m_aspacemgr/aspacemgr.c
trunk/coregrind/m_libcmman.c
trunk/coregrind/m_main.c
trunk/coregrind/m_mallocfree.c
trunk/coregrind/m_signals.c
trunk/coregrind/m_syswrap/syswrap-generic.c
trunk/coregrind/m_syswrap/syswrap-linux.c
trunk/coregrind/pub_core_aspacemgr.h
trunk/coregrind/pub_core_libcmman.h
Modified: trunk/coregrind/m_aspacemgr/aspacemgr.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_aspacemgr/aspacemgr.c 2005-06-28 19:44:10 UTC (rev =
4044)
+++ trunk/coregrind/m_aspacemgr/aspacemgr.c 2005-06-28 22:14:53 UTC (rev =
4045)
@@ -802,9 +802,6 @@
) {
s->seginfo =3D VG_(read_seg_symbols)(s->addr, s->len, s->offset=
,
s->filename);
- if (s->seginfo !=3D NULL) {
- s->flags |=3D SF_DYNLIB;
- }
} else if (flags & SF_MMAP) {
#if 0
const SegInfo *info;
@@ -1167,7 +1164,7 @@
for (i =3D 0; i < segments_used; i++) {
s =3D &segments[i];
flags =3D s->flags & (SF_SHARED|SF_MMAP|SF_VALGRIND
- |SF_CORE|SF_STACK|SF_DEVICE);
+ |SF_CORE|SF_STACK);
if (flags !=3D SF_MMAP && flags !=3D SF_STACK)
continue;
if ((s->prot & (VKI_PROT_READ|VKI_PROT_WRITE))=20
Modified: trunk/coregrind/m_libcmman.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_libcmman.c 2005-06-28 19:44:10 UTC (rev 4044)
+++ trunk/coregrind/m_libcmman.c 2005-06-28 22:14:53 UTC (rev 4045)
@@ -65,7 +65,6 @@
}
=20
sf_flags |=3D SF_MMAP;
- if ( flags & VKI_MAP_FIXED) sf_flags |=3D SF_FIXED;
if ( flags & VKI_MAP_SHARED) sf_flags |=3D SF_SHARED;
if (!(flags & VKI_MAP_ANONYMOUS)) sf_flags |=3D SF_FILE;
if (!(flags & VKI_MAP_CLIENT)) sf_flags |=3D SF_VALGRIND;
@@ -106,7 +105,7 @@
void* p;
p =3D VG_(mmap)(0, nBytes,
VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC,
- VKI_MAP_PRIVATE|VKI_MAP_ANONYMOUS, 0, -1, 0);
+ VKI_MAP_PRIVATE|VKI_MAP_ANONYMOUS, SF_VALGRIND, -1, 0);
=20
if (p !=3D ((void*)(-1))) {
vg_assert((void*)VG_(valgrind_base) <=3D p && p <=3D (void*)VG_(va=
lgrind_last));
@@ -131,17 +130,16 @@
}
=20
// Returns 0 on failure.
-Addr VG_(get_memory_from_mmap_for_client)
- (Addr addr, SizeT len, UInt prot, UInt sf_flags)
+Addr VG_(get_memory_from_mmap_for_client) (SizeT len)
{
+ Addr addr;
+
len =3D VG_PGROUNDUP(len);
=20
- tl_assert(!(sf_flags & SF_FIXED));
- tl_assert(0 =3D=3D addr);
-
- addr =3D (Addr)VG_(mmap)((void *)addr, len, prot,=20
- VKI_MAP_PRIVATE | VKI_MAP_ANONYMOUS | VKI_MAP_=
CLIENT,
- sf_flags | SF_CORE, -1, 0);
+ addr =3D (Addr)VG_(mmap)(NULL, len,=20
+ VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC,
+ VKI_MAP_PRIVATE|VKI_MAP_ANONYMOUS|VKI_MAP_CLIE=
NT,
+ SF_CORE, -1, 0);
if ((Addr)-1 !=3D addr)
return addr;
else
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-06-28 19:44:10 UTC (rev 4044)
+++ trunk/coregrind/m_main.c 2005-06-28 22:14:53 UTC (rev 4045)
@@ -2138,7 +2138,7 @@
if (is_stack_segment)
flags =3D SF_STACK | SF_GROWDOWN;
else
- flags =3D SF_EXEC|SF_MMAP;
+ flags =3D SF_MMAP;
=20
if (filename !=3D NULL)
flags |=3D SF_FILE;
Modified: trunk/coregrind/m_mallocfree.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_mallocfree.c 2005-06-28 19:44:10 UTC (rev 4044)
+++ trunk/coregrind/m_mallocfree.c 2005-06-28 22:14:53 UTC (rev 4045)
@@ -484,9 +484,7 @@
VG_MIN_MALLOC_SZB );
} else if (a->clientmem) {
// client allocation -- return 0 to client if it fails
- sb =3D (Superblock *)
- VG_(get_memory_from_mmap_for_client)
- (0, cszB, VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC, 0);
+ sb =3D (Superblock*)VG_(get_memory_from_mmap_for_client)(cszB);
if (NULL =3D=3D sb)
return 0;
} else {
Modified: trunk/coregrind/m_signals.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_signals.c 2005-06-28 19:44:10 UTC (rev 4044)
+++ trunk/coregrind/m_signals.c 2005-06-28 22:14:53 UTC (rev 4045)
@@ -926,7 +926,7 @@
/* If true, then this Segment may be mentioned in the core */
static Bool may_dump(const Segment *seg)
{
- return (seg->flags & (SF_DEVICE|SF_VALGRIND)) =3D=3D 0 && VG_(is_clie=
nt_addr)(seg->addr);
+ return (seg->flags & SF_VALGRIND) =3D=3D 0 && VG_(is_client_addr)(seg=
->addr);
}
=20
/* If true, then this Segment's contents will be in the core */
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-06-28 19:44:10 UTC (=
rev 4044)
+++ trunk/coregrind/m_syswrap/syswrap-generic.c 2005-06-28 22:14:53 UTC (=
rev 4045)
@@ -138,8 +138,6 @@
=20
flags =3D SF_MMAP;
=20
- if (mm_flags & VKI_MAP_FIXED)
- flags |=3D SF_FIXED;
if (!(mm_flags & VKI_MAP_PRIVATE))
flags |=3D SF_SHARED;
=20
@@ -826,7 +824,7 @@
} else if ((void*)-1 !=3D VG_(mmap)((void*)current, newaddr-cur=
rent,
VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC,
VKI_MAP_PRIVATE|VKI_MAP_ANONYMOUS|VKI_MAP_FIXED|VKI_MAP_C=
LIENT,
- SF_FIXED|SF_BRK, -1, 0))=20
+ 0, -1, 0))=20
{
ret =3D newbrk;
}
Modified: trunk/coregrind/m_syswrap/syswrap-linux.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-linux.c 2005-06-28 19:44:10 UTC (re=
v 4044)
+++ trunk/coregrind/m_syswrap/syswrap-linux.c 2005-06-28 22:14:53 UTC (re=
v 4045)
@@ -685,7 +685,7 @@
return;
}
=20
- VG_(map_segment)(addr, size, VKI_PROT_READ|VKI_PROT_WRITE, SF_FIXED);
+ VG_(map_segment)(addr, size, VKI_PROT_READ|VKI_PROT_WRITE, 0);
=20
VG_(pad_address_space)(0);
SET_STATUS_from_SysRes( VG_(do_syscall2)(SYSNO, ARG1, ARG2) );
Modified: trunk/coregrind/pub_core_aspacemgr.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_aspacemgr.h 2005-06-28 19:44:10 UTC (rev 404=
4)
+++ trunk/coregrind/pub_core_aspacemgr.h 2005-06-28 22:14:53 UTC (rev 404=
5)
@@ -68,24 +68,18 @@
/* A Segment is mapped piece of client memory. This covers all kinds
of mapped memory (exe, brk, mmap, .so, shm, stack, etc)
=20
- We try to encode everything we know about a particular segment here.
+ We encode relevant info about each segment with these constants.
*/
-#define SF_FIXED (1 << 0) // client asked for MAP_FIXED
-#define SF_SHARED (1 << 1) // shared
-#define SF_SHM (1 << 2) // SYSV SHM (also SF_SHARED)
-#define SF_MMAP (1 << 3) // mmap memory
-#define SF_FILE (1 << 4) // mapping is backed by a file
-#define SF_STACK (1 << 5) // is a stack
-#define SF_GROWDOWN (1 << 6) // segment grows down
-#define SF_GROWUP (1 << 7) // segment grows up
-#define SF_EXEC (1 << 8) // segment created by exec
-#define SF_DYNLIB (1 << 9) // mapped from dynamic library
-#define SF_NOSYMS (1 << 10) // don't load syms, even if present
-#define SF_BRK (1 << 11) // brk segment
-#define SF_CORE (1 << 12) // allocated by core on behalf of the clie=
nt
-#define SF_VALGRIND (1 << 13) // a valgrind-internal mapping - not in cl=
ient
-#define SF_CODE (1 << 14) // segment contains cached code
-#define SF_DEVICE (1 << 15) // device mapping; avoid careless touching
+#define SF_SHARED (1 << 0) // shared
+#define SF_SHM (1 << 1) // SYSV SHM (also SF_SHARED)
+#define SF_MMAP (1 << 2) // mmap memory
+#define SF_FILE (1 << 3) // mapping is backed by a file
+#define SF_STACK (1 << 4) // is a stack
+#define SF_GROWDOWN (1 << 5) // segment grows down
+#define SF_NOSYMS (1 << 6) // don't load syms, even if present
+#define SF_CORE (1 << 7) // allocated by core on behalf of the clie=
nt
+#define SF_VALGRIND (1 << 8) // a valgrind-internal mapping - not in cl=
ient
+#define SF_CODE (1 << 9) // segment contains cached code
=20
typedef struct _Segment Segment;
=20
Modified: trunk/coregrind/pub_core_libcmman.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_libcmman.h 2005-06-28 19:44:10 UTC (rev 4044=
)
+++ trunk/coregrind/pub_core_libcmman.h 2005-06-28 22:14:53 UTC (rev 4045=
)
@@ -43,8 +43,7 @@
extern Int VG_(munmap) ( void* start, SizeT length );
extern Int VG_(mprotect) ( void *start, SizeT length, UInt prot );
=20
-extern Addr VG_(get_memory_from_mmap_for_client)
- (Addr base, SizeT len, UInt prot, UInt flags);
+extern Addr VG_(get_memory_from_mmap_for_client)(SizeT len);
=20
#endif // __PUB_CORE_LIBCMMAN_H
=20
|