views:

396

answers:

1

I'm just cross posting the same question I did on virtualbox.org. http://forums.virtualbox.org/viewtopic.php?f=9&t=26702&p=119139#p119139

If not breaking any rule, I'd appreciate to kwon more about it since stackoverflow promisses to be more dynamic!

"Hi, I did some search and could not find any tool to debug a guest system from the early boot in virtual box. Although, I came across JCP, a x86 emulator in java that is not so powerful and beautyful but has a debug mode where one can view the Physical Memory, the CPU registers along other things. It also makes it possible to execute CPU instructions step by step and set break points, watchpoints and conditional ones. There's such thing in Virtual Box?

I think would be amazing to have it and be able to inspect the system while its running. For learn about PC architecture or as a tool to develop a kernel as well.

In the case you think its good idea (I think it is) how can it be achieved? I'm interested in develop such sort o things and would like to know if it is feasible if not already implemented somewhere."

EDT: Are modern x86 able to interrupt its execution just after a cpu cycle and pass execution addres to another code to just do this? Yes, the trap flag can be set to put the processor in step by step execution mode. x86 will execute one instruction and call INT 3.

+1  A: 

The OSDev wiki has some useful information on debugging a guest operating system, though according to this page VirtualBox doesn't have a debugger at present. I've been using QEmu with the GDB stub and it works quite nicely, so you might like to give that a go instead.

Mark Pim
Gdb will be able to inspect the guest memory and will point to the guest IP? AFAIK VirtualBox is based on QEMU so to have a nice interface should not be impossible. right?
Ruben Trancoso
Yep, when I've used it you can do all the normal GDB stuff like setting breakpoints, inspecting registers and listing memory locations. I don't have any experience with VirtualBox I'm afraid so I can't tell you how feasible it is.
Mark Pim
will it also understand debug symbols? I just was thinking about using a nice interface like DDD, but I use windows and looks like theres no port.
Ruben Trancoso
I got, it understand symbols also like a normal debug session. Fantastic! http://wiki.osdev.org/QEMU - Thank you Mark by the help.
Ruben Trancoso
Just to close it I found WinGDB that adds gdb debug capabilities to Visual Studio.
Ruben Trancoso