qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

qemu-gdb: add $qemu_coroutine_sp and $qemu_coroutine_pc

These can be useful to manually get a stack trace of a coroutine inside
a core dump.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1444636974-19950-4-git-send-email-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

authored by

Paolo Bonzini and committed by
Stefan Hajnoczi
a201b0ff 80ab31b2

+19
+3
scripts/qemu-gdb.py
··· 38 38 coroutine.CoroutineCommand() 39 39 mtree.MtreeCommand() 40 40 41 + coroutine.CoroutineSPFunction() 42 + coroutine.CoroutinePCFunction() 43 + 41 44 # Default to silently passing through SIGUSR1, because QEMU sends it 42 45 # to itself a lot. 43 46 gdb.execute('handle SIGUSR1 pass noprint nostop')
+16
scripts/qemugdb/coroutine.py
··· 15 15 16 16 import gdb 17 17 18 + VOID_PTR = gdb.lookup_type('void').pointer() 19 + 18 20 def get_fs_base(): 19 21 '''Fetch %fs base value using arch_prctl(ARCH_GET_FS). This is 20 22 pthread_self().''' ··· 101 103 return 102 104 103 105 bt_jmpbuf(coroutine_to_jmpbuf(gdb.parse_and_eval(argv[0]))) 106 + 107 + class CoroutineSPFunction(gdb.Function): 108 + def __init__(self): 109 + gdb.Function.__init__(self, 'qemu_coroutine_sp') 110 + 111 + def invoke(self, addr): 112 + return get_jmpbuf_regs(coroutine_to_jmpbuf(addr))['rsp'].cast(VOID_PTR) 113 + 114 + class CoroutinePCFunction(gdb.Function): 115 + def __init__(self): 116 + gdb.Function.__init__(self, 'qemu_coroutine_pc') 117 + 118 + def invoke(self, addr): 119 + return get_jmpbuf_regs(coroutine_to_jmpbuf(addr))['rip'].cast(VOID_PTR)