From patchwork Wed May 7 07:41:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taimoor Mirza X-Patchwork-Id: 825 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx23.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id 00939360079 for ; Wed, 7 May 2014 00:41:48 -0700 (PDT) Received: by homiemail-mx23.g.dreamhost.com (Postfix, from userid 14314964) id 81D0463827666; Wed, 7 May 2014 00:41:48 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx23.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx23.g.dreamhost.com (Postfix) with ESMTPS id 5667C6382764A for ; Wed, 7 May 2014 00:41:48 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-type; q=dns; s=default; b=hVkkQ83HjG7h43/D INV+DCcuiuYgtIl+wtWbpWFKBarFUH7vhcYWcOiMwmNDTO4uUkW4Hw7+Szc8wZXu qiIrvs8Gsuab856BWaWftuWPNuguQJV+eqgjxq/csFGXFCNynZzsukCjbtd6sf4R qTIQbCjKSnzcTIUh9R6Q9WMIoPM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-type; s=default; bh=pqMVPZYUFHtImUWFbFAU9O XXyLc=; b=lqqOimLoajHgbVyrVf/ZPmhuY5yGEfQQyM+A5GK4Co9MMGfMJ3mod8 wmZCJ0j+Pku4y+A+iCdnn3iSr/7DTB4jXM30N5zPJtfie8cZmiC/U8mE9zW+3LIT IT9mAq5O0XbmKV7Z35Aadd64b1S102iprwBvL8RJjJTmZvedsX6w0= Received: (qmail 27517 invoked by alias); 7 May 2014 07:41:46 -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 27506 invoked by uid 89); 7 May 2014 07:41:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00 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; Wed, 07 May 2014 07:41:44 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1WhwU0-0006Mn-NQ from Taimoor_Mirza@mentor.com for gdb-patches@sourceware.org; Wed, 07 May 2014 00:41:41 -0700 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 7 May 2014 00:41:38 -0700 Received: from PKL-TAIMOORMI-LT.pkl.mentorg.com (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server (TLS) id 14.2.247.3; Wed, 7 May 2014 08:41:37 +0100 From: Taimoor Mirza To: CC: Taimoor Mirza Subject: [PATCH] Fix prologue analysis for ldr.w and ldrd instruction Date: Wed, 7 May 2014 12:41:25 +0500 Message-ID: <1399448485-1740-1-git-send-email-tmirza@codesourcery.com> MIME-Version: 1.0 X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in Hi Guys, We experienced a problem while debugging startup code on Cortex-M targets (LPC4350 and ATSAM3UEK). On stepping through the code, GDB was throwing "invalid memory access" error. We found out that problem is coming because of wrong offset calculation for ldr.w and ldrd instruction during prologue analysis in thumb-mode. Below is problematic code in *thumb_analyze_prologue* function: else if ((insn & 0xff7f) == 0xf85f) /* ldr.w Rt,