From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 130087 invoked by alias); 23 Apr 2015 18:53:51 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 130075 invoked by uid 89); 23 Apr 2015 18:53:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 23 Apr 2015 18:53:49 +0000 Received: from svr-orw-fem-02x.mgc.mentorg.com ([147.34.96.206] helo=SVR-ORW-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1YlMFu-0003p8-6n from Sandra_Loosemore@mentor.com ; Thu, 23 Apr 2015 11:53:46 -0700 Received: from [IPv6:::1] (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.3.224.2; Thu, 23 Apr 2015 11:53:46 -0700 Message-ID: <55393F7F.40004@codesourcery.com> Date: Thu, 23 Apr 2015 18:53:00 -0000 From: Sandra Loosemore User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: , Yao Qi Subject: [patch 1/3, nios2] revert to using "trap 31" for breakpoints References: <55393E8C.8090804@codesourcery.com> In-Reply-To: <55393E8C.8090804@codesourcery.com> Content-Type: multipart/mixed; boundary="------------020009020202090509000802" X-SW-Source: 2015-04/txt/msg00905.txt.bz2 --------------020009020202090509000802 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 772 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 --------------020009020202090509000802 Content-Type: text/x-log; name="gdb-breakpoint.log" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gdb-breakpoint.log" Content-length: 180 2015-04-23 Sandra Loosemore gdb/ * nios2-tdep.c (nios2_breakpoint_from_pc): Revert to using "trap 31" as the breakpoint instruction on all targets. --------------020009020202090509000802 Content-Type: text/x-patch; name="gdb-breakpoint.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gdb-breakpoint.patch" Content-length: 1481 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; --------------020009020202090509000802--