On Wed, 2007-07-04 at 20:20 +0200, Mark Wielaard wrote: > - Testsuite. The best I could come up with for now is TestInstructions > and funit-instructions.c which is a nice little framework for having a > simple assembly instructions labeled in such a way that a 'instruction > address path' can be communicated to the java side so it can do either a > full step through the program or install breakpoints on every > instruction and make sure that every step and/or breakpoint hit takes it > to the right next address. But the assembly part has to be written > completely by hand (and unsurprisingly the simple assembly program > currently used works identically on x86 and x86_64). Trying to reuse the > funit-asm.h generic assembly instructions to make it platform neutral > was really hard especially since the labels used on the C and inline > assembly side have to kept in sync and mixing C defines and asm > statements don't seem to mix very well. Also at the moment it is just > using nops and jmps to keep things simple. I guess that in the end, if > we have real instruction parsers we could try to generate them using > that. Ideas or experiences with setting something up to track individual > instructions and getting the right addresses listed appreciated. I think I know how this can be made way easier. The current setup inserts labels at every instruction. This makes it really hard to combine with the generic funit-asm.h assembly instructions since it introduces 2 layers of macros to write a simple test. And the test has to be marked up fully with the labels and a path through the program that can be checked. But the current setup already shows an easier way to do this. In TestInstructions we already do a full step through the assembly and double check that all the labels are hit in the right order. But this can be turned around. We can first do this full step through the assembly instructions and record all addresses, then we put breakpoints at every instruction that we just past and do another run with the breakpoints inserted that should then run exactly the same as before (except for hitting a breakpoint at every step of course). If we do it that way then we just need the start and end address of the instruction stream and can hopefully completely reuse funit-asm.h as long as the test writer makes sure the program always ends at the same address. I'll try and implement it as above using as much instructions from funit-asm as possible. The only tricky thing is then just coming up with a good/long enough instruction sequence to proof we really handle all those instructions out there. Cheers, Mark