summaryrefslogtreecommitdiff
path: root/massif
diff options
context:
space:
mode:
authornjn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9>2009-05-28 01:53:07 +0000
committernjn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9>2009-05-28 01:53:07 +0000
commitf76d27a697a7b0bf3b84490baf60623fc96a23af (patch)
tree682ff0946c0b8b501714e055ff1269c6b0bf5d91 /massif
parentda8549df7939ee3024938cdd8a4cc64e6c2279b8 (diff)
Merge the DARWIN branch onto the trunk.
I tried using 'svn merge' to do the merge but it did a terrible job and there were bazillions of conflicts. So instead I just took the diff between the branch and trunk at r10155, applied the diff to the trunk, 'svn add'ed the added files (no files needed to be 'svn remove'd) and committed. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10156 a5019735-40e9-0310-863c-91ae7b9d1cf9
Diffstat (limited to 'massif')
-rw-r--r--massif/Makefile.am39
-rw-r--r--massif/ms_main.c16
-rw-r--r--massif/tests/malloc_usable.c2
3 files changed, 50 insertions, 7 deletions
diff --git a/massif/Makefile.am b/massif/Makefile.am
index 6ff1f51a..3033df1e 100644
--- a/massif/Makefile.am
+++ b/massif/Makefile.am
@@ -5,6 +5,7 @@ SUBDIRS += perf
bin_SCRIPTS = ms_print
noinst_PROGRAMS =
+noinst_DSYMS =
if VGCONF_PLATFORMS_INCLUDE_X86_LINUX
noinst_PROGRAMS += massif-x86-linux vgpreload_massif-x86-linux.so
endif
@@ -23,6 +24,14 @@ endif
if VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5
noinst_PROGRAMS += massif-ppc64-aix5 vgpreload_massif-ppc64-aix5.so
endif
+if VGCONF_PLATFORMS_INCLUDE_X86_DARWIN
+noinst_PROGRAMS += massif-x86-darwin vgpreload_massif-x86-darwin.so
+noinst_DSYMS += vgpreload_massif-x86-darwin.so
+endif
+if VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN
+noinst_PROGRAMS += massif-amd64-darwin vgpreload_massif-amd64-darwin.so
+noinst_DSYMS += vgpreload_massif-amd64-darwin.so
+endif
vgpreload_massif_x86_linux_so_SOURCES =
vgpreload_massif_x86_linux_so_CPPFLAGS = $(AM_CPPFLAGS_X86_LINUX)
@@ -72,6 +81,22 @@ vgpreload_massif_ppc64_aix5_so_LDFLAGS = \
$(PRELOAD_LDFLAGS_PPC64_AIX5) \
$(LIBREPLACEMALLOC_LDFLAGS_PPC64_AIX5)
+vgpreload_massif_x86_darwin_so_SOURCES =
+vgpreload_massif_x86_darwin_so_CPPFLAGS = $(AM_CPPFLAGS_X86_DARWIN)
+vgpreload_massif_x86_darwin_so_CFLAGS = $(AM_CFLAGS_X86_DARWIN) $(AM_CFLAGS_PIC)
+vgpreload_massif_x86_darwin_so_DEPENDENCIES = $(LIBREPLACEMALLOC_X86_DARWIN)
+vgpreload_massif_x86_darwin_so_LDFLAGS = \
+ $(PRELOAD_LDFLAGS_X86_DARWIN) \
+ $(LIBREPLACEMALLOC_LDFLAGS_X86_DARWIN)
+
+vgpreload_massif_amd64_darwin_so_SOURCES =
+vgpreload_massif_amd64_darwin_so_CPPFLAGS = $(AM_CPPFLAGS_AMD64_DARWIN)
+vgpreload_massif_amd64_darwin_so_CFLAGS = $(AM_CFLAGS_AMD64_DARWIN) $(AM_CFLAGS_PIC)
+vgpreload_massif_amd64_darwin_so_DEPENDENCIES = $(LIBREPLACEMALLOC_AMD64_DARWIN)
+vgpreload_massif_amd64_darwin_so_LDFLAGS = \
+ $(PRELOAD_LDFLAGS_AMD64_DARWIN) \
+ $(LIBREPLACEMALLOC_LDFLAGS_AMD64_DARWIN)
+
MASSIF_SOURCES_COMMON = ms_main.c
massif_x86_linux_SOURCES = $(MASSIF_SOURCES_COMMON)
@@ -115,3 +140,17 @@ massif_ppc64_aix5_CFLAGS = $(AM_CFLAGS_PPC64_AIX5)
massif_ppc64_aix5_DEPENDENCIES = $(COREGRIND_LIBS_PPC64_AIX5)
massif_ppc64_aix5_LDADD = $(TOOL_LDADD_PPC64_AIX5)
massif_ppc64_aix5_LDFLAGS = $(TOOL_LDFLAGS_PPC64_AIX5)
+
+massif_x86_darwin_SOURCES = $(MASSIF_SOURCES_COMMON)
+massif_x86_darwin_CPPFLAGS = $(AM_CPPFLAGS_X86_DARWIN)
+massif_x86_darwin_CFLAGS = $(AM_CFLAGS_X86_DARWIN)
+massif_x86_darwin_DEPENDENCIES = $(COREGRIND_LIBS_X86_DARWIN)
+massif_x86_darwin_LDADD = $(TOOL_LDADD_X86_DARWIN)
+massif_x86_darwin_LDFLAGS = $(TOOL_LDFLAGS_X86_DARWIN)
+
+massif_amd64_darwin_SOURCES = $(MASSIF_SOURCES_COMMON)
+massif_amd64_darwin_CPPFLAGS = $(AM_CPPFLAGS_AMD64_DARWIN)
+massif_amd64_darwin_CFLAGS = $(AM_CFLAGS_AMD64_DARWIN)
+massif_amd64_darwin_DEPENDENCIES = $(COREGRIND_LIBS_AMD64_DARWIN)
+massif_amd64_darwin_LDADD = $(TOOL_LDADD_AMD64_DARWIN)
+massif_amd64_darwin_LDFLAGS = $(TOOL_LDFLAGS_AMD64_DARWIN)
diff --git a/massif/ms_main.c b/massif/ms_main.c
index 318fc11a..f3d46feb 100644
--- a/massif/ms_main.c
+++ b/massif/ms_main.c
@@ -1288,8 +1288,10 @@ static Time get_time(void)
// Take a snapshot, and only that -- decisions on whether to take a
// snapshot, or what kind of snapshot, are made elsewhere.
+// Nb: we call the arg "my_time" because "time" shadows a global declaration
+// in /usr/include/time.h on Darwin.
static void
-take_snapshot(Snapshot* snapshot, SnapshotKind kind, Time time,
+take_snapshot(Snapshot* snapshot, SnapshotKind kind, Time my_time,
Bool is_detailed)
{
tl_assert(!is_snapshot_in_use(snapshot));
@@ -1314,7 +1316,7 @@ take_snapshot(Snapshot* snapshot, SnapshotKind kind, Time time,
// Rest of snapshot.
snapshot->kind = kind;
- snapshot->time = time;
+ snapshot->time = my_time;
sanity_check_snapshot(snapshot);
// Update stats.
@@ -1341,12 +1343,14 @@ maybe_take_snapshot(SnapshotKind kind, Char* what)
Snapshot* snapshot;
Bool is_detailed;
- Time time = get_time();
+ // Nb: we call this variable "my_time" because "time" shadows a global
+ // declaration in /usr/include/time.h on Darwin.
+ Time my_time = get_time();
switch (kind) {
case Normal:
// Only do a snapshot if it's time.
- if (time < earliest_possible_time_of_next_snapshot) {
+ if (my_time < earliest_possible_time_of_next_snapshot) {
n_skipped_snapshots++;
n_skipped_snapshots_since_last_snapshot++;
return;
@@ -1376,7 +1380,7 @@ maybe_take_snapshot(SnapshotKind kind, Char* what)
// Take the snapshot.
snapshot = & snapshots[next_snapshot_i];
- take_snapshot(snapshot, kind, time, is_detailed);
+ take_snapshot(snapshot, kind, my_time, is_detailed);
// Record if it was detailed.
if (is_detailed) {
@@ -1422,7 +1426,7 @@ maybe_take_snapshot(SnapshotKind kind, Char* what)
}
// Work out the earliest time when the next snapshot can happen.
- earliest_possible_time_of_next_snapshot = time + min_time_interval;
+ earliest_possible_time_of_next_snapshot = my_time + min_time_interval;
}
diff --git a/massif/tests/malloc_usable.c b/massif/tests/malloc_usable.c
index 4a0e470d..25781732 100644
--- a/massif/tests/malloc_usable.c
+++ b/massif/tests/malloc_usable.c
@@ -5,7 +5,7 @@
int main(void)
{
-# if !defined(VGO_aix5)
+# if !defined(VGO_aix5) && !defined(VGO_darwin)
// Because our allocations are in multiples of 8 or 16, 99 will round up
// to 104 or 112.
int* x = malloc(99);