The debuggee domain will die with unexpected trap
on single stepping of emulated instruction.
Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
diff -r 5fd51e1e9c79 xen/arch/x86/hvm/vmx/realmode.c
--- a/xen/arch/x86/hvm/vmx/realmode.c Wed Nov 05 10:57:21 2008 +0000
+++ b/xen/arch/x86/hvm/vmx/realmode.c Tue Nov 11 09:45:52 2008 +0900
@@ -148,6 +148,14 @@ static void realmode_emulate_one(struct
hvmemul_ctxt->exn_insn_len = 0;
}
+ if ( curr->domain->debugger_attached &&
+ ( hvmemul_ctxt->exn_vector == TRAP_debug ||
+ hvmemul_ctxt->exn_vector == TRAP_int3 ) )
+ {
+ domain_pause_for_debugger();
+ return;
+ }
+
if ( curr->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PE )
{
gdprintk(XENLOG_ERR, "Exception %02x in protected mode.\n",
diff -r 5fd51e1e9c79 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c Wed Nov 05 10:57:21 2008 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c Tue Nov 11 09:45:52 2008 +0900
@@ -1154,8 +1154,6 @@ static void vmx_inject_exception(
{
struct vcpu *curr = current;
- vmx_inject_hw_exception(curr, trapnr, errcode);
-
if ( trapnr == TRAP_page_fault )
curr->arch.hvm_vcpu.guest_cr[2] = cr2;
@@ -1164,7 +1162,14 @@ static void vmx_inject_exception(
{
__restore_debug_registers(curr);
write_debugreg(6, read_debugreg(6) | 0x4000);
+ if ( curr->domain->debugger_attached )
+ {
+ domain_pause_for_debugger();
+ return;
+ }
}
+
+ vmx_inject_hw_exception(curr, trapnr, errcode);
}
static int vmx_event_pending(struct vcpu *v)
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|