|
From: <sv...@va...> - 2009-06-12 04:56:32
|
Author: njn
Date: 2009-06-12 05:56:25 +0100 (Fri, 12 Jun 2009)
New Revision: 10305
Log:
More preprocessor file selection. Also get rid of the
HAVE_{ELF,MACHO,SCRIPT} constants -- they were used only inconsistently.
Perhaps they should be used universally instead of VGO_linux et al, but that
can happen later.
Modified:
branches/BUILD_TWEAKS/coregrind/Makefile.am
branches/BUILD_TWEAKS/coregrind/m_debuginfo/debuginfo.c
branches/BUILD_TWEAKS/coregrind/m_debuginfo/priv_readpdb.h
branches/BUILD_TWEAKS/coregrind/m_debuginfo/readdwarf.c
branches/BUILD_TWEAKS/coregrind/m_debuginfo/readdwarf3.c
branches/BUILD_TWEAKS/coregrind/m_debuginfo/readelf.c
branches/BUILD_TWEAKS/coregrind/m_debuginfo/readmacho.c
branches/BUILD_TWEAKS/coregrind/m_debuginfo/readpdb.c
branches/BUILD_TWEAKS/coregrind/m_debuginfo/readstabs.c
branches/BUILD_TWEAKS/coregrind/m_debuginfo/readxcoff.c
branches/BUILD_TWEAKS/coregrind/m_ume/elf.c
branches/BUILD_TWEAKS/coregrind/m_ume/macho.c
branches/BUILD_TWEAKS/coregrind/m_ume/main.c
branches/BUILD_TWEAKS/coregrind/m_ume/priv_ume.h
branches/BUILD_TWEAKS/coregrind/m_ume/script.c
branches/BUILD_TWEAKS/coregrind/pub_core_ume.h
Modified: branches/BUILD_TWEAKS/coregrind/Makefile.am
===================================================================
--- branches/BUILD_TWEAKS/coregrind/Makefile.am 2009-06-12 03:14:08 UTC (rev 10304)
+++ branches/BUILD_TWEAKS/coregrind/Makefile.am 2009-06-12 04:56:25 UTC (rev 10305)
@@ -287,8 +287,15 @@
m_coredump/coredump-amd64-darwin.c \
m_debuginfo/misc.c \
m_debuginfo/d3basics.c \
- m_debuginfo/storage.c \
m_debuginfo/debuginfo.c \
+ m_debuginfo/readdwarf.c \
+ m_debuginfo/readdwarf3.c \
+ m_debuginfo/readelf.c \
+ m_debuginfo/readmacho.c \
+ m_debuginfo/readpdb.c \
+ m_debuginfo/readstabs.c \
+ m_debuginfo/readxcoff.c \
+ m_debuginfo/storage.c \
m_debuginfo/tytypes.c \
m_demangle/cp-demangle.c \
m_demangle/cplus-dem.c \
@@ -352,23 +359,8 @@
m_ume/script.c
COREGRIND_LINUX_SOURCE = \
- m_coredump/coredump-elf.c \
- m_debuginfo/readelf.c \
- m_debuginfo/readdwarf.c \
- m_debuginfo/readdwarf3.c \
- m_debuginfo/readstabs.c \
- m_debuginfo/readpdb.c
+ m_coredump/coredump-elf.c
-COREGRIND_AIX5_SOURCE = \
- m_debuginfo/readxcoff.c
-
-COREGRIND_DARWIN_SOURCE = \
- m_debuginfo/readdwarf.c \
- m_debuginfo/readdwarf3.c \
- m_debuginfo/readstabs.c \
- m_debuginfo/readmacho.c \
- m_debuginfo/readpdb.c
-
# These are generated using 'mig' from $mach_defs above.
COREGRIND_DARWIN_BUILT_SOURCES = \
m_mach/mach_vmUser.c \
@@ -405,32 +397,28 @@
libcoregrind_ppc64_linux_a_CCASFLAGS = $(AM_CCASFLAGS_PPC64_LINUX)
libcoregrind_ppc32_aix5_a_SOURCES = \
- $(COREGRIND_SOURCES_COMMON) \
- $(COREGRIND_AIX5_SOURCE)
+ $(COREGRIND_SOURCES_COMMON)
libcoregrind_ppc32_aix5_a_CPPFLAGS = $(AM_CPPFLAGS_PPC32_AIX5)
libcoregrind_ppc32_aix5_a_CFLAGS = $(AM_CFLAGS_PPC32_AIX5)
libcoregrind_ppc32_aix5_a_CCASFLAGS = $(AM_CCASFLAGS_PPC32_AIX5)
libcoregrind_ppc32_aix5_a_AR = $(AR) -X32 cru
libcoregrind_ppc64_aix5_a_SOURCES = \
- $(COREGRIND_SOURCES_COMMON) \
- $(COREGRIND_AIX5_SOURCE)
+ $(COREGRIND_SOURCES_COMMON)
libcoregrind_ppc64_aix5_a_CPPFLAGS = $(AM_CPPFLAGS_PPC64_AIX5)
libcoregrind_ppc64_aix5_a_CFLAGS = $(AM_CFLAGS_PPC64_AIX5)
libcoregrind_ppc64_aix5_a_CCASFLAGS = $(AM_CCASFLAGS_PPC64_AIX5)
libcoregrind_ppc64_aix5_a_AR = $(AR) -X64 cru
libcoregrind_x86_darwin_a_SOURCES = \
- $(COREGRIND_SOURCES_COMMON) \
- $(COREGRIND_DARWIN_SOURCE)
+ $(COREGRIND_SOURCES_COMMON)
nodist_libcoregrind_x86_darwin_a_SOURCES = $(COREGRIND_DARWIN_BUILT_SOURCES)
libcoregrind_x86_darwin_a_CPPFLAGS = $(AM_CPPFLAGS_X86_DARWIN)
libcoregrind_x86_darwin_a_CFLAGS = $(AM_CFLAGS_X86_DARWIN)
libcoregrind_x86_darwin_a_CCASFLAGS = $(AM_CCASFLAGS_X86_DARWIN)
libcoregrind_amd64_darwin_a_SOURCES = \
- $(COREGRIND_SOURCES_COMMON) \
- $(COREGRIND_DARWIN_SOURCE)
+ $(COREGRIND_SOURCES_COMMON)
nodist_libcoregrind_amd64_darwin_a_SOURCES = $(COREGRIND_DARWIN_BUILT_SOURCES)
libcoregrind_amd64_darwin_a_CPPFLAGS = $(AM_CPPFLAGS_AMD64_DARWIN)
libcoregrind_amd64_darwin_a_CFLAGS = $(AM_CFLAGS_AMD64_DARWIN)
Modified: branches/BUILD_TWEAKS/coregrind/m_debuginfo/debuginfo.c
===================================================================
--- branches/BUILD_TWEAKS/coregrind/m_debuginfo/debuginfo.c 2009-06-12 03:14:08 UTC (rev 10304)
+++ branches/BUILD_TWEAKS/coregrind/m_debuginfo/debuginfo.c 2009-06-12 04:56:25 UTC (rev 10305)
@@ -28,11 +28,6 @@
The GNU General Public License is contained in the file COPYING.
*/
-/*
- Stabs reader greatly improved by Nick Nethercote, Apr 02.
- This module was also extensively hacked on by Jeremy Fitzhardinge
- and Tom Hughes.
-*/
#include "pub_core_basics.h"
#include "pub_core_vki.h"
@@ -752,15 +747,16 @@
}
vg_assert(nread > 0 && nread <= sizeof(buf1k) );
- /* We're only interested in mappings of ELF object files. */
-#if defined(HAVE_ELF)
+ /* We're only interested in mappings of object files. */
+ // Nb: AIX5 doesn't use this file and so isn't represented here.
+#if defined(VGO_linux)
if (!ML_(is_elf_object_file)( buf1k, (SizeT)nread ))
return 0;
-#elif defined(HAVE_MACHO)
+#elif defined(VGO_darwin)
if (!ML_(is_macho_object_file)( buf1k, (SizeT)nread ))
return 0;
#else
-# error "unknown executable type"
+# error "unknown OS"
#endif
/* See if we have a DebugInfo for this filename. If not,
@@ -813,12 +809,13 @@
discard_DebugInfos_which_overlap_with( di );
/* .. and acquire new info. */
-#if defined(HAVE_ELF)
+ // Nb: AIX5 doesn't use this file and so isn't represented here.
+#if defined(VGO_linux)
ok = ML_(read_elf_debug_info)( di );
-#elif defined(HAVE_MACHO)
+#elif defined(VGO_darwin)
ok = ML_(read_macho_debug_info)( di );
#else
-# error "unknown executable type"
+# error "unknown OS"
#endif
if (ok) {
@@ -1026,7 +1023,7 @@
if (pdbname) ML_(dinfo_free)(pdbname);
}
-#endif /* defined(VGO_linux) */
+#endif /* defined(VGO_linux) || defined(VGO_darwin) */
/*-------------------------------------------------------------*/
Modified: branches/BUILD_TWEAKS/coregrind/m_debuginfo/priv_readpdb.h
===================================================================
--- branches/BUILD_TWEAKS/coregrind/m_debuginfo/priv_readpdb.h 2009-06-12 03:14:08 UTC (rev 10304)
+++ branches/BUILD_TWEAKS/coregrind/m_debuginfo/priv_readpdb.h 2009-06-12 04:56:25 UTC (rev 10305)
@@ -32,6 +32,8 @@
The GNU General Public License is contained in the file COPYING.
*/
+#if defined(VGO_linux) || defined(VGO_darwin)
+
#ifndef __PRIV_READPDB_H
#define __PRIV_READPDB_H
@@ -48,6 +50,8 @@
#endif /* ndef __PRIV_READPDB_H */
+#endif // defined(VGO_linux) || defined(VGO_darwin)
+
/*--------------------------------------------------------------------*/
-/*--- end priv_readpdb.h ---*/
+/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: branches/BUILD_TWEAKS/coregrind/m_debuginfo/readdwarf.c
===================================================================
--- branches/BUILD_TWEAKS/coregrind/m_debuginfo/readdwarf.c 2009-06-12 03:14:08 UTC (rev 10304)
+++ branches/BUILD_TWEAKS/coregrind/m_debuginfo/readdwarf.c 2009-06-12 04:56:25 UTC (rev 10305)
@@ -27,12 +27,9 @@
The GNU General Public License is contained in the file COPYING.
*/
-/*
- Stabs reader greatly improved by Nick Nethercote, Apr 02.
- This module was also extensively hacked on by Jeremy Fitzhardinge
- and Tom Hughes.
-*/
+#if defined(VGO_linux) || defined(VGO_darwin)
+
#include "pub_core_basics.h"
#include "pub_core_debuginfo.h"
#include "pub_core_libcbase.h"
@@ -3884,6 +3881,7 @@
return;
}
+#endif // defined(VGO_linux) || defined(VGO_darwin)
/*--------------------------------------------------------------------*/
/*--- end ---*/
Modified: branches/BUILD_TWEAKS/coregrind/m_debuginfo/readdwarf3.c
===================================================================
--- branches/BUILD_TWEAKS/coregrind/m_debuginfo/readdwarf3.c 2009-06-12 03:14:08 UTC (rev 10304)
+++ branches/BUILD_TWEAKS/coregrind/m_debuginfo/readdwarf3.c 2009-06-12 04:56:25 UTC (rev 10305)
@@ -34,6 +34,8 @@
without prior written permission.
*/
+#if defined(VGO_linux) || defined(VGO_darwin)
+
/* REFERENCE (without which this code will not make much sense):
DWARF Debugging Information Format, Version 3,
@@ -3904,7 +3906,8 @@
TRACE_SYMTAB("\n");
#endif
+#endif // defined(VGO_linux) || defined(VGO_darwin)
/*--------------------------------------------------------------------*/
-/*--- end readdwarf3.c ---*/
+/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: branches/BUILD_TWEAKS/coregrind/m_debuginfo/readelf.c
===================================================================
--- branches/BUILD_TWEAKS/coregrind/m_debuginfo/readelf.c 2009-06-12 03:14:08 UTC (rev 10304)
+++ branches/BUILD_TWEAKS/coregrind/m_debuginfo/readelf.c 2009-06-12 04:56:25 UTC (rev 10305)
@@ -28,12 +28,9 @@
The GNU General Public License is contained in the file COPYING.
*/
-/*
- Stabs reader greatly improved by Nick Nethercote, Apr 02.
- This module was also extensively hacked on by Jeremy Fitzhardinge
- and Tom Hughes.
-*/
+#if defined(VGO_linux)
+
#include "pub_core_basics.h"
#include "pub_core_vki.h"
#include "pub_core_debuginfo.h"
@@ -2048,6 +2045,7 @@
}
}
+#endif // defined(VGO_linux)
/*--------------------------------------------------------------------*/
/*--- end ---*/
Modified: branches/BUILD_TWEAKS/coregrind/m_debuginfo/readmacho.c
===================================================================
--- branches/BUILD_TWEAKS/coregrind/m_debuginfo/readmacho.c 2009-06-12 03:14:08 UTC (rev 10304)
+++ branches/BUILD_TWEAKS/coregrind/m_debuginfo/readmacho.c 2009-06-12 04:56:25 UTC (rev 10305)
@@ -29,6 +29,8 @@
The GNU General Public License is contained in the file COPYING.
*/
+#if defined(VGO_darwin)
+
#include "pub_core_basics.h"
#include "pub_core_vki.h"
#include "pub_core_libcbase.h"
@@ -1092,6 +1094,8 @@
return False;
}
+#endif // defined(VGO_darwin)
+
/*--------------------------------------------------------------------*/
-/*--- end readmacho.c ---*/
+/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: branches/BUILD_TWEAKS/coregrind/m_debuginfo/readpdb.c
===================================================================
--- branches/BUILD_TWEAKS/coregrind/m_debuginfo/readpdb.c 2009-06-12 03:14:08 UTC (rev 10304)
+++ branches/BUILD_TWEAKS/coregrind/m_debuginfo/readpdb.c 2009-06-12 04:56:25 UTC (rev 10305)
@@ -35,6 +35,8 @@
The GNU General Public License is contained in the file COPYING.
*/
+#if defined(VGO_linux) || defined(VGO_darwin)
+
#include "pub_core_basics.h"
#include "pub_core_debuginfo.h"
#include "pub_core_vki.h" // VKI_PAGE_SIZE
@@ -2261,7 +2263,8 @@
return True;
}
+#endif // defined(VGO_linux) || defined(VGO_darwin)
/*--------------------------------------------------------------------*/
-/*--- end readpdb.c ---*/
+/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: branches/BUILD_TWEAKS/coregrind/m_debuginfo/readstabs.c
===================================================================
--- branches/BUILD_TWEAKS/coregrind/m_debuginfo/readstabs.c 2009-06-12 03:14:08 UTC (rev 10304)
+++ branches/BUILD_TWEAKS/coregrind/m_debuginfo/readstabs.c 2009-06-12 04:56:25 UTC (rev 10305)
@@ -27,6 +27,9 @@
The GNU General Public License is contained in the file COPYING.
*/
+
+#if defined(VGO_linux) || defined(VGO_darwin)
+
/*
Stabs reader greatly improved by Nick Nethercote, Apr 02.
This module was also extensively hacked on by Jeremy Fitzhardinge
@@ -386,6 +389,8 @@
}
}
+#endif // defined(VGO_linux) || defined(VGO_darwin)
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: branches/BUILD_TWEAKS/coregrind/m_debuginfo/readxcoff.c
===================================================================
--- branches/BUILD_TWEAKS/coregrind/m_debuginfo/readxcoff.c 2009-06-12 03:14:08 UTC (rev 10304)
+++ branches/BUILD_TWEAKS/coregrind/m_debuginfo/readxcoff.c 2009-06-12 04:56:25 UTC (rev 10305)
@@ -33,6 +33,8 @@
without prior written permission.
*/
+#if defined(VGO_aix5)
+
/* This file reads XCOFF symbol tables and debug info.
Known limitations:
@@ -2481,6 +2483,8 @@
return ok;
}
+#endif // defined(VGO_aix5)
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: branches/BUILD_TWEAKS/coregrind/m_ume/elf.c
===================================================================
--- branches/BUILD_TWEAKS/coregrind/m_ume/elf.c 2009-06-12 03:14:08 UTC (rev 10304)
+++ branches/BUILD_TWEAKS/coregrind/m_ume/elf.c 2009-06-12 04:56:25 UTC (rev 10305)
@@ -28,6 +28,8 @@
The GNU General Public License is contained in the file COPYING.
*/
+#if defined(VGO_linux)
+
#include "pub_core_basics.h"
#include "pub_core_vki.h"
@@ -44,8 +46,6 @@
#include "priv_ume.h"
-#if defined(HAVE_ELF)
-
/* --- !!! --- EXTERNAL HEADERS start --- !!! --- */
#define _GNU_SOURCE
#define _FILE_OFFSET_BITS 64
@@ -511,7 +511,7 @@
return 0;
}
-#endif /* defined(HAVE_ELF) */
+#endif // defined(VGO_linux)
/*--------------------------------------------------------------------*/
/*--- end ---*/
Modified: branches/BUILD_TWEAKS/coregrind/m_ume/macho.c
===================================================================
--- branches/BUILD_TWEAKS/coregrind/m_ume/macho.c 2009-06-12 03:14:08 UTC (rev 10304)
+++ branches/BUILD_TWEAKS/coregrind/m_ume/macho.c 2009-06-12 04:56:25 UTC (rev 10305)
@@ -28,6 +28,8 @@
The GNU General Public License is contained in the file COPYING.
*/
+#if defined(VGO_darwin)
+
#include "pub_core_basics.h"
#include "pub_core_vki.h"
@@ -45,9 +47,6 @@
#include "priv_ume.h"
-
-#if defined(HAVE_MACHO)
-
#include <mach/mach.h>
#include <mach-o/dyld.h>
@@ -768,7 +767,7 @@
return 0;
}
-#endif // defined(HAVE_MACHO)
+#endif // defined(VGO_darwin)
/*--------------------------------------------------------------------*/
/*--- end ---*/
Modified: branches/BUILD_TWEAKS/coregrind/m_ume/main.c
===================================================================
--- branches/BUILD_TWEAKS/coregrind/m_ume/main.c 2009-06-12 03:14:08 UTC (rev 10304)
+++ branches/BUILD_TWEAKS/coregrind/m_ume/main.c 2009-06-12 04:56:25 UTC (rev 10305)
@@ -46,21 +46,20 @@
typedef struct {
- const HChar *name;
Bool (*match_fn)(Char *hdr, Int len);
Int (*load_fn)(Int fd, const HChar *name, ExeInfo *info);
} ExeHandler;
static ExeHandler exe_handlers[] = {
-# if defined(HAVE_ELF)
- { "ELF", VG_(match_ELF), VG_(load_ELF) },
-# endif
-# if defined(HAVE_SCRIPT)
- { "script", VG_(match_script), VG_(load_script) },
-# endif
-# if defined(HAVE_MACHO)
- { "Mach-O", VG_(match_macho), VG_(load_macho) },
-# endif
+ // Nb: AIX5 doesn't use m_ume, which is why it's not represented here.
+#if defined(VGO_linux)
+ { VG_(match_ELF), VG_(load_ELF) },
+#elif defined(VGO_darwin)
+ { VG_(match_macho), VG_(load_macho) },
+#else
+# error "unknown OS"
+#endif
+ { VG_(match_script), VG_(load_script) },
};
#define EXE_HANDLER_COUNT (sizeof(exe_handlers)/sizeof(exe_handlers[0]))
Modified: branches/BUILD_TWEAKS/coregrind/m_ume/priv_ume.h
===================================================================
--- branches/BUILD_TWEAKS/coregrind/m_ume/priv_ume.h 2009-06-12 03:14:08 UTC (rev 10304)
+++ branches/BUILD_TWEAKS/coregrind/m_ume/priv_ume.h 2009-06-12 04:56:25 UTC (rev 10305)
@@ -27,28 +27,31 @@
The GNU General Public License is contained in the file COPYING.
*/
+#if defined(VGO_linux) || defined(VGO_darwin)
+
#ifndef __PRIV_UME_H
#define __PRIV_UME_H
extern int VG_(do_exec_inner)(const HChar *exe, ExeInfo *info);
-#if defined(HAVE_ELF)
+#if defined(VGO_linux)
extern Bool VG_(match_ELF) ( Char *hdr, Int len );
extern Int VG_(load_ELF) ( Int fd, const HChar *name, ExeInfo *info );
+#elif defined(HAVE_MACHO)
+extern Bool VG_(match_macho) ( Char *hdr, Int len );
+extern Int VG_(load_macho) ( Int fd, const HChar *name, ExeInfo *info );
+#else
+# error Unknown OS
#endif
-#if defined(HAVE_SCRIPT)
extern Bool VG_(match_script) ( Char *hdr, Int len );
extern Int VG_(load_script) ( Int fd, const HChar *name, ExeInfo *info );
-#endif
-#if defined(HAVE_MACHO)
-extern Bool VG_(match_macho) ( Char *hdr, Int len );
-extern Int VG_(load_macho) ( Int fd, const HChar *name, ExeInfo *info );
-#endif
-#endif /* __PRIV_UME_H */
+#endif // __PRIV_UME_H
+#endif // defined(VGO_linux) || defined(VGO_darwin)
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: branches/BUILD_TWEAKS/coregrind/m_ume/script.c
===================================================================
--- branches/BUILD_TWEAKS/coregrind/m_ume/script.c 2009-06-12 03:14:08 UTC (rev 10304)
+++ branches/BUILD_TWEAKS/coregrind/m_ume/script.c 2009-06-12 04:56:25 UTC (rev 10305)
@@ -40,9 +40,6 @@
#include "priv_ume.h"
-
-#if defined(HAVE_SCRIPT)
-
Bool VG_(match_script)(Char *hdr, Int len)
{
Char* end = hdr + len;
@@ -143,8 +140,6 @@
return VG_(do_exec_inner)(interp, info);
}
-#endif /* defined(HAVE_SCRIPT) */
-
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: branches/BUILD_TWEAKS/coregrind/pub_core_ume.h
===================================================================
--- branches/BUILD_TWEAKS/coregrind/pub_core_ume.h 2009-06-12 03:14:08 UTC (rev 10304)
+++ branches/BUILD_TWEAKS/coregrind/pub_core_ume.h 2009-06-12 04:56:25 UTC (rev 10305)
@@ -36,21 +36,6 @@
// and exec'ing.
//--------------------------------------------------------------------
-#if defined(VGO_linux)
-# define HAVE_ELF
-# define HAVE_SCRIPT
-
-#elif defined(VGO_aix5)
-// The AIX port doesn't use UME.
-
-#elif defined(VGO_darwin)
-# define HAVE_MACHO
-# define HAVE_SCRIPT
-
-#else
-#error unknown architecture
-#endif
-
/*------------------------------------------------------------*/
/*--- Loading files ---*/
/*------------------------------------------------------------*/
|