From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MLbur-0003Dc-NN for qemu-devel@nongnu.org; Tue, 30 Jun 2009 07:54:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MLbun-000399-1D for qemu-devel@nongnu.org; Tue, 30 Jun 2009 07:54:25 -0400 Received: from [199.232.76.173] (port=36205 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MLbum-00038y-T2 for qemu-devel@nongnu.org; Tue, 30 Jun 2009 07:54:20 -0400 Received: from gecko.sbs.de ([194.138.37.40]:24884) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MLbul-0004Aq-Tc for qemu-devel@nongnu.org; Tue, 30 Jun 2009 07:54:20 -0400 Message-ID: <4A49FCE3.1090104@siemens.com> Date: Tue, 30 Jun 2009 13:54:11 +0200 From: Jan Kiszka MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [PATCH 4/4] gdbstub: x86: Switch 64/32 bit registers dynamically References: <20090627075350.13376.17936.stgit@mchn012c.ww002.siemens.net> <200906291507.05278.paul@codesourcery.com> <4A48CE13.6050800@siemens.com> <200906291543.34071.paul@codesourcery.com> <4A48D579.8000305@siemens.com> <20090629151613.GA5924@caradoc.them.org> <4A48DF6F.1090506@siemens.com> <20090629220044.GB7761@shareable.org> In-Reply-To: <20090629220044.GB7761@shareable.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jamie Lokier Cc: qemu-devel@nongnu.org, Anthony Liguori , Paul Brook Jamie Lokier wrote: > Jan Kiszka wrote: >> Daniel Jacobowitz wrote: >>> On Mon, Jun 29, 2009 at 04:53:45PM +0200, Jan Kiszka wrote: >>>> Just to recall the situation (again, please actually try it): if you >>>> have to debug code that switches between 16/32 bit and 64 bit, you >>>> _can't_ debug the 16 or 32 bit part as gdb will stumble and fall over >>>> qemu sending 64-bit register layout for 16/32 bit code. That is a gdb >>>> limitation, but this patch is about dealing with it until it's resolved >>>> in gdb. >>> Remind me why you can't just tell GDB that the target is 64-bit >>> despite whatever file you've given it? >> Because gdb mixes up arch capability and current operation mode on x86. >> It always tries to disassemble according to the set arch. Moreover, it >> will misinterpret the registers as being valid across all 64 bits, not >> just 16 or 32. I haven't looked into further side effects, but I bet >> there are more. > > On a 64-bit CPU in 16/32-bit mode, all 64 register bits _are_ valid > aren't they? (But not useful, as far as I know. Unless there's a > 64-bit equivalent to i386's "big real" modes and such). I meant they are invalid in the sense that, e.g., 32 bit code will not modify the bits 32..63, thus r*x may not always equal e*x. But even more problematic is the fact that frame unwinding does not work if gdb applies 64 bit mode while the target is doing something completely different. A "set arch i386:x86-64" workaround for this problem simply does not work. Jan -- Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux