On 09/10/09 14:24, Ralph Corderoy wrote:

On 09/10/09 13:53, Ralph Corderoy wrote:
Because Allegro is used, valgrind and cachegrind can't be used;
Allegro doesn't play nicely with them.  :-(

What's the problem with valgrind and allegro?

     $ valgrind ./rpcemu
     ==9782== Memcheck, a memory error detector.
     ==9782== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
     ==9782== Using LibVEX rev 1804, a library for dynamic binary translation.
     ==9782== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
     ==9782== Using valgrind-3.3.0-Debian, a dynamic binary instrumentation 
framework.
     ==9782== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
     ==9782== For more details, rerun with: -v
     ==9782==
     rpcemu: version=0.8.5 _DEBUG=no DYNAREC=yes
     Shutting down Allegro due to signal #11

Ah. I think that's a rather unhelpful allegro message confusing you...

Allegro has registered a segv handler and prints that message whenever the program hits a segv regardless of who causes it

If you use --trace-signals=yes on valgrind you'll see that the signal is coming from dynamically generated code - the core problem is that valgrind is itself doing dynamic translation and has a cache and if code that it has translated changes it will not notice and it will execute incorrect code.

Ad --smc-check=all to valgrind and it will checksum each block before executing it and retranslate it if it has changed. That will slow things down a lot though.

Better is to add VALGRIND_DISCARD_TRANSLATIONS() calls to the rpcemu code so that it tells valgrind when it has reused a piece of the dynamic code buffer and valgrind will then discard it's cached translations for that area.

I also had to patch my way round one instruction that rcpemu is using in the code it generates that valgrind didn't understand as it wasn't the "normal" encoding for that instruction. I've raised a bug for valgrind to get Julian to fix that:

https://bugs.kde.org/show_bug.cgi?id=209995

Tom

--
Tom Hughes ([email protected])
http://www.compton.nu/

_______________________________________________
Rpcemu mailing list
[email protected]
http://www.riscos.info/cgi-bin/mailman/listinfo/rpcemu

Reply via email to