|
From: <sv...@va...> - 2005-05-08 15:26:06
|
Author: njn
Date: 2005-05-08 16:26:00 +0100 (Sun, 08 May 2005)
New Revision: 3637
Modified:
trunk/memcheck/mac_needs.c
Log:
Add some comments about Param errors, and slightly rewrite a tiny=20
bit of code in a cleaner way.
Modified: trunk/memcheck/mac_needs.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/mac_needs.c 2005-05-08 14:45:13 UTC (rev 3636)
+++ trunk/memcheck/mac_needs.c 2005-05-08 15:26:00 UTC (rev 3637)
@@ -164,12 +164,18 @@
return False;
}
=20
+ // Perhaps we should also check the addrinfo.akinds for equality.
+ // That would result in more error reports, but only in cases wher=
e
+ // a register contains uninitialised bytes and points to memory
+ // containing uninitialised bytes. Currently, the 2nd of those to=
be
+ // detected won't be reported. That is (nearly?) always the memor=
y
+ // error, which is good.
+ case ParamErr:
+ if (0 !=3D VG_(strcmp)(VG_(get_error_string)(e1),
+ VG_(get_error_string)(e2))) return False=
;
+ // fall through
case UserErr:
- case ParamErr:
- if (e1_extra->isUnaddr !=3D e2_extra->isUnaddr) return =
False;
- if (VG_(get_error_kind)(e1) =3D=3D ParamErr=20
- && 0 !=3D VG_(strcmp)(VG_(get_error_string)(e1),
- VG_(get_error_string)(e2))) return Fa=
lse;
+ if (e1_extra->isUnaddr !=3D e2_extra->isUnaddr) return Fal=
se;
return True;
=20
case FreeErr:
@@ -470,12 +476,18 @@
VG_(maybe_record_error)( tid, CoreMemErr, /*addr*/0, msg, &err_extra =
);
}
=20
+// Three kinds of param errors:
+// - register arg contains undefined bytes
+// - memory arg is unaddressable
+// - memory arg contains undefined bytes
+// 'isReg' and 'isUnaddr' dictate which of these it is.
void MAC_(record_param_error) ( ThreadId tid, Addr a, Bool isReg,
Bool isUnaddr, Char* msg )
{
MAC_Error err_extra;
=20
tl_assert(VG_INVALID_THREADID !=3D tid);
+ if (isUnaddr) tl_assert(!isReg); // unaddressable register is impo=
ssible
MAC_(clear_MAC_Error)( &err_extra );
err_extra.addrinfo.akind =3D ( isReg ? Register : Undescribed );
err_extra.isUnaddr =3D isUnaddr;
|