From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ghzaa-0005an-6L for qemu-devel@nongnu.org; Wed, 08 Nov 2006 21:24:24 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GhzaY-0005Zv-CY for qemu-devel@nongnu.org; Wed, 08 Nov 2006 21:24:23 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GhzaY-0005Zq-3S for qemu-devel@nongnu.org; Wed, 08 Nov 2006 21:24:22 -0500 Received: from [66.93.172.17] (helo=nevyn.them.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GhzaX-00067R-Re for qemu-devel@nongnu.org; Wed, 08 Nov 2006 21:24:22 -0500 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1GhzaW-0004fN-KR for qemu-devel@nongnu.org; Wed, 08 Nov 2006 21:24:20 -0500 Date: Wed, 8 Nov 2006 21:24:20 -0500 From: Daniel Jacobowitz Subject: Re: [Qemu-devel] Re: Debugging with paging enabled Message-ID: <20061109022420.GA17900@nevyn.them.org> References: <1583108256.20061108033019@kilgus.net> <6310169804.20061108221303@kilgus.net> <455256F2.6090006@bellard.org> <822249722.20061109003305@kilgus.net> <20061108234226.GA13464@nevyn.them.org> <816057700.20061109005729@kilgus.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <816057700.20061109005729@kilgus.net> 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 On Thu, Nov 09, 2006 at 12:57:29AM +0100, Marcel Kilgus wrote: > Daniel Jacobowitz wrote: > >> Leaving that aside, if I do set the breakpoint correctly at virtual > >> address (e.g.) 0xC0123456 qemu will (correctly I guess) cause an > >> exception for code offset 0x123456 (as CS base is 0xC0000000). GDB > >> however then doesn't recognize its own breakpoint as it only remembers > >> having set one at 0xC0123456, and apparently doesn't translate the > >> given exception address of CS:0x123456 back to a virtual one. > > Which segment is it running from at this point? Qemu may be reporting > > the wrong address. > > After paging is switched on, all code always runs in the CS that is > based at 0xC0000000. As I see it qemu reports the address just fine. > As I wrote in my original mail it only works if I set two breakpoints, > one at 0x123456 and one at 0xC0123456. Makes sense then, the > 0xC0123456 triggers the breakpoint exception within qemu and the > 0x123456 is used by GDB to recognize the offset it gets from qemu. > It's a mess, really, and probably not qemu's fault. If qemu is ever sending "0x123456" back to GDB in the scenario you've described, you can probably get the right behavior by simulating flat memory: make qemu add the segment base to the pc when it sends it to gdb. At this point you're past what I know about i386 though. -- Daniel Jacobowitz CodeSourcery