From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:49825) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rp35C-0001bx-43 for qemu-devel@nongnu.org; Sun, 22 Jan 2012 14:28:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rp35A-0001e9-Qq for qemu-devel@nongnu.org; Sun, 22 Jan 2012 14:28:05 -0500 Received: from fmmailgate03.web.de ([217.72.192.234]:44396) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rp35A-0001e5-Fc for qemu-devel@nongnu.org; Sun, 22 Jan 2012 14:28:04 -0500 Received: from moweb002.kundenserver.de (moweb002.kundenserver.de [172.19.20.108]) by fmmailgate03.web.de (Postfix) with ESMTP id CEFEE1B05BBEF for ; Sun, 22 Jan 2012 20:28:03 +0100 (CET) Message-ID: <4F1C6342.7020404@web.de> Date: Sun, 22 Jan 2012 20:28:02 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <4F1C5A39.10907@web.de> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig282C94E7AEE78F17F5B43329" Subject: Re: [Qemu-devel] Failed to use gdb with qemu 15.1 (with and without kvm support) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Francis Moreau Cc: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig282C94E7AEE78F17F5B43329 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2012-01-22 20:25, Francis Moreau wrote: > Hello, >=20 > Thanks for you hints ! >=20 > On Sun, Jan 22, 2012 at 7:49 PM, Jan Kiszka wrote: >> On 2012-01-22 15:20, Francis Moreau wrote: >>> Hello, >>> >>> I'm trying to debug a 64 bits kernel (3.2) using qemu (with and >>> without KVM support). The host is also 64 bits. Version of gdb I'm >>> using is 7.1. >>> >>> To do that I simply start qemu like the following: >>> >>> $ qemu-system-x86_64 -kernel bzImage -append "root=3D/dev/sda1 >>> console=3DttyS0 3" -serial stdio -S -s >>> >>> and in another term, I start gdb like this: >>> >>> $ gdb vmlinux >>> $ target remote locahost:1234 >>> $ b prepare_namespace >>> $ continue >>> Continuing. >>> Remote 'g' packet reply is too long: af75919effffffff0............. >>> >>> So it fails when gdb stops on the breakpoint with the above message. >>> >>> If I try to dump the backtrace I got: >>> >>> $ bt >>> Target is executing. >>> $ info thread >>> * 1 Thread 1 (CPU#0 [running]) (running) >>> >>> But the VM seems to be stopped because if I'm asking the status to qe= mu: >>> >>> $ info status >>> VM status: paused >>> >>> I also tried qemu with KVM support but I get one more problem: gdb is= >>> ignoring my breakpoint. >>> >>> Could anybody help me to make gdb work ? >> >> When stopping the guest with -S before it booted, gdb will interrupt i= t >> while it is still in 16-bit real mode. Later on, when Linux runs, the >> guest is in 64-bit protected mode. gdb is not prepared for such a >> switch. All you can do: >> >> - let the guest run until it surely reached 64-bit mode >> - interrupt it and set a breakpoint at the desired early-boot location= , >=20 > So I let the kernel boot, and then I'm trying to start and connect gdb > to qemu but unfortunately gdb is segfaulting when trying to connect :( Try gdb 7.3 or even latest development version (the latter is required for module debugging - just in case). >=20 >> important: if using KVM, set a hardware breakpoint! >=20 > ah ok good to know, I'll try to use hw breakpoints. The reason is that software breakpoints are implemented under kvm by patching breakpoint instructions into the guest - and those get overwritten when reloading the kernel after reboot. Jan --------------enig282C94E7AEE78F17F5B43329 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.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk8cY0IACgkQitSsb3rl5xREHgCfQrAU/T1bOTZPFj+ttP3W6ssY gckAoJVJQYT5TiIiUr5O31TXdWiX9ds6 =K/IF -----END PGP SIGNATURE----- --------------enig282C94E7AEE78F17F5B43329--