From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32512 invoked by alias); 16 Jan 2009 10:39:25 -0000 Received: (qmail 32500 invoked by uid 22791); 16 Jan 2009 10:39:23 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.155) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 16 Jan 2009 10:38:42 +0000 Received: from baal.u-strasbg.fr (baal.u-strasbg.fr [IPv6:2001:660:2402::41]) by mailhost.u-strasbg.fr (8.14.2/jtpda-5.5pre1) with ESMTP id n0GAcPKL007085 ; Fri, 16 Jan 2009 11:38:25 +0100 (CET) Received: from mailserver.u-strasbg.fr (ms4.u-strasbg.fr [IPv6:2001:660:2402:d::13]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id n0GAcPBH088146 ; Fri, 16 Jan 2009 11:38:25 +0100 (CET) (envelope-from muller@ics.u-strasbg.fr) Received: from d620muller (www-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id n0GAcP0D001094 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) ; Fri, 16 Jan 2009 11:38:25 +0100 (CET) (envelope-from muller@ics.u-strasbg.fr) From: "Pierre Muller" To: "'Kai Tietz'" , "'Christopher Faylor'" Cc: References: <001401c97656$77a66b70$66f34250$@u-strasbg.fr> In-Reply-To: Subject: [RFA/windows] 64-bit support for x86-64 windows debug registers Date: Fri, 16 Jan 2009 10:39:00 -0000 Message-ID: <004801c977c6$91f5e110$b5e1a330$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-01/txt/msg00377.txt.bz2 > From Kai Tietz > Hello Pierre, > > for me it worked fine on w64. But of course a maintainer has to give > his > approval for this. Thus, I resubmit the patch as a RFA. Christopher, is this patch OK? Pierre Muller Pascal language support maintainer for GDB ChangeLog entry: 2009-01-14 Pierre Muller * windows-nat.c: Fix debug registers for 64 bits. (dr): Change type to CORE_ADDR and size to 4. (dr6, dr7): New variables. (windows_add_thread, _windows_fetch_inferior_registers) (windows_continue, do_initial_windows_stuff) (cygwin_set_dr, cygwin_set_dr7, cygwin_get_dr6): Adapt to changes above. Index: gdb/windows-nat.c =================================================================== RCS file: /cvs/src/src/gdb/windows-nat.c,v retrieving revision 1.178 diff -u -p -r1.178 windows-nat.c --- gdb/windows-nat.c 14 Jan 2009 05:27:48 -0000 1.178 +++ gdb/windows-nat.c 14 Jan 2009 14:12:05 -0000 @@ -95,7 +95,9 @@ enum #define CONTEXT_DEBUGGER_DR CONTEXT_DEBUGGER | CONTEXT_DEBUG_REGISTERS \ | CONTEXT_EXTENDED_REGISTERS -static unsigned dr[8]; +static CORE_ADDR dr[4]; +static unsigned dr6, dr7; + static int debug_registers_changed; static int debug_registers_used; #define DR6_CLEAR_VALUE 0xffff0ff0 @@ -284,7 +286,7 @@ windows_add_thread (ptid_t ptid, HANDLE th->context.Dr2 = dr[2]; th->context.Dr3 = dr[3]; th->context.Dr6 = DR6_CLEAR_VALUE; - th->context.Dr7 = dr[7]; + th->context.Dr7 = dr7; CHECK (SetThreadContext (th->h, &th->context)); th->context.ContextFlags = 0; } @@ -374,8 +376,8 @@ do_windows_fetch_inferior_registers (str dr[1] = th->context.Dr1; dr[2] = th->context.Dr2; dr[3] = th->context.Dr3; - dr[6] = th->context.Dr6; - dr[7] = th->context.Dr7; + dr6 = th->context.Dr6; + dr7 = th->context.Dr7; } } current_thread->reload_context = 0; @@ -1122,7 +1124,7 @@ windows_continue (DWORD continue_status, th->context.Dr2 = dr[2]; th->context.Dr3 = dr[3]; th->context.Dr6 = DR6_CLEAR_VALUE; - th->context.Dr7 = dr[7]; + th->context.Dr7 = dr7; } if (th->context.ContextFlags) { @@ -1238,7 +1240,7 @@ windows_resume (ptid_t ptid, int step, e th->context.Dr2 = dr[2]; th->context.Dr3 = dr[3]; th->context.Dr6 = DR6_CLEAR_VALUE; - th->context.Dr7 = dr[7]; + th->context.Dr7 = dr7; } CHECK (SetThreadContext (th->h, &th->context)); th->context.ContextFlags = 0; @@ -1508,6 +1510,8 @@ do_initial_windows_stuff (struct target_ debug_registers_used = 0; for (i = 0; i < sizeof (dr) / sizeof (dr[0]); i++) dr[i] = 0; + dr6 = 0; + dr7 = 0; #ifdef __CYGWIN__ cygwin_load_start = cygwin_load_end = 0; #endif @@ -2237,7 +2241,7 @@ cygwin_set_dr (int i, CORE_ADDR addr) if (i < 0 || i > 3) internal_error (__FILE__, __LINE__, _("Invalid register %d in cygwin_set_dr.\n"), i); - dr[i] = (unsigned) addr; + dr[i] = addr; debug_registers_changed = 1; debug_registers_used = 1; } @@ -2248,7 +2252,7 @@ cygwin_set_dr (int i, CORE_ADDR addr) void cygwin_set_dr7 (unsigned val) { - dr[7] = val; + dr7 = val; debug_registers_changed = 1; debug_registers_used = 1; } @@ -2259,7 +2263,7 @@ cygwin_set_dr7 (unsigned val) unsigned cygwin_get_dr6 (void) { - return dr[6]; + return dr6; } /* Determine if the thread referenced by "ptid" is alive