Skip to content
This repository has been archived by the owner on Feb 1, 2020. It is now read-only.

Commit

Permalink
Fix memset issues in user_to_state32 and state32_to_user.
Browse files Browse the repository at this point in the history
This was causing writeCPUState to fail on Windows because we were
clearing the flags after setting them.
  • Loading branch information
sas committed May 2, 2016
1 parent 65bb303 commit 1ac7dbe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions Headers/DebugServer2/Architecture/X86/RegisterCopy.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ static inline void user_to_state32(StateType &state,
template <typename UserStructType, typename StateType>
static inline void state32_to_user(UserStructType &user,
StateType const &state) {
std::memset(&user, 0, sizeof(user));
DO_COPY_GPR_32();
DO_COPY_SS();
DO_COPY_EXTRA_32();
Expand All @@ -155,7 +154,6 @@ static inline void user_to_state64(StateType &state,
template <typename UserStructType, typename StateType>
static inline void state64_to_user(UserStructType &user,
StateType const &state) {
std::memset(&user, 0, sizeof(user));
DO_COPY_GPR_64();
DO_COPY_SS();
DO_COPY_EXTRA_64();
Expand Down
4 changes: 2 additions & 2 deletions Sources/Target/Windows/X86/ThreadX86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ErrorCode Thread::step(int signal, Address const &address) {
ErrorCode Thread::readCPUState(Architecture::CPUState &state) {
CONTEXT context;

memset(&context, 0, sizeof(context));
std::memset(&context, 0, sizeof(context));
// TODO(sas): Handle AVX.
context.ContextFlags = CONTEXT_INTEGER | // GP registers.
CONTEXT_CONTROL | // Some more GP + cs/ss.
Expand Down Expand Up @@ -102,7 +102,7 @@ ErrorCode Thread::readCPUState(Architecture::CPUState &state) {
ErrorCode Thread::writeCPUState(Architecture::CPUState const &state) {
CONTEXT context;

memset(&context, 0, sizeof(context));
std::memset(&context, 0, sizeof(context));
// TODO(sas): Handle floats, SSE, AVX and debug registers.
context.ContextFlags = CONTEXT_INTEGER | // GP registers.
CONTEXT_CONTROL | // Some more GP + cs/ss.
Expand Down

0 comments on commit 1ac7dbe

Please sign in to comment.