Re: get backtrace of KVM VM from host

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thank you for answering. You are right this (qemu-system-x86_64 -s ...) covers most, maybe also all of my requierments/whishes (I'm using/did use/ this with OSv often -OSv authors included beautiful gdb extension commands).

But I see now I was not clear what I'm I trying to do. My problem is I noticed 'perf kvm stat' shows much less KVM_EXIT/ENTRY/INTERRUPT etc events for regular Linux VM than for say OSv or IncludeOS. Hence I would like to use sort of strace tool over KVM api, to see which VKM api calls are called, and from where in VM code. Not really debugging, just (performance) analysis. Doing this from gdb - maybe, if I can intercept all relevant events, and if gdb allows me to continue after each event. Sounds good enough, so I can try that too (thank you for idea).

Justin

On 05/21/2018 11:03 AM, Fam Zheng wrote:
On Mon, 05/21 10:23, Justin Cinkelj wrote:
Hi

Is it possible to get stack backtrace into KVM VM from the host side? So if
I run './stack -p PID' (stack from elfutilfs
https://sourceware.org/elfutils/), I get backtrace of some process. I would
like to do the same for VM. I can assume VM will run only a kernel (a
unikernel, like OSv or IncludeOS), so most/all debug symbols will be there
in a single file, and at least IncludeOS doesnt load any code beside its own
kernel.

I did notice KVM_GET_REGS and KVM_SET_MEMORY_REGION, and at least for
trivial examples (like https://github.com/dpw/kvm-hello-world) this provides
enough information to track which code was loaded into VM, observe current
stack content and registers. I can only guess much more work is required to
get similar result with qemu-kvm. Hence I'm asking if this is already
implemented.
Yes, you can easily connect gdb remotely to a gdb stub built-in QEMU and start
debug your guest kernel just like a usual process, the only thing between you
and that is the debug info, which you already have:

https://lwn.net/Articles/660404/

Fam




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux