From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=45413 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OwPFB-00036i-MP for qemu-devel@nongnu.org; Thu, 16 Sep 2010 20:56:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OwPFA-0000lU-IN for qemu-devel@nongnu.org; Thu, 16 Sep 2010 20:56:01 -0400 Received: from fmmailgate01.web.de ([217.72.192.221]:51734) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OwPFA-0000l3-6E for qemu-devel@nongnu.org; Thu, 16 Sep 2010 20:56:00 -0400 Message-ID: <4C92BC9D.40707@web.de> Date: Fri, 17 Sep 2010 02:55:57 +0200 From: Jan Kiszka MIME-Version: 1.0 References: In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig8AC515735DCD6B5ABA5A720A" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: Commit 5f30fa18ad043a841fe9f0c3917ac60f2519ebd1 breaks debugging 64 bit guests List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ted Harkington Cc: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig8AC515735DCD6B5ABA5A720A Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Am 14.09.2010 07:48, Ted Harkington wrote: > Hello, >=20 > I have been trying to figure out why I cannot debug a 64 bit kernel of = my > own invention. >=20 > I launch qemu-system-x86_64 with the -s -S flags, we also specify -cpu > core2duo -vga std and a -hda with an ext2 FS holding our multiboot kern= el > and GRUB2. >=20 > When I try to set breakpoints and "continue" in GDB (7.2) using the ver= y > latest HEAD (b6601141cd2a170dfe773987b06f716a190ea7e0) or 0.12.0 or 0.1= 2.5 > or 13.0.rc0 or 13.0.rc1, I get failures of the same nature: >=20 > 0x0000000000000000 in ?? () > (gdb) break main > Breakpoint 1 at 0x101730: file src/kernel/init.c, line 18. > (gdb) c >=20 > Program received signal SIGTRAP, Trace/breakpoint trap. > 0x0000000000000000 in ?? () > (gdb) >=20 > Note that in this case, main lies in 64 bit mode. However, trying to br= eak > on _start yields virtually the same effect and _start is 32 bit code. >=20 > By doing a git bisect, I managed to narrow the commit that introduced t= his > bug to 5f30fa18ad043a841fe9f0c3917ac60f2519ebd1. Reverting this commit = on > HEAD seemingly fixed the problem for both the 32 bit and 64 bit cases. > I might be doing something incorrectly on my end but this seemed to fix= the > problem. >=20 > Perhaps the pertinent thing to do would be to > revert 5f30fa18ad043a841fe9f0c3917ac60f2519ebd1 as it seems to do nothi= ng > but break things unless, of course, this would only break something tha= t I > am not aware of further. Without that commit, you won't be able to debug guest code in 32- or 16-bit mode with qemu-system-x86_64. The reason is the limited remote gdb protocol that cannot handle mode switches. The commit works around this by switching the architecture instead - which is far from being elegant but still the only alternative. Do you have to debug across a mode switch or just set a proper breakpoint in 64-bit land? In the latter case, just interrupt your guest when it is running 64 bits, then set your breakpoints. If that was too late, issue a system_reset and let the breakpoints trap on second run. If you need to debug the mode switch itself, things get hairy as gdb sometimes dislikes to follow the architecture change via "set arch i386..= =2E". Jan --------------enig8AC515735DCD6B5ABA5A720A 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.15 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/ iEYEARECAAYFAkySvJ0ACgkQitSsb3rl5xQzoQCeLVdHTOVvhVovJRgtwCOhPrXE GrsAni27CheMNZko4CyDiXjDnd1NIZ2g =JyAS -----END PGP SIGNATURE----- --------------enig8AC515735DCD6B5ABA5A720A--