This is an archive of the discontinued LLVM Phabricator instance.

Implement a RegisterContext for Windows and hook it up to TargetThreadWindows
ClosedPublic

Authored by zturner on Nov 19 2014, 10:45 AM.

Details

Summary

This provides a very basic implementation of RegisterContext for Windows. It supports only General Purpose Registers, and only x86. In future patches we will add support for all of these things, as well as add an additional value to the RegisterKind enumeration for MSVC, since MSVC generated binaries have their own ABI and thusly their own encoding for register numbers.

The idea behind this patch is simply to make sure RegisterContext is being implemented and tied into the Process plugin and the Thread class correctly from a high level, and OS / platform specific details can be filled in more completely later so I tried to keep the patch simple and general enough it can be reviewed without knowledge of Windows.

Diff Detail

Repository
rL LLVM

Event Timeline

zturner updated this revision to Diff 16391.Nov 19 2014, 10:45 AM
zturner retitled this revision from to Implement a RegisterContext for Windows and hook it up to TargetThreadWindows.
zturner updated this object.
zturner edited the test plan for this revision. (Show Details)
zturner added a reviewer: clayborg.
zturner added a subscriber: Unknown Object (MLST).
zturner added inline comments.
source/Plugins/Process/Windows/RegisterContextWindows_x86.cpp
43–49 ↗(On Diff #16391)

Hah, looks like a funny side effect of clang-format (probably because I put the comma in the macro definition). I will fix this.

zturner updated this revision to Diff 16399.Nov 19 2014, 1:59 PM

Fixed an issue where I misunderstood the purpose of RegisterContext::GetRegisterContext()

zturner added inline comments.Nov 19 2014, 5:39 PM
source/Plugins/Process/Windows/RegisterContextWindows_x86.cpp
27–31 ↗(On Diff #16399)

Note that dwarf_eax_i386 here should be dwarf_reg_i386. I've fixed this locally.

clayborg accepted this revision.Nov 20 2014, 12:31 PM
clayborg edited edge metadata.

We recently started using "override" in many places. I spoke with our C++ guys on the clang team and they agree that if you use the override key word that we should remove the virtual keyword, so we should fix this on new commits like this one.

Other than that it looks good. I don't understand the comment:

For now we're only supporting general purpose registers. Unfortunately we have to maintain
parallel arrays since that's how the RegisterContext interface expects things to be returned.
We might be able to fix this by initializing these arrays at runtime during the construction of
the RegisterContext by using helper functions that can update multiple arrays, register sets,
// etc all at once through a more easily understandable interface.

Feel free to contact me offline for further comment.

This revision is now accepted and ready to land.Nov 20 2014, 12:31 PM
zturner closed this revision.Nov 20 2014, 2:48 PM
zturner updated this revision to Diff 16452.

Closed by commit rL222474 (authored by @zturner).