summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2011-12-02 09:45:53 -0800
committerRoland McGrath <roland@hack.frob.com>2011-12-02 09:45:53 -0800
commit01fef9d502eb1e21ac7b7e8ec9451dc96c72f7ed (patch)
treeaf48bf740976cf0c8d8f9dbb233b7f4da2dbc0d9
parente5ba2a160bea234b1f38d6e4e7a09ef898017c51 (diff)
Fix elf_from_remote_memory for ELFCLASS64 case.
-rw-r--r--libdwfl/ChangeLog6
-rw-r--r--libdwfl/elf-from-memory.c8
2 files changed, 10 insertions, 4 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 0cfa462d..87a05550 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,9 @@
+2011-12-02 Roland McGrath <roland@hack.frob.com>
+
+ * elf-from-memory.c (elf_from_remote_memory): Fix ELFCLASS64 case
+ to use elf64_xlatetom and PHDRS.p64.
+ Reported by Serge Pavlov <serge.pavlov.at.gnu@gmail.com>.
+
2011-11-31 Mark Wielaard <mjw@redhat.com>
* dwfl_module_addrsym.c (dwfl_module_addrsym): First search all
diff --git a/libdwfl/elf-from-memory.c b/libdwfl/elf-from-memory.c
index c0e7c46d..0fb5f8a3 100644
--- a/libdwfl/elf-from-memory.c
+++ b/libdwfl/elf-from-memory.c
@@ -1,5 +1,5 @@
/* Reconstruct an ELF file by reading the segments out of remote memory.
- Copyright (C) 2005, 2006, 2007 Red Hat, Inc.
+ Copyright (C) 2005-2011 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -244,11 +244,11 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
break;
case ELFCLASS64:
- if (elf32_xlatetom (&xlateto, &xlatefrom,
- ehdr.e32.e_ident[EI_DATA]) == NULL)
+ if (elf64_xlatetom (&xlateto, &xlatefrom,
+ ehdr.e64.e_ident[EI_DATA]) == NULL)
goto libelf_error;
for (uint_fast16_t i = 0; i < phnum; ++i)
- if (phdrs.p32[i].p_type == PT_LOAD)
+ if (phdrs.p64[i].p_type == PT_LOAD)
handle_segment (phdrs.p64[i].p_vaddr, phdrs.p64[i].p_offset,
phdrs.p64[i].p_filesz, phdrs.p64[i].p_align);
break;