+2016-10-12 Anton Kolesov <anton.kolesov@synopsys.com>
+
+ * arc-tdep.h (struct gdbarch_tdep) <jb_pc>: New field.
+ * arc-tdep.c (arc_get_longjmp_target): New function.
+ (arc_gdbarch_init): Set get_longjmp_target if jb_pc is non-negative.
+ (arc_dump_tdep): Print jb_pc.
+
2016-10-12 Anton Kolesov <anton.kolesov@synopsys.com>
* arc-tdep.h (struct gdbarch_tdep): New.
error (_("arc_store_return_value: type length too large."));
}
+/* Implement the "get_longjmp_target" gdbarch method. */
+
+static int
+arc_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
+{
+ if (arc_debug)
+ debug_printf ("arc: get_longjmp_target\n");
+
+ struct gdbarch *gdbarch = get_frame_arch (frame);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ int pc_offset = tdep->jb_pc * ARC_REGISTER_SIZE;
+ gdb_byte buf[ARC_REGISTER_SIZE];
+ CORE_ADDR jb_addr = get_frame_register_unsigned (frame, ARC_FIRST_ARG_REGNUM);
+
+ if (target_read_memory (jb_addr + pc_offset, buf, ARC_REGISTER_SIZE))
+ return 0; /* Failed to read from memory. */
+
+ *pc = extract_unsigned_integer (buf, ARC_REGISTER_SIZE,
+ gdbarch_byte_order (gdbarch));
+ return 1;
+}
+
/* Implement the "return_value" gdbarch method. */
static enum return_value_convention
/* Allocate the ARC-private target-dependent information structure, and the
GDB target-independent information structure. */
struct gdbarch_tdep *tdep = XCNEW (struct gdbarch_tdep);
+ tdep->jb_pc = -1; /* No longjmp support by default. */
struct gdbarch *gdbarch = gdbarch_alloc (&info, tdep);
/* Data types. */
It can override functions set earlier. */
gdbarch_init_osabi (info, gdbarch);
+ if (tdep->jb_pc >= 0)
+ set_gdbarch_get_longjmp_target (gdbarch, arc_get_longjmp_target);
+
tdesc_use_registers (gdbarch, tdesc, tdesc_data);
return gdbarch;
static void
arc_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
- /* Empty for now. */
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ fprintf_unfiltered (file, "arc_dump_tdep: jb_pc = %i\n", tdep->jb_pc);
}
/* Suppress warning from -Wmissing-prototypes. */