+2020-11-12  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-12  Tom Tromey  <tom@tromey.com>
 
        PR rust/26799:
 
 collect_register (const struct regcache *regcache, struct gdbarch *gdbarch,
                  int regnum, gdb_byte *buf)
 {
+  int offset;
+
   /* 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;
 
   /* The address where the execution has stopped is in pseudo-register
      the program will continue at the address after the current instruction.
      */
   if (regnum == gdbarch_pc_regnum (gdbarch))
-    regnum = ARC_ERET_REGNUM;
-  regcache->raw_collect (regnum, buf + arc_linux_core_reg_offsets[regnum]);
+    offset = arc_linux_core_reg_offsets[ARC_ERET_REGNUM];
+  else
+    offset = arc_linux_core_reg_offsets[regnum];
+  regcache->raw_collect (regnum, buf + offset);
 }
 
 void