v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
session.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_SESSION_H_
6
#define V8_DEBUG_WASM_GDB_SERVER_SESSION_H_
7
8
#include "
src/base/macros.h
"
9
10
namespace
v8
{
11
namespace
internal
{
12
namespace
wasm
{
13
namespace
gdb_server {
14
15
class
Packet;
16
class
TransportBase;
17
18
// Represents a gdb-remote debugging session.
19
class
V8_EXPORT_PRIVATE
Session
{
20
public
:
21
explicit
Session
(
TransportBase
* transport);
22
Session
(
const
Session
&) =
delete
;
23
Session
&
operator=
(
const
Session
&) =
delete
;
24
25
// Attempt to send a packet and optionally wait for an ACK from the receiver.
26
bool
SendPacket(
Packet
* packet,
bool
expect_ack =
true
);
27
28
// Attempt to receive a packet.
29
bool
GetPacket(
Packet
* packet);
30
31
// Return true if there is data to read.
32
bool
IsDataAvailable()
const
;
33
34
// Return true if the connection is still valid.
35
bool
IsConnected()
const
;
36
37
// Shutdown the connection.
38
void
Disconnect();
39
40
// When a debugging session is active, the GDB-remote thread can block waiting
41
// for events and it will resume execution when one of these two events arise:
42
// - A network event (a new packet arrives, or the connection is dropped)
43
// - A thread event (the execution stopped because of a trap or breakpoint).
44
void
WaitForDebugStubEvent();
45
46
// Signal that the debuggee execution stopped because of a trap or breakpoint.
47
bool
SignalThreadEvent();
48
49
// By default, when either the debugger or the GDB-stub sends a packet,
50
// the first response expected is an acknowledgment: either '+' (to indicate
51
// the packet was received correctly) or '-' (to request retransmission).
52
// When a transport is reliable, the debugger may request that acknowledgement
53
// be disabled by means of the 'QStartNoAckMode' packet.
54
void
EnableAck
(
bool
ack_enabled) { ack_enabled_ = ack_enabled; }
55
56
private
:
57
// Read a single character from the transport.
58
bool
GetChar(
char
* ch);
59
60
// Read the content of a packet, from a leading '$' to a trailing '#'.
61
bool
GetPayload(
Packet
* pkt, uint8_t* checksum);
62
63
TransportBase
*
io_
;
// Transport object not owned by the Session.
64
bool
connected_
;
// Is the connection still valid.
65
bool
ack_enabled_
;
// If true, emit or wait for '+' from RSP stream.
66
};
67
68
}
// namespace gdb_server
69
}
// namespace wasm
70
}
// namespace internal
71
}
// namespace v8
72
73
#endif
// V8_DEBUG_WASM_GDB_SERVER_SESSION_H_
v8::internal::wasm::gdb_server::Packet
Definition
packet.h:17
v8::internal::wasm::gdb_server::Session
Definition
session.h:19
v8::internal::wasm::gdb_server::Session::operator=
Session & operator=(const Session &)=delete
v8::internal::wasm::gdb_server::Session::Session
Session(const Session &)=delete
v8::internal::wasm::gdb_server::Session::EnableAck
void EnableAck(bool ack_enabled)
Definition
session.h:54
v8::internal::wasm::gdb_server::Session::io_
TransportBase * io_
Definition
session.h:63
v8::internal::wasm::gdb_server::Session::ack_enabled_
bool ack_enabled_
Definition
session.h:65
v8::internal::wasm::gdb_server::Session::connected_
bool connected_
Definition
session.h:64
v8::internal::wasm::gdb_server::TransportBase
Definition
transport.h:72
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8
Definition
api-arguments-inl.h:19
wasm
Definition
c-api.cc:87
macros.h
V8_EXPORT_PRIVATE
#define V8_EXPORT_PRIVATE
Definition
macros.h:460
src
debug
wasm
gdb-server
session.h
Generated on Sun Apr 6 2025 21:08:53 for v8 by
1.12.0