You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The IA32_FS_BASE, IA32_GS_BASE MSRs are commonly used for thread-local storage (e.g., FS on Linux, GS on Windows), so it would be useful to support reporting them back to GDB in some cases.
You'll need to define a custom Registers implementation that includes these additional registers as well:
structX86_64_SegmentsRegs{fs_base:u64,gs_base:u64,}// and then package it up alongside the existing register defnstructX86_64_SSE_SegmentsRegs{core: gdbstub_arch::x86::reg::X86_64CoreRegs,segments:X86_64_SegmentsRegs}
These are all public traits, and can be implemented by types outside of the main gdbstub repo. This makes it easy to get an implementation up-and-running without having to use a custom local version of gdbstub. Once you get something working that you're happy with, feel free to open a PR to upstream it.
Now, while the above solution is all well and good, it does touch upon a larger and long-standing issue in gdbstub that I never found a good time to sort out: what's a good way to support fine-grained control over available target features / registers without requiring a combinatorial explosion of Arch implementations? More details of what I mean in #12.
I bring this up not as a call-to-action, but moreso as a reminder to my future self that I really need to stop kicking this issue down the road, and actually fixing this. After all, at the time of writing, there are 8 different x86 feature sets that can all be (theoretically) mixed and matched: https://sourceware.org/gdb/onlinedocs/gdb/i386-Features.html#i386-Features. Handling all combinations of features would require 8! == 40320 impls, which isn't at all sustainable!
daniel5151
changed the title
[arch][x86] Expose segment base MSRs
[x86] Expose segment base MSRs
Sep 25, 2021
The
IA32_FS_BASE
,IA32_GS_BASE
MSRs are commonly used for thread-local storage (e.g., FS on Linux, GS on Windows), so it would be useful to support reporting them back to GDB in some cases.GDB exposes them as the
fs_base
andgs_base
virtual registers (https://github.com/bminor/binutils-gdb/blob/master/gdb/features/i386/64bit-segments.xml).The text was updated successfully, but these errors were encountered: