2015-08-04 21:34:14 +08:00
|
|
|
/* Copyright (C) 1995-2015 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 "arch/arm.h"
|
|
|
|
#include "linux-low.h"
|
|
|
|
#include "linux-aarch32-low.h"
|
|
|
|
|
|
|
|
#include <sys/ptrace.h>
|
|
|
|
/* Don't include elf.h if linux/elf.h got included by gdb_proc_service.h.
|
|
|
|
On Bionic elf.h and linux/elf.h have conflicting definitions. */
|
|
|
|
#ifndef ELFMAG0
|
|
|
|
#include <elf.h>
|
|
|
|
#endif
|
|
|
|
|
2015-08-12 03:28:19 +08:00
|
|
|
/* Some older versions of GNU/Linux and Android do not define
|
|
|
|
the following macros. */
|
|
|
|
#ifndef NT_ARM_VFP
|
|
|
|
#define NT_ARM_VFP 0x400
|
|
|
|
#endif
|
|
|
|
|
2015-08-04 21:34:14 +08:00
|
|
|
/* Collect GP registers from REGCACHE to buffer BUF. */
|
|
|
|
|
|
|
|
void
|
|
|
|
arm_fill_gregset (struct regcache *regcache, void *buf)
|
|
|
|
{
|
|
|
|
int i;
|
2015-11-04 02:33:13 +08:00
|
|
|
uint32_t *regs = (uint32_t *) buf;
|
2015-08-04 21:34:14 +08:00
|
|
|
|
|
|
|
for (i = ARM_A1_REGNUM; i <= ARM_PC_REGNUM; i++)
|
|
|
|
collect_register (regcache, i, ®s[i]);
|
|
|
|
|
|
|
|
collect_register (regcache, ARM_PS_REGNUM, ®s[16]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Supply GP registers contents, stored in BUF, to REGCACHE. */
|
|
|
|
|
|
|
|
void
|
|
|
|
arm_store_gregset (struct regcache *regcache, const void *buf)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
char zerobuf[8];
|
2015-11-04 02:33:13 +08:00
|
|
|
const uint32_t *regs = (const uint32_t *) buf;
|
2015-08-04 21:34:14 +08:00
|
|
|
|
|
|
|
memset (zerobuf, 0, 8);
|
|
|
|
for (i = ARM_A1_REGNUM; i <= ARM_PC_REGNUM; i++)
|
|
|
|
supply_register (regcache, i, ®s[i]);
|
|
|
|
|
|
|
|
for (; i < ARM_PS_REGNUM; i++)
|
|
|
|
supply_register (regcache, i, zerobuf);
|
|
|
|
|
|
|
|
supply_register (regcache, ARM_PS_REGNUM, ®s[16]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Collect NUM number of VFP registers from REGCACHE to buffer BUF. */
|
|
|
|
|
|
|
|
void
|
|
|
|
arm_fill_vfpregset_num (struct regcache *regcache, void *buf, int num)
|
|
|
|
{
|
|
|
|
int i, base;
|
|
|
|
|
|
|
|
gdb_assert (num == 16 || num == 32);
|
|
|
|
|
|
|
|
base = find_regno (regcache->tdesc, "d0");
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
collect_register (regcache, base + i, (char *) buf + i * 8);
|
|
|
|
|
|
|
|
collect_register_by_name (regcache, "fpscr", (char *) buf + 32 * 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Supply NUM number of VFP registers contents, stored in BUF, to
|
|
|
|
REGCACHE. */
|
|
|
|
|
|
|
|
void
|
|
|
|
arm_store_vfpregset_num (struct regcache *regcache, const void *buf, int num)
|
|
|
|
{
|
|
|
|
int i, base;
|
|
|
|
|
|
|
|
gdb_assert (num == 16 || num == 32);
|
|
|
|
|
|
|
|
base = find_regno (regcache->tdesc, "d0");
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
supply_register (regcache, base + i, (char *) buf + i * 8);
|
|
|
|
|
|
|
|
supply_register_by_name (regcache, "fpscr", (char *) buf + 32 * 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
arm_fill_vfpregset (struct regcache *regcache, void *buf)
|
|
|
|
{
|
|
|
|
arm_fill_vfpregset_num (regcache, buf, 32);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
arm_store_vfpregset (struct regcache *regcache, const void *buf)
|
|
|
|
{
|
|
|
|
arm_store_vfpregset_num (regcache, buf, 32);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Register sets with using PTRACE_GETREGSET. */
|
|
|
|
|
|
|
|
static struct regset_info aarch32_regsets[] = {
|
|
|
|
{ PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS, 18 * 4,
|
|
|
|
GENERAL_REGS,
|
|
|
|
arm_fill_gregset, arm_store_gregset },
|
|
|
|
{ PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_VFP, 32 * 8 + 4,
|
|
|
|
EXTENDED_REGS,
|
|
|
|
arm_fill_vfpregset, arm_store_vfpregset },
|
2015-11-04 02:33:12 +08:00
|
|
|
NULL_REGSET
|
2015-08-04 21:34:14 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct regsets_info aarch32_regsets_info =
|
|
|
|
{
|
|
|
|
aarch32_regsets, /* regsets */
|
|
|
|
0, /* num_regsets */
|
|
|
|
NULL, /* disabled_regsets */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct regs_info regs_info_aarch32 =
|
|
|
|
{
|
|
|
|
NULL, /* regset_bitmap */
|
|
|
|
NULL, /* usrregs */
|
|
|
|
&aarch32_regsets_info
|
|
|
|
};
|
|
|
|
|
Support Z0 packet in AArch64 multi-arch debugging
In commit 6085d6f6, Z0 packet is disabled in aarch64 GDBserver if
the inferior is 32-bit or there may be multiple inferiors, because
Z0 packet isn't supported for arm then. Recently, Z0 packet
is supported in arm target, so we don't have such limitation in
aarch64 GDBserver, that is to say, aarch64 GDBserver can use Z0
packet in multi-arch/multi-inferior debugging when the inferior's
arch is arm.
Part of this patch is to revert 6085d6f6, and the rest of the patch
is to move some breakpoint related arm_* functions into
linux-aarch32-low.c in order to share them between arm and aarch64.
This patch is regression tested on aarch64-linux for debugging both
aarch64 programs and arm programs respectively.
gdb/gdbserver:
2015-12-07 Yao Qi <yao.qi@linaro.org>
* configure.srv: Append arm.o to srv_tgtobj for
aarch64*-*-linux* target.
* linux-aarch32-low.c (arm_abi_breakpoint): New macro. Moved
from linux-arm-low.c.
(arm_eabi_breakpoint, arm_breakpoint): Likewise.
(arm_breakpoint_len, thumb_breakpoint): Likewise.
(thumb_breakpoint_len, thumb2_breakpoint): Likewise.
(thumb2_breakpoint_len): Likewise.
(arm_is_thumb_mode, arm_breakpoint_at): Likewise.
(arm_breakpoint_kinds): Likewise.
(arm_breakpoint_kind_from_pc): Likewise.
(arm_sw_breakpoint_from_kind): Likewise.
(arm_breakpoint_kind_from_current_state): Likewise.
* linux-aarch32-low.h (arm_breakpoint_kind_from_pc): Declare.
(arm_sw_breakpoint_from_kind): Declare.
(arm_breakpoint_kind_from_current_state): Declare.
(arm_breakpoint_at): Declare.
* linux-aarch64-low.c (aarch64_sw_breakpoint_from_kind): Call
arm_sw_breakpoint_from_kind if process is 32-bit.
(aarch64_breakpoint_kind_from_pc): New function.
(aarch64_breakpoint_kind_from_current_state): New function.
(the_low_target): Initialize fields breakpoint_kind_from_pc
and breakpoint_kind_from_current_state.
* linux-arm-low.c (arm_breakpoint_kinds): Move to
linux-aarch32-low.c.
(arm_abi_breakpoint, arm_eabi_breakpoint): Likewise.
(arm_breakpoint, arm_breakpoint_len): Likewise.
(thumb_breakpoint, thumb_breakpoint_len): Likewise.
(thumb2_breakpoint, thumb2_breakpoint_len): Likewise.
(arm_is_thumb_mode): Likewise.
(arm_breakpoint_at): Likewise.
(arm_breakpoint_kind_from_pc): Likewise.
(arm_sw_breakpoint_from_kind): Likewise.
(arm_breakpoint_kind_from_current_state): Likewise.
Revert:
2015-08-04 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (aarch64_supports_z_point_type): Return
0 for Z_PACKET_SW_BP if it may be used in multi-arch debugging.
* server.c (extended_protocol): Remove "static".
* server.h (extended_protocol): Declare it.
2015-12-07 23:56:31 +08:00
|
|
|
/* Returns 1 if the current instruction set is thumb, 0 otherwise. */
|
|
|
|
|
Support software single step on ARM in GDBServer
This patch teaches GDBServer how to software single step on ARM
linux by sharing code with GDB.
The arm_get_next_pcs function in GDB is now shared with GDBServer. So
that GDBServer can use the function to return the possible addresses of
the next PC.
A proper shared context was also needed so that we could share the code,
this context is described in the arm_get_next_pcs structure.
Testing :
No regressions, tested on ubuntu 14.04 ARMv7 and x86.
With gdbserver-{native,extended} / { -marm -mthumb }
gdb/ChangeLog:
* Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o,
arm-linux.o.
(ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c
(arm-linux.o): New rule.
(arm-get-next-pcs.o): New rule.
* arch/arm-get-next-pcs.c: New file.
* arch/arm-get-next-pcs.h: New file.
* arch/arm-linux.h: New file.
* arch/arm-linux.c: New file.
* arm.c: Include common-regcache.c.
(thumb_advance_itstate): Moved from arm-tdep.c.
(arm_instruction_changes_pc): Likewise.
(thumb_instruction_changes_pc): Likewise.
(thumb2_instruction_changes_pc): Likewise.
(shifted_reg_val): Likewise.
* arm.h (submask): Move macro from arm-tdep.h
(bit): Likewise.
(bits): Likewise.
(sbits): Likewise.
(BranchDest): Likewise.
(thumb_advance_itstate): Moved declaration from arm-tdep.h
(arm_instruction_changes_pc): Likewise.
(thumb_instruction_changes_pc): Likewise.
(thumb2_instruction_changes_pc): Likewise.
(shifted_reg_val): Likewise.
* arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h
arch/arm-linux.h.
(arm_linux_get_next_pcs_ops): New struct.
(ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT,
ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT,
ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack
layout defines to arch/arm-linux.h.
(arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c.
(arm_linux_software_single_step): Adjust for arm_get_next_pcs
implementation.
* arm-tdep.c: Include arch/arm-get-next-pcs.h.
(arm_get_next_pcs_ops): New struct.
(submask): Move macro to arm.h.
(bit): Likewise.
(bits): Likewise.
(sbits): Likewise.
(BranchDest): Likewise.
(thumb_instruction_changes_pc): Move to arm.c
(thumb2_instruction_changes_pc): Likewise.
(arm_instruction_changes_pc): Likewise.
(shifted_reg_val): Likewise.
(thumb_advance_itstate): Likewise.
(thumb_get_next_pc_raw): Move to arm-get-next-pcs.c.
(arm_get_next_pc_raw): Likewise.
(arm_get_next_pc): Likewise.
(thumb_deal_with_atomic_sequence_raw): Likewise.
(arm_deal_with_atomic_sequence_raw): Likewise.
(arm_deal_with_atomic_sequence): Likewise.
(arm_get_next_pcs_read_memory_unsigned_integer): New function.
(arm_get_next_pcs_addr_bits_remove): Likewise.
(arm_get_next_pcs_syscall_next_pc): Likewise.
(arm_get_next_pcs_is_thumb): Likewise.
(arm_software_single_step): Adjust for arm_get_next_pcs
implementation.
* arm-tdep.h: (arm_get_next_pc): Remove declaration.
(arm_get_next_pcs_read_memory_unsigned_integer):
New declaration.
(arm_get_next_pcs_addr_bits_remove): Likewise.
(arm_get_next_pcs_syscall_next_pc): Likewise.
(arm_get_next_pcs_is_thumb): Likewise.
(arm_deal_with_atomic_sequence: Remove declaration.
* common/gdb_vecs.h: Add CORE_ADDR vector definition.
* configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o,
arm-linux.o.
(arm*-wince-pe): Add arm-get-next-pcs.o.
(arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o,
arm-get-next-pcs.o
(arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o.
(arm*-*-openbsd*): Likewise.
(arm*-*-symbianelf*): Likewise.
(arm*-*-*): Likewise.
* symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h.
gdb/gdbserver/ChangeLog:
* Makefile.in (SFILES): Append arch/arm-linux.c,
arch/arm-get-next-pcs.c.
(arm-linux.o): New rule.
(arm-get-next-pcs.o): New rule.
* configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o,
arm-linux.o.
* linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved
to linux-aarch32-low.c.
(arm_eabi_breakpoint, arm_breakpoint): Likewise.
(arm_breakpoint_len, thumb_breakpoint): Likewise.
(thumb_breakpoint_len, thumb2_breakpoint): Likewise.
(thumb2_breakpoint_len): Likewise.
(arm_is_thumb_mode): Make non-static.
* linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved
from linux-aarch32-low.c.
(arm_eabi_breakpoint, arm_breakpoint): Likewise.
(arm_breakpoint_len, thumb_breakpoint): Likewise.
(thumb_breakpoint_len, thumb2_breakpoint): Likewise.
(thumb2_breakpoint_len): Likewise.
(arm_is_thumb_mode): New declaration.
* linux-arm-low.c: Include arch/arm-linux.h
aarch/arm-get-next-pcs.h, sys/syscall.h.
(get_next_pcs_ops): New struct.
(get_next_pcs_addr_bits_remove): New function.
(get_next_pcs_is_thumb): New function.
(get_next_pcs_read_memory_unsigned_integer): Likewise.
(arm_sigreturn_next_pc): Likewise.
(get_next_pcs_syscall_next_pc): Likewise.
(arm_gdbserver_get_next_pcs): Likewise.
(struct linux_target_ops) <arm_gdbserver_get_next_pcs>:
Initialize.
* linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h.
* server.h: Include gdb_vecs.h.
2015-12-19 00:33:59 +08:00
|
|
|
int
|
Support Z0 packet in AArch64 multi-arch debugging
In commit 6085d6f6, Z0 packet is disabled in aarch64 GDBserver if
the inferior is 32-bit or there may be multiple inferiors, because
Z0 packet isn't supported for arm then. Recently, Z0 packet
is supported in arm target, so we don't have such limitation in
aarch64 GDBserver, that is to say, aarch64 GDBserver can use Z0
packet in multi-arch/multi-inferior debugging when the inferior's
arch is arm.
Part of this patch is to revert 6085d6f6, and the rest of the patch
is to move some breakpoint related arm_* functions into
linux-aarch32-low.c in order to share them between arm and aarch64.
This patch is regression tested on aarch64-linux for debugging both
aarch64 programs and arm programs respectively.
gdb/gdbserver:
2015-12-07 Yao Qi <yao.qi@linaro.org>
* configure.srv: Append arm.o to srv_tgtobj for
aarch64*-*-linux* target.
* linux-aarch32-low.c (arm_abi_breakpoint): New macro. Moved
from linux-arm-low.c.
(arm_eabi_breakpoint, arm_breakpoint): Likewise.
(arm_breakpoint_len, thumb_breakpoint): Likewise.
(thumb_breakpoint_len, thumb2_breakpoint): Likewise.
(thumb2_breakpoint_len): Likewise.
(arm_is_thumb_mode, arm_breakpoint_at): Likewise.
(arm_breakpoint_kinds): Likewise.
(arm_breakpoint_kind_from_pc): Likewise.
(arm_sw_breakpoint_from_kind): Likewise.
(arm_breakpoint_kind_from_current_state): Likewise.
* linux-aarch32-low.h (arm_breakpoint_kind_from_pc): Declare.
(arm_sw_breakpoint_from_kind): Declare.
(arm_breakpoint_kind_from_current_state): Declare.
(arm_breakpoint_at): Declare.
* linux-aarch64-low.c (aarch64_sw_breakpoint_from_kind): Call
arm_sw_breakpoint_from_kind if process is 32-bit.
(aarch64_breakpoint_kind_from_pc): New function.
(aarch64_breakpoint_kind_from_current_state): New function.
(the_low_target): Initialize fields breakpoint_kind_from_pc
and breakpoint_kind_from_current_state.
* linux-arm-low.c (arm_breakpoint_kinds): Move to
linux-aarch32-low.c.
(arm_abi_breakpoint, arm_eabi_breakpoint): Likewise.
(arm_breakpoint, arm_breakpoint_len): Likewise.
(thumb_breakpoint, thumb_breakpoint_len): Likewise.
(thumb2_breakpoint, thumb2_breakpoint_len): Likewise.
(arm_is_thumb_mode): Likewise.
(arm_breakpoint_at): Likewise.
(arm_breakpoint_kind_from_pc): Likewise.
(arm_sw_breakpoint_from_kind): Likewise.
(arm_breakpoint_kind_from_current_state): Likewise.
Revert:
2015-08-04 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (aarch64_supports_z_point_type): Return
0 for Z_PACKET_SW_BP if it may be used in multi-arch debugging.
* server.c (extended_protocol): Remove "static".
* server.h (extended_protocol): Declare it.
2015-12-07 23:56:31 +08:00
|
|
|
arm_is_thumb_mode (void)
|
|
|
|
{
|
|
|
|
struct regcache *regcache = get_thread_regcache (current_thread, 1);
|
|
|
|
unsigned long cpsr;
|
|
|
|
|
|
|
|
collect_register_by_name (regcache, "cpsr", &cpsr);
|
|
|
|
|
|
|
|
if (cpsr & 0x20)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Returns 1 if there is a software breakpoint at location. */
|
|
|
|
|
|
|
|
int
|
|
|
|
arm_breakpoint_at (CORE_ADDR where)
|
|
|
|
{
|
|
|
|
if (arm_is_thumb_mode ())
|
|
|
|
{
|
|
|
|
/* Thumb mode. */
|
|
|
|
unsigned short insn;
|
|
|
|
|
|
|
|
(*the_target->read_memory) (where, (unsigned char *) &insn, 2);
|
|
|
|
if (insn == thumb_breakpoint)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (insn == thumb2_breakpoint[0])
|
|
|
|
{
|
|
|
|
(*the_target->read_memory) (where + 2, (unsigned char *) &insn, 2);
|
|
|
|
if (insn == thumb2_breakpoint[1])
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* ARM mode. */
|
|
|
|
unsigned long insn;
|
|
|
|
|
|
|
|
(*the_target->read_memory) (where, (unsigned char *) &insn, 4);
|
|
|
|
if (insn == arm_abi_breakpoint)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (insn == arm_eabi_breakpoint)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Enum describing the different kinds of breakpoints. */
|
|
|
|
enum arm_breakpoint_kinds
|
|
|
|
{
|
|
|
|
ARM_BP_KIND_THUMB = 2,
|
|
|
|
ARM_BP_KIND_THUMB2 = 3,
|
|
|
|
ARM_BP_KIND_ARM = 4,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Implementation of linux_target_ops method "breakpoint_kind_from_pc".
|
|
|
|
|
|
|
|
Determine the type and size of breakpoint to insert at PCPTR. Uses the
|
|
|
|
program counter value to determine whether a 16-bit or 32-bit breakpoint
|
|
|
|
should be used. It returns the breakpoint's kind, and adjusts the program
|
|
|
|
counter (if necessary) to point to the actual memory location where the
|
|
|
|
breakpoint should be inserted. */
|
|
|
|
|
|
|
|
int
|
|
|
|
arm_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
|
|
|
|
{
|
|
|
|
if (IS_THUMB_ADDR (*pcptr))
|
|
|
|
{
|
|
|
|
gdb_byte buf[2];
|
|
|
|
|
|
|
|
*pcptr = UNMAKE_THUMB_ADDR (*pcptr);
|
|
|
|
|
|
|
|
/* Check whether we are replacing a thumb2 32-bit instruction. */
|
|
|
|
if ((*the_target->read_memory) (*pcptr, buf, 2) == 0)
|
|
|
|
{
|
|
|
|
unsigned short inst1 = 0;
|
|
|
|
|
|
|
|
(*the_target->read_memory) (*pcptr, (gdb_byte *) &inst1, 2);
|
|
|
|
if (thumb_insn_size (inst1) == 4)
|
|
|
|
return ARM_BP_KIND_THUMB2;
|
|
|
|
}
|
|
|
|
return ARM_BP_KIND_THUMB;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return ARM_BP_KIND_ARM;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Implementation of the linux_target_ops method "sw_breakpoint_from_kind". */
|
|
|
|
|
|
|
|
const gdb_byte *
|
|
|
|
arm_sw_breakpoint_from_kind (int kind , int *size)
|
|
|
|
{
|
|
|
|
*size = arm_breakpoint_len;
|
|
|
|
/* Define an ARM-mode breakpoint; we only set breakpoints in the C
|
|
|
|
library, which is most likely to be ARM. If the kernel supports
|
|
|
|
clone events, we will never insert a breakpoint, so even a Thumb
|
|
|
|
C library will work; so will mixing EABI/non-EABI gdbserver and
|
|
|
|
application. */
|
|
|
|
switch (kind)
|
|
|
|
{
|
|
|
|
case ARM_BP_KIND_THUMB:
|
|
|
|
*size = thumb_breakpoint_len;
|
|
|
|
return (gdb_byte *) &thumb_breakpoint;
|
|
|
|
case ARM_BP_KIND_THUMB2:
|
|
|
|
*size = thumb2_breakpoint_len;
|
|
|
|
return (gdb_byte *) &thumb2_breakpoint;
|
|
|
|
case ARM_BP_KIND_ARM:
|
|
|
|
*size = arm_breakpoint_len;
|
|
|
|
return (const gdb_byte *) &arm_breakpoint;
|
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Implementation of the linux_target_ops method
|
|
|
|
"breakpoint_kind_from_current_state". */
|
|
|
|
|
|
|
|
int
|
|
|
|
arm_breakpoint_kind_from_current_state (CORE_ADDR *pcptr)
|
|
|
|
{
|
|
|
|
if (arm_is_thumb_mode ())
|
|
|
|
{
|
|
|
|
*pcptr = MAKE_THUMB_ADDR (*pcptr);
|
|
|
|
return arm_breakpoint_kind_from_pc (pcptr);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return arm_breakpoint_kind_from_pc (pcptr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-04 21:34:14 +08:00
|
|
|
void
|
|
|
|
initialize_low_arch_aarch32 (void)
|
|
|
|
{
|
|
|
|
init_registers_arm_with_neon ();
|
|
|
|
|
|
|
|
initialize_regsets_info (&aarch32_regsets_info);
|
|
|
|
}
|