Bug 22410
Eliminate CopyContext and related functions to allow for debugging on Vista.
CopyContext is necessary to safely get the XState, but LLDB doesn't currently
use the XState. CopyContext is available as of Windows 7 SP1, so it can't be
used on Vista.
I left the structure of the code to continue to ensure that we're handling
the CONTEXT alignment and so that we can switch back to CopyContext in the
future.
I went to lldb/Host/windows.h to lower NTDDI_VERSION, which specifies the minimum
version of the SDK we use, and found it was already set to NTDDI_VISTA. This
was surprising since the CopyContext function was defined even though it's
inside a #if (NTDDI_VERSION >= NTDDI_WIN7SP1) block in <WinBase.h>. It turns out
that the SDK doesn't define NTDDI_WIN7SP1, so the statement boiled down to
While I was in lldb/Host/windows.h, I eliminated two redundant #undefs.
Is alignment to 16 necessary? I think that's only if you use CopyContext() and InitializeContext(). If you're not using any of the AVX stuff, I don't think it has special alignment requirements. We might be able to get rid of this whole function, and all the cruft associated with the heap buffer, and just store the CONTEXT directly in the class. Note that CONTEXT in WinNT.h is declared with DECLSPEC_ALIGN(8), so I think everything is already taken care of.