From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2174 invoked by alias); 19 Jul 2011 18:44:09 -0000 Received: (qmail 2164 invoked by uid 22791); 19 Jul 2011 18:44:09 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,FROM_12LTRDOM,SPF_FAIL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 19 Jul 2011 18:43:55 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1QjFGt-0004Py-Bo from meadori@codesourcery.com for gdb-patches@sourceware.org; Tue, 19 Jul 2011 11:43:55 -0700 Received: from na2-mail.mgc.mentorg.com ([134.86.114.213]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 19 Jul 2011 11:41:46 -0700 Received: from localhost.localdomain ([134.86.101.110]) by na2-mail.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 19 Jul 2011 12:43:53 -0600 From: Meador Inge To: gdb-patches@sourceware.org Subject: [PATCH 0/1] ARM: Fix crash when frame cannot be found Date: Tue, 19 Jul 2011 19:05:00 -0000 Message-Id: <1311101033-7648-1-git-send-email-meadori@codesourcery.com> X-IsSubscribed: yes 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 X-SW-Source: 2011-07/txt/msg00490.txt.bz2 This patch addresses an issue with the ARM prologue analyzer that occurs when the frame pointer cannot be deduced. The way things are currently written GDB crashes in some cases. For example, a crash can occur when the first instruction in the assembly function in question is 'mov sp, r0'. When stepping GDB kicks off a prologue analysis from 'arm-tdep.c:arm_make_prologue_cache'. However, it can't actually find the frame, so it sets the cached frame reg to -1. Later on in 'arm_make_prologue_cache' GDB tries to pass 'cache->framereg' to 'get_frame_register_unsigned' and crashes. This patch fixes the problem by always falling back on the SP register when the frame cannot be computed. A similar strategy is used on other architectures. GDB testsuite run with 'target sim'; no regressions. Some ad hoc testing done on actual hardware as well. OK? Meador Inge (1): arm: Change prologue analyzer to always fallback on SP. gdb/arm-tdep.c | 16 +------------ gdb/testsuite/gdb.arch/thumb-prologue.c | 34 +++++++++++++++++++++++++++++ gdb/testsuite/gdb.arch/thumb-prologue.exp | 27 +++++++++++++++++++++++ 3 files changed, 63 insertions(+), 14 deletions(-)