Backed out 2 changesets (bug 1452204) for perma failing in memory/replace/dmd/test/test_dmd.js
authorMargareta Eliza Balazs <ebalazs@mozilla.com>
Tue, 05 Jun 2018 11:01:54 +0300
changeset 804151 a47957da1983ecb6d7b3ec323c84ec71421251b6
parent 804150 7cfd6a1fa407af606ae048ea762266ce84332a0e
child 804152 988847e0ed2ec4f3c87fa3cf92c08eb2a1acd18c
child 804678 a13f9589588d6353fa82c1195ef847e0428ce994
push id112312
push userbmo:standard8@mozilla.com
push dateTue, 05 Jun 2018 16:07:56 +0000
bugs1452204
milestone62.0a1
backs out4431cecd4c2d43fedc0acfa5016ef89a583d87b6
72fc40daf6cd1339caef2c9407255027c1f5baec
Backed out 2 changesets (bug 1452204) for perma failing in memory/replace/dmd/test/test_dmd.js Backed out changeset 4431cecd4c2d (bug 1452204) Backed out changeset 72fc40daf6cd (bug 1452204)
mozglue/misc/StackWalk.cpp
--- a/mozglue/misc/StackWalk.cpp
+++ b/mozglue/misc/StackWalk.cpp
@@ -249,19 +249,20 @@ WalkStackMain64(struct WalkStackData* aD
 {
   // Get a context for the specified thread.
   CONTEXT context_buf;
   CONTEXT* context;
   if (!aData->context) {
     context = &context_buf;
     memset(context, 0, sizeof(CONTEXT));
     context->ContextFlags = CONTEXT_FULL;
-    if (aData->walkCallingThread) {
-      ::RtlCaptureContext(context);
-    } else if (!GetThreadContext(aData->thread, context)) {
+    if (!GetThreadContext(aData->thread, context)) {
+      if (aData->walkCallingThread) {
+        PrintError("GetThreadContext");
+      }
       return;
     }
   } else {
     context = aData->context;
   }
 
 #if defined(_M_IX86) || defined(_M_IA64)
   // Setup initial stack frame to walk from.
@@ -501,25 +502,19 @@ MozStackWalkThread(MozWalkStackCallback 
   InitializeDbgHelpCriticalSection();
 
   // EnsureWalkThreadReady's _beginthreadex takes a heap lock and must be
   // avoided if we're walking another (i.e. suspended) thread.
   if (!aThread && !EnsureWalkThreadReady()) {
     return;
   }
 
-  HANDLE targetThread = aThread;
-  if (!aThread) {
-    targetThread = ::GetCurrentThread();
-    data.walkCallingThread = true;
-  } else {
-    DWORD threadId = ::GetThreadId(aThread);
-    DWORD currentThreadId = ::GetCurrentThreadId();
-    data.walkCallingThread = (threadId == currentThreadId);
-  }
+  HANDLE currentThread = ::GetCurrentThread();
+  HANDLE targetThread = aThread ? aThread : currentThread;
+  data.walkCallingThread = (targetThread == currentThread);
 
   // Have to duplicate handle to get a real handle.
   if (!myProcess) {
     if (!::DuplicateHandle(::GetCurrentProcess(),
                            ::GetCurrentProcess(),
                            ::GetCurrentProcess(),
                            &myProcess,
                            PROCESS_ALL_ACCESS, FALSE, 0)) {