mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-22 02:50:08 +08:00
* peXXigen.c (pe_print_idata): Fix seg faults on printing import tables with
auto-imported symbols.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2002-05-29 Ralf Habacker <ralf.habacker@freenet.de>
|
||||||
|
|
||||||
|
* peXXigen.c (pe_print_idata): Fix seg faults on printing import tables
|
||||||
|
with auto-imported symbols.
|
||||||
|
|
||||||
2002-05-29 Adam Nemet <anemet@lnxw.com>
|
2002-05-29 Adam Nemet <anemet@lnxw.com>
|
||||||
|
|
||||||
* elf32-arm.h (bfd_elf32_arm_get_bfd_for_interworking): Don't add glue
|
* elf32-arm.h (bfd_elf32_arm_get_bfd_for_interworking): Don't add glue
|
||||||
|
@ -1142,6 +1142,7 @@ pe_print_idata (abfd, vfile)
|
|||||||
|
|
||||||
adj = section->vma - extra->ImageBase;
|
adj = section->vma - extra->ImageBase;
|
||||||
|
|
||||||
|
/* print all image import descriptors */
|
||||||
for (i = 0; i < datasize; i += onaline)
|
for (i = 0; i < datasize; i += onaline)
|
||||||
{
|
{
|
||||||
bfd_vma hint_addr;
|
bfd_vma hint_addr;
|
||||||
@ -1180,44 +1181,6 @@ pe_print_idata (abfd, vfile)
|
|||||||
fprintf (file, _("\n\tDLL Name: %s\n"), dll);
|
fprintf (file, _("\n\tDLL Name: %s\n"), dll);
|
||||||
|
|
||||||
if (hint_addr != 0)
|
if (hint_addr != 0)
|
||||||
{
|
|
||||||
fprintf (file, _("\tvma: Hint/Ord Member-Name\n"));
|
|
||||||
|
|
||||||
idx = hint_addr - adj;
|
|
||||||
|
|
||||||
for (j = 0; j < datasize; j += 4)
|
|
||||||
{
|
|
||||||
unsigned long member = bfd_get_32 (abfd, data + idx + j);
|
|
||||||
|
|
||||||
if (member == 0)
|
|
||||||
break;
|
|
||||||
if (member & 0x80000000)
|
|
||||||
fprintf (file, "\t%04lx\t %4lu", member,
|
|
||||||
member & 0x7fffffff);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int ordinal;
|
|
||||||
char *member_name;
|
|
||||||
|
|
||||||
ordinal = bfd_get_16 (abfd, data + member - adj);
|
|
||||||
member_name = (char *) data + member - adj + 2;
|
|
||||||
fprintf (file, "\t%04lx\t %4d %s",
|
|
||||||
member, ordinal, member_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If the time stamp is not zero, the import address
|
|
||||||
table holds actual addresses. */
|
|
||||||
if (time_stamp != 0
|
|
||||||
&& first_thunk != 0
|
|
||||||
&& first_thunk != hint_addr)
|
|
||||||
fprintf (file, "\t%04lx",
|
|
||||||
(long) bfd_get_32 (abfd, data + first_thunk - adj + j));
|
|
||||||
|
|
||||||
fprintf (file, "\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hint_addr != first_thunk && time_stamp == 0)
|
|
||||||
{
|
{
|
||||||
bfd_byte *ft_data;
|
bfd_byte *ft_data;
|
||||||
asection *ft_section;
|
asection *ft_section;
|
||||||
@ -1227,8 +1190,17 @@ pe_print_idata (abfd, vfile)
|
|||||||
int differ = 0;
|
int differ = 0;
|
||||||
int ft_allocated = 0;
|
int ft_allocated = 0;
|
||||||
|
|
||||||
ft_addr = first_thunk + extra->ImageBase;
|
fprintf (file, _("\tvma: Hint/Ord Member-Name\n"));
|
||||||
|
|
||||||
|
idx = hint_addr - adj;
|
||||||
|
|
||||||
|
ft_addr = first_thunk + extra->ImageBase;
|
||||||
|
ft_data = data;
|
||||||
|
ft_idx = first_thunk - adj;
|
||||||
|
ft_allocated = 0;
|
||||||
|
|
||||||
|
if (first_thunk != hint_addr)
|
||||||
|
{
|
||||||
/* Find the section which contains the first thunk. */
|
/* Find the section which contains the first thunk. */
|
||||||
for (ft_section = abfd->sections;
|
for (ft_section = abfd->sections;
|
||||||
ft_section != NULL;
|
ft_section != NULL;
|
||||||
@ -1271,6 +1243,37 @@ pe_print_idata (abfd, vfile)
|
|||||||
ft_idx = 0;
|
ft_idx = 0;
|
||||||
ft_allocated = 1;
|
ft_allocated = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
/* print HintName vector entries */
|
||||||
|
for (j = 0; j < datasize; j += 4)
|
||||||
|
{
|
||||||
|
unsigned long member = bfd_get_32 (abfd, data + idx + j);
|
||||||
|
|
||||||
|
/* print single IMAGE_IMPORT_BY_NAME vector */
|
||||||
|
if (member == 0)
|
||||||
|
break;
|
||||||
|
if (member & 0x80000000)
|
||||||
|
fprintf (file, "\t%04lx\t %4lu", member,
|
||||||
|
member & 0x7fffffff);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int ordinal;
|
||||||
|
char *member_name;
|
||||||
|
|
||||||
|
ordinal = bfd_get_16 (abfd, data + member - adj);
|
||||||
|
member_name = (char *) data + member - adj + 2;
|
||||||
|
fprintf (file, "\t%04lx\t %4d %s",
|
||||||
|
member, ordinal, member_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If the time stamp is not zero, the import address
|
||||||
|
table holds actual addresses. */
|
||||||
|
if (time_stamp != 0 && first_thunk != 0 && first_thunk != hint_addr)
|
||||||
|
fprintf (file, "\t%04lx",
|
||||||
|
(long) bfd_get_32 (abfd, ft_data + ft_idx + j));
|
||||||
|
|
||||||
|
fprintf (file, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
for (j = 0; j < datasize; j += 4)
|
for (j = 0; j < datasize; j += 4)
|
||||||
{
|
{
|
||||||
@ -1299,14 +1302,13 @@ pe_print_idata (abfd, vfile)
|
|||||||
if (iat_member == 0)
|
if (iat_member == 0)
|
||||||
fprintf (file,
|
fprintf (file,
|
||||||
_("\t>>> Ran out of IAT members!\n"));
|
_("\t>>> Ran out of IAT members!\n"));
|
||||||
else
|
|
||||||
|
else if (hint_member != 0)
|
||||||
{
|
{
|
||||||
ordinal = bfd_get_16 (abfd, data + iat_member - adj);
|
ordinal = bfd_get_16 (abfd, data + hint_member - adj);
|
||||||
member_name = (char *) data + iat_member - adj + 2;
|
member_name = (char *) data + hint_member - adj + 2;
|
||||||
fprintf (file, "\t%04lx\t %4d %s\n",
|
fprintf (file, "\t%04lx\t %4d %s\n",
|
||||||
(unsigned long) iat_member,
|
(unsigned long) iat_member, ordinal, member_name);
|
||||||
ordinal,
|
|
||||||
member_name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1315,8 +1317,7 @@ pe_print_idata (abfd, vfile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (differ == 0)
|
if (differ == 0)
|
||||||
fprintf (file,
|
fprintf (file, _("\tThe Import Address Table is identical\n"));
|
||||||
_("\tThe Import Address Table is identical\n"));
|
|
||||||
|
|
||||||
if (ft_allocated)
|
if (ft_allocated)
|
||||||
free (ft_data);
|
free (ft_data);
|
||||||
|
Reference in New Issue
Block a user