+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ CORE_ADDR tocp;
+
+ if (execution_direction == EXEC_REVERSE)
+ {
+ /* If executing in reverse, r2 will have been stored to the stack. */
+ CORE_ADDR sp = get_frame_register_unsigned (frame,
+ tdep->ppc_gp0_regnum + 1);
+ unsigned int sp_off = tdep->elf_abi == POWERPC_ELF_V1 ? 40 : 24;
+ tocp = read_memory_unsigned_integer (sp + sp_off, 8, byte_order);
+ }
+ else
+ tocp = get_frame_register_unsigned (frame, tdep->ppc_gp0_regnum + 2);
+