public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Sandra Loosemore <sandra@codesourcery.com>
To: <gdb-patches@sourceware.org>, Yao Qi <yao.qi@linaro.org>
Subject: [patch 1/3, nios2] revert to using "trap 31" for breakpoints
Date: Thu, 23 Apr 2015 18:53:00 -0000	[thread overview]
Message-ID: <55393F7F.40004@codesourcery.com> (raw)
In-Reply-To: <55393E8C.8090804@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 772 bytes --]

This patch fixes a bug I introduced in commit 
d53c26c753a39b80a338fb85bd41f75a49374842, when I was refactoring code to 
prepare for the addition of new Nios II ISA variants.  One of the new 
variants we were testing did not have an appropriate "trap" encoding 
usable for all breakpoints, so we had to tweak GDB to use "break 31" 
instead of "trap 31".  While that works fine for bare-metal, it's 
incompatible with the published Nios II ABI documentation for Linux 
systems, which explicitly requires "trap 31".  Moreover, using "break 
31" causes a kernel hang.  Oops!  So, this patch puts it back to using 
"trap 31", the way it was before.  We've discussed this with Altera and 
they are going to fix the new ISA instead of changing the ABI.

OK to commit?

-Sandra


[-- Attachment #2: gdb-breakpoint.log --]
[-- Type: text/x-log, Size: 180 bytes --]

2015-04-23  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.

[-- Attachment #3: gdb-breakpoint.patch --]
[-- Type: text/x-patch, Size: 1481 bytes --]

diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c
index 08f2034..882c263 100644
--- a/gdb/nios2-tdep.c
+++ b/gdb/nios2-tdep.c
@@ -1189,7 +1189,9 @@ 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.
+   Note that the Nios II ABI for Linux requires "trap 31"
+   as the breakpoint, and we use that consistently on all targets.  */
 
 static const gdb_byte*
 nios2_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *bp_addr,
@@ -1198,11 +1200,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;

  reply	other threads:[~2015-04-23 18:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-23 18:49 [patch 0/3, nios2] unbreak nios2-linux-gnu GDB Sandra Loosemore
2015-04-23 18:53 ` Sandra Loosemore [this message]
2015-04-28 11:18   ` [patch 1/3, nios2] revert to using "trap 31" for breakpoints Yao Qi
2015-04-23 18:55 ` [patch 2/3, nios2] use PTRACE_GETREGSET/SETREGSET in gdbserver Sandra Loosemore
2015-04-28 11:29   ` Yao Qi
2015-04-28 11:31     ` Pedro Alves
2015-04-28 15:27       ` Sandra Loosemore
2015-04-23 19:01 ` [patch 3/3, nios2] fixes for new implementation of signal handler trampolines Sandra Loosemore
2015-04-23 19:11   ` Sandra Loosemore
2015-04-28 12:11   ` Yao Qi
2015-04-28 15:47     ` Sandra Loosemore
2015-04-28 11:15 ` [patch 0/3, nios2] unbreak nios2-linux-gnu GDB Yao Qi
2015-04-28 15:14   ` Sandra Loosemore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55393F7F.40004@codesourcery.com \
    --to=sandra@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=yao.qi@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).