2000-05-03 Michael Snyder <msnyder@seadog.cygnus.com>
* solib.c (elf_locate_base, info_sharedlibrary_command): Look at the bfd to determine if it is elf32 or elf64, rather than using an ifdef. This makes it runtime teststable and multi-arch.
This commit is contained in:
parent
3425c18298
commit
f5b8946ca6
@ -43,6 +43,13 @@ Thu May 4 20:54:00 2000 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
(MIPS_NUM_ARG_REGS), config/mips/tm-mips.h (MIPS_NUM_FP_ARG_REGS):
|
||||
Delete unused macros.
|
||||
|
||||
2000-05-03 Michael Snyder <msnyder@seadog.cygnus.com>
|
||||
|
||||
* solib.c (elf_locate_base, info_sharedlibrary_command):
|
||||
Look at the bfd to determine if it is elf32 or elf64, rather
|
||||
than using an ifdef. This makes it runtime teststable and
|
||||
multi-arch.
|
||||
|
||||
2000-05-01 Mark Kettenis <kettenis@gnu.org>
|
||||
|
||||
* infrun.c (handle_inferior_event): When doing a "next", and
|
||||
|
36
gdb/solib.c
36
gdb/solib.c
@ -710,6 +710,7 @@ elf_locate_base ()
|
||||
CORE_ADDR dyninfo_addr;
|
||||
char *buf;
|
||||
char *bufend;
|
||||
int arch_size;
|
||||
|
||||
/* Find the start address of the .dynamic section. */
|
||||
dyninfo_sect = bfd_get_section_by_name (exec_bfd, ".dynamic");
|
||||
@ -726,7 +727,13 @@ elf_locate_base ()
|
||||
/* Find the DT_DEBUG entry in the the .dynamic section.
|
||||
For mips elf we look for DT_MIPS_RLD_MAP, mips elf apparently has
|
||||
no DT_DEBUG entries. */
|
||||
#ifndef TARGET_ELF64
|
||||
|
||||
arch_size = bfd_elf_get_arch_size (exec_bfd);
|
||||
if (arch_size == -1) /* failure */
|
||||
return 0;
|
||||
|
||||
if (arch_size == 32)
|
||||
{ /* 32-bit elf */
|
||||
for (bufend = buf + dyninfo_sect_size;
|
||||
buf < bufend;
|
||||
buf += sizeof (Elf32_External_Dyn))
|
||||
@ -740,7 +747,8 @@ elf_locate_base ()
|
||||
break;
|
||||
else if (dyn_tag == DT_DEBUG)
|
||||
{
|
||||
dyn_ptr = bfd_h_get_32 (exec_bfd, (bfd_byte *) x_dynp->d_un.d_ptr);
|
||||
dyn_ptr = bfd_h_get_32 (exec_bfd,
|
||||
(bfd_byte *) x_dynp->d_un.d_ptr);
|
||||
return dyn_ptr;
|
||||
}
|
||||
#ifdef DT_MIPS_RLD_MAP
|
||||
@ -750,14 +758,17 @@ elf_locate_base ()
|
||||
|
||||
/* 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);
|
||||
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)))
|
||||
return 0;
|
||||
return extract_unsigned_integer (pbuf, sizeof (pbuf));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#else /* ELF64 */
|
||||
}
|
||||
else /* 64-bit elf */
|
||||
{
|
||||
for (bufend = buf + dyninfo_sect_size;
|
||||
buf < bufend;
|
||||
buf += sizeof (Elf64_External_Dyn))
|
||||
@ -771,11 +782,12 @@ elf_locate_base ()
|
||||
break;
|
||||
else if (dyn_tag == DT_DEBUG)
|
||||
{
|
||||
dyn_ptr = bfd_h_get_64 (exec_bfd, (bfd_byte *) x_dynp->d_un.d_ptr);
|
||||
dyn_ptr = bfd_h_get_64 (exec_bfd,
|
||||
(bfd_byte *) x_dynp->d_un.d_ptr);
|
||||
return dyn_ptr;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* DT_DEBUG entry not found. */
|
||||
return 0;
|
||||
@ -1484,6 +1496,7 @@ info_sharedlibrary_command (ignore, from_tty)
|
||||
int header_done = 0;
|
||||
int addr_width;
|
||||
char *addr_fmt;
|
||||
int arch_size;
|
||||
|
||||
if (exec_bfd == NULL)
|
||||
{
|
||||
@ -1491,13 +1504,18 @@ info_sharedlibrary_command (ignore, from_tty)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef TARGET_ELF64
|
||||
arch_size = bfd_elf_get_arch_size (exec_bfd);
|
||||
/* Default to 32-bit in case of failure (non-elf). */
|
||||
if (arch_size == 32 || arch_size == -1)
|
||||
{
|
||||
addr_width = 8 + 4;
|
||||
addr_fmt = "08l";
|
||||
#else
|
||||
}
|
||||
else if (arch_size == 64)
|
||||
{
|
||||
addr_width = 16 + 4;
|
||||
addr_fmt = "016l";
|
||||
#endif
|
||||
}
|
||||
|
||||
update_solib_list (from_tty, 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user