From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2873 invoked by alias); 23 Feb 2012 14:12:48 -0000 Received: (qmail 2852 invoked by uid 22791); 23 Feb 2012 14:12:46 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,TW_BJ,TW_JC,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp3.ugent.be (HELO smtp3.UGent.be) (157.193.49.127) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 23 Feb 2012 14:12:30 +0000 Received: from localhost (mcheck5.ugent.be [157.193.49.247]) by smtp3.UGent.be (Postfix) with ESMTP id 5D28A14821A; Thu, 23 Feb 2012 15:12:29 +0100 (CET) Received: from smtp3.UGent.be ([157.193.49.127]) by localhost (mcheck5.UGent.be [157.193.43.11]) (amavisd-new, port 10024) with ESMTP id iMpWr0NuLXcE; Thu, 23 Feb 2012 15:12:28 +0100 (CET) Received: from mail.elis.ugent.be (mail.elis.UGent.be [157.193.206.48]) by smtp3.UGent.be (Postfix) with ESMTP id 57B6A1481FD; Thu, 23 Feb 2012 15:12:28 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail.elis.ugent.be (Postfix) with ESMTP id 1B5FC918F17; Thu, 23 Feb 2012 15:12:28 +0100 (CET) Received: from mail.elis.ugent.be ([127.0.0.1]) by localhost (mail.elis.ugent.be [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NQqNL19DdFjz; Thu, 23 Feb 2012 15:12:24 +0100 (CET) Received: from bigmac.elis.UGent.be (bigmac.elis.UGent.be [157.193.206.33]) by mail.elis.ugent.be (Postfix) with ESMTP id 2D540918F19; Thu, 23 Feb 2012 15:12:24 +0100 (CET) Cc: Matthew Gretton-Dann , "gdb@sourceware.org" Message-Id: <0BFF88B8-4648-444A-B4ED-2BEEAD2F35E8@elis.ugent.be> From: Jonas Maebe To: Peter Maydell In-Reply-To: Content-Type: multipart/mixed; boundary=Apple-Mail-360--488174267 Mime-Version: 1.0 (Apple Message framework v936) Subject: Re: Debug ARM semihosting Thumb-2 binary Date: Thu, 23 Feb 2012 14:12:00 -0000 References: <047D674A-A77C-4E5A-B207-592A81D857DC@elis.ugent.be> <20120208173258.GA21639@e103070-lin.arm.com> <2370539B-1B7C-4ADB-B44F-0F09553C5D62@elis.ugent.be> <20120209013821.GB7259@e103070-lin.arm.com> <30DEFAEF-E241-44A7-BB22-5CD1AED61899@elis.ugent.be> X-j-chkmail-Enveloppe: 4F46494C.000 from mail.elis.UGent.be/mail.elis.UGent.be/157.193.206.48/mail.elis.ugent.be/ X-j-chkmail-Score: MSGID : 4F46494C.000 on smtp3.UGent.be : j-chkmail score : . : R=. U=. O=. B=0.000 -> S=0.000 X-j-chkmail-Status: Ham 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/msg00066.txt.bz2 --Apple-Mail-360--488174267 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Content-length: 2604 On 20 Feb 2012, at 17:21, Peter Maydell wrote: > The reason this isn't working for you is that QEMU's M3 model doesn't > pay any attention to the entry point in an ELF file -- it expects that > you feed it an ELF image which starts at address zero and includes the > M profile vector table (from which it will pull the starting PC and > SP). > > Not supporting "load ELF file and use its entry point as the starting > PC" is arguably a missing feature (although you have to answer the > question > of 'so what should the starting SP be' if you want to support this). > However since QEMU's M profile support is basically in the 'odd fixes' > state this isn't likely to be improved in the near future, so the > simplest thing is for you to just generate an ELF file of the right > shape. I see, thanks. I'm currently waiting for a renewal of our compiler license though, so right now that's unfortunately not an option (I can use objcopy extract a binary dump from my binary, but then it misses the vector table). Since I'm not writing an OS but am running very simple minibenchmarks (mibench), I assume that in general things should work fine though. Except, of course, if the bkpt instructions require extra support not provided by the realview-eb platform... > There's now a version 2 of the patch which attacks the problem > in a slightly different way and fixes both the SIGINT problems and > also the occasional stalls which were causing semihosting read/write > performance to be so poor: > > http://patchwork.ozlabs.org/patch/141867/ Thanks. I tested it (with the realview-eb platform) on top of Qemu 1.0, but unfortunately it doesn't completely solve the problem yet for me: a) gdb no longer stops with SIGINT whenever a bkpt is executed, which is good b) however, the syscalls still don't seem to get executed, or at least do not return the proper result Without gdb attached, the qsort_large binary shows this output: *** Sorting 50000 vectors based on distance from the origin. 25138398 28611231 9838998 [etc] *** With gdb attached, this is the output: *** Sorting 0 vectors based on distance from the origin. *** So it seems the reading of the input file fails. FWIW, this is the same output I got before the patch, except that GDB then also stopped with a SIGINT every time a syscall/bkpt was executed. I've attached the new target remote debug output from gdb. If this is due to me using the realview-eb platform, then I guess I'll just have to do without debugging past the first syscall until I can regenerate my binaries. Thanks, Jonas --Apple-Mail-360--488174267 Content-Disposition: attachment; filename=target-remote-v2.txt Content-Type: text/plain; x-unix-mode=0644; name="target-remote-v2.txt" Content-Transfer-Encoding: quoted-printable Content-length: 4145 (gdb) set arm force-mode thumb (gdb) set debug remote 1 (gdb) target remote :1234 Remote debugging using :1234 Sending packet: $qSupported:qRelocInsn+#9a...Ack Packet received: PacketSize=3D1000;qXfer:features:read+ Packet qSupported (supported-packets) is supported Sending packet: $Hg0#df...Ack Packet received: OK Sending packet: $qXfer:features:read:target.xml:0,ffb#79...Ack Packet received: l Sending packet: $qXfer:features:read:arm-core.xml:0,ffb#08...Ack Packet received: l\n\n\n= \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \= n \n\n Sending packet: $?#3f...Ack Packet received: T05thread:01; Sending packet: $Hc-1#09...Ack Packet received: OK Sending packet: $qC#b4...Ack Packet received: QC1 Sending packet: $qAttached#8f...Ack Packet received:=20 Packet qAttached (query-attached) is NOT supported Sending packet: $g#67...Ack Packet received: 0000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000080000073010= 040 Sending packet: $m8000,4#95...Ack Packet received: 00f002f8 Sending packet: $m7ffc,4#33...Ack Packet received: 00000000 Sending packet: $m8000,4#95...Ack Packet received: 00f002f8 Sending packet: $m7ffc,4#33...Ack Packet received: 00000000 Sending packet: $m8000,4#95...Ack Packet received: 00f002f8 Sending packet: $m7ffc,4#33...Ack Packet received: 00000000 Sending packet: $m8000,4#95...Ack Packet received: 00f002f8 Sending packet: $m8000,4#95...Ack Packet received: 00f002f8 Sending packet: $m8000,4#95...Ack Packet received: 00f002f8 0x00008000 in ?? () Sending packet: $qTStatus#49...Ack Packet received:=20 (gdb) c Continuing. Sending packet: $vCont?#49...Ack Packet received: vCont;c;C;s;S Packet vCont (verbose-resume) is supported Sending packet: $vCont;c#a8...Ack Packet received: Fopen,04000024/10,00000000,1a4 Sending packet: $m4000024,10#54...Ack Packet received: 696e7075745f6c617267652e64617400 Sending packet: $F-1,2#02...Ack Packet received: Fisatty,00000001 Sending packet: $F1#77...Ack Packet received: Fwrite,00000001,04000188,00000001 Sending packet: $m4000188,1#2f...Ack Packet received: 0a Sending packet: $F1#77...Ack Packet received: Fwrite,00000001,04000188,00000035 Sending packet: $m4000188,35#66...Ack Packet received: 536f7274696e67203020766563746f7273206261736564206f6e206469= 7374616e63652066726f6d20746865206f726967696e2e0a Sorting 0 vectors based on distance from the origin. Sending packet: $F35#ae...Ack Packet received: Fwrite,00000001,04000188,00000001 Sending packet: $m4000188,1#2f...Ack Packet received: 0a Sending packet: $F1#77...Ack Packet received: Fclose,00000000 Sending packet: $F0#76...Ack Packet received: Fclose,00000001 Sending packet: $F0#76...Ack Packet received: Fclose,00000001 Sending packet: $F-1,9#09...Ack Packet received: W00 Program exited normally. --Apple-Mail-360--488174267 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1 --Apple-Mail-360--488174267--