]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Modularised m_redir. As a side-effect, managed to remove
authorNicholas Nethercote <njn@valgrind.org>
Sun, 29 May 2005 17:01:48 +0000 (17:01 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Sun, 29 May 2005 17:01:48 +0000 (17:01 +0000)
$PLATFORM/core_platform.c and $PLATFORM/libplatform.a, hooray.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3808

coregrind/Makefile.am
coregrind/amd64-linux/Makefile.am
coregrind/amd64-linux/core_platform.c [deleted file]
coregrind/arm-linux/Makefile.am
coregrind/core.h
coregrind/m_redir.c [moved from coregrind/vg_redir.c with 96% similarity]
coregrind/m_translate.c
coregrind/vg_main.c
coregrind/vg_symtab2.c
coregrind/x86-linux/Makefile.am
coregrind/x86-linux/core_platform.c [deleted file]

index 6c8430945b171238d52f5eeab63d457e7c4df883..ade1a6d46949d5cff230de53fcc70c1e617faaf8 100644 (file)
@@ -45,6 +45,7 @@ noinst_HEADERS = \
        pub_core_hashtable.h    \
        pub_core_mallocfree.h   \
        pub_core_options.h      \
+       pub_core_redir.h        \
        pub_core_replacemalloc.h\
        pub_core_sigframe.h     \
        pub_core_skiplist.h     \
@@ -79,6 +80,7 @@ stage2_SOURCES = \
        m_hashtable.c \
        m_mallocfree.c \
        m_options.c \
+       m_redir.c \
        m_skiplist.c \
        m_stacktrace.c \
        m_tooliface.c \
@@ -95,19 +97,16 @@ stage2_SOURCES = \
        vg_symtab2.c \
        vg_threadmodel.c \
        vg_pthreadmodel.c \
-       vg_redir.c \
        vg_dwarf.c \
        vg_stabs.c \
        vg_symtypes.c
 
-## libplatform.a must be before libarch.a and libos.a, it seems.
 stage2_extra= \
        m_dispatch/libdispatch.a \
        m_demangle/libdemangle.a \
        m_aspacemgr/libaspacemgr.a \
        m_sigframe/libsigframe.a \
        m_syscalls/libsyscalls.a \
-       ${VG_PLATFORM}/libplatform.a \
        ${VG_ARCH}/libarch.a \
        ${VG_OS}/libos.a \
        @VEX_DIR@/libvex.a
index 58b3a7328ba8f106d82f9817816eea5cc572a891..96f3688d63ad047dfcd9e4d57512b04af470ff6f 100644 (file)
@@ -4,9 +4,3 @@ include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
 noinst_HEADERS = \
        core_platform.h \
        vki_unistd.h
-
-noinst_LIBRARIES = libplatform.a
-
-
-libplatform_a_SOURCES = \
-       core_platform.c
diff --git a/coregrind/amd64-linux/core_platform.c b/coregrind/amd64-linux/core_platform.c
deleted file mode 100644 (file)
index d420b83..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#include "core.h"
-
-void VGP_(setup_redirects)(void)
-{
-   /* Redirect vsyscalls to local versions */
-   VG_(add_redirect_addr_to_addr)(0xFFFFFFFFFF600000ULL,
-                                  VG_(client_trampoline_code)+VG_(tramp_gettimeofday_offset));
-   VG_(add_redirect_addr_to_addr)(0xFFFFFFFFFF600400ULL,
-                                  VG_(client_trampoline_code)+VG_(tramp_time_offset));
-}
index cb4cb1f8968bf48725637a57bcf7766d0055773f..96f3688d63ad047dfcd9e4d57512b04af470ff6f 100644 (file)
@@ -4,8 +4,3 @@ include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
 noinst_HEADERS = \
        core_platform.h \
        vki_unistd.h
-
-noinst_LIBRARIES = libplatform.a
-
-libplatform_a_SOURCES =
-
index 795a0c3ce4a3b386654ee1a8618db9816945e4a4..104390cf968963e42f8ccd814573d25835456bac 100644 (file)
@@ -488,45 +488,6 @@ extern Bool VG_(use_CFI_info) ( /*MOD*/Addr* ipP,
                                 Addr max_accessible );
 
 
-/* ---------------------------------------------------------------------
-   Exports of vg_redir.c
-   ------------------------------------------------------------------ */
-
-/* Redirection machinery */
-extern Addr VG_(code_redirect) ( Addr orig );
-
-/* Set up some default redirects */
-extern void VG_(setup_code_redirect_table) ( void );
-
-extern void VG_(add_redirect_sym_to_addr)(const Char *from_lib,
-                                         const Char *from_sym,
-                                         Addr to_addr);
-extern void VG_(add_redirect_addr_to_addr)(Addr from_addr, Addr to_addr);
-extern void VG_(resolve_seg_redirs)(SegInfo *si);
-
-/* Wrapping machinery */
-enum return_type {
-   RT_RETURN,
-   RT_LONGJMP,
-   RT_EXIT,
-};
-
-typedef struct _FuncWrapper FuncWrapper;
-struct _FuncWrapper {
-   void *(*before)(va_list args);
-   void  (*after) (void *nonce, enum return_type, Word retval);
-};
-
-extern void VG_(wrap_function)(Addr eip, const FuncWrapper *wrapper);
-extern const FuncWrapper *VG_(is_wrapped)(Addr eip);
-extern Bool VG_(is_wrapper_return)(Addr eip);
-
-/* Primary interface for adding wrappers for client-side functions. */
-extern CodeRedirect *VG_(add_wrapper)(const Char *from_lib, const Char *from_sym,
-                                     const FuncWrapper *wrapper);
-
-extern Bool VG_(is_resolved)(const CodeRedirect *redir);
-
 /* ---------------------------------------------------------------------
    Exports of vg_main.c
    ------------------------------------------------------------------ */
@@ -688,13 +649,6 @@ extern void VGA_(final_tidyup)(ThreadId tid);
 extern Bool VGA_(client_requests)(ThreadId tid, UWord *args);
 
 
-// ---------------------------------------------------------------------
-// Platform-specific things defined in eg. x86/*.c
-// ---------------------------------------------------------------------
-
-// Do any platform specific redirects.
-extern void VGP_(setup_redirects)(void);
-
 ///* ---------------------------------------------------------------------
 //   Thread modelling
 //   ------------------------------------------------------------------ */
similarity index 96%
rename from coregrind/vg_redir.c
rename to coregrind/m_redir.c
index 1214e5839f93f6a1a41bb677866174a7e6ae51e6..6ffbb8ecdf3dcae9479631253fecb695a3eb7db2 100644 (file)
@@ -35,6 +35,7 @@
 #include "pub_core_aspacemgr.h"
 #include "pub_core_skiplist.h"
 #include "pub_core_options.h"
+#include "pub_core_redir.h"
 #include "pub_core_transtab.h"
 
 /*------------------------------------------------------------*/
@@ -490,8 +491,23 @@ void VG_(setup_code_redirect_table) ( void )
 
    add_redirect_sym_to_sym("soname:ld-linux-x86-64.so.2", "strlen",
                            "*vgpreload_memcheck.so*", "strlen");
-}
 
+#if defined(VGP_x86_linux)
+   /* Redirect _dl_sysinfo_int80, which is glibc's default system call
+      routine, to the routine in our trampoline page so that the
+      special sysinfo unwind hack in m_stacktrace.c will kick in.  */
+   VG_(add_redirect_sym_to_addr)("soname:ld-linux.so.2", "_dl_sysinfo_int80",
+                                 VG_(client_trampoline_code)+VG_(tramp_syscall_offset));
+#elif defined(VGP_amd64_linux)
+   /* Redirect vsyscalls to local versions */
+   VG_(add_redirect_addr_to_addr)(0xFFFFFFFFFF600000ULL,
+                                  VG_(client_trampoline_code)+VG_(tramp_gettimeofday_offset));
+   VG_(add_redirect_addr_to_addr)(0xFFFFFFFFFF600400ULL,
+                                  VG_(client_trampoline_code)+VG_(tramp_time_offset));
+#else
+#  error Unknown platform
+#endif
+}
 
 //:: /*------------------------------------------------------------*/
 //:: /*--- General function wrapping.                           ---*/
index ee20139a85fdd2ec72b8ad33afdaa85f0d1398a0..8f04780dd07664d9de7acd9f75d4a4adf29949d6 100644 (file)
@@ -32,6 +32,7 @@
 #include "core.h"
 #include "pub_core_aspacemgr.h"
 #include "pub_core_options.h"
+#include "pub_core_redir.h"
 #include "pub_core_tooliface.h"
 #include "pub_core_translate.h"
 #include "pub_core_transtab.h"
index 7c1eb6f6a42517a30b8d27b450462ff7c9a7589a..f181423cb763988e822c1e58b43be1623be1b12f 100644 (file)
@@ -37,6 +37,7 @@
 #include "pub_core_errormgr.h"
 #include "pub_core_execontext.h"
 #include "pub_core_options.h"
+#include "pub_core_redir.h"
 #include "pub_core_syscalls.h"
 #include "pub_core_tooliface.h"
 #include "pub_core_transtab.h"
@@ -2794,7 +2795,6 @@ int main(int argc, char **argv, char **envp)
    //--------------------------------------------------------------
    VG_(debugLog)(1, "main", "Initialise redirects\n");
    VG_(setup_code_redirect_table)();
-   VGP_(setup_redirects)();
 
    //--------------------------------------------------------------
    // Verbosity message
index eb788e2192262bf8331b33f475d7bfbd24d55b56..80bdaaa0bf2cd8e62fdb83ba794486c14a47ff7c 100644 (file)
@@ -36,6 +36,7 @@
 #include "pub_core_aspacemgr.h"
 #include "pub_core_demangle.h"
 #include "pub_core_options.h"
+#include "pub_core_redir.h"
 #include "pub_core_tooliface.h"
 
 #include <elf.h>          /* ELF defns */
index 58b3a7328ba8f106d82f9817816eea5cc572a891..96f3688d63ad047dfcd9e4d57512b04af470ff6f 100644 (file)
@@ -4,9 +4,3 @@ include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
 noinst_HEADERS = \
        core_platform.h \
        vki_unistd.h
-
-noinst_LIBRARIES = libplatform.a
-
-
-libplatform_a_SOURCES = \
-       core_platform.c
diff --git a/coregrind/x86-linux/core_platform.c b/coregrind/x86-linux/core_platform.c
deleted file mode 100644 (file)
index 7e06419..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "core.h"
-
-void VGP_(setup_redirects)(void)
-{
-   /* Redirect _dl_sysinfo_int80, which is glibc's default system call
-      routine, to the routine in our trampoline page so that the
-      special sysinfo unwind hack in vg_execontext.c will kick in.
-   */
-   VG_(add_redirect_sym_to_addr)("soname:ld-linux.so.2", "_dl_sysinfo_int80",
-                                 VG_(client_trampoline_code)+VG_(tramp_syscall_offset));
-}