|
From: Jeremy F. <je...@go...> - 2003-08-14 17:50:26
|
On Thu, 2003-08-14 at 02:44, Nicholas Nethercote wrote: > On Thu, 14 Aug 2003 ps...@ic... wrote: > > > I would really appreciate a feature being added to detect > > non-aligned access - i.e. could the valgrind VM halt if it > > reads or writes a 2-byte value from an odd address? or > > a 4-byte value from a non-4-aligned address? (or have an > > option to give a warning?) > > > > This is possibly a good feature for others as well - it > > can ensure portability of your code to the SPARC, for > > example. > > It would absolutely have to be an option, since unaligned accesses are > valid on x86. I'm not convinced how useful this would be in general. > > [aside: don't feel bad, if we included every feature ever requested into > Valgrind, it would have about 100 options] Lucky for us, so does the x86. There is a flag you can set in some register or other which makes the CPU trap on unaligned access. So long as we don't do it internally, you could set that and watch all the unaligned accesses in your program (even without Valgrind). J |