Replies: 3 comments 9 replies
-
To implement this, we need to replace all the fn gdb_serialize(&self, mut buf: &mut [u8]) {
for reg in self.r.iter() {
buf.write_u32::<LittleEndian>(*reg).unwrap();
}
...
} |
Beta Was this translation helpful? Give feedback.
-
Ahh shoot, you know what, I totally remembered why I used the callback approach vs. writing data into the buffer. The GDB spec allows returning The current callback API supports this use-case by allowing the implementation to call See https://github.com/daniel5151/gdbstub/blob/0db1406/gdbstub_arch/src/arm/reg/arm_core.rs#L44-L46 for an example of this being used. This is an important bit of functionality, since returning a dummy value for those registers (e.g: I don't have a great solution for how your proposed API would handle this. Maybe you could have some kind of extra return value from But also, taking a step back for a second: is there any pressing need to make this API change? The current So, aside from the argument of "code elegance" of composing data in a output buffer vs. using a callback (which might not even hold true, given the aforementioned |
Beta Was this translation helpful? Give feedback.
-
Note that this refactor might not even be worth doing, depending on the outcome of #90. i.e: there's a chance that the entire notion of having a separate |
Beta Was this translation helpful? Give feedback.
-
Currently the
gdb_serialize
function takes awrite_byte
callback to send packet out. As discussion in #70 , it's better to replace the callback withPacketBuf
, collect all the registers in this buffer and send them out together.Beta Was this translation helpful? Give feedback.
All reactions