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 2 of the License, or
+ 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,
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, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
#include "target.h"
#include "regset.h"
#include "trad-frame.h"
#include "tramp-frame.h"
+#include "breakpoint.h"
#include "arm-tdep.h"
#include "arm-linux-tdep.h"
reg_pc = extract_unsigned_integer (gregs
+ INT_REGISTER_SIZE * ARM_PC_REGNUM,
INT_REGISTER_SIZE);
- reg_pc = gdbarch_addr_bits_remove (current_gdbarch, reg_pc);
+ reg_pc = gdbarch_addr_bits_remove (get_regcache_arch (regcache), reg_pc);
store_unsigned_integer (pc_buf, INT_REGISTER_SIZE, reg_pc);
regcache_raw_supply (regcache, ARM_PC_REGNUM, pc_buf);
}
return NULL;
}
+/* Insert a single step breakpoint at the next executed instruction. */
+
+int
+arm_linux_software_single_step (struct frame_info *frame)
+{
+ CORE_ADDR next_pc = arm_get_next_pc (frame, get_frame_pc (frame));
+
+ /* The Linux kernel offers some user-mode helpers in a high page. We can
+ not read this page (as of 2.6.23), and even if we could then we couldn't
+ set breakpoints in it, and even if we could then the atomic operations
+ would fail when interrupted. They are all called as functions and return
+ to the address in LR, so step to there instead. */
+ if (next_pc > 0xffff0000)
+ next_pc = get_frame_register_unsigned (frame, ARM_LR_REGNUM);
+
+ insert_single_step_breakpoint (next_pc);
+
+ return 1;
+}
+
static void
arm_linux_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch)
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
/* Single stepping. */
- set_gdbarch_software_single_step (gdbarch, arm_software_single_step);
+ set_gdbarch_software_single_step (gdbarch, arm_linux_software_single_step);
/* Shared library handling. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);