arc: Write correct "eret" value during register collection
authorShahab Vahedi <shahab@synopsys.com>
Thu, 12 Nov 2020 11:50:33 +0000 (12:50 +0100)
committerShahab Vahedi <shahab@synopsys.com>
Thu, 12 Nov 2020 16:00:55 +0000 (17:00 +0100)
commit10c19fadfd45da5262d2f8b9624be71c274ff15d
treec6b9afc856514699d48d084fa1febb0426d729f9
parent1f2624a35413c31c317e5da8ce7401b59ecfbfa5
arc: Write correct "eret" value during register collection

In collect_register() function of arc-linux-tdep.c, the "eret"
(exception return) register value was not being reported correctly.
This patch fixes that.

Background:
When asked for the "pc" value, we have to update the "eret" register
with GDB's STOP_PC.  The "eret" instructs the kernel code where to
jump back when an instruction has stopped due to a breakpoint.  This
is how collect_register() was doing so:

--------------8<--------------
  if (regnum == gdbarch_pc_regnum (gdbarch))
    regnum = ARC_ERET_REGNUM;
  regcache->raw_collect (regnum, buf + arc_linux_core_reg_offsets[regnum]);
-------------->8--------------

Root cause:
Although this is using the correct offset (ERET register's), it is also
changing the REGNUM itself.  Therefore, raw_collect (regnum, ...) is
not reading from "pc" anymore.

v2:
- Fix a copy/paste issue as rightfully addressed by Tom [1].

[1]
https://sourceware.org/pipermail/gdb-patches/2020-November/173208.html

gdb/ChangeLog:

* arc-linux-tdep.c (collect_register): Populate "eret" by
"pc" value from the regcache when asked for "pc" value.
gdb/ChangeLog
gdb/arc-linux-tdep.c
This page took 0.024055 seconds and 4 git commands to generate.