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
8
#include "
src/base/platform/platform.h
"
9
#include "
src/base/platform/semaphore.h
"
10
#include "
src/debug/wasm/gdb-server/target.h
"
11
#include "
src/debug/wasm/gdb-server/transport.h
"
12
13
namespace
v8
{
14
namespace
internal
{
15
namespace
wasm
{
16
namespace
gdb_server {
17
18
class
GdbServer;
19
20
// class GdbServerThread spawns a thread where all communication with a debugger
21
// happens.
22
class
GdbServerThread
:
public
v8::base::Thread
{
23
public
:
24
explicit
GdbServerThread
(
GdbServer
* gdb_server);
25
GdbServerThread
(
const
GdbServerThread
&) =
delete
;
26
GdbServerThread
&
operator=
(
const
GdbServerThread
&) =
delete
;
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
44
GdbServer
*
gdb_server_
;
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).
50
base::Semaphore
start_semaphore_
;
51
52
base::Mutex
mutex_
;
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_
v8::base::Mutex
Definition
mutex.h:36
v8::base::Semaphore
Definition
semaphore.h:41
v8::base::Thread
Definition
platform.h:533
v8::internal::wasm::gdb_server::GdbServerThread
Definition
gdb-server-thread.h:22
v8::internal::wasm::gdb_server::GdbServerThread::Run
void Run() override
Definition
gdb-server-thread.cc:52
v8::internal::wasm::gdb_server::GdbServerThread::GdbServerThread
GdbServerThread(const GdbServerThread &)=delete
v8::internal::wasm::gdb_server::GdbServerThread::start_semaphore_
base::Semaphore start_semaphore_
Definition
gdb-server-thread.h:50
v8::internal::wasm::gdb_server::GdbServerThread::Stop
void Stop()
Definition
gdb-server-thread.cc:100
v8::internal::wasm::gdb_server::GdbServerThread::gdb_server_
GdbServer * gdb_server_
Definition
gdb-server-thread.h:44
v8::internal::wasm::gdb_server::GdbServerThread::mutex_
base::Mutex mutex_
Definition
gdb-server-thread.h:52
v8::internal::wasm::gdb_server::GdbServerThread::target_
std::unique_ptr< Target > target_
Definition
gdb-server-thread.h:55
v8::internal::wasm::gdb_server::GdbServerThread::operator=
GdbServerThread & operator=(const GdbServerThread &)=delete
v8::internal::wasm::gdb_server::GdbServerThread::CleanupThread
void CleanupThread()
Definition
gdb-server-thread.cc:40
v8::internal::wasm::gdb_server::GdbServerThread::GetTarget
Target & GetTarget()
Definition
gdb-server-thread.h:39
v8::internal::wasm::gdb_server::GdbServerThread::transport_
std::unique_ptr< TransportBase > transport_
Definition
gdb-server-thread.h:54
v8::internal::wasm::gdb_server::GdbServerThread::GdbServerThread
GdbServerThread(GdbServer *gdb_server)
Definition
gdb-server-thread.cc:16
v8::internal::wasm::gdb_server::GdbServerThread::StartAndInitialize
bool StartAndInitialize()
Definition
gdb-server-thread.cc:21
v8::internal::wasm::gdb_server::GdbServer
Definition
gdb-server.h:25
v8::internal::wasm::gdb_server::Target
Definition
target.h:27
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8
Definition
api-arguments-inl.h:19
wasm
Definition
c-api.cc:87
semaphore.h
platform.h
target.h
transport.h
src
debug
wasm
gdb-server
gdb-server-thread.h
Generated on Sun Apr 6 2025 21:08:53 for v8 by
1.12.0