mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-01 14:03:56 +08:00
607685ecee
This patch is to let aarch64 GDB debug 32-bit arm program natively. In each function for fetching and storing registers, GDB will check gdbarch_bfd_arch_info (gdbarch)->bits_per_word, if it is 32, call the corresponding aarch32 functions in aarch32-linux-nat.c, otherwise fall back to aarch64 code to fetch and store registers. aarch64_linux_read_description has to return the right target description, but we don't have gdbarch available there, so GDB fetches auxv and gets AT_PHENT, in order to determine whether the target is 32-bit or 64-bit. I learned this trick from solib-svr4.c. gdb: 2015-07-07 Yao Qi <yao.qi@linaro.org> * aarch32-linux-nat.h (VFP_REGS_SIZE): New macro, moved from arm-linux-nat.c. * aarch64-linux-nat.c: Include aarch32-linux-nat.h and elf/external.h. (fetch_gregs_from_thread): Call aarch32_gp_regcache_supply if target is 32-bit. (store_gregs_to_thread): Call aarch32_gp_regcache_collect if target is 32-bit. (fetch_fpregs_from_thread): Call aarch32_vfp_regcache_supply if target is 32-bit. (store_fpregs_to_thread): Call aarch32_vfp_regcache_collect if target is 32-bit. (tdesc_arm_with_vfpv3, tdesc_arm_with_neon): Declare. (aarch64_linux_read_description): Return the right target description. * arm-linux-nat.c (VFP_REGS_SIZE): Moved to aarch32-linux-nat.h. * config/aarch64/linux.mh (NATDEPFILES): Add aarch32-linux-nat.o. * configure.tgt (aarch64*-*-linux*): Add arm-tdep.o and arm-linux-tdep.o
35 lines
1.4 KiB
C
35 lines
1.4 KiB
C
/* Copyright (C) 1999-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/>. */
|
|
|
|
/* Fetch and store VFP Registers. The kernel object has space for 32
|
|
64-bit registers, and the FPSCR. This is even when on a VFPv2 or
|
|
VFPv3D16 target. */
|
|
#define VFP_REGS_SIZE (32 * 8 + 4)
|
|
|
|
void aarch32_gp_regcache_supply (struct regcache *regcache, uint32_t *regs,
|
|
int arm_apcs_32);
|
|
|
|
void aarch32_gp_regcache_collect (const struct regcache *regcache,
|
|
uint32_t *regs, int arm_apcs_32);
|
|
|
|
void aarch32_vfp_regcache_supply (struct regcache *regcache, gdb_byte *regs,
|
|
const int vfp_register_count);
|
|
|
|
void aarch32_vfp_regcache_collect (const struct regcache *regcache,
|
|
gdb_byte *regs,
|
|
const int vfp_register_count);
|