]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Make diagnostics for SIGILL more controllable (VEX part).
authorJulian Seward <jseward@acm.org>
Thu, 6 Dec 2012 18:08:04 +0000 (18:08 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 6 Dec 2012 18:08:04 +0000 (18:08 +0000)
Fixes #309425.  (Mark Wielaard, mjw@redhat.com)

git-svn-id: svn://svn.valgrind.org/vex/trunk@2582

16 files changed:
VEX/priv/guest_amd64_defs.h
VEX/priv/guest_amd64_toIR.c
VEX/priv/guest_arm_defs.h
VEX/priv/guest_arm_toIR.c
VEX/priv/guest_generic_bb_to_IR.c
VEX/priv/guest_generic_bb_to_IR.h
VEX/priv/guest_mips_defs.h
VEX/priv/guest_mips_toIR.c
VEX/priv/guest_ppc_defs.h
VEX/priv/guest_ppc_toIR.c
VEX/priv/guest_s390_defs.h
VEX/priv/guest_s390_toIR.c
VEX/priv/guest_x86_defs.h
VEX/priv/guest_x86_toIR.c
VEX/priv/main_main.c
VEX/pub/libvex.h

index f687d90a93b2f354a662d39dab1140b12262abee..303d4eb54cec847fde01245c4996d6e67775045f 100644 (file)
@@ -60,7 +60,8 @@ DisResult disInstr_AMD64 ( IRSB*        irbb,
                            VexArch      guest_arch,
                            VexArchInfo* archinfo,
                            VexAbiInfo*  abiinfo,
-                           Bool         host_bigendian );
+                           Bool         host_bigendian,
+                           Bool         sigill_diag );
 
 /* Used by the optimiser to specialise calls to helpers. */
 extern
index 53553ebee3b9a3631b08e013eaef9fe09c14eed6..9e8df2694f335e17adcceb012a3b2fe0ddd3a725 100644 (file)
@@ -26616,7 +26616,8 @@ DisResult disInstr_AMD64_WRK (
              void*        callback_opaque,
              Long         delta64,
              VexArchInfo* archinfo,
-             VexAbiInfo*  vbi
+             VexAbiInfo*  vbi,
+             Bool         sigill_diag
           )
 {
    IRTemp    t1, t2, t3, t4, t5, t6;
@@ -27167,29 +27168,31 @@ DisResult disInstr_AMD64_WRK (
      //default:
   decode_failure:
    /* All decode failures end up here. */
-   vex_printf("vex amd64->IR: unhandled instruction bytes: "
-              "0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",
-              (Int)getUChar(delta_start+0),
-              (Int)getUChar(delta_start+1),
-              (Int)getUChar(delta_start+2),
-              (Int)getUChar(delta_start+3),
-              (Int)getUChar(delta_start+4),
-              (Int)getUChar(delta_start+5),
-              (Int)getUChar(delta_start+6),
-              (Int)getUChar(delta_start+7) );
-   vex_printf("vex amd64->IR:   REX=%d REX.W=%d REX.R=%d REX.X=%d REX.B=%d\n",
-              haveREX(pfx) ? 1 : 0, getRexW(pfx), getRexR(pfx),
-              getRexX(pfx), getRexB(pfx));
-   vex_printf("vex amd64->IR:   VEX=%d VEX.L=%d VEX.nVVVV=0x%x ESC=%s\n",
-              haveVEX(pfx) ? 1 : 0, getVexL(pfx),
-              getVexNvvvv(pfx),
-              esc==ESC_NONE ? "NONE" :
-                esc==ESC_0F ? "0F" :
-                esc==ESC_0F38 ? "0F38" :
-                esc==ESC_0F3A ? "0F3A" : "???");
-   vex_printf("vex amd64->IR:   PFX.66=%d PFX.F2=%d PFX.F3=%d\n",
-              have66(pfx) ? 1 : 0, haveF2(pfx) ? 1 : 0,
-              haveF3(pfx) ? 1 : 0);
+   if (sigill_diag) {
+      vex_printf("vex amd64->IR: unhandled instruction bytes: "
+                 "0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",
+                 (Int)getUChar(delta_start+0),
+                 (Int)getUChar(delta_start+1),
+                 (Int)getUChar(delta_start+2),
+                 (Int)getUChar(delta_start+3),
+                 (Int)getUChar(delta_start+4),
+                 (Int)getUChar(delta_start+5),
+                 (Int)getUChar(delta_start+6),
+                 (Int)getUChar(delta_start+7) );
+      vex_printf("vex amd64->IR:   REX=%d REX.W=%d REX.R=%d REX.X=%d REX.B=%d\n",
+                 haveREX(pfx) ? 1 : 0, getRexW(pfx), getRexR(pfx),
+                 getRexX(pfx), getRexB(pfx));
+      vex_printf("vex amd64->IR:   VEX=%d VEX.L=%d VEX.nVVVV=0x%x ESC=%s\n",
+                 haveVEX(pfx) ? 1 : 0, getVexL(pfx),
+                 getVexNvvvv(pfx),
+                 esc==ESC_NONE ? "NONE" :
+                   esc==ESC_0F ? "0F" :
+                   esc==ESC_0F38 ? "0F38" :
+                   esc==ESC_0F3A ? "0F3A" : "???");
+      vex_printf("vex amd64->IR:   PFX.66=%d PFX.F2=%d PFX.F3=%d\n",
+                 have66(pfx) ? 1 : 0, haveF2(pfx) ? 1 : 0,
+                 haveF3(pfx) ? 1 : 0);
+   }
 
    /* Tell the dispatcher that this insn cannot be decoded, and so has
       not been executed, and (is currently) the next to be executed.
@@ -27252,7 +27255,8 @@ DisResult disInstr_AMD64 ( IRSB*        irsb_IN,
                            VexArch      guest_arch,
                            VexArchInfo* archinfo,
                            VexAbiInfo*  abiinfo,
-                           Bool         host_bigendian_IN )
+                           Bool         host_bigendian_IN,
+                           Bool         sigill_diag_IN )
 {
    Int       i, x1, x2;
    Bool      expect_CAS, has_CAS;
@@ -27275,7 +27279,7 @@ DisResult disInstr_AMD64 ( IRSB*        irsb_IN,
    dres = disInstr_AMD64_WRK ( &expect_CAS, resteerOkFn,
                                resteerCisOk,
                                callback_opaque,
-                               delta, archinfo, abiinfo );
+                               delta, archinfo, abiinfo, sigill_diag_IN );
    x2 = irsb_IN->stmts_used;
    vassert(x2 >= x1);
 
@@ -27308,7 +27312,7 @@ DisResult disInstr_AMD64 ( IRSB*        irsb_IN,
       dres = disInstr_AMD64_WRK ( &expect_CAS, resteerOkFn,
                                   resteerCisOk,
                                   callback_opaque,
-                                  delta, archinfo, abiinfo );
+                                  delta, archinfo, abiinfo, sigill_diag_IN );
       for (i = x1; i < x2; i++) {
          vex_printf("\t\t");
          ppIRStmt(irsb_IN->stmts[i]);
index e064b40bc548d12996c6ad8459b8245ac9ba38e1..9702dbd345551c8f83d8317183845112f4d662e8 100644 (file)
@@ -52,7 +52,8 @@ DisResult disInstr_ARM ( IRSB*        irbb,
                          VexArch      guest_arch,
                          VexArchInfo* archinfo,
                          VexAbiInfo*  abiinfo,
-                         Bool         host_bigendian );
+                         Bool         host_bigendian,
+                         Bool         sigill_diag );
 
 /* Used by the optimiser to specialise calls to helpers. */
 extern
index a59b6cb47844315e1cf3c46624d1d1f2380bf6a5..fe8ee477ad24161825aa54502e1ee933a6524379 100644 (file)
@@ -12568,7 +12568,8 @@ DisResult disInstr_ARM_WRK (
              void*        callback_opaque,
              UChar*       guest_instr,
              VexArchInfo* archinfo,
-             VexAbiInfo*  abiinfo
+             VexAbiInfo*  abiinfo,
+             Bool         sigill_diag
           )
 {
    // A macro to fish bits out of 'insn'.
@@ -14664,15 +14665,17 @@ DisResult disInstr_ARM_WRK (
 
   decode_failure:
    /* All decode failures end up here. */
-   vex_printf("disInstr(arm): unhandled instruction: "
-              "0x%x\n", insn);
-   vex_printf("                 cond=%d(0x%x) 27:20=%u(0x%02x) "
-                                "4:4=%d "
-                                "3:0=%u(0x%x)\n",
-              (Int)INSN_COND, (UInt)INSN_COND,
-              (Int)INSN(27,20), (UInt)INSN(27,20),
-              (Int)INSN(4,4),
-              (Int)INSN(3,0), (UInt)INSN(3,0) );
+   if (sigill_diag) {
+      vex_printf("disInstr(arm): unhandled instruction: "
+                 "0x%x\n", insn);
+      vex_printf("                 cond=%d(0x%x) 27:20=%u(0x%02x) "
+                                   "4:4=%d "
+                                   "3:0=%u(0x%x)\n",
+                 (Int)INSN_COND, (UInt)INSN_COND,
+                 (Int)INSN(27,20), (UInt)INSN(27,20),
+                 (Int)INSN(4,4),
+                 (Int)INSN(3,0), (UInt)INSN(3,0) );
+   }
 
    /* Tell the dispatcher that this insn cannot be decoded, and so has
       not been executed, and (is currently) the next to be executed.
@@ -14781,7 +14784,8 @@ DisResult disInstr_THUMB_WRK (
              void*        callback_opaque,
              UChar*       guest_instr,
              VexArchInfo* archinfo,
-             VexAbiInfo*  abiinfo
+             VexAbiInfo*  abiinfo,
+             Bool         sigill_diag
           )
 {
    /* A macro to fish bits out of insn0.  There's also INSN1, to fish
@@ -18785,8 +18789,9 @@ DisResult disInstr_THUMB_WRK (
 
   decode_failure:
    /* All decode failures end up here. */
-   vex_printf("disInstr(thumb): unhandled instruction: "
-              "0x%04x 0x%04x\n", (UInt)insn0, (UInt)insn1);
+   if (sigill_diag)
+      vex_printf("disInstr(thumb): unhandled instruction: "
+                 "0x%04x 0x%04x\n", (UInt)insn0, (UInt)insn1);
 
    /* Back up ITSTATE to the initial value for this instruction.
       If we don't do that, any subsequent restart of the instruction
@@ -18931,7 +18936,8 @@ DisResult disInstr_ARM ( IRSB*        irsb_IN,
                          VexArch      guest_arch,
                          VexArchInfo* archinfo,
                          VexAbiInfo*  abiinfo,
-                         Bool         host_bigendian_IN )
+                         Bool         host_bigendian_IN,
+                         Bool         sigill_diag_IN )
 {
    DisResult dres;
    Bool isThumb = (Bool)(guest_IP_ENCODED & 1);
@@ -18953,12 +18959,12 @@ DisResult disInstr_ARM ( IRSB*        irsb_IN,
       dres = disInstr_THUMB_WRK ( resteerOkFn,
                                   resteerCisOk, callback_opaque,
                                   &guest_code_IN[delta_ENCODED - 1],
-                                  archinfo, abiinfo );
+                                  archinfo, abiinfo, sigill_diag_IN );
    } else {
       dres = disInstr_ARM_WRK ( resteerOkFn,
                                 resteerCisOk, callback_opaque,
                                 &guest_code_IN[delta_ENCODED],
-                                archinfo, abiinfo );
+                                archinfo, abiinfo, sigill_diag_IN );
    }
 
    return dres;
index 7a7e87408be0dd03ad753a3ffdd69d79b92a3a68..2c761f0bd0b4a2c2c600c939361eb2083efd60a0 100644 (file)
@@ -187,6 +187,7 @@ IRSB* bb_to_IR (
          /*IN*/ Addr64           guest_IP_bbstart,
          /*IN*/ Bool             (*chase_into_ok)(void*,Addr64),
          /*IN*/ Bool             host_bigendian,
+         /*IN*/ Bool             sigill_diag,
          /*IN*/ VexArch          arch_guest,
          /*IN*/ VexArchInfo*     archinfo_guest,
          /*IN*/ VexAbiInfo*      abiinfo_both,
@@ -361,7 +362,8 @@ IRSB* bb_to_IR (
                             arch_guest,
                             archinfo_guest,
                             abiinfo_both,
-                            host_bigendian );
+                            host_bigendian,
+                            sigill_diag );
 
       /* stay sane ... */
       vassert(dres.whatNext == Dis_StopHere
index 13cac1f2197d40737beebceb1df11f36861627ea..22b1e8b877d055472c5b7abe416f27ec0c6b5bbd 100644 (file)
@@ -153,7 +153,10 @@ typedef
       /*IN*/  VexAbiInfo*  abiinfo,
 
       /* Is the host bigendian? */
-      /*IN*/  Bool         host_bigendian
+      /*IN*/  Bool         host_bigendian,
+
+      /* Should diagnostics be printed for illegal instructions? */
+      /*IN*/  Bool         sigill_diag
 
    );
 
@@ -174,6 +177,7 @@ IRSB* bb_to_IR (
          /*IN*/ Addr64           guest_IP_bbstart,
          /*IN*/ Bool             (*chase_into_ok)(void*,Addr64),
          /*IN*/ Bool             host_bigendian,
+         /*IN*/ Bool             sigill_diag,
          /*IN*/ VexArch          arch_guest,
          /*IN*/ VexArchInfo*     archinfo_guest,
          /*IN*/ VexAbiInfo*      abiinfo_both,
index 74f1259e36314be11ef519753221588db9d4bc87..d38ca5370b34da8414e44c201a10cf7405c8543b 100644 (file)
@@ -52,7 +52,8 @@ extern DisResult disInstr_MIPS ( IRSB*        irbb,
                                  VexArch      guest_arch,
                                  VexArchInfo* archinfo,
                                  VexAbiInfo*  abiinfo,
-                                 Bool         host_bigendian );
+                                 Bool         host_bigendian,
+                                 Bool         sigill_diag );
 
 /* Used by the optimiser to specialise calls to helpers. */
 extern IRExpr *guest_mips32_spechelper(const HChar * function_name, IRExpr ** args,
index 1daadb3facdd636ec996e74e4b5bcf9889ec25e4..f9fb4423a7db1f57346212db401db86551d0ab15 100644 (file)
@@ -1205,7 +1205,8 @@ static DisResult disInstr_MIPS_WRK ( Bool(*resteerOkFn) (/*opaque */void *,
                                      void*        callback_opaque,
                                      Long         delta64,
                                      VexArchInfo* archinfo,
-                                     VexAbiInfo*  abiinfo )
+                                     VexAbiInfo*  abiinfo,
+                                     Bool         sigill_diag )
 {
    IRTemp t0, t1, t2, t3, t4, t5, t6, t7, t8;
    UInt opcode, cins, rs, rt, rd, sa, ft, fs, fd, fmt, tf, nd, function,
@@ -3557,12 +3558,13 @@ static DisResult disInstr_MIPS_WRK ( Bool(*resteerOkFn) (/*opaque */void *,
 
  decode_failure:
       /* All decode failures end up here. */
-      DIP("vex mips->IR: unhandled instruction bytes: "
-          "0x%x 0x%x 0x%x 0x%x\n",
-          (Int) getIByte(delta_start + 0),
-          (Int) getIByte(delta_start + 1),
-          (Int) getIByte(delta_start + 2),
-          (Int) getIByte(delta_start + 3));
+      if (sigill_diag)
+         vex_printf("vex mips->IR: unhandled instruction bytes: "
+                    "0x%x 0x%x 0x%x 0x%x\n",
+                    (Int) getIByte(delta_start + 0),
+                    (Int) getIByte(delta_start + 1),
+                    (Int) getIByte(delta_start + 2),
+                    (Int) getIByte(delta_start + 3));
 
       /* Tell the dispatcher that this insn cannot be decoded, and so has
          not been executed, and (is currently) the next to be executed.
@@ -3652,7 +3654,8 @@ disInstr_MIPS(IRSB*        irsb_IN,
               VexArch      guest_arch,
               VexArchInfo* archinfo,
               VexAbiInfo*  abiinfo,
-              Bool         host_bigendian_IN)
+              Bool         host_bigendian_IN,
+              Bool         sigill_diag_IN)
 {
    DisResult dres;
 
@@ -3668,7 +3671,7 @@ disInstr_MIPS(IRSB*        irsb_IN,
    guest_PC_bbstart = (Addr32) toUInt(guest_IP - delta);
 
    dres = disInstr_MIPS_WRK(resteerOkFn, resteerCisOk, callback_opaque,
-                            delta, archinfo, abiinfo);
+                            delta, archinfo, abiinfo, sigill_diag_IN);
 
    return dres;
 }
index 00b4ee7529a936e78d98fc5b1528e0c8abf45b40..11844b10df962c8060ed52dc673842da88af8399 100644 (file)
@@ -61,7 +61,8 @@ DisResult disInstr_PPC ( IRSB*        irbb,
                          VexArch      guest_arch,
                          VexArchInfo* archinfo,
                          VexAbiInfo*  abiinfo,
-                         Bool         host_bigendian );
+                         Bool         host_bigendian,
+                         Bool         sigill_diag );
 
 /* Used by the optimiser to specialise calls to helpers. */
 extern
index be53754e4786e16f9ed4ee2142dbb4595cfdba51..165aaafcbc4ecd93a2312d2761afdec93f7d3cb3 100644 (file)
@@ -16478,7 +16478,8 @@ DisResult disInstr_PPC_WRK (
              void*        callback_opaque,
              Long         delta64,
              VexArchInfo* archinfo,
-             VexAbiInfo*  abiinfo
+             VexAbiInfo*  abiinfo,
+             Bool         sigill_diag
           )
 {
    UChar     opc1;
@@ -17713,10 +17714,12 @@ DisResult disInstr_PPC_WRK (
    decode_failure:
    /* All decode failures end up here. */
    opc2 = (theInstr) & 0x7FF;
-   vex_printf("disInstr(ppc): unhandled instruction: "
-              "0x%x\n", theInstr);
-   vex_printf("                 primary %d(0x%x), secondary %u(0x%x)\n", 
-              opc1, opc1, opc2, opc2);
+   if (sigill_diag) {
+      vex_printf("disInstr(ppc): unhandled instruction: "
+                 "0x%x\n", theInstr);
+      vex_printf("                 primary %d(0x%x), secondary %u(0x%x)\n", 
+                 opc1, opc1, opc2, opc2);
+   }
 
    /* Tell the dispatcher that this insn cannot be decoded, and so has
       not been executed, and (is currently) the next to be executed.
@@ -17777,7 +17780,8 @@ DisResult disInstr_PPC ( IRSB*        irsb_IN,
                          VexArch      guest_arch,
                          VexArchInfo* archinfo,
                          VexAbiInfo*  abiinfo,
-                         Bool         host_bigendian_IN )
+                         Bool         host_bigendian_IN,
+                         Bool         sigill_diag_IN )
 {
    IRType     ty;
    DisResult  dres;
@@ -17813,7 +17817,7 @@ DisResult disInstr_PPC ( IRSB*        irsb_IN,
    guest_CIA_bbstart    = mkSzAddr(ty, guest_IP - delta);
 
    dres = disInstr_PPC_WRK ( resteerOkFn, resteerCisOk, callback_opaque,
-                             delta, archinfo, abiinfo );
+                             delta, archinfo, abiinfo, sigill_diag_IN );
 
    return dres;
 }
index 3e18b8441229c26dc50f2a35f668423cd72c9718..ebb6cbe5f7b4a719debb77d78284a7dc1c19f641 100644 (file)
@@ -50,7 +50,8 @@ DisResult disInstr_S390 ( IRSB*        irbb,
                           VexArch      guest_arch,
                           VexArchInfo* archinfo,
                           VexAbiInfo*  abiinfo,
-                          Bool         host_bigendian );
+                          Bool         host_bigendian,
+                          Bool         sigill_diag );
 
 /* Used by the optimiser to specialise calls to helpers. */
 IRExpr* guest_s390x_spechelper ( const HChar *function_name,
index 3ca5cb0581a8645339c3d2043657e8ad35faa5f7..68bad92d956cacf5b3f83f5b5b6dabb7916bd974 100644 (file)
@@ -73,6 +73,9 @@ static DisResult *dis_res;
 static Bool (*resteer_fn)(void *, Addr64);
 static void *resteer_data;
 
+/* Whether to print diagnostics for illegal instructions. */
+static Bool sigill_diag;
+
 /* The last seen execute target instruction */
 ULong last_execute_target;
 
@@ -14972,34 +14975,36 @@ s390_decode_and_irgen(UChar *bytes, UInt insn_length, DisResult *dres)
    if (status == S390_DECODE_OK) return insn_length;  /* OK */
 
    /* Decoding failed somehow */
-   vex_printf("vex s390->IR: ");
-   switch (status) {
-   case S390_DECODE_UNKNOWN_INSN:
-      vex_printf("unknown insn: ");
-      break;
+   if (sigill_diag) {
+      vex_printf("vex s390->IR: ");
+      switch (status) {
+      case S390_DECODE_UNKNOWN_INSN:
+         vex_printf("unknown insn: ");
+         break;
 
-   case S390_DECODE_UNIMPLEMENTED_INSN:
-      vex_printf("unimplemented insn: ");
-      break;
+      case S390_DECODE_UNIMPLEMENTED_INSN:
+         vex_printf("unimplemented insn: ");
+         break;
 
-   case S390_DECODE_UNKNOWN_SPECIAL_INSN:
-      vex_printf("unimplemented special insn: ");
-      break;
+      case S390_DECODE_UNKNOWN_SPECIAL_INSN:
+         vex_printf("unimplemented special insn: ");
+         break;
 
-   default:
-   case S390_DECODE_ERROR:
-      vex_printf("decoding error: ");
-      break;
-   }
+      default:
+      case S390_DECODE_ERROR:
+         vex_printf("decoding error: ");
+         break;
+      }
 
-   vex_printf("%02x%02x", bytes[0], bytes[1]);
-   if (insn_length > 2) {
-      vex_printf(" %02x%02x", bytes[2], bytes[3]);
-   }
-   if (insn_length > 4) {
-      vex_printf(" %02x%02x", bytes[4], bytes[5]);
+      vex_printf("%02x%02x", bytes[0], bytes[1]);
+      if (insn_length > 2) {
+         vex_printf(" %02x%02x", bytes[2], bytes[3]);
+      }
+      if (insn_length > 4) {
+         vex_printf(" %02x%02x", bytes[4], bytes[5]);
+      }
+      vex_printf("\n");
    }
-   vex_printf("\n");
 
    return 0;  /* Failed */
 }
@@ -15097,7 +15102,8 @@ disInstr_S390(IRSB        *irsb_IN,
               VexArch      guest_arch,
               VexArchInfo *archinfo,
               VexAbiInfo  *abiinfo,
-              Bool         host_bigendian)
+              Bool         host_bigendian,
+              Bool         sigill_diag_IN)
 {
    vassert(guest_arch == VexArchS390X);
 
@@ -15109,6 +15115,7 @@ disInstr_S390(IRSB        *irsb_IN,
    irsb = irsb_IN;
    resteer_fn = resteerOkFn;
    resteer_data = callback_opaque;
+   sigill_diag = sigill_diag_IN;
 
    return disInstr_S390_WRK(guest_code + delta);
 }
index a47040af75d8e21a020b4fbad0ea8351e7969c5f..389e6bb15c4d528f5f6f153073aadb4d17015773 100644 (file)
@@ -60,7 +60,8 @@ DisResult disInstr_X86 ( IRSB*        irbb,
                          VexArch      guest_arch,
                          VexArchInfo* archinfo,
                          VexAbiInfo*  abiinfo,
-                         Bool         host_bigendian );
+                         Bool         host_bigendian,
+                         Bool         sigill_diag );
 
 /* Used by the optimiser to specialise calls to helpers. */
 extern
index c6f6c544b339bb20cec85e0b5cf27c2d64161fea..a3cef4d1b761043ae89319606c564fe4b9e90385 100644 (file)
@@ -7933,7 +7933,8 @@ DisResult disInstr_X86_WRK (
              void*        callback_opaque,
              Long         delta64,
              VexArchInfo* archinfo,
-             VexAbiInfo*  vbi
+             VexAbiInfo*  vbi,
+             Bool         sigill_diag
           )
 {
    IRType    ty;
@@ -15177,12 +15178,14 @@ DisResult disInstr_X86_WRK (
   default:
   decode_failure:
    /* All decode failures end up here. */
-   vex_printf("vex x86->IR: unhandled instruction bytes: "
-              "0x%x 0x%x 0x%x 0x%x\n",
-              (Int)getIByte(delta_start+0),
-              (Int)getIByte(delta_start+1),
-              (Int)getIByte(delta_start+2),
-              (Int)getIByte(delta_start+3) );
+   if (sigill_diag) {
+      vex_printf("vex x86->IR: unhandled instruction bytes: "
+                 "0x%x 0x%x 0x%x 0x%x\n",
+                 (Int)getIByte(delta_start+0),
+                 (Int)getIByte(delta_start+1),
+                 (Int)getIByte(delta_start+2),
+                 (Int)getIByte(delta_start+3) );
+   }
 
    /* Tell the dispatcher that this insn cannot be decoded, and so has
       not been executed, and (is currently) the next to be executed.
@@ -15245,7 +15248,8 @@ DisResult disInstr_X86 ( IRSB*        irsb_IN,
                          VexArch      guest_arch,
                          VexArchInfo* archinfo,
                          VexAbiInfo*  abiinfo,
-                         Bool         host_bigendian_IN )
+                         Bool         host_bigendian_IN,
+                         Bool         sigill_diag_IN )
 {
    Int       i, x1, x2;
    Bool      expect_CAS, has_CAS;
@@ -15264,7 +15268,7 @@ DisResult disInstr_X86 ( IRSB*        irsb_IN,
    dres = disInstr_X86_WRK ( &expect_CAS, resteerOkFn,
                              resteerCisOk,
                              callback_opaque,
-                             delta, archinfo, abiinfo );
+                             delta, archinfo, abiinfo, sigill_diag_IN );
    x2 = irsb_IN->stmts_used;
    vassert(x2 >= x1);
 
@@ -15284,7 +15288,7 @@ DisResult disInstr_X86 ( IRSB*        irsb_IN,
       dres = disInstr_X86_WRK ( &expect_CAS, resteerOkFn,
                                 resteerCisOk,
                                 callback_opaque,
-                                delta, archinfo, abiinfo );
+                                delta, archinfo, abiinfo, sigill_diag_IN );
       for (i = x1; i < x2; i++) {
          vex_printf("\t\t");
          ppIRStmt(irsb_IN->stmts[i]);
index 4d98f510701a19ee7c0cacca3b0d776c6d276d31..f4086627a1eeb5f70958f8c93c4877009f87ca34 100644 (file)
@@ -605,6 +605,7 @@ VexTranslateResult LibVEX_Translate ( VexTranslateArgs* vta )
                      vta->guest_bytes_addr,
                      vta->chase_into_ok,
                      host_is_bigendian,
+                     vta->sigill_diag,
                      vta->arch_guest,
                      &vta->archinfo_guest,
                      &vta->abiinfo_both,
index d5c3483cae4c493b92e3ff507666f1119ea400e5..8e096cd67dcd78cace2c85ac9a7d62e2aa167d4f 100644 (file)
@@ -675,6 +675,9 @@ typedef
       /* IN: debug: trace vex activity at various points */
       Int     traceflags;
 
+      /* IN: debug: print diagnostics when an illegal instr is detected */
+      Bool    sigill_diag;
+
       /* IN: profiling: add a 64 bit profiler counter increment to the
          translation? */
       Bool    addProfInc;