From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7qGr-0000IE-0m for qemu-devel@nongnu.org; Fri, 09 Aug 2013 13:14:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V7qGl-0002Dz-1a for qemu-devel@nongnu.org; Fri, 09 Aug 2013 13:14:36 -0400 Received: from mail-la0-f49.google.com ([209.85.215.49]:41018) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7qGk-0002Ds-Qz for qemu-devel@nongnu.org; Fri, 09 Aug 2013 13:14:30 -0400 Received: by mail-la0-f49.google.com with SMTP id ev20so3127853lab.22 for ; Fri, 09 Aug 2013 10:14:30 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <44F64AFA-B961-41D8-A669-90EC61894689@gmail.com> References: <44F64AFA-B961-41D8-A669-90EC61894689@gmail.com> From: Peter Maydell Date: Fri, 9 Aug 2013 18:14:09 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] GDB debugging of QEMU. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yaodong Yang Cc: qemu-devel@nongnu.org On 9 August 2013 18:11, Yaodong Yang wrote: > I think I did not make my question clear. I do not know > 1. how to add "-g" flag when compile QEMU, in order to use gdb This is what passing --enable-debug to configure does. > 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.) -- PMM