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 ///
99 /// \returns
100 /// The server's initial stop reply if "vRun" was used, or "OK" from
101 /// "qLaunchSuccess" if the "A" packet was used. Returns an llvm::Error if
102 /// launching fails with either packet.
103 llvm::Expected<StringExtractorGDBRemote> LaunchProcess(const Args &args);
104
105 /// Sends a "QEnvironment:NAME=VALUE" packet that will build up the
106 /// environment that will get used when launching an application
107 /// in conjunction with the 'A' packet. This function can be called
108 /// multiple times in a row in order to pass on the desired
109 /// environment that the inferior should be launched with.
110 ///
111 /// \param[in] name_equal_value
112 /// A null-terminated C string that contains a single environment
113 /// in the format "NAME=VALUE".
114 ///
115 /// \return
116 /// Zero if the response was "OK", a positive value if the
117 /// the response was "Exx" where xx are two hex digits, or
118 /// -1 if the call is unsupported or any other unexpected
119 /// response was received.
120 int SendEnvironmentPacket(char const *name_equal_value);
121 int SendEnvironment(const Environment &env);
122
123 int SendLaunchArchPacket(const char *arch);
124
125 int SendLaunchEventDataPacket(const char *data,
126 bool *was_supported = nullptr);
127
128 /// Sends a GDB remote protocol 'I' packet that delivers stdin
129 /// data to the remote process.
130 ///
131 /// \param[in] data
132 /// A pointer to stdin data.
133 ///
134 /// \param[in] data_len
135 /// The number of bytes available at \a data.
136 ///
137 /// \param[in] interrupt_timeout
138 /// If the inferior is running, how long to wait for a `\x03` BREAK
139 /// to interrupt it before giving up. Pass zero only when the caller knows
140 /// the inferior is stopped.
141 ///
142 /// \return
143 /// Zero if the attach was successful, or an error indicating
144 /// an error code.
146 const char *data, size_t data_len,
147 std::chrono::seconds interrupt_timeout = std::chrono::seconds(0));
148
149 /// Sets the path to use for stdin/out/err for a process
150 /// that will be launched with the 'A' packet.
151 ///
152 /// \param[in] file_spec
153 /// The path to use for stdin/out/err
154 ///
155 /// \return
156 /// Zero if the for success, or an error code for failure.
157 int SetSTDIN(const FileSpec &file_spec);
158 int SetSTDOUT(const FileSpec &file_spec);
159 int SetSTDERR(const FileSpec &file_spec);
160
161 /// Send the dimensions of the user's stdio terminal window to the server.
162 int SetSTDIOWindowSize(uint16_t cols, uint16_t rows);
163
164 /// Sets the disable ASLR flag to \a enable for a process that will
165 /// be launched with the 'A' packet.
166 ///
167 /// \param[in] enable
168 /// A boolean value indicating whether to disable ASLR or not.
169 ///
170 /// \return
171 /// Zero if the for success, or an error code for failure.
172 int SetDisableASLR(bool enable);
173
174 /// Sets the DetachOnError flag to \a enable for the process controlled by the
175 /// stub.
176 ///
177 /// \param[in] enable
178 /// A boolean value indicating whether to detach on error or not.
179 ///
180 /// \return
181 /// Zero if the for success, or an error code for failure.
182 int SetDetachOnError(bool enable);
183
184 /// Sets the working directory to \a path for a process that will
185 /// be launched with the 'A' packet for non platform based
186 /// connections. If this packet is sent to a GDB server that
187 /// implements the platform, it will change the current working
188 /// directory for the platform process.
189 ///
190 /// \param[in] working_dir
191 /// The path to a directory to use when launching our process
192 ///
193 /// \return
194 /// Zero if the for success, or an error code for failure.
195 int SetWorkingDir(const FileSpec &working_dir);
196
197 /// Gets the current working directory of a remote platform GDB
198 /// server.
199 ///
200 /// \param[out] working_dir
201 /// The current working directory on the remote platform.
202 ///
203 /// \return
204 /// Boolean for success
205 bool GetWorkingDir(FileSpec &working_dir);
206
207 lldb::addr_t AllocateMemory(size_t size, uint32_t permissions);
208
210
211 Status Detach(bool keep_stopped, lldb::pid_t pid = LLDB_INVALID_PROCESS_ID);
212
214
215 std::optional<uint32_t> GetWatchpointSlotCount();
216
217 std::optional<bool> GetWatchpointReportedAfter();
218
219 WatchpointHardwareFeature GetSupportedWatchpointTypes();
220
222
223 std::chrono::seconds GetHostDefaultPacketTimeout();
224
226
228 bool &value_is_offset);
229
230 std::vector<lldb::addr_t> GetProcessStandaloneBinaries();
231
232 /// Empty if the server does not support "jAddressSpacesInfo".
233 std::vector<AddressSpaceInfo> GetAddressSpaces();
234
235 /// Whether the server advertised address-space support ("address-spaces+").
237
238 void GetRemoteQSupported();
239
240 bool GetVContSupported(llvm::StringRef flavor);
241
243
244 enum class xPacketState {
246 Prefixed, // Successful responses start with a 'b' character. This is the
247 // style used by GDB.
248 Bare, // No prefix, packets starts with the memory being read. This is
249 // LLDB's original style.
250 };
252
254
256
257 void ResetDiscoverableSettings(bool did_exec);
258
259 bool GetHostInfo(bool force = false);
260
262
263 llvm::VersionTuple GetOSVersion();
264
265 llvm::VersionTuple GetMacCatalystVersion();
266
267 std::optional<std::string> GetOSBuildString();
268
269 std::optional<std::string> GetOSKernelDescription();
270
272
274
275 bool GetHostname(std::string &s);
276
278
279 bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &process_info);
280
281 uint32_t FindProcesses(const ProcessInstanceInfoMatch &process_match_info,
282 ProcessInstanceInfoList &process_infos);
283
284 bool GetUserName(uint32_t uid, std::string &name);
285
286 bool GetGroupName(uint32_t gid, std::string &name);
287
289
290 bool HasAnyVContSupport() { return GetVContSupported("a"); }
291
293
295
297 switch (type) {
299 return m_supports_z0;
301 return m_supports_z1;
302 case eWatchpointWrite:
303 return m_supports_z2;
304 case eWatchpointRead:
305 return m_supports_z3;
307 return m_supports_z4;
308 default:
309 return false;
310 }
311 }
312
314 GDBStoppointType type, // Type of breakpoint or watchpoint
315 bool insert, // Insert or remove?
316 lldb::addr_t addr, // Address of breakpoint or watchpoint
317 uint32_t length, // Byte Size of breakpoint or watchpoint
318 std::chrono::seconds interrupt_timeout); // Time to wait for an interrupt
319
320 void TestPacketSpeed(const uint32_t num_packets, uint32_t max_send,
321 uint32_t max_recv, uint64_t recv_amount, bool json,
322 Stream &strm);
323
324 // This packet is for testing the speed of the interface only. Both
325 // the client and server need to support it, but this allows us to
326 // measure the packet speed without any other work being done on the
327 // other end and avoids any of that work affecting the packet send
328 // and response times.
329 bool SendSpeedTestPacket(uint32_t send_size, uint32_t recv_size);
330
331 std::optional<PidTid> SendSetCurrentThreadPacket(uint64_t tid, uint64_t pid,
332 char op);
333
334 bool SetCurrentThread(uint64_t tid,
336
337 bool SetCurrentThreadForRun(uint64_t tid,
339
341
343
345
347
348 uint64_t GetRemoteMaxPacketSize();
349
350 bool GetEchoSupported();
351
353
355
357
359
361
363
365
367
369
371
373
374 /// Whether the WebAssembly stub can be told which module instance to read
375 /// from, which it advertises with "qWasmInstance+" in its qSupported
376 /// response.
378
379 /// Send the "jAcceleratorPluginInitialize" packet and return the actions
380 /// requested by each accelerator plugin installed in lldb-server. The packet
381 /// is only sent if the lldb-server advertised accelerator plugin support via
382 /// "accelerator-plugins+" in its qSupported response; otherwise (and when no
383 /// plugin returns actions) this returns an empty vector. Errors are returned
384 /// for the caller to report.
385 llvm::Expected<std::vector<AcceleratorActions>>
387
388 /// Return LLDB-specific settings for this GDB-remote process.
389 ///
390 /// Only sent when the server advertises "lldb-settings+" in response to the
391 /// "qSupported" packet.
392 std::optional<LLDBSettings> GetLLDBSettings();
393
394 /// Send the "jAcceleratorPluginBreakpointHit" packet to notify the
395 /// accelerator plugin that one of its requested breakpoints was hit, and
396 /// return the plugin's response. This is only used when the lldb-server
397 /// advertised accelerator plugin support via "accelerator-plugins+" in its
398 /// qSupported response, since the breakpoints that trigger it are only set in
399 /// that case. Errors are returned for the caller to report.
400 llvm::Expected<AcceleratorBreakpointHitResponse>
402
403 /// Returns std::nullopt if the packet failed or the response did not parse.
404 std::optional<AcceleratorDynamicLoaderResponse>
406 const AcceleratorDynamicLoaderArgs &args);
407
409 {
410 // Uncomment this to have lldb pretend the debug server doesn't respond to
411 // alloc/dealloc memory packets.
412 // m_supports_alloc_dealloc_memory = lldb_private::eLazyBoolNo;
414 }
415
416 std::vector<std::pair<lldb::pid_t, lldb::tid_t>>
417 GetCurrentProcessAndThreadIDs(bool &sequence_mutex_unavailable);
418
419 size_t GetCurrentThreadIDs(std::vector<lldb::tid_t> &thread_ids,
420 bool &sequence_mutex_unavailable);
421
422 lldb::user_id_t OpenFile(const FileSpec &file_spec, File::OpenOptions flags,
423 mode_t mode, Status &error);
424
426
427 std::optional<GDBRemoteFStatData> FStat(lldb::user_id_t fd);
428
429 // NB: this is just a convenience wrapper over open() + fstat(). It does not
430 // work if the file cannot be opened.
431 std::optional<GDBRemoteFStatData> Stat(const FileSpec &file_spec);
432
433 lldb::user_id_t GetFileSize(const FileSpec &file_spec);
434
436 bool only_dir);
437
438 Status GetFilePermissions(const FileSpec &file_spec,
439 uint32_t &file_permissions);
440
441 Status SetFilePermissions(const FileSpec &file_spec,
442 uint32_t file_permissions);
443
444 uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst,
445 uint64_t dst_len, Status &error);
446
447 uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src,
448 uint64_t src_len, Status &error);
449
450 Status CreateSymlink(const FileSpec &src, const FileSpec &dst);
451
452 Status Unlink(const FileSpec &file_spec);
453
454 Status MakeDirectory(const FileSpec &file_spec, uint32_t mode);
455
456 bool GetFileExists(const FileSpec &file_spec);
457
459 llvm::StringRef command,
460 const FileSpec &working_dir, // Pass empty FileSpec to use the current
461 // working directory
462 int *status_ptr, // Pass nullptr if you don't want the process exit status
463 int *signo_ptr, // Pass nullptr if you don't want the signal that caused
464 // the process to exit
465 std::string
466 *command_output, // Pass nullptr if you don't want the command output
467 std::string *separated_error_output, // Pass nullptr if you don't want the
468 // command error output
469 const Timeout<std::micro> &timeout);
470
471 llvm::ErrorOr<llvm::MD5::MD5Result> CalculateMD5(const FileSpec &file_spec);
472
474 lldb::tid_t tid,
475 uint32_t
476 reg_num); // Must be the eRegisterKindProcessPlugin register number
477
479
480 bool
482 uint32_t reg_num, // eRegisterKindProcessPlugin register number
483 llvm::ArrayRef<uint8_t> data);
484
485 bool WriteAllRegisters(lldb::tid_t tid, llvm::ArrayRef<uint8_t> data);
486
487 bool SaveRegisterState(lldb::tid_t tid, uint32_t &save_id);
488
489 bool RestoreRegisterState(lldb::tid_t tid, uint32_t save_id);
490
492
493 const char *GetGDBServerProgramName();
494
496
497 bool AvoidGPackets(ProcessGDBRemote *process);
498
500
502
504
506
508
510
511 bool UsesNativeSignals();
512
514 int32_t type);
515
516 Status WriteMemoryTags(lldb::addr_t addr, size_t len, int32_t type,
517 const std::vector<uint8_t> &tags);
518
519 /// Use qOffsets to query the offset used when relocating the target
520 /// executable. If successful, the returned structure will contain at least
521 /// one value in the offsets field.
522 std::optional<QOffsets> GetQOffsets();
523
524 bool GetModuleInfo(const FileSpec &module_file_spec,
525 const ArchSpec &arch_spec, ModuleSpec &module_spec);
526
527 std::optional<std::vector<ModuleSpec>>
528 GetModulesInfo(llvm::ArrayRef<FileSpec> module_file_specs,
529 const llvm::Triple &triple);
530
531 llvm::Expected<std::string> ReadExtFeature(llvm::StringRef object,
532 llvm::StringRef annex);
533
534 /// Read the siginfo of the given thread using the qXfer:siginfo:read packet.
535 llvm::Expected<std::string> ReadSiginfo(lldb::tid_t tid);
536
538
539 // Sends QPassSignals packet to the server with given signals to ignore.
540 Status SendSignalsToIgnore(llvm::ArrayRef<int32_t> signals);
541
542 /// Return the feature set supported by the gdb-remote server.
543 ///
544 /// This method returns the remote side's response to the qSupported
545 /// packet. The response is the complete string payload returned
546 /// to the client.
547 ///
548 /// \return
549 /// The string returned by the server to the qSupported query.
550 const std::string &GetServerSupportedFeatures() const {
552 }
553
554 /// Return the array of async JSON packet types supported by the remote.
555 ///
556 /// This method returns the remote side's array of supported JSON
557 /// packet types as a list of type names. Each of the results are
558 /// expected to have an Enable{type_name} command to enable and configure
559 /// the related feature. Each type_name for an enabled feature will
560 /// possibly send async-style packets that contain a payload of a
561 /// binhex-encoded JSON dictionary. The dictionary will have a
562 /// string field named 'type', that contains the type_name of the
563 /// supported packet type.
564 ///
565 /// There is a Plugin category called structured-data plugins.
566 /// A plugin indicates whether it knows how to handle a type_name.
567 /// If so, it can be used to process the async JSON packet.
568 ///
569 /// \return
570 /// The string returned by the server to the qSupported query.
572
573 /// Configure a StructuredData feature on the remote end.
574 ///
575 /// \see \b Process::ConfigureStructuredData(...) for details.
576 Status
577 ConfigureRemoteStructuredData(llvm::StringRef type_name,
578 const StructuredData::ObjectSP &config_sp);
579
580 llvm::Expected<TraceSupportedResponse>
581 SendTraceSupported(std::chrono::seconds interrupt_timeout);
582
583 llvm::Error SendTraceStart(const llvm::json::Value &request,
584 std::chrono::seconds interrupt_timeout);
585
586 llvm::Error SendTraceStop(const TraceStopRequest &request,
587 std::chrono::seconds interrupt_timeout);
588
589 llvm::Expected<std::string>
590 SendTraceGetState(llvm::StringRef type,
591 std::chrono::seconds interrupt_timeout);
592
593 llvm::Expected<std::vector<uint8_t>>
595 std::chrono::seconds interrupt_timeout);
596
597 bool GetSaveCoreSupported() const;
598
599 llvm::Expected<int> KillProcess(lldb::pid_t pid);
600
601protected:
643 std::optional<xPacketState> m_x_packet_state;
651
662
663 /// Current gdb remote protocol process identifier for all other operations
665 /// Current gdb remote protocol process identifier for continue, step, etc
667 /// Current gdb remote protocol thread identifier for all other operations
669 /// Current gdb remote protocol thread identifier for continue, step, etc
671
673 WatchpointHardwareFeature m_watchpoint_types =
674 eWatchpointHardwareFeatureUnknown;
677
684 std::vector<lldb::addr_t> m_binary_addresses;
685 llvm::VersionTuple m_os_version;
686 llvm::VersionTuple m_maccatalyst_version;
687 std::optional<LLDBSettings> m_lldb_settings;
688 std::string m_os_build;
689 std::string m_os_kernel;
690 std::string m_hostname;
691 std::string m_gdb_server_name; // from reply to qGDBServerVersion, empty if
692 // qGDBServerVersion is not supported
694 UINT32_MAX; // from reply to qGDBServerVersion, zero if
695 // qGDBServerVersion is not supported
696 std::chrono::seconds m_default_packet_timeout;
697 int m_target_vm_page_size = 0; // target system VM page size; 0 unspecified
698 uint64_t m_max_packet_size = 0; // as returned by qSupported
699 std::string m_qSupported_response; // the complete response to qSupported
700
703
704 std::vector<MemoryRegionInfo> m_qXfer_memory_map;
706
707 bool GetCurrentProcessInfo(bool allow_lazy_pid = true);
708
709 bool GetGDBServerVersion();
710
711 // Given the list of compression types that the remote debug stub can support,
712 // possibly enable compression if we find an encoding we can handle.
714 llvm::ArrayRef<llvm::StringRef> supported_compressions);
715
717 ProcessInstanceInfo &process_info);
718
719 void OnRunPacketSent(bool first) override;
720
722 lldb::tid_t tid, StreamString &&payload,
723 StringExtractorGDBRemote &response);
724
726 lldb::tid_t thread_id,
727 llvm::MutableArrayRef<uint8_t> &buffer,
728 size_t offset);
729
731
733 MemoryRegionInfo &region);
734
735 LazyBool GetThreadPacketSupported(lldb::tid_t tid, llvm::StringRef packetStr);
736
737private:
741};
742
743} // namespace process_gdb_remote
744} // namespace lldb_private
745
746#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:370
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)
llvm::Expected< StringExtractorGDBRemote > LaunchProcess(const Args &args)
Launch the process using the provided arguments.
bool DecodeProcessInfoResponse(StringExtractorGDBRemote &response, ProcessInstanceInfo &process_info)
llvm::Expected< std::string > ReadSiginfo(lldb::tid_t tid)
Read the siginfo of the given thread using the qXfer:siginfo:read packet.
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)
std::optional< LLDBSettings > GetLLDBSettings()
Return LLDB-specific settings for this GDB-remote process.
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)
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...
std::optional< AcceleratorDynamicLoaderResponse > GetAcceleratorDynamicLoaderLibraryInfos(const AcceleratorDynamicLoaderArgs &args)
Returns std::nullopt if the packet failed or the response did not parse.
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.
Arguments for the jAcceleratorPluginGetDynamicLoaderLibraryInfo packet.
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.