Re: [GHC] #3215: Valgrind support

2012-03-26 Thread GHC
#3215: Valgrind support
--+-
  Reporter:  cmcq |  Owner:  
  Type:  feature request  | Status:  new 
  Priority:  normal   |  Milestone:  _|_ 
 Component:  Runtime System   |Version:  6.10.3  
Resolution:   |   Keywords:  valgrind
Os:  Linux|   Architecture:  x86 
   Failure:  None/Unknown | Difficulty:  Unknown 
  Testcase:  yes  |  Blockedby:  
  Blocking:   |Related:  
--+-
Changes (by rrnewton):

 * cc: rrnewton@… (added)


-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #3215: Valgrind support

2009-11-21 Thread GHC
#3215: Valgrind support
--+-
  Reporter:  cmcq |  Owner:  
  Type:  feature request  | Status:  reopened
  Priority:  normal   |  Milestone:  _|_ 
 Component:  Runtime System   |Version:  6.10.3  
Resolution:   |   Keywords:  valgrind
Difficulty:  Unknown  | Os:  Linux   
  Testcase:  yes  |   Architecture:  x86 
   Failure:  None/Unknown |  
--+-
Changes (by igloo):

  * failure:  => None/Unknown
  * milestone:  6.12.1 => _|_

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #3215: Valgrind support

2009-05-24 Thread GHC
#3215: Valgrind support
+---
Reporter:  cmcq |Owner:  
Type:  feature request  |   Status:  reopened
Priority:  normal   |Milestone:  6.12.1  
   Component:  Runtime System   |  Version:  6.10.3  
Severity:  trivial  |   Resolution:  
Keywords:  valgrind |   Difficulty:  Unknown 
Testcase:  yes  |   Os:  Linux   
Architecture:  x86  |  
+---
Changes (by igloo):

  * milestone:  => 6.12.1

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #3215: Valgrind support

2009-05-24 Thread GHC
#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 |   Difficulty:  Unknown 
Testcase:  yes  |   Os:  Linux   
Architecture:  x86  |  
+---
Changes (by igloo):

  * difficulty:  => Unknown

Old description:

> This is based on code in gtk2hs.
>
> $ valgrind -q ./finalizer_queue
>
> finalizer_queue: internal error: stg_ap_v_ret
> (GHC version 6.10.3 for i386_unknown_linux)
> Please report this as a GHC bug:
> http://www.haskell.org/ghc/reportabug
> Killed
>
> Unfortunately this test doesn't crash without Valgrind.
>
> My guess is that this bit is the problem:
>
> finalizer <- fixIO $ \dPtr -> mkThunk $ do
> freeHaskellFunPtr callback
> freeHaskellFunPtr dPtr
>
> Perhaps the documentation should say not to do this?

New description:

 This is based on code in gtk2hs.
 {{{
 $ valgrind -q ./finalizer_queue

 finalizer_queue: internal error: stg_ap_v_ret
 (GHC version 6.10.3 for i386_unknown_linux)
 Please report this as a GHC bug:
 http://www.haskell.org/ghc/reportabug
 Killed
 }}}
 Unfortunately this test doesn't crash without Valgrind.

 My guess is that this bit is the problem:
 {{{
 finalizer <- fixIO $ \dPtr -> mkThunk $ do
 freeHaskellFunPtr callback
 freeHaskellFunPtr dPtr
 }}}
 Perhaps the documentation should say not to do this?

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #3215: Valgrind support

2009-05-17 Thread GHC
#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 
-+--
Comment (by cmcq):

 Also see #793 regarding use of libffi.

 I get this unrelated problem using UseLibFFIForAdjustors=YES on GHC from
 darcs:

 {{{
 $ gdb -q ./finalizer_queue
 (gdb) break MallocFailHook
 Breakpoint 1 at 0x8194826: file rts/hooks/MallocFail.c, line 14.
 (gdb) r
 Starting program: /home/colin/FinalizerQueue/finalizer_queue
 [Thread debugging using libthread_db enabled]
 [New Thread 0xb7ce86d0 (LWP 13368)]
 [New Thread 0xb7affb90 (LWP 13371)]
 [New Thread 0xb72feb90 (LWP 13372)]
 [Switching to Thread 0xb72feb90 (LWP 13372)]

 Breakpoint 1, MallocFailHook (request_size=4294967292, msg=0x81d3870
 "createAdjustor")
 at rts/hooks/MallocFail.c:14
 14  fprintf(stderr, "malloc: failed on request for %lu bytes;
 message: %s\n", request_size, msg);
 (gdb) where
 #0  MallocFailHook (request_size=4294967292, msg=0x81d3870
 "createAdjustor")
 at rts/hooks/MallocFail.c:14
 #1  0x08187b87 in stgMallocBytes (n=-4, msg=0x81d3870 "createAdjustor")
 at rts/RtsUtils.c:201
 #2  0x08182800 in createAdjustor (cconv=1, hptr=0xc, wptr=0x804b9c0
 ,
 typeString=0x81c0008 "") at rts/Adjustor.c:97
 #3  0x0804ac7f in sG9_info ()
 #4  0x0001 in ?? ()
 #5  0x080750bc in base_GHCziIOBase_a23_info ()
 #6  0xb7b8004a in ?? ()
 Backtrace stopped: previous frame inner to this frame (corrupt stack?)
 }}}

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #3215: Valgrind support

2009-05-17 Thread GHC
#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 
-+--
Comment (by cmcq):

 On x86 Linux, libffi is only used for allocating code. From "darcs changes
 rts/Adjustor.c":
 {{{
 Tue Apr  8 19:34:34 BST 2008  Simon Marlow 
   * Import libffi-3.0.4, and use it to provide FFI support in GHCi
   ...
   There is also code in the RTS to use libffi in place of
   rts/Adjustor.c, but it is currently not enabled if we already have
   support in Adjustor.c for the current platform.  We need to assess the
   performance impact before using libffi here too (in GHCi we don't care
   too much about performance).
 }}}

 The libffi source doesn't mention Valgrind so there's no explicit support.
 I couldn't get a test that fails. From a quick look at its source, a
 libffi trampoline's code is based on its address. Hence the only way
 Valgrind's code cache could become incoherent is if ffi_closure_alloc
 returns addresses such that a trampoline overlaps previous trampolines.

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #3215: Valgrind support

2009-05-16 Thread GHC
#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 
-+--
Comment (by duncan):

 Is rts/Adjustor.c still used? I thought it was all libffi now. Does libffi
 have valgrind support?

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #3215: Valgrind support

2009-05-15 Thread GHC
#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.0 +0100
 +++ new-ghc/rts/Adjustor.c  2009-05-11 11:30:09.0 +0100
 @@ -143,6 +143,8 @@
  #define UNDERSCORE ""
  #endif
  #if defined(i386_HOST_ARCH) && !defined(darwin_HOST_OS)
 +#include 
 +
  /*
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: 
GHC 
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs