www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - valgrind? electric fence?

reply Jason House <jason.james.house gmail.com> writes:
Does anyone know if valgrind or similar products can work with D?  If 
so, how?  If not, does anyone know of the next best thing?  (like 
running the GC after every line of code in a particular function?)

Needless to say, I have a bug that's driving me crazy.  Somewhere fairly 
late in a loop equivalent to "for (int i=0; i<36100; i++) 
doSomething();", my program crashes in seemingly normal code with normal 
state.  doSomething passes all of its unit tests and passes my nieve 
code inspection.  I could even be looking in the wrong spot since the 
code is multithreaded...  (but the other threads are stuck in the 
equivalent of "while(foo()==false) yield;" while waiting for the other 
thing to finish.  (foo is a very simple function)
Jun 03 2007
next sibling parent reply Frank Benoit <keinfarbton googlemail.com> writes:
Jason House schrieb:
 Does anyone know if valgrind or similar products can work with D?  If
 so, how?  If not, does anyone know of the next best thing?  (like
 running the GC after every line of code in a particular function?)
 

I never used valgrind, but i know that there are ppl that use valgrind on linux with D (probably GDC).
Jun 03 2007
next sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Frank Benoit schrieb am 2007-06-03:
 Jason House schrieb:
 Does anyone know if valgrind or similar products can work with D?  If
 so, how?  If not, does anyone know of the next best thing?  (like
 running the GC after every line of code in a particular function?)
 

I never used valgrind, but i know that there are ppl that use valgrind on linux with D (probably GDC).

Simply compile the application with debugging information and use valgrind as you would do with a plain C application. Valgrind's bug tracker contains a patch to add D demangler support. The demangling information is dated and using http://ddemangled.kuehne.cn (either as a standalone or a pluging) should result in better results. Thomas -----BEGIN PGP SIGNATURE----- iQIVAwUBRmMeD7ZlboUnBhRKAQLREg//Z7al9b+OsWi843+T5mpSQ85HTTbEj91G OWhwRhD2ktjJCYFRe4U5uowVVpsGp96jiGeXM6eE2HCn23U/crpDaDh6bkPAQPfe J8yJPyWfcfNE3vdyoK2QGOGjHV4cTRCgjAAHv5VbDlMuOGtwK9g1QuF8PfWBB+01 B8ItDjDkt8JL3d382FzsNANl0ZCQeWFU+Zk4OlLOKS0plgwIUJPddFRQRjQoQTnb DZ2jARDErE75jFpdaWNP9ysTbUgUCjg/ipwFZLS33oAKZxa7A/5Tf9q4yLTpIcK6 Gzz5fWRJj6t6FZsD2RHWmKS9HJlXzZCjD+bceV0jqZKWcaU6Fjr2NQKh2dM9H1kH yu3Z33g3aTNOQPgWLDm0al3FpxlMRDgR54v9qhWLygsRAdSClOOqeuhyGLSPQPcI 2rs12wOXEECwHfK85sJToQ0skflaGADg/5cE3HJD/Rw5LioB2G5Pfqh1e6Ad/iKC RPOSgBlMDiUVQbH3EsJTCZ7p9mNs9PXVlIiCDEWuR7qurnYQtFSs7wto6Run86fe wrLQwuO6WpZ1POgb2MD82mYuL+Is6PZMaGKoh8j8oI7yLZjMQttYv9w4rBjEQ/OI nOsfmncuNPh4rkkiaObDwtSSShjIo8/XgV/AgpBY/5wv29nDtOKTFxxezwuQqHu1 d1nwGsf/1cY= =uadc -----END PGP SIGNATURE-----
Jun 03 2007
prev sibling parent Jason House <jason.james.house gmail.com> writes:
Frank Benoit wrote:
 Jason House schrieb:
 Does anyone know if valgrind or similar products can work with D?  If
 so, how?  If not, does anyone know of the next best thing?  (like
 running the GC after every line of code in a particular function?)

I never used valgrind, but i know that there are ppl that use valgrind on linux with D (probably GDC).

I'd be interested in hearing from others who have used valgrind with gdc. It found issues immediately... But it left me scratching my head. It seems like code that should work doesn't in subtle ways. For example, I opened a bug with the gdc project for my simplest example: https://sourceforge.net/tracker/?func=detail&atid=791252&aid=1734477&group_id=154306 In the original code that drove me to experiment with this, the bug was reproducible on many platforms with gdc and never with dmd. I only tested with valgrind on a single system, so I don't know if the valgrind insanity applies to other platforms. I'd like to know if others have had similar issues.
Jun 10 2007
prev sibling parent Regan Heath <regan netmail.co.nz> writes:
Jason House Wrote:
 Does anyone know if valgrind or similar products can work with D?  If 
 so, how?  If not, does anyone know of the next best thing?  (like 
 running the GC after every line of code in a particular function?)
 
 Needless to say, I have a bug that's driving me crazy.  Somewhere fairly 
 late in a loop equivalent to "for (int i=0; i<36100; i++) 
 doSomething();", my program crashes in seemingly normal code with normal 
 state.  doSomething passes all of its unit tests and passes my nieve 
 code inspection.  I could even be looking in the wrong spot since the 
 code is multithreaded...  (but the other threads are stuck in the 
 equivalent of "while(foo()==false) yield;" while waiting for the other 
 thing to finish.  (foo is a very simple function)

I'm looking for a challenge, if you want you can send me the code (my email is valid) and I'll see if I can find the bug. If the code is closed source I'll even promise not to keep it afterwards, or leak it in any way shape or form. Regan Heath
Jun 03 2007