From: Luis Machado <lgustavo@codesourcery.com>
To: Pedro Alves <palves@redhat.com>
Cc: lgustavo@codesourcery.com, Joel Brobecker <brobecker@adacore.com>,
gdb-patches@sourceware.org
Subject: Re: [PATCH,tests] Run to main before doing any tests in structs3.exp
Date: Tue, 06 Nov 2012 20:20:00 -0000 [thread overview]
Message-ID: <509970EF.1060503@codesourcery.com> (raw)
In-Reply-To: <50996120.9070806@redhat.com>
On 11/06/2012 05:12 PM, Pedro Alves wrote:
> 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.
>
Thanks Pedro.
#2 seems to work just as well. We will read data straight from the
binary's sections without having to touch real memory.
I'm fine with either solution.
next prev parent reply other threads:[~2012-11-06 20:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-06 17:09 Luis Machado
2012-11-06 17:30 ` Joel Brobecker
2012-11-06 18:51 ` Luis Machado
2012-11-06 19:12 ` Pedro Alves
2012-11-06 20:20 ` Luis Machado [this message]
2012-11-07 0:26 ` Joel Brobecker
2012-11-07 11:24 ` Luis Machado
2012-11-07 15:09 ` Joel Brobecker
2012-11-14 19:22 ` Luis Machado
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=509970EF.1060503@codesourcery.com \
--to=lgustavo@codesourcery.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox