From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32825) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7qDi-0006NP-EX for qemu-devel@nongnu.org; Fri, 09 Aug 2013 13:11:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V7qDc-0000hL-Hl for qemu-devel@nongnu.org; Fri, 09 Aug 2013 13:11:22 -0400 Received: from mail-ie0-x234.google.com ([2607:f8b0:4001:c03::234]:52189) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7qDc-0000h3-Aj for qemu-devel@nongnu.org; Fri, 09 Aug 2013 13:11:16 -0400 Received: by mail-ie0-f180.google.com with SMTP id aq17so4552036iec.11 for ; Fri, 09 Aug 2013 10:11:15 -0700 (PDT) Content-Type: multipart/alternative; boundary="Apple-Mail=_E584BFBB-D65C-4980-9CF7-0046205DB820" Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) From: Yaodong Yang In-Reply-To: Date: Fri, 9 Aug 2013 12:11:13 -0500 Message-Id: <44F64AFA-B961-41D8-A669-90EC61894689@gmail.com> References: Subject: Re: [Qemu-devel] GDB debugging of QEMU. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Yaodong Yang , qemu-devel@nongnu.org --Apple-Mail=_E584BFBB-D65C-4980-9CF7-0046205DB820 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hello Peter, Best, Yaodong ---------------------------------------------- Yaodong Yang Ph.D. Student Department of Computer Science & Engineering University of Nebraska-Lincoln=20 Email: yaodong.yangy@gmail.com OR yyang@cse.unl.edu On Aug 9, 2013, at 11:56 AM, Peter Maydell = wrote: > On 9 August 2013 17:45, Yaodong Yang wrote: >> I tried the following commands. >>=20 >> ./configure --enable-debug --disable-werror --enable-kvm >> --prefix=3D/usr/local/kvm >=20 > --disable-werror is usually not a good idea for developers. I see, I will get rid of it in my development. >=20 >> make -j4 >>=20 >> sudo make install >>=20 >> gdb sudo /usr/local/kvm/bin/qemu-system/x86_64 -s -enable-kvm -hda >> ubuntu.img -m 1024. >=20 > Why are you running qemu as root here? (ie why 'sudo'?) In my implementation, I need to read and write to other raw disks, so I = think I need the root permission to run this program.=20 >=20 >> Could someone give me some guidance on how to use gdb in QEMU. >> I know the basic usage of gdb for simple .c file, but I really >> do not know how to use it in QEMU. >=20 > There is no particular difference. QEMU is a bigger program > but has no particular gotchas for being debugged. 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 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" by the way, when I add storagemanager.c and storagemanager.h to the root = directory, in order to compile and link them, I add storagemanger.o in = Makefile.objs, as "block-obj-y +=3D nbd.o block.o storagemanager.o" in = line 10.=20 Thanks a lot! >=20 > -- PMM --Apple-Mail=_E584BFBB-D65C-4980-9CF7-0046205DB820 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii Hello = Peter,

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



On Aug 9, 2013, at 11:56 AM, Peter Maydell <peter.maydell@linaro.org> = wrote:

On 9 August 2013 17:45, Yaodong Yang <yaodong.yangy@gmail.com> = wrote:
I tried the following = commands.

./configure --enable-debug --disable-werror = --enable-kvm
--prefix=3D/usr/local/kvm

--disable-we= rror is usually not a good idea for developers.
I see, I = will get rid of it in my development.

make -j4

sudo make = install

gdb sudo /usr/local/kvm/bin/qemu-system/x86_64 -s = -enable-kvm -hda
ubuntu.img -m 1024.

Why are you = running qemu as root here? (ie why 'sudo'?)
In my = implementation, I need to read and write to other raw disks, so I think = I need the root permission to run this program. 

Could someone give me some = guidance on how to use gdb in QEMU.
I know the basic usage of gdb for = simple .c file, but I really
do not know how to use it in = QEMU.

There is no particular difference. QEMU is a = bigger program
but has no particular gotchas for being = debugged.

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 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"

by the way, when I add = storagemanager.c and storagemanager.h to the root directory, in order to = compile and link them, I add storagemanger.o in Makefile.objs, as = "block-obj-y +=3D nbd.o  block.o  storagemanager.o" in line = 10. 

Thanks a lot!

-- PMM

= --Apple-Mail=_E584BFBB-D65C-4980-9CF7-0046205DB820--