GDBRemoteCommunicationClient.h revision 341825
1180740Sdes//===-- GDBRemoteCommunicationClient.h --------------------------*- C++ -*-===// 2248613Sdes// 3180740Sdes// The LLVM Compiler Infrastructure 4248613Sdes// 5248613Sdes// This file is distributed under the University of Illinois Open Source 6248613Sdes// License. See LICENSE.TXT for details. 7248613Sdes// 8248613Sdes//===----------------------------------------------------------------------===// 9248613Sdes 10248613Sdes#ifndef liblldb_GDBRemoteCommunicationClient_h_ 11248613Sdes#define liblldb_GDBRemoteCommunicationClient_h_ 12180740Sdes 13248613Sdes#include "GDBRemoteClientBase.h" 14248613Sdes 15248613Sdes// C Includes 16248613Sdes// C++ Includes 17248613Sdes#include <chrono> 18248613Sdes#include <map> 19248613Sdes#include <mutex> 20248613Sdes#include <string> 21248613Sdes#include <vector> 22248613Sdes 23180740Sdes#include "lldb/Target/Process.h" 24263970Sdes#include "lldb/Utility/ArchSpec.h" 25248613Sdes#include "lldb/Utility/StreamGDBRemote.h" 26248613Sdes#include "lldb/Utility/StructuredData.h" 27248613Sdes 28248613Sdes#include "llvm/ADT/Optional.h" 29248613Sdes 30248613Sdesnamespace lldb_private { 31248613Sdesnamespace process_gdb_remote { 32248613Sdes 33248613Sdesclass GDBRemoteCommunicationClient : public GDBRemoteClientBase { 34248613Sdespublic: 35248613Sdes GDBRemoteCommunicationClient(); 36248613Sdes 37248613Sdes ~GDBRemoteCommunicationClient() override; 38248613Sdes 39248613Sdes //------------------------------------------------------------------ 40180740Sdes // After connecting, send the handshake to the server to make sure 41248613Sdes // we are communicating with it. 42248613Sdes //------------------------------------------------------------------ 43248613Sdes bool HandshakeWithServer(Status *error_ptr); 44248613Sdes 45248613Sdes // For packets which specify a range of output to be returned, 46248613Sdes // return all of the output via a series of request packets of the form 47248613Sdes // <prefix>0,<size> 48248613Sdes // <prefix><size>,<size> 49248613Sdes // <prefix><size>*2,<size> 50248613Sdes // <prefix><size>*3,<size> 51248613Sdes // ... 52248613Sdes // until a "$l..." packet is received, indicating the end. 53248613Sdes // (size is in hex; this format is used by a standard gdbserver to 54248613Sdes // return the given portion of the output specified by <prefix>; 55248613Sdes // for example, "qXfer:libraries-svr4:read::fff,1000" means 56248613Sdes // "return a chunk of the xml description file for shared 57248613Sdes // library load addresses, where the chunk starts at offset 0xfff 58248613Sdes // and continues for 0x1000 bytes"). 59248613Sdes // Concatenate the resulting server response packets together and 60248613Sdes // return in response_string. If any packet fails, the return value 61248613Sdes // indicates that failure and the returned string value is undefined. 62248613Sdes PacketResult 63248613Sdes SendPacketsAndConcatenateResponses(const char *send_payload_prefix, 64248613Sdes std::string &response_string); 65248613Sdes 66248613Sdes bool GetThreadSuffixSupported(); 67248613Sdes 68248613Sdes // This packet is usually sent first and the boolean return value 69248613Sdes // indicates if the packet was send and any response was received 70248613Sdes // even in the response is UNIMPLEMENTED. If the packet failed to 71248613Sdes // get a response, then false is returned. This quickly tells us 72248613Sdes // if we were able to connect and communicate with the remote GDB 73248613Sdes // server 74248613Sdes bool QueryNoAckModeSupported(); 75248613Sdes 76248613Sdes void GetListThreadsInStopReplySupported(); 77248613Sdes 78248613Sdes lldb::pid_t GetCurrentProcessID(bool allow_lazy = true); 79248613Sdes 80248613Sdes bool GetLaunchSuccess(std::string &error_str); 81248613Sdes 82248613Sdes bool LaunchGDBServer(const char *remote_accept_hostname, lldb::pid_t &pid, 83248613Sdes uint16_t &port, std::string &socket_name); 84248613Sdes 85248613Sdes size_t QueryGDBServer( 86248613Sdes std::vector<std::pair<uint16_t, std::string>> &connection_urls); 87248613Sdes 88248613Sdes bool KillSpawnedProcess(lldb::pid_t pid); 89248613Sdes 90248613Sdes //------------------------------------------------------------------ 91248613Sdes /// Sends a GDB remote protocol 'A' packet that delivers program 92248613Sdes /// arguments to the remote server. 93248613Sdes /// 94248613Sdes /// @param[in] argv 95248613Sdes /// A NULL terminated array of const C strings to use as the 96248613Sdes /// arguments. 97248613Sdes /// 98248613Sdes /// @return 99248613Sdes /// Zero if the response was "OK", a positive value if the 100248613Sdes /// the response was "Exx" where xx are two hex digits, or 101248613Sdes /// -1 if the call is unsupported or any other unexpected 102248613Sdes /// response was received. 103248613Sdes //------------------------------------------------------------------ 104248613Sdes int SendArgumentsPacket(const ProcessLaunchInfo &launch_info); 105248613Sdes 106248613Sdes //------------------------------------------------------------------ 107248613Sdes /// Sends a "QEnvironment:NAME=VALUE" packet that will build up the 108248613Sdes /// environment that will get used when launching an application 109248613Sdes /// in conjunction with the 'A' packet. This function can be called 110248613Sdes /// multiple times in a row in order to pass on the desired 111248613Sdes /// environment that the inferior should be launched with. 112248613Sdes /// 113248613Sdes /// @param[in] name_equal_value 114248613Sdes /// A NULL terminated C string that contains a single environment 115248613Sdes /// in the format "NAME=VALUE". 116248613Sdes /// 117248613Sdes /// @return 118248613Sdes /// Zero if the response was "OK", a positive value if the 119248613Sdes /// the response was "Exx" where xx are two hex digits, or 120248613Sdes /// -1 if the call is unsupported or any other unexpected 121248613Sdes /// response was received. 122248613Sdes //------------------------------------------------------------------ 123248613Sdes int SendEnvironmentPacket(char const *name_equal_value); 124248613Sdes int SendEnvironment(const Environment &env); 125248613Sdes 126248613Sdes int SendLaunchArchPacket(const char *arch); 127248613Sdes 128248613Sdes int SendLaunchEventDataPacket(const char *data, 129248613Sdes bool *was_supported = nullptr); 130248613Sdes 131248613Sdes //------------------------------------------------------------------ 132248613Sdes /// Sends a "vAttach:PID" where PID is in hex. 133248613Sdes /// 134248613Sdes /// @param[in] pid 135248613Sdes /// A process ID for the remote gdb server to attach to. 136248613Sdes /// 137248613Sdes /// @param[out] response 138248613Sdes /// The response received from the gdb server. If the return 139248613Sdes /// value is zero, \a response will contain a stop reply 140248613Sdes /// packet. 141248613Sdes /// 142248613Sdes /// @return 143248613Sdes /// Zero if the attach was successful, or an error indicating 144248613Sdes /// an error code. 145248613Sdes //------------------------------------------------------------------ 146248613Sdes int SendAttach(lldb::pid_t pid, StringExtractorGDBRemote &response); 147248613Sdes 148248613Sdes //------------------------------------------------------------------ 149248613Sdes /// Sends a GDB remote protocol 'I' packet that delivers stdin 150248613Sdes /// data to the remote process. 151248613Sdes /// 152248613Sdes /// @param[in] data 153248613Sdes /// A pointer to stdin data. 154248613Sdes /// 155248613Sdes /// @param[in] data_len 156248613Sdes /// The number of bytes available at \a data. 157248613Sdes /// 158248613Sdes /// @return 159248613Sdes /// Zero if the attach was successful, or an error indicating 160248613Sdes /// an error code. 161248613Sdes //------------------------------------------------------------------ 162248613Sdes int SendStdinNotification(const char *data, size_t data_len); 163248613Sdes 164248613Sdes //------------------------------------------------------------------ 165248613Sdes /// Sets the path to use for stdin/out/err for a process 166248613Sdes /// that will be launched with the 'A' packet. 167248613Sdes /// 168248613Sdes /// @param[in] path 169248613Sdes /// The path to use for stdin/out/err 170248613Sdes /// 171248613Sdes /// @return 172248613Sdes /// Zero if the for success, or an error code for failure. 173248613Sdes //------------------------------------------------------------------ 174248613Sdes int SetSTDIN(const FileSpec &file_spec); 175248613Sdes int SetSTDOUT(const FileSpec &file_spec); 176248613Sdes int SetSTDERR(const FileSpec &file_spec); 177248613Sdes 178248613Sdes //------------------------------------------------------------------ 179248613Sdes /// Sets the disable ASLR flag to \a enable for a process that will 180248613Sdes /// be launched with the 'A' packet. 181248613Sdes /// 182248613Sdes /// @param[in] enable 183248613Sdes /// A boolean value indicating whether to disable ASLR or not. 184248613Sdes /// 185248613Sdes /// @return 186248613Sdes /// Zero if the for success, or an error code for failure. 187 //------------------------------------------------------------------ 188 int SetDisableASLR(bool enable); 189 190 //------------------------------------------------------------------ 191 /// Sets the DetachOnError flag to \a enable for the process controlled by the 192 /// stub. 193 /// 194 /// @param[in] enable 195 /// A boolean value indicating whether to detach on error or not. 196 /// 197 /// @return 198 /// Zero if the for success, or an error code for failure. 199 //------------------------------------------------------------------ 200 int SetDetachOnError(bool enable); 201 202 //------------------------------------------------------------------ 203 /// Sets the working directory to \a path for a process that will 204 /// be launched with the 'A' packet for non platform based 205 /// connections. If this packet is sent to a GDB server that 206 /// implements the platform, it will change the current working 207 /// directory for the platform process. 208 /// 209 /// @param[in] working_dir 210 /// The path to a directory to use when launching our process 211 /// 212 /// @return 213 /// Zero if the for success, or an error code for failure. 214 //------------------------------------------------------------------ 215 int SetWorkingDir(const FileSpec &working_dir); 216 217 //------------------------------------------------------------------ 218 /// Gets the current working directory of a remote platform GDB 219 /// server. 220 /// 221 /// @param[out] working_dir 222 /// The current working directory on the remote platform. 223 /// 224 /// @return 225 /// Boolean for success 226 //------------------------------------------------------------------ 227 bool GetWorkingDir(FileSpec &working_dir); 228 229 lldb::addr_t AllocateMemory(size_t size, uint32_t permissions); 230 231 bool DeallocateMemory(lldb::addr_t addr); 232 233 Status Detach(bool keep_stopped); 234 235 Status GetMemoryRegionInfo(lldb::addr_t addr, MemoryRegionInfo &range_info); 236 237 Status GetWatchpointSupportInfo(uint32_t &num); 238 239 Status GetWatchpointSupportInfo(uint32_t &num, bool &after, 240 const ArchSpec &arch); 241 242 Status GetWatchpointsTriggerAfterInstruction(bool &after, 243 const ArchSpec &arch); 244 245 const ArchSpec &GetHostArchitecture(); 246 247 std::chrono::seconds GetHostDefaultPacketTimeout(); 248 249 const ArchSpec &GetProcessArchitecture(); 250 251 void GetRemoteQSupported(); 252 253 bool GetVContSupported(char flavor); 254 255 bool GetpPacketSupported(lldb::tid_t tid); 256 257 bool GetxPacketSupported(); 258 259 bool GetVAttachOrWaitSupported(); 260 261 bool GetSyncThreadStateSupported(); 262 263 void ResetDiscoverableSettings(bool did_exec); 264 265 bool GetHostInfo(bool force = false); 266 267 bool GetDefaultThreadId(lldb::tid_t &tid); 268 269 llvm::VersionTuple GetOSVersion(); 270 271 bool GetOSBuildString(std::string &s); 272 273 bool GetOSKernelDescription(std::string &s); 274 275 ArchSpec GetSystemArchitecture(); 276 277 bool GetHostname(std::string &s); 278 279 lldb::addr_t GetShlibInfoAddr(); 280 281 bool GetSupportsThreadSuffix(); 282 283 bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &process_info); 284 285 uint32_t FindProcesses(const ProcessInstanceInfoMatch &process_match_info, 286 ProcessInstanceInfoList &process_infos); 287 288 bool GetUserName(uint32_t uid, std::string &name); 289 290 bool GetGroupName(uint32_t gid, std::string &name); 291 292 bool HasFullVContSupport() { return GetVContSupported('A'); } 293 294 bool HasAnyVContSupport() { return GetVContSupported('a'); } 295 296 bool GetStopReply(StringExtractorGDBRemote &response); 297 298 bool GetThreadStopInfo(lldb::tid_t tid, StringExtractorGDBRemote &response); 299 300 bool SupportsGDBStoppointPacket(GDBStoppointType type) { 301 switch (type) { 302 case eBreakpointSoftware: 303 return m_supports_z0; 304 case eBreakpointHardware: 305 return m_supports_z1; 306 case eWatchpointWrite: 307 return m_supports_z2; 308 case eWatchpointRead: 309 return m_supports_z3; 310 case eWatchpointReadWrite: 311 return m_supports_z4; 312 default: 313 return false; 314 } 315 } 316 317 uint8_t SendGDBStoppointTypePacket( 318 GDBStoppointType type, // Type of breakpoint or watchpoint 319 bool insert, // Insert or remove? 320 lldb::addr_t addr, // Address of breakpoint or watchpoint 321 uint32_t length); // Byte Size of breakpoint or watchpoint 322 323 bool SetNonStopMode(const bool enable); 324 325 void TestPacketSpeed(const uint32_t num_packets, uint32_t max_send, 326 uint32_t max_recv, uint64_t recv_amount, bool json, 327 Stream &strm); 328 329 // This packet is for testing the speed of the interface only. Both 330 // the client and server need to support it, but this allows us to 331 // measure the packet speed without any other work being done on the 332 // other end and avoids any of that work affecting the packet send 333 // and response times. 334 bool SendSpeedTestPacket(uint32_t send_size, uint32_t recv_size); 335 336 bool SetCurrentThread(uint64_t tid); 337 338 bool SetCurrentThreadForRun(uint64_t tid); 339 340 bool GetQXferAuxvReadSupported(); 341 342 void EnableErrorStringInPacket(); 343 344 bool GetQXferLibrariesReadSupported(); 345 346 bool GetQXferLibrariesSVR4ReadSupported(); 347 348 uint64_t GetRemoteMaxPacketSize(); 349 350 bool GetEchoSupported(); 351 352 bool GetQPassSignalsSupported(); 353 354 bool GetAugmentedLibrariesSVR4ReadSupported(); 355 356 bool GetQXferFeaturesReadSupported(); 357 358 bool GetQXferMemoryMapReadSupported(); 359 360 LazyBool SupportsAllocDeallocMemory() // const 361 { 362 // Uncomment this to have lldb pretend the debug server doesn't respond to 363 // alloc/dealloc memory packets. 364 // m_supports_alloc_dealloc_memory = lldb_private::eLazyBoolNo; 365 return m_supports_alloc_dealloc_memory; 366 } 367 368 size_t GetCurrentThreadIDs(std::vector<lldb::tid_t> &thread_ids, 369 bool &sequence_mutex_unavailable); 370 371 lldb::user_id_t OpenFile(const FileSpec &file_spec, uint32_t flags, 372 mode_t mode, Status &error); 373 374 bool CloseFile(lldb::user_id_t fd, Status &error); 375 376 lldb::user_id_t GetFileSize(const FileSpec &file_spec); 377 378 Status GetFilePermissions(const FileSpec &file_spec, 379 uint32_t &file_permissions); 380 381 Status SetFilePermissions(const FileSpec &file_spec, 382 uint32_t file_permissions); 383 384 uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst, 385 uint64_t dst_len, Status &error); 386 387 uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src, 388 uint64_t src_len, Status &error); 389 390 Status CreateSymlink(const FileSpec &src, const FileSpec &dst); 391 392 Status Unlink(const FileSpec &file_spec); 393 394 Status MakeDirectory(const FileSpec &file_spec, uint32_t mode); 395 396 bool GetFileExists(const FileSpec &file_spec); 397 398 Status RunShellCommand( 399 const char *command, // Shouldn't be nullptr 400 const FileSpec &working_dir, // Pass empty FileSpec to use the current 401 // working directory 402 int *status_ptr, // Pass nullptr if you don't want the process exit status 403 int *signo_ptr, // Pass nullptr if you don't want the signal that caused 404 // the process to exit 405 std::string 406 *command_output, // Pass nullptr if you don't want the command output 407 const Timeout<std::micro> &timeout); 408 409 bool CalculateMD5(const FileSpec &file_spec, uint64_t &high, uint64_t &low); 410 411 lldb::DataBufferSP ReadRegister( 412 lldb::tid_t tid, 413 uint32_t 414 reg_num); // Must be the eRegisterKindProcessPlugin register number 415 416 lldb::DataBufferSP ReadAllRegisters(lldb::tid_t tid); 417 418 bool 419 WriteRegister(lldb::tid_t tid, 420 uint32_t reg_num, // eRegisterKindProcessPlugin register number 421 llvm::ArrayRef<uint8_t> data); 422 423 bool WriteAllRegisters(lldb::tid_t tid, llvm::ArrayRef<uint8_t> data); 424 425 bool SaveRegisterState(lldb::tid_t tid, uint32_t &save_id); 426 427 bool RestoreRegisterState(lldb::tid_t tid, uint32_t save_id); 428 429 bool SyncThreadState(lldb::tid_t tid); 430 431 const char *GetGDBServerProgramName(); 432 433 uint32_t GetGDBServerProgramVersion(); 434 435 bool AvoidGPackets(ProcessGDBRemote *process); 436 437 StructuredData::ObjectSP GetThreadsInfo(); 438 439 bool GetThreadExtendedInfoSupported(); 440 441 bool GetLoadedDynamicLibrariesInfosSupported(); 442 443 bool GetSharedCacheInfoSupported(); 444 445 bool GetModuleInfo(const FileSpec &module_file_spec, 446 const ArchSpec &arch_spec, ModuleSpec &module_spec); 447 448 llvm::Optional<std::vector<ModuleSpec>> 449 GetModulesInfo(llvm::ArrayRef<FileSpec> module_file_specs, 450 const llvm::Triple &triple); 451 452 bool ReadExtFeature(const lldb_private::ConstString object, 453 const lldb_private::ConstString annex, std::string &out, 454 lldb_private::Status &err); 455 456 void ServeSymbolLookups(lldb_private::Process *process); 457 458 // Sends QPassSignals packet to the server with given signals to ignore. 459 Status SendSignalsToIgnore(llvm::ArrayRef<int32_t> signals); 460 461 //------------------------------------------------------------------ 462 /// Return the feature set supported by the gdb-remote server. 463 /// 464 /// This method returns the remote side's response to the qSupported 465 /// packet. The response is the complete string payload returned 466 /// to the client. 467 /// 468 /// @return 469 /// The string returned by the server to the qSupported query. 470 //------------------------------------------------------------------ 471 const std::string &GetServerSupportedFeatures() const { 472 return m_qSupported_response; 473 } 474 475 //------------------------------------------------------------------ 476 /// Return the array of async JSON packet types supported by the remote. 477 /// 478 /// This method returns the remote side's array of supported JSON 479 /// packet types as a list of type names. Each of the results are 480 /// expected to have an Enable{type_name} command to enable and configure 481 /// the related feature. Each type_name for an enabled feature will 482 /// possibly send async-style packets that contain a payload of a 483 /// binhex-encoded JSON dictionary. The dictionary will have a 484 /// string field named 'type', that contains the type_name of the 485 /// supported packet type. 486 /// 487 /// There is a Plugin category called structured-data plugins. 488 /// A plugin indicates whether it knows how to handle a type_name. 489 /// If so, it can be used to process the async JSON packet. 490 /// 491 /// @return 492 /// The string returned by the server to the qSupported query. 493 //------------------------------------------------------------------ 494 lldb_private::StructuredData::Array *GetSupportedStructuredDataPlugins(); 495 496 //------------------------------------------------------------------ 497 /// Configure a StructuredData feature on the remote end. 498 /// 499 /// @see \b Process::ConfigureStructuredData(...) for details. 500 //------------------------------------------------------------------ 501 Status 502 ConfigureRemoteStructuredData(const ConstString &type_name, 503 const StructuredData::ObjectSP &config_sp); 504 505 lldb::user_id_t SendStartTracePacket(const TraceOptions &options, 506 Status &error); 507 508 Status SendStopTracePacket(lldb::user_id_t uid, lldb::tid_t thread_id); 509 510 Status SendGetDataPacket(lldb::user_id_t uid, lldb::tid_t thread_id, 511 llvm::MutableArrayRef<uint8_t> &buffer, 512 size_t offset = 0); 513 514 Status SendGetMetaDataPacket(lldb::user_id_t uid, lldb::tid_t thread_id, 515 llvm::MutableArrayRef<uint8_t> &buffer, 516 size_t offset = 0); 517 518 Status SendGetTraceConfigPacket(lldb::user_id_t uid, TraceOptions &options); 519 520protected: 521 LazyBool m_supports_not_sending_acks; 522 LazyBool m_supports_thread_suffix; 523 LazyBool m_supports_threads_in_stop_reply; 524 LazyBool m_supports_vCont_all; 525 LazyBool m_supports_vCont_any; 526 LazyBool m_supports_vCont_c; 527 LazyBool m_supports_vCont_C; 528 LazyBool m_supports_vCont_s; 529 LazyBool m_supports_vCont_S; 530 LazyBool m_qHostInfo_is_valid; 531 LazyBool m_curr_pid_is_valid; 532 LazyBool m_qProcessInfo_is_valid; 533 LazyBool m_qGDBServerVersion_is_valid; 534 LazyBool m_supports_alloc_dealloc_memory; 535 LazyBool m_supports_memory_region_info; 536 LazyBool m_supports_watchpoint_support_info; 537 LazyBool m_supports_detach_stay_stopped; 538 LazyBool m_watchpoints_trigger_after_instruction; 539 LazyBool m_attach_or_wait_reply; 540 LazyBool m_prepare_for_reg_writing_reply; 541 LazyBool m_supports_p; 542 LazyBool m_supports_x; 543 LazyBool m_avoid_g_packets; 544 LazyBool m_supports_QSaveRegisterState; 545 LazyBool m_supports_qXfer_auxv_read; 546 LazyBool m_supports_qXfer_libraries_read; 547 LazyBool m_supports_qXfer_libraries_svr4_read; 548 LazyBool m_supports_qXfer_features_read; 549 LazyBool m_supports_qXfer_memory_map_read; 550 LazyBool m_supports_augmented_libraries_svr4_read; 551 LazyBool m_supports_jThreadExtendedInfo; 552 LazyBool m_supports_jLoadedDynamicLibrariesInfos; 553 LazyBool m_supports_jGetSharedCacheInfo; 554 LazyBool m_supports_QPassSignals; 555 LazyBool m_supports_error_string_reply; 556 557 bool m_supports_qProcessInfoPID : 1, m_supports_qfProcessInfo : 1, 558 m_supports_qUserName : 1, m_supports_qGroupName : 1, 559 m_supports_qThreadStopInfo : 1, m_supports_z0 : 1, m_supports_z1 : 1, 560 m_supports_z2 : 1, m_supports_z3 : 1, m_supports_z4 : 1, 561 m_supports_QEnvironment : 1, m_supports_QEnvironmentHexEncoded : 1, 562 m_supports_qSymbol : 1, m_qSymbol_requests_done : 1, 563 m_supports_qModuleInfo : 1, m_supports_jThreadsInfo : 1, 564 m_supports_jModulesInfo : 1; 565 566 lldb::pid_t m_curr_pid; 567 lldb::tid_t m_curr_tid; // Current gdb remote protocol thread index for all 568 // other operations 569 lldb::tid_t m_curr_tid_run; // Current gdb remote protocol thread index for 570 // continue, step, etc 571 572 uint32_t m_num_supported_hardware_watchpoints; 573 574 ArchSpec m_host_arch; 575 ArchSpec m_process_arch; 576 llvm::VersionTuple m_os_version; 577 std::string m_os_build; 578 std::string m_os_kernel; 579 std::string m_hostname; 580 std::string m_gdb_server_name; // from reply to qGDBServerVersion, empty if 581 // qGDBServerVersion is not supported 582 uint32_t m_gdb_server_version; // from reply to qGDBServerVersion, zero if 583 // qGDBServerVersion is not supported 584 std::chrono::seconds m_default_packet_timeout; 585 uint64_t m_max_packet_size; // as returned by qSupported 586 std::string m_qSupported_response; // the complete response to qSupported 587 588 bool m_supported_async_json_packets_is_valid; 589 lldb_private::StructuredData::ObjectSP m_supported_async_json_packets_sp; 590 591 std::vector<MemoryRegionInfo> m_qXfer_memory_map; 592 bool m_qXfer_memory_map_loaded; 593 594 bool GetCurrentProcessInfo(bool allow_lazy_pid = true); 595 596 bool GetGDBServerVersion(); 597 598 // Given the list of compression types that the remote debug stub can support, 599 // possibly enable compression if we find an encoding we can handle. 600 void MaybeEnableCompression(std::vector<std::string> supported_compressions); 601 602 bool DecodeProcessInfoResponse(StringExtractorGDBRemote &response, 603 ProcessInstanceInfo &process_info); 604 605 void OnRunPacketSent(bool first) override; 606 607 PacketResult SendThreadSpecificPacketAndWaitForResponse( 608 lldb::tid_t tid, StreamString &&payload, 609 StringExtractorGDBRemote &response, bool send_async); 610 611 Status SendGetTraceDataPacket(StreamGDBRemote &packet, lldb::user_id_t uid, 612 lldb::tid_t thread_id, 613 llvm::MutableArrayRef<uint8_t> &buffer, 614 size_t offset); 615 616 Status LoadQXferMemoryMap(); 617 618 Status GetQXferMemoryMapRegionInfo(lldb::addr_t addr, 619 MemoryRegionInfo ®ion); 620 621private: 622 DISALLOW_COPY_AND_ASSIGN(GDBRemoteCommunicationClient); 623}; 624 625} // namespace process_gdb_remote 626} // namespace lldb_private 627 628#endif // liblldb_GDBRemoteCommunicationClient_h_ 629