forked from Imagelibrary/binutils-gdb
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.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2020-12-04 Shahab Vahedi <shahab@synopsys.com>
|
||||||
|
|
||||||
|
* arc-linux-tdep.c (collect_register): Populate "eret" by
|
||||||
|
"pc" value from the regcache when asked for "pc" value.
|
||||||
|
|
||||||
2020-11-29 Hannes Domani <ssbssa@yahoo.de>
|
2020-11-29 Hannes Domani <ssbssa@yahoo.de>
|
||||||
|
|
||||||
PR tui/26973
|
PR tui/26973
|
||||||
|
|||||||
@@ -319,8 +319,10 @@ static void
|
|||||||
collect_register (const struct regcache *regcache, struct gdbarch *gdbarch,
|
collect_register (const struct regcache *regcache, struct gdbarch *gdbarch,
|
||||||
int regnum, gdb_byte *buf)
|
int regnum, gdb_byte *buf)
|
||||||
{
|
{
|
||||||
|
int offset;
|
||||||
|
|
||||||
/* Skip non-existing registers. */
|
/* Skip non-existing registers. */
|
||||||
if ((arc_linux_core_reg_offsets[regnum] == ARC_OFFSET_NO_REGISTER))
|
if (arc_linux_core_reg_offsets[regnum] == ARC_OFFSET_NO_REGISTER)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* The address where the execution has stopped is in pseudo-register
|
/* The address where the execution has stopped is in pseudo-register
|
||||||
@@ -332,8 +334,10 @@ collect_register (const struct regcache *regcache, struct gdbarch *gdbarch,
|
|||||||
the program will continue at the address after the current instruction.
|
the program will continue at the address after the current instruction.
|
||||||
*/
|
*/
|
||||||
if (regnum == gdbarch_pc_regnum (gdbarch))
|
if (regnum == gdbarch_pc_regnum (gdbarch))
|
||||||
regnum = ARC_ERET_REGNUM;
|
offset = arc_linux_core_reg_offsets[ARC_ERET_REGNUM];
|
||||||
regcache->raw_collect (regnum, buf + arc_linux_core_reg_offsets[regnum]);
|
else
|
||||||
|
offset = arc_linux_core_reg_offsets[regnum];
|
||||||
|
regcache->raw_collect (regnum, buf + offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user