This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: PR13901
On Apr 2, 2012, at 4:16 PM, Pedro Alves wrote:
> On 04/02/2012 03:06 PM, Tristan Gingold wrote:
>
>>
>> On Apr 2, 2012, at 3:56 PM, Pedro Alves wrote:
>
>
>>> Why does GDB need to touch the shell's registers at all in the first place?
>>
>> I haven't checked why.
>
>
> Well, I claim that it shouldn't. :-) The whole existence of
> fork-child.c:startup_inferior was justified on making GDB not touch the
> shell. We used to have the startup phase go through the whole
> wait_for_inferior shebang, which was problematic as it touched the shell.
>
>>
>>> If we can't skip darwin_set_sstep for all continues that are not single-steps,
>>> we could at least skip those while starting up (when continuing the shell
>>> until we see enough execs). That'd suggest a new flag like
>>> darwin-nat.h:struct private_inferior->starting_up, set and cleared in
>>> darwin_create_inferior, and then making darwin_resume_thread do:
>>>
>>> - /* Set single step. */
>>> - inferior_debug (4, _("darwin_set_sstep (thread=%x, enable=%d)\n"),
>>> - thread->gdb_port, step);
>>> - darwin_set_sstep (thread->gdb_port, step);
>>> + /* Avoid touching the $SHELL process, and go straight to resuming it. */
>>> + gdb_assert (!inf->private->starting_up || !step);
>>> + if (!inf->private->starting_up)
>>> + {
>>> + /* Set single step. */
>>> + inferior_debug (4, _("darwin_set_sstep (thread=%x, enable=%d)\n"),
>>> + thread->gdb_port, step);
>>> + darwin_set_sstep (thread->gdb_port, step);
>>>
>>> WDYT?
>>
>> Yes, it might be cleaner.
>>
>> Honestly, I'd prefer to get rid of the shell step and directly execute the user program - or at least have an option to do that. I think I also understand the cons of this approach.
>
>
> I'd be glad to see STARTUP_WITH_SHELL turned into a run-time option.
Good to know that.
> I think there's
> a PR open for that even. However, we need the shell at least for argument globbing,
> as in, e.g., debugging `ls *', so I don't think we could make it off by default,
> which practically renders it an orthogonal feature.
Sure.
Tristan.