From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11793 invoked by alias); 29 Nov 2007 10:11:37 -0000 Received: (qmail 11773 invoked by uid 22791); 29 Nov 2007 10:11:35 -0000 X-Spam-Check-By: sourceware.org Received: from ics.u-strasbg.fr (HELO ics.u-strasbg.fr) (130.79.112.250) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 29 Nov 2007 10:11:21 +0000 Received: from ICSMULLER (laocoon.u-strasbg.fr [130.79.112.72]) by ics.u-strasbg.fr (Postfix) with ESMTP id EDAB018701D for ; Thu, 29 Nov 2007 11:15:44 +0100 (CET) From: "Pierre Muller" To: References: <000001c82dad$e507e0b0$af17a210$@u-strasbg.fr> <20071124210708.GE4928@ednor.casa.cgf.cx> <20071124224727.GA13580@caradoc.them.org> <20071125173207.GA7689@ednor.casa.cgf.cx> <20071125190823.GA11606@caradoc.them.org> <20071125221238.GB10356@ednor.casa.cgf.cx> In-Reply-To: <20071125221238.GB10356@ednor.casa.cgf.cx> Subject: [RFA v2] Allow cygwin native to compile with --enable-64-bit-bfd Date: Thu, 29 Nov 2007 10:11:00 -0000 Message-ID: <000901c83270$2a7f7060$7f7e5120$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Content-Language: en-us 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: 2007-11/txt/msg00541.txt.bz2 > >> And the warning is? > > > >Cast from pointer to integer of different size. Casts are the way > >we've handled it elsewhere in GDB, but I wouldn't complain about a > >wrapper; casting host pointers to CORE_ADDRs is an action we try to > >keep to a minimum anyway. > > I wouldn't mind a double cast either, if there is precedent for that. Here is a revised patch that only uses double typecasts. I ran the testsuite and got a slight improvement (2 FAIL less in gdb.base/signals.exp), but I doubt this is significant... OK to check in? ChangeLog entry: 2007-11-28 Pierre Muller *win32-nat.c: Allow compilation if CORE_ADDR is 8 byte long. Add "gdb_stdint.h" dependency required for uintptr_t type use. (handle_output_debug_string): Use uintptr_t typecast. (handle_exception): Ditto. (win32_xfer_memory): Ditto. Index: gdb/win32-nat.c =================================================================== RCS file: /cvs/src/src/gdb/win32-nat.c,v retrieving revision 1.140 diff -u -p -r1.140 win32-nat.c --- gdb/win32-nat.c 24 Nov 2007 12:13:28 -0000 1.140 +++ gdb/win32-nat.c 28 Nov 2007 11:02:09 -0000 @@ -48,6 +48,7 @@ #include "objfiles.h" #include "gdb_obstack.h" #include "gdb_string.h" +#include "gdb_stdint.h" #include "gdbthread.h" #include "gdbcmd.h" #include @@ -829,7 +830,8 @@ handle_output_debug_string (struct targe int retval = 0; if (!target_read_string - ((CORE_ADDR) current_event.u.DebugString.lpDebugStringData, &s, 1024, 0) + ((CORE_ADDR) (uintptr_t) current_event.u.DebugString.lpDebugStringData, + &s, 1024, 0) || !s || !*s) /* nothing to do */; else if (strncmp (s, _CYGWIN_SIGNAL_STRING, sizeof (_CYGWIN_SIGNAL_STRING) - 1) != 0) @@ -1023,7 +1025,8 @@ handle_exception (struct target_waitstat and will be sent as a cygwin-specific-signal. So, ignore SEGVs if th ey show up within the text segment of the DLL itself. */ char *fn; - bfd_vma addr = (bfd_vma) current_event.u.Exception.ExceptionRecord.Excep tionAddress; + bfd_vma addr = (bfd_vma) (uintptr_t) current_event.u.Exception. + ExceptionRecord.ExceptionAddress; if ((!cygwin_exceptions && (addr >= cygwin_load_start && addr < cygwin_l oad_end)) || (find_pc_partial_function (addr, &fn, NULL, NULL) && strncmp (fn, "KERNEL32!IsBad", strlen ("KERNEL32!IsBad")) == 0)) @@ -1925,20 +1928,24 @@ win32_xfer_memory (CORE_ADDR memaddr, gd struct target_ops *target) { DWORD done = 0; + if (write) { DEBUG_MEM (("gdb: write target memory, %d bytes at 0x%08lx\n", - len, (DWORD) memaddr)); - if (!WriteProcessMemory (current_process_handle, (LPVOID) memaddr, our, + len, (DWORD) (uintptr_t) memaddr)); + if (!WriteProcessMemory (current_process_handle, + (LPVOID) (uintptr_t) memaddr, our, len, &done)) done = 0; - FlushInstructionCache (current_process_handle, (LPCVOID) memaddr, len); + FlushInstructionCache (current_process_handle, + (LPCVOID) (uintptr_t) memaddr, len); } else { DEBUG_MEM (("gdb: read target memory, %d bytes at 0x%08lx\n", - len, (DWORD) memaddr)); - if (!ReadProcessMemory (current_process_handle, (LPCVOID) memaddr, our, + len, (DWORD) (uintptr_t) memaddr)); + if (!ReadProcessMemory (current_process_handle, + (LPCVOID) (uintptr_t) memaddr, our, len, &done)) done = 0; }