On 04/17/2012 02:25 PM, Wen Congyang wrote: > > > >> > >> For scenario 2, we also want the guest's registers values to be dumped into > >> qemu process's core file when qemu process crashes. This is the task of TODO-list 2. > > > > Why? If qemu crashed it is because of an internal qemu fault. If any > > guest registers were involved, they would have been decoded by qemu > > previously and would be present in the stack trace (for example mmio > > address/data). > > Hmm, IIRC, if qemu meets some critical error, it will call abort() or assert(). > The guest registers are stored in the kernel, and qemu does not call > cpu_synchronize_state() to get guest register. So I donot understand > why the registers woubld be present int the stack trace... There are two cases. One case is where the problem was not caused directly by guest action, for example a segmentation fault in the block layer or the VNC server. In this case the guest registers are immaterial. The other case is where the problem was directly caused by guest action, for example an mmio write to a device register triggered an error. In this case kvm emulates the mmio instruction and returns KVM_EXIT_MMIO; it can be seen in the kvm_run page. The address/data pair is propagated by the qemu memory core all the way to the device callback. So the instruction and register contents are unneeded for debugging the crash. Is there a scenario where the guest registers help towards debugging a qemu crash? -- error compiling committee.c: too many arguments to function