On Sun, Nov 27, 2011 at 04:10, Rick Hodgin <foxmuldrs...@yahoo.com> wrote: > For i386, I'm considering writing a native debugger for QEMU that is not GDB. > It would allow a separate/new windowed interface which would show > disassembly, registers, stack, local variables, memory windows, etc., > allowing the user to single-step through code and trap opcodes like INT 1, > INT 3, INT 4, etc. It would be invoked with something like "qemu -debugger" > from the command line, and would have a UI similar to Microsoft's Debugger in > Visual Studio when no PDB is available, but would show a similar type of > disassembly form.
QEMU and the debugger should be kept separate. You should use the GDB interface to implement the debugger, that way you can also test it against known good configuration. For example, try to find out how GDB performs single stepping (set remote debug 1). > I was looking at the QEMU code and I can't find an obvious place where it > seems to iterate through each CPU instruction, which is where I had in mind > to add a hook. > > Can someone get me pointed in the right direction? Where will I look for > something like this: > > for (;;) > { > execute_next_instruction(); > } QEMU does not work like that at all, it uses TCG, KVM or Xen to execute the code and none of those use that kind of single instruction loop either.