From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20144 invoked by alias); 1 Nov 2011 19:50:02 -0000 Received: (qmail 20036 invoked by uid 22791); 1 Nov 2011 19:50:00 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from qmta15.emeryville.ca.mail.comcast.net (HELO qmta15.emeryville.ca.mail.comcast.net) (76.96.27.228) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 01 Nov 2011 19:49:44 +0000 Received: from omta11.emeryville.ca.mail.comcast.net ([76.96.30.36]) by qmta15.emeryville.ca.mail.comcast.net with comcast id rv5T1h0040mlR8UAFvpcDy; Tue, 01 Nov 2011 19:49:36 +0000 Received: from up.mrs.kithrup.com ([24.4.193.8]) by omta11.emeryville.ca.mail.comcast.net with comcast id rvmk1h00p0BKwT48Xvmkb7; Tue, 01 Nov 2011 19:46:44 +0000 Subject: Re: remote-sim.h Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: multipart/mixed; boundary=Apple-Mail-8-419883080 From: Mike Stump In-Reply-To: Date: Tue, 01 Nov 2011 19:50:00 -0000 Cc: Mike Frysinger , gdb-patches@sourceware.org Message-Id: <1996AF78-76A1-4104-A1AE-DF674CA3E6CE@comcast.net> References: <42696E6D-92F3-4F66-B2C9-D79C76B12D2F@comcast.net> <201110312354.53063.vapier@gentoo.org> <593EB847-F177-4D84-8DB3-30064C53907E@comcast.net> To: Tom Tromey 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: 2011-11/txt/msg00028.txt.bz2 --Apple-Mail-8-419883080 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Content-length: 3022 On Nov 1, 2011, at 10:18 AM, Tom Tromey wrote: > I don't know this code, but the comment in remote-sim.h indicates it is > trying to use the same type as gdb, and the current gdb/defs.h says: >=20 > typedef bfd_vma CORE_ADDR; >=20 > remote-sim.h is the only reference I see to CORE_ADDR_TYPE. > I don't know the history but replacing it with bfd_vma seems like the > right thing. Ah, yes, I agree. Another patch to get the overlay code to work is below. It just replaces u= nsigned int (32-bits for me) with CORE_ADDR, as otherwise int doesn't have = enough bits to actually hold a long (64-bits for me). Index: gdb/symfile.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gdb/symfile.c (revision 1878) +++ gdb/symfile.c (working copy) @@ -122,7 +122,7 @@ static void overlay_command (char *, int =20 static void simple_free_overlay_table (void); =20 -static void read_target_long_array (CORE_ADDR, unsigned int *, int, int, +static void read_target_long_array (CORE_ADDR, CORE_ADDR *, int, int, enum bfd_endian); =20 static int simple_read_overlay_table (void); @@ -3307,8 +3307,8 @@ overlay_command (char *args, int from_tt the target (whenever possible). */ =20 /* Cached, dynamically allocated copies of the target data structures: */ -static unsigned (*cache_ovly_table)[4] =3D 0; -static unsigned cache_novlys =3D 0; +static CORE_ADDR (*cache_ovly_table)[4] =3D 0; +static CORE_ADDR cache_novlys =3D 0; static CORE_ADDR cache_ovly_table_base =3D 0; enum ovly_index { @@ -3329,7 +3329,7 @@ simple_free_overlay_table (void) /* Read an array of ints of size SIZE from the target into a local buffer. Convert to host order. int LEN is number of ints. */ static void -read_target_long_array (CORE_ADDR memaddr, unsigned int *myaddr, +read_target_long_array (CORE_ADDR memaddr, CORE_ADDR *myaddr, int len, int size, enum bfd_endian byte_order) { /* FIXME (alloca): Not safe if array is very large. */ @@ -3380,7 +3380,7 @@ simple_read_overlay_table (void) =3D (void *) xmalloc (cache_novlys * sizeof (*cache_ovly_table)); cache_ovly_table_base =3D SYMBOL_VALUE_ADDRESS (ovly_table_msym); read_target_long_array (cache_ovly_table_base, - (unsigned int *) cache_ovly_table, + (CORE_ADDR *) cache_ovly_table, cache_novlys * 4, word_size, byte_order); =20 return 1; /* SUCCESS */ @@ -3411,7 +3411,7 @@ simple_overlay_update_1 (struct obj_sect /* && cache_ovly_table[i][SIZE] =3D=3D size */ ) { read_target_long_array (cache_ovly_table_base + i * word_size, - (unsigned int *) cache_ovly_table[i], + (CORE_ADDR *) cache_ovly_table[i], 4, word_size, byte_order); if (cache_ovly_table[i][VMA] =3D=3D bfd_section_vma (obfd, bsect) && cache_ovly_table[i][LMA] =3D=3D bfd_section_lma (obfd, bsect) --Apple-Mail-8-419883080 Content-Disposition: attachment; filename=symfile.patch.txt Content-Type: text/plain; name="symfile.patch.txt" Content-Transfer-Encoding: 7bit Content-length: 2234 Index: gdb/symfile.c =================================================================== --- gdb/symfile.c (revision 1878) +++ gdb/symfile.c (working copy) @@ -122,7 +122,7 @@ static void overlay_command (char *, int static void simple_free_overlay_table (void); -static void read_target_long_array (CORE_ADDR, unsigned int *, int, int, +static void read_target_long_array (CORE_ADDR, CORE_ADDR *, int, int, enum bfd_endian); static int simple_read_overlay_table (void); @@ -3307,8 +3307,8 @@ overlay_command (char *args, int from_tt the target (whenever possible). */ /* Cached, dynamically allocated copies of the target data structures: */ -static unsigned (*cache_ovly_table)[4] = 0; -static unsigned cache_novlys = 0; +static CORE_ADDR (*cache_ovly_table)[4] = 0; +static CORE_ADDR cache_novlys = 0; static CORE_ADDR cache_ovly_table_base = 0; enum ovly_index { @@ -3329,7 +3329,7 @@ simple_free_overlay_table (void) /* Read an array of ints of size SIZE from the target into a local buffer. Convert to host order. int LEN is number of ints. */ static void -read_target_long_array (CORE_ADDR memaddr, unsigned int *myaddr, +read_target_long_array (CORE_ADDR memaddr, CORE_ADDR *myaddr, int len, int size, enum bfd_endian byte_order) { /* FIXME (alloca): Not safe if array is very large. */ @@ -3380,7 +3380,7 @@ simple_read_overlay_table (void) = (void *) xmalloc (cache_novlys * sizeof (*cache_ovly_table)); cache_ovly_table_base = SYMBOL_VALUE_ADDRESS (ovly_table_msym); read_target_long_array (cache_ovly_table_base, - (unsigned int *) cache_ovly_table, + (CORE_ADDR *) cache_ovly_table, cache_novlys * 4, word_size, byte_order); return 1; /* SUCCESS */ @@ -3411,7 +3411,7 @@ simple_overlay_update_1 (struct obj_sect /* && cache_ovly_table[i][SIZE] == size */ ) { read_target_long_array (cache_ovly_table_base + i * word_size, - (unsigned int *) cache_ovly_table[i], + (CORE_ADDR *) cache_ovly_table[i], 4, word_size, byte_order); if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect) && cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect) --Apple-Mail-8-419883080 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Content-length: 2 --Apple-Mail-8-419883080--