Add DT_MIPS_RLD_MAP case for 64-bit targets.
authorKevin Buettner <kevinb@redhat.com>
Sat, 21 Dec 2002 06:43:25 +0000 (06:43 +0000)
committerKevin Buettner <kevinb@redhat.com>
Sat, 21 Dec 2002 06:43:25 +0000 (06:43 +0000)
gdb/ChangeLog
gdb/solib-svr4.c

index f0ce860e0e459d835ec8496667ff8e9b2375c10c..c3ab1847a9208c11bc91523daa34aef5b8870de3 100644 (file)
@@ -1,3 +1,8 @@
+2002-12-20  Kevin Buettner  <kevinb@redhat.com>
+
+       * solib-svr4.c (elf_locate_base): Fix sizeof() related bug.  Add
+       DT_MIPS_RLD_MAP case for 64-bit targets.
+
 2002-12-20  Kevin Buettner  <kevinb@redhat.com>
 
        * mips-tdep.c (heuristic_proc_desc): Clear memory associated with
index 78161e0d2498476cb4eb604fdace4d1b244b6ff4..8ced5f0129b3c2c4a03d86b543a50f400f123290 100644 (file)
@@ -446,15 +446,16 @@ elf_locate_base (void)
          else if (dyn_tag == DT_MIPS_RLD_MAP)
            {
              char *pbuf;
+             int pbuf_size = TARGET_PTR_BIT / HOST_CHAR_BIT;
 
-             pbuf = alloca (TARGET_PTR_BIT / HOST_CHAR_BIT);
+             pbuf = alloca (pbuf_size);
              /* DT_MIPS_RLD_MAP contains a pointer to the address
                 of the dynamic link structure.  */
              dyn_ptr = bfd_h_get_32 (exec_bfd, 
                                      (bfd_byte *) x_dynp->d_un.d_ptr);
-             if (target_read_memory (dyn_ptr, pbuf, sizeof (pbuf)))
+             if (target_read_memory (dyn_ptr, pbuf, pbuf_size))
                return 0;
-             return extract_unsigned_integer (pbuf, sizeof (pbuf));
+             return extract_unsigned_integer (pbuf, pbuf_size);
            }
        }
     }
@@ -477,6 +478,20 @@ elf_locate_base (void)
                                      (bfd_byte *) x_dynp->d_un.d_ptr);
              return dyn_ptr;
            }
+         else if (dyn_tag == DT_MIPS_RLD_MAP)
+           {
+             char *pbuf;
+             int pbuf_size = TARGET_PTR_BIT / HOST_CHAR_BIT;
+
+             pbuf = alloca (pbuf_size);
+             /* DT_MIPS_RLD_MAP contains a pointer to the address
+                of the dynamic link structure.  */
+             dyn_ptr = bfd_h_get_64 (exec_bfd, 
+                                     (bfd_byte *) x_dynp->d_un.d_ptr);
+             if (target_read_memory (dyn_ptr, pbuf, pbuf_size))
+               return 0;
+             return extract_unsigned_integer (pbuf, pbuf_size);
+           }
        }
     }