Track Vex API change in rev 1062: pass both the guest and host word
sizes to the instrumentatation functions. Make most of the tools
abort if they are not the same; we can't handle that case yet.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3397 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/addrcheck/ac_main.c b/addrcheck/ac_main.c
index e93981a..bcb937a 100644
--- a/addrcheck/ac_main.c
+++ b/addrcheck/ac_main.c
@@ -986,7 +986,8 @@
/*--- Our instrumenter ---*/
/*------------------------------------------------------------*/
-IRBB* TL_(instrument)(IRBB* bb_in, VexGuestLayout* layout, IRType hWordTy )
+IRBB* TL_(instrument)(IRBB* bb_in, VexGuestLayout* layout,
+ IRType gWordTy, IRType hWordTy )
{
Int i, hsz;
IRStmt* st;
@@ -995,9 +996,15 @@
IRExpr* guard;
IRDirty* di;
Bool isLoad;
+ IRBB* bb;
+
+ if (gWordTy != hWordTy) {
+ /* We don't currently support this case. */
+ VG_(tool_panic)("host/guest word size mismatch");
+ }
/* Set up BB */
- IRBB* bb = emptyIRBB();
+ bb = emptyIRBB();
bb->tyenv = dopyIRTypeEnv(bb_in->tyenv);
bb->next = dopyIRExpr(bb_in->next);
bb->jumpkind = bb_in->jumpkind;
diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c
index d6e18ee..40fd86c 100644
--- a/cachegrind/cg_main.c
+++ b/cachegrind/cg_main.c
@@ -559,7 +559,8 @@
addStmtToIRBB( bbOut, IRStmt_Dirty(di) );
}
-IRBB* TL_(instrument) ( IRBB* bbIn, VexGuestLayout* layout, IRType hWordTy )
+IRBB* TL_(instrument) ( IRBB* bbIn, VexGuestLayout* layout,
+ IRType gWordTy, IRType hWordTy )
{
Int i, dataSize = 0, bbInfo_i;
IRBB* bbOut;
@@ -570,6 +571,11 @@
UInt instrLen;
IRExpr *loadAddrExpr, *storeAddrExpr;
+ if (gWordTy != hWordTy) {
+ /* We don't currently support this case. */
+ VG_(tool_panic)("host/guest word size mismatch");
+ }
+
/* Set up BB */
bbOut = emptyIRBB();
bbOut->tyenv = dopyIRTypeEnv(bbIn->tyenv);
diff --git a/corecheck/cc_main.c b/corecheck/cc_main.c
index 2601570..0d81512 100644
--- a/corecheck/cc_main.c
+++ b/corecheck/cc_main.c
@@ -51,7 +51,8 @@
{
}
-IRBB* TL_(instrument)(IRBB* bb_in, VexGuestLayout* layout, IRType hWordTy )
+IRBB* TL_(instrument)(IRBB* bb_in, VexGuestLayout* layout,
+ IRType gWordTy, IRType hWordTy )
{
return bb_in;
}
diff --git a/coregrind/toolfuncs.def b/coregrind/toolfuncs.def
index 1806c3b..4fa66de 100644
--- a/coregrind/toolfuncs.def
+++ b/coregrind/toolfuncs.def
@@ -26,7 +26,7 @@
## Instrument a basic block. Must be a true function, ie. the same input
## always results in the same output, because basic blocks can be
## retranslated. Unless you're doing something really strange...
-IRBB*, instrument, IRBB* bb, VexGuestLayout* layout, IRType hWordTy
+IRBB*, instrument, IRBB* bb, VexGuestLayout* layout, IRType gWordTy, IRType hWordTy
## Finish up, print out any results, etc. `exitcode' is program's exit
## code. The shadow can be found with VG_(get_exit_status_shadow)().
diff --git a/lackey/lk_main.c b/lackey/lk_main.c
index ef05d90..55fdc7e 100644
--- a/lackey/lk_main.c
+++ b/lackey/lk_main.c
@@ -129,13 +129,20 @@
Which gives us the right answer. And just to avoid two C calls, we fold
the basic-block-beginning call in with add_one_BB(). Phew.
*/
-IRBB* TL_(instrument)(IRBB* bb_in, VexGuestLayout* layout, IRType hWordTy )
+IRBB* TL_(instrument)(IRBB* bb_in, VexGuestLayout* layout,
+ IRType gWordTy, IRType hWordTy )
{
IRDirty* di;
Int i;
+ IRBB* bb;
+
+ if (gWordTy != hWordTy) {
+ /* We don't currently support this case. */
+ VG_(tool_panic)("host/guest word size mismatch");
+ }
/* Set up BB */
- IRBB* bb = emptyIRBB();
+ bb = emptyIRBB();
bb->tyenv = dopyIRTypeEnv(bb_in->tyenv);
bb->next = dopyIRExpr(bb_in->next);
bb->jumpkind = bb_in->jumpkind;
diff --git a/massif/ms_main.c b/massif/ms_main.c
index 9ce0407..1576b5f 100644
--- a/massif/ms_main.c
+++ b/massif/ms_main.c
@@ -1210,8 +1210,10 @@
/*--- Instrumentation ---*/
/*------------------------------------------------------------*/
-IRBB* TL_(instrument) ( IRBB* bb_in, VexGuestLayout* layout, IRType hWordTy )
+IRBB* TL_(instrument) ( IRBB* bb_in, VexGuestLayout* layout,
+ IRType gWordTy, IRType hWordTy )
{
+ /* XXX Will Massif work when gWordTy != hWordTy ? */
return bb_in;
}
diff --git a/memcheck/mc_translate.c b/memcheck/mc_translate.c
index 5dc79be..f6f984b 100644
--- a/memcheck/mc_translate.c
+++ b/memcheck/mc_translate.c
@@ -2383,16 +2383,23 @@
}
-IRBB* TL_(instrument) ( IRBB* bb_in, VexGuestLayout* layout, IRType hWordTy )
+IRBB* TL_(instrument) ( IRBB* bb_in, VexGuestLayout* layout,
+ IRType gWordTy, IRType hWordTy )
{
Bool verboze = False; //True;
Int i, j, first_stmt;
IRStmt* st;
MCEnv mce;
+ IRBB* bb;
+
+ if (gWordTy != hWordTy) {
+ /* We don't currently support this case. */
+ VG_(tool_panic)("host/guest word size mismatch");
+ }
/* Set up BB */
- IRBB* bb = emptyIRBB();
+ bb = emptyIRBB();
bb->tyenv = dopyIRTypeEnv(bb_in->tyenv);
bb->next = dopyIRExpr(bb_in->next);
bb->jumpkind = bb_in->jumpkind;
diff --git a/none/nl_main.c b/none/nl_main.c
index c2fcb58..2f136c2 100644
--- a/none/nl_main.c
+++ b/none/nl_main.c
@@ -46,7 +46,8 @@
{
}
-IRBB* TL_(instrument)(IRBB* bb, VexGuestLayout* layout, IRType hWordTy)
+IRBB* TL_(instrument)(IRBB* bb, VexGuestLayout* layout,
+ IRType gWordTy, IRType hWordTy)
{
return bb;
}