v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
gdb-server-thread.h
Go to the documentation of this file.
1// Copyright 2020 the V8 project 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
5#ifndef V8_DEBUG_WASM_GDB_SERVER_GDB_SERVER_THREAD_H_
6#define V8_DEBUG_WASM_GDB_SERVER_GDB_SERVER_THREAD_H_
7
12
13namespace v8 {
14namespace internal {
15namespace wasm {
16namespace gdb_server {
17
18class GdbServer;
19
20// class GdbServerThread spawns a thread where all communication with a debugger
21// happens.
23 public:
24 explicit GdbServerThread(GdbServer* gdb_server);
27
28 // base::Thread
29 void Run() override;
30
31 // Starts the GDB-server thread and waits Run() method is called on the new
32 // thread and the initialization completes.
33 bool StartAndInitialize();
34
35 // Stops the GDB-server thread when the V8 process shuts down; gracefully
36 // closes any active debugging session.
37 void Stop();
38
39 Target& GetTarget() { return *target_; }
40
41 private:
42 void CleanupThread();
43
45
46 // Used to block the caller on StartAndInitialize() waiting for the new thread
47 // to have completed its initialization.
48 // (Note that Thread::StartSynchronously() wouldn't work in this case because
49 // it returns as soon as the new thread starts, but before Run() is called).
51
53 // Protected by {mutex_}:
54 std::unique_ptr<TransportBase> transport_;
55 std::unique_ptr<Target> target_;
56};
57
58} // namespace gdb_server
59} // namespace wasm
60} // namespace internal
61} // namespace v8
62
63#endif // V8_DEBUG_WASM_GDB_SERVER_GDB_SERVER_THREAD_H_
GdbServerThread(const GdbServerThread &)=delete
GdbServerThread & operator=(const GdbServerThread &)=delete
std::unique_ptr< TransportBase > transport_
Definition c-api.cc:87