summaryrefslogtreecommitdiffstats
path: root/scripts/qemugdb
Commit message (Collapse)AuthorAgeFilesLines
* scripts/gdb: implement 'qemu bt'Maxim Levitsky2021-01-121-1/+27
| | | | | | | | | | This script first runs the regular gdb's 'bt' command, and then if we are in a coroutine it prints the coroutines backtraces in the order in which they were called. Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> Message-Id: <20201217155436.927320-3-mlevitsk@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* scripts/gdb: fix 'qemu coroutine' when users selects a non topmost stack frameMaxim Levitsky2021-01-121-0/+7
| | | | | | | | | | | | | | | | | | | | | The code that dumps the stack frame works like that: * save current registers * overwrite current registers (including rip/rsp) with coroutine snapshot in the jmpbuf * print backtrace * restore the saved registers. If the user has currently selected a non topmost stack frame in gdb, the above code will still restore the selected frame registers, but the gdb will then lose the selected frame index, which makes it impossible to switch back to frame 0, to continue debugging the executable. Therefore switch temporarily to the topmost frame of the stack for the above code. Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> Message-Id: <20201217155436.927320-2-mlevitsk@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* scripts/qemugdb: Remove shebang headerPhilippe Mathieu-Daudé2020-05-316-11/+4Star
| | | | | | | | | | | | These scripts are loaded as plugin by GDB (and they don't have any __main__ entry point). Remove the shebang header. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Acked-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20200512103238.7078-2-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
* scripts/qemugdb: re-license timers.py to GPLv2 or laterAlex Bennée2019-03-121-2/+4
| | | | | | | | | | I'm the sole author (aside from a one line by Greg fixing encoding) and I was asked nicely on IRC to bring it into line with the rest of the files. Cc: Greg Kurz <groug@kaod.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Thomas Huth <thuth@redhat.com>
* qemugdb: fix licensingPaolo Bonzini2019-03-113-15/+6Star
| | | | | | | qemu-gdb.py was committed after 2012-01-13, so the notice about GPL v2-only contributions does not apply. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qemugdb/coroutine: fix arch_prctl has unknown return typeVladimir Sementsov-Ogievskiy2019-02-121-1/+1
| | | | | | | | | | | | | | | | | | qemu coroutine command results in following error output: Python Exception <class 'gdb.error'> 'arch_prctl' has unknown return type; cast the call to its declared return type: Error occurred in Python command: 'arch_prctl' has unknown return type; cast the call to its declared return type Fix it by giving it what it wants: arch_prctl return type. Information on the topic: https://sourceware.org/gdb/onlinedocs/gdb/Calling.html Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-id: 20190206151425.105871-1-vsementsov@virtuozzo.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* scripts/qemu-gdb/timers.py: define encoding in header commentGreg Kurz2018-02-051-0/+1
| | | | | | | | | | | | | | | | | This is required otherwise python complains because of the accentuated letter in Alex's last name: Traceback (most recent call last): File "scripts/qemu-gdb.py", line 29, in <module> from qemugdb import aio, mtree, coroutine, tcg, timers File "scripts/qemugdb/timers.py", line 1 SyntaxError: Non-ASCII character '\xc3' in file scripts/qemugdb/timers.py on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details Signed-off-by: Greg Kurz <groug@kaod.org> Message-Id: <151629549711.18276.15497684562308683805.stgit@bahia.lan> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* scripts/qemu-gdb/timers.py: new helper to dump timer stateAlex Bennée2018-01-161-0/+54
| | | | | | | | | This introduces the qemu-gdb command "qemu timers" which will dump the state of the main timers in the system. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* scripts/qemu-gdb: add simple tcg lock status helperAlex Bennée2018-01-161-0/+46
| | | | | | | Add a simple helper to dump lock state. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* scripts/qemugdb/mtree.py: fix up mtree dumpAlex Bennée2017-04-071-2/+10
| | | | | | | | | Since QEMU has been able to build with native Int128 support this was broken as it attempts to fish values out of the non-existent structure. Also the alias print was trying to make a %x out of gdb.ValueType directly which didn't seem to work. Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
* scripts/gdb: Fix a python exception in mtree.pyYang Wei2015-12-221-5/+5
| | | | | | | | | | | | | The following exception is threw: Python Exception <class 'NameError'> name 'long' is not defined: Error occurred in Python command: name 'long' is not defined Python 2.4+, int()/long() have been unified, so replace long with int. Signed-off-by: Yang Wei <w90p710@gmail.com> Message-id: 1449316340-4030-1-git-send-email-w90p710@gmail.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* gdb command: qemu handlersDr. David Alan Gilbert2015-10-291-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A new gdb commands are added: qemu handlers That dumps an AioContext list (by default qemu_aio_context) possibly including a backtrace for cases it knows about (with the verbose option). Intended to help find why something is hanging waiting for IO. Use 'qemu handlers --verbose iohandler_ctx' to find out why your incoming migration is stuck. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-id: 1445951385-11924-1-git-send-email-dgilbert@redhat.com V2: Merge into one command with optional handlers arg, and only do backtrace in verbose mode (gdb) qemu handlers ---- {pfd = {fd = 6, events = 25, revents = 0}, io_read = 0x55869656ffd0 <event_notifier_dummy_cb>, io_write = 0x0, deleted = 0, opaque = 0x558698c4ce08, node = {le_next = 0x0, le_prev = 0x558698c4cdc0}} (gdb) qemu handlers iohandler_ctx ---- {pfd = {fd = 9, events = 25, revents = 0}, io_read = 0x558696581380 <fd_coroutine_enter>, io_write = 0x0, deleted = 0, opaque = 0x558698dc99d0, node = {le_next = 0x558698c4cca0, le_prev = 0x558698c4c1d0}} ---- {pfd = {fd = 4, events = 25, revents = 0}, io_read = 0x55869657b330 <sigfd_handler>, io_write = 0x0, deleted = 0, opaque = 0x4, node = {le_next = 0x558698c4c260, le_prev = 0x558699f72508}} ---- {pfd = {fd = 5, events = 25, revents = 0}, io_read = 0x55869656ffd0 <event_notifier_dummy_cb>, io_write = 0x0, deleted = 0, opaque = 0x558698c4c218, node = {le_next = 0x0, le_prev = 0x558698c4ccc8}} ---- (gdb) qemu handlers --verbose iohandler_ctx ---- {pfd = {fd = 9, events = 25, revents = 0}, io_read = 0x558696581380 <fd_coroutine_enter>, io_write = 0x0, deleted = 0, opaque = 0x558698dc99d0, node = {le_next = 0x558698c4cca0, le_prev = 0x558698c4c1d0}} #0 0x0000558696581820 in qemu_coroutine_switch (from_=from_@entry=0x558698cb3cf0, to_=to_@entry=0x7f421c37eac8, action=action@entry=COROUTINE_YIELD) at /home/dgilbert/git/qemu/coroutine-ucontext.c:177 #1 0x0000558696580c00 in qemu_coroutine_yield () at /home/dgilbert/git/qemu/qemu-coroutine.c:145 #2 0x00005586965814f5 in yield_until_fd_readable (fd=9) at /home/dgilbert/git/qemu/qemu-coroutine-io.c:90 #3 0x0000558696523937 in socket_get_buffer (opaque=0x55869a3dc620, buf=0x558698c505a0 "", pos=<optimized out>, size=32768) at /home/dgilbert/git/qemu/migration/qemu-file-unix.c:101 #4 0x0000558696521fac in qemu_fill_buffer (f=0x558698c50570) at /home/dgilbert/git/qemu/migration/qemu-file.c:227 #5 0x0000558696522989 in qemu_peek_byte (f=0x558698c50570, offset=0) at /home/dgilbert/git/qemu/migration/qemu-file.c:507 #6 0x0000558696522bf4 in qemu_get_be32 (f=0x558698c50570) at /home/dgilbert/git/qemu/migration/qemu-file.c:520 #7 0x0000558696522bf4 in qemu_get_be32 (f=f@entry=0x558698c50570) at /home/dgilbert/git/qemu/migration/qemu-file.c:604 #8 0x0000558696347e5c in qemu_loadvm_state (f=f@entry=0x558698c50570) at /home/dgilbert/git/qemu/migration/savevm.c:1821 #9 0x000055869651de8c in process_incoming_migration_co (opaque=0x558698c50570) at /home/dgilbert/git/qemu/migration/migration.c:336 #10 0x000055869658188a in coroutine_trampoline (i0=<optimized out>, i1=<optimized out>) at /home/dgilbert/git/qemu/coroutine-ucontext.c:80 #11 0x00007f420f05df10 in __start_context () at /lib64/libc.so.6 #12 0x00007ffc40815f50 in () #13 0x0000000000000000 in () ---- Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qemu-gdb: add $qemu_coroutine_sp and $qemu_coroutine_pcPaolo Bonzini2015-10-291-0/+16
| | | | | | | | | 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>
* qemu-gdb: extract parts of "qemu coroutine" implementationPaolo Bonzini2015-10-291-29/+27Star
| | | | | | | | Provide useful Python functions to reach and decipher a jmpbuf. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1444636974-19950-3-git-send-email-pbonzini@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qemu-gdb: allow using glibc_pointer_guard() on core dumpsPaolo Bonzini2015-10-291-2/+16
| | | | | | | | | | | | | | | | | get_fs_base() cannot be run on a core dump, because it uses the arch_prctl system call. The fs base is the value that is returned by pthread_self(), and it would be nice to just glean it from the "info threads" output: * 1 Thread 0x7f16a3fff700 (LWP 33642) pthread_cond_wait@@GLIBC_2.3.2 () ^^^^^^^^^^^^^^ but unfortunately the gdb API does not provide that. Instead, we can look for the "arg" argument of the start_thread function if glibc debug information are available. If not, fall back to the old mechanism. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1444636974-19950-2-git-send-email-pbonzini@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* scripts/qemu-gdb: Split CoroutineCommand into its own filePeter Maydell2015-09-111-0/+91
| | | | | | | | Split the implementation of CoroutineCommand into its own file. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1439574392-4403-3-git-send-email-peter.maydell@linaro.org
* scripts/qemu-gdb: Split MtreeCommand into its own modulePeter Maydell2015-09-112-0/+110
As we add more commands to our Python gdb debugging support, it's going to get unwieldy to have everything in a single file. Split the implementation of the 'mtree' command from qemu-gdb.py into its own module. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1439574392-4403-2-git-send-email-peter.maydell@linaro.org