This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] sim: don't rely on inferior_ptid in gdbsim_target::wait
- From: Simon Marchi <simon dot marchi at polymtl dot ca>
- To: Andrew Burgess <andrew dot burgess at embecosm dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Sun, 19 Jan 2020 19:48:48 -0500
- Subject: Re: [PATCH] sim: don't rely on inferior_ptid in gdbsim_target::wait
- Dkim-filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 00K0mnwT021302
- References: <20200119035557.5975-1-simon.marchi@polymtl.ca> <20200119211217.GE3865@embecosm.com>
On 2020-01-19 4:12 p.m., Andrew Burgess wrote:
> * Simon Marchi <simon.marchi@polymtl.ca> [2020-01-18 22:55:57 -0500]:
>
>> When running a program with the simulator target, I get:
>>
>> /home/simark/src/binutils-gdb/gdb/inferior.c:279: internal-error: inferior* find_inferior_pid(process_stratum_target*, int): Assertion `pid != 0' failed.
>>
>> This can be reproduced by building a GDB for --target=arm-none-gnueabi,
>> and running with
>>
>> $ ./gdb -nx --data-directory=data-directory a.out -ex "target sim" -ex load -ex "b main" -ex r
>>
>> Where a.out is any program with a main.
>>
>> The problem is that gdbsim_target::wait assumes that inferior_ptid has
>> the value of the thread it wants to report an event for.
>>
>> Actually, it's the target's responsibility to come up with the ptid of
>> the thread the event is for. In the sim target, that ptid is stored in
>> sim_inferior_data::remote_sim_ptid, so return that instead of
>> inferior_ptid.
>>
>> ChangeLog:
>>
>> * remote-sim.c (gdbsim_target::wait): Return
>> sim_data->remote_sim_ptid instead of inferior_ptid.
>
> This makes sense. LGTM.
>
> Thanks,
> Andrew
Thanks, I pushed it.
Simon