Make diagnostics for SIGILL more controllable (VEX part).
Fixes #309425. (Mark Wielaard, mjw@redhat.com)
git-svn-id: svn://svn.valgrind.org/vex/trunk@2582 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/priv/guest_s390_toIR.c b/priv/guest_s390_toIR.c
index 3ca5cb0..68bad92 100644
--- a/priv/guest_s390_toIR.c
+++ b/priv/guest_s390_toIR.c
@@ -73,6 +73,9 @@
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,35 +14975,37 @@
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("\n");
}
- 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");
-
return 0; /* Failed */
}
@@ -15097,7 +15102,8 @@
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 @@
irsb = irsb_IN;
resteer_fn = resteerOkFn;
resteer_data = callback_opaque;
+ sigill_diag = sigill_diag_IN;
return disInstr_S390_WRK(guest_code + delta);
}