It works! Thank you very much!

Best,
Yaodong
----------------------------------------------
Yaodong Yang
Ph.D. Student
Department of Computer Science & Engineering
University of Nebraska-Lincoln 




On Aug 9, 2013, at 12:25 PM, Max Filippov <jcmvbkbc@gmail.com> wrote:

On Fri, Aug 9, 2013 at 9:14 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
On 9 August 2013 18:11, Yaodong Yang <yaodong.yangy@gmail.com> wrote:
2. how to invoke QEMU with gdb,
because my previous attempt failed. "gdb sudo
/usr/local/kvm/bin/qemu-system/x86_64 -s -enable-kvm -hda"

This won't work because you're running gdb as your own
user and attempting to debug a program running as root.
'sudo gdb qemu-system-x86_64 ...' will probably work.

(Also, you almost certainly want to run gdb on the binary
that you just built rather than on the binary in
/usr/local/kvm/bin which is presumably whatever older
version was last installed.)

You also need --args when you pass arguments to the application
being debugged, so the command line looks like

sudo gdb --args /usr/local/kvm/bin/qemu-system/x86_64 -s -enable-kvm -hda

--
Thanks.
-- Max