summaryrefslogtreecommitdiff
path: root/libdwfl
diff options
context:
space:
mode:
authorAndreas Krebbel <krebbel@linux.ibm.com>2020-11-19 20:32:24 +0100
committerMark Wielaard <mark@klomp.org>2020-11-19 22:50:08 +0100
commite4d985a3c1c873f77d20fa0cd421458cc2824996 (patch)
treee5dd7f1dfe51b66d6e07974fccf1a6cfcd1a56a0 /libdwfl
parentd745b47b8386a7972edb70e97857c076c45b3b5d (diff)
downloadelfutils-e4d985a3c1c873f77d20fa0cd421458cc2824996.tar.gz
IBM Z: Fix endianess problem in pid_memory_read
The cached reads lack the big endian adjustments done in the fallback path. Signed-off-by: Andreas Krebbel <krebbel@linux.ibm.com>
Diffstat (limited to 'libdwfl')
-rw-r--r--libdwfl/ChangeLog5
-rw-r--r--libdwfl/linux-pid-attach.c10
2 files changed, 14 insertions, 1 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 59ef37aa..ecd87d3a 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,8 @@
+2020-11-19 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ * linux-pid-attach.c (pid_memory_read): Shift the upper 4 bytes
+ down on big endian 64 bit targets.
+
2020-11-12 Timm Bäder <tbaeder@redhat.com>
* dwfl_segment_report_module.c (dwfl_segment_report_module): Remove
diff --git a/libdwfl/linux-pid-attach.c b/libdwfl/linux-pid-attach.c
index 3a6af997..b23139d9 100644
--- a/libdwfl/linux-pid-attach.c
+++ b/libdwfl/linux-pid-attach.c
@@ -193,14 +193,22 @@ pid_memory_read (Dwfl *dwfl, Dwarf_Addr addr, Dwarf_Word *result, void *arg)
{
struct __libdwfl_pid_arg *pid_arg = arg;
pid_t tid = pid_arg->tid_attached;
+ Dwfl_Process *process = dwfl->process;
assert (tid > 0);
#ifdef HAVE_PROCESS_VM_READV
if (read_cached_memory (pid_arg, addr, result))
+ {
+#if SIZEOF_LONG == 8
+# if BYTE_ORDER == BIG_ENDIAN
+ if (ebl_get_elfclass (process->ebl) == ELFCLASS32)
+ *result >>= 32;
+# endif
+#endif
return true;
+ }
#endif
- Dwfl_Process *process = dwfl->process;
if (ebl_get_elfclass (process->ebl) == ELFCLASS64)
{
#if SIZEOF_LONG == 8