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"
29#include "lldb/Utility/UUID.h"
30#if defined(_WIN32)
32#endif
33
34#include "llvm/Support/VersionTuple.h"
35
36namespace lldb_private {
37namespace process_gdb_remote {
38
39/// The offsets used by the target when relocating the executable. Decoded from
40/// qOffsets packet response.
41struct QOffsets {
42 /// If true, the offsets field describes segments. Otherwise, it describes
43 /// sections.
45
46 /// The individual offsets. Section offsets have two or three members.
47 /// Segment offsets have either one of two.
48 std::vector<uint64_t> offsets;
49};
50inline bool operator==(const QOffsets &a, const QOffsets &b) {
51 return a.segments == b.segments && a.offsets == b.offsets;
52}
53llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const QOffsets &offsets);
54
55// A trivial struct used to return a pair of PID and TID.
56struct PidTid {
57 uint64_t pid;
58 uint64_t tid;
59};
60
62public:
64
66
67 // After connecting, send the handshake to the server to make sure
68 // we are communicating with it.
69 bool HandshakeWithServer(Status *error_ptr);
70
72
73 // This packet is usually sent first and the boolean return value
74 // indicates if the packet was send and any response was received
75 // even in the response is UNIMPLEMENTED. If the packet failed to
76 // get a response, then false is returned. This quickly tells us
77 // if we were able to connect and communicate with the remote GDB
78 // server
80
82
83 lldb::pid_t GetCurrentProcessID(bool allow_lazy = true);
84
85 bool LaunchGDBServer(const char *remote_accept_hostname, lldb::pid_t &pid,
86 uint16_t &port, std::string &socket_name);
87
88 size_t QueryGDBServer(
89 std::vector<std::pair<uint16_t, std::string>> &connection_urls);
90
92
93 /// Launch the process using the provided arguments.
94 ///
95 /// \param[in] args
96 /// A list of program arguments. The first entry is the program being run.
97 llvm::Error LaunchProcess(const Args &args);
98
99 /// Sends a "QEnvironment:NAME=VALUE" packet that will build up the
100 /// environment that will get used when launching an application
101 /// in conjunction with the 'A' packet. This function can be called
102 /// multiple times in a row in order to pass on the desired
103 /// environment that the inferior should be launched with.
104 ///
105 /// \param[in] name_equal_value
106 /// A NULL terminated C string that contains a single environment
107 /// in the format "NAME=VALUE".
108 ///
109 /// \return
110 /// Zero if the response was "OK", a positive value if the
111 /// the response was "Exx" where xx are two hex digits, or
112 /// -1 if the call is unsupported or any other unexpected
113 /// response was received.
114 int SendEnvironmentPacket(char const *name_equal_value);
115 int SendEnvironment(const Environment &env);
116
117 int SendLaunchArchPacket(const char *arch);
118
119 int SendLaunchEventDataPacket(const char *data,
120 bool *was_supported = nullptr);
121
122 /// Sends a GDB remote protocol 'I' packet that delivers stdin
123 /// data to the remote process.
124 ///
125 /// \param[in] data
126 /// A pointer to stdin data.
127 ///
128 /// \param[in] data_len
129 /// The number of bytes available at \a data.
130 ///
131 /// \param[in] interrupt_timeout
132 /// If the inferior is running, how long to wait for a `\x03` BREAK
133 /// to interrupt it before giving up. Pass zero only when the caller knows
134 /// the inferior is stopped.
135 ///
136 /// \return
137 /// Zero if the attach was successful, or an error indicating
138 /// an error code.
140 const char *data, size_t data_len,
141 std::chrono::seconds interrupt_timeout = std::chrono::seconds(0));
142
143 /// Sets the path to use for stdin/out/err for a process
144 /// that will be launched with the 'A' packet.
145 ///
146 /// \param[in] file_spec
147 /// The path to use for stdin/out/err
148 ///
149 /// \return
150 /// Zero if the for success, or an error code for failure.
151 int SetSTDIN(const FileSpec &file_spec);
152 int SetSTDOUT(const FileSpec &file_spec);
153 int SetSTDERR(const FileSpec &file_spec);
154
155 /// Send the dimensions of the user's stdio terminal window to the server.
156 int SetSTDIOWindowSize(uint16_t cols, uint16_t rows);
157
158 /// Sets the disable ASLR flag to \a enable for a process that will
159 /// be launched with the 'A' packet.
160 ///
161 /// \param[in] enable
162 /// A boolean value indicating whether to disable ASLR or not.
163 ///
164 /// \return
165 /// Zero if the for success, or an error code for failure.
166 int SetDisableASLR(bool enable);
167
168 /// Sets the DetachOnError flag to \a enable for the process controlled by the
169 /// stub.
170 ///
171 /// \param[in] enable
172 /// A boolean value indicating whether to detach on error or not.
173 ///
174 /// \return
175 /// Zero if the for success, or an error code for failure.
176 int SetDetachOnError(bool enable);
177
178 /// Sets the working directory to \a path for a process that will
179 /// be launched with the 'A' packet for non platform based
180 /// connections. If this packet is sent to a GDB server that
181 /// implements the platform, it will change the current working
182 /// directory for the platform process.
183 ///
184 /// \param[in] working_dir
185 /// The path to a directory to use when launching our process
186 ///
187 /// \return
188 /// Zero if the for success, or an error code for failure.
189 int SetWorkingDir(const FileSpec &working_dir);
190
191 /// Gets the current working directory of a remote platform GDB
192 /// server.
193 ///
194 /// \param[out] working_dir
195 /// The current working directory on the remote platform.
196 ///
197 /// \return
198 /// Boolean for success
199 bool GetWorkingDir(FileSpec &working_dir);
200
201 lldb::addr_t AllocateMemory(size_t size, uint32_t permissions);
202
204
205 Status Detach(bool keep_stopped, lldb::pid_t pid = LLDB_INVALID_PROCESS_ID);
206
208
209 std::optional<uint32_t> GetWatchpointSlotCount();
210
211 std::optional<bool> GetWatchpointReportedAfter();
212
213 WatchpointHardwareFeature GetSupportedWatchpointTypes();
214
216
217 std::chrono::seconds GetHostDefaultPacketTimeout();
218
220
222 bool &value_is_offset);
223
224 std::vector<lldb::addr_t> GetProcessStandaloneBinaries();
225
226 void GetRemoteQSupported();
227
228 bool GetVContSupported(llvm::StringRef flavor);
229
231
232 enum class xPacketState {
234 Prefixed, // Successful responses start with a 'b' character. This is the
235 // style used by GDB.
236 Bare, // No prefix, packets starts with the memory being read. This is
237 // LLDB's original style.
238 };
240
242
244
245 void ResetDiscoverableSettings(bool did_exec);
246
247 bool GetHostInfo(bool force = false);
248
250
251 llvm::VersionTuple GetOSVersion();
252
253 llvm::VersionTuple GetMacCatalystVersion();
254
255 std::optional<std::string> GetOSBuildString();
256
257 std::optional<std::string> GetOSKernelDescription();
258
260
262
263 bool GetHostname(std::string &s);
264
266
267 bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &process_info);
268
269 uint32_t FindProcesses(const ProcessInstanceInfoMatch &process_match_info,
270 ProcessInstanceInfoList &process_infos);
271
272 bool GetUserName(uint32_t uid, std::string &name);
273
274 bool GetGroupName(uint32_t gid, std::string &name);
275
277
278 bool HasAnyVContSupport() { return GetVContSupported("a"); }
279
281
283
285 switch (type) {
287 return m_supports_z0;
289 return m_supports_z1;
290 case eWatchpointWrite:
291 return m_supports_z2;
292 case eWatchpointRead:
293 return m_supports_z3;
295 return m_supports_z4;
296 default:
297 return false;
298 }
299 }
300
302 GDBStoppointType type, // Type of breakpoint or watchpoint
303 bool insert, // Insert or remove?
304 lldb::addr_t addr, // Address of breakpoint or watchpoint
305 uint32_t length, // Byte Size of breakpoint or watchpoint
306 std::chrono::seconds interrupt_timeout); // Time to wait for an interrupt
307
308 void TestPacketSpeed(const uint32_t num_packets, uint32_t max_send,
309 uint32_t max_recv, uint64_t recv_amount, bool json,
310 Stream &strm);
311
312 // This packet is for testing the speed of the interface only. Both
313 // the client and server need to support it, but this allows us to
314 // measure the packet speed without any other work being done on the
315 // other end and avoids any of that work affecting the packet send
316 // and response times.
317 bool SendSpeedTestPacket(uint32_t send_size, uint32_t recv_size);
318
319 std::optional<PidTid> SendSetCurrentThreadPacket(uint64_t tid, uint64_t pid,
320 char op);
321
322 bool SetCurrentThread(uint64_t tid,
324
325 bool SetCurrentThreadForRun(uint64_t tid,
327
329
331
333
335
336 uint64_t GetRemoteMaxPacketSize();
337
338 bool GetEchoSupported();
339
341
343
345
347
349
351
353
355
357
359
361
362 /// Send the "jAcceleratorPluginInitialize" packet and return the actions
363 /// requested by each accelerator plugin installed in lldb-server. The packet
364 /// is only sent if the lldb-server advertised accelerator plugin support via
365 /// "accelerator-plugins+" in its qSupported response; otherwise (and when no
366 /// plugin returns actions) this returns an empty vector. Errors are returned
367 /// for the caller to report.
368 llvm::Expected<std::vector<AcceleratorActions>>
370
371 /// Send the "jAcceleratorPluginBreakpointHit" packet to notify the
372 /// accelerator plugin that one of its requested breakpoints was hit, and
373 /// return the plugin's response. This is only used when the lldb-server
374 /// advertised accelerator plugin support via "accelerator-plugins+" in its
375 /// qSupported response, since the breakpoints that trigger it are only set in
376 /// that case. Errors are returned for the caller to report.
377 llvm::Expected<AcceleratorBreakpointHitResponse>
379
381 {
382 // Uncomment this to have lldb pretend the debug server doesn't respond to
383 // alloc/dealloc memory packets.
384 // m_supports_alloc_dealloc_memory = lldb_private::eLazyBoolNo;
386 }
387
388 std::vector<std::pair<lldb::pid_t, lldb::tid_t>>
389 GetCurrentProcessAndThreadIDs(bool &sequence_mutex_unavailable);
390
391 size_t GetCurrentThreadIDs(std::vector<lldb::tid_t> &thread_ids,
392 bool &sequence_mutex_unavailable);
393
394 lldb::user_id_t OpenFile(const FileSpec &file_spec, File::OpenOptions flags,
395 mode_t mode, Status &error);
396
398
399 std::optional<GDBRemoteFStatData> FStat(lldb::user_id_t fd);
400
401 // NB: this is just a convenience wrapper over open() + fstat(). It does not
402 // work if the file cannot be opened.
403 std::optional<GDBRemoteFStatData> Stat(const FileSpec &file_spec);
404
405 lldb::user_id_t GetFileSize(const FileSpec &file_spec);
406
408 bool only_dir);
409
410 Status GetFilePermissions(const FileSpec &file_spec,
411 uint32_t &file_permissions);
412
413 Status SetFilePermissions(const FileSpec &file_spec,
414 uint32_t file_permissions);
415
416 uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst,
417 uint64_t dst_len, Status &error);
418
419 uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src,
420 uint64_t src_len, Status &error);
421
422 Status CreateSymlink(const FileSpec &src, const FileSpec &dst);
423
424 Status Unlink(const FileSpec &file_spec);
425
426 Status MakeDirectory(const FileSpec &file_spec, uint32_t mode);
427
428 bool GetFileExists(const FileSpec &file_spec);
429
431 llvm::StringRef command,
432 const FileSpec &working_dir, // Pass empty FileSpec to use the current
433 // working directory
434 int *status_ptr, // Pass nullptr if you don't want the process exit status
435 int *signo_ptr, // Pass nullptr if you don't want the signal that caused
436 // the process to exit
437 std::string
438 *command_output, // Pass nullptr if you don't want the command output
439 std::string *separated_error_output, // Pass nullptr if you don't want the
440 // command error output
441 const Timeout<std::micro> &timeout);
442
443 llvm::ErrorOr<llvm::MD5::MD5Result> CalculateMD5(const FileSpec &file_spec);
444
446 lldb::tid_t tid,
447 uint32_t
448 reg_num); // Must be the eRegisterKindProcessPlugin register number
449
451
452 bool
454 uint32_t reg_num, // eRegisterKindProcessPlugin register number
455 llvm::ArrayRef<uint8_t> data);
456
457 bool WriteAllRegisters(lldb::tid_t tid, llvm::ArrayRef<uint8_t> data);
458
459 bool SaveRegisterState(lldb::tid_t tid, uint32_t &save_id);
460
461 bool RestoreRegisterState(lldb::tid_t tid, uint32_t save_id);
462
464
465 const char *GetGDBServerProgramName();
466
468
469 bool AvoidGPackets(ProcessGDBRemote *process);
470
472
474
476
478
480
482
483 bool UsesNativeSignals();
484
486 int32_t type);
487
488 Status WriteMemoryTags(lldb::addr_t addr, size_t len, int32_t type,
489 const std::vector<uint8_t> &tags);
490
491 /// Use qOffsets to query the offset used when relocating the target
492 /// executable. If successful, the returned structure will contain at least
493 /// one value in the offsets field.
494 std::optional<QOffsets> GetQOffsets();
495
496 bool GetModuleInfo(const FileSpec &module_file_spec,
497 const ArchSpec &arch_spec, ModuleSpec &module_spec);
498
499 std::optional<std::vector<ModuleSpec>>
500 GetModulesInfo(llvm::ArrayRef<FileSpec> module_file_specs,
501 const llvm::Triple &triple);
502
503 llvm::Expected<std::string> ReadExtFeature(llvm::StringRef object,
504 llvm::StringRef annex);
505
507
508 // Sends QPassSignals packet to the server with given signals to ignore.
509 Status SendSignalsToIgnore(llvm::ArrayRef<int32_t> signals);
510
511 /// Return the feature set supported by the gdb-remote server.
512 ///
513 /// This method returns the remote side's response to the qSupported
514 /// packet. The response is the complete string payload returned
515 /// to the client.
516 ///
517 /// \return
518 /// The string returned by the server to the qSupported query.
519 const std::string &GetServerSupportedFeatures() const {
521 }
522
523 /// Return the array of async JSON packet types supported by the remote.
524 ///
525 /// This method returns the remote side's array of supported JSON
526 /// packet types as a list of type names. Each of the results are
527 /// expected to have an Enable{type_name} command to enable and configure
528 /// the related feature. Each type_name for an enabled feature will
529 /// possibly send async-style packets that contain a payload of a
530 /// binhex-encoded JSON dictionary. The dictionary will have a
531 /// string field named 'type', that contains the type_name of the
532 /// supported packet type.
533 ///
534 /// There is a Plugin category called structured-data plugins.
535 /// A plugin indicates whether it knows how to handle a type_name.
536 /// If so, it can be used to process the async JSON packet.
537 ///
538 /// \return
539 /// The string returned by the server to the qSupported query.
541
542 /// Configure a StructuredData feature on the remote end.
543 ///
544 /// \see \b Process::ConfigureStructuredData(...) for details.
545 Status
546 ConfigureRemoteStructuredData(llvm::StringRef type_name,
547 const StructuredData::ObjectSP &config_sp);
548
549 llvm::Expected<TraceSupportedResponse>
550 SendTraceSupported(std::chrono::seconds interrupt_timeout);
551
552 llvm::Error SendTraceStart(const llvm::json::Value &request,
553 std::chrono::seconds interrupt_timeout);
554
555 llvm::Error SendTraceStop(const TraceStopRequest &request,
556 std::chrono::seconds interrupt_timeout);
557
558 llvm::Expected<std::string>
559 SendTraceGetState(llvm::StringRef type,
560 std::chrono::seconds interrupt_timeout);
561
562 llvm::Expected<std::vector<uint8_t>>
564 std::chrono::seconds interrupt_timeout);
565
566 bool GetSaveCoreSupported() const;
567
568 llvm::Expected<int> KillProcess(lldb::pid_t pid);
569
570protected:
611 std::optional<xPacketState> m_x_packet_state;
617
628
629 /// Current gdb remote protocol process identifier for all other operations
631 /// Current gdb remote protocol process identifier for continue, step, etc
633 /// Current gdb remote protocol thread identifier for all other operations
635 /// Current gdb remote protocol thread identifier for continue, step, etc
637
639 WatchpointHardwareFeature m_watchpoint_types =
640 eWatchpointHardwareFeatureUnknown;
643
650 std::vector<lldb::addr_t> m_binary_addresses;
651 llvm::VersionTuple m_os_version;
652 llvm::VersionTuple m_maccatalyst_version;
653 std::string m_os_build;
654 std::string m_os_kernel;
655 std::string m_hostname;
656 std::string m_gdb_server_name; // from reply to qGDBServerVersion, empty if
657 // qGDBServerVersion is not supported
659 UINT32_MAX; // from reply to qGDBServerVersion, zero if
660 // qGDBServerVersion is not supported
661 std::chrono::seconds m_default_packet_timeout;
662 int m_target_vm_page_size = 0; // target system VM page size; 0 unspecified
663 uint64_t m_max_packet_size = 0; // as returned by qSupported
664 std::string m_qSupported_response; // the complete response to qSupported
665
668
669 std::vector<MemoryRegionInfo> m_qXfer_memory_map;
671
672 bool GetCurrentProcessInfo(bool allow_lazy_pid = true);
673
674 bool GetGDBServerVersion();
675
676 // Given the list of compression types that the remote debug stub can support,
677 // possibly enable compression if we find an encoding we can handle.
679 llvm::ArrayRef<llvm::StringRef> supported_compressions);
680
682 ProcessInstanceInfo &process_info);
683
684 void OnRunPacketSent(bool first) override;
685
687 lldb::tid_t tid, StreamString &&payload,
688 StringExtractorGDBRemote &response);
689
691 lldb::tid_t thread_id,
692 llvm::MutableArrayRef<uint8_t> &buffer,
693 size_t offset);
694
696
698 MemoryRegionInfo &region);
699
700 LazyBool GetThreadPacketSupported(lldb::tid_t tid, llvm::StringRef packetStr);
701
702private:
706};
707
708} // namespace process_gdb_remote
709} // namespace lldb_private
710
711#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:57
A plug-in interface definition class for debugging a process.
Definition Process.h:357
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)
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)
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)
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:83
uint64_t user_id_t
Definition lldb-types.h:82
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
uint64_t addr_t
Definition lldb-types.h:80
uint64_t tid_t
Definition lldb-types.h:84
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.