From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2251 invoked by alias); 23 Nov 2007 08:50:21 -0000 Received: (qmail 2242 invoked by uid 22791); 23 Nov 2007 08:50:20 -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; Fri, 23 Nov 2007 08:50:09 +0000 Received: from ICSMULLER (laocoon.u-strasbg.fr [130.79.112.72]) by ics.u-strasbg.fr (Postfix) with ESMTP id 7710618701A for ; Fri, 23 Nov 2007 09:54:39 +0100 (CET) From: "Pierre Muller" To: Subject: [RFC/RFA] Allow cygwin native to compile with --enable-64-bit-bfd Date: Fri, 23 Nov 2007 08:50:00 -0000 Message-ID: <000001c82dad$e507e0b0$af17a210$@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/msg00418.txt.bz2 This patch fixes the build failure for cygwin (or mingw32) if you add --enable-64-bit-bfd option to configure. When I tried to check the multi-target support patch from Ulrich Weigand, I stumpled over a win32 native problem. See http://sourceware.org/ml/gdb-patches/2007-11/msg00367.html The problem is that win32-nat.c code implicitly supposes the CORE_ADDR is a 32 bit type, while it becomes a 64 bit type if --enable-64-bit-bfd option is used. The testsuite gives very similar results for gdb configured without options and with --enable-64-bit-bfd after that patch. Pierre Muller The ChangeLog entry is maybe to verbose, but I didn't know how to shorten it. ChangeLog entry: 2007-11-22 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): New local variable: addr, used to convert lpDebugStringData pointer to uintptr_t type, which can further be typecasted to CORE_ADDR. (handle_exception): Typecast ExceptionAddress field to uintptr_t. (win32_xfer_memory): New local variable: mem_addr, used to convert memaddr of type CORE_ADDR to uintputr_t. Index: gdb/win32-nat.c =================================================================== RCS file: /cvs/src/src/gdb/win32-nat.c,v retrieving revision 1.139 diff -u -p -r1.139 win32-nat.c --- gdb/win32-nat.c 16 Nov 2007 04:53:46 -0000 1.139 +++ gdb/win32-nat.c 23 Nov 2007 08:30:33 -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 @@ -818,9 +819,10 @@ handle_output_debug_string (struct targe { char *s = NULL; int retval = 0; + uintptr_t addr = (uintptr_t) current_event.u.DebugString.lpDebugStringData; if (!target_read_string - ((CORE_ADDR) current_event.u.DebugString.lpDebugStringData, &s, 1024, 0) + ((CORE_ADDR) addr, &s, 1024, 0) || !s || !*s) /* nothing to do */; else if (strncmp (s, _CYGWIN_SIGNAL_STRING, sizeof (_CYGWIN_SIGNAL_STRING) - 1) != 0) @@ -1014,7 +1016,7 @@ handle_exception (struct target_waitstat and will be sent as a cygwin-specific-signal. So, ignore SEGVs if they show up within the text segment of the DLL itself. */ char *fn; - bfd_vma addr = (bfd_vma) current_event.u.Exception.ExceptionRecord.ExceptionAddress; + bfd_vma addr = (uintptr_t) current_event.u.Exception.ExceptionRecord.ExceptionAddress; if ((!cygwin_exceptions && (addr >= cygwin_load_start && addr < cygwin_load_end)) || (find_pc_partial_function (addr, &fn, NULL, NULL) && strncmp (fn, "KERNEL32!IsBad", strlen ("KERNEL32!IsBad")) == 0)) @@ -1915,20 +1917,22 @@ win32_xfer_memory (CORE_ADDR memaddr, gd struct target_ops *target) { DWORD done = 0; + uintptr_t mem_addr = (uintptr_t) memaddr; + 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) mem_addr)); + if (!WriteProcessMemory (current_process_handle, (LPVOID) mem_addr, our, len, &done)) done = 0; - FlushInstructionCache (current_process_handle, (LPCVOID) memaddr, len); + FlushInstructionCache (current_process_handle, (LPCVOID) mem_addr, 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) mem_addr)); + if (!ReadProcessMemory (current_process_handle, (LPCVOID) mem_addr, our, len, &done)) done = 0; }