LLDB mainline
GDBRemoteCommunicationClient.h
Go to the documentation of this file.
1//===-- GDBRemoteCommunicationClient.h --------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTECOMMUNICATIONCLIENT_H
10#define LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTECOMMUNICATIONCLIENT_H
11
12#include "GDBRemoteClientBase.h"
13
14#include <chrono>
15#include <map>
16#include <mutex>
17#include <optional>
18#include <string>
19#include <vector>
20
21#include "lldb/Host/File.h"
30#include "lldb/Utility/UUID.h"
31#if defined(_WIN32)
33#endif
34
35#include "llvm/Support/VersionTuple.h"
36
37namespace lldb_private {
38namespace process_gdb_remote {
39
40/// The offsets used by the target when relocating the executable. Decoded from
41/// qOffsets packet response.
42struct QOffsets {
43 /// If true, the offsets field describes segments. Otherwise, it describes
44 /// sections.
46
47 /// The individual offsets. Section offsets have two or three members.
48 /// Segment offsets have either one of two.
49 std::vector<uint64_t> offsets;
50};
51inline bool operator==(const QOffsets &a, const QOffsets &b) {
52 return a.segments == b.segments && a.offsets == b.offsets;
53}
54llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const QOffsets &offsets);
55
56// A trivial struct used to return a pair of PID and TID.
57struct PidTid {
58 uint64_t pid;
59 uint64_t tid;
60};
61
63public:
65
67
68 // After connecting, send the handshake to the server to make sure
69 // we are communicating with it.
70 bool HandshakeWithServer(Status *error_ptr);
71
73
74 // This packet is usually sent first and the boolean return value
75 // indicates if the packet was send and any response was received
76 // even in the response is UNIMPLEMENTED. If the packet failed to
77 // get a response, then false is returned. This quickly tells us
78 // if we were able to connect and communicate with the remote GDB
79 // server
81
83
84 lldb::pid_t GetCurrentProcessID(bool allow_lazy = true);
85
86 bool LaunchGDBServer(const char *remote_accept_hostname, lldb::pid_t &pid,
87 uint16_t &port, std::string &socket_name);
88
89 size_t QueryGDBServer(
90 std::vector<std::pair<uint16_t, std::string>> &connection_urls);
91
93
94 /// Launch the process using the provided arguments.
95 ///
96 /// \param[in] args
97 /// A list of program arguments. The first entry is the program being run.
98 llvm::Error LaunchProcess(const Args &args);
99
100 /// Sends a "QEnvironment:NAME=VALUE" packet that will build up the
101 /// environment that will get used when launching an application
102 /// in conjunction with the 'A' packet. This function can be called
103 /// multiple times in a row in order to pass on the desired
104 /// environment that the inferior should be launched with.
105 ///
106 /// \param[in] name_equal_value
107 /// A NULL terminated C string that contains a single environment
108 /// in the format "NAME=VALUE".
109 ///
110 /// \return
111 /// Zero if the response was "OK", a positive value if the
112 /// the response was "Exx" where xx are two hex digits, or
113 /// -1 if the call is unsupported or any other unexpected
114 /// response was received.
115 int SendEnvironmentPacket(char const *name_equal_value);
116 int SendEnvironment(const Environment &env);
117
118 int SendLaunchArchPacket(const char *arch);
119
120 int SendLaunchEventDataPacket(const char *data,
121 bool *was_supported = nullptr);
122
123 /// Sends a GDB remote protocol 'I' packet that delivers stdin
124 /// data to the remote process.
125 ///
126 /// \param[in] data
127 /// A pointer to stdin data.
128 ///
129 /// \param[in] data_len
130 /// The number of bytes available at \a data.
131 ///
132 /// \param[in] interrupt_timeout
133 /// If the inferior is running, how long to wait for a `\x03` BREAK
134 /// to interrupt it before giving up. Pass zero only when the caller knows
135 /// the inferior is stopped.
136 ///
137 /// \return
138 /// Zero if the attach was successful, or an error indicating
139 /// an error code.
141 const char *data, size_t data_len,
142 std::chrono::seconds interrupt_timeout = std::chrono::seconds(0));
143
144 /// Sets the path to use for stdin/out/err for a process
145 /// that will be launched with the 'A' packet.
146 ///
147 /// \param[in] file_spec
148 /// The path to use for stdin/out/err
149 ///
150 /// \return
151 /// Zero if the for success, or an error code for failure.
152 int SetSTDIN(const FileSpec &file_spec);
153 int SetSTDOUT(const FileSpec &file_spec);
154 int SetSTDERR(const FileSpec &file_spec);
155
156 /// Send the dimensions of the user's stdio terminal window to the server.
157 int SetSTDIOWindowSize(uint16_t cols, uint16_t rows);
158
159 /// Sets the disable ASLR flag to \a enable for a process that will
160 /// be launched with the 'A' packet.
161 ///
162 /// \param[in] enable
163 /// A boolean value indicating whether to disable ASLR or not.
164 ///
165 /// \return
166 /// Zero if the for success, or an error code for failure.
167 int SetDisableASLR(bool enable);
168
169 /// Sets the DetachOnError flag to \a enable for the process controlled by the
170 /// stub.
171 ///
172 /// \param[in] enable
173 /// A boolean value indicating whether to detach on error or not.
174 ///
175 /// \return
176 /// Zero if the for success, or an error code for failure.
177 int SetDetachOnError(bool enable);
178
179 /// Sets the working directory to \a path for a process that will
180 /// be launched with the 'A' packet for non platform based
181 /// connections. If this packet is sent to a GDB server that
182 /// implements the platform, it will change the current working
183 /// directory for the platform process.
184 ///
185 /// \param[in] working_dir
186 /// The path to a directory to use when launching our process
187 ///
188 /// \return
189 /// Zero if the for success, or an error code for failure.
190 int SetWorkingDir(const FileSpec &working_dir);
191
192 /// Gets the current working directory of a remote platform GDB
193 /// server.
194 ///
195 /// \param[out] working_dir
196 /// The current working directory on the remote platform.
197 ///
198 /// \return
199 /// Boolean for success
200 bool GetWorkingDir(FileSpec &working_dir);
201
202 lldb::addr_t AllocateMemory(size_t size, uint32_t permissions);
203
205
206 Status Detach(bool keep_stopped, lldb::pid_t pid = LLDB_INVALID_PROCESS_ID);
207
209
210 std::optional<uint32_t> GetWatchpointSlotCount();
211
212 std::optional<bool> GetWatchpointReportedAfter();
213
214 WatchpointHardwareFeature GetSupportedWatchpointTypes();
215
217
218 std::chrono::seconds GetHostDefaultPacketTimeout();
219
221
223 bool &value_is_offset);
224
225 std::vector<lldb::addr_t> GetProcessStandaloneBinaries();
226
227 /// Empty if the server does not support "jAddressSpacesInfo".
228 std::vector<AddressSpaceInfo> GetAddressSpaces();
229
230 /// Whether the server advertised address-space support ("address-spaces+").
232
233 void GetRemoteQSupported();
234
235 bool GetVContSupported(llvm::StringRef flavor);
236
238
239 enum class xPacketState {
241 Prefixed, // Successful responses start with a 'b' character. This is the
242 // style used by GDB.
243 Bare, // No prefix, packets starts with the memory being read. This is
244 // LLDB's original style.
245 };
247
249
251
252 void ResetDiscoverableSettings(bool did_exec);
253
254 bool GetHostInfo(bool force = false);
255
257
258 llvm::VersionTuple GetOSVersion();
259
260 llvm::VersionTuple GetMacCatalystVersion();
261
262 std::optional<std::string> GetOSBuildString();
263
264 std::optional<std::string> GetOSKernelDescription();
265
267
269
270 bool GetHostname(std::string &s);
271
273
274 bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &process_info);
275
276 uint32_t FindProcesses(const ProcessInstanceInfoMatch &process_match_info,
277 ProcessInstanceInfoList &process_infos);
278
279 bool GetUserName(uint32_t uid, std::string &name);
280
281 bool GetGroupName(uint32_t gid, std::string &name);
282
284
285 bool HasAnyVContSupport() { return GetVContSupported("a"); }
286
288
290
292 switch (type) {
294 return m_supports_z0;
296 return m_supports_z1;
297 case eWatchpointWrite:
298 return m_supports_z2;
299 case eWatchpointRead:
300 return m_supports_z3;
302 return m_supports_z4;
303 default:
304 return false;
305 }
306 }
307
309 GDBStoppointType type, // Type of breakpoint or watchpoint
310 bool insert, // Insert or remove?
311 lldb::addr_t addr, // Address of breakpoint or watchpoint
312 uint32_t length, // Byte Size of breakpoint or watchpoint
313 std::chrono::seconds interrupt_timeout); // Time to wait for an interrupt
314
315 void TestPacketSpeed(const uint32_t num_packets, uint32_t max_send,
316 uint32_t max_recv, uint64_t recv_amount, bool json,
317 Stream &strm);
318
319 // This packet is for testing the speed of the interface only. Both
320 // the client and server need to support it, but this allows us to
321 // measure the packet speed without any other work being done on the
322 // other end and avoids any of that work affecting the packet send
323 // and response times.
324 bool SendSpeedTestPacket(uint32_t send_size, uint32_t recv_size);
325
326 std::optional<PidTid> SendSetCurrentThreadPacket(uint64_t tid, uint64_t pid,
327 char op);
328
329 bool SetCurrentThread(uint64_t tid,
331
332 bool SetCurrentThreadForRun(uint64_t tid,
334
336
338
340
342
343 uint64_t GetRemoteMaxPacketSize();
344
345 bool GetEchoSupported();
346
348
350
352
354
356
358
360
362
364
366
368
369 /// Whether the WebAssembly stub can be told which module instance to read
370 /// from, which it advertises with "qWasmInstance+" in its qSupported
371 /// response.
373
374 /// Send the "jAcceleratorPluginInitialize" packet and return the actions
375 /// requested by each accelerator plugin installed in lldb-server. The packet
376 /// is only sent if the lldb-server advertised accelerator plugin support via
377 /// "accelerator-plugins+" in its qSupported response; otherwise (and when no
378 /// plugin returns actions) this returns an empty vector. Errors are returned
379 /// for the caller to report.
380 llvm::Expected<std::vector<AcceleratorActions>>
382
383 /// Send the "jAcceleratorPluginBreakpointHit" packet to notify the
384 /// accelerator plugin that one of its requested breakpoints was hit, and
385 /// return the plugin's response. This is only used when the lldb-server
386 /// advertised accelerator plugin support via "accelerator-plugins+" in its
387 /// qSupported response, since the breakpoints that trigger it are only set in
388 /// that case. Errors are returned for the caller to report.
389 llvm::Expected<AcceleratorBreakpointHitResponse>
391
393 {
394 // Uncomment this to have lldb pretend the debug server doesn't respond to
395 // alloc/dealloc memory packets.
396 // m_supports_alloc_dealloc_memory = lldb_private::eLazyBoolNo;
398 }
399
400 std::vector<std::pair<lldb::pid_t, lldb::tid_t>>
401 GetCurrentProcessAndThreadIDs(bool &sequence_mutex_unavailable);
402
403 size_t GetCurrentThreadIDs(std::vector<lldb::tid_t> &thread_ids,
404 bool &sequence_mutex_unavailable);
405
406 lldb::user_id_t OpenFile(const FileSpec &file_spec, File::OpenOptions flags,
407 mode_t mode, Status &error);
408
410
411 std::optional<GDBRemoteFStatData> FStat(lldb::user_id_t fd);
412
413 // NB: this is just a convenience wrapper over open() + fstat(). It does not
414 // work if the file cannot be opened.
415 std::optional<GDBRemoteFStatData> Stat(const FileSpec &file_spec);
416
417 lldb::user_id_t GetFileSize(const FileSpec &file_spec);
418
420 bool only_dir);
421
422 Status GetFilePermissions(const FileSpec &file_spec,
423 uint32_t &file_permissions);
424
425 Status SetFilePermissions(const FileSpec &file_spec,
426 uint32_t file_permissions);
427
428 uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst,
429 uint64_t dst_len, Status &error);
430
431 uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src,
432 uint64_t src_len, Status &error);
433
434 Status CreateSymlink(const FileSpec &src, const FileSpec &dst);
435
436 Status Unlink(const FileSpec &file_spec);
437
438 Status MakeDirectory(const FileSpec &file_spec, uint32_t mode);
439
440 bool GetFileExists(const FileSpec &file_spec);
441
443 llvm::StringRef command,
444 const FileSpec &working_dir, // Pass empty FileSpec to use the current
445 // working directory
446 int *status_ptr, // Pass nullptr if you don't want the process exit status
447 int *signo_ptr, // Pass nullptr if you don't want the signal that caused
448 // the process to exit
449 std::string
450 *command_output, // Pass nullptr if you don't want the command output
451 std::string *separated_error_output, // Pass nullptr if you don't want the
452 // command error output
453 const Timeout<std::micro> &timeout);
454
455 llvm::ErrorOr<llvm::MD5::MD5Result> CalculateMD5(const FileSpec &file_spec);
456
458 lldb::tid_t tid,
459 uint32_t
460 reg_num); // Must be the eRegisterKindProcessPlugin register number
461
463
464 bool
466 uint32_t reg_num, // eRegisterKindProcessPlugin register number
467 llvm::ArrayRef<uint8_t> data);
468
469 bool WriteAllRegisters(lldb::tid_t tid, llvm::ArrayRef<uint8_t> data);
470
471 bool SaveRegisterState(lldb::tid_t tid, uint32_t &save_id);
472
473 bool RestoreRegisterState(lldb::tid_t tid, uint32_t save_id);
474
476
477 const char *GetGDBServerProgramName();
478
480
481 bool AvoidGPackets(ProcessGDBRemote *process);
482
484
486
488
490
492
494
495 bool UsesNativeSignals();
496
498 int32_t type);
499
500 Status WriteMemoryTags(lldb::addr_t addr, size_t len, int32_t type,
501 const std::vector<uint8_t> &tags);
502
503 /// Use qOffsets to query the offset used when relocating the target
504 /// executable. If successful, the returned structure will contain at least
505 /// one value in the offsets field.
506 std::optional<QOffsets> GetQOffsets();
507
508 bool GetModuleInfo(const FileSpec &module_file_spec,
509 const ArchSpec &arch_spec, ModuleSpec &module_spec);
510
511 std::optional<std::vector<ModuleSpec>>
512 GetModulesInfo(llvm::ArrayRef<FileSpec> module_file_specs,
513 const llvm::Triple &triple);
514
515 llvm::Expected<std::string> ReadExtFeature(llvm::StringRef object,
516 llvm::StringRef annex);
517
519
520 // Sends QPassSignals packet to the server with given signals to ignore.
521 Status SendSignalsToIgnore(llvm::ArrayRef<int32_t> signals);
522
523 /// Return the feature set supported by the gdb-remote server.
524 ///
525 /// This method returns the remote side's response to the qSupported
526 /// packet. The response is the complete string payload returned
527 /// to the client.
528 ///
529 /// \return
530 /// The string returned by the server to the qSupported query.
531 const std::string &GetServerSupportedFeatures() const {
533 }
534
535 /// Return the array of async JSON packet types supported by the remote.
536 ///
537 /// This method returns the remote side's array of supported JSON
538 /// packet types as a list of type names. Each of the results are
539 /// expected to have an Enable{type_name} command to enable and configure
540 /// the related feature. Each type_name for an enabled feature will
541 /// possibly send async-style packets that contain a payload of a
542 /// binhex-encoded JSON dictionary. The dictionary will have a
543 /// string field named 'type', that contains the type_name of the
544 /// supported packet type.
545 ///
546 /// There is a Plugin category called structured-data plugins.
547 /// A plugin indicates whether it knows how to handle a type_name.
548 /// If so, it can be used to process the async JSON packet.
549 ///
550 /// \return
551 /// The string returned by the server to the qSupported query.
553
554 /// Configure a StructuredData feature on the remote end.
555 ///
556 /// \see \b Process::ConfigureStructuredData(...) for details.
557 Status
558 ConfigureRemoteStructuredData(llvm::StringRef type_name,
559 const StructuredData::ObjectSP &config_sp);
560
561 llvm::Expected<TraceSupportedResponse>
562 SendTraceSupported(std::chrono::seconds interrupt_timeout);
563
564 llvm::Error SendTraceStart(const llvm::json::Value &request,
565 std::chrono::seconds interrupt_timeout);
566
567 llvm::Error SendTraceStop(const TraceStopRequest &request,
568 std::chrono::seconds interrupt_timeout);
569
570 llvm::Expected<std::string>
571 SendTraceGetState(llvm::StringRef type,
572 std::chrono::seconds interrupt_timeout);
573
574 llvm::Expected<std::vector<uint8_t>>
576 std::chrono::seconds interrupt_timeout);
577
578 bool GetSaveCoreSupported() const;
579
580 llvm::Expected<int> KillProcess(lldb::pid_t pid);
581
582protected:
624 std::optional<xPacketState> m_x_packet_state;
631
642
643 /// Current gdb remote protocol process identifier for all other operations
645 /// Current gdb remote protocol process identifier for continue, step, etc
647 /// Current gdb remote protocol thread identifier for all other operations
649 /// Current gdb remote protocol thread identifier for continue, step, etc
651
653 WatchpointHardwareFeature m_watchpoint_types =
654 eWatchpointHardwareFeatureUnknown;
657
664 std::vector<lldb::addr_t> m_binary_addresses;
665 llvm::VersionTuple m_os_version;
666 llvm::VersionTuple m_maccatalyst_version;
667 std::string m_os_build;
668 std::string m_os_kernel;
669 std::string m_hostname;
670 std::string m_gdb_server_name; // from reply to qGDBServerVersion, empty if
671 // qGDBServerVersion is not supported
673 UINT32_MAX; // from reply to qGDBServerVersion, zero if
674 // qGDBServerVersion is not supported
675 std::chrono::seconds m_default_packet_timeout;
676 int m_target_vm_page_size = 0; // target system VM page size; 0 unspecified
677 uint64_t m_max_packet_size = 0; // as returned by qSupported
678 std::string m_qSupported_response; // the complete response to qSupported
679
682
683 std::vector<MemoryRegionInfo> m_qXfer_memory_map;
685
686 bool GetCurrentProcessInfo(bool allow_lazy_pid = true);
687
688 bool GetGDBServerVersion();
689
690 // Given the list of compression types that the remote debug stub can support,
691 // possibly enable compression if we find an encoding we can handle.
693 llvm::ArrayRef<llvm::StringRef> supported_compressions);
694
696 ProcessInstanceInfo &process_info);
697
698 void OnRunPacketSent(bool first) override;
699
701 lldb::tid_t tid, StreamString &&payload,
702 StringExtractorGDBRemote &response);
703
705 lldb::tid_t thread_id,
706 llvm::MutableArrayRef<uint8_t> &buffer,
707 size_t offset);
708
710
712 MemoryRegionInfo &region);
713
714 LazyBool GetThreadPacketSupported(lldb::tid_t tid, llvm::StringRef packetStr);
715
716private:
720};
721
722} // namespace process_gdb_remote
723} // namespace lldb_private
724
725#endif // LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTECOMMUNICATIONCLIENT_H
static llvm::raw_ostream & error(Stream &strm)
A class which holds the metadata from a remote stub/corefile note about how many bits are used for ad...
An architecture specification class.
Definition ArchSpec.h:32
A command line argument class.
Definition Args.h:33
"lldb/Utility/ArgCompletionRequest.h"
A file utility class.
Definition FileSpec.h:56
A plug-in interface definition class for debugging a process.
Definition Process.h:367
An error handling class.
Definition Status.h:118
A stream class that can stream formatted output to a file.
Definition Stream.h:28
std::shared_ptr< Object > ObjectSP
Represents UUID's of various sizes.
Definition UUID.h:27
lldb::DataBufferSP ReadRegister(lldb::tid_t tid, uint32_t reg_num)
PacketResult SendThreadSpecificPacketAndWaitForResponse(lldb::tid_t tid, StreamString &&payload, StringExtractorGDBRemote &response)
bool DecodeProcessInfoResponse(StringExtractorGDBRemote &response, ProcessInstanceInfo &process_info)
lldb_private::StructuredData::Array * GetSupportedStructuredDataPlugins()
Return the array of async JSON packet types supported by the remote.
lldb::tid_t m_curr_tid_run
Current gdb remote protocol thread identifier for continue, step, etc.
int SetSTDIOWindowSize(uint16_t cols, uint16_t rows)
Send the dimensions of the user's stdio terminal window to the server.
int SendLaunchEventDataPacket(const char *data, bool *was_supported=nullptr)
std::optional< std::vector< ModuleSpec > > GetModulesInfo(llvm::ArrayRef< FileSpec > module_file_specs, const llvm::Triple &triple)
llvm::Expected< std::string > ReadExtFeature(llvm::StringRef object, llvm::StringRef annex)
std::optional< GDBRemoteFStatData > Stat(const FileSpec &file_spec)
std::optional< QOffsets > GetQOffsets()
Use qOffsets to query the offset used when relocating the target executable.
size_t QueryGDBServer(std::vector< std::pair< uint16_t, std::string > > &connection_urls)
Status SendGetTraceDataPacket(StreamGDBRemote &packet, lldb::user_id_t uid, lldb::tid_t thread_id, llvm::MutableArrayRef< uint8_t > &buffer, size_t offset)
llvm::Error SendTraceStop(const TraceStopRequest &request, std::chrono::seconds interrupt_timeout)
void TestPacketSpeed(const uint32_t num_packets, uint32_t max_send, uint32_t max_recv, uint64_t recv_amount, bool json, Stream &strm)
bool LaunchGDBServer(const char *remote_accept_hostname, lldb::pid_t &pid, uint16_t &port, std::string &socket_name)
bool SetCurrentThreadForRun(uint64_t tid, lldb::pid_t pid=LLDB_INVALID_PROCESS_ID)
uint8_t SendGDBStoppointTypePacket(GDBStoppointType type, bool insert, lldb::addr_t addr, uint32_t length, std::chrono::seconds interrupt_timeout)
uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst, uint64_t dst_len, Status &error)
bool GetWorkingDir(FileSpec &working_dir)
Gets the current working directory of a remote platform GDB server.
lldb::user_id_t OpenFile(const FileSpec &file_spec, File::OpenOptions flags, mode_t mode, Status &error)
std::optional< GDBRemoteFStatData > FStat(lldb::user_id_t fd)
Status RunShellCommand(llvm::StringRef command, const FileSpec &working_dir, int *status_ptr, int *signo_ptr, std::string *command_output, std::string *separated_error_output, const Timeout< std::micro > &timeout)
llvm::Expected< std::string > SendTraceGetState(llvm::StringRef type, std::chrono::seconds interrupt_timeout)
llvm::Error LaunchProcess(const Args &args)
Launch the process using the provided arguments.
const GDBRemoteCommunicationClient & operator=(const GDBRemoteCommunicationClient &)=delete
Status ConfigureRemoteStructuredData(llvm::StringRef type_name, const StructuredData::ObjectSP &config_sp)
Configure a StructuredData feature on the remote end.
uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src, uint64_t src_len, Status &error)
llvm::Expected< std::vector< AcceleratorActions > > GetAcceleratorInitializeActions()
Send the "jAcceleratorPluginInitialize" packet and return the actions requested by each accelerator p...
bool SetCurrentThread(uint64_t tid, lldb::pid_t pid=LLDB_INVALID_PROCESS_ID)
int SendStdinNotification(const char *data, size_t data_len, std::chrono::seconds interrupt_timeout=std::chrono::seconds(0))
Sends a GDB remote protocol 'I' packet that delivers stdin data to the remote process.
const std::string & GetServerSupportedFeatures() const
Return the feature set supported by the gdb-remote server.
lldb::tid_t m_curr_tid
Current gdb remote protocol thread identifier for all other operations.
bool WriteAllRegisters(lldb::tid_t tid, llvm::ArrayRef< uint8_t > data)
bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &process_info)
Status SetFilePermissions(const FileSpec &file_spec, uint32_t file_permissions)
Status GetQXferMemoryMapRegionInfo(lldb::addr_t addr, MemoryRegionInfo &region)
std::vector< AddressSpaceInfo > GetAddressSpaces()
Empty if the server does not support "jAddressSpacesInfo".
int SetDetachOnError(bool enable)
Sets the DetachOnError flag to enable for the process controlled by the stub.
LazyBool GetThreadPacketSupported(lldb::tid_t tid, llvm::StringRef packetStr)
bool WriteRegister(lldb::tid_t tid, uint32_t reg_num, llvm::ArrayRef< uint8_t > data)
llvm::Expected< std::vector< uint8_t > > SendTraceGetBinaryData(const TraceGetBinaryDataRequest &request, std::chrono::seconds interrupt_timeout)
GDBRemoteCommunicationClient(const GDBRemoteCommunicationClient &)=delete
int SetSTDIN(const FileSpec &file_spec)
Sets the path to use for stdin/out/err for a process that will be launched with the 'A' packet.
lldb::pid_t m_curr_pid
Current gdb remote protocol process identifier for all other operations.
Status WriteMemoryTags(lldb::addr_t addr, size_t len, int32_t type, const std::vector< uint8_t > &tags)
size_t GetCurrentThreadIDs(std::vector< lldb::tid_t > &thread_ids, bool &sequence_mutex_unavailable)
Status Detach(bool keep_stopped, lldb::pid_t pid=LLDB_INVALID_PROCESS_ID)
bool GetAddressSpacesSupported() const
Whether the server advertised address-space support ("address-spaces+").
int SetDisableASLR(bool enable)
Sets the disable ASLR flag to enable for a process that will be launched with the 'A' packet.
Status GetMemoryRegionInfo(lldb::addr_t addr, MemoryRegionInfo &range_info)
bool GetWasmInstanceSupported()
Whether the WebAssembly stub can be told which module instance to read from, which it advertises with...
void AutoCompleteDiskFileOrDirectory(CompletionRequest &request, bool only_dir)
lldb::pid_t m_curr_pid_run
Current gdb remote protocol process identifier for continue, step, etc.
void MaybeEnableCompression(llvm::ArrayRef< llvm::StringRef > supported_compressions)
llvm::Expected< TraceSupportedResponse > SendTraceSupported(std::chrono::seconds interrupt_timeout)
llvm::ErrorOr< llvm::MD5::MD5Result > CalculateMD5(const FileSpec &file_spec)
llvm::Error SendTraceStart(const llvm::json::Value &request, std::chrono::seconds interrupt_timeout)
llvm::Expected< AcceleratorBreakpointHitResponse > AcceleratorBreakpointHit(const AcceleratorBreakpointHitArgs &args)
Send the "jAcceleratorPluginBreakpointHit" packet to notify the accelerator plugin that one of its re...
bool GetModuleInfo(const FileSpec &module_file_spec, const ArchSpec &arch_spec, ModuleSpec &module_spec)
std::optional< PidTid > SendSetCurrentThreadPacket(uint64_t tid, uint64_t pid, char op)
Status GetFilePermissions(const FileSpec &file_spec, uint32_t &file_permissions)
uint32_t FindProcesses(const ProcessInstanceInfoMatch &process_match_info, ProcessInstanceInfoList &process_infos)
lldb::DataBufferSP ReadMemoryTags(lldb::addr_t addr, size_t len, int32_t type)
int SetWorkingDir(const FileSpec &working_dir)
Sets the working directory to path for a process that will be launched with the 'A' packet for non pl...
std::vector< std::pair< lldb::pid_t, lldb::tid_t > > GetCurrentProcessAndThreadIDs(bool &sequence_mutex_unavailable)
bool GetThreadStopInfo(lldb::tid_t tid, StringExtractorGDBRemote &response)
bool GetProcessStandaloneBinary(UUID &uuid, lldb::addr_t &value, bool &value_is_offset)
int SendEnvironmentPacket(char const *name_equal_value)
Sends a "QEnvironment:NAME=VALUE" packet that will build up the environment that will get used when l...
#define LLDB_INVALID_THREAD_ID
#define LLDB_INVALID_ADDRESS
#define UINT32_MAX
#define LLDB_INVALID_PROCESS_ID
llvm::raw_ostream & operator<<(llvm::raw_ostream &os, const QOffsets &offsets)
bool operator==(const QOffsets &a, const QOffsets &b)
A class that represents a running process on the host machine.
std::vector< ProcessInstanceInfo > ProcessInstanceInfoList
Definition Host.h:32
uint64_t pid_t
Definition lldb-types.h:84
uint64_t user_id_t
Definition lldb-types.h:83
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
uint64_t addr_t
Definition lldb-types.h:80
uint64_t tid_t
Definition lldb-types.h:85
Sent by the client when a plugin-requested breakpoint is hit.
jLLDBTraceGetBinaryData gdb-remote packet
jLLDBTraceStop gdb-remote packet
The offsets used by the target when relocating the executable.
bool segments
If true, the offsets field describes segments.
std::vector< uint64_t > offsets
The individual offsets.