The thread entitled SysRes::_valEx on valgrind-developers makes a good warm-up reading. Function VG_(sr_as_string) may also need adjustment.
Created attachment 92378 [details] A possible fix This fixes it. The basic idea is to pass the system call number to sr_EQ (the comparison function for SysRes) so that it can decide whether or not .valEx needs to be considered. A previous attempt that encoded a boolean in the SysRes to indicate validity/non-validity of .valEx failed because there is a place where a SysRes is constructed without the creating syscall number being available. As part of this I made a new version of the SysRes type specifically for mips{32,64}-linux rather than cluttering up the other linux variants with a not-used field. So there is some tidying up too. Tested and believed working on a mips64-linux install on QEMU -- a very slow experience.
(In reply to Julian Seward from comment #1) > Created attachment 92378 [details] > A possible fix > > This fixes it. The basic idea is to pass the system call number to > sr_EQ (the comparison function for SysRes) so that it can decide > whether or not .valEx needs to be considered. A previous attempt that > encoded a boolean in the SysRes to indicate validity/non-validity of > .valEx failed because there is a place where a SysRes is constructed > without the creating syscall number being available. > > As part of this I made a new version of the SysRes type specifically > for mips{32,64}-linux rather than cluttering up the other linux > variants with a not-used field. So there is some tidying up too. > > Tested and believed working on a mips64-linux install on QEMU -- a > very slow experience. Looks good to me. Thank you for working on this.
In pub_tool_basics.h (and likewise in m_syscall.c): I would change the #ifdeffery to have this structure: #ifdef VGO_linux // common code here, e.g. sr_Res etc. // let's keep in common what can be kept in common and not replicate it #if defined(VGP_mips32_linux) || defined(VGP_mips64_linux) // mips stuff here # else // non-mips linux stuff here #endif #elif defined(VGO_darwin) ... #endif That seems like a more natural hierarchy to me. I really do not like to hard code the syscall numbers. This is a bit messy. Instead make sr_EQ forward to, say, VG_(eq_mips_SysRes) which is defined in m_syscall.c
(In reply to Julian Seward from comment #1) > Created attachment 92378 [details] > A possible fix Committed, r15404, with some extra STATIC_ASSERTS to make the hardwired syscall numbers safe. Leaving open so that a better fix can later be landed, if anyone is inspired to do so.