Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mike Stump <mikestump@comcast.net>
To: Tom Tromey <tromey@redhat.com>
Cc: Mike Frysinger <vapier@gentoo.org>, gdb-patches@sourceware.org
Subject: Re: remote-sim.h
Date: Tue, 01 Nov 2011 19:50:00 -0000	[thread overview]
Message-ID: <1996AF78-76A1-4104-A1AE-DF674CA3E6CE@comcast.net> (raw)
In-Reply-To: <m3obwv3gn8.fsf@fleche.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2907 bytes --]

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:
> 
>    typedef bfd_vma CORE_ADDR;
> 
> 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 unsigned 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
===================================================================
--- 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)



[-- Attachment #2: symfile.patch.txt --]
[-- Type: text/plain, Size: 2234 bytes --]

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)

[-- Attachment #3: Type: text/plain, Size: 2 bytes --]




  reply	other threads:[~2011-11-01 19:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-31 23:24 remote-sim.h Mike Stump
2011-11-01  3:55 ` remote-sim.h Mike Frysinger
2011-11-01  5:38   ` remote-sim.h Mike Stump
2011-11-01 18:55     ` remote-sim.h Tom Tromey
2011-11-01 19:50       ` Mike Stump [this message]
2011-11-02 17:02         ` remote-sim.h Tom Tromey
2011-11-06 17:35 ` remote-sim.h Mike Frysinger
2011-11-06 18:31   ` remote-sim.h Mike Stump

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1996AF78-76A1-4104-A1AE-DF674CA3E6CE@comcast.net \
    --to=mikestump@comcast.net \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    --cc=vapier@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox