diff options
author | Andreas Schwab <schwab@linux-m68k.org> | 2004-11-21 03:09:39 +0000 |
---|---|---|
committer | Andreas Schwab <schwab@linux-m68k.org> | 2004-11-21 03:09:39 +0000 |
commit | db1d3e1b9706b64e129855a0e12eba74ca16befa (patch) | |
tree | 0831b2d63907f4577988479fd30260eaeca58ea0 /gdb/gdbserver | |
parent | fefa18880beb0d6e2de40563fb6827ec019ee18b (diff) | |
download | gdb-db1d3e1b9706b64e129855a0e12eba74ca16befa.zip gdb-db1d3e1b9706b64e129855a0e12eba74ca16befa.tar.gz gdb-db1d3e1b9706b64e129855a0e12eba74ca16befa.tar.bz2 |
* linux-m68k-low.c (m68k_num_gregs): Define.
(m68k_fill_gregset, m68k_store_gregset, m68k_fill_fpregset)
(m68k_store_fpregset, target_regsets) [HAVE_LINUX_REGSETS]: New.
(m68k_breakpoint, m68k_breakpoint_len, m68k_get_pc, m68k_set_pc)
(m68k_breakpoint_at): New. Add to the_low_target.
* configure.srv (m68*-*-linux*): Set srv_linux_regsets and
srv_linux_thread_db to yes.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 11 | ||||
-rw-r--r-- | gdb/gdbserver/configure.srv | 2 | ||||
-rw-r--r-- | gdb/gdbserver/linux-m68k-low.c | 97 |
3 files changed, 109 insertions, 1 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 8343916..c98b951 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,14 @@ +2004-11-21 Andreas Schwab <schwab@suse.de> + + * linux-m68k-low.c (m68k_num_gregs): Define. + (m68k_fill_gregset, m68k_store_gregset, m68k_fill_fpregset) + (m68k_store_fpregset, target_regsets) [HAVE_LINUX_REGSETS]: New. + (m68k_breakpoint, m68k_breakpoint_len, m68k_get_pc, m68k_set_pc) + (m68k_breakpoint_at): New. Add to the_low_target. + + * configure.srv (m68*-*-linux*): Set srv_linux_regsets and + srv_linux_thread_db to yes. + 2004-10-20 Joel Brobecker <brobecker@gnat.com> * linux-x86-64-low.c (ARCH_SET_GS): Add definition if missing. diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv index 251dd6b..991cb05 100644 --- a/gdb/gdbserver/configure.srv +++ b/gdb/gdbserver/configure.srv @@ -36,6 +36,8 @@ case "${target}" in m68*-*-linux*) srv_regobj=reg-m68k.o srv_tgtobj="linux-low.o linux-m68k-low.o" srv_linux_usrregs=yes + srv_linux_regsets=yes + srv_linux_thread_db=yes ;; mips*-*-linux*) srv_regobj=reg-mips.o srv_tgtobj="linux-low.o linux-mips-low.o" diff --git a/gdb/gdbserver/linux-m68k-low.c b/gdb/gdbserver/linux-m68k-low.c index b49a8c9..c81df93 100644 --- a/gdb/gdbserver/linux-m68k-low.c +++ b/gdb/gdbserver/linux-m68k-low.c @@ -1,5 +1,5 @@ /* GNU/Linux/m68k specific low level interface, for the remote server for GDB. - Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -27,6 +27,7 @@ #endif #define m68k_num_regs 29 +#define m68k_num_gregs 18 /* This table must line up with REGISTER_NAMES in tm-m68k.h */ static int m68k_regmap[] = @@ -64,9 +65,103 @@ m68k_cannot_fetch_register (int regno) return (regno >= m68k_num_regs); } +#ifdef HAVE_LINUX_REGSETS +#include <sys/procfs.h> +#include <sys/ptrace.h> + +static void +m68k_fill_gregset (void *buf) +{ + int i; + + for (i = 0; i < m68k_num_gregs; i++) + collect_register (i, (char *) buf + m68k_regmap[i]); +} + +static void +m68k_store_gregset (const void *buf) +{ + int i; + + for (i = 0; i < m68k_num_gregs; i++) + supply_register (i, (const char *) buf + m68k_regmap[i]); +} + +static void +m68k_fill_fpregset (void *buf) +{ + int i; + + for (i = m68k_num_gregs; i < m68k_num_regs; i++) + collect_register (i, ((char *) buf + + (m68k_regmap[i] - m68k_regmap[m68k_num_gregs]))); +} + +static void +m68k_store_fpregset (const void *buf) +{ + int i; + + for (i = m68k_num_gregs; i < m68k_num_regs; i++) + supply_register (i, ((const char *) buf + + (m68k_regmap[i] - m68k_regmap[m68k_num_gregs]))); +} + + +struct regset_info target_regsets[] = { + { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t), + GENERAL_REGS, + m68k_fill_gregset, m68k_store_gregset }, + { PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (elf_fpregset_t), + FP_REGS, + m68k_fill_fpregset, m68k_store_fpregset }, + { 0, 0, -1, -1, NULL, NULL } +}; + +#endif /* HAVE_LINUX_REGSETS */ + +static const char m68k_breakpoint[] = { 0x4E, 0x4F }; +#define m68k_breakpoint_len 2 + +static CORE_ADDR +m68k_get_pc () +{ + unsigned long pc; + + collect_register_by_name ("pc", &pc); + return pc; +} + +static void +m68k_set_pc (CORE_ADDR value) +{ + unsigned long newpc = value; + + supply_register_by_name ("pc", &newpc); +} + +static int +m68k_breakpoint_at (CORE_ADDR pc) +{ + unsigned char c[2]; + + read_inferior_memory (pc, c, 2); + if (c[0] == 0x4E && c[1] == 0x4F) + return 1; + + return 0; +} + struct linux_target_ops the_low_target = { m68k_num_regs, m68k_regmap, m68k_cannot_fetch_register, m68k_cannot_store_register, + m68k_get_pc, + m68k_set_pc, + m68k_breakpoint, + m68k_breakpoint_len, + NULL, + 2, + m68k_breakpoint_at, }; |