Extension of remote-sim interface

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Extension of remote-sim interface

Lukas Durfina
Hello,

I want to add support for PIE files in the simulators. It requires to get an auxv object, where is an address of entry point.
I want to discuss my (working) proposal before sending a patch. My plan is to add a new method to remote-sim.h for getting
the address of various objects: SIM_ADDR sim_get_object_address(arg) -> as the argument it gets new enum value SIM_OBJECT_AUXV.
The simulator returns the address, where auxv object is prepared and stored by the simulator.

Finally, in remote-sim.c (gdbsim_target::xfer_partial) there is used gdbsim_xfer_memory to read the object from the memory.

The usage of argument in sim_get_object_address opens an option for further extensions. If some simulator does not support it,
it will return 0.

Is such an extension appropriate? Or is there better way how to extend the sim interface?

Thanks
Lukas
Reply | Threaded
Open this post in threaded view
|

Re: Extension of remote-sim interface

Simon Marchi-4
On 2019-09-19 4:25 a.m., Lukas Durfina wrote:

> I want to add support for PIE files in the simulators. It requires to get an auxv object, where is an address of entry point.
> I want to discuss my (working) proposal before sending a patch. My plan is to add a new method to remote-sim.h for getting
> the address of various objects: SIM_ADDR sim_get_object_address(arg) -> as the argument it gets new enum value SIM_OBJECT_AUXV.
> The simulator returns the address, where auxv object is prepared and stored by the simulator.
>
> Finally, in remote-sim.c (gdbsim_target::xfer_partial) there is used gdbsim_xfer_memory to read the object from the memory.
>
> The usage of argument in sim_get_object_address opens an option for further extensions. If some simulator does not support it,
> it will return 0.
>
> Is such an extension appropriate? Or is there better way how to extend the sim interface?

Hi Lukas,

What you propose sounds fine to me, we can add whatever is needed PIE files to be
supported.  AFAIK, the sim API is not public, it's just between GDB and the simulator
code, so we can change it as we like.

Note that there is an idea out there of changing simulators so that they run in their
own processes, in which case GDB would talk with them using the remote target/protocol.
The remote protocol already supports reading the auxiliary vector of the program, so
it would just be a matter of the simulators implementing that packet.  But this is just
an idea at this point, I suggest you proceed with extending the current simulator API
to implement what you need.

Thanks!

Simon