Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(838)

Side by Side Diff: src/trusted/debug_stub/win/thread_impl.cc

Issue 6525058: Reverting: Several changes to fix debug_stub:... (issue6489005)... (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/trusted/gdb_rsp/target.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2010 The Native Client Authors. All rights reserved. 2 * Copyright 2010 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can 3 * Use of this source code is governed by a BSD-style license that can
4 * be found in the LICENSE file. 4 * be found in the LICENSE file.
5 */ 5 */
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <windows.h> 8 #include <windows.h>
9 #include <exception> 9 #include <exception>
10 #include <stdexcept> 10 #include <stdexcept>
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 302
303 return true; 303 return true;
304 } 304 }
305 305
306 virtual void* GetContext() { return &context_; } 306 virtual void* GetContext() { return &context_; }
307 307
308 static LONG NTAPI ExceptionCatch(PEXCEPTION_POINTERS ep) { 308 static LONG NTAPI ExceptionCatch(PEXCEPTION_POINTERS ep) {
309 uint32_t id = static_cast<uint32_t>(GetCurrentThreadId()); 309 uint32_t id = static_cast<uint32_t>(GetCurrentThreadId());
310 Thread* thread = static_cast<Thread*>(Acquire(id)); 310 Thread* thread = static_cast<Thread*>(Acquire(id));
311 311
312 // This 2 lineas are a fix for the bug:
313 // 366: Linux GDB doesn't work for Chrome
314 // http://code.google.com/p/nativeclient/issues/detail?id=366
315 // When debug stub thread opens socket to listen (for RSP debugger),
316 // it triggers some component to send DBG_PRINTEXCEPTION(with string
317 // "swi_lsp: non-browser app; disable"), then VEH handler goes into wait
318 // for debugger to resolve exception.
319 // But debugger is not connected, and debug thread is not listening on
320 // connection! It get stuck.
321 // Ignoring this exception - for now - helps debug stub start on chrome.
322 // Now it can listen on RSP connection and can get debugger connected etc.
323 if (DBG_PRINTEXCEPTION_C == ep->ExceptionRecord->ExceptionCode) {
324 return EXCEPTION_CONTINUE_EXECUTION;
325 }
326
327 // If we are not tracking this thread, then ignore it 312 // If we are not tracking this thread, then ignore it
328 if (NULL == thread) return EXCEPTION_CONTINUE_SEARCH; 313 if (NULL == thread) return EXCEPTION_CONTINUE_SEARCH;
329 314
330 State old_state = thread->state_; 315 State old_state = thread->state_;
331 thread->state_ = SIGNALED; 316 thread->state_ = SIGNALED;
332 int8_t sig = ExceptionToSignal(ep->ExceptionRecord->ExceptionCode); 317 int8_t sig = ExceptionToSignal(ep->ExceptionRecord->ExceptionCode);
333 318
334 void *ctx = thread->GetContext(); 319 void *ctx = thread->GetContext();
335 320
336 memcpy(ctx, ep->ContextRecord, sizeof(CONTEXT)); 321 memcpy(ctx, ep->ContextRecord, sizeof(CONTEXT));
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 385
401 // Add the new one, at the front of the list 386 // Add the new one, at the front of the list
402 s_OldCatch = AddVectoredExceptionHandler(1, Thread::ExceptionCatch); 387 s_OldCatch = AddVectoredExceptionHandler(1, Thread::ExceptionCatch);
403 s_CatchFunc = func; 388 s_CatchFunc = func;
404 s_CatchCookie = cookie; 389 s_CatchCookie = cookie;
405 } 390 }
406 391
407 392
408 } // End of port namespace 393 } // End of port namespace
409 394
OLDNEW
« no previous file with comments | « no previous file | src/trusted/gdb_rsp/target.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698