From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13815 invoked by alias); 6 Nov 2012 19:12:49 -0000 Received: (qmail 13806 invoked by uid 22791); 6 Nov 2012 19:12:48 -0000 X-SWARE-Spam-Status: No, hits=-7.7 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 06 Nov 2012 19:12:36 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qA6JCY7w025616 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 6 Nov 2012 14:12:34 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qA6JCW9b030520; Tue, 6 Nov 2012 14:12:33 -0500 Message-ID: <50996120.9070806@redhat.com> Date: Tue, 06 Nov 2012 19:12:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121016 Thunderbird/16.0.1 MIME-Version: 1.0 To: lgustavo@codesourcery.com CC: Joel Brobecker , gdb-patches@sourceware.org Subject: Re: [PATCH,tests] Run to main before doing any tests in structs3.exp References: <50994431.1040405@codesourcery.com> <20121106173029.GC5103@adacore.com> <50995C16.2060507@codesourcery.com> In-Reply-To: <50995C16.2060507@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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-11/txt/msg00126.txt.bz2 On 11/06/2012 06:51 PM, Luis Machado wrote: > Hi Joel, > > On 11/06/2012 03:30 PM, Joel Brobecker wrote: >>> On remote targets, we don't always start at the entry point. Thus, >>> it is safer to get to main and do the tests from that point onwards. >> >> Can you elaborate more? Your patch looks reasonable at first sight, >> but then at the same time now introduces a new requirement that it >> needs to be run on the target, whereas that was not the case before. >> >> The testcase only prints global variables. I don't suppose there >> is much of a guaranty that you could print global variables without >> starting the program first, but it's been generally working. So >> I am curious as to why it isn't working in your case. > > We've been generally only testing these with native targets or with gdbserver on linux, both of which have well-known inferior startup procedures. > > Consider, for example, a target that runs on QEMU. QEMU won't start the binary in exactly the same way as gdbserver running on linux. Thus, global variable initialization procedures may not have happened at that point yet. Consider that we start even before the dynamic loader had a chance to run and do all the relocation magic. > > In this case, it makes no sense to try to print global variables since they will only contain garbage. > > Effectively starting the binary and running to a known location helps avoid such a situation, and it does not change much for targets that already passed these tests. > > Hopefully this explains things a little better. The difference between native and remote debugging, is that on native debugging, we don't start the inferior in any way at all. Ideally we'd make the test environments in both cases as similar as possible. So we have two options: #1 - Always run to main, so to get past startup for remote targets, thus on native debugging we'll start the inferior too. This is your patch. #2 - Don't start the inferior at all against remote targets too. We have several tests that do this, as not spawning the remote server cuts a bit of test time. This is done by using gdb_file instead of gdb_load (it is usually gdb_load that spawns the remote side). I haven't really thought if #2 makes sense for this test; I just wanted to explain that option #2 exists. -- Pedro Alves