From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JXOwf-0000j2-DS for qemu-devel@nongnu.org; Thu, 06 Mar 2008 17:52:13 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JXOwc-0000iT-Ih for qemu-devel@nongnu.org; Thu, 06 Mar 2008 17:52:12 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JXOwc-0000iN-FE for qemu-devel@nongnu.org; Thu, 06 Mar 2008 17:52:10 -0500 Received: from smtp-14.smtp.ucla.edu ([169.232.46.250]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JXOwb-00058t-Sy for qemu-devel@nongnu.org; Thu, 06 Mar 2008 17:52:10 -0500 Received: from mail.ucla.edu (mail.ucla.edu [169.232.48.150]) by smtp-14.smtp.ucla.edu (8.14.2/8.14.2) with ESMTP id m26Mq7Zr013061 for ; Thu, 6 Mar 2008 14:52:07 -0800 Received: from mug.lcdf.org (Cs-32-42.CS.UCLA.EDU [131.179.32.42]) (authenticated bits=0) by mail.ucla.edu (8.13.8/8.13.8) with ESMTP id m26Mq6we012927 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Thu, 6 Mar 2008 14:52:07 -0800 Message-ID: <47D0752B.8080807@cs.ucla.edu> Date: Thu, 06 Mar 2008 14:50:19 -0800 From: Eddie Kohler MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] PATCH: allow i386 debugging when segment offset != 0 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 Hi all, This patch makes QEMU's gdb debugging stub and CPU breakpoints work when the segment offset is not 0. Previously, the debugging stub assumed the segment offset was 0, leading to very odd behavior. This patch assumes that the code segment and data segment have the same offset. This is a reasonable assumption. Making the code work for different code and data offsets would be more invasive. Please accept this patch (this is a resend.) Eddie Kohler Index: target-i386/helper2.c =================================================================== RCS file: /sources/qemu/qemu/target-i386/helper2.c,v retrieving revision 1.62 diff -u -r1.62 helper2.c --- target-i386/helper2.c 24 Dec 2007 14:04:06 -0000 1.62 +++ target-i386/helper2.c 6 Mar 2008 22:46:46 -0000 @@ -1081,6 +1081,7 @@ { uint32_t pde_addr, pte_addr; uint32_t pde, pte, paddr, page_offset, page_size; + addr += env->segs[R_DS].base; if (env->cr[4] & CR4_PAE_MASK) { uint32_t pdpe_addr, pde_addr, pte_addr; Index: target-i386/translate.c =================================================================== RCS file: /sources/qemu/qemu/target-i386/translate.c,v retrieving revision 1.79 diff -u -r1.79 translate.c --- target-i386/translate.c 24 Feb 2008 07:45:42 -0000 1.79 +++ target-i386/translate.c 6 Mar 2008 22:46:46 -0000 @@ -6740,7 +6740,7 @@ for(;;) { if (env->nb_breakpoints > 0) { for(j = 0; j < env->nb_breakpoints; j++) { - if (env->breakpoints[j] == pc_ptr) { + if (env->breakpoints[j] == pc_ptr - dc->cs_base) { gen_debug(dc, pc_ptr - dc->cs_base); break; }