Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virt-test/RFE: Provide a way to run QEMU under gdb #1319

Open
dagrh opened this issue Jan 6, 2014 · 3 comments
Open

virt-test/RFE: Provide a way to run QEMU under gdb #1319

dagrh opened this issue Jan 6, 2014 · 3 comments

Comments

@dagrh
Copy link
Contributor

dagrh commented Jan 6, 2014

It would be nice to provide a simple way to run the QEMUs that are started under gdb for those of us debugging/breaking qemu.
It should be possible to do this to any test, and in the case of tests with multiple QEMUs (e.g. migration) to select which one you want to debug.
When attached with gdb you probably want to stop timeouts/the test being killed.

@clebergnu
Copy link
Member

Thinking about the simplest case first (a single qemu), I wonder how useful would it be to just prefix the qemu command with: gdb -batch.

This implementation would be trivial but would only pop up gdb in case of an exception such as a segmentation fault IIRC.

@dagrh would you need to interact with gdb during the normal test run time?

@dagrh
Copy link
Contributor Author

dagrh commented Jan 6, 2014

I guess with gdb -batch you'd have to get the set of parameters virt-test passes to gdb into the batch somehow.

I can see a few cases:

  1. If it fails you just want to get it to dump a backtrace etc - for that the batch would work ok
  2. If you want to have a bit of a dig about to see what's going on then batch wouldn't be as useful
  3. Lets say you had something like a ping-pong migration test and once in a while it seg'd - I think you'd probably want to start it off and then come back to it sitting in a gdb when it failed.

@dagrh
Copy link
Contributor Author

dagrh commented Jan 10, 2014

One way of doing it which seems to work ok (in the migration test) but is a bit of a hack is a wrapper script like the following.
The hack with the -S check causes only the main run of qemu to go through gdb so it doesn't upset the runs which just prod it to get the version/info out.
Then I pass this in as the qemu binary

'''
#!/bin/sh
if [ $1 = '-S' ]
then
exec gdb --eval-command='set pagination off' --eval-command='set confirm no' --eval-command='handle SIGPIPE print pass nostop' --eval-command='handle SIGBUS print pass nostop' --eval-command=r --eval-command='thread apply all bt full' --
eval-command=q --args /fullpath/qemu-system-x86_64 "$@"
else
exec /fullpath/qemu-system-x86_64 "$@"
fi
'''

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants