+#ifdef GET_LONGJMP_TARGET
+/* Figure out where the longjmp will land. We expect that we have just entered
+ longjmp and haven't yet setup the stack frame, so the args are still in the
+ output regs. lr2 (LR2_REGNUM) points at the jmp_buf structure from which we
+ extract the pc (JB_PC) that we will land at. The pc is copied into ADDR.
+ This routine returns true on success */
+
+int
+get_longjmp_target (CORE_ADDR *pc)
+{
+ CORE_ADDR jb_addr;
+ char buf[sizeof (CORE_ADDR)];
+
+ jb_addr = read_register (LR2_REGNUM);
+
+ if (target_read_memory (jb_addr + JB_PC * JB_ELEMENT_SIZE, (char *) buf,
+ sizeof (CORE_ADDR)))
+ return 0;
+
+ *pc = extract_address ((PTR) buf, sizeof (CORE_ADDR));
+ return 1;
+}
+#endif /* GET_LONGJMP_TARGET */
+