|
From: <sv...@va...> - 2005-05-08 18:35:07
|
Author: njn
Date: 2005-05-08 19:34:59 +0100 (Sun, 08 May 2005)
New Revision: 3641
Removed:
trunk/memcheck/mc_errcontext.c
Modified:
trunk/memcheck/Makefile.am
trunk/memcheck/mc_include.h
trunk/memcheck/mc_main.c
Log:
Moved mc_errcontext.c into mc_main.c, since it was very small and there w=
as
no benefit in having it separate. This allows some exports to be removed
from mc_include.h.
Modified: trunk/memcheck/Makefile.am
=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/Makefile.am 2005-05-08 18:21:15 UTC (rev 3640)
+++ trunk/memcheck/Makefile.am 2005-05-08 18:34:59 UTC (rev 3641)
@@ -17,7 +17,6 @@
mac_leakcheck.c \
mac_malloc_wrappers.c \
mac_needs.c \
- mc_errcontext.c \
mc_main.c \
mc_translate.c
vgtool_memcheck_so_LDFLAGS =3D -shared
Deleted: trunk/memcheck/mc_errcontext.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/mc_errcontext.c 2005-05-08 18:21:15 UTC (rev 3640)
+++ trunk/memcheck/mc_errcontext.c 2005-05-08 18:34:59 UTC (rev 3641)
@@ -1,152 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- Management of memory error messages. ---*/
-/*--- mc_errcontext.c ---*/
-/*--------------------------------------------------------------------*/
-
-/*
- This file is part of MemCheck, a heavyweight Valgrind tool for
- detecting memory errors.
-
- Copyright (C) 2000-2005 Julian Seward=20
- js...@ac...
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
-
- The GNU General Public License is contained in the file COPYING.
-*/
-
-#include "mc_include.h"
-
-/*------------------------------------------------------------*/
-/*--- Printing errors ---*/
-/*------------------------------------------------------------*/
-
-void TL_(pp_Error) ( Error* err )
-{
- MAC_Error* err_extra =3D VG_(get_error_extra)(err);
-
- switch (VG_(get_error_kind)(err)) {
- case CoreMemErr: {
- Char* s =3D ( err_extra->isUnaddr ? "unaddressable" : "uninitia=
lised" );
- VG_(message)(Vg_UserMsg, "%s contains %s byte(s)",=20
- VG_(get_error_string)(err), s);
- VG_(pp_ExeContext)( VG_(get_error_where)(err) );
- break;
- =20
- }=20
- =20
- case ValueErr:
- if (err_extra->size =3D=3D 0) {
- VG_(message)(Vg_UserMsg,
- "Conditional jump or move depends on uninitialised value=
(s)");
- } else {
- VG_(message)(Vg_UserMsg,
- "Use of uninitialised value of size %d",
- err_extra->size);
- }
- VG_(pp_ExeContext)( VG_(get_error_where)(err) );
- break;
-
- case ParamErr: {
- Bool isReg =3D ( Register =3D=3D err_extra->addrinfo.akind );
- Char* s1 =3D ( isReg ? "contains" : "points to" );
- Char* s2 =3D ( err_extra->isUnaddr ? "unaddressable" : "uniniti=
alised" );
- if (isReg) tl_assert(!err_extra->isUnaddr);
-
- VG_(message)(Vg_UserMsg, "Syscall param %s %s %s byte(s)",
- VG_(get_error_string)(err), s1, s2);
-
- VG_(pp_ExeContext)( VG_(get_error_where)(err) );
- MAC_(pp_AddrInfo)(VG_(get_error_address)(err), &err_extra->addr=
info);
- break;
- }
- case UserErr: {
- Char* s =3D ( err_extra->isUnaddr ? "Unaddressable" : "Uninitia=
lised" );
-
- VG_(message)(Vg_UserMsg,=20
- "%s byte(s) found during client check request", s);
-
- VG_(pp_ExeContext)( VG_(get_error_where)(err) );
- MAC_(pp_AddrInfo)(VG_(get_error_address)(err), &err_extra->addr=
info);
- break;
- }
- default:=20
- MAC_(pp_shared_Error)(err);
- break;
- }
-}
-
-/*------------------------------------------------------------*/
-/*--- Recording errors ---*/
-/*------------------------------------------------------------*/
-
-/* Creates a copy of the `extra' part, updates the copy with address inf=
o if
- necessary, and returns the copy. */
-/* This one called from generated code and non-generated code. */
-void MC_(record_value_error) ( ThreadId tid, Int size )
-{
- MAC_Error err_extra;
-
- MAC_(clear_MAC_Error)( &err_extra );
- err_extra.size =3D size;
- err_extra.isUnaddr =3D False;
- VG_(maybe_record_error)( tid, ValueErr, /*addr*/0, /*s*/NULL, &err_ex=
tra );
-}
-
-/* This called from non-generated code */
-
-void MC_(record_user_error) ( ThreadId tid, Addr a, Bool isWrite,
- Bool isUnaddr )
-{
- MAC_Error err_extra;
-
- tl_assert(VG_INVALID_THREADID !=3D tid);
- MAC_(clear_MAC_Error)( &err_extra );
- err_extra.addrinfo.akind =3D Undescribed;
- err_extra.isUnaddr =3D isUnaddr;
- VG_(maybe_record_error)( tid, UserErr, a, /*s*/NULL, &err_extra );
-}
-
-/*------------------------------------------------------------*/
-/*--- Suppressions ---*/
-/*------------------------------------------------------------*/
-
-Bool TL_(recognised_suppression) ( Char* name, Supp* su )
-{
- SuppKind skind;
-
- if (MAC_(shared_recognised_suppression)(name, su))
- return True;
-
- /* Extra suppressions not used by Addrcheck */
- else if (VG_STREQ(name, "Cond")) skind =3D Value0Supp;
- else if (VG_STREQ(name, "Value0")) skind =3D Value0Supp;/* backwards=
compat */
- else if (VG_STREQ(name, "Value1")) skind =3D Value1Supp;
- else if (VG_STREQ(name, "Value2")) skind =3D Value2Supp;
- else if (VG_STREQ(name, "Value4")) skind =3D Value4Supp;
- else if (VG_STREQ(name, "Value8")) skind =3D Value8Supp;
- else if (VG_STREQ(name, "Value16")) skind =3D Value16Supp;
- else=20
- return False;
-
- VG_(set_supp_kind)(su, skind);
- return True;
-}
-
-/*--------------------------------------------------------------------*/
-/*--- end mc_errcontext.c ---*/
-/*--------------------------------------------------------------------*/
Modified: trunk/memcheck/mc_include.h
=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/mc_include.h 2005-05-08 18:21:15 UTC (rev 3640)
+++ trunk/memcheck/mc_include.h 2005-05-08 18:34:59 UTC (rev 3641)
@@ -70,12 +70,6 @@
extern VGA_REGPARM(1) UWord MC_(helperc_LOADV4) ( Addr );
extern VGA_REGPARM(1) ULong MC_(helperc_LOADV8) ( Addr );
=20
-/* Functions defined in mc_errcontext.c */
-extern void MC_(record_value_error) ( ThreadId tid, Int size );
-extern void MC_(record_user_error) ( ThreadId tid, Addr a, Bool isWrit=
e,
- Bool isUnaddr );
-
-
#endif
=20
/*--------------------------------------------------------------------*/
Modified: trunk/memcheck/mc_main.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/mc_main.c 2005-05-08 18:21:15 UTC (rev 3640)
+++ trunk/memcheck/mc_main.c 2005-05-08 18:34:59 UTC (rev 3641)
@@ -1206,6 +1206,122 @@
=20
=20
/*------------------------------------------------------------*/
+/*--- Printing errors ---*/
+/*------------------------------------------------------------*/
+
+void TL_(pp_Error) ( Error* err )
+{
+ MAC_Error* err_extra =3D VG_(get_error_extra)(err);
+
+ switch (VG_(get_error_kind)(err)) {
+ case CoreMemErr: {
+ Char* s =3D ( err_extra->isUnaddr ? "unaddressable" : "uninitia=
lised" );
+ VG_(message)(Vg_UserMsg, "%s contains %s byte(s)",=20
+ VG_(get_error_string)(err), s);
+ VG_(pp_ExeContext)( VG_(get_error_where)(err) );
+ break;
+ =20
+ }=20
+ =20
+ case ValueErr:
+ if (err_extra->size =3D=3D 0) {
+ VG_(message)(Vg_UserMsg,
+ "Conditional jump or move depends on uninitialised value=
(s)");
+ } else {
+ VG_(message)(Vg_UserMsg,
+ "Use of uninitialised value of size %d",
+ err_extra->size);
+ }
+ VG_(pp_ExeContext)( VG_(get_error_where)(err) );
+ break;
+
+ case ParamErr: {
+ Bool isReg =3D ( Register =3D=3D err_extra->addrinfo.akind );
+ Char* s1 =3D ( isReg ? "contains" : "points to" );
+ Char* s2 =3D ( err_extra->isUnaddr ? "unaddressable" : "uniniti=
alised" );
+ if (isReg) tl_assert(!err_extra->isUnaddr);
+
+ VG_(message)(Vg_UserMsg, "Syscall param %s %s %s byte(s)",
+ VG_(get_error_string)(err), s1, s2);
+
+ VG_(pp_ExeContext)( VG_(get_error_where)(err) );
+ MAC_(pp_AddrInfo)(VG_(get_error_address)(err), &err_extra->addr=
info);
+ break;
+ }
+ case UserErr: {
+ Char* s =3D ( err_extra->isUnaddr ? "Unaddressable" : "Uninitia=
lised" );
+
+ VG_(message)(Vg_UserMsg,=20
+ "%s byte(s) found during client check request", s);
+
+ VG_(pp_ExeContext)( VG_(get_error_where)(err) );
+ MAC_(pp_AddrInfo)(VG_(get_error_address)(err), &err_extra->addr=
info);
+ break;
+ }
+ default:=20
+ MAC_(pp_shared_Error)(err);
+ break;
+ }
+}
+
+/*------------------------------------------------------------*/
+/*--- Recording errors ---*/
+/*------------------------------------------------------------*/
+
+/* Creates a copy of the `extra' part, updates the copy with address inf=
o if
+ necessary, and returns the copy. */
+/* This one called from generated code and non-generated code. */
+void mc_record_value_error ( ThreadId tid, Int size )
+{
+ MAC_Error err_extra;
+
+ MAC_(clear_MAC_Error)( &err_extra );
+ err_extra.size =3D size;
+ err_extra.isUnaddr =3D False;
+ VG_(maybe_record_error)( tid, ValueErr, /*addr*/0, /*s*/NULL, &err_ex=
tra );
+}
+
+/* This called from non-generated code */
+
+void mc_record_user_error ( ThreadId tid, Addr a, Bool isWrite,
+ Bool isUnaddr )
+{
+ MAC_Error err_extra;
+
+ tl_assert(VG_INVALID_THREADID !=3D tid);
+ MAC_(clear_MAC_Error)( &err_extra );
+ err_extra.addrinfo.akind =3D Undescribed;
+ err_extra.isUnaddr =3D isUnaddr;
+ VG_(maybe_record_error)( tid, UserErr, a, /*s*/NULL, &err_extra );
+}
+
+/*------------------------------------------------------------*/
+/*--- Suppressions ---*/
+/*------------------------------------------------------------*/
+
+Bool TL_(recognised_suppression) ( Char* name, Supp* su )
+{
+ SuppKind skind;
+
+ if (MAC_(shared_recognised_suppression)(name, su))
+ return True;
+
+ /* Extra suppressions not used by Addrcheck */
+ else if (VG_STREQ(name, "Cond")) skind =3D Value0Supp;
+ else if (VG_STREQ(name, "Value0")) skind =3D Value0Supp;/* backwards=
compat */
+ else if (VG_STREQ(name, "Value1")) skind =3D Value1Supp;
+ else if (VG_STREQ(name, "Value2")) skind =3D Value2Supp;
+ else if (VG_STREQ(name, "Value4")) skind =3D Value4Supp;
+ else if (VG_STREQ(name, "Value8")) skind =3D Value8Supp;
+ else if (VG_STREQ(name, "Value16")) skind =3D Value16Supp;
+ else=20
+ return False;
+
+ VG_(set_supp_kind)(su, skind);
+ return True;
+}
+
+/*------------------------------------------------------------*/
/*--- Functions called directly from generated code: ---*/
/*--- Load/store handlers. ---*/
/*------------------------------------------------------------*/
@@ -1605,27 +1721,27 @@
=20
void MC_(helperc_value_check0_fail) ( void )
{
- MC_(record_value_error) ( VG_(get_running_tid)(), 0 );
+ mc_record_value_error ( VG_(get_running_tid)(), 0 );
}
=20
void MC_(helperc_value_check1_fail) ( void )
{
- MC_(record_value_error) ( VG_(get_running_tid)(), 1 );
+ mc_record_value_error ( VG_(get_running_tid)(), 1 );
}
=20
void MC_(helperc_value_check4_fail) ( void )
{
- MC_(record_value_error) ( VG_(get_running_tid)(), 4 );
+ mc_record_value_error ( VG_(get_running_tid)(), 4 );
}
=20
void MC_(helperc_value_check8_fail) ( void )
{
- MC_(record_value_error) ( VG_(get_running_tid)(), 8 );
+ mc_record_value_error ( VG_(get_running_tid)(), 8 );
}
=20
VGA_REGPARM(1) void MC_(helperc_complain_undef) ( HWord sz )
{
- MC_(record_value_error) ( VG_(get_running_tid)(), (Int)sz );
+ mc_record_value_error ( VG_(get_running_tid)(), (Int)sz );
}
=20
=20
@@ -1687,7 +1803,7 @@
//zz /* setting */
//zz for (i =3D 0; i < szW; i++) {
//zz if (get_vbytes4_ALIGNED( (Addr)&vbits[i] ) !=3D VGM_WORD_V=
ALID)
-//zz MC_(record_value_error)(tid, 4);
+//zz mc_record_value_error(tid, 4);
//zz set_vbytes4_ALIGNED( (Addr)&data[i], vbits[i] );
//zz }
//zz } else {
@@ -2108,8 +2224,8 @@
case VG_USERREQ__CHECK_WRITABLE: /* check writable */
ok =3D mc_check_writable ( arg[1], arg[2], &bad_addr );
if (!ok)
- MC_(record_user_error) ( tid, bad_addr, /*isWrite*/True,
- /*isUnaddr*/True );
+ mc_record_user_error ( tid, bad_addr, /*isWrite*/True,
+ /*isUnaddr*/True );
*ret =3D ok ? (UWord)NULL : bad_addr;
break;
=20
@@ -2117,11 +2233,11 @@
MC_ReadResult res;
res =3D mc_check_readable ( arg[1], arg[2], &bad_addr );
if (MC_AddrErr =3D=3D res)
- MC_(record_user_error) ( tid, bad_addr, /*isWrite*/False,
- /*isUnaddr*/True );
+ mc_record_user_error ( tid, bad_addr, /*isWrite*/False,
+ /*isUnaddr*/True );
else if (MC_ValueErr =3D=3D res)
- MC_(record_user_error) ( tid, bad_addr, /*isWrite*/False,
- /*isUnaddr*/False );
+ mc_record_user_error ( tid, bad_addr, /*isWrite*/False,
+ /*isUnaddr*/False );
*ret =3D ( res=3D=3DMC_Ok ? (UWord)NULL : bad_addr );
break;
}
|