Implement X packet for gdbstub.#82
Conversation
|
Well shoot, that was fast 😅 It's 11:00pm here in seattle, and while I was going to head off to bed, I guess I'll just leave this comment right now... Yep, that's pretty much the code I expected. Nice! My immediate follow-up thought is whether or not this "optimization" packet should be part of the "required" base packets, or if there ought to be some way to "opt-in" to it (or more likely, "opt-out" of it). After all, this current implementation will unconditionally add quite a bit of extra binary bloat to the base Instead... I think it might make sense to do something a bit more clever, whereby we recycle some of the IDET infrastructure to make trait Target {
// ...
#[inline(always)]
fn use_X_packet(&self) -> bool { true } // on by default
}Note that this wouldn't be a fully-fledged IDET, but Admittedly, this will add some complexity to an otherwise simple PR, but the more I think about it, the more I feel like this should probably be the approach we take here... Feel free to take a crack at this, though there's a non-zero chance I'll end up pushing to this PR directly myself sometime this weekend... |
|
Alright, I pushed up some changes. Could you pull these changes down and make sure everything still works? I'd also appreciate it if you could quickly sanity-check that overriding the |
|
Oh no, don't do this. Why such a basic command is set to optional?
I think you are insane about the size of binary. Is the size more important than correctness or elegance?
In fact, GDB wants to write memory with |
|
@bet4it the following excerpt from the spec should answer your questions:
https://sourceware.org/gdb/onlinedocs/gdb/Overview.html#Overview Making
I'm not sure if you've noticed yet, but That said, this is still my project, so for the time being, I will continue to keep binary size as an important part of the project - even if it requires a less "elegant" internal code :) EDIT: ah, and thank you for the explanation re: the zero-length write. This makes sense :) |
|
If you care so much about the size, why you implement RLE? |
|
I actually do have a TODO to see if I can make RLE optional 😉: https://github.com/daniel5151/gdbstub/blob/dev/0.6/src/protocol/response_writer.rs#L26 As a broader point, it's important to remember that If I were writing this library with deadlines + deliverables in mind, I would be taking a very different approach to the overall library design 😄 Anyways, to get back on track: @gz is this good to merge? Everything seems to be working as expected? |
|
Tried it on my (still a bit broken implementation) but X packets arrived (or not) depending on what's returned in use_x_upcase_packet |
|
Yep, that's fine. The GDB client is allowed to probe for the existence of the packet, so it'll send it unconditionally (whether it's implemented or not). If the target responds with a non-empty packet, that means it supports the Basically, I just wanted to double check that if the |
|
So... does the 👍 mean that things are confirmed working, and this is ready to merge? |
|
Ah yes,things are working. Sorry if I wasnt clear earlier! |
Description
Closes #81
API Stability
Checklist
cargo buildcompiles withouterrorsorwarningscargo clippyruns withouterrorsorwarningscargo fmtwas run