aboutsummaryrefslogtreecommitdiff
path: root/gdb/nios2-tdep.c
diff options
context:
space:
mode:
authorSandra Loosemore <sandra@codesourcery.com>2015-05-08 12:24:41 -0700
committerSandra Loosemore <sandra@codesourcery.com>2015-05-08 12:24:41 -0700
commitb73c49b7f6691cf1debb14dbce5b3222a7190314 (patch)
tree3835e91cb8447148c28124fbb54d2888980fc36c /gdb/nios2-tdep.c
parentf7797074a5dc314f8922d2e90c1a4ea04b189c36 (diff)
downloadgdb-b73c49b7f6691cf1debb14dbce5b3222a7190314.zip
gdb-b73c49b7f6691cf1debb14dbce5b3222a7190314.tar.gz
gdb-b73c49b7f6691cf1debb14dbce5b3222a7190314.tar.bz2
Revert to using "trap 31" for breakpoints on nios2.
2015-05-08 Sandra Loosemore <sandra@codesourcery.com> gdb/ * nios2-tdep.c (nios2_breakpoint_from_pc): Revert to using "trap 31" as the breakpoint instruction on all targets.
Diffstat (limited to 'gdb/nios2-tdep.c')
-rw-r--r--gdb/nios2-tdep.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c
index 08f2034..988b9fc 100644
--- a/gdb/nios2-tdep.c
+++ b/gdb/nios2-tdep.c
@@ -1189,7 +1189,15 @@ nios2_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
return nios2_analyze_prologue (gdbarch, start_pc, start_pc, &cache, NULL);
}
-/* Implement the breakpoint_from_pc gdbarch hook. */
+/* Implement the breakpoint_from_pc gdbarch hook.
+
+ The Nios II ABI for Linux says: "Userspace programs should not use
+ the break instruction and userspace debuggers should not insert
+ one." and "Userspace breakpoints are accomplished using the trap
+ instruction with immediate operand 31 (all ones)."
+
+ So, we use "trap 31" consistently as the breakpoint on bare-metal
+ as well as Linux targets. */
static const gdb_byte*
nios2_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *bp_addr,
@@ -1198,11 +1206,11 @@ nios2_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *bp_addr,
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
unsigned long mach = gdbarch_bfd_arch_info (gdbarch)->mach;
- /* R1 break encoding:
- ((0x1e << 17) | (0x34 << 11) | (0x1f << 6) | (0x3a << 0))
- 0x003da7fa */
- static const gdb_byte r1_breakpoint_le[] = {0xfa, 0xa7, 0x3d, 0x0};
- static const gdb_byte r1_breakpoint_be[] = {0x0, 0x3d, 0xa7, 0xfa};
+ /* R1 trap encoding:
+ ((0x1d << 17) | (0x2d << 11) | (0x1f << 6) | (0x3a << 0))
+ 0x003b6ffa */
+ static const gdb_byte r1_breakpoint_le[] = {0xfa, 0x6f, 0x3b, 0x0};
+ static const gdb_byte r1_breakpoint_be[] = {0x0, 0x3b, 0x6f, 0xfa};
*bp_size = NIOS2_OPCODE_SIZE;
if (byte_order_for_code == BFD_ENDIAN_BIG)
return r1_breakpoint_be;