x86,misc: add additional info on faulting X86 instruction, fetched PC
[gem5.git] / src / arch / x86 / faults.cc
index 4198bcc7cf444c59cd396c9750ca82eb0bb727d0..093926d362c3dda8a9aec6122e79435cc3376fd8 100644 (file)
@@ -44,6 +44,7 @@
 
 #include "arch/x86/generated/decoder.hh"
 #include "arch/x86/isa_traits.hh"
+#include "base/loader/symtab.hh"
 #include "base/trace.hh"
 #include "cpu/thread_context.hh"
 #include "debug/Faults.hh"
@@ -161,7 +162,15 @@ namespace X86ISA
                 modeStr = "write";
             else
                 modeStr = "read";
-            panic("Tried to %s unmapped address %#x.\n", modeStr, addr);
+
+            // print information about what we are panic'ing on
+            if (!inst) {
+                panic("Tried to %s unmapped address %#x.\n", modeStr, addr);
+            } else {
+                panic("Tried to %s unmapped address %#x.\nPC: %#x, Instr: %s",
+                      modeStr, addr, tc->pcState().pc(),
+                      inst->disassemble(tc->pcState().pc(), debugSymbolTable));
+            }
         }
     }