From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JuB1a-0005Ix-7d for qemu-devel@nongnu.org; Thu, 08 May 2008 14:39:26 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JuB1Y-0005IW-8C for qemu-devel@nongnu.org; Thu, 08 May 2008 14:39:25 -0400 Received: from [199.232.76.173] (port=40980 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JuB1Y-0005IA-2e for qemu-devel@nongnu.org; Thu, 08 May 2008 14:39:24 -0400 Received: from fmmailgate01.web.de ([217.72.192.221]:40193) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JuB1X-0007SR-Hq for qemu-devel@nongnu.org; Thu, 08 May 2008 14:39:23 -0400 Received: from smtp06.web.de (fmsmtp06.dlan.cinetic.de [172.20.5.172]) by fmmailgate01.web.de (Postfix) with ESMTP id E6FAFDE61676 for ; Thu, 8 May 2008 20:39:22 +0200 (CEST) Received: from [88.64.10.113] (helo=[192.168.1.198]) by smtp06.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.109 #226) id 1JuB1W-0006N0-00 for qemu-devel@nongnu.org; Thu, 08 May 2008 20:39:22 +0200 Message-ID: <482348DA.4030807@web.de> Date: Thu, 08 May 2008 20:39:22 +0200 From: Jan Kiszka MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: Debugging vmlinux with qemu and gdb. Unable to step, next, print or to get any information.. References: <824D057211107844BA95DB341B4BF12E01139BF2@hanvsmail04.eu.thmulti.com> <4822B9C3.4070808@siemens.com> <824D057211107844BA95DB341B4BF12E01139BF3@hanvsmail04.eu.thmulti.com> In-Reply-To: <824D057211107844BA95DB341B4BF12E01139BF3@hanvsmail04.eu.thmulti.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig5D5B77A628A4BB4CBCA08021" Sender: jan.kiszka@web.de Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig5D5B77A628A4BB4CBCA08021 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Keilhau Timo ( Student ) wrote: > =20 >=20 >> -----Original Message----- >> From:=20 >> qemu-devel-bounces+timo.keilhau.student=3Dthomson.net@nongnu.org >> =20 >> [mailto:qemu-devel-bounces+timo.keilhau.student=3Dthomson.net@no > ngnu.org] On Behalf Of Jan Kiszka >> Sent: Donnerstag, 8. Mai 2008 10:29 >> To: qemu-devel@nongnu.org >> Subject: [Qemu-devel] Re: Debugging vmlinux with qemu and=20 >> gdb. Unable to step, next, print or to get any information.. >> >> Keilhau Timo ( Student ) wrote: >>> Hello List! >>> >>> I am trying to debug linux 2.6.25 kernel with qemu -s and gdb on 64=20 >>> bit amd system. >>> But I am experiencing strange behaviour with qemu and gdb.. >>> Gdb stops at a given breakpoint but I cant step, next, print etc.. >>> >>> Software: >>> Host OS used: opensuse 10.3 >>> Host kernelversion: 2.6.22.5-31-default >>> guest: Debian Etch 4.0r3 amd64=20 >> with 2.6.25 >>> The kernel used to debug: linux-2.6.25.tar.bz2 >>> Virtualization Software: qemu pc emulator version 0.9.0 >>> Host make utillity GNU Make 3.81 >>> Host debugger: GNU gdb 6.6.50.20070726-cvs >>> (Also tried gdb 6.6, gdb 6.8 compiled from source) >>> >>> Look here: >>> >>> // Starting qemu on host: >>> >>> $ qemu-system-x86_64 -s -kernel bzImage -hda=20 >>> qemu_mini_debian_root_fs.img -append "root=3D/dev/hda1" -initrd=20 >>> debian_boot/initrd.img-2.6.25-customtk-i -no-kqemu -redir >>> tcp:10022:10.0.2.15:22 >>> >>> // Boots fine. >>> // vmlinux is compiled with CFLAGS=3D-g3 -ggdb, I have also=20 >> tried only=20 >>> with -g // On host: >>> >>> $ nm vmlinux | grep sys_sendmsg >>> ffffffff803e9ac5 T sys_sendmsg >>> >>> >>> // Starting gdb on host and setting a breakpoint: >>> >>> $ gdb vmlinux >>> >>> GNU gdb 6.6.50.20070726-cvs >>> Copyright (C) 2007 Free Software Foundation, Inc. >>> GDB is free software, covered by the GNU General Public=20 >> License, and=20 >>> you are welcome to change it and/or distribute copies of it under=20 >>> certain conditions. >>> Type "show copying" to see the conditions. >>> There is absolutely no warranty for GDB. Type "show warranty" for=20 >>> details. >>> This GDB was configured as "x86_64-suse-linux"... >>> Using host libthread_db library "/lib64/libthread_db.so.1". >>> (gdb) l sys_sendmsg >>> 1783 /* >>> 1784 * BSD sendmsg interface >>> 1785 */ >>> 1786 >>> 1787 asmlinkage long sys_sendmsg(int fd, struct msghdr=20 >> __user *msg, >>> unsigned flags) >>> 1788 { >>> 1789 struct compat_msghdr __user *msg_compat =3D >>> 1790 (struct compat_msghdr __user *)msg; >>> 1791 struct socket *sock; >>> 1792 char address[MAX_SOCK_ADDR]; >>> (gdb) b 1787 >>> Breakpoint 1 at 0xffffffff803e9ac5: file net/socket.c, line 1787. >>> (gdb) >>> >>> // Now connect to qemu's gdb-stub: >>> >>> (gdb) target remote :1234 >>> Remote debugging using :1234 >>> 0x0000000000000000 in ?? () >>> (gdb) c >>> Continuing. >>> >>> // On guest launching a ping for example, to trigger the breakpoint: >>> >>> $ ping 212.76.144.43 >>> >>> // On Host gdb stops, but it looks strange no address info etc is=20 >>> shown?!?! >>> >>> Program received signal SIGTRAP, Trace/breakpoint trap. >>> 0x0000000000000000 in ?? () >> Make sure gdb is assuming the right arch at this point (=3D>=20 >> set arch i386:x86-64). If you initially break into the guest=20 >> when it is still in real mode, gdb stays in i386 mode even if=20 >> the guest's mode changes. >> >> Jan >> >=20 > Hello Jan, > thanks for your reply! > I've tried your suggestion with "set arch i386:x86-64" > But it seems that it has no effect on this problem. But it was a good > idea. >=20 > Additionally I've tried all architectures just to see what happens. >=20 > This is what ive done: >=20 > (gdb) set architecture i386:x86-64 > The target architecture is assumed to be i386:x86-64 > (gdb) c > Continuing. >=20 > Program received signal SIGTRAP, Trace/breakpoint trap. > 0x0000000000000000 in ?? () > (gdb) s > Cannot find bounds of current function > (gdb) n > Cannot find bounds of current function > (gdb) info locals > No symbol table info available. > (gdb) set architecture i386 > The target architecture is assumed to be i386 > (gdb) c > Continuing. >=20 > // >=20 > Program received signal SIGINT, Interrupt. > 0x8020aed9 in ?? () > (gdb) p this > No symbol "this" in current context. > (gdb) info locals > No symbol table info available. > (gdb) l *0x8020aed9 > No source file for address 0x8020aed9. > (gdb) p *0x8020aed9 > Cannot access memory at address 0x8020aed9 > (gdb) set architecture i386:intel > The target architecture is assumed to be i386:intel > (gdb) c > Continuing. >=20 > // >=20 > Program received signal SIGINT, Interrupt. > 0x8020aed9 in ?? () > (gdb) p this > No symbol "this" in current context. > (gdb) info locals > No symbol table info available. > (gdb) s > Cannot find bounds of current function > (gdb) n > Cannot find bounds of current function > (gdb) l *0x8020aed9 > No source file for address 0x8020aed9. > (gdb) set architecture i386:x86-64:intel > The target architecture is assumed to be i386:x86-64:intel > (gdb) c > Continuing. >=20 > Program received signal SIGTRAP, Trace/breakpoint trap. > 0x0000000000000000 in ?? () > (gdb) info locals > No symbol table info available. > (gdb) n > Cannot find bounds of current function > (gdb) s > Cannot find bounds of current function > (gdb) p this > No symbol "this" in current context. > (gdb) set architecture i8086 > The target architecture is assumed to be i8086 > (gdb) c > Continuing. >=20 > // >=20 > Program received signal SIGINT, Interrupt. > 0x8020aed9 in ?? () > (gdb) s > Cannot find bounds of current function > (gdb) n > Cannot find bounds of current function > (gdb) info locals > No symbol table info available. > (gdb) set architecture > auto i386:intel i386:x86-64:intel > i386 i386:x86-64 i8086 > (gdb) set architecture auto > The target architecture is set automatically (currently i386:x86-64) > (gdb) =20 >=20 > Any further ideas what is going / I'm doing wrong ? Missed breakpoints most often mean that the executed image and the one loaded by gdb do not match. Try comparing offline and runtime disassemblies of the same locations. Jan --------------enig5D5B77A628A4BB4CBCA08021 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4-svn0 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFII0janiDOoMHTA+kRAlzhAJ4hzU+USA0JXZN7P1KlEgAPY30k8gCeO78t e9zkWe5sBZ6DxBq4ngGP08E= =T4aM -----END PGP SIGNATURE----- --------------enig5D5B77A628A4BB4CBCA08021--