#3215: Valgrind support
-----------------------------+----------------------------------------------
Reporter: cmcq | Owner:
Type: feature request | Status: reopened
Priority: normal | Milestone:
Component: Runtime System | Version: 6.10.3
Severity: trivial | Resolution:
Keywords: valgrind | Testcase: yes
Os: Linux | Architecture: x86
-----------------------------+----------------------------------------------
Changes (by cmcq):
* status: closed => reopened
* severity: normal => trivial
* type: bug => feature request
* summary: Calling freeHaskellFunPtr on the current function => Valgrind
support
* testcase: => yes
* keywords: => valgrind
* resolution: invalid =>
Comment:
This is now a feature request.
Valgrind is a useful tool when working with the FFI. However, it needs
a bit of help to work efficiently. Trac 3215 has a test case where
Valgrind's instruction cache causes a RTS crash. One solution is for
users to pass --smc-check=all but this is slow.
The RTS could use the "Client Request mechanism" to tell Valgrind to
update its instruction cache. These normally have no effect.
http://valgrind.org/docs/manual/manual-core-adv.html
Note "You are encouraged to copy the valgrind/*.h headers into your
project's include directory, so your program doesn't have a
compile-time dependency on Valgrind being installed. The Valgrind
headers, unlike most of the rest of the code, are under a BSD-style
license so you may include them without worrying about license
incompatibility."
Should these headers just go in the "includes" directory?
{{{
diff -rN -u old-ghc/rts/Adjustor.c new-ghc/rts/Adjustor.c
--- old-ghc/rts/Adjustor.c 2009-05-11 11:30:09.000000000 +0100
+++ new-ghc/rts/Adjustor.c 2009-05-11 11:30:09.000000000 +0100
@@ -143,6 +143,8 @@
#define UNDERSCORE ""
#endif
#if defined(i386_HOST_ARCH) && !defined(darwin_HOST_OS)
+#include <valgrind/valgrind.h>
+
/*
Now here's something obscure for you:
@@ -411,6 +413,8 @@
adj_code[0x0f] = (unsigned char)0xff; /* jmp *%eax */
adj_code[0x10] = (unsigned char)0xe0;
+
+ VALGRIND_DISCARD_TRANSLATIONS(code,0x11);
}
#elif defined(i386_HOST_ARCH) && defined(darwin_HOST_OS)
{
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3215#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs