public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* Is there any way to get Windbg to work with QEMU/KVM?
@ 2007-12-12  6:43 duck-j34lQMj1tz/QT0dZR+AlfA
       [not found] ` <OF6F10E645.9C7DF3C6-ONCA2573AF.0023131F-CA2573AF.0024E904-j34lQMj1tz/QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: duck-j34lQMj1tz/QT0dZR+AlfA @ 2007-12-12  6:43 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f


G'day folks.

Apologies if this is a FAQ. Is there any way to get Windbg working between
two Windows guests? I have recently switched from QEMU+KQEMU to QEMU/KVM
(better speed and a Vista-ready BIOS got me interested). I never did get
Windbg working at all with QEMU+KQEMU. Now I am rather closer with
QEMU/KVM, but still no cigar.

I have two XP2 guests. The first (debugee) has /DEBUG etc. in its BOOT.INI;
the second doesn't. I start the first with '-serial tcp::5555,server'; it
begins loading and waits...I start the latter with '-serial tcp::5555' and
both VMs boot fine.

OK, now I start Windbg on the debugger, choose Kernel debugging and then
try to break into the debugee. It almost works. The debugee freezes, and
the debugger gives some feedback to claim that it's started connecting,
identifies the remote PC, and then...nothing.

If I resynchronise, then occasionally I get a bit further, but never to a
command prompt (the place in Windbg where you type in commands remains
greyed out with "debugee not connected".

After blindly trying applying an oldish QEMU patch mentioned here
(http://www.damogran.de/blog/archives/14-WinDbg-and-QEMU.html) I got ever
so slightly further, to the point that I reached the Windbg command prompt
and could enter commands (e.g. '.dl'). All I got back were sporadic errors
such as "couldn't find KTHREAD entry at blah" and other "it's nae workin'
cap'n" sort of messages.

Can it be made to work? Others seem to have claimed to have done it. Seems
I am so near but so far!

It would certainly be very handy to be able to do proper Windows kernel
debugging with just one PC (and on Linux, no less). Windbg is fine for
kernel snooping under QEMU but you need two PCs if you want to use it to
set breakpoints inside the kernel. (I have tried Syser, a commercial
SoftICE replacement from China, which is a single-PC Windows kernel
debugger-with-built-in-monitor-GUI but it BSODded fairly early on in the
session. Anyway, I really want to stick to Windbg.)


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Is there any way to get Windbg to work with QEMU/KVM?
       [not found] ` <OF6F10E645.9C7DF3C6-ONCA2573AF.0023131F-CA2573AF.0024E904-j34lQMj1tz/QT0dZR+AlfA@public.gmane.org>
@ 2007-12-12 11:34   ` Dor Laor
       [not found]     ` <475FC72C.7070506-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  2007-12-13  9:35   ` Uri Lublin
  1 sibling, 1 reply; 5+ messages in thread
From: Dor Laor @ 2007-12-12 11:34 UTC (permalink / raw)
  To: duck-j34lQMj1tz/QT0dZR+AlfA; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

duck-j34lQMj1tz/QT0dZR+AlfA@public.gmane.org wrote:
> G'day folks.
>
> Apologies if this is a FAQ. Is there any way to get Windbg working between
> two Windows guests? I have recently switched from QEMU+KQEMU to QEMU/KVM
> (better speed and a Vista-ready BIOS got me interested). I never did get
> Windbg working at all with QEMU+KQEMU. Now I am rather closer with
> QEMU/KVM, but still no cigar.
>
> I have two XP2 guests. The first (debugee) has /DEBUG etc. in its BOOT.INI;
> the second doesn't. I start the first with '-serial tcp::5555,server'; it
> begins loading and waits...I start the latter with '-serial tcp::5555' and
> both VMs boot fine.
>
> OK, now I start Windbg on the debugger, choose Kernel debugging and then
> try to break into the debugee. It almost works. The debugee freezes, and
> the debugger gives some feedback to claim that it's started connecting,
> identifies the remote PC, and then...nothing.
>
>   
It's because the qemu patch is not relevant when running in kvm.
The patch makes serial poll every 100 instructions, since in kvm we run 
on bare hw and not
emulation the existing patch does not work.
Instead you might run in parallel to the VM a script that does while(1) 
kill -SIGIO vm_pid.
This will cause constant exits out of kvm's guest mode.
Since I have not tried it myself (I did use the -no-kvm flag) please 
report if it helped.
Regards,
Dor.
> If I resynchronise, then occasionally I get a bit further, but never to a
> command prompt (the place in Windbg where you type in commands remains
> greyed out with "debugee not connected".
>
> After blindly trying applying an oldish QEMU patch mentioned here
> (http://www.damogran.de/blog/archives/14-WinDbg-and-QEMU.html) I got ever
> so slightly further, to the point that I reached the Windbg command prompt
> and could enter commands (e.g. '.dl'). All I got back were sporadic errors
> such as "couldn't find KTHREAD entry at blah" and other "it's nae workin'
> cap'n" sort of messages.
>
> Can it be made to work? Others seem to have claimed to have done it. Seems
> I am so near but so far!
>
> It would certainly be very handy to be able to do proper Windows kernel
> debugging with just one PC (and on Linux, no less). Windbg is fine for
> kernel snooping under QEMU but you need two PCs if you want to use it to
> set breakpoints inside the kernel. (I have tried Syser, a commercial
> SoftICE replacement from China, which is a single-PC Windows kernel
> debugger-with-built-in-monitor-GUI but it BSODded fairly early on in the
> session. Anyway, I really want to stick to Windbg.)
>
>
> -------------------------------------------------------------------------
> SF.Net email is sponsored by:
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> kvm-devel mailing list
> kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/kvm-devel
>
>   


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Is there any way to get Windbg to work with QEMU/KVM?
       [not found]     ` <475FC72C.7070506-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-12-13  1:28       ` duck-j34lQMj1tz/QT0dZR+AlfA
       [not found]         ` <OFB934B8E7.F5AD5E7A-ONCA2573B0.0007F3A1-CA2573B0.00081680-j34lQMj1tz/QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: duck-j34lQMj1tz/QT0dZR+AlfA @ 2007-12-13  1:28 UTC (permalink / raw)
  To: dor.laor-atKUWr5tajBWk0Htik3J/w
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

[making Windbg's serial protocol work between two VMs]

>Instead you might run in parallel to the VM a script
>that does while(1) kill -SIGIO vm_pid.

The first 'kill -SIGIO' kills the whole VM instantly.

kvm-55 with its own kernel module.


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Is there any way to get Windbg to work with QEMU/KVM?
       [not found]         ` <OFB934B8E7.F5AD5E7A-ONCA2573B0.0007F3A1-CA2573B0.00081680-j34lQMj1tz/QT0dZR+AlfA@public.gmane.org>
@ 2007-12-13  9:14           ` Dor Laor
  0 siblings, 0 replies; 5+ messages in thread
From: Dor Laor @ 2007-12-13  9:14 UTC (permalink / raw)
  To: duck-j34lQMj1tz/QT0dZR+AlfA; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

duck-j34lQMj1tz/QT0dZR+AlfA@public.gmane.org wrote:
> [making Windbg's serial protocol work between two VMs]
>
>   
>> Instead you might run in parallel to the VM a script
>> that does while(1) kill -SIGIO vm_pid.
>>     
>
> The first 'kill -SIGIO' kills the whole VM instantly.
>
> kvm-55 with its own kernel module.
>
>
>   
It works for me, can you send a stack dump from the core dump created?

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Is there any way to get Windbg to work with QEMU/KVM?
       [not found] ` <OF6F10E645.9C7DF3C6-ONCA2573AF.0023131F-CA2573AF.0024E904-j34lQMj1tz/QT0dZR+AlfA@public.gmane.org>
  2007-12-12 11:34   ` Dor Laor
@ 2007-12-13  9:35   ` Uri Lublin
  1 sibling, 0 replies; 5+ messages in thread
From: Uri Lublin @ 2007-12-13  9:35 UTC (permalink / raw)
  To: duck-j34lQMj1tz/QT0dZR+AlfA; +Cc: kvm-devel

duck-j34lQMj1tz/QT0dZR+AlfA@public.gmane.org wrote:
> G'day folks.
>
> After blindly trying applying an oldish QEMU patch mentioned here
> (http://www.damogran.de/blog/archives/14-WinDbg-and-QEMU.html) I got ever
> so slightly further, to the point that I reached the Windbg command prompt
> and could enter commands (e.g. '.dl'). All I got back were sporadic errors
> such as "couldn't find KTHREAD entry at blah" and other "it's nae workin'
> cap'n" sort of messages.
>
> Can it be made to work? Others seem to have claimed to have done it. Seems
> I am so near but so far!
>   
Try hacking qemu/qemu-kvm.c:pre_kvm_run() with something like that:

+#if 1
+#define MIN_CYCLE_COUNT 100
+		{
+                    static int cycle_count;
+		  
+		    if (++cycle_count > MIN_CYCLE_COUNT) {
+                        cycle_count = 0;
+                        return 1;
+                    }
+		}
+#endif



-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-12-13  9:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-12  6:43 Is there any way to get Windbg to work with QEMU/KVM? duck-j34lQMj1tz/QT0dZR+AlfA
     [not found] ` <OF6F10E645.9C7DF3C6-ONCA2573AF.0023131F-CA2573AF.0024E904-j34lQMj1tz/QT0dZR+AlfA@public.gmane.org>
2007-12-12 11:34   ` Dor Laor
     [not found]     ` <475FC72C.7070506-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-12-13  1:28       ` duck-j34lQMj1tz/QT0dZR+AlfA
     [not found]         ` <OFB934B8E7.F5AD5E7A-ONCA2573B0.0007F3A1-CA2573B0.00081680-j34lQMj1tz/QT0dZR+AlfA@public.gmane.org>
2007-12-13  9:14           ` Dor Laor
2007-12-13  9:35   ` Uri Lublin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox