mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-09 04:21:49 +08:00
d7146cda56
gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'breakpoint_at' linux target op into a method of linux_process_target. * linux-low.h (struct linux_target_ops): Remove the op. (class linux_process_target) <low_breakpoint_at>: Declare. Update the callers below: * linux-low.cc (linux_process_target::save_stop_reason) (linux_process_target::thread_still_has_status_pending) (linux_process_target::wait_1) * linux-x86-low.cc (class x86_target) <low_breakpoint_at>: Declare. (x86_breakpoint_at): Turn into... (x86_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-aarch64-low.cc (class aarch64_target) <low_breakpoint_at>: Declare. (aarch64_breakpoint_at): Turn into... (aarch64_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-arm-low.cc (class arm_target) <low_breakpoint_at>: Declare. (arm_target::low_breakpoint_at): Define. (the_low_target): Remove the op field. * linux-bfin-low.cc (class bfin_target) <low_breakpoint_at>: Declare. (bfin_breakpoint_at): Turn into... (bfin_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-cris-low.cc (class cris_target) <low_breakpoint_at>: Declare. (cris_breakpoint_at): Turn into... (cris_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-crisv32-low.cc (class crisv32_target) <low_breakpoint_at>: Declare. (crisv32_breakpoint_at): Turn into... (crisv32_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-ia64-low.cc (class ia64_target) <low_breakpoint_at>: Declare. (ia64_target::low_breakpoint_at): Define. * linux-m32r-low.cc (class m32r_target) <low_breakpoint_at>: Declare. (m32r_breakpoint_at): Turn into... (m32r_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-m68k-low.cc (class m68k_target) <low_breakpoint_at>: Declare. (m68k_breakpoint_at): Turn into... (m68k_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-mips-low.cc (class mips_target) <low_breakpoint_at>: Declare. (mips_breakpoint_at): Turn into... (mips_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-nios2-low.cc (class nios2_target) <low_breakpoint_at>: Declare. (nios2_breakpoint_at): Turn into... (nios2_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-ppc-low.cc (class ppc_target) <low_breakpoint_at>: Declare. (ppc_breakpoint_at): Turn into... (ppc_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-riscv-low.cc (class riscv_target) <low_breakpoint_at>: Declare. (riscv_breakpoint_at): Turn into... (riscv_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-s390-low.cc (class s390_target) <low_breakpoint_at>: Declare. (s390_breakpoint_at): Turn into... (s390_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-sh-low.cc (class sh_target) <low_breakpoint_at>: Declare. (sh_breakpoint_at): Turn into... (sh_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-sparc-low.cc (class sparc_target) <low_breakpoint_at>: Declare. (sparc_breakpoint_at): Turn into... (sparc_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-tic6x-low.cc (class tic6x_target) <low_breakpoint_at>: Declare. (tic6x_breakpoint_at): Turn into... (tic6x_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-tile-low.cc (class tile_target) <low_breakpoint_at>: Declare. (tile_breakpoint_at): Turn into... (tile_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field. * linux-xtensa-low.cc (class xtensa_target) <low_breakpoint_at>: Declare. (xtensa_breakpoint_at): Turn into... (xtensa_target::low_breakpoint_at): ...this. (the_low_target): Remove the op field.
173 lines
3.7 KiB
C++
173 lines
3.7 KiB
C++
/* GNU/Linux/CRIS specific low level interface, for the remote server for GDB.
|
|
Copyright (C) 1995-2020 Free Software Foundation, Inc.
|
|
|
|
This file is part of GDB.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
#include "server.h"
|
|
#include "linux-low.h"
|
|
#include "nat/gdb_ptrace.h"
|
|
|
|
/* Linux target op definitions for the CRIS architecture. */
|
|
|
|
class cris_target : public linux_process_target
|
|
{
|
|
public:
|
|
|
|
const regs_info *get_regs_info () override;
|
|
|
|
const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
|
|
|
|
protected:
|
|
|
|
void low_arch_setup () override;
|
|
|
|
bool low_cannot_fetch_register (int regno) override;
|
|
|
|
bool low_cannot_store_register (int regno) override;
|
|
|
|
bool low_supports_breakpoints () override;
|
|
|
|
CORE_ADDR low_get_pc (regcache *regcache) override;
|
|
|
|
void low_set_pc (regcache *regcache, CORE_ADDR newpc) override;
|
|
|
|
bool low_breakpoint_at (CORE_ADDR pc) override;
|
|
};
|
|
|
|
/* The singleton target ops object. */
|
|
|
|
static cris_target the_cris_target;
|
|
|
|
bool
|
|
cris_target::low_supports_breakpoints ()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
CORE_ADDR
|
|
cris_target::low_get_pc (regcache *regcache)
|
|
{
|
|
return linux_get_pc_32bit (regcache);
|
|
}
|
|
|
|
void
|
|
cris_target::low_set_pc (regcache *regcache, CORE_ADDR pc)
|
|
{
|
|
linux_set_pc_32bit (regcache, pc);
|
|
}
|
|
|
|
/* Defined in auto-generated file reg-cris.c. */
|
|
void init_registers_cris (void);
|
|
extern const struct target_desc *tdesc_cris;
|
|
|
|
/* CRISv10 */
|
|
#define cris_num_regs 32
|
|
|
|
/* Locations need to match <include/asm/arch/ptrace.h>. */
|
|
static int cris_regmap[] = {
|
|
15*4, 14*4, 13*4, 12*4,
|
|
11*4, 10*4, 9*4, 8*4,
|
|
7*4, 6*4, 5*4, 4*4,
|
|
3*4, 2*4, 23*4, 19*4,
|
|
|
|
-1, -1, -1, -1,
|
|
-1, 17*4, -1, 16*4,
|
|
-1, -1, -1, 18*4,
|
|
-1, 17*4, -1, -1
|
|
|
|
};
|
|
|
|
bool
|
|
cris_target::low_cannot_store_register (int regno)
|
|
{
|
|
if (cris_regmap[regno] == -1)
|
|
return true;
|
|
|
|
return (regno >= cris_num_regs);
|
|
}
|
|
|
|
bool
|
|
cris_target::low_cannot_fetch_register (int regno)
|
|
{
|
|
if (cris_regmap[regno] == -1)
|
|
return true;
|
|
|
|
return (regno >= cris_num_regs);
|
|
}
|
|
|
|
static const unsigned short cris_breakpoint = 0xe938;
|
|
#define cris_breakpoint_len 2
|
|
|
|
/* Implementation of target ops method "sw_breakpoint_from_kind". */
|
|
|
|
const gdb_byte *
|
|
cris_target::sw_breakpoint_from_kind (int kind, int *size)
|
|
{
|
|
*size = cris_breakpoint_len;
|
|
return (const gdb_byte *) &cris_breakpoint;
|
|
}
|
|
|
|
bool
|
|
cris_target::low_breakpoint_at (CORE_ADDR where)
|
|
{
|
|
unsigned short insn;
|
|
|
|
read_memory (where, (unsigned char *) &insn, cris_breakpoint_len);
|
|
if (insn == cris_breakpoint)
|
|
return true;
|
|
|
|
/* If necessary, recognize more trap instructions here. GDB only uses the
|
|
one. */
|
|
return false;
|
|
}
|
|
|
|
void
|
|
cris_target::low_arch_setup ()
|
|
{
|
|
current_process ()->tdesc = tdesc_cris;
|
|
}
|
|
|
|
static struct usrregs_info cris_usrregs_info =
|
|
{
|
|
cris_num_regs,
|
|
cris_regmap,
|
|
};
|
|
|
|
static struct regs_info myregs_info =
|
|
{
|
|
NULL, /* regset_bitmap */
|
|
&cris_usrregs_info,
|
|
};
|
|
|
|
const regs_info *
|
|
cris_target::get_regs_info ()
|
|
{
|
|
return &myregs_info;
|
|
}
|
|
|
|
struct linux_target_ops the_low_target = {
|
|
};
|
|
|
|
/* The linux target ops object. */
|
|
|
|
linux_process_target *the_linux_target = &the_cris_target;
|
|
|
|
void
|
|
initialize_low_arch (void)
|
|
{
|
|
init_registers_cris ();
|
|
}
|