Re: [PATCH] Consolidate target_mourn_inferior between GDB and gdbserver

Sergio Durigan Junior
2016-09-19T04:19:20Z

On Thursday, September 15 2016, Pedro Alves wrote:

> 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, pushed.

bc1e6c81d5b77d78282c47f6fd7f697e564a6eb6

--
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible