From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 66601 invoked by alias); 4 Jul 2016 20:40:10 -0000 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 Received: (qmail 66587 invoked by uid 89); 4 Jul 2016 20:40:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=3.1 required=5.0 tests=BAYES_00,BODY_8BITS,GARBLED_BODY,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=sx, deciding, Reading, 2346 X-HELO: usplmg20.ericsson.net Received: from usplmg20.ericsson.net (HELO usplmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 04 Jul 2016 20:39:59 +0000 Received: from EUSAAHC004.ericsson.se (Unknown_Domain [147.117.188.84]) by usplmg20.ericsson.net (Symantec Mail Security) with SMTP id 81.D5.09012.31FBA775; Mon, 4 Jul 2016 21:54:59 +0200 (CEST) Received: from [142.133.110.144] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.86) with Microsoft SMTP Server id 14.3.294.0; Mon, 4 Jul 2016 16:39:56 -0400 Subject: Re: gdbserver/ada testing broken To: Pedro Alves References: <1462538104-19109-1-git-send-email-palves@redhat.com> <1462538104-19109-32-git-send-email-palves@redhat.com> <5772DBCA.4090802@ericsson.com> <813555f3-c917-cd95-6d41-3ec64cad2cf6@redhat.com> <14e113dd-0488-79d0-6cde-82cdb1562793@redhat.com> CC: , Joel Brobecker From: Simon Marchi Message-ID: <577AC99C.6040206@ericsson.com> Date: Mon, 04 Jul 2016 20:40:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2016-07/txt/msg00043.txt.bz2 On 16-06-30 08:10 AM, Pedro Alves wrote: > BTW, while testing this, I noticed that all gdb.ada/ tests that build > a binary with the same name as their test directory are broken. > I suspect this is a regression caused by one of the gdb_remote_download, > etc. patches. >=20 > For example: >=20 > Running /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.ada/formatted_ref.ex= p ... > PASS: gdb.ada/formatted_ref.exp: compilation formatted_ref.adb > FAIL: gdb.ada/formatted_ref.exp: print/x s > FAIL: gdb.ada/formatted_ref.exp: print/x s'access > FAIL: gdb.ada/formatted_ref.exp: print s.x =3D 13 >=20 > gdb.log shows: >=20 > The program is not being run. > (gdb) file /home/pedro/brno/pedro/gdb/mygit/build/gdb/testsuite/outputs/= gdb.ada/formatted_ref/formatted_ref/formatted_ref > Reading symbols from /home/pedro/brno/pedro/gdb/mygit/build/gdb/testsuit= e/outputs/gdb.ada/formatted_ref/formatted_ref/formatted_ref...done. > ... > (gdb) spawn ../gdbserver/gdbserver --once :2346 /home/pedro/brno/pedro/g= db/mygit/build/gdb/testsuite/outputs/gdb.ada/formatted_ref/formatted_ref > Process /home/pedro/brno/pedro/gdb/mygit/build/gdb/testsuite/outputs/gdb= .ada/formatted_ref/formatted_ref created; pid =3D 7553 > Cannot exec /home/pedro/brno/pedro/gdb/mygit/build/gdb/testsuite/outputs= /gdb.ada/formatted_ref/formatted_ref: Permission denied. >=20 > Child exited with status 127 > No program to debug >=20 > Note how gdb loads: >=20 > .../gdb.ada/formatted_ref/formatted_ref/formatted_ref >=20 > while gdbserver tries to load: >=20 > .../gdb.ada/formatted_ref/formatted_ref >=20 > ... which fails because it's the directory. >=20 > This is probably because gdb_remote_download only minds "tail" when > deciding the destination filename: >=20 > proc gdb_remote_download {dest fromfile {tofile {}}} { > # If TOFILE is not given, default to the same filename as FROMFILE. > if {[string length $tofile] =3D=3D 0} { > set tofile [file tail $fromfile] > } >=20 > if {[is_remote $dest]} { > # When the DEST is remote, we simply send the file to DEST. > global cleanfiles >=20 > set destname [remote_download $dest $fromfile $tofile] > lappend cleanfiles $destname >=20 > return $destname >=20 >=20 > and then gdbserver-base.exp does: >=20 > proc ${board}_download { board host dest } { > # We pass DEST in standard_output_file, regardless of whether it is a= bsolute > # or relative, because we don't want the tests to be able to write ou= tside > # their standard output directory. > set dest [standard_output_file $dest] >=20 > file copy -force $host $dest >=20 > return $dest > } >=20 > Here $dest already exists when we get here -- it's the directory. >=20 > I haven't confirmed, just inspected the code. I think you are right. > Not sure exactly what the best fix is. Maybe simply tweak > the tests to never get into this situation, along with > making standard_ada_testfile issue perror when it happens? >=20 > Most tests pass an explicit base_file name to standard_ada_testfile > that avoids the conflict, like: >=20 > gdb.ada/str_ref_cmp.exp:18:standard_ada_testfile foo >=20 > Maybe standard_ada_testfile's $base_file parameter should be > defaulted, like: >=20 > -proc standard_ada_testfile {base_file {dir ""}} { > +proc standard_ada_testfile {{base_file "test"} {dir ""}} { >=20 > and then most tests adjusted to not pass an explicit > base_file at all. >=20 > Thanks, > Pedro Alves >=20 Is there a reason have a double level of directories named after the test? outputs =E2=94=94=E2=94=80=E2=94=80 gdb.ada =E2=94=94=E2=94=80=E2=94=80 formatted_ref =E2=94=94=E2=94=80=E2=94=80 formatted_ref =E2=94=9C=E2=94=80=E2=94=80 b~formatted_ref.adb =E2=94=9C=E2=94=80=E2=94=80 b~formatted_ref.ads =E2=94=9C=E2=94=80=E2=94=80 b~formatted_ref.ali =E2=94=9C=E2=94=80=E2=94=80 b~formatted_ref.o =E2=94=9C=E2=94=80=E2=94=80 defs.ali =E2=94=9C=E2=94=80=E2=94=80 defs.o =E2=94=9C=E2=94=80=E2=94=80 formatted_ref =E2=94=9C=E2=94=80=E2=94=80 formatted_ref.ali =E2=94=94=E2=94=80=E2=94=80 formatted_ref.o If we removed the extra "formatted_ref" level, we wouldn't have the problem= at all. The source and destination would become identical when running locally, jus= t like when testing C/C++. Or maybe it's needed for some reason in Ada? I made this patch quickly: https://github.com/simark/binutils-gdb/commit/d451ff22f1980d4a89c5d6d126bc8= 39734fa393f A few tests that assume the current directory layout need to be adjusted, b= ut other than that it looks fine. I'll clean it up, give it more testing and post i= t tomorrow, unless you say it's a wrong approach in the mean time.