|
From: <sv...@va...> - 2005-06-19 18:58:06
|
Author: njn
Date: 2005-06-19 19:58:03 +0100 (Sun, 19 Jun 2005)
New Revision: 3956
Log:
Fix up the libc_freeres_wrapper code so that m_main depends on m_redir,
not the other way around.
Modified:
trunk/coregrind/m_main.c
trunk/coregrind/m_redir.c
trunk/coregrind/pub_core_main.h
trunk/coregrind/pub_core_redir.h
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-19 18:49:19 UTC (rev 3955)
+++ trunk/coregrind/m_main.c 2005-06-19 18:58:03 UTC (rev 3956)
@@ -2759,26 +2759,19 @@
}
=20
=20
-/* The we need to know the address of it so it can be
- called at program exit. */
-static Addr __libc_freeres_wrapper;
-
-void VG_(set_libc_freeres_wrapper_addr)(Addr addr)
-{
- __libc_freeres_wrapper =3D addr;
-}
-
/* Final clean-up before terminating the process. =20
Clean up the client by calling __libc_freeres() (if requested)=20
This is Linux-specific?
*/
static void final_tidyup(ThreadId tid)
{
+ Addr __libc_freeres_wrapper;
+
vg_assert(VG_(is_running_thread)(tid));
=20
- if (!VG_(needs).libc_freeres ||
- !VG_(clo_run_libc_freeres) ||
- __libc_freeres_wrapper =3D=3D 0)
+ if ( !VG_(needs).libc_freeres ||
+ !VG_(clo_run_libc_freeres) ||
+ 0 =3D=3D (__libc_freeres_wrapper =3D VG_(get_libc_freeres_wrappe=
r)()) )
return; /* can't/won't do it */
=20
if (VG_(clo_verbosity) > 2 ||
Modified: trunk/coregrind/m_redir.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_redir.c 2005-06-19 18:49:19 UTC (rev 3955)
+++ trunk/coregrind/m_redir.c 2005-06-19 18:58:03 UTC (rev 3956)
@@ -36,7 +36,6 @@
#include "pub_core_libcbase.h"
#include "pub_core_libcassert.h"
#include "pub_core_libcprint.h"
-#include "pub_core_main.h" // for VG_(set_libc_freeres_wrapper_add=
r)
#include "pub_core_mallocfree.h"
#include "pub_core_options.h"
#include "pub_core_redir.h"
@@ -512,6 +511,13 @@
VG_(arena_free)(VG_AR_SYMTAB, lib);
}
=20
+static Addr __libc_freeres_wrapper =3D 0;
+
+Addr VG_(get_libc_freeres_wrapper)(void)
+{
+ return __libc_freeres_wrapper;
+}
+
// This is specifically for stringifying VG_(x) function names. We
// need to do two macroexpansions to get the VG_ macro expanded before
// stringifying.
@@ -521,7 +527,7 @@
static void handle_load_notifier( Char* symbol, Addr addr )
{
if (VG_(strcmp)(symbol, STR(VG_NOTIFY_ON_LOAD(freeres))) =3D=3D 0)
- VG_(set_libc_freeres_wrapper_addr)(addr);
+ __libc_freeres_wrapper =3D addr;
// else if (VG_(strcmp)(symbol, STR(VG_WRAPPER(pthread_startfunc_wrapp=
er))) =3D=3D 0)
// VG_(pthread_startfunc_wrapper)((Addr)(si->offset + sym->st_value=
));
else
Modified: trunk/coregrind/pub_core_main.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_main.h 2005-06-19 18:49:19 UTC (rev 3955)
+++ trunk/coregrind/pub_core_main.h 2005-06-19 18:58:03 UTC (rev 3956)
@@ -48,9 +48,6 @@
/* Something of a function looking for a home ... start up debugger. */
extern void VG_(start_debugger) ( ThreadId tid );
=20
-// Set up the libc freeres wrapper=20
-extern void VG_(set_libc_freeres_wrapper_addr)(Addr);
-
// Do everything which needs doing before the process finally ends,
// like printing reports, etc
extern void VG_(shutdown_actions_NORETURN) (
Modified: trunk/coregrind/pub_core_redir.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_redir.h 2005-06-19 18:49:19 UTC (rev 3955)
+++ trunk/coregrind/pub_core_redir.h 2005-06-19 18:58:03 UTC (rev 3956)
@@ -89,6 +89,8 @@
#define VG_NOTIFY_ON_LOAD_PREFIX "_vgw_"
#define VG_NOTIFY_ON_LOAD_PREFIX_LEN 5
=20
+// Called by m_main to get our __libc_freeres wrapper.
+extern Addr VG_(get_libc_freeres_wrapper)(void);
=20
//--------------------------------------------------------------------
// Function wrapping
|