simple typo with cache_ovly_table

Message ID 6B8A85F6-332A-4B74-873A-2E8A68FEA97F@comcast.net
State New, archived
Headers

Commit Message

Mike Stump Oct. 21, 2015, 7:31 p.m. UTC
  On Oct 21, 2015, at 11:00 AM, Simon Marchi <simon.marchi@ericsson.com> wrote:
> cache_ovly_table seems to be a
> 
>  unsigned (*cache_ovly_table)[4]
> 
> so why does it make sense to cast it to a
> 
>  CORE_ADDR (*)[4]
> 
> ?

Ah, I think that was a soft merge conflict resolution failure with a local patch that has overlay addresses being 64-bits.  The 32-bit days are over.  I think I’d need to pull the rest of those out of my tree to submit the lot of them.  Anyway, kinda straight forward as I recall.  [ digging ]

My original patch was as below.  Since then I might have resolved a few merge errors from it.  Apparently no one but me has ever done overlays on a 64-bit port and expected it to work.

Author: Mike Stump <mikestump@comcast.net>
Date:   Tue Nov 1 19:50:29 2011 +0000

    Add 64-bit support for the overlay manager code.
    
    
    git-svn-id: svn+ssh://...
  

Patch

diff --git a/binutils/gdb/symfile.c b/binutils/gdb/symfile.c
index 9ebe050..2ded709 100644
--- a/binutils/gdb/symfile.c
+++ b/binutils/gdb/symfile.c
@@ -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_tty)
    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_section *osect)
        /* && 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)