]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
RISC-V: Improve riscv64 core file support.
authorJim Wilson <jimw@sifive.com>
Thu, 27 Dec 2018 23:25:49 +0000 (15:25 -0800)
committerMark Wielaard <mark@klomp.org>
Tue, 8 Jan 2019 22:52:11 +0000 (23:52 +0100)
This fixes two problems.  The offset for x1 is changed from 1 to 8 because
this is a byte offset not a register skip count.  Support for reading the
PC value is added.  This requires changing the testsuite to match the new
readelf output for coredumps.

Signed-off-by: Jim Wilson <jimw@sifive.com>
backends/ChangeLog
backends/riscv_corenote.c
tests/ChangeLog
tests/run-readelf-mixed-corenote.sh

index e2a02812cc21a23618528b6fb33ff3a1c669d8a3..c823407200eb2603b190d039f55f85529fb31135 100644 (file)
@@ -1,3 +1,8 @@
+2018-12-27  Jim Wilson  <jimw@sifive.com>
+
+       * riscv_corenote.c (prstatus_regs): Change offset from 1 to 8.
+       (PRSTATUS_REGSET_ITEMS): New.
+
 2018-11-06  Mark Wielaard  <mark@klomp.org>
 
        * x86_64_symbol.c (x86_64_section_type_name): New function.
index 37cce7e3d31aae7a7b800045118bdf98bc3e08f1..afb84bee3e45b818def73e5d972c24ed44cebc6c 100644 (file)
 
 static const Ebl_Register_Location prstatus_regs[] =
   {
-    { .offset = 1, .regno = 1, .count = 31, .bits = 64 } /* x1..x31 */
+    { .offset = 8, .regno = 1, .count = 31, .bits = 64 } /* x1..x31 */
   };
 #define PRSTATUS_REGS_SIZE     (32 * 8)
 
+#define PRSTATUS_REGSET_ITEMS                                          \
+  {                                                                    \
+    .name = "pc", .type = ELF_T_ADDR, .format = 'x',                   \
+    .offset = offsetof (struct EBLHOOK(prstatus), pr_reg[0]),          \
+    .group = "register", .pc_register = true                           \
+  }
+
 #include "linux-core-note.c"
index 1382e40af1bcd8af8d2fbefa025bd4fd19b9c7c9..71b24e098b2c443ecb2a8dc8fa14502e2d8c4cdf 100644 (file)
@@ -1,3 +1,7 @@
+2018-12-27  Jim Wilson  <jimw@sifive.com>
+
+       * run-readelf-mixed-corenote.sh: Update with new riscv64 output.
+
 2018-12-02  Mark Wielaard  <mark@klomp.org>
 
        * testfile_gnu_props.32le.o.bz2: New testfile.
index 07cfc39c63432dee3c2857bb357c83dd65c0f50d..c960f1d6160e0c7af141f3368bf30bf1c6e94621 100755 (executable)
@@ -660,23 +660,23 @@ Note segment of 1408 bytes at offset 0x388:
     sighold: <>
     pid: 6801, ppid: 1155, pgrp: 6801, sid: 1155
     utime: 0.000000, stime: 0.110000, cutime: 0.000000, cstime: 0.000000
-    fpvalid: 0
-    ra:    0x9a00000000000104  sp:    0x400000002000051c
-    gp:    0x280000003fff9812  tp:    0xd000000000000128
-    t0:   5764607523571106577  t1:   -432345563690696255
-    t2:  -5764607522497362661  s0:   5764607523034235171
-    s1:  -6629298650415654894  a0:     72057594037928196
-    a1:  -6341068275337658368  a2:  -5188146769657096173
-    a3:            1073715219  a4:   8646911284551352320
-    a5:   8646911285625067538  a6:   1729382256911463510
-    a7:             536876397  s2:  -1152921504606846976
-    s3:   1152921505322686797  s4:             536871337
-    s5:  -3458764513820540928  s6:  -9223372036138925403
-    s7:             715843991  s8:  -2594073385365405696
-    s9:   4611686019143218592  s10:            715850259
-    s11:            715850393  t3:   -432345564227567616
-    t4:    144115188075856379  t5:    216172782113783808
-    t6:   1152921504606846976
+    pc: 0x000000000001049a, fpvalid: 0
+    ra:    0x0000002000051c9a  sp:    0x0000003fff981240
+    gp:    0x0000000000012828  tp:    0x00000020000311d0
+    t0:          137439068496  t1:          137439288314
+    t2:                 74672  s0:          274871095888
+    s1:                 66724  a0:                     1
+    a1:          274871096232  a2:          274871096248
+    a3:                     0  a4:          274871095928
+    a5:             305419896  a6:          137440357656
+    a7:                     0  s2:          183254994416
+    s3:          137439062288  s4:                     0
+    s5:          183257703888  s6:          183256061824
+    s7:                     0  s8:          183252656348
+    s9:          183257666368  s10:         183257700608
+    s11:                    0  t3:                130042
+    t4:                     2  t5:                     3
+    t6:                 15632
   CORE                 136  PRPSINFO
     state: 0, sname: R, zomb: 0, nice: 0, flag: 0x0000000000400600
     uid: 0, gid: 0, pid: 6801, ppid: 1155, pgrp: 6801, sid: 1155