From patchwork Wed May 20 09:49:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Simmons X-Patchwork-Id: 6811 Received: (qmail 59146 invoked by alias); 20 May 2015 09:49:54 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 59129 invoked by uid 89); 20 May 2015 09:49:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: lwfs1-cam.cam.lispworks.com Received: from mail.lispworks.com (HELO lwfs1-cam.cam.lispworks.com) (46.17.166.21) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 20 May 2015 09:49:53 +0000 Received: from heapu.cam.lispworks.com (heapu.cam.lispworks.com [192.168.1.71]) by lwfs1-cam.cam.lispworks.com (8.14.5/8.14.5) with ESMTP id t4K9nm6k045229; Wed, 20 May 2015 10:49:48 +0100 (BST) (envelope-from martin@lispworks.com) Received: from heapu.cam.lispworks.com (localhost.localdomain [127.0.0.1]) by heapu.cam.lispworks.com (8.14.4) id t4K9nmV4015740; Wed, 20 May 2015 10:49:48 +0100 Received: (from martin@localhost) by heapu.cam.lispworks.com (8.14.4/8.14.4/Submit) id t4K9nlqt015737; Wed, 20 May 2015 10:49:47 +0100 Date: Wed, 20 May 2015 10:49:47 +0100 Message-Id: <201505200949.t4K9nlqt015737@heapu.cam.lispworks.com> From: Martin Simmons To: gdb-patches@sourceware.org Subject: [PATCH] Prevent internal-error when computing $pc in ARM assembly code This patch prevents a gdb internal-error when computing $pc for ARM assembly code that doesn't use the normal stack frame convention. It might also help with gdb/12223. I'm not subscribed to the list so please include me on any replies. gdb/ChangeLog: * arm-tdep.c (arm_analyze_prologue): Read memory without throwing an exception, to allow debugging of assembly code. diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 8181f25..d47b4af 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -1669,8 +1669,11 @@ arm_analyze_prologue (struct gdbarch *gdbarch, current_pc < prologue_end; current_pc += 4) { - unsigned int insn - = read_memory_unsigned_integer (current_pc, 4, byte_order_for_code); + unsigned int insn; + gdb_byte buf[4]; + if (target_read_memory (current_pc, buf, 4)) + break; + insn = extract_unsigned_integer (buf, 4, byte_order_for_code); if (insn == 0xe1a0c00d) /* mov ip, sp */ {