[PATCH] arc: Write correct "eret" value during register collection
Tom Tromey
tom@tromey.com
Thu Nov 12 14:36:42 GMT 2020
>>>>> "Shahab" == Shahab Vahedi via Gdb-patches <gdb-patches@sourceware.org> writes:
Shahab> * arc-linux-tdep.c (collect_register): Use "eret" value while
Shahab> still writing to "pc" register cache.
Shahab> collect_register (const struct regcache *regcache, struct gdbarch *gdbarch,
Shahab> int regnum, gdb_byte *buf)
Shahab> {
Shahab> + int offset;
Shahab> +
Shahab> /* Skip non-existing registers. */
Shahab> - if ((arc_linux_core_reg_offsets[regnum] == ARC_OFFSET_NO_REGISTER))
Shahab> + if (arc_linux_core_reg_offsets[regnum] == ARC_OFFSET_NO_REGISTER)
Shahab> return;
Shahab> + else
Shahab> + offset = arc_linux_core_reg_offsets[ARC_ERET_REGNUM];
I would drop the "else" here.
I didn't understand this patch. It unconditionally sets 'offset' to the
offset of ARC_ERET_REGNUM. But surely that can't be correct?
The assignment above does this, and so does...
Shahab> if (regnum == gdbarch_pc_regnum (gdbarch))
Shahab> - regnum = ARC_ERET_REGNUM;
Shahab> - regcache->raw_collect (regnum, buf + arc_linux_core_reg_offsets[regnum]);
Shahab> + offset = arc_linux_core_reg_offsets[ARC_ERET_REGNUM];
... this one.
Tom
More information about the Gdb-patches
mailing list