From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9212 invoked by alias); 23 Mar 2012 15:47:12 -0000 Received: (qmail 8720 invoked by uid 22791); 23 Mar 2012 15:47:05 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,FROM_12LTRDOM,SUBJ_OBFU_PUNCT_FEW 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; Fri, 23 Mar 2012 15:46:51 +0000 Received: from nat-dem.mentorg.com ([195.212.93.2] helo=eu2-mail.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1SB6hV-0000Rz-KW from Thomas_Schwinge@mentor.com ; Fri, 23 Mar 2012 08:46:49 -0700 Received: from feldtkeller.schwinge.homeip.net ([172.30.64.78]) by eu2-mail.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 23 Mar 2012 16:46:48 +0100 From: Thomas Schwinge To: gdb-patches@sourceware.org Cc: Kevin Buettner Subject: [SH] gdb.arch/gdb1291.exp, gdb.arch/gdb1431.exp User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Fri, 23 Mar 2012 15:47:00 -0000 Message-ID: <87fwcze2w7.fsf@schwinge.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" 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: 2012-03/txt/msg00805.txt.bz2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 7732 Hi! For sh-linux-gnu, both gdb.arch/gdb1291.exp and gdb.arch/gdb1431.exp currently fail to build as follows: Running [...]/gdb.arch/gdb1291.exp ... Executing on host: sh-linux-gnu-gcc [...]/gdb.arch/gdb1291.s [...] -o [= ...]/gdb.arch/gdb1291 (timeout =3D 3600) [...]/usr/lib/crt1.o: In function `L_main': (.text+0x1c): undefined reference to `main' /tmp/cciSZQqk.o: In function `_main': gdb1291.c:(.text+0x2c): undefined reference to `_printf' collect2: error: ld returned 1 exit status Exactly the same for gdb.arch/gdb1431.exp: their source files (gdb.arch/gdb1291.s, gdb.arch/gdb1431.s) are identical, and I first propose to get rid of one of them: gdb/testsuite/ * gdb.arch/gdb1431.s: Remove file. * gdb.arch/gdb1431.exp (srcfile): Refer to gdb1291.s. Index: gdb.arch/gdb1291.s =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/gdb1291.s,v retrieving revision 1.5 diff -u -p -r1.5 gdb1291.s --- gdb.arch/gdb1291.s 4 Jan 2012 08:17:44 -0000 1.5 +++ gdb.arch/gdb1291.s 23 Mar 2012 15:32:32 -0000 @@ -18,6 +18,8 @@ ! ! This file is part of the gdb testsuite. ! +! It is shared between gdb1291.exp and gdb1431.exp. +! ! It was generated using "sh-elf-gcc -S gdb1291.c", using the following ! source file: ! Index: gdb.arch/gdb1431.exp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/gdb1431.exp,v retrieving revision 1.12 diff -u -p -r1.12 gdb1431.exp --- gdb.arch/gdb1431.exp 16 Jan 2012 16:21:44 -0000 1.12 +++ gdb.arch/gdb1431.exp 23 Mar 2012 15:28:11 -0000 @@ -32,7 +32,8 @@ if ![istarget "sh-*-*"] then { } =20 set testfile "gdb1431" -set srcfile ${testfile}.s +# Use gdb1291.s instead of duplicating it. +set srcfile "gdb1291.s" set binfile ${objdir}/${subdir}/${testfile} if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable= ""] !=3D "" } { untested gdb1431.exp Next, for the linking error, the problem is that global symbols (such as printf) are specified with a leading underscore, which is correct for sh-elf, but not for sh-linux-gnu. Relying on GCC's __USER_LABEL_PREFIX__, I propose the following: gdb/testsuite/ * gdb.arch/gdb1291.s: Rename file to... * gdb.arch/gdb1291.S: ... this. (CONCAT1, CONCAT2, SYM): New macros. (_main, _printf, _sub1, _sub2): Replace with SYM(main), etc. * gdb.arch/gdb1291.exp (srcfile): Update for the changed filename. * gdb.arch/gdb1431.exp (srcfile): Likewise. --- gdb.arch/gdb1291.s 2012-03-23 16:32:22.160825674 +0100 +++ gdb.arch/gdb1291.S 2012-03-23 12:46:10.730852730 +0100 @@ -20,8 +20,8 @@ ! ! It is shared between gdb1291.exp and gdb1431.exp. ! -! It was generated using "sh-elf-gcc -S gdb1291.c", using the following -! source file: +! It has originally been generated using "sh-elf-gcc -S gdb1291.c", using = the +! following source file: ! ! #include !=09 @@ -46,6 +46,11 @@ ! We use a pregenerated assembly file as the test input to avoid possible ! problems with future versions of gcc generating different code. =20 + +#define CONCAT1(a, b) CONCAT2(a, b) +#define CONCAT2(a, b) a ## b +#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) + .file "gdb1291.c" .text .section .rodata @@ -54,9 +59,9 @@ .string "hello world\n" .text .align 1 - .global _main - .type _main, @function -_main: + .global SYM(main) + .type SYM(main), @function +SYM(main): mov.l r14,@-r15 sts.l pr,@-r15 mov r15,r14 @@ -81,16 +86,16 @@ .L2: .long .LC0 .L3: - .long _printf + .long SYM(printf) .L4: - .long _sub1 + .long SYM(sub1) .L5: - .long _sub2 - .size _main, .-_main + .long SYM(sub2) + .size SYM(main), . - SYM(main) .align 1 - .global _sub1 - .type _sub1, @function -_sub1: + .global SYM(sub1) + .type SYM(sub1), @function +SYM(sub1): mov.l r14,@-r15 sts.l pr,@-r15 add #-128,r15 @@ -106,11 +111,11 @@ .align 1 .L8: .short 256 - .size _sub1, .-_sub1 + .size SYM(sub1), . - SYM(sub1) .align 1 - .global _sub2 - .type _sub2, @function -_sub2: + .global SYM(sub2) + .type SYM(sub2), @function +SYM(sub2): mov.l r14,@-r15 sts.l pr,@-r15 mov.w .L11,r1 @@ -126,5 +131,5 @@ .align 1 .L11: .short 260 - .size _sub2, .-_sub2 + .size SYM(sub2), . - SYM(sub2) .ident "GCC: (GNU) 3.5.0 20040204 (experimental)" Index: gdb.arch/gdb1291.exp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/gdb1291.exp,v retrieving revision 1.12 diff -u -p -r1.12 gdb1291.exp --- gdb.arch/gdb1291.exp 16 Jan 2012 16:21:44 -0000 1.12 +++ gdb.arch/gdb1291.exp 23 Mar 2012 15:44:37 -0000 @@ -30,7 +30,7 @@ if ![istarget "sh-*-*"] then { } =20 set testfile "gdb1291" -set srcfile ${testfile}.s +set srcfile ${testfile}.S set binfile ${objdir}/${subdir}/${testfile} if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable= ""] !=3D "" } { untested gdb1291.exp --- gdb.arch/gdb1431.exp_ 2012-03-23 16:31:15.551606197 +0100 +++ gdb.arch/gdb1431.exp 2012-03-23 16:15:04.511666412 +0100 @@ -32,8 +32,8 @@ } =20 set testfile "gdb1431" -# Use gdb1291.s instead of duplicating it. -set srcfile "gdb1291.s" +# Use gdb1291.S instead of duplicating it. +set srcfile "gdb1291.S" set binfile ${objdir}/${subdir}/${testfile} if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable= ""] !=3D "" } { untested gdb1431.exp And then we additionally need the following bit for cases where gdbserver is involved: gdb/testsuite/ * gdb.arch/gdb1431.exp : Only expect to hear the debuggee's friendly greeting if we're not deaf. Index: gdb.arch/gdb1431.exp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/gdb1431.exp,v retrieving revision 1.12 diff -u -p -r1.12 gdb1431.exp --- gdb.arch/gdb1431.exp 16 Jan 2012 16:21:44 -0000 1.12 +++ gdb.arch/gdb1431.exp 23 Mar 2012 15:28:11 -0000 @@ -52,6 +53,11 @@ if ![runto_main] then { gdb_suppress_tests } =20 -gdb_test "advance sub1" "hello world\r\n$hex in sub1 \\(\\)" "get to sub1" +set expect "$hex in sub1 \\(\\)" +if { ![target_info exists gdb,noinferiorio] } then { + # Accept the debuggee's friendly greeting. + set expect "hello world\r\n$expect" +} +gdb_test "advance sub1" "$expect" "get to sub1" gdb_test "advance sub2" "$hex in main \\(\\)" "advance returns from sub1 f= rame" gdb_test "advance sub2" "$hex in sub2 \\(\\)" "get to sub2" End result for both sh-linux-gnu and sh-elf: Running [...]/gdb.arch/gdb1291.exp ... PASS: gdb.arch/gdb1291.exp: set breakpoint PASS: gdb.arch/gdb1291.exp: get to sub1 PASS: gdb.arch/gdb1291.exp: backtrace with local variable less than or = equal to 256 bytes PASS: gdb.arch/gdb1291.exp: set breakpoint PASS: gdb.arch/gdb1291.exp: get to sub2 PASS: gdb.arch/gdb1291.exp: backtrace with local variable larger than 2= 56 bytes Running [...]/gdb.arch/gdb1431.exp ... PASS: gdb.arch/gdb1431.exp: get to sub1 PASS: gdb.arch/gdb1431.exp: advance returns from sub1 frame PASS: gdb.arch/gdb1431.exp: get to sub2 OK to commit? Gr=C3=BC=C3=9Fe, Thomas --=-=-= Content-Type: application/pgp-signature Content-length: 489 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAEBAgAGBQJPbJrYAAoJENuKOtuXzphJNT4H/iAEvMdPpjv9GffSQ+FsAjJh 9L5USvOGClHLpTq6weaDHz3imbcADh10AYfyCaQV4R5CmUf/25CvpYSc5/aheEJV SD2g3b72k9/ZR4EsQllyyNLrV5LAGaLVH763vXRQnYsXn5j5V7dLtLzL6oPrKmN7 hlPrv35KzkakNCGfNAtmu32w7EMkVrg+dziXm9NGc+Co817bFt2i1ONTk56WBTWO LcC+O/hlJPNk1Ds+Bz125m4SwWW2b/Cnl5rRsD16Y5Tbenp8LqmFgaxFq5kPrX00 20cNAcJoBiCUhxuLah2JHmBQ9GiKwkxAb45KVaKg1MXptXWvMJP/OGxKqKsdF5k= =GlM7 -----END PGP SIGNATURE----- --=-=-=--