-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add x86_64 support #11
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, I appreciate it!
I mention in one of the inline comments that you've mixed in some SSE extensions in with the core registers. My guess would be that just setting i386:x86-64
in the target description XML doesn't give GDB enough info about the system, and will simply assume that the system includes SSE registers as well. This is just a guess though, and I could be wrong...
For correctness, you may want to adjust the target description XML to include a <feature name="org.gnu.gdb.i386.sse">
tag (see the Target Description Format docs and i386 features).
Truth be told, I haven't put too much thought into the best way to support these sorts of fine-grained architecture-specific feature toggles in gdbstub
. It would probably require a rework of the Arch
trait itself... That's not really something that can be addressed in this PR though, so I'll just open an issue up for it and possibly look into it at some point down the line.
As for naming, I'm hoping to keep things somewhat consistent with the gdb
source tree, namely, the definitions present under gdb/features
(https://github.com/bminor/binutils-gdb/tree/master/gdb/features). It seems like the relevant file for x86-64 would be https://github.com/bminor/binutils-gdb/blob/master/gdb/features/i386/64bit-core.xml
.
That said, using i386
everywhere would be quite ugly, so i'm cool with using x86
instead, for clarity's sake.
And while Amd64CoreRegs
definitely looks nicer than X86_64CoreRegs
, I think it'd be best to use the latter name, for consistency's sake. Similarly, amd64_core.rs
aught to be renamed to x86_64_core.rs
(or even just core64.rs
, since it's a submodule of x86
).
Also thanks for the quick and thorough review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing all the comments!
I had a few more nits and notes, but I think this this is very close to getting merged!
p.s: not sure how helpful this might be, but it might be worth checking out how other gdbstub implementation (written in C) have added x86 support. Notably, the official https://github.com/facebookarchive/binutils/tree/master/gdb/gdbserver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work! I've just jotted down 2 final nits, but other than that, it LGTM.
Thanks again!
When I get the chance, I'll bump the version and push to crates.io (sometime today / tomorrow). |
One potential concern is the naming, which I'm fine with changing. Currently I have:
module:
x86
Arch struct:
X86_64
Registers struct: Amd64CoreRegs