Blame SOURCES/elfutils-0.182-s390-pid_memory_read.patch

9ffd79
commit e4d985a3c1c873f77d20fa0cd421458cc2824996
9ffd79
Author: Andreas Krebbel <krebbel@linux.ibm.com>
9ffd79
Date:   Thu Nov 19 20:32:24 2020 +0100
9ffd79
9ffd79
    IBM Z: Fix endianess problem in pid_memory_read
9ffd79
    
9ffd79
    The cached reads lack the big endian adjustments done in the fallback
9ffd79
    path.
9ffd79
    
9ffd79
    Signed-off-by: Andreas Krebbel <krebbel@linux.ibm.com>
9ffd79
9ffd79
diff --git a/libdwfl/linux-pid-attach.c b/libdwfl/linux-pid-attach.c
9ffd79
index 3a6af997..b23139d9 100644
9ffd79
--- a/libdwfl/linux-pid-attach.c
9ffd79
+++ b/libdwfl/linux-pid-attach.c
9ffd79
@@ -193,14 +193,22 @@ pid_memory_read (Dwfl *dwfl, Dwarf_Addr addr, Dwarf_Word *result, void *arg)
9ffd79
 {
9ffd79
   struct __libdwfl_pid_arg *pid_arg = arg;
9ffd79
   pid_t tid = pid_arg->tid_attached;
9ffd79
+  Dwfl_Process *process = dwfl->process;
9ffd79
   assert (tid > 0);
9ffd79
 
9ffd79
 #ifdef HAVE_PROCESS_VM_READV
9ffd79
   if (read_cached_memory (pid_arg, addr, result))
9ffd79
+    {
9ffd79
+#if SIZEOF_LONG == 8
9ffd79
+# if BYTE_ORDER == BIG_ENDIAN
9ffd79
+      if (ebl_get_elfclass (process->ebl) == ELFCLASS32)
9ffd79
+	*result >>= 32;
9ffd79
+# endif
9ffd79
+#endif
9ffd79
     return true;
9ffd79
+    }
9ffd79
 #endif
9ffd79
 
9ffd79
-  Dwfl_Process *process = dwfl->process;
9ffd79
   if (ebl_get_elfclass (process->ebl) == ELFCLASS64)
9ffd79
     {
9ffd79
 #if SIZEOF_LONG == 8