Re: [PATCH] Consolidate target_mourn_inferior between GDB and gdbserver

Pedro Alves
2016-09-15T15:51:54Z

On 09/12/2016 05:51 AM, Sergio Durigan Junior wrote:
> This patch consolidates the API of target_mourn_inferior between GDB
> and gdbserver, in my continuing efforts to make sharing the
> fork_inferior function possible between both.
>
> GDB's version of the function did not care about the inferior's ptid
> being mourned, but gdbserver's needed to know this information. Since
> it actually makes sense to pass the ptid as an argument, instead of
> depending on a global value directly (which GDB's version did), I
> decided to make the generic API to accept it. I then went on and
> extended all calls being made on GDB to include a ptid argument (which
> ended up being inferior_ptid most of the times, anyway), and now we
> have a more sane interface.
>
> On GDB's side, after talking to Pedro a bit about it, we decided that
> just an assertion to make sure that the ptid being passed is equal to
> inferior_ptid would be enough for now, on the GDB side. We can remove
> the assertion and perform more operations later if we ever pass
> anything different than inferior_ptid.
>
> Regression tested on our BuildBot, everything OK.
>

Thanks, patch is OK.

> I'd appreciate a special look at gdb/windows-nat.c's modification
> because I wasn't really sure what to do there. It seemed to me that
> maybe I should build a ptid out of the process information there, but
> then I am almost sure the assertion on GDB's side would trigger.

Just leave it passing inferior_ptid like all other places, which is
a no-op. We're certain the assertion does not fail this way.

Thanks,
Pedro Alves