Re: RFC: target_create_inferior that does not call proceed

Daniel Jacobowitz
2006-01-21T15:13:51Z

On Sat, Jan 21, 2006 at 01:22:37PM +0200, Eli Zaretskii wrote:
> > Date: Mon, 16 Jan 2006 15:02:38 -0500
> > From: Daniel Jacobowitz <drow@false.org>
> >
> > This patch adjusts the to_create_inferior target method so that the inferior
> > is implicitly stopped at the end of it, instead of running.
>
> Daniel, could you please describe in some detail what happens now on
> Posix systems when to_create_inferior is called, and in particular as
> result of the call to `proceed'? AFAIK, the inferior is not actually
> running until you say "run", but your message seems to indicate
> otherwise?
>
> I need these details to decide whether your suggested change in
> go32-nat.c is the right thing to do. There's the prog_has_started
> flag there that go32_create_inferior is setting after the call to
> proceed. You suggest to remove the call to proceed, but the flag is
> still being set, and I need to make up my mind whether this could
> spell some trouble. If it does, we might need a new target op to
> handle that.
>
> I tried to understand what exactly does proceed do when called from
> to_create_inferior, but got lost in twisty little passages, all alike.
> I need help.

The only call site for target_create_inferior is at the bottom of
run_command_1. It first creates a new inferior, and then calls
proceed, which transitions the inferior from stopped to executing.
prog_has_started is only set when the program is created and cleared
when it is killed, so I think the patch is right - but I don't
understand all the DOS-specific bits of go32-nat.c.

> > Another benefit of this is that I could finally implement a command I've
> > wanted for ages when debugging startup code: create the inferior but don't
> > run it, and give me my prompt back. That's not in this patch only because I
> > couldn't think of a name for it! I'd call it "start", but well... already
> > in use. Would anyone else find this useful? If so, would you care to
> > suggest a name?
>
> "create" or "create-inferior" sounds like a good name.
>
> We would need a docs patch if we add a new command, of course.

Of course. Hmm, I like both of your suggestions.