How to get xen whole-machine dump image and analyse it prepair

来源:互联网 发布:c语言小程序100例 编辑:程序博客网 时间:2024/06/09 21:44

enable kexec

  • apply kexec patches to xen source tree. latest patches are available in xen-devel list. (It maybe merged into xen 3.0.3)

install dom0cut

  • prerequirement: libelf, python, binutils

    get dom0cut script and libelf wrapper from http://people.valinux.co.jp/~moriwaka/dumpread/ install libelf wrapper

     $ wget http://people.valinux.co.jp/~moriwaka/dumpread/libelf-0.3.0.tar.gz
    $ tar zxf libelf-0.3.0.tar.gz
    $ cd libelf-0.3.0
    $ sudo python ./setup.py install
    install dom0cut script
     $ wget http://people.valinux.co.jp/~moriwaka/dumpread/dumpread-20060927.tar.gz
    $ tar zxvf dumpread-20060927.tar.gz

prepair xen-syms, vmlinux

  • copy xen executable binary with symbols (when you compile, it is made at xen/xen-syms) and vmlinux used for domain 0

get coredump

load kdump kernel

1. append followings to xen boot args

  • kdump_megabytes=64 kdump_megabytes_base=32

2. on dom0, load kdump kernel, take a dump.

  • This is same as linux kdump usage. http://lse.sourceforge.net/kdump/

get a dump image

  •  echo c > /proc/sysrq-trigger

after reboot, copy /proc/vmcore to core file.

  • cp /proc/vmcore /vmcore

analysis

/!/ Now dom0cut script eats large memory(about 100-200MB). You should reboot machine before analysis.

extract domain 0 image

  • $ cd dumpread
    $ ./dom0cut_x86.py -d/vmcore --target=0 -odom0image -xxen-syms -txen

/!/ you maybe need LD_PRELOAD=/usr/local/lib/libelf.so to resolve conflict for distribution's libelf.(same-name different library is contained in Fedora Core or Redhat)

use crash

  • $ crash vmlinux dom0image 

extract xen hypervisor image

  • $ cd dumpread
    $ ./dom0cut_x86.py -d/vmcore --target=x -oxenimage -xxen-syms -telf

use gdb

$ gdb xen-syms xenimage