OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 #include "debugger/core/debuggee_thread.h" | |
5 #include "debugger/core/debug_api.h" | |
6 #include <signal.h> | |
7 | |
8 namespace debug { | |
9 DebuggeeThread::DebuggeeThread(int id, DebugAPI* debug_api) | |
10 : id_(id), | |
11 state_(RUNNING), | |
12 debug_api_(debug_api) { | |
13 } | |
14 | |
15 DebugAPI& DebuggeeThread::debug_api() { | |
16 return *debug_api_; | |
17 } | |
18 | |
19 bool DebuggeeThread::Continue() { | |
20 if (RUNNING == state_) | |
21 return false; | |
22 | |
23 int signal_to_pass = last_debug_event_.signal_no_; | |
24 if (SIGTRAP == signal_to_pass) // TODO: shall we pass 0 for SIGSTOP too? | |
25 signal_to_pass = 0; | |
26 | |
27 bool res = debug_api().ContinueDebugEvent(id_, signal_to_pass); | |
28 if (res) | |
29 state_ = RUNNING; | |
30 return res; | |
31 } | |
32 | |
33 void DebuggeeThread::OnDebugEvent(const DebugEvent& debug_event) { | |
34 last_debug_event_ = debug_event; | |
35 state_ = debug_event.process_state_; | |
36 } | |
37 | |
38 } // namespace debug | |
39 | |
OLD | NEW |