Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Allegro + valgrind / electric fence

Credits go to Trent Gamblin for helping out!
This thread is locked; no one can reply to it. rss feed Print
Allegro + valgrind / electric fence
kdevil
Member #1,075
March 2001
avatar

I'm trying to track down a memory-related bug in my game, but I've found that both valgrind and electric fence don't work with Allegro programs.

This is on Ubuntu 8.04 (if that matters), and this happens when using Allegro 4.2.1 or 4.2.2. Trying to run the Allegro demo under valgrind gives me several errors stemming from _unix_load_modules (Errors like "Invalid read of size 4" and "Address 0x4418d38 is 40 bytes inside a block of size 43 alloc'd"), followed by a segfault.

When I try to run the Allegro demo using electric fence as my memory debugger, I get a near-instant segfault:

1(with unimportant stuff removed)
2 
3gdb demo
4 
5(no debugging symbols found)
6(gdb) efence
7Enabled Electric Fence
8(gdb) run
9Starting program: demo
10(no debugging symbols found)
11[Thread debugging using libthread_db enabled]
12(no debugging symbols found)
13 
14[New Thread 0xb7bee6b0 (LWP 18727)]
15[New Thread 0xb79f5b90 (LWP 18730)]
16[New Thread 0xb68f4b90 (LWP 18731)]
17 
18Program received signal SIGSEGV, Segmentation fault.

Being unable to use either valgrind or electric fence is a bit crippling.

Any idea on how to make Allegro programs work with either of those memory debuggers, or does anyone know of a memory debugger that works with Allegro?

-----
"I am the Black Mage! I casts the spells that makes the peoples fall down!"

Trent Gamblin
Member #261
April 2000
avatar

Compile allegro without asm and valgrind will work.

Paul Pridham
Member #250
April 2000
avatar

kdevil
Member #1,075
March 2001
avatar

Disabling asm did the trick. Valgrind still reports a few errors, but it no longer segfaults, and that's good enough for me. :)

Edit: Thanks, ppridham, I'll also take a look at Fortify.

-----
"I am the Black Mage! I casts the spells that makes the peoples fall down!"

Go to: