vsk updated this revision to Diff 125639.
vsk edited the summary of this revision.
vsk added a comment.

- Address Greg's comments.


https://reviews.llvm.org/D40821

Files:
  source/Plugins/Process/Utility/RegisterContextMach_arm.cpp
  source/Plugins/Process/Utility/RegisterContextMach_i386.cpp
  source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp

Index: source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp
===================================================================
--- source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp
+++ source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp
@@ -46,17 +46,23 @@
 
 int RegisterContextMach_x86_64::DoWriteGPR(lldb::tid_t tid, int flavor,
                                            const GPR &gpr) {
-  return ::thread_set_state(tid, flavor, (thread_state_t)&gpr, GPRWordCount);
+  return ::thread_set_state(
+      tid, flavor, reinterpret_cast<thread_state_t>(const_cast<GPR *>(&gpr)),
+      GPRWordCount);
 }
 
 int RegisterContextMach_x86_64::DoWriteFPU(lldb::tid_t tid, int flavor,
                                            const FPU &fpu) {
-  return ::thread_set_state(tid, flavor, (thread_state_t)&fpu, FPUWordCount);
+  return ::thread_set_state(
+      tid, flavor, reinterpret_cast<thread_state_t>(const_cast<FPU *>(&fpu)),
+      FPUWordCount);
 }
 
 int RegisterContextMach_x86_64::DoWriteEXC(lldb::tid_t tid, int flavor,
                                            const EXC &exc) {
-  return ::thread_set_state(tid, flavor, (thread_state_t)&exc, EXCWordCount);
+  return ::thread_set_state(
+      tid, flavor, reinterpret_cast<thread_state_t>(const_cast<EXC *>(&exc)),
+      EXCWordCount);
 }
 
 #endif
Index: source/Plugins/Process/Utility/RegisterContextMach_i386.cpp
===================================================================
--- source/Plugins/Process/Utility/RegisterContextMach_i386.cpp
+++ source/Plugins/Process/Utility/RegisterContextMach_i386.cpp
@@ -43,17 +43,23 @@
 
 int RegisterContextMach_i386::DoWriteGPR(lldb::tid_t tid, int flavor,
                                          const GPR &gpr) {
-  return ::thread_set_state(tid, flavor, (thread_state_t)&gpr, GPRWordCount);
+  return ::thread_set_state(
+      tid, flavor, reinterpret_cast<thread_state_t>(const_cast<GPR *>(&gpr)),
+      GPRWordCount);
 }
 
 int RegisterContextMach_i386::DoWriteFPU(lldb::tid_t tid, int flavor,
                                          const FPU &fpu) {
-  return ::thread_set_state(tid, flavor, (thread_state_t)&fpu, FPUWordCount);
+  return ::thread_set_state(
+      tid, flavor, reinterpret_cast<thread_state_t>(const_cast<FPU *>(&fpu)),
+      FPUWordCount);
 }
 
 int RegisterContextMach_i386::DoWriteEXC(lldb::tid_t tid, int flavor,
                                          const EXC &exc) {
-  return ::thread_set_state(tid, flavor, (thread_state_t)&exc, EXCWordCount);
+  return ::thread_set_state(
+      tid, flavor, reinterpret_cast<thread_state_t>(const_cast<EXC *>(&exc)),
+      EXCWordCount);
 }
 
 #endif
Index: source/Plugins/Process/Utility/RegisterContextMach_arm.cpp
===================================================================
--- source/Plugins/Process/Utility/RegisterContextMach_arm.cpp
+++ source/Plugins/Process/Utility/RegisterContextMach_arm.cpp
@@ -50,22 +50,30 @@
 
 int RegisterContextMach_arm::DoWriteGPR(lldb::tid_t tid, int flavor,
                                         const GPR &gpr) {
-  return ::thread_set_state(tid, flavor, (thread_state_t)&gpr, GPRWordCount);
+  return ::thread_set_state(
+      tid, flavor, reinterpret_cast<thread_state_t>(const_cast<GPR *>(&gpr)),
+      GPRWordCount);
 }
 
 int RegisterContextMach_arm::DoWriteFPU(lldb::tid_t tid, int flavor,
                                         const FPU &fpu) {
-  return ::thread_set_state(tid, flavor, (thread_state_t)&fpu, FPUWordCount);
+  return ::thread_set_state(
+      tid, flavor, reinterpret_cast<thread_state_t>(const_cast<FPU *>(&fpu)),
+      FPUWordCount);
 }
 
 int RegisterContextMach_arm::DoWriteEXC(lldb::tid_t tid, int flavor,
                                         const EXC &exc) {
-  return ::thread_set_state(tid, flavor, (thread_state_t)&exc, EXCWordCount);
+  return ::thread_set_state(
+      tid, flavor, reinterpret_cast<thread_state_t>(const_cast<EXC *>(&exc)),
+      EXCWordCount);
 }
 
 int RegisterContextMach_arm::DoWriteDBG(lldb::tid_t tid, int flavor,
                                         const DBG &dbg) {
-  return ::thread_set_state(tid, flavor, (thread_state_t)&dbg, DBGWordCount);
+  return ::thread_set_state(
+      tid, flavor, reinterpret_cast<thread_state_t>(const_cast<DBG *>(&dbg)),
+      DBGWordCount);
 }
 
 #endif
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to