daniel5151 / gdbstub

An ergonomic, featureful, and easy-to-integrate implementation of the GDB Remote Serial Protocol in Rust (with no-compromises #![no_std] support)
Other
291 stars 45 forks source link

Allow `read_addrs()` to send fewer bytes than requested #111

Closed geigerzaehler closed 10 months ago

geigerzaehler commented 1 year ago

GDBs m command allows the stub to respond with fewer bytes than requested if part of the memory is not accessible. Implementations of SingleThreadBase::read_addrs() cannot make use of that feature. If an implementation writes fewer bytes to the data argument the remaining bytes will be zero.

(Happy to provide a PR for this if you want me to.)

daniel5151 commented 1 year ago

Yep, this is certainly functionality gdbstub should support.

Unfortunately, this will require a breaking API change, as the current read_addrs API returns a TargetResult<(), Self>, whereas we'd want to return a TargetResult<usize, Self>, where the usize indicates the number of bytes written into the read buffer.

The PR should be pretty easy to implement, so if you're interested in taking a shot at getting this working, feel free to open one that targets the dev/0.7 branch!

daniel5151 commented 10 months ago

Closed now that gdbstub 0.7 has been released