From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 361 invoked by alias); 8 Feb 2012 17:34:34 -0000 Received: (qmail 32350 invoked by uid 22791); 8 Feb 2012 17:34:31 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,TW_QE X-Spam-Check-By: sourceware.org Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 08 Feb 2012 17:34:12 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Wed, 08 Feb 2012 17:33:06 +0000 Received: from e103070-lin.arm.com ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 8 Feb 2012 17:33:02 +0000 Date: Wed, 08 Feb 2012 17:34:00 -0000 From: Matthew Gretton-Dann To: Jonas Maebe Cc: "gdb@sourceware.org" Subject: Re: Debug ARM semihosting Thumb-2 binary Message-ID: <20120208173258.GA21639@e103070-lin.arm.com> Mail-Followup-To: Jonas Maebe , "gdb@sourceware.org" References: <047D674A-A77C-4E5A-B207-592A81D857DC@elis.ugent.be> MIME-Version: 1.0 In-Reply-To: <047D674A-A77C-4E5A-B207-592A81D857DC@elis.ugent.be> User-Agent: Mutt/1.5.20 (2009-06-14) X-MC-Unique: 112020817330620001 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2012-02/txt/msg00011.txt.bz2 On Wed, Feb 08, 2012 at 10:34:18AM +0000, Jonas Maebe wrote: > Hi, >=20 > I'm debugging ARM binaries compiled for the semihosting interface (http:/= /infocenter.arm.com/help/index.jsp?topic=3D/com.arm.doc.dui0471c/CHDJHHDI.h= tml=20 > ). The binaries run under qemu-system-arm and I'm using QEMU's gdb=20=20 > remote target interface. >=20 > In general, this works fine, except when such binaries are Thumb-2 and=20= =20 > perform system calls. The reason is that for Thumb-2, the system call=20= =20 > interface of the semihosting platform uses "bkpt 0xab" (http://infocenter= .arm.com/help/index.jsp?topic=3D/com.arm.doc.dui0491c/CJAFABBB.html=20 > ). GDB intercepts this bkpt, halts the execution with a SIGINT=20=20 > message and does not pass it on to the debugged process. If the=20=20 > process is then continued, it behaves as if the system call/bkpt in=20=20 > question never was executed >=20 > Using "handle SIGINT pass" does not change this. >=20 > Is there another way to tell gdb to ignore those particular bkpt=20=20 > instructions and execute them normally? I'm using gdb 7.4 (7.2 behaves=20= =20 > the same). What CPU are you compiling for? The docs aren't clear but BKPT should only= be used for Cortex-M CPUs - otherwise 'svc 0xab' is appropriate in ARM state. However, I know there have been issues with libgloss/newlib using the wrong semi-hosting call sequence in some cases. Try updating newlib (if that is what you are using) if you are compiling for non-Cortex-M systems. If you are compiling for a Cortex-M CPU then I believe things should work. Thanks, Matt --=20 Matthew Gretton-Dann Principal Engineer, PD Software, ARM Ltd.