You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
1
(16) |
2
(23) |
3
(15) |
|
4
(19) |
5
(21) |
6
(27) |
7
(18) |
8
(17) |
9
(15) |
10
(11) |
|
11
(9) |
12
(18) |
13
(26) |
14
(28) |
15
(26) |
16
(20) |
17
(27) |
|
18
(16) |
19
(40) |
20
(2) |
21
(11) |
22
(27) |
23
(24) |
24
(16) |
|
25
(10) |
26
(12) |
27
(16) |
28
(7) |
29
(6) |
30
(15) |
31
(5) |
|
From: <sv...@va...> - 2005-12-07 22:20:27
|
Author: sewardj
Date: 2005-12-07 22:20:19 +0000 (Wed, 07 Dec 2005)
New Revision: 5313
Log:
Nasty tri-state hack to avoid looping on libpthread wrappers.
Modified:
branches/FNWRAP/coregrind/m_scheduler/scheduler.c
branches/FNWRAP/coregrind/m_translate.c
branches/FNWRAP/coregrind/vg_preloaded.c
branches/FNWRAP/include/valgrind.h
Modified: branches/FNWRAP/coregrind/m_scheduler/scheduler.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
--- branches/FNWRAP/coregrind/m_scheduler/scheduler.c 2005-12-07 21:07:35=
UTC (rev 5312)
+++ branches/FNWRAP/coregrind/m_scheduler/scheduler.c 2005-12-07 22:20:19=
UTC (rev 5313)
@@ -1033,13 +1033,16 @@
zztid, O_CLREQ_RET, sizeof(UWord), f); \
} while (0)
=20
-#define SET_CLIENT_NRADDR(zztid, zzaddr) \
- do { VG_(threads)[zztid].arch.vex.guest_NRFLAG =3D 1; \
- VG_(threads)[zztid].arch.vex.guest_NRADDR =3D (zzaddr); \
+#define SET_CLIENT_NRFLAG(zztid, zzflag) \
+ do { VG_(threads)[zztid].arch.vex.guest_NRFLAG =3D (zzflag); \
VG_TRACK( post_reg_write, \
Vg_CoreClientReq, zztid, \
offsetof(VexGuestArchState,guest_NRFLAG), \
sizeof(UWord) ); \
+ } while (0)
+
+#define SET_CLIENT_NRADDR(zztid, zzaddr) \
+ do { VG_(threads)[zztid].arch.vex.guest_NRADDR =3D (zzaddr); \
VG_TRACK( post_reg_write, \
Vg_CoreClientReq, zztid, \
offsetof(VexGuestArchState,guest_NRADDR), \
@@ -1048,6 +1051,8 @@
=20
#define GET_CLIENT_NRFLAG(zztid) \
VG_(threads)[zztid].arch.vex.guest_NRFLAG
+#define GET_CLIENT_NRADDR(zztid) \
+ VG_(threads)[zztid].arch.vex.guest_NRADDR
=20
=20
/* ---------------------------------------------------------------------
@@ -1095,14 +1100,51 @@
switch (req_no) {
=20
case VG_USERREQ__PUSH_NRADDR: {
- Addr noredir =3D arg[1];
- if (GET_CLIENT_NRFLAG(tid) !=3D 0) {
- /* The 1-entry stack is full, so we must fail (return 1). */
- SET_CLREQ_RETVAL(tid, 1);
- } else {
- SET_CLIENT_NRADDR(tid, noredir); /* also sets _NRFLAG */
+ Addr nraddr =3D arg[1];
+ UWord do_check =3D arg[2];
+
+ if (do_check) {
+
+ /* This is the normal (safe) case. */
+ switch (GET_CLIENT_NRFLAG(tid)) {
+ case 0:
+ SET_CLIENT_NRFLAG(tid, 1);
+ SET_CLIENT_NRADDR(tid, nraddr);
+ SET_CLREQ_RETVAL(tid, 0);
+ break;
+ case 1:=20
+ case 2:
+ /* The 1-entry stack is full, so we must fail
+ (return 1). */
+ SET_CLREQ_RETVAL(tid, 1);
+ break;
+ default:
+ vg_assert2(0, "VG_USERREQ__PUSH_NRADDR(checked):"
+ " bogus value");
+ }
+
+ } else {
+
+ /* This is the not-normal (unsafe) case. */
+ switch (GET_CLIENT_NRFLAG(tid)) {
+ case 0:
+ SET_CLIENT_NRFLAG(tid, 1);
+ SET_CLIENT_NRADDR(tid, nraddr);
+ break;
+ case 1:=20
+ SET_CLIENT_NRFLAG(tid, 2);
+ break;
+ case 2:
+ break;
+ default:
+ vg_assert2(0, "VG_USERREQ__PUSH_NRADDR(***unchecked***=
):"
+ " bogus value");
+ }
+ /* Unchecked case always succeeds */
SET_CLREQ_RETVAL(tid, 0);
- }
+
+ }
+
break;
}
=20
Modified: branches/FNWRAP/coregrind/m_translate.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
--- branches/FNWRAP/coregrind/m_translate.c 2005-12-07 21:07:35 UTC (rev =
5312)
+++ branches/FNWRAP/coregrind/m_translate.c 2005-12-07 22:20:19 UTC (rev =
5313)
@@ -486,7 +486,8 @@
did_redirect =3D False;
}
=20
- if (redir !=3D orig_addr && VG_(clo_verbosity) >=3D 2) {
+ if (redir !=3D orig_addr=20
+ && (VG_(clo_verbosity) >=3D 2 || VG_(clo_trace_redir))) {
Bool ok;
Char name1[64] =3D "";
Char name2[64] =3D "";
Modified: branches/FNWRAP/coregrind/vg_preloaded.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
--- branches/FNWRAP/coregrind/vg_preloaded.c 2005-12-07 21:07:35 UTC (rev=
5312)
+++ branches/FNWRAP/coregrind/vg_preloaded.c 2005-12-07 22:20:19 UTC (rev=
5313)
@@ -77,10 +77,6 @@
ret_ty VG_REDIRECT_FUNCTION_ZZ(libpthreadZdsoZd0,f)(args); \
ret_ty VG_REDIRECT_FUNCTION_ZZ(libpthreadZdsoZd0,f)(args)
=20
-#define LIBC_FUNC(ret_ty, f, args...) \
- ret_ty VG_REPLACE_FUNCTION(libcZdsoZd6, f)(args); \
- ret_ty VG_REPLACE_FUNCTION(libcZdsoZd6, f)(args)
-
#include <stdio.h>
#include <pthread.h>
=20
@@ -93,8 +89,7 @@
int ret;
fprintf(stderr, "<< pthread_create wrapper"); fflush(stderr);
=20
- VALGRIND_SET_NOREDIR;
- ret =3D pthread_create(thread, attr, start, arg);
+ CALL_ORIG_FN_4_UNCHECKED(ret, pthread_create, thread,attr,start,arg);
=20
fprintf(stderr, " -> %d >>\n", ret);
return ret;
@@ -107,8 +102,7 @@
int ret;
fprintf(stderr, "<< pthread_mxlock %p", mutex); fflush(stderr);
=20
- VALGRIND_SET_NOREDIR;
- ret =3D pthread_mutex_lock(mutex);
+ CALL_ORIG_FN_1_UNCHECKED(ret, pthread_mutex_lock, mutex);
=20
fprintf(stderr, " -> %d >>\n", ret);
return ret;
@@ -121,8 +115,7 @@
int ret;
fprintf(stderr, "<< pthread_mxunlk %p", mutex); fflush(stderr);
=20
- VALGRIND_SET_NOREDIR;
- ret =3D pthread_mutex_unlock(mutex);
+ CALL_ORIG_FN_1_UNCHECKED(ret, pthread_mutex_unlock, mutex);
=20
fprintf(stderr, " -> %d >>\n", ret);
return ret;
Modified: branches/FNWRAP/include/valgrind.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
--- branches/FNWRAP/include/valgrind.h 2005-12-07 21:07:35 UTC (rev 5312)
+++ branches/FNWRAP/include/valgrind.h 2005-12-07 22:20:19 UTC (rev 5313)
@@ -315,17 +315,19 @@
that the next entry by this thread into a redirected translation
whose address is on top of the stack will instead to jump to the
non-redirected version. Returns 0 if success, 1 if failure. */
-#define VALGRIND_PUSH_NRADDR(_qzz_addr) __extension__ \
+#define VALGRIND_PUSH_NRADDR(_qzz_addr,_qzz_check) __extension__ \
({unsigned long _qzz_res; \
VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0/*native result*/, \
VG_USERREQ__PUSH_NRADDR, \
- _qzz_addr, 0, 0, 0); \
+ _qzz_addr, _qzz_check, 0, 0); \
_qzz_res; \
})
+
#define VALGRIND_PUSH_NRADDR_AND_CHECK(_addr) \
+ /* Always use this one -- it's safer. */ \
do { \
extern void exit(int); \
- long _r =3D VALGRIND_PUSH_NRADDR(_addr); \
+ long _r =3D VALGRIND_PUSH_NRADDR(_addr,1); \
if (_r) { \
VALGRIND_PRINTF_BACKTRACE( \
"Valgrind: function wrapping: " \
@@ -333,6 +335,11 @@
exit(1); \
} \
} while (0)
+#define VALGRIND_PUSH_NRADDR_NO_CHECK(_addr) \
+ /* Don't use this. This is a horrible kludge for libpthread. */ \
+ do { \
+ (void) VALGRIND_PUSH_NRADDR(_addr,0); \
+ } while (0)
=20
=20
#ifdef NVALGRIND
@@ -520,9 +527,38 @@
id, start, end, 0); \
}
=20
+/* ---------------------------------------------------------- */
+/* --- Hacky macros for writing function wrappers. --- */
+/* --- XXXXXXX DANGEROUS. DO NOT USE. XXXXXXXXXX --- */
+/* ---------------------------------------------------------- */
=20
-/* --- End-user functions for writing function wrappers. --- */
+#define CALL_ORIG_FN_1_UNCHECKED(lval,fn,arg1) \
+ do { \
+ __typeof__(&(fn)) _fn =3D &(fn); \
+ __typeof__(lval) _lval; \
+ __typeof__(arg1) _arg1 =3D (arg1); \
+ VALGRIND_PUSH_NRADDR_NO_CHECK(_fn); \
+ _lval =3D (*_fn)(_arg1); \
+ lval =3D _lval; \
+ } while (0)
=20
+#define CALL_ORIG_FN_4_UNCHECKED(lval,fn,arg1,arg2,arg3,arg4) \
+ do { \
+ __typeof__(&(fn)) _fn =3D &(fn); \
+ __typeof__(lval) _lval; \
+ __typeof__(arg1) _arg1 =3D (arg1); \
+ __typeof__(arg2) _arg2 =3D (arg2); \
+ __typeof__(arg3) _arg3 =3D (arg3); \
+ __typeof__(arg4) _arg4 =3D (arg4); \
+ VALGRIND_PUSH_NRADDR_NO_CHECK(_fn); \
+ _lval =3D (*_fn)(_arg1,_arg2,_arg3,_arg4); \
+ lval =3D _lval; \
+ } while (0)
+
+/* ---------------------------------------------------------- */
+/* --- End-user functions for writing function wrappers. --- */
+/* ---------------------------------------------------------- */
+
/* Use these to write the name of your wrapper. NOTE: duplicates
VG_REDIRECT_FUNCTION_Z{U,Z} in pub_tool_redir.h. */
=20
@@ -546,7 +582,7 @@
(*_fn)(); \
} while (0)
=20
-/* returns an arg, takes one arg */
+/* returns a value, takes one arg */
#define CALL_ORIG_FN_1(lval,fn,arg1) \
do { \
__typeof__(&(fn)) _fn =3D &(fn); \
@@ -557,4 +593,18 @@
lval =3D _lval; \
} while (0)
=20
+/* returns a value, takes four args */
+#define CALL_ORIG_FN_4(lval,fn,arg1,arg2,arg3,arg4) \
+ do { \
+ __typeof__(&(fn)) _fn =3D &(fn); \
+ __typeof__(lval) _lval; \
+ __typeof__(arg1) _arg1 =3D (arg1); \
+ __typeof__(arg2) _arg2 =3D (arg2); \
+ __typeof__(arg3) _arg3 =3D (arg3); \
+ __typeof__(arg4) _arg4 =3D (arg4); \
+ VALGRIND_PUSH_NRADDR_AND_CHECK(_fn); \
+ _lval =3D (*_fn)(_arg1,_arg2,_arg3,_arg4); \
+ lval =3D _lval; \
+ } while (0)
+
#endif /* __VALGRIND_H */
|
|
From: <sv...@va...> - 2005-12-07 22:19:40
|
Author: sewardj
Date: 2005-12-07 22:19:36 +0000 (Wed, 07 Dec 2005)
New Revision: 1486
Log:
Function wrapping: add tri-state hack to deal with libpthread better.
Modified:
branches/FNWRAP/priv/guest-generic/bb_to_IR.c
Modified: branches/FNWRAP/priv/guest-generic/bb_to_IR.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
--- branches/FNWRAP/priv/guest-generic/bb_to_IR.c 2005-12-07 17:31:42 UTC=
(rev 1485)
+++ branches/FNWRAP/priv/guest-generic/bb_to_IR.c 2005-12-07 22:19:36 UTC=
(rev 1486)
@@ -76,7 +76,22 @@
IRExpr_Unop(Iop_1Uto64,y)));
}
=20
+static IRExpr* mkOr1 ( IRType ty, IRExpr* x, IRExpr* y )
+{
+ vassert(ty =3D=3D Ity_I32 || ty =3D=3D Ity_I64);
+ return=20
+ ty =3D=3D Ity_I32
+ ? IRExpr_Unop(Iop_32to1,
+ IRExpr_Binop(Iop_Or32,
+ IRExpr_Unop(Iop_1Uto32,x),
+ IRExpr_Unop(Iop_1Uto32,y)))
+ : IRExpr_Unop(Iop_64to1,
+ IRExpr_Binop(Iop_Or64,
+ IRExpr_Unop(Iop_1Uto64,x),
+ IRExpr_Unop(Iop_1Uto64,y)));
+}
=20
+
/* Disassemble a complete basic block, starting at guest_IP_start,=20
returning a new IRBB. The disassembler may chase across basic
block boundaries if it wishes and if chase_into_ok allows it.
@@ -179,35 +194,43 @@
if (do_noredir_check) {
/* Create this:
tmp =3D _NRFLAG;
- _NRFLAG =3D 0;
- if (tmp !=3D 0 && _NRADDR =3D=3D guest_IP_bbstart_noredir)
+ _NRFLAG =3D tmp-1;
+ if ( (tmp =3D=3D 1 && _NRADDR =3D=3D guest_IP_bbstart_noredir=
)
+ || tmp =3D=3D 2)
exit, request noredir xfer to guest_IP_bbstart_noredir
_NRFLAG =3D tmp -- restores _NRFLAG to whatever it was
*/
IRTemp tmp =3D newIRTemp(irbb->tyenv, guest_word_type);
- IRExpr* zero =3D guest_word_type=3D=3DIty_I32=20
- ? IRExpr_Const(IRConst_U32(0))=20
- : IRExpr_Const(IRConst_U64(0));
+ IRExpr* one =3D guest_word_type=3D=3DIty_I32=20
+ ? IRExpr_Const(IRConst_U32(1))=20
+ : IRExpr_Const(IRConst_U64(1));
+ IRExpr* two =3D guest_word_type=3D=3DIty_I32=20
+ ? IRExpr_Const(IRConst_U32(2))=20
+ : IRExpr_Const(IRConst_U64(2));
IROp cmpEQ =3D guest_word_type=3D=3DIty_I32 ? Iop_CmpEQ32 : Iop_Cm=
pEQ64;
- IROp cmpNE =3D guest_word_type=3D=3DIty_I32 ? Iop_CmpNE32 : Iop_Cm=
pNE64;
+ IROp opSUB =3D guest_word_type=3D=3DIty_I32 ? Iop_Sub32 : Iop_Sub6=
4;
=20
/* fetch old flag */
addStmtToIRBB( irbb,=20
IRStmt_Tmp( tmp,=20
IRExpr_Get(offB_NRFLAG, guest_word_type)));
- /* zero flag */
+ /* flag-- */
addStmtToIRBB( irbb,
- IRStmt_Put( offB_NRFLAG, zero ));
+ IRStmt_Put( offB_NRFLAG, IRExpr_Binop(opSUB, IRExpr_Tmp(tmp), o=
ne) ));
/* exit, maybe */
addStmtToIRBB( irbb,
- IRStmt_Exit(=20
- mkAnd1( guest_word_type,
- IRExpr_Binop( cmpNE, IRExpr_Tmp(tmp), zero ),
- IRExpr_Binop(=20
- cmpEQ,=20
- IRExpr_Get(offB_NRADDR, guest_word_type),
- IRExpr_Const(guest_IP_bbstart_noredir_IRConst)
- )
+ IRStmt_Exit(
+ mkOr1(
+ guest_word_type,
+ mkAnd1( guest_word_type,
+ IRExpr_Binop( cmpEQ, IRExpr_Tmp(tmp), one ),
+ IRExpr_Binop(=20
+ cmpEQ,=20
+ IRExpr_Get(offB_NRADDR, guest_word_type),
+ IRExpr_Const(guest_IP_bbstart_noredir_IRConst)
+ )
+ ),
+ IRExpr_Binop( cmpEQ, IRExpr_Tmp(tmp), two )
),
Ijk_NoRedir,
guest_IP_bbstart_noredir_IRConst=20
@@ -215,6 +238,7 @@
/* if we didn't exit, now need to restore the flag */
addStmtToIRBB( irbb,
IRStmt_Put( offB_NRFLAG, IRExpr_Tmp(tmp) ));
+
}
=20
/* If asked to make a self-checking translation, leave 5 spaces
|
|
From: <sv...@va...> - 2005-12-07 21:07:52
|
Author: njn Date: 2005-12-07 21:07:35 +0000 (Wed, 07 Dec 2005) New Revision: 5312 Log: Continued folding in code from mac_shared.c, and removed it. Removed: branches/COMPVBITS/memcheck/mac_shared.c Modified: branches/COMPVBITS/memcheck/Makefile.am branches/COMPVBITS/memcheck/mac_leakcheck.c branches/COMPVBITS/memcheck/mac_malloc_wrappers.c branches/COMPVBITS/memcheck/mc_include.h branches/COMPVBITS/memcheck/mc_main.c [... diff too large to include ...] |
|
From: <sv...@va...> - 2005-12-07 17:39:01
|
Author: sewardj
Date: 2005-12-07 17:38:48 +0000 (Wed, 07 Dec 2005)
New Revision: 5311
Log:
Some simple tests for the function wrapping machinery. They work.
Not connected to regtest driver yet tho.
Added:
branches/FNWRAP/memcheck/tests/wrap1.c
branches/FNWRAP/memcheck/tests/wrap2.c
branches/FNWRAP/memcheck/tests/wrap3.c
branches/FNWRAP/memcheck/tests/wrap4.c
branches/FNWRAP/memcheck/tests/wrap5.c
Added: branches/FNWRAP/memcheck/tests/wrap1.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
--- branches/FNWRAP/memcheck/tests/wrap1.c (rev 0=
)
+++ branches/FNWRAP/memcheck/tests/wrap1.c 2005-12-07 17:38:48 UTC (rev 5=
311)
@@ -0,0 +1,33 @@
+
+#include <stdio.h>
+#include "valgrind.h"
+
+/* The simplest possible wrapping test: just call a wrapped function
+ and check we run the wrapper instead. */
+
+/* The "original" function */
+void actual ( void )
+{
+ printf("in actual\n");
+}
+
+/* The wrapper. Since this executable won't have a soname, we have to
+ use "NONE", since V treats any executable/.so which lacks a soname
+ as if its soname was "NONE". */
+void I_REPLACE_SONAME_FNNAME_ZU(NONE,actual) ( void )
+{
+ printf("wrapper-pre\n");
+
+ CALL_ORIG_VOIDFN_0(actual);
+
+ printf("wrapper-post\n");
+}
+
+/* --------------- */
+
+int main ( void )
+{
+ printf("starting\n");
+ actual();
+ return 0;
+}
Added: branches/FNWRAP/memcheck/tests/wrap2.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
--- branches/FNWRAP/memcheck/tests/wrap2.c (rev 0=
)
+++ branches/FNWRAP/memcheck/tests/wrap2.c 2005-12-07 17:38:48 UTC (rev 5=
311)
@@ -0,0 +1,34 @@
+
+#include <stdio.h>
+#include "valgrind.h"
+
+/* Check that function wrapping works for a recursive function. */
+
+/* This is needed to stop gcc4 turning 'fact' into a loop */
+__attribute__((noinline))
+int mul ( int x, int y ) { return x * y; }
+
+int fact ( int n )
+{
+ if (n =3D=3D 0) return 1; else return mul(n, fact(n-1));
+}
+
+int I_REPLACE_SONAME_FNNAME_ZU(NONE,fact) ( int n )
+{
+ int r;
+ printf("in wrapper1-pre: fact(%d)\n", n);
+ CALL_ORIG_FN_1(r,fact,n);
+ printf("in wrapper1-post: fact(%d) =3D %d\n", n, r);
+ return r;
+}
+
+/* --------------- */
+
+int main ( void )
+{
+ int r;
+ printf("computing fact(5)\n");
+ r =3D fact(5);
+ printf("fact(5) =3D %d\n", r);
+ return 0;
+}
Added: branches/FNWRAP/memcheck/tests/wrap3.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
--- branches/FNWRAP/memcheck/tests/wrap3.c (rev 0=
)
+++ branches/FNWRAP/memcheck/tests/wrap3.c 2005-12-07 17:38:48 UTC (rev 5=
311)
@@ -0,0 +1,52 @@
+
+#include <stdio.h>
+#include "valgrind.h"
+
+/* Check that function wrapping works for a mutually recursive
+ pair. */
+
+static int fact1 ( int n );
+static int fact2 ( int n );
+
+/* This is needed to stop gcc4 turning 'fact' into a loop */
+__attribute__((noinline))
+int mul ( int x, int y ) { return x * y; }
+
+int fact1 ( int n )
+{
+ if (n =3D=3D 0) return 1; else return mul(n, fact2(n-1));
+}
+int fact2 ( int n )
+{
+ if (n =3D=3D 0) return 1; else return mul(n, fact1(n-1));
+}
+
+
+int I_REPLACE_SONAME_FNNAME_ZU(NONE,fact1) ( int n )
+{
+ int r;
+ printf("in wrapper1-pre: fact(%d)\n", n);
+ CALL_ORIG_FN_1(r,fact1,n);
+ printf("in wrapper1-post: fact(%d) =3D %d\n", n, r);
+ return r;
+}
+
+int I_REPLACE_SONAME_FNNAME_ZU(NONE,fact2) ( int n )
+{
+ int r;
+ printf("in wrapper2-pre: fact(%d)\n", n);
+ CALL_ORIG_FN_1(r,fact2,n);
+ printf("in wrapper2-post: fact(%d) =3D %d\n", n, r);
+ return r;
+}
+
+/* --------------- */
+
+int main ( void )
+{
+ int r;
+ printf("computing fact1(5)\n");
+ r =3D fact1(5);
+ printf("fact1(5) =3D %d\n", r);
+ return 0;
+}
Added: branches/FNWRAP/memcheck/tests/wrap4.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
--- branches/FNWRAP/memcheck/tests/wrap4.c (rev 0=
)
+++ branches/FNWRAP/memcheck/tests/wrap4.c 2005-12-07 17:38:48 UTC (rev 5=
311)
@@ -0,0 +1,57 @@
+
+#include <stdio.h>
+#include "valgrind.h"
+
+/* Check that it's safe to call a wrapped function from some other
+ function's wrapper. Note that because the wrapper for fact1
+ actually interferes with the computation of the result, this
+ program produces a different answer when run on V (162) from
+ natively (120).
+*/
+
+static int fact1 ( int n );
+static int fact2 ( int n );
+
+/* This is needed to stop gcc4 turning 'fact' into a loop */
+__attribute__((noinline))
+int mul ( int x, int y ) { return x * y; }
+
+int fact1 ( int n )
+{
+ if (n =3D=3D 0) return 1; else return mul(n, fact2(n-1));
+}
+int fact2 ( int n )
+{
+ if (n =3D=3D 0) return 1; else return mul(n, fact1(n-1));
+}
+
+
+int I_REPLACE_SONAME_FNNAME_ZU(NONE,fact1) ( int n )
+{
+ int r;
+ printf("in wrapper1-pre: fact(%d)\n", n);
+ CALL_ORIG_FN_1(r,fact1,n);
+ printf("in wrapper1-post: fact(%d) =3D %d\n", n, r);
+ if (n >=3D 3) r +=3D fact2(2);
+ return r;
+}
+
+int I_REPLACE_SONAME_FNNAME_ZU(NONE,fact2) ( int n )
+{
+ int r;
+ printf("in wrapper2-pre: fact(%d)\n", n);
+ CALL_ORIG_FN_1(r,fact2,n);
+ printf("in wrapper2-post: fact(%d) =3D %d\n", n, r);
+ return r;
+}
+
+/* --------------- */
+
+int main ( void )
+{
+ int r;
+ printf("computing fact1(5)\n");
+ r =3D fact1(5);
+ printf("fact1(5) =3D %d\n", r);
+ return 0;
+}
Added: branches/FNWRAP/memcheck/tests/wrap5.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
--- branches/FNWRAP/memcheck/tests/wrap5.c (rev 0=
)
+++ branches/FNWRAP/memcheck/tests/wrap5.c 2005-12-07 17:38:48 UTC (rev 5=
311)
@@ -0,0 +1,91 @@
+
+#include <stdio.h>
+#include <malloc.h>
+#include "valgrind.h"
+
+/* As wrap4.c, but also throw in various calls to another redirected
+ function (malloc) to check that that doesn't screw anything up.
+*/
+
+typedef=20
+ struct _Lard {
+ struct _Lard* next;=20
+ char stuff[999];=20
+ }
+ Lard;
+
+Lard* lard =3D NULL;
+static int ctr =3D 0;
+
+void addMoreLard ( void )
+{
+ Lard* p;
+ ctr++;
+ if ((ctr % 3) =3D=3D 1) {
+ p =3D malloc(sizeof(Lard));
+ p->next =3D lard;
+ lard =3D p;
+ }
+}
+
+
+static int fact1 ( int n );
+static int fact2 ( int n );
+
+/* This is needed to stop gcc4 turning 'fact' into a loop */
+__attribute__((noinline))
+int mul ( int x, int y ) { return x * y; }
+
+int fact1 ( int n )
+{
+ addMoreLard();
+ if (n =3D=3D 0) return 1; else return mul(n, fact2(n-1));
+}
+int fact2 ( int n )
+{
+ addMoreLard();
+ if (n =3D=3D 0) return 1; else return mul(n, fact1(n-1));
+}
+
+
+int I_REPLACE_SONAME_FNNAME_ZU(NONE,fact1) ( int n )
+{
+ int r;
+ printf("in wrapper1-pre: fact(%d)\n", n);
+ addMoreLard();
+ CALL_ORIG_FN_1(r,fact1,n);
+ addMoreLard();
+ printf("in wrapper1-post: fact(%d) =3D %d\n", n, r);
+ if (n >=3D 3) r +=3D fact2(2);
+ return r;
+}
+
+int I_REPLACE_SONAME_FNNAME_ZU(NONE,fact2) ( int n )
+{
+ int r;
+ printf("in wrapper2-pre: fact(%d)\n", n);
+ addMoreLard();
+ CALL_ORIG_FN_1(r,fact2,n);
+ addMoreLard();
+ printf("in wrapper2-post: fact(%d) =3D %d\n", n, r);
+ return r;
+}
+
+/* --------------- */
+
+int main ( void )
+{
+ int r;
+ Lard *p, *p_next;
+ printf("computing fact1(7)\n");
+ r =3D fact1(7);
+ printf("fact1(7) =3D %d\n", r);
+
+ printf("allocated %d Lards\n", ctr);
+ for (p =3D lard; p; p =3D p_next) {
+ p_next =3D p->next;
+ free(p);
+ }
+
+ return 0;
+}
|
|
From: <sv...@va...> - 2005-12-07 17:37:14
|
Author: sewardj
Date: 2005-12-07 17:36:55 +0000 (Wed, 07 Dec 2005)
New Revision: 5310
Log:
- Track changes in redir support in vex r1485. =20
- start to add some macros to valgrind.h to be used for end-users to
write wrappers conveniently
Modified:
branches/FNWRAP/coregrind/m_scheduler/scheduler.c
branches/FNWRAP/include/pub_tool_redir.h
branches/FNWRAP/include/valgrind.h
Modified: branches/FNWRAP/coregrind/m_scheduler/scheduler.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
--- branches/FNWRAP/coregrind/m_scheduler/scheduler.c 2005-12-07 00:55:14=
UTC (rev 5309)
+++ branches/FNWRAP/coregrind/m_scheduler/scheduler.c 2005-12-07 17:36:55=
UTC (rev 5310)
@@ -1033,14 +1033,23 @@
zztid, O_CLREQ_RET, sizeof(UWord), f); \
} while (0)
=20
-#define SET_CLIENT_NOREDIR(zztid, zzval) \
- do { VG_(threads)[zztid].arch.vex.guest_NOREDIR =3D 1; \
+#define SET_CLIENT_NRADDR(zztid, zzaddr) \
+ do { VG_(threads)[zztid].arch.vex.guest_NRFLAG =3D 1; \
+ VG_(threads)[zztid].arch.vex.guest_NRADDR =3D (zzaddr); \
VG_TRACK( post_reg_write, \
Vg_CoreClientReq, zztid, \
- offsetof(VexGuestArchState,guest_NOREDIR), \
+ offsetof(VexGuestArchState,guest_NRFLAG), \
sizeof(UWord) ); \
+ VG_TRACK( post_reg_write, \
+ Vg_CoreClientReq, zztid, \
+ offsetof(VexGuestArchState,guest_NRADDR), \
+ sizeof(UWord) ); \
} while (0)
=20
+#define GET_CLIENT_NRFLAG(zztid) \
+ VG_(threads)[zztid].arch.vex.guest_NRFLAG
+
+
/* ---------------------------------------------------------------------
Handle client requests.
------------------------------------------------------------------ */
@@ -1085,10 +1094,17 @@
VG_(printf)("req no =3D 0x%llx, arg =3D %p\n", (ULong)req_no, arg)=
;
switch (req_no) {
=20
- case VG_USERREQ__SET_NOREDIR:
- SET_CLIENT_NOREDIR(tid, 1);
- SET_CLREQ_RETVAL(tid, 0);
+ case VG_USERREQ__PUSH_NRADDR: {
+ Addr noredir =3D arg[1];
+ if (GET_CLIENT_NRFLAG(tid) !=3D 0) {
+ /* The 1-entry stack is full, so we must fail (return 1). */
+ SET_CLREQ_RETVAL(tid, 1);
+ } else {
+ SET_CLIENT_NRADDR(tid, noredir); /* also sets _NRFLAG */
+ SET_CLREQ_RETVAL(tid, 0);
+ }
break;
+ }
=20
case VG_USERREQ__CLIENT_CALL0: {
UWord (*f)(ThreadId) =3D (void*)arg[1];
Modified: branches/FNWRAP/include/pub_tool_redir.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
--- branches/FNWRAP/include/pub_tool_redir.h 2005-12-07 00:55:14 UTC (rev=
5309)
+++ branches/FNWRAP/include/pub_tool_redir.h 2005-12-07 17:36:55 UTC (rev=
5310)
@@ -110,8 +110,9 @@
Everything else is left unchanged.
*/
=20
-/* If you change these, the code in VG_(maybe_Z_demangle) needs to
- be changed accordingly. */
+/* If you change these, the code in VG_(maybe_Z_demangle) needs to be
+ changed accordingly. NOTE: duplicates
+ I_REPLACE_SONAME_FNNAME_Z{U,Z} in valgrind.h. */
#define VG_REDIRECT_FUNCTION_ZU(soname,fnname) _vgrZU_##soname##_##fnnam=
e
#define VG_REDIRECT_FUNCTION_ZZ(soname,fnname) _vgrZZ_##soname##_##fnnam=
e
=20
Modified: branches/FNWRAP/include/valgrind.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
--- branches/FNWRAP/include/valgrind.h 2005-12-07 00:55:14 UTC (rev 5309)
+++ branches/FNWRAP/include/valgrind.h 2005-12-07 17:36:55 UTC (rev 5310)
@@ -248,7 +248,7 @@
typedef
enum { VG_USERREQ__RUNNING_ON_VALGRIND =3D 0x1001,
VG_USERREQ__DISCARD_TRANSLATIONS =3D 0x1002,
- VG_USERREQ__SET_NOREDIR =3D 0x1003,
+ VG_USERREQ__PUSH_NRADDR =3D 0x1003,
=20
/* These allow any function to be called from the
simulated CPU but run on the real CPU.
@@ -311,19 +311,30 @@
_qzz_addr, _qzz_len, 0, 0); \
}
=20
-/* Sets this thread's guest_NOREDIR register to 1, so that the next
- entry by this thread into a redirected translation will cause it
- instead to jump to the non-redirected version. */
-#define VALGRIND_SET_NOREDIR __extension__ \
- ({unsigned int _qzz_res; \
- VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, \
- VG_USERREQ__SET_NOREDIR, \
- 0, 0, 0, 0); \
- _qzz_res; \
+/* Push an address onto this thread's stack of noredir addresses, so
+ that the next entry by this thread into a redirected translation
+ whose address is on top of the stack will instead to jump to the
+ non-redirected version. Returns 0 if success, 1 if failure. */
+#define VALGRIND_PUSH_NRADDR(_qzz_addr) __extension__ \
+ ({unsigned long _qzz_res; \
+ VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0/*native result*/, \
+ VG_USERREQ__PUSH_NRADDR, \
+ _qzz_addr, 0, 0, 0); \
+ _qzz_res; \
})
+#define VALGRIND_PUSH_NRADDR_AND_CHECK(_addr) \
+ do { \
+ extern void exit(int); \
+ long _r =3D VALGRIND_PUSH_NRADDR(_addr); \
+ if (_r) { \
+ VALGRIND_PRINTF_BACKTRACE( \
+ "Valgrind: function wrapping: " \
+ "redirect stack is full. Program halted."); \
+ exit(1); \
+ } \
+ } while (0)
=20
=20
-
#ifdef NVALGRIND
=20
#define VALGRIND_PRINTF(...)
@@ -509,4 +520,41 @@
id, start, end, 0); \
}
=20
+
+/* --- End-user functions for writing function wrappers. --- */
+
+/* Use these to write the name of your wrapper. NOTE: duplicates
+ VG_REDIRECT_FUNCTION_Z{U,Z} in pub_tool_redir.h. */
+
+#define I_REPLACE_SONAME_FNNAME_ZU(soname,fnname) \
+ _vgrZU_##soname##_##fnname
+
+#define I_REPLACE_SONAME_FNNAME_ZZ(soname,fnname) \
+ _vgrZZ_##soname##_##fnname
+
+/* Use these inside the wrapper, to make calls to the function you are
+ wrapping. You must use these - calling originals directly will get
+ you a redirect-stack overflow in short order. Also, these force
+ evaluation of all args before pushing the noredir-address, which is
+ needed to make things work reliably.*/
+
+/* returns void, takes zero args */
+#define CALL_ORIG_VOIDFN_0(fn) \
+ do { \
+ __typeof__(&(fn)) _fn =3D &(fn); \
+ VALGRIND_PUSH_NRADDR_AND_CHECK(_fn); \
+ (*_fn)(); \
+ } while (0)
+
+/* returns an arg, takes one arg */
+#define CALL_ORIG_FN_1(lval,fn,arg1) \
+ do { \
+ __typeof__(&(fn)) _fn =3D &(fn); \
+ __typeof__(lval) _lval; \
+ __typeof__(arg1) _arg1 =3D (arg1); \
+ VALGRIND_PUSH_NRADDR_AND_CHECK(_fn); \
+ _lval =3D (*_fn)(_arg1); \
+ lval =3D _lval; \
+ } while (0)
+
#endif /* __VALGRIND_H */
|
|
From: <sv...@va...> - 2005-12-07 17:31:53
|
Author: sewardj
Date: 2005-12-07 17:31:42 +0000 (Wed, 07 Dec 2005)
New Revision: 1485
Log:
Change the redirect hacks so as to implement a 1-entry no-redirect
stack, which is the simplest arrangement that makes any sense.
Modified:
branches/FNWRAP/priv/guest-amd64/ghelpers.c
branches/FNWRAP/priv/guest-generic/bb_to_IR.c
branches/FNWRAP/priv/guest-generic/bb_to_IR.h
branches/FNWRAP/priv/guest-ppc32/ghelpers.c
branches/FNWRAP/priv/guest-x86/ghelpers.c
branches/FNWRAP/priv/main/vex_main.c
branches/FNWRAP/pub/libvex.h
branches/FNWRAP/pub/libvex_guest_amd64.h
branches/FNWRAP/pub/libvex_guest_ppc32.h
branches/FNWRAP/pub/libvex_guest_x86.h
Modified: branches/FNWRAP/priv/guest-amd64/ghelpers.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
--- branches/FNWRAP/priv/guest-amd64/ghelpers.c 2005-12-06 19:11:02 UTC (=
rev 1484)
+++ branches/FNWRAP/priv/guest-amd64/ghelpers.c 2005-12-07 17:31:42 UTC (=
rev 1485)
@@ -1930,6 +1930,9 @@
initialise them anyway. */
vex_state->guest_TISTART =3D 0;
vex_state->guest_TILEN =3D 0;
+
+ vex_state->guest_NRFLAG =3D 0;
+ vex_state->guest_NRADDR =3D 0;
}
=20
=20
Modified: branches/FNWRAP/priv/guest-generic/bb_to_IR.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
--- branches/FNWRAP/priv/guest-generic/bb_to_IR.c 2005-12-06 19:11:02 UTC=
(rev 1484)
+++ branches/FNWRAP/priv/guest-generic/bb_to_IR.c 2005-12-07 17:31:42 UTC=
(rev 1485)
@@ -57,6 +57,26 @@
static UInt genericg_compute_adler32 ( HWord addr, HWord len );
=20
=20
+/* Small helpers */
+
+static Bool const_False ( Addr64 a ) { return False; }
+
+static IRExpr* mkAnd1 ( IRType ty, IRExpr* x, IRExpr* y )
+{
+ vassert(ty =3D=3D Ity_I32 || ty =3D=3D Ity_I64);
+ return=20
+ ty =3D=3D Ity_I32
+ ? IRExpr_Unop(Iop_32to1,
+ IRExpr_Binop(Iop_And32,
+ IRExpr_Unop(Iop_1Uto32,x),
+ IRExpr_Unop(Iop_1Uto32,y)))
+ : IRExpr_Unop(Iop_64to1,
+ IRExpr_Binop(Iop_And64,
+ IRExpr_Unop(Iop_1Uto64,x),
+ IRExpr_Unop(Iop_1Uto64,y)));
+}
+
+
/* Disassemble a complete basic block, starting at guest_IP_start,=20
returning a new IRBB. The disassembler may chase across basic
block boundaries if it wishes and if chase_into_ok allows it.
@@ -76,8 +96,6 @@
without knowing what it is, those offsets have to passed in.
*/
=20
-static Bool const_False ( Addr64 a ) { return False; }
-
IRBB* bb_to_IR ( /*OUT*/VexGuestExtents* vge,
/*IN*/ DisOneInstrFn dis_instr_fn,
/*IN*/ UChar* guest_code,
@@ -91,7 +109,8 @@
/*IN*/ Bool do_noredir_check,
/*IN*/ Int offB_TISTART,
/*IN*/ Int offB_TILEN,
- /*IN*/ Int offB_NOREDIR )
+ /*IN*/ Int offB_NRFLAG,
+ /*IN*/ Int offB_NRADDR )
{
Long delta;
Int i, n_instrs, first_stmt_idx;
@@ -158,27 +177,47 @@
whether the translation is still valid once we've decided we
should be here. So the noredir check comes first. */
if (do_noredir_check) {
- IRTemp noredir_tmp =3D newIRTemp(irbb->tyenv, guest_word_type);
+ /* Create this:
+ tmp =3D _NRFLAG;
+ _NRFLAG =3D 0;
+ if (tmp !=3D 0 && _NRADDR =3D=3D guest_IP_bbstart_noredir)
+ exit, request noredir xfer to guest_IP_bbstart_noredir
+ _NRFLAG =3D tmp -- restores _NRFLAG to whatever it was
+ */
+ IRTemp tmp =3D newIRTemp(irbb->tyenv, guest_word_type);
IRExpr* zero =3D guest_word_type=3D=3DIty_I32=20
? IRExpr_Const(IRConst_U32(0))=20
: IRExpr_Const(IRConst_U64(0));
+ IROp cmpEQ =3D guest_word_type=3D=3DIty_I32 ? Iop_CmpEQ32 : Iop_Cm=
pEQ64;
IROp cmpNE =3D guest_word_type=3D=3DIty_I32 ? Iop_CmpNE32 : Iop_Cm=
pNE64;
=20
- /* fetch old setting */
+ /* fetch old flag */
addStmtToIRBB( irbb,=20
- IRStmt_Tmp( noredir_tmp,=20
- IRExpr_Get( offB_NOREDIR, guest_word_type)));
- /* zero it */
+ IRStmt_Tmp( tmp,=20
+ IRExpr_Get(offB_NRFLAG, guest_word_type)));
+ /* zero flag */
addStmtToIRBB( irbb,
- IRStmt_Put( offB_NOREDIR, zero ));
- /* exit if it wasn't zero */
+ IRStmt_Put( offB_NRFLAG, zero ));
+ /* exit, maybe */
addStmtToIRBB( irbb,
- IRStmt_Exit( IRExpr_Binop( cmpNE, IRExpr_Tmp(noredir_tmp), zero=
),
- Ijk_NoRedir,
- guest_IP_bbstart_noredir_IRConst ));
+ IRStmt_Exit(=20
+ mkAnd1( guest_word_type,
+ IRExpr_Binop( cmpNE, IRExpr_Tmp(tmp), zero ),
+ IRExpr_Binop(=20
+ cmpEQ,=20
+ IRExpr_Get(offB_NRADDR, guest_word_type),
+ IRExpr_Const(guest_IP_bbstart_noredir_IRConst)
+ )
+ ),
+ Ijk_NoRedir,
+ guest_IP_bbstart_noredir_IRConst=20
+ ));
+ /* if we didn't exit, now need to restore the flag */
+ addStmtToIRBB( irbb,
+ IRStmt_Put( offB_NRFLAG, IRExpr_Tmp(tmp) ));
}
=20
- /* If asked to make a self-checking translation, leave a 5 spaces
+ /* If asked to make a self-checking translation, leave 5 spaces
in which to put the check statements. We'll fill them in later
when we know the length and adler32 of the area to check. */
if (do_self_check) {
Modified: branches/FNWRAP/priv/guest-generic/bb_to_IR.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
--- branches/FNWRAP/priv/guest-generic/bb_to_IR.h 2005-12-06 19:11:02 UTC=
(rev 1484)
+++ branches/FNWRAP/priv/guest-generic/bb_to_IR.h 2005-12-07 17:31:42 UTC=
(rev 1485)
@@ -163,7 +163,8 @@
/*IN*/ Bool do_noredir_check,
/*IN*/ Int offB_TISTART,
/*IN*/ Int offB_TILEN,
- /*IN*/ Int offB_NOREDIR );
+ /*IN*/ Int offB_NRFLAG,
+ /*IN*/ Int offB_NRADDR );
=20
=20
#endif /* ndef GENERIC_BB_TO_IR_H */
Modified: branches/FNWRAP/priv/guest-ppc32/ghelpers.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
--- branches/FNWRAP/priv/guest-ppc32/ghelpers.c 2005-12-06 19:11:02 UTC (=
rev 1484)
+++ branches/FNWRAP/priv/guest-ppc32/ghelpers.c 2005-12-07 17:31:42 UTC (=
rev 1485)
@@ -413,10 +413,13 @@
=20
vex_state->guest_EMWARN =3D EmWarn_NONE;
=20
+ vex_state->guest_RESVN =3D 0;
+
vex_state->guest_TISTART =3D 0;
vex_state->guest_TILEN =3D 0;
=20
- vex_state->guest_RESVN =3D 0;
+ vex_state->guest_NRFLAG =3D 0;
+ vex_state->guest_NRADDR =3D 0;
}
=20
=20
@@ -561,10 +564,13 @@
=20
vex_state->guest_EMWARN =3D EmWarn_NONE;
=20
+ vex_state->guest_RESVN =3D 0;
+
vex_state->guest_TISTART =3D 0;
vex_state->guest_TILEN =3D 0;
=20
- vex_state->guest_RESVN =3D 0;
+ // vex_state->guest_NRFLAG =3D 0;
+ //vex_state->guest_NRADDR =3D 0;
}
=20
=20
Modified: branches/FNWRAP/priv/guest-x86/ghelpers.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
--- branches/FNWRAP/priv/guest-x86/ghelpers.c 2005-12-06 19:11:02 UTC (re=
v 1484)
+++ branches/FNWRAP/priv/guest-x86/ghelpers.c 2005-12-07 17:31:42 UTC (re=
v 1485)
@@ -2226,7 +2226,8 @@
vex_state->guest_TISTART =3D 0;
vex_state->guest_TILEN =3D 0;
=20
- vex_state->guest_NOREDIR =3D 0;
+ vex_state->guest_NRFLAG =3D 0;
+ vex_state->guest_NRADDR =3D 0;
}
=20
=20
Modified: branches/FNWRAP/priv/main/vex_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
--- branches/FNWRAP/priv/main/vex_main.c 2005-12-06 19:11:02 UTC (rev 148=
4)
+++ branches/FNWRAP/priv/main/vex_main.c 2005-12-07 17:31:42 UTC (rev 148=
5)
@@ -237,7 +237,8 @@
HInstrArray* vcode;
HInstrArray* rcode;
Int i, j, k, out_used, guest_sizeB;
- Int offB_TISTART, offB_TILEN, offB_NOREDIR;
+ Int offB_TISTART, offB_TILEN;
+ Int offB_NRFLAG, offB_NRADDR;
UChar insn_bytes[32];
IRType guest_word_type;
IRType host_word_type;
@@ -261,7 +262,8 @@
host_word_type =3D Ity_INVALID;
offB_TISTART =3D 0;
offB_TILEN =3D 0;
- offB_NOREDIR =3D 0;
+ offB_NRFLAG =3D 0;
+ offB_NRADDR =3D 0;
=20
vex_traceflags =3D traceflags;
=20
@@ -345,14 +347,16 @@
guest_layout =3D &x86guest_layout;
offB_TISTART =3D offsetof(VexGuestX86State,guest_TISTART);
offB_TILEN =3D offsetof(VexGuestX86State,guest_TILEN);
- offB_NOREDIR =3D offsetof(VexGuestX86State,guest_NOREDIR);
+ offB_NRFLAG =3D offsetof(VexGuestX86State,guest_NRFLAG);
+ offB_NRADDR =3D offsetof(VexGuestX86State,guest_NRADDR);
vassert(archinfo_guest->subarch =3D=3D VexSubArchX86_sse0
|| archinfo_guest->subarch =3D=3D VexSubArchX86_sse1
|| archinfo_guest->subarch =3D=3D VexSubArchX86_sse2);
vassert(0 =3D=3D sizeof(VexGuestX86State) % 8);
- vassert(sizeof( ((VexGuestX86State*)0)->guest_TISTART ) =3D=3D =
4);
- vassert(sizeof( ((VexGuestX86State*)0)->guest_TILEN ) =3D=3D =
4);
- vassert(sizeof( ((VexGuestX86State*)0)->guest_NOREDIR ) =3D=3D =
4);
+ vassert(sizeof( ((VexGuestX86State*)0)->guest_TISTART) =3D=3D 4=
);
+ vassert(sizeof( ((VexGuestX86State*)0)->guest_TILEN ) =3D=3D 4=
);
+ vassert(sizeof( ((VexGuestX86State*)0)->guest_NRFLAG ) =3D=3D 4=
);
+ vassert(sizeof( ((VexGuestX86State*)0)->guest_NRADDR ) =3D=3D 4=
);
break;
=20
case VexArchAMD64:
@@ -364,12 +368,14 @@
guest_layout =3D &amd64guest_layout;
offB_TISTART =3D offsetof(VexGuestAMD64State,guest_TISTART)=
;
offB_TILEN =3D offsetof(VexGuestAMD64State,guest_TILEN);
- offB_NOREDIR =3D offsetof(VexGuestAMD64State,guest_NOREDIR)=
;
+ offB_NRFLAG =3D offsetof(VexGuestAMD64State,guest_NRFLAG);
+ offB_NRADDR =3D offsetof(VexGuestAMD64State,guest_NRADDR);
vassert(archinfo_guest->subarch =3D=3D VexSubArch_NONE);
vassert(0 =3D=3D sizeof(VexGuestAMD64State) % 8);
vassert(sizeof( ((VexGuestAMD64State*)0)->guest_TISTART ) =3D=3D=
8);
vassert(sizeof( ((VexGuestAMD64State*)0)->guest_TILEN ) =3D=3D=
8);
- vassert(sizeof( ((VexGuestAMD64State*)0)->guest_NOREDIR ) =3D=3D=
8);
+ vassert(sizeof( ((VexGuestAMD64State*)0)->guest_NRFLAG ) =3D=3D=
8);
+ vassert(sizeof( ((VexGuestAMD64State*)0)->guest_NRADDR ) =3D=3D=
8);
break;
=20
case VexArchARM:
@@ -381,7 +387,8 @@
guest_layout =3D &armGuest_layout;
offB_TISTART =3D 0; /* hack ... arm has bitrot */
offB_TILEN =3D 0; /* hack ... arm has bitrot */
- offB_NOREDIR =3D 0; /* hack ... arm has bitrot */
+ offB_NRFLAG =3D 0; /* hack ... arm has bitrot */
+ offB_NRADDR =3D 0; /* hack ... arm has bitrot */
vassert(archinfo_guest->subarch =3D=3D VexSubArchARM_v4);
break;
=20
@@ -394,14 +401,16 @@
guest_layout =3D &ppc32Guest_layout;
offB_TISTART =3D offsetof(VexGuestPPC32State,guest_TISTART)=
;
offB_TILEN =3D offsetof(VexGuestPPC32State,guest_TILEN);
- offB_NOREDIR =3D offsetof(VexGuestPPC32State,guest_NOREDIR)=
;
+ offB_NRFLAG =3D offsetof(VexGuestPPC32State,guest_NRFLAG);
+ offB_NRADDR =3D offsetof(VexGuestPPC32State,guest_NRADDR);
vassert(archinfo_guest->subarch =3D=3D VexSubArchPPC32_I
|| archinfo_guest->subarch =3D=3D VexSubArchPPC32_FI
|| archinfo_guest->subarch =3D=3D VexSubArchPPC32_VFI);
vassert(0 =3D=3D sizeof(VexGuestPPC32State) % 8);
vassert(sizeof( ((VexGuestPPC32State*)0)->guest_TISTART ) =3D=3D=
4);
vassert(sizeof( ((VexGuestPPC32State*)0)->guest_TILEN ) =3D=3D=
4);
- vassert(sizeof( ((VexGuestPPC32State*)0)->guest_NOREDIR ) =3D=3D=
4);
+ vassert(sizeof( ((VexGuestPPC32State*)0)->guest_NRFLAG ) =3D=3D=
4);
+ vassert(sizeof( ((VexGuestPPC32State*)0)->guest_NRADDR ) =3D=3D=
4);
break;
=20
default:
@@ -436,7 +445,8 @@
do_noredir_check,
offB_TISTART,
offB_TILEN,
- offB_NOREDIR );
+ offB_NRFLAG,
+ offB_NRADDR );
=20
vexAllocSanityCheck();
=20
Modified: branches/FNWRAP/pub/libvex.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
--- branches/FNWRAP/pub/libvex.h 2005-12-06 19:11:02 UTC (rev 1484)
+++ branches/FNWRAP/pub/libvex.h 2005-12-07 17:31:42 UTC (rev 1485)
@@ -402,11 +402,12 @@
the despatcher. Both pseudo-regs must have size equal to the guest
word size.
=20
- The architecture must contain a third pseudo-register,
- guest_NOREDIR, which is guest-word-sized. This is tested and
- zeroed at the start of translations of redirected blocks (under
- LibVEX's client's control), and the block immediately exited if it
- is set.
+ The architecture must contain a two more pseudo-registers,
+ guest_NRFLAG and guest_NRADDR, which are both guest-word-sized.
+ These are tested and zeroed at the start of translations of
+ redirected blocks (under LibVEX's client's control). If _NRFLAG is
+ nonzero and _NRADDR equals the unredirected guest address of the
+ block, then _NRFLAG is zeroed, and the block immediately exited.
*/
#endif /* ndef __LIBVEX_H */
=20
Modified: branches/FNWRAP/pub/libvex_guest_amd64.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
--- branches/FNWRAP/pub/libvex_guest_amd64.h 2005-12-06 19:11:02 UTC (rev=
1484)
+++ branches/FNWRAP/pub/libvex_guest_amd64.h 2005-12-07 17:31:42 UTC (rev=
1485)
@@ -146,9 +146,14 @@
ULong guest_TILEN;
=20
/* Affects behaviour on entry to redirected translations: if
- nonzero, will cause an immediate exit and attempt to execute
- the non-redirected version instead. Is almost always zero. */
- ULong guest_NOREDIR;
+ _NRFLAG ("NR", no-redirect) is nonzero and _NRADDR equals the
+ unredirected guest address for this translation, will cause
+ an immediate exit, requesting to execute the unredirected
+ version instead. Such an exit "uses up" the setting, in that
+ _NRFLAG must be reset to zero if the exit occurs, and
+ unchanged if it doesn't. */
+ ULong guest_NRFLAG;
+ ULong guest_NRADDR;
=20
/* Padding to make it have an 8-aligned size */
/* UInt padding; */
Modified: branches/FNWRAP/pub/libvex_guest_ppc32.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
--- branches/FNWRAP/pub/libvex_guest_ppc32.h 2005-12-06 19:11:02 UTC (rev=
1484)
+++ branches/FNWRAP/pub/libvex_guest_ppc32.h 2005-12-07 17:31:42 UTC (rev=
1485)
@@ -208,9 +208,14 @@
/* 952 */ UInt guest_TILEN;
=20
/* Affects behaviour on entry to redirected translations: if
- nonzero, will cause an immediate exit and attempt to execute
- the non-redirected version instead. Is almost always zero. */
- /* 956 */ UInt guest_NOREDIR;
+ _NRFLAG ("NR", no-redirect) is nonzero and _NRADDR equals the
+ unredirected guest address for this translation, will cause
+ an immediate exit, requesting to execute the unredirected
+ version instead. Such an exit "uses up" the setting, in that
+ _NRFLAG must be reset to zero if the exit occurs, and
+ unchanged if it doesn't. */
+ /* 956 */ UInt guest_NRFLAG;
+ /* 960 */ UInt guest_NRADDR;
=20
/* Padding to make it have an 8-aligned size */
UInt padding;
Modified: branches/FNWRAP/pub/libvex_guest_x86.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
--- branches/FNWRAP/pub/libvex_guest_x86.h 2005-12-06 19:11:02 UTC (rev 1=
484)
+++ branches/FNWRAP/pub/libvex_guest_x86.h 2005-12-07 17:31:42 UTC (rev 1=
485)
@@ -219,12 +219,17 @@
UInt guest_TILEN;
=20
/* Affects behaviour on entry to redirected translations: if
- nonzero, will cause an immediate exit and attempt to execute
- the non-redirected version instead. Is almost always zero. */
- UInt guest_NOREDIR;
+ _NRFLAG ("NR", no-redirect) is nonzero and _NRADDR equals the
+ unredirected guest address for this translation, will cause
+ an immediate exit, requesting to execute the unredirected
+ version instead. Such an exit "uses up" the setting, in that
+ _NRFLAG must be reset to zero if the exit occurs, and
+ unchanged if it doesn't. */
+ UInt guest_NRFLAG;
+ UInt guest_NRADDR;
=20
/* Padding to make it have an 8-aligned size */
- UInt padding;
+ /*UInt padding;*/
}
VexGuestX86State;
=20
|
|
From: Ashley P. <as...@qu...> - 2005-12-07 16:02:52
|
On Tue, 2005-12-06 at 18:37 +0000, Ashley Pittman wrote:
> I'm still seeing both crashes within valgrind and no error reports where
> there should be some but I'm no further forward finding the cause of
> this yet. A typical stack trace looks like this with what appears to be
> two assertion failures in mac_leakcheck.c, the first one at line 588
> "tl_assert(p_min != NULL)" and a second one at 539.
I gave up trying to work with my library and went back to basics coding
up a reproducer from scratch, can somebody take a look at this for me
please.
With the patch I posted yesterday it crashes with this error:
Memcheck: mac_leakcheck.c:539 (full_report): Assertion
'lc_markstack[i].state == IndirectLeak' failed.
==11809== at 0xB000E279: report_and_quit (m_libcassert.c:136)
==11809== by 0xB000E412: vgPlain_assert_fail (m_libcassert.c:199)
==11809== by 0xB000090B: vgMAC_do_detect_memory_leaks
(mac_leakcheck.c:588)
==11809== by 0xB00049A3: mc_detect_memory_leaks (mc_main.c:2078)
==11809== by 0xB0004E19: mc_handle_client_request (mc_main.c:2439)
==11809== by 0xB002D828: do_client_request (scheduler.c:1098)
==11809== by 0xB002CDD7: vgPlain_scheduler (scheduler.c:721)
==11809== by 0xB003D036: thread_wrapper (syswrap-linux.c:86)
==11809== by 0xB003D0FC: run_a_thread_NORETURN (syswrap-linux.c:119)
Ashley,
#include <stdlib.h>
#include <assert.h>
#include <sys/mman.h>
#include <valgrind/valgrind.h>
#include <valgrind/memcheck.h>
#define SIZE (64*1024)
int main () {
char *mbase = mmap(NULL,SIZE,PROT_READ|PROT_WRITE, MAP_PRIVATE|
MAP_NORESERVE|MAP_ANONYMOUS, 0, 0);
assert(mbase != (void *)MAP_FAILED);
VALGRIND_MAKE_NOACCESS(mbase,SIZE);
VALGRIND_MALLOCLIKE_BLOCK(mbase+0,64,0,1);
VALGRIND_MALLOCLIKE_BLOCK(mbase+64,64,0,1);
/* Calling either this or using --leak-check=full results in a assert
failure */
VALGRIND_DO_LEAK_CHECK;
exit(0);
}
|
|
From: <js...@ac...> - 2005-12-07 04:16:44
|
Nightly build on phoenix ( SuSE 10.0 ) started at 2005-12-07 03:30:01 GMT Checking out vex source tree ... done Building vex ... done Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 208 tests, 6 stderr failures, 1 stdout failure ================= memcheck/tests/leak-tree (stderr) memcheck/tests/mempool (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/x86/scalar (stderr) none/tests/mremap2 (stdout) none/tests/x86/faultstatus (stderr) none/tests/x86/int (stderr) |
|
From: <js...@ac...> - 2005-12-07 03:47:00
|
Nightly build on g5 ( YDL 4.0, ppc970 ) started at 2005-12-07 04:40:00 CET Checking out vex source tree ... done Building vex ... done Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 175 tests, 15 stderr failures, 0 stdout failures ================= memcheck/tests/badjump (stderr) memcheck/tests/badjump2 (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/mempool (stderr) memcheck/tests/partiallydefinedeq (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/supp1 (stderr) memcheck/tests/supp_unknown (stderr) memcheck/tests/toobig-allocs (stderr) memcheck/tests/xml1 (stderr) massif/tests/toobig-allocs (stderr) none/tests/faultstatus (stderr) none/tests/fdleak_cmsg (stderr) none/tests/mremap (stderr) |
|
From: Tom H. <to...@co...> - 2005-12-07 03:42:32
|
Nightly build on dunsmere ( athlon, Fedora Core 4 ) started at 2005-12-07 03:30:06 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 210 tests, 7 stderr failures, 1 stdout failure ================= memcheck/tests/leak-tree (stderr) memcheck/tests/mempool (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/x86/scalar (stderr) none/tests/mremap2 (stdout) none/tests/x86/faultstatus (stderr) none/tests/x86/int (stderr) |
|
From: Tom H. <th...@cy...> - 2005-12-07 03:38:21
|
Nightly build on aston ( x86_64, Fedora Core 3 ) started at 2005-12-07 03:05:10 GMT Results differ from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 227 tests, 6 stderr failures, 2 stdout failures ================= memcheck/tests/mempool (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) none/tests/amd64/faultstatus (stderr) none/tests/mremap2 (stdout) none/tests/tls (stdout) none/tests/x86/faultstatus (stderr) none/tests/x86/int (stderr) ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 227 tests, 6 stderr failures, 1 stdout failure ================= memcheck/tests/mempool (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) none/tests/amd64/faultstatus (stderr) none/tests/mremap2 (stdout) none/tests/x86/faultstatus (stderr) none/tests/x86/int (stderr) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Wed Dec 7 03:24:42 2005 --- new.short Wed Dec 7 03:38:12 2005 *************** *** 8,10 **** ! == 227 tests, 6 stderr failures, 1 stdout failure ================= memcheck/tests/mempool (stderr) --- 8,10 ---- ! == 227 tests, 6 stderr failures, 2 stdout failures ================= memcheck/tests/mempool (stderr) *************** *** 14,15 **** --- 14,16 ---- none/tests/mremap2 (stdout) + none/tests/tls (stdout) none/tests/x86/faultstatus (stderr) |
|
From: Tom H. <th...@cy...> - 2005-12-07 03:30:10
|
Nightly build on alvis ( i686, Red Hat 7.3 ) started at 2005-12-07 03:15:06 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 209 tests, 17 stderr failures, 1 stdout failure ================= memcheck/tests/addressable (stderr) memcheck/tests/describe-block (stderr) memcheck/tests/erringfds (stderr) memcheck/tests/leak-0 (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-regroot (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/leakotron (stdout) memcheck/tests/match-overrun (stderr) memcheck/tests/mempool (stderr) memcheck/tests/partial_load_dflt (stderr) memcheck/tests/partial_load_ok (stderr) memcheck/tests/partiallydefinedeq (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/sigkill (stderr) memcheck/tests/stack_changes (stderr) none/tests/x86/faultstatus (stderr) none/tests/x86/int (stderr) |
|
From: Tom H. <th...@cy...> - 2005-12-07 03:27:34
|
Nightly build on dellow ( x86_64, Fedora Core 4 ) started at 2005-12-07 03:10:08 GMT Results differ from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 227 tests, 5 stderr failures, 2 stdout failures ================= memcheck/tests/mempool (stderr) memcheck/tests/x86/scalar (stderr) none/tests/amd64/faultstatus (stderr) none/tests/mremap2 (stdout) none/tests/tls (stdout) none/tests/x86/faultstatus (stderr) none/tests/x86/int (stderr) ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 227 tests, 5 stderr failures, 1 stdout failure ================= memcheck/tests/mempool (stderr) memcheck/tests/x86/scalar (stderr) none/tests/amd64/faultstatus (stderr) none/tests/mremap2 (stdout) none/tests/x86/faultstatus (stderr) none/tests/x86/int (stderr) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Wed Dec 7 03:21:05 2005 --- new.short Wed Dec 7 03:27:29 2005 *************** *** 8,10 **** ! == 227 tests, 5 stderr failures, 1 stdout failure ================= memcheck/tests/mempool (stderr) --- 8,10 ---- ! == 227 tests, 5 stderr failures, 2 stdout failures ================= memcheck/tests/mempool (stderr) *************** *** 13,14 **** --- 13,15 ---- none/tests/mremap2 (stdout) + none/tests/tls (stdout) none/tests/x86/faultstatus (stderr) |
|
From: Tom H. <th...@cy...> - 2005-12-07 03:26:25
|
Nightly build on gill ( x86_64, Fedora Core 2 ) started at 2005-12-07 03:01:56 GMT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 227 tests, 6 stderr failures, 0 stdout failures ================= memcheck/tests/mempool (stderr) memcheck/tests/pointer-trace (stderr) none/tests/amd64/faultstatus (stderr) none/tests/fdleak_fcntl (stderr) none/tests/x86/faultstatus (stderr) none/tests/x86/int (stderr) |
|
From: <sv...@va...> - 2005-12-07 00:55:21
|
Author: sewardj
Date: 2005-12-07 00:55:14 +0000 (Wed, 07 Dec 2005)
New Revision: 5309
Log:
Fix bogus OSet handling in VG_(redir_notify_delete_SegInfo) (bug
detected by the 0xDDDDDDDD trick :-)
Modified:
branches/FNWRAP/coregrind/m_redir.c
Modified: branches/FNWRAP/coregrind/m_redir.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
--- branches/FNWRAP/coregrind/m_redir.c 2005-12-07 00:36:51 UTC (rev 5308=
)
+++ branches/FNWRAP/coregrind/m_redir.c 2005-12-07 00:55:14 UTC (rev 5309=
)
@@ -583,9 +583,9 @@
activeSet. */
VG_(OSet_ResetIter)( tmpSet );
while ( (addrP =3D VG_(OSet_Next)(tmpSet)) ) {
- /* XXXXXXXXXXX invalidate translations */
- VG_(OSet_Remove)( activeSet, addrP );
- VG_(OSet_FreeNode)( activeSet, addrP );
+ act =3D VG_(OSet_Remove)( activeSet, addrP );
+ vg_assert(act);
+ VG_(OSet_FreeNode)( activeSet, act );
}
=20
VG_(OSet_Destroy)( tmpSet );
@@ -606,6 +606,9 @@
tsPrev->next =3D ts->next;
}
symtab_free(ts);
+
+ if (VG_(clo_trace_redir))
+ show_redir_state("after VG_(redir_notify_delete_SegInfo)");
}
=20
=20
|
|
From: <sv...@va...> - 2005-12-07 00:36:54
|
Author: njn
Date: 2005-12-07 00:36:51 +0000 (Wed, 07 Dec 2005)
New Revision: 5308
Log:
Started folding in code from mac_shared.c and mac_shared.h into mc_main.c
and mc_include.h, as a consequence of removing Addrcheck.
Removed:
branches/COMPVBITS/memcheck/mac_shared.h
Modified:
branches/COMPVBITS/memcheck/Makefile.am
branches/COMPVBITS/memcheck/mac_leakcheck.c
branches/COMPVBITS/memcheck/mac_malloc_wrappers.c
branches/COMPVBITS/memcheck/mac_shared.c
branches/COMPVBITS/memcheck/mc_include.h
branches/COMPVBITS/memcheck/mc_main.c
branches/COMPVBITS/memcheck/mc_translate.c
Modified: branches/COMPVBITS/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
--- branches/COMPVBITS/memcheck/Makefile.am 2005-12-07 00:04:22 UTC (rev =
5307)
+++ branches/COMPVBITS/memcheck/Makefile.am 2005-12-07 00:36:51 UTC (rev =
5308)
@@ -77,7 +77,6 @@
memcheck.h
=20
noinst_HEADERS =3D \
- mac_shared.h \
mc_include.h
=20
mac_replace_strmem.o: CFLAGS +=3D -fno-omit-frame-pointer
Modified: branches/COMPVBITS/memcheck/mac_leakcheck.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
--- branches/COMPVBITS/memcheck/mac_leakcheck.c 2005-12-07 00:04:22 UTC (=
rev 5307)
+++ branches/COMPVBITS/memcheck/mac_leakcheck.c 2005-12-07 00:36:51 UTC (=
rev 5308)
@@ -32,9 +32,9 @@
=20
#include "pub_tool_basics.h"
#include "pub_tool_aspacemgr.h"
-#include "pub_tool_errormgr.h" // For mac_shared.h
-#include "pub_tool_execontext.h" // For mac_shared.h
-#include "pub_tool_hashtable.h" // For mac_shared.h
+#include "pub_tool_errormgr.h" // For mc_include.h
+#include "pub_tool_execontext.h" // For mc_include.h
+#include "pub_tool_hashtable.h" // For mc_include.h
#include "pub_tool_libcbase.h"
#include "pub_tool_libcassert.h"
#include "pub_tool_libcprint.h"
@@ -42,10 +42,10 @@
#include "pub_tool_machine.h"
#include "pub_tool_mallocfree.h"
#include "pub_tool_options.h"
-#include "pub_tool_profile.h" // For mac_shared.h
+#include "pub_tool_profile.h" // For mc_include.h
#include "pub_tool_signals.h"
=20
-#include "mac_shared.h"
+#include "mc_include.h"
=20
#include <setjmp.h> // For jmp_buf
=20
@@ -551,7 +551,7 @@
=20
for (p =3D errlist; p !=3D NULL; p =3D p->next) {
if (p->loss_mode =3D=3D lc_markstack[i].state
- && VG_(eq_ExeContext) ( MAC_(clo_leak_resolution),
+ && VG_(eq_ExeContext) ( MC_(clo_leak_resolution),
p->allocated_at,=20
where) ) {
break;
@@ -593,7 +593,7 @@
Prints the error if not suppressed, unless it's reachable (Prop=
er
or IndirectLeak) and --show-reachable=3Dno */
=20
- print_record =3D ( MAC_(clo_show_reachable) ||=20
+ print_record =3D ( MC_(clo_show_reachable) ||=20
Unreached =3D=3D p_min->loss_mode ||=20
Interior =3D=3D p_min->loss_mode );
=20
@@ -804,7 +804,7 @@
if (mode =3D=3D LC_Summary && blocks_leaked > 0)
VG_(message)(Vg_UserMsg,
"Use --leak-check=3Dfull to see details of leaked memory.");
- else if (!MAC_(clo_show_reachable)) {
+ else if (!MC_(clo_show_reachable)) {
VG_(message)(Vg_UserMsg,=20
"Reachable blocks (those to which a pointer was found) are no=
t shown.");
VG_(message)(Vg_UserMsg,=20
Modified: branches/COMPVBITS/memcheck/mac_malloc_wrappers.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
--- branches/COMPVBITS/memcheck/mac_malloc_wrappers.c 2005-12-07 00:04:22=
UTC (rev 5307)
+++ branches/COMPVBITS/memcheck/mac_malloc_wrappers.c 2005-12-07 00:36:51=
UTC (rev 5308)
@@ -31,18 +31,18 @@
*/
=20
#include "pub_tool_basics.h"
-#include "pub_tool_errormgr.h" // For mac_shared.h
-#include "pub_tool_execontext.h" // For mac_shared.h
-#include "pub_tool_hashtable.h" // For mac_shared.h
+#include "pub_tool_errormgr.h" // For mc_include.h
+#include "pub_tool_execontext.h" // For mc_include.h
+#include "pub_tool_hashtable.h" // For mc_include.h
#include "pub_tool_libcbase.h"
#include "pub_tool_libcassert.h"
#include "pub_tool_libcprint.h"
#include "pub_tool_mallocfree.h"
#include "pub_tool_options.h"
-#include "pub_tool_profile.h" // For mac_shared.h
+#include "pub_tool_profile.h" // For mc_include.h
#include "pub_tool_replacemalloc.h"
#include "pub_tool_threadstate.h"
-#include "mac_shared.h"
+#include "mc_include.h"
=20
/*------------------------------------------------------------*/
/*--- Defns ---*/
@@ -98,7 +98,7 @@
/* Release enough of the oldest blocks to bring the free queue
volume below vg_clo_freelist_vol. */
=20
- while (freed_list_volume > MAC_(clo_freelist_vol)) {
+ while (freed_list_volume > MC_(clo_freelist_vol)) {
MAC_Chunk* mc1;
=20
tl_assert(freed_list_start !=3D NULL);
Modified: branches/COMPVBITS/memcheck/mac_shared.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
--- branches/COMPVBITS/memcheck/mac_shared.c 2005-12-07 00:04:22 UTC (rev=
5307)
+++ branches/COMPVBITS/memcheck/mac_shared.c 2005-12-07 00:36:51 UTC (rev=
5308)
@@ -6,8 +6,7 @@
=20
/*
This file is part of MemCheck, a heavyweight Valgrind tool for
- detecting memory errors, and AddrCheck, a lightweight Valgrind tool=20
- for detecting memory errors.
+ detecting memory errors.
=20
Copyright (C) 2000-2005 Julian Seward=20
js...@ac...
@@ -31,19 +30,19 @@
*/
=20
#include "pub_tool_basics.h"
-#include "pub_tool_errormgr.h" // For mac_shared.h
-#include "pub_tool_execontext.h" // For mac_shared.h
-#include "pub_tool_hashtable.h" // For mac_shared.h
+#include "pub_tool_errormgr.h" // For mc_include.h
+#include "pub_tool_execontext.h" // For mc_include.h
+#include "pub_tool_hashtable.h" // For mc_include.h
#include "pub_tool_libcassert.h"
#include "pub_tool_libcbase.h"
#include "pub_tool_libcprint.h"
#include "pub_tool_mallocfree.h"
#include "pub_tool_machine.h"
#include "pub_tool_options.h"
-#include "pub_tool_profile.h" // For mac_shared.h
+#include "pub_tool_profile.h" // For mc_include.h
#include "pub_tool_replacemalloc.h"
#include "pub_tool_threadstate.h"
-#include "mac_shared.h"
+#include "mc_include.h"
#include "memcheck.h" /* for VG_USERREQ__* */
=20
/*------------------------------------------------------------*/
@@ -55,68 +54,6 @@
#define VG_GCC296_BUG_STACK_SLOP 1024
=20
/*------------------------------------------------------------*/
-/*--- Command line options ---*/
-/*------------------------------------------------------------*/
-
-Bool MAC_(clo_partial_loads_ok) =3D False;
-Int MAC_(clo_freelist_vol) =3D 5000000;
-LeakCheckMode MAC_(clo_leak_check) =3D LC_Summary;
-VgRes MAC_(clo_leak_resolution) =3D Vg_LowRes;
-Bool MAC_(clo_show_reachable) =3D False;
-Bool MAC_(clo_workaround_gcc296_bugs) =3D False;
-Bool MAC_(clo_undef_value_errors) =3D True;
-
-Bool MAC_(process_common_cmd_line_option)(Char* arg)
-{
- VG_BOOL_CLO(arg, "--partial-loads-ok", MAC_(clo_partial_loads_ok))
- else VG_BOOL_CLO(arg, "--show-reachable", MAC_(clo_show_reacha=
ble))
- else VG_BOOL_CLO(arg, "--workaround-gcc296-bugs",MAC_(clo_workaround_=
gcc296_bugs))
-
- else VG_BOOL_CLO(arg, "--undef-value-errors", MAC_(clo_undef_value=
_errors))
- =20
- else VG_BNUM_CLO(arg, "--freelist-vol", MAC_(clo_freelist_vol), 0, 1=
000000000)
- =20
- else if (VG_CLO_STREQ(arg, "--leak-check=3Dno"))
- MAC_(clo_leak_check) =3D LC_Off;
- else if (VG_CLO_STREQ(arg, "--leak-check=3Dsummary"))
- MAC_(clo_leak_check) =3D LC_Summary;
- else if (VG_CLO_STREQ(arg, "--leak-check=3Dyes") ||
- VG_CLO_STREQ(arg, "--leak-check=3Dfull"))
- MAC_(clo_leak_check) =3D LC_Full;
-
- else if (VG_CLO_STREQ(arg, "--leak-resolution=3Dlow"))
- MAC_(clo_leak_resolution) =3D Vg_LowRes;
- else if (VG_CLO_STREQ(arg, "--leak-resolution=3Dmed"))
- MAC_(clo_leak_resolution) =3D Vg_MedRes;
- else if (VG_CLO_STREQ(arg, "--leak-resolution=3Dhigh"))
- MAC_(clo_leak_resolution) =3D Vg_HighRes;
-
- else
- return VG_(replacement_malloc_process_cmd_line_option)(arg);
-
- return True;
-}
-
-void MAC_(print_common_usage)(void)
-{
- VG_(printf)(
-" --leak-check=3Dno|summary|full search for memory leaks at exit?=
[summary]\n"
-" --leak-resolution=3Dlow|med|high how much bt merging in leak chec=
k [low]\n"
-" --show-reachable=3Dno|yes show reachable blocks in leak ch=
eck? [no]\n"
-" --undef-value-errors=3Dno|yes check for undefined value errors=
[yes]\n"
-" --partial-loads-ok=3Dno|yes too hard to explain here; see ma=
nual [no]\n"
-" --freelist-vol=3D<number> volume of freed blocks queue [50=
00000]\n"
-" --workaround-gcc296-bugs=3Dno|yes self explanatory [no]\n"
- );
- VG_(replacement_malloc_print_usage)();
-}
-
-void MAC_(print_common_debug_usage)(void)
-{
- VG_(replacement_malloc_print_debug_usage)();
-}
-
-/*------------------------------------------------------------*/
/*--- Comparing and printing errors ---*/
/*------------------------------------------------------------*/
=20
@@ -303,109 +240,6 @@
}
}
=20
-/* This prints out the message for the error types where Memcheck and
- Addrcheck have identical messages */
-void MAC_(pp_shared_Error) ( Error* err )
-{
- MAC_Error* err_extra =3D VG_(get_error_extra)(err);
-
- HChar* xpre =3D VG_(clo_xml) ? " <what>" : "";
- HChar* xpost =3D VG_(clo_xml) ? "</what>" : "";
-
- switch (VG_(get_error_kind)(err)) {
- case FreeErr:
- if (VG_(clo_xml))
- VG_(message)(Vg_UserMsg, " <kind>InvalidFree</kind>");
- VG_(message)(Vg_UserMsg,=20
- "%sInvalid free() / delete / delete[]%s",
- xpre, xpost);
- VG_(pp_ExeContext)( VG_(get_error_where)(err) );
- MAC_(pp_AddrInfo)(VG_(get_error_address)(err), &err_extra->addr=
info);
- break;
-
- case FreeMismatchErr:
- if (VG_(clo_xml))
- VG_(message)(Vg_UserMsg, " <kind>MismatchedFree</kind>");
- VG_(message)(Vg_UserMsg,=20
- "%sMismatched free() / delete / delete []%s",
- xpre, xpost);
- VG_(pp_ExeContext)( VG_(get_error_where)(err) );
- MAC_(pp_AddrInfo)(VG_(get_error_address)(err), &err_extra->addr=
info);
- break;
-
- case AddrErr:
- switch (err_extra->axskind) {
- case ReadAxs:
- if (VG_(clo_xml))
- VG_(message)(Vg_UserMsg, " <kind>InvalidRead</kind>")=
;
- VG_(message)(Vg_UserMsg,
- "%sInvalid read of size %d%s",=20
- xpre, err_extra->size, xpost );=20
- break;
- case WriteAxs:
- if (VG_(clo_xml))
- VG_(message)(Vg_UserMsg, " <kind>InvalidWrite</kind>"=
);
- VG_(message)(Vg_UserMsg,=20
- "%sInvalid write of size %d%s",=20
- xpre, err_extra->size, xpost );=20
- break;
- case ExecAxs:
- if (VG_(clo_xml))
- VG_(message)(Vg_UserMsg, " <kind>InvalidJump</kind>")=
;
- VG_(message)(Vg_UserMsg,=20
- "%sJump to the invalid address "
- "stated on the next line%s",
- xpre, xpost);
- break;
- default:=20
- VG_(tool_panic)("MAC_(pp_shared_Error)(axskind)");
- }
- VG_(pp_ExeContext)( VG_(get_error_where)(err) );
- MAC_(pp_AddrInfo)(VG_(get_error_address)(err), &err_extra->addr=
info);
- break;
-
- case OverlapErr: {
- OverlapExtra* ov_extra =3D (OverlapExtra*)VG_(get_error_extra)(=
err);
- if (VG_(clo_xml))
- VG_(message)(Vg_UserMsg, " <kind>Overlap</kind>");
- if (ov_extra->len =3D=3D -1)
- VG_(message)(Vg_UserMsg,
- "%sSource and destination overlap in %s(%p, %p)=
%s",
- xpre,
- VG_(get_error_string)(err),
- ov_extra->dst, ov_extra->src,
- xpost);
- else
- VG_(message)(Vg_UserMsg,
- "%sSource and destination overlap in %s(%p, %p,=
%d)%s",
- xpre,
- VG_(get_error_string)(err),
- ov_extra->dst, ov_extra->src, ov_extra->len,
- xpost);
- VG_(pp_ExeContext)( VG_(get_error_where)(err) );
- break;
- }
- case LeakErr: {
- MAC_(pp_LeakError)(err_extra);
- break;
- }
-
- case IllegalMempoolErr:
- if (VG_(clo_xml))
- VG_(message)(Vg_UserMsg, " <kind>InvalidMemPool</kind>");
- VG_(message)(Vg_UserMsg, "%sIllegal memory pool address%s",
- xpre, xpost);
- VG_(pp_ExeContext)( VG_(get_error_where)(err) );
- MAC_(pp_AddrInfo)(VG_(get_error_address)(err), &err_extra->addr=
info);
- break;
-
- default:=20
- VG_(printf)("Error:\n unknown Memcheck/Addrcheck error code %d=
\n",
- VG_(get_error_kind)(err));
- VG_(tool_panic)("unknown error code in MAC_(pp_shared_Error)");
- }
-}
-
/*------------------------------------------------------------*/
/*--- Recording errors ---*/
/*------------------------------------------------------------*/
@@ -499,7 +333,7 @@
=20
/* If this is caused by an access immediately below %ESP, and the
user asks nicely, we just ignore it. */
- if (MAC_(clo_workaround_gcc296_bugs) && just_below_esp)
+ if (MC_(clo_workaround_gcc296_bugs) && just_below_esp)
return;
=20
MAC_(clear_MAC_Error)( &err_extra );
@@ -792,259 +626,6 @@
}
}
=20
-/*------------------------------------------------------------*/
-/*--- Crude profiling machinery. ---*/
-/*------------------------------------------------------------*/
-
-/* Event index. If just the name of the fn is given, this means the
- number of calls to the fn. Otherwise it is the specified event.
- Ones marked 'M' are MemCheck only. Ones marked 'A' are AddrCheck onl=
y.
- The rest are shared.
-
- 10 alloc_secondary_map
-
- 20 get_abit
-M 21 get_vbyte
- 22 set_abit
-M 23 set_vbyte
- 24 get_abits4_ALIGNED
-M 25 get_vbytes4_ALIGNED =20
-
- 30 set_address_range_perms
- 31 set_address_range_perms(lower byte loop)
- 32 set_address_range_perms(quadword loop)
- 33 set_address_range_perms(upper byte loop)
- =20
- 35 make_noaccess
- 36 make_writable
- 37 make_readable
-A 38 make_accessible
-
- 40 copy_address_range_state
- 41 copy_address_range_state(byte loop)
- 42 check_writable
- 43 check_writable(byte loop)
- 44 check_readable
- 45 check_readable(byte loop)
- 46 check_readable_asciiz
- 47 check_readable_asciiz(byte loop)
-A 48 check_accessible
-A 49 check_accessible(byte loop)
-
- 50 make_noaccess_aligned
- 51 make_writable_aligned
-
-M 60 helperc_LOADV4
-M 61 helperc_STOREV4
-M 62 helperc_LOADV2
-M 63 helperc_STOREV2
-M 64 helperc_LOADV1
-M 65 helperc_STOREV1
-
-A 66 helperc_ACCESS4
-A 67 helperc_ACCESS2
-A 68 helperc_ACCESS1
-
-M 70 rim_rd_V4_SLOWLY
-M 71 rim_wr_V4_SLOWLY
-M 72 rim_rd_V2_SLOWLY
-M 73 rim_wr_V2_SLOWLY
-M 74 rim_rd_V1_SLOWLY
-M 75 rim_wr_V1_SLOWLY
-
-A 76 ACCESS4_SLOWLY
-A 77 ACCESS2_SLOWLY
-A 78 ACCESS1_SLOWLY
-
- 80 fpu_read
- 81 fpu_read aligned 4
- 82 fpu_read aligned 8
- 83 fpu_read 2
- 84 fpu_read 10/28/108/512
-
-M 85 fpu_write
-M 86 fpu_write aligned 4
-M 87 fpu_write aligned 8
-M 88 fpu_write 2
-M 89 fpu_write 10/28/108/512
-
- 90 fpu_access
- 91 fpu_access aligned 4
- 92 fpu_access aligned 8
- 93 fpu_access 2
- 94 fpu_access 10/28/108/512
-
- 100 fpu_access_check_SLOWLY
- 101 fpu_access_check_SLOWLY(byte loop)
-
- 110 new_mem_stack_4
- 111 new_mem_stack_8
- 112 new_mem_stack_12
- 113 new_mem_stack_16
- 114 new_mem_stack_32
- 115 new_mem_stack
-
- 120 die_mem_stack_4
- 121 die_mem_stack_8
- 122 die_mem_stack_12
- 123 die_mem_stack_16
- 124 die_mem_stack_32
- 125 die_mem_stack
-*/
-
-#ifdef MAC_PROFILE_MEMORY
-
-UInt MAC_(event_ctr)[N_PROF_EVENTS];
-HChar* MAC_(event_ctr_name)[N_PROF_EVENTS];
-
-static void init_prof_mem ( void )
-{
- Int i;
- for (i =3D 0; i < N_PROF_EVENTS; i++) {
- MAC_(event_ctr)[i] =3D 0;
- MAC_(event_ctr_name)[i] =3D NULL;
- }
-}
-
-static void done_prof_mem ( void )
-{
- Int i;
- Bool spaced =3D False;
- for (i =3D 0; i < N_PROF_EVENTS; i++) {
- if (!spaced && (i % 10) =3D=3D 0) {
- VG_(printf)("\n");
- spaced =3D True;
- }
- if (MAC_(event_ctr)[i] > 0) {
- spaced =3D False;
- VG_(printf)( "prof mem event %3d: %9d %s\n",=20
- i, MAC_(event_ctr)[i],
- MAC_(event_ctr_name)[i]=20
- ? MAC_(event_ctr_name)[i] : "unnamed");
- }
- }
-}
-
-#else
-
-static void init_prof_mem ( void ) { }
-static void done_prof_mem ( void ) { }
-
-#endif
-
-/*------------------------------------------------------------*/
-/*--- Common initialisation + finalisation ---*/
-/*------------------------------------------------------------*/
-
-void MAC_(common_pre_clo_init)(void)
-{
- MAC_(malloc_list) =3D VG_(HT_construct)( 80021 ); // prime, big
- MAC_(mempool_list) =3D VG_(HT_construct)( 1009 ); // prime, not so=
big
- init_prof_mem();
-}
-
-void MAC_(common_fini)(void (*leak_check)(ThreadId tid, LeakCheckMode mo=
de))
-{
- MAC_(print_malloc_stats)();
-
- if (VG_(clo_verbosity) =3D=3D 1 && !VG_(clo_xml)) {
- if (MAC_(clo_leak_check) =3D=3D LC_Off)
- VG_(message)(Vg_UserMsg,=20
- "For a detailed leak analysis, rerun with: --leak-check=3D=
yes");
-
- VG_(message)(Vg_UserMsg,=20
- "For counts of detected errors, rerun with: -v");
- }
- if (MAC_(clo_leak_check) !=3D LC_Off)
- leak_check(1/*bogus ThreadId*/, MAC_(clo_leak_check));
-
- done_prof_mem();
-}
-
-/*------------------------------------------------------------*/
-/*--- Common client request handling ---*/
-/*------------------------------------------------------------*/
-
-Bool MAC_(handle_common_client_requests)(ThreadId tid, UWord* arg, UWord=
* ret )
-{
- switch (arg[0]) {
- case VG_USERREQ__COUNT_LEAKS: { /* count leaked bytes */
- UWord** argp =3D (UWord**)arg;
- // MAC_(bytes_leaked) et al were set by the last leak check (or ze=
ro
- // if no prior leak checks performed).
- *argp[1] =3D MAC_(bytes_leaked) + MAC_(bytes_indirect);
- *argp[2] =3D MAC_(bytes_dubious);
- *argp[3] =3D MAC_(bytes_reachable);
- *argp[4] =3D MAC_(bytes_suppressed);
- // there is no argp[5]
- //*argp[5] =3D MAC_(bytes_indirect);
- // XXX need to make *argp[1-4] readable
- *ret =3D 0;
- return True;
- }
- case VG_USERREQ__MALLOCLIKE_BLOCK: {
- Addr p =3D (Addr)arg[1];
- SizeT sizeB =3D arg[2];
- UInt rzB =3D arg[3];
- Bool is_zeroed =3D (Bool)arg[4];
-
- MAC_(new_block) ( tid, p, sizeB, /*ignored*/0, rzB, is_zeroed,=20
- MAC_AllocCustom, MAC_(malloc_list) );
- return True;
- }
- case VG_USERREQ__FREELIKE_BLOCK: {
- Addr p =3D (Addr)arg[1];
- UInt rzB =3D arg[2];
-
- MAC_(handle_free) ( tid, p, rzB, MAC_AllocCustom );
- return True;
- }
-
- case _VG_USERREQ__MEMCHECK_RECORD_OVERLAP_ERROR: {
- Char* s =3D (Char*) arg[1];
- OverlapExtra* extra =3D (OverlapExtra*)arg[2];
- MAC_(record_overlap_error)(tid, s, extra);
- return True;
- }
-
- case VG_USERREQ__CREATE_MEMPOOL: {
- Addr pool =3D (Addr)arg[1];
- UInt rzB =3D arg[2];
- Bool is_zeroed =3D (Bool)arg[3];
-
- MAC_(create_mempool) ( pool, rzB, is_zeroed );
- return True;
- }
-
- case VG_USERREQ__DESTROY_MEMPOOL: {
- Addr pool =3D (Addr)arg[1];
-
- MAC_(destroy_mempool) ( pool );
- return True;
- }
-
- case VG_USERREQ__MEMPOOL_ALLOC: {
- Addr pool =3D (Addr)arg[1];
- Addr addr =3D (Addr)arg[2];
- UInt size =3D arg[3];
-
- MAC_(mempool_alloc) ( tid, pool, addr, size );
- return True;
- }
-
- case VG_USERREQ__MEMPOOL_FREE: {
- Addr pool =3D (Addr)arg[1];
- Addr addr =3D (Addr)arg[2];
-
- MAC_(mempool_free) ( pool, addr );
- return True;
- }
-
- default:
- return False;
- }
-}
-
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Deleted: branches/COMPVBITS/memcheck/mac_shared.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
--- branches/COMPVBITS/memcheck/mac_shared.h 2005-12-07 00:04:22 UTC (rev=
5307)
+++ branches/COMPVBITS/memcheck/mac_shared.h 2005-12-07 00:36:51 UTC (rev=
5308)
@@ -1,638 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- Declarations shared between Memcheck and Addrcheck. ---*/
-/*--- mac_shared.h ---*/
-/*--------------------------------------------------------------------*/
-
-/*
- This file is part of MemCheck, a heavyweight Valgrind tool for
- detecting memory errors, and AddrCheck, a lightweight Valgrind tool=20
- 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.
-*/
-
-/* Note: This header contains the declarations shared between
- Addrcheck and Memcheck, and is #included by both. */
-
-#ifndef __MAC_SHARED_H
-#define __MAC_SHARED_H
-
-#define MAC_(str) VGAPPEND(vgMAC_,str)
-
-/*------------------------------------------------------------*/
-/*--- Errors and suppressions ---*/
-/*------------------------------------------------------------*/
-
-/* The classification of a faulting address. */
-typedef=20
- enum {=20
- Undescribed, // as-yet unclassified
- Stack,=20
- Unknown, // classification yielded nothing useful
- Freed, Mallocd,=20
- UserG, // in a user-defined block
- Mempool, // in a mempool
- Register, // in a register; for Param errors only
- }
- AddrKind;
-
-/* Records info about a faulting address. */
-typedef
- struct { // Used by:
- AddrKind akind; // ALL
- SizeT blksize; // Freed, Mallocd
- OffT rwoffset; // Freed, Mallocd
- ExeContext* lastchange; // Freed, Mallocd
- ThreadId stack_tid; // Stack
- const Char *desc; // UserG
- Bool maybe_gcc; // True if just below %esp -- could be a g=
cc bug.
- }
- AddrInfo;
-
-typedef=20
- enum {=20
- ParamSupp, // Bad syscall params
- CoreMemSupp, // Memory errors in core (pthread ops, signal handl=
ing)
-
- // Use of invalid values of given size (MemCheck only)
- Value0Supp, Value1Supp, Value2Supp, Value4Supp, Value8Supp, Value1=
6Supp,
-
- // Invalid read/write attempt at given size
- Addr1Supp, Addr2Supp, Addr4Supp, Addr8Supp, Addr16Supp,
-
- FreeSupp, // Invalid or mismatching free
- OverlapSupp, // Overlapping blocks in memcpy(), strcpy(), etc
- LeakSupp, // Something to be suppressed in a leak check.
- MempoolSupp, // Memory pool suppression.
- }=20
- MAC_SuppKind;
-
-/* What kind of error it is. */
-typedef=20
- enum { ValueErr, /* Memcheck only */
- CoreMemErr,
- AddrErr,=20
- ParamErr, UserErr, /* behaves like an anonymous ParamErr */
- FreeErr, FreeMismatchErr,
- OverlapErr,
- LeakErr,
- IllegalMempoolErr,
- }
- MAC_ErrorKind;
-
-/* What kind of memory access is involved in the error? */
-typedef
- enum { ReadAxs, WriteAxs, ExecAxs }
- AxsKind;
-
-/* Extra context for memory errors */
-typedef
- struct { // Used by:
- AxsKind axskind; // AddrErr
- Int size; // AddrErr, ValueErr
- AddrInfo addrinfo; // {Addr,Free,FreeMismatch,Param,User}Err
- Bool isUnaddr; // {CoreMem,Param,User}Err
- }
- MAC_Error;
-
-/* Extra info for overlap errors */
-typedef
- struct {
- Addr src;
- Addr dst;
- Int len; // -1 if unused
- }
- OverlapExtra;
-
-/* For malloc()/new/new[] vs. free()/delete/delete[] mismatch checking. =
*/
-typedef
- enum {
- MAC_AllocMalloc =3D 0,
- MAC_AllocNew =3D 1,
- MAC_AllocNewVec =3D 2,
- MAC_AllocCustom =3D 3
- }
- MAC_AllocKind;
- =20
-/* Nb: first two fields must match core's VgHashNode. */
-typedef
- struct _MAC_Chunk {
- struct _MAC_Chunk* next;
- Addr data; // ptr to actual block
- SizeT size : (sizeof(UWord)*8)-2; // size requested; 30 or=
62 bits
- MAC_AllocKind allockind : 2; // which wrapper did the allocation
- ExeContext* where; // where it was allocated
- }
- MAC_Chunk;
-
-/* Memory pool. Nb: first two fields must match core's VgHashNode. */
-typedef
- struct _MAC_Mempool {
- struct _MAC_Mempool* next;
- Addr pool; // pool identifier
- SizeT rzB; // pool red-zone size
- Bool is_zeroed; // allocations from this pool are ze=
roed
- VgHashTable chunks; // chunks associated with this pool
- }
- MAC_Mempool;
-
-
-/*------------------------------------------------------------*/
-/*--- Profiling of tools and memory events ---*/
-/*------------------------------------------------------------*/
-
-typedef=20
- enum {=20
- VgpCheckMem =3D VgpFini+1,
- VgpSetMem,
- VgpESPAdj
- }=20
- VgpToolCC;
-
-/* Define to collect detailed performance info. */
-/* #define MAC_PROFILE_MEMORY */
-
-#ifdef MAC_PROFILE_MEMORY
-# define N_PROF_EVENTS 500
-
-extern UInt MAC_(event_ctr)[N_PROF_EVENTS];
-extern HChar* MAC_(event_ctr_name)[N_PROF_EVENTS];
-
-# define PROF_EVENT(ev, name) \
- do { tl_assert((ev) >=3D 0 && (ev) < N_PROF_EVENTS); \
- /* crude and inaccurate check to ensure the same */ \
- /* event isn't being used with > 1 name */ \
- if (MAC_(event_ctr_name)[ev]) \
- tl_assert(name =3D=3D MAC_(event_ctr_name)[ev]); \
- MAC_(event_ctr)[ev]++; \
- MAC_(event_ctr_name)[ev] =3D (name); \
- } while (False);
-
-#else
-
-# define PROF_EVENT(ev, name) /* */
-
-#endif /* MAC_PROFILE_MEMORY */
-
-
-/*------------------------------------------------------------*/
-/*--- V and A bits (Victoria & Albert ?) ---*/
-/*------------------------------------------------------------*/
-
-/* expand 1 bit -> 8 */
-#define BIT_TO_BYTE(b) ((~(((UChar)(b) & 1) - 1)) & 0xFF)
-
-/* The number of entries in the primary map can be altered. However
- we hardwire the assumption that each secondary map covers precisely
- 64k of address space. */
-#define SM_SIZE 65536 /* DO NOT CHANGE */
-#define SM_MASK (SM_SIZE-1) /* DO NOT CHANGE */
-
-//zz #define SECONDARY_SHIFT 16
-//zz #define SECONDARY_SIZE (1 << SECONDARY_SHIFT)
-//zz #define SECONDARY_MASK (SECONDARY_SIZE - 1)
-//zz=20
-//zz #define PRIMARY_SIZE (1 << (32 - SECONDARY_SHIFT))
-//zz=20
-//zz #define SM_OFF(addr) ((addr) & SECONDARY_MASK)
-//zz #define PM_IDX(addr) ((addr) >> SECONDARY_SHIFT)
-/*
-#define IS_DISTINGUISHED_SM(smap) \
- ((smap) >=3D &distinguished_secondary_maps[0] && \
- (smap) < &distinguished_secondary_maps[N_SECONDARY_MAPS])
-
-#define IS_DISTINGUISHED(addr) (IS_DISTINGUISHED_SM(primary_map[PM_IDX(a=
ddr)]))
-
-#define ENSURE_MAPPABLE(addr,caller) \
- do { \
- if (IS_DISTINGUISHED(addr)) { \
- primary_map[PM_IDX(addr)] =3D alloc_secondary_map(caller, primary_map[=
PM_IDX(addr)]); \
- if (0) VG_(printf)("new 2map because of %p\n", addr); \
- } \
- } while(0)
-*/
-
-#define BITARR_SET(aaa_p,iii_p) \
- do { \
- UWord iii =3D (UWord)iii_p; \
- UChar* aaa =3D (UChar*)aaa_p; \
- aaa[iii >> 3] |=3D (1 << (iii & 7)); \
- } while (0)
-
-#define BITARR_CLEAR(aaa_p,iii_p) \
- do { \
- UWord iii =3D (UWord)iii_p; \
- UChar* aaa =3D (UChar*)aaa_p; \
- aaa[iii >> 3] &=3D ~(1 << (iii & 7)); \
- } while (0)
-
-#define BITARR_TEST(aaa_p,iii_p) \
- (0 !=3D (((UChar*)aaa_p)[ ((UWord)iii_p) >> 3 ] \
- & (1 << (((UWord)iii_p) & 7)))) \
-
-static inline=20
-void write_bit_array ( UChar* arr, UWord idx, UWord bit )=20
-{
- UWord shift =3D idx & 7;
- idx >>=3D 3;
- bit &=3D 1;
- arr[idx] =3D (arr[idx] & ~(1<<shift)) | (bit << shift);
-}
-
-static inline
-UWord read_bit_array ( UChar* arr, UWord idx )
-{
- UWord shift =3D idx & 7;
- idx >>=3D 3;
- return 1 & (arr[idx] >> shift);
-}
-
-
-#define VGM_BIT_VALID 0
-#define VGM_BIT_INVALID 1
-
-#define VGM_NIBBLE_VALID 0
-#define VGM_NIBBLE_INVALID 0xF
-
-#define VGM_BYTE_VALID 0
-#define VGM_BYTE_INVALID 0xFF
-
-#define VGM_SHORT_VALID 0
-#define VGM_SHORT_INVALID 0xFFFF
-
-#define VGM_WORD32_VALID 0
-#define VGM_WORD32_INVALID 0xFFFFFFFF
-
-#define VGM_WORD64_VALID 0ULL
-#define VGM_WORD64_INVALID 0xFFFFFFFFFFFFFFFFULL
-
-
-/*------------------------------------------------------------*/
-/*--- Command line options + defaults ---*/
-/*------------------------------------------------------------*/
-
-/* Memcheck defines a couple more. */
-
-/* Allow loads from partially-valid addresses? default: YES */
-extern Bool MAC_(clo_partial_loads_ok);
-
-/* Max volume of the freed blocks queue. */
-extern Int MAC_(clo_freelist_vol);
-
-/* Do leak check at exit? default: NO */
-typedef
- enum {
- LC_Off,
- LC_Summary,
- LC_Full,
- }
- LeakCheckMode;
-
-extern LeakCheckMode MAC_(clo_leak_check);
-
-/* How closely should we compare ExeContexts in leak records? default: 2=
*/
-extern VgRes MAC_(clo_leak_resolution);
-
-/* In leak check, show reachable-but-not-freed blocks? default: NO */
-extern Bool MAC_(clo_show_reachable);
-
-/* Assume accesses immediately below %esp are due to gcc-2.96 bugs.
- * default: NO */
-extern Bool MAC_(clo_workaround_gcc296_bugs);
-
-/* Do undefined value checking? "No" gives Addrcheck-style behaviour, ie=
.
- * faster but fewer errors found. Note that although Addrcheck had 1 bi=
t
- * per byte overhead vs the old Memcheck's 9 bits per byte, with this mo=
de
- * and compressed V bits, no memory is saved with this mode -- it's stil=
l
- * 2 bits per byte overhead. This is a little wasteful -- it could be d=
one
- * with 1 bit per byte -- but lets us reuse the many shadow memory acces=
s
- * functions. Note also that in this mode the secondary V bit table is
- * never used.
- *
- * default: YES */
-extern Bool MAC_(clo_undef_value_errors);
-
-extern Bool MAC_(process_common_cmd_line_option) ( Char* arg );
-extern void MAC_(print_common_usage) ( void );
-extern void MAC_(print_common_debug_usage) ( void );
-
-/* We want a 16B redzone on heap blocks for Addrcheck and Memcheck */
-#define MAC_MALLOC_REDZONE_SZB 16
-
-/*------------------------------------------------------------*/
-/*--- Variables ---*/
-/*------------------------------------------------------------*/
-
-/* For tracking malloc'd blocks */
-extern VgHashTable MAC_(malloc_list);
-
-/* For tracking memory pools. */
-extern VgHashTable MAC_(mempool_list);
-
-/* Function pointers for the two tools to track interesting events. */
-extern void (*MAC_(new_mem_heap)) ( Addr a, SizeT len, Bool is_inited );
-extern void (*MAC_(ban_mem_heap)) ( Addr a, SizeT len );
-extern void (*MAC_(die_mem_heap)) ( Addr a, SizeT len );
-extern void (*MAC_(copy_mem_heap))( Addr from, Addr to, SizeT len );
-
-/* Function pointers for internal sanity checking. */
-extern Bool (*MAC_(check_noaccess))( Addr a, SizeT len, Addr* bad_addr )=
;
-
-/* Used in describe_addr() */
-extern Bool (*MAC_(describe_addr_supp)) ( Addr a, AddrInfo* ai );
-
-/* For VALGRIND_COUNT_LEAKS client request */
-extern SizeT MAC_(bytes_leaked);
-extern SizeT MAC_(bytes_indirect);
-extern SizeT MAC_(bytes_dubious);
-extern SizeT MAC_(bytes_reachable);
-extern SizeT MAC_(bytes_suppressed);
-
-/*------------------------------------------------------------*/
-/*--- Functions ---*/
-/*------------------------------------------------------------*/
-
-extern void MAC_(pp_AddrInfo) ( Addr a, AddrInfo* ai );
-
-extern void MAC_(clear_MAC_Error) ( MAC_Error* err_extra );
-
-extern Bool MAC_(eq_Error) ( VgRes res, Error* e1, Error* e2 );
-extern UInt MAC_(update_extra)( Error* err );
-extern Bool MAC_(read_extra_suppression_info) ( Int fd, Char* buf, Int =
nBuf, Supp *su );
-extern Bool MAC_(error_matches_suppression)(Error* err, Supp* su);
-extern Char* MAC_(get_error_name) ( Error* err );
-extern void MAC_(print_extra_suppression_info) ( Error* err );
-
-extern Bool MAC_(shared_recognised_suppression) ( Char* name, Supp* su =
);
-
-extern void* MAC_(new_block) ( ThreadId tid,
- Addr p, SizeT size, SizeT align, UInt rzB=
,
- Bool is_zeroed, MAC_AllocKind kind,
- VgHashTable table);
-
-extern void MAC_(handle_free) ( ThreadId tid,
- Addr p, UInt rzB, MAC_AllocKind kind );
-
-extern void MAC_(create_mempool)(Addr pool, UInt rzB, Bool is_zeroed);
-
-extern void MAC_(destroy_mempool)(Addr pool);
-
-extern void MAC_(mempool_alloc)(ThreadId tid,=20
- Addr pool, Addr addr, SizeT size);
-
-extern void MAC_(mempool_free)(Addr pool, Addr addr);
-
-extern void MAC_(record_address_error) ( ThreadId tid, Addr a,
- Int size, Bool isWrite );
-extern void MAC_(record_core_mem_error) ( ThreadId tid, Bool isUnaddr=
,
- Char* s );
-extern void MAC_(record_param_error) ( ThreadId tid, Addr a, Bool =
isReg,
- Bool isUnaddr, Char* msg );
-extern void MAC_(record_jump_error) ( ThreadId tid, Addr a );
-extern void MAC_(record_free_error) ( ThreadId tid, Addr a );
-extern void MAC_(record_freemismatch_error)( ThreadId tid, Addr a,
- MAC_Chunk* mc);
-extern void MAC_(record_overlap_error) ( ThreadId tid,=20
- Char* function, OverlapExtr=
a* oe );
-extern void MAC_(record_illegal_mempool_error) ( ThreadId tid, Addr pool=
);
-
-extern void MAC_(pp_shared_Error) ( Error* err);
-
-extern MAC_Chunk* MAC_(get_freed_list_head)( void );
-
-extern void MAC_(common_pre_clo_init) ( void );
-extern void MAC_(common_fini) ( void (*leak_check)(ThreadId tid,
- LeakCheckMode=
mode) );
-
-extern Bool MAC_(handle_common_client_requests) ( ThreadId tid,=20
- UWord* arg_block, UWor=
d* ret );
-
-/* For leak checking */
-extern void MAC_(pp_LeakError)(void* extra);
- =20
-extern void MAC_(print_malloc_stats) ( void );
-
-extern void MAC_(do_detect_memory_leaks) (
- ThreadId tid, LeakCheckMode mode,
- Bool (*is_within_valid_secondary) ( Addr ),
- Bool (*is_valid_aligned_word) ( Addr )
- );
-
-extern VG_REGPARM(1) void MAC_(new_mem_stack_4) ( Addr old_ESP );
-extern VG_REGPARM(1) void MAC_(die_mem_stack_4) ( Addr old_ESP );
-extern VG_REGPARM(1) void MAC_(new_mem_stack_8) ( Addr old_ESP );
-extern VG_REGPARM(1) void MAC_(die_mem_stack_8) ( Addr old_ESP );
-extern VG_REGPARM(1) void MAC_(new_mem_stack_12) ( Addr old_ESP );
-extern VG_REGPARM(1) void MAC_(die_mem_stack_12) ( Addr old_ESP );
-extern VG_REGPARM(1) void MAC_(new_mem_stack_16) ( Addr old_ESP );
-extern VG_REGPARM(1) void MAC_(die_mem_stack_16) ( Addr old_ESP );
-extern VG_REGPARM(1) void MAC_(new_mem_stack_32) ( Addr old_ESP );
-extern VG_REGPARM(1) void MAC_(die_mem_stack_32) ( Addr old_ESP );
-extern void MAC_(die_mem_stack) ( Addr a, SizeT len);
-extern void MAC_(new_mem_stack) ( Addr a, SizeT len);
-
-extern void* MAC_(malloc) ( ThreadId tid, SizeT n );
-extern void* MAC_(__builtin_new) ( ThreadId tid, SizeT n );
-extern void* MAC_(__builtin_vec_new) ( ThreadId tid, SizeT n );
-extern void* MAC_(memalign) ( ThreadId tid, SizeT align, Siz=
eT n );
-extern void* MAC_(calloc) ( ThreadId tid, SizeT nmemb, Siz=
eT size1 );
-extern void MAC_(free) ( ThreadId tid, void* p );
-extern void MAC_(__builtin_delete) ( ThreadId tid, void* p );
-extern void MAC_(__builtin_vec_delete) ( ThreadId tid, void* p );
-extern void* MAC_(realloc) ( ThreadId tid, void* p, SizeT n=
ew_size );
-
-/*------------------------------------------------------------*/
-/*--- Stack pointer adjustment ---*/
-/*------------------------------------------------------------*/
-
-/* Some noble preprocessor abuse, to enable Memcheck and Addrcheck to
- share this code, but call different functions.
-
- Note that this code is executed very frequently and must be highly
- optimised, which is why I resort to the preprocessor to achieve the
- factoring, rather than eg. using function pointers. =20
-*/
-
-#define SP_UPDATE_HANDLERS(ALIGNED4_NEW, ALIGNED4_DIE, \
- ALIGNED8_NEW, ALIGNED8_DIE, \
- UNALIGNED_NEW, UNALIGNED_DIE) \
- \
-void VG_REGPARM(1) MAC_(new_mem_stack_4)(Addr new_SP) \
-{ \
- PROF_EVENT(110, "new_mem_stack_4"); \
- if (VG_IS_4_ALIGNED(new_SP)) { \
- ALIGNED4_NEW ( -VG_STACK_REDZONE_SZB + new_SP ); \
- } else { \
- UNALIGNED_NEW ( -VG_STACK_REDZONE_SZB + new_SP, 4 ); \
- } \
-} \
- \
-void VG_REGPARM(1) MAC_(die_mem_stack_4)(Addr new_SP) \
-{ \
- PROF_EVENT(120, "die_mem_stack_4"); \
- if (VG_IS_4_ALIGNED(new_SP)) { \
- ALIGNED4_DIE ( -VG_STACK_REDZONE_SZB + new_SP-4 ); \
- } else { \
- UNALIGNED_DIE ( -VG_STACK_REDZONE_SZB + new_SP-4, 4 ); \
- } \
-} \
- \
-void VG_REGPARM(1) MAC_(new_mem_stack_8)(Addr new_SP) \
-{ \
- PROF_EVENT(111, "new_mem_stack_8"); \
- if (VG_IS_8_ALIGNED(new_SP)) { \
- ALIGNED8_NEW ( -VG_STACK_REDZONE_SZB + new_SP ); \
- } else if (VG_IS_4_ALIGNED(new_SP)) { \
- ALIGNED4_NEW ( -VG_STACK_REDZONE_SZB + new_SP ); \
- ALIGNED4_NEW ( -VG_STACK_REDZONE_SZB + new_SP+4 ); \
- } else { \
- UNALIGNED_NEW ( -VG_STACK_REDZONE_SZB + new_SP, 8 ); \
- } \
-} \
- \
-void VG_REGPARM(1) MAC_(die_mem_stack_8)(Addr new_SP) \
-{ \
- PROF_EVENT(121, "die_mem_stack_8"); \
- if (VG_IS_8_ALIGNED(new_SP)) { \
- ALIGNED8_DIE ( -VG_STACK_REDZONE_SZB + new_SP-8 ); \
- } else if (VG_IS_4_ALIGNED(new_SP)) { \
- ALIGNED4_DIE ( -VG_STACK_REDZONE_SZB + new_SP-8 ); \
- ALIGNED4_DIE ( -VG_STACK_REDZONE_SZB + new_SP-4 ); \
- } else { \
- UNALIGNED_DIE ( -VG_STACK_REDZONE_SZB + new_SP-8, 8 ); \
- } \
-} \
- \
-void VG_REGPARM(1) MAC_(new_mem_stack_12)(Addr new_SP) \
-{ \
- PROF_EVENT(112, "new_mem_stack_12"); \
- if (VG_IS_8_ALIGNED(new_SP)) { \
- ALIGNED8_NEW ( -VG_STACK_REDZONE_SZB + new_SP ); \
- ALIGNED4_NEW ( -VG_STACK_REDZONE_SZB + new_SP+8 ); \
- } else if (VG_IS_4_ALIGNED(new_SP)) { \
- ALIGNED4_NEW ( -VG_STACK_REDZONE_SZB + new_SP ); \
- ALIGNED8_NEW ( -VG_STACK_REDZONE_SZB + new_SP+4 ); \
- } else { \
- UNALIGNED_NEW ( -VG_STACK_REDZONE_SZB + new_SP, 12 ); \
- } \
-} \
- \
-void VG_REGPARM(1) MAC_(die_mem_stack_12)(Addr new_SP) \
-{ \
- PROF_EVENT(122, "die_mem_stack_12"); \
- /* Note the -12 in the test */ \
- if (VG_IS_8_ALIGNED(new_SP-12)) { \
- ALIGNED8_DIE ( -VG_STACK_REDZONE_SZB + new_SP-12 ); \
- ALIGNED4_DIE ( -VG_STACK_REDZONE_SZB + new_SP-4 ); \
- } else if (VG_IS_4_ALIGNED(new_SP)) { \
- ALIGNED4_DIE ( -VG_STACK_REDZONE_SZB + new_SP-12 ); \
- ALIGNED8_DIE ( -VG_STACK_REDZONE_SZB + new_SP-8 ); \
- } else { \
- UNALIGNED_DIE ( -VG_STACK_REDZONE_SZB + new_SP-12, 12 ); \
- } \
-} \
- \
-void VG_REGPARM(1) MAC_(new_mem_stack_16)(Addr new_SP) \
-{ \
- PROF_EVENT(113, "new_mem_stack_16"); \
- if (VG_IS_8_ALIGNED(new_SP)) { \
- ALIGNED8_NEW ( -VG_STACK_REDZONE_SZB + new_SP ); \
- ALIGNED8_NEW ( -VG_STACK_REDZONE_SZB + new_SP+8 ); \
- } else if (VG_IS_4_ALIGNED(new_SP)) { \
- ALIGNED4_NEW ( -VG_STACK_REDZONE_SZB + new_SP ); \
- ALIGNED8_NEW ( -VG_STACK_REDZONE_SZB + new_SP+4 ); \
- ALIGNED4_NEW ( -VG_STACK_REDZONE_SZB + new_SP+12 ); \
- } else { \
- UNALIGNED_NEW ( -VG_STACK_REDZONE_SZB + new_SP, 16 ); \
- } \
-} \
- \
-void VG_REGPARM(1) MAC_(die_mem_stack_16)(Addr new_SP) \
-{ \
- PROF_EVENT(123, "die_mem_stack_16"); \
- if (VG_IS_8_ALIGNED(new_SP)) { \
- ALIGNED8_DIE ( -VG_STACK_REDZONE_SZB + new_SP-16 ); \
- ALIGNED8_DIE ( -VG_STACK_REDZONE_SZB + new_SP-8 ); \
- } else if (VG_IS_4_ALIGNED(new_SP)) { \
- ALIGNED4_DIE ( -VG_STACK_REDZONE_SZB + new_SP-16 ); \
- ALIGNED8_DIE ( -VG_STACK_REDZONE_SZB + new_SP-12 ); \
- ALIGNED4_DIE ( -VG_STACK_REDZONE_SZB + new_SP-4 ); \
- } else { \
- UNALIGNED_DIE ( -VG_STACK_REDZONE_SZB + new_SP-16, 16 ); \
- } \
-} \
- \
-void VG_REGPARM(1) MAC_(new_mem_stack_32)(Addr new_SP) \
-{ \
- PROF_EVENT(114, "new_mem_stack_32"); \
- if (VG_IS_8_ALIGNED(new_SP)) { \
- ALIGNED8_NEW ( -VG_STACK_REDZONE_SZB + new_SP ); \
- ALIGNED8_NEW ( -VG_STACK_REDZONE_SZB + new_SP+8 ); \
- ALIGNED8_NEW ( -VG_STACK_REDZONE_SZB + new_SP+16 ); \
- ALIGNED8_NEW ( -VG_STACK_REDZONE_SZB + new_SP+24 ); \
- } else if (VG_IS_4_ALIGNED(new_SP)) { \
- ALIGNED4_NEW ( -VG_STACK_REDZONE_SZB + new_SP ); \
- ALIGNED8_NEW ( -VG_STACK_REDZONE_SZB + new_SP+4 ); \
- ALIGNED8_NEW ( -VG_STACK_REDZONE_SZB + new_SP+12 ); \
- ALIGNED8_NEW ( -VG_STACK_REDZONE_SZB + new_SP+20 ); \
- ALIGNED4_NEW ( -VG_STACK_REDZONE_SZB + new_SP+28 ); \
- } else { \
- UNALIGNED_NEW ( -VG_STACK_REDZONE_SZB + new_SP, 32 ); \
- } \
-} \
- \
-void VG_REGPARM(1) MAC_(die_mem_stack_32)(Addr new_SP) \
-{ \
- PROF_EVENT(124, "die_mem_stack_32"); \
- if (VG_IS_8_ALIGNED(new_SP)) { \
- ALIGNED8_DIE ( -VG_STACK_REDZONE_SZB + new_SP-32 ); \
- ALIGNED8_DIE ( -VG_STACK_REDZONE_SZB + new_SP-24 ); \
- ALIGNED8_DIE ( -VG_STACK_REDZONE_SZB + new_SP-16 ); \
- ALIGNED8_DIE ( -VG_STACK_REDZONE_SZB + new_SP- 8 ); \
- } else if (VG_IS_4_ALIGNED(new_SP)) { \
- ALIGNED4_DIE ( -VG_STACK_REDZONE_SZB + new_SP-32 ); \
- ALIGNED8_DIE ( -VG_STACK_REDZONE_SZB + new_SP-28 ); \
- ALIGNED8_DIE ( -VG_STACK_REDZONE_SZB + new_SP-20 ); \
- ALIGNED8_DIE ( -VG_STACK_REDZONE_SZB + new_SP-12 ); \
- ALIGNED4_DIE ( -VG_STACK_REDZONE_SZB + new_SP-4 ); \
- } else { \
- UNALIGNED_DIE ( -VG_STACK_REDZONE_SZB + new_SP-32, 32 ); \
- } \
-} \
- \
-void MAC_(new_mem_stack) ( Addr a, SizeT len ) \
-{ \
- PROF_EVENT(115, "new_mem_stack"); \
- UNALIGNED_NEW ( -VG_STACK_REDZONE_SZB + a, len ); \
-} \
- \
-void MAC_(die_mem_stack) ( Addr a, SizeT len ) \
-{ \
- PROF_EVENT(125, "die_mem_stack"); \
- UNALIGNED_DIE ( -VG_STACK_REDZONE_SZB + a, len ); \
-}
-
-#endif /* __MAC_SHARED_H */
-
-/*--------------------------------------------------------------------*/
-/*--- end ---*/
-/*--------------------------------------------------------------------*/
Modified: branches/COMPVBITS/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
--- branches/COMPVBITS/memcheck/mc_include.h 2005-12-07 00:04:22 UTC (rev=
5307)
+++ branches/COMPVBITS/memcheck/mc_include.h 2005-12-07 00:36:51 UTC (rev=
5308)
@@ -29,25 +29,529 @@
The GNU General Public License is contained in the file COPYING.
*/
=20
-/* Note: this header should contain declarations that are for use by
- Memcheck only -- declarations shared with Addrcheck go in mac_shared.=
h.
-*/
-
#ifndef __MC_INCLUDE_H
#define __MC_INCLUDE_H
=20
-#include "mac_shared.h"
+#define MAC_(str) VGAPPEND(vgMAC_,str)
=20
+/*------------------------------------------------------------*/
+/*--- Errors and suppressions ---*/
+/*------------------------------------------------------------*/
+
+/* The classification of a faulting address. */
+typedef=20
+ enum {=20
+ Undescribed, // as-yet unclassified
+ Stack,=20
+ Unknown, // classification yielded nothing useful
+ Freed, Mallocd,=20
+ UserG, // in a user-defined block
+ Mempool, // in a mempool
+ Register, // in a register; for Param errors only
+ }
+ AddrKind;
+
+/* Records info about a faulting address. */
+typedef
+ struct { // Used by:
+ AddrKind akind; // ALL
+ SizeT blksize; // Freed, Mallocd
+ OffT rwoffset; // Freed, Mallocd
+ ExeContext* lastchange; // Freed, Mallocd
+ ThreadId stack_tid; // Stack
+ const Char *desc; // UserG
+ Bool maybe_gcc; // True if just below %esp -- could be a g=
cc bug.
+ }
+ AddrInfo;
+
+typedef=20
+ enum {=20
+ ParamSupp, // Bad syscall params
+ CoreMemSupp, // Memory errors in core (pthread ops, signal handl=
ing)
+
+ // Use of invalid values of given size (MemCheck only)
+ Value0Supp, Value1Supp, Value2Supp, Value4Supp, Value8Supp, Value1=
6Supp,
+
+ // Invalid read/write attempt at given size
+ Addr1Supp, Addr2Supp, Addr4Supp, Addr8Supp, Addr16Supp,
+
+ FreeSupp, // Invalid or mismatching free
+ OverlapSupp, // Overlapping blocks in memcpy(), strcpy(), etc
+ LeakSupp, // Something to be suppressed in a leak check.
+ MempoolSupp, // Memory pool suppression.
+ }=20
+ MAC_SuppKind;
+
+/* What kind of error it is. */
+typedef=20
+ enum { ValueErr, /* Memcheck only */
+ CoreMemErr,
+ AddrErr,=20
+ ParamErr, UserErr, /* behaves like an anonymous ParamErr */
+ FreeErr, FreeMismatchErr,
+ OverlapErr,
+ LeakErr,
+ IllegalMempoolErr,
+ }
+ MAC_ErrorKind;
+
+/* What kind of memory access is involved in the error? */
+typedef
+ enum { ReadAxs, WriteAxs, ExecAxs }
+ AxsKind;
+
+/* Extra context for memory errors */
+typedef
+ struct { // Used by:
+ AxsKind axskind; // AddrErr
+ Int size; // AddrErr, ValueErr
+ AddrInfo addrinfo; // {Addr,Free,FreeMismatch,Param,User}Err
+ Bool isUnaddr; // {CoreMem,Param,User}Err
+ }
+ MAC_Error;
+
+/* Extra info for overlap errors */
+typedef
+ struct {
+ Addr src;
+ Addr dst;
+ Int len; // -1 if unused
+ }
+ OverlapExtra;
+
+/* For malloc()/new/new[] vs. free()/delete/delete[] mismatch checking. =
*/
+typedef
+ enum {
+ MAC_AllocMalloc =3D 0,
+ MAC_AllocNew =3D 1,
+ MAC_AllocNewVec =3D 2,
+ MAC_AllocCustom =3D 3
+ }
+ MAC_AllocKind;
+ =20
+/* Nb: first two fields must match core's VgHashNode. */
+typedef
+ struct _MAC_Chunk {
+ struct _MAC_Chunk* next;
+ Addr data; // ptr to actual block
+ SizeT size : (sizeof(UWord)*8)-2; // size requested; 30 or=
62 bits
+ MAC_AllocKind allockind : 2; // which wrapper did the allocation
+ ExeContext* where; // where it was allocated
+ }
+ MAC_Chunk;
+
+/* Memory pool. Nb: first two fields must match core's VgHashNode. */
+typedef
+ struct _MAC_Mempool {
+ struct _MAC_Mempool* next;
+ Addr pool; // pool identifier
+ SizeT rzB; // pool red-zone size
+ Bool is_zeroed; // allocations from this pool are ze=
roed
+ VgHashTable chunks; // chunks associated with this pool
+ }
+ MAC_Mempool;
+
+
+/*------------------------------------------------------------*/
+/*--- Profiling of tools and memory events ---*/
+/*------------------------------------------------------------*/
+
+typedef=20
+ enum {=20
+ VgpCheckMem =3D VgpFini+1,
+ VgpSetMem,
+ VgpESPAdj
+ }=20
+ VgpToolCC;
+
+/* Define to collect detailed performance info. */
+/* #define MAC_PROFILE_MEMORY */
+
+#ifdef MAC_PROFILE_MEMORY
+# define N_PROF_EVENTS 500
+
+extern UInt MAC_(event_ctr)[N_PROF_EVENTS];
+extern HChar* MAC_(event_ctr_name)[N_PROF_EVENTS];
+
+# define PROF_EVENT(ev, name) \
+ do { tl_assert((ev) >=3D 0 && (ev) < N_PROF_EVENTS); \
+ /* crude and inaccurate check to ensure the same */ \
+ /* event isn't being used with > 1 name */ \
+ if (MAC_(event_ctr_name)[ev]) \
+ tl_assert(name =3D=3D MAC_(event_ctr_name)[ev]); \
+ MAC_(event_ctr)[ev]++; \
+ MAC_(event_ctr_name)[ev] =3D (name); \
+ } while (False);
+
+#else
+
+# define PROF_EVENT(ev, name) /* */
+
+#endif /* MAC_PROFILE_MEMORY */
+
+
+/*------------------------------------------------------------*/
+/*--- V and A bits (Victoria & Albert ?) ---*/
+/*------------------------------------------------------------*/
+
+/* The number of entries in the primary map can be altered. However
+ we hardwire the assumption that each secondary map covers precisely
+ 64k of address space. */
+#define SM_SIZE 65536 /* DO NOT CHANGE */
+#define SM_MASK (SM_SIZE-1) /* DO NOT CHANGE */
+
+#define VGM_BIT_VALID 0
+#define VGM_BIT_INVALID 1
+
+#define VGM_NIBBLE_VALID 0
+#define VGM_NIBBLE_INVALID 0xF
+
+#define VGM_BYTE_VALID 0
+#define VGM_BYTE_INVALID 0xFF
+
+#define VGM_SHORT_VALID 0
+#define VGM_SHORT_INVALID 0xFFFF
+
+#define VGM_WORD32_VALID 0
+#define VGM_WORD32_INVALID 0xFFFFFFFF
+
+#define VGM_WORD64_VALID 0ULL
+#define VGM_WORD64_INVALID 0xFFFFFFFFFFFFFFFFULL
+
+
+/* We want a 16B redzone on heap blocks for Memcheck */
+#define MAC_MALLOC_REDZONE_SZB 16
+
+/*------------------------------------------------------------*/
+/*--- Variables ---*/
+/*------------------------------------------------------------*/
+
+/* For tracking malloc'd blocks */
+extern VgHashTable MAC_(malloc_list);
+
+/* For tracking memory pools. */
+extern VgHashTable MAC_(mempool_list);
+
+/* Function pointers for the two tools to track interesting events. */
+extern void (*MAC_(new_mem_heap)) ( Addr a, SizeT len, Bool is_inited );
+extern void (*MAC_(ban_mem_heap)) ( Addr a, SizeT len );
+extern void (*MAC_(die_mem_heap)) ( Addr a, SizeT len );
+extern void (*MAC_(copy_mem_heap))( Addr from, Addr to, SizeT len );
+
+/* Function pointers for internal sanity checking. */
+extern Bool (*MAC_(check_noaccess))( Addr a, SizeT len, Addr* bad_addr )=
;
+
+/* Used in describe_addr() */
+extern Bool (*MAC_(describe_addr_supp)) ( Addr a, AddrInfo* ai );
+
+/* For VALGRIND_COUNT_LEAKS client request */
+extern SizeT MAC_(bytes_leaked);
+extern SizeT MAC_(bytes_indirect);
+extern SizeT MAC_(bytes_dubious);
+extern SizeT MAC_(bytes_reachable);
+extern SizeT MAC_(bytes_suppressed);
+
+/*------------------------------------------------------------*/
+/*--- Functions ---*/
+/*------------------------------------------------------------*/
+
+extern void MAC_(pp_AddrInfo) ( Addr a, AddrInfo* ai );
+
+extern void MAC_(clear_MAC_Error) ( MAC_Error* err_extra );
+
+extern Bool MAC_(eq_Error) ( VgRes res, Error* e1, Error* e2 );
+extern UInt MAC_(update_extra)( Error* err );
+extern Bool MAC_(read_extra_suppression_info) ( Int fd, Char* buf, Int =
nBuf, Supp *su );
+extern Bool MAC_(error_matches_suppression)(Error* err, Supp* su);
+extern Char* MAC_(get_error_name) ( Error* err );
+extern void MAC_(print_extra_suppression_info) ( Error* err );
+
+extern Bool MAC_(shared_recognised_suppression) ( Char* name, Supp* su =
);
+
+extern void* MAC_(new_block) ( ThreadId tid,
+ Addr p, SizeT size, SizeT align, UInt rzB=
,
+...
[truncated message content] |
|
From: <sv...@va...> - 2005-12-07 00:04:24
|
Author: njn Date: 2005-12-07 00:04:22 +0000 (Wed, 07 Dec 2005) New Revision: 5307 Log: Remove some random references to Addrcheck. Modified: branches/COMPVBITS/include/pub_tool_signals.h branches/COMPVBITS/memcheck/tests/addressable.c branches/COMPVBITS/memcheck/tests/x86/scalar.c Modified: branches/COMPVBITS/include/pub_tool_signals.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 --- branches/COMPVBITS/include/pub_tool_signals.h 2005-12-07 00:00:36 UTC= (rev 5306) +++ branches/COMPVBITS/include/pub_tool_signals.h 2005-12-07 00:04:22 UTC= (rev 5307) @@ -36,8 +36,8 @@ // not expected to return. // // It's frustrating that we need this header for a single function used -// only by Memcheck and Addrcheck during leak checking. We should find -// a way to remove the need for this file. +// only by Memcheck during leak checking. We should find a way to remov= e +// the need for this file. extern void VG_(set_fault_catcher)(void (*catcher)(Int sig, Addr addr)); =20 #endif // __PUB_TOOL_SIGNALS_H Modified: branches/COMPVBITS/memcheck/tests/addressable.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 --- branches/COMPVBITS/memcheck/tests/addressable.c 2005-12-07 00:00:36 U= TC (rev 5306) +++ branches/COMPVBITS/memcheck/tests/addressable.c 2005-12-07 00:04:22 U= TC (rev 5307) @@ -47,7 +47,7 @@ =20 VALGRIND_CHECK_READABLE(&m[pgsz*2], pgsz); /* undefined */ =20 - /* XXX need an memcheck/addrcheck request to test addressability */ + /* XXX need a memcheck request to test addressability */ m[pgsz*2] =3D 'x'; /* unmapped fault */ } =20 Modified: branches/COMPVBITS/memcheck/tests/x86/scalar.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 --- branches/COMPVBITS/memcheck/tests/x86/scalar.c 2005-12-07 00:00:36 UT= C (rev 5306) +++ branches/COMPVBITS/memcheck/tests/x86/scalar.c 2005-12-07 00:04:22 UT= C (rev 5307) @@ -11,7 +11,7 @@ // Occasionally we have to be careful not to cause Valgrind to seg fault= in // its pre-syscall wrappers; it does so because it can't know in genera= l // when memory is unaddressable, and so tries to dereference it when doi= ng -// PRE_MEM_READ/PRE_MEM_WRITE calls. (Note that Memcheck and Addrcheck = will +// PRE_MEM_READ/PRE_MEM_WRITE calls. (Note that Memcheck will // always issue an error message immediately before these seg faults occ= ur). =20 //#include <asm/ipc.h> |
|
From: <sv...@va...> - 2005-12-07 00:00:45
|
Author: njn
Date: 2005-12-07 00:00:36 +0000 (Wed, 07 Dec 2005)
New Revision: 5306
Log:
Removed Addrcheck. It's not necessary in a world where Memcheck has a
shadow memory overhead of only 25% and has an
--undef-value-errors=3Dno option.
Removed:
branches/COMPVBITS/addrcheck/
Modified:
branches/COMPVBITS/Makefile.am
branches/COMPVBITS/configure.in
Modified: branches/COMPVBITS/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
--- branches/COMPVBITS/Makefile.am 2005-12-06 23:53:12 UTC (rev 5305)
+++ branches/COMPVBITS/Makefile.am 2005-12-07 00:00:36 UTC (rev 5306)
@@ -3,21 +3,17 @@
=20
include $(top_srcdir)/Makefile.all.am=20
=20
-## addrcheck must come after memcheck, for mac_*.o
TOOLS =3D memcheck \
cachegrind \
massif \
lackey \
none
=20
-## addrcheck \
-
# Temporary: we want to compile Helgrind, but not regtest it.
-# And we want to include Addrcheck in the distro, but not compile/test i=
t.
# Put docs last because building the HTML is slow and we want to get
# everything else working before we try it.
SUBDIRS =3D include coregrind . tests auxprogs $(TOOLS) helgrind docs
-DIST_SUBDIRS =3D $(SUBDIRS) addrcheck
+DIST_SUBDIRS =3D $(SUBDIRS)
=20
SUPP_FILES =3D \
glibc-2.2.supp glibc-2.3.supp glibc-2.4.supp \
Modified: branches/COMPVBITS/configure.in
=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
--- branches/COMPVBITS/configure.in 2005-12-06 23:53:12 UTC (rev 5305)
+++ branches/COMPVBITS/configure.in 2005-12-07 00:00:36 UTC (rev 5306)
@@ -477,9 +477,6 @@
include/Makefile=20
auxprogs/Makefile
coregrind/Makefile=20
- addrcheck/Makefile
- addrcheck/tests/Makefile
- addrcheck/docs/Makefile
memcheck/Makefile
memcheck/tests/Makefile
memcheck/tests/amd64/Makefile
|