Skip to content
  • Laszlo Ersek's avatar
    Python-lang gdb script to extract x86_64 guest vmcore from qemu coredump · 3e16d14f
    Laszlo Ersek authored
    When qemu dies unexpectedly, for example in response to an explicit
    abort() call, or (more importantly) when an external signal is delivered
    to it that results in a coredump, sometimes it is useful to extract the
    guest vmcore from the qemu process' memory image. The guest vmcore might
    help understand an emulation problem in qemu, or help debug the guest.
    
    This script reimplements (and cuts many features of) the
    qmp_dump_guest_memory() command in gdb/Python,
    
      https://sourceware.org/gdb/current/onlinedocs/gdb/Python-API.html
    
    working off the saved memory image of the qemu process. The docstring in
    the patch (serving as gdb help text) describes the limitations relative to
    the QMP command.
    
    Dependencies of qmp_dump_guest_memory() have been reimplemented as needed.
    I sought to follow the general structure, sticking to original function
    names where possible. However, keeping it simple prevailed in some places.
    
    The patch has been tested ...
    3e16d14f