#include <asm/ptrace.h>
#include <xtensa-config.h>
+#include "arch/xtensa.h"
+#include "gdb_proc_service.h"
#include "xtensa-xtregs.c"
{ PTRACE_GETXTREGS, PTRACE_SETXTREGS, 0, XTENSA_ELF_XTREG_SIZE,
EXTENDED_REGS,
xtensa_fill_xtregset, xtensa_store_xtregset },
- { 0, 0, 0, -1, -1, NULL, NULL }
+ NULL_REGSET
};
#if XCHAL_HAVE_BE
#define XTENSA_BREAKPOINT {0x2d,0xf0}
#endif
-static const unsigned char xtensa_breakpoint[] = XTENSA_BREAKPOINT;
+static const gdb_byte xtensa_breakpoint[] = XTENSA_BREAKPOINT;
#define xtensa_breakpoint_len 2
+/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
+
+static const gdb_byte *
+xtensa_sw_breakpoint_from_kind (int kind, int *size)
+{
+ *size = xtensa_breakpoint_len;
+ return xtensa_breakpoint;
+}
+
static CORE_ADDR
xtensa_get_pc (struct regcache *regcache)
{
xtensa_breakpoint, xtensa_breakpoint_len) == 0;
}
+/* Called by libthread_db. */
+
+ps_err_e
+ps_get_thread_area (const struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+{
+ xtensa_elf_gregset_t regs;
+
+ if (ptrace (PTRACE_GETREGS, lwpid, NULL, ®s) != 0)
+ return PS_ERR;
+
+ /* IDX is the bias from the thread pointer to the beginning of the
+ thread descriptor. It has to be subtracted due to implementation
+ quirks in libthread_db. */
+ *base = (void *) ((char *) regs.threadptr - idx);
+
+ return PS_OK;
+}
+
static struct regsets_info xtensa_regsets_info =
{
xtensa_regsets, /* regsets */
NULL, /* fetch_register */
xtensa_get_pc,
xtensa_set_pc,
- xtensa_breakpoint,
- xtensa_breakpoint_len,
+ NULL, /* breakpoint_kind_from_pc */
+ xtensa_sw_breakpoint_from_kind,
NULL,
0,
xtensa_breakpoint_at,