This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, RFC] Changes to sim_store_register API


The current API to sim_store_register returns the length of the register that was updated. However if the length returned is <= 0 then this is acceptable. Some simulators return 0 or -1 even on a successful register write.

I would like to propose the following changes,

(1) As the length of the register to be written is already passed into sim_store_register all simulators should return that length if they successfully update the register.
(2) If a length of 0 is returned this indicates that the simulator understood the request but couldn't update the register, this might mean that the register is read only, or just that updating of this register has not been implemented yet; in this case gdb will give a warning that the register has not been updated and continue.
(3) If a length of -1 is returned this indicates that the simulator didn't understand the request or some other non-recoverable error has occurred; in this case gdb will quit with an error.

The attached patch implements this change and updates the existing simulators to either return the length in the case of success or to return 0 for errors. 

I would welcome your feedback and suggestions.

I would be happy to update the fetch register case in a similar fashion but thought I'd start small to begin with.

Thanks,
Andrew

Attachment: sim-store-register.patch;size=4381;creation-date="Sun,
Description: sim-store-register.patch


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]