| // Copyright 2020 The Fuchsia Authors. All rights reserved. | |
| // Use of this source code is governed by a BSD-style license that can be | |
| // found in the LICENSE file. | |
| #include "src/developer/debug/debug_agent/zircon_suspend_handle.h" | |
| #include "src/developer/debug/shared/logging/logging.h" | |
| namespace debug_agent { | |
| ZirconSuspendHandle::ZirconSuspendHandle(zx::suspend_token token, zx_koid_t task_koid, | |
| TaskKind kind) | |
| : token_(std::move(token)), task_koid_(task_koid), kind_(kind) { | |
| switch (kind_) { | |
| case TaskKind::kProcess: { | |
| DEBUG_LOG(Process) << "[P: " << task_koid_ << "] Creating suspend handle."; | |
| break; | |
| } | |
| case TaskKind::kThread: { | |
| DEBUG_LOG(Thread) << "[T: " << task_koid_ << "] Creating suspend handle."; | |
| break; | |
| } | |
| } | |
| } | |
| ZirconSuspendHandle::~ZirconSuspendHandle() { | |
| switch (kind_) { | |
| case TaskKind::kProcess: { | |
| DEBUG_LOG(Process) << "[P: " << task_koid_ << "] Closing suspend handle."; | |
| break; | |
| } | |
| case TaskKind::kThread: { | |
| DEBUG_LOG(Thread) << "[T: " << task_koid_ << "] Closing suspend handle."; | |
| break; | |
| } | |
| } | |
| } | |
| } // namespace debug_agent |