Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 1 | //===-- GDBRemoteCommunicationClient.h --------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef liblldb_GDBRemoteCommunicationClient_h_ |
| 11 | #define liblldb_GDBRemoteCommunicationClient_h_ |
| 12 | |
Pavel Labath | b42b48e | 2016-08-19 12:31:49 +0000 | [diff] [blame] | 13 | #include "GDBRemoteClientBase.h" |
| 14 | |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 15 | // C Includes |
| 16 | // C++ Includes |
Pavel Labath | 8c1b6bd | 2016-08-09 12:04:46 +0000 | [diff] [blame] | 17 | #include <chrono> |
Eugene Zelenko | edb35d9 | 2015-10-24 01:08:35 +0000 | [diff] [blame] | 18 | #include <map> |
Saleem Abdulrasool | 16ff860 | 2016-05-18 01:59:10 +0000 | [diff] [blame] | 19 | #include <mutex> |
Eugene Zelenko | edb35d9 | 2015-10-24 01:08:35 +0000 | [diff] [blame] | 20 | #include <string> |
Greg Clayton | adc00cb | 2011-05-20 23:38:13 +0000 | [diff] [blame] | 21 | #include <vector> |
| 22 | |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 23 | // Other libraries and framework includes |
| 24 | // Project includes |
| 25 | #include "lldb/Core/ArchSpec.h" |
Greg Clayton | 358cf1e | 2015-06-25 21:46:34 +0000 | [diff] [blame] | 26 | #include "lldb/Core/StructuredData.h" |
Greg Clayton | 46fb558 | 2011-11-18 07:03:08 +0000 | [diff] [blame] | 27 | #include "lldb/Target/Process.h" |
Ravitheja Addepally | e714c4f | 2017-05-26 11:46:27 +0000 | [diff] [blame] | 28 | #include "lldb/Utility/StreamGDBRemote.h" |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 29 | |
Pavel Labath | 2f1fbae | 2016-09-08 10:07:04 +0000 | [diff] [blame] | 30 | #include "llvm/ADT/Optional.h" |
| 31 | |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 32 | namespace lldb_private { |
| 33 | namespace process_gdb_remote { |
| 34 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 35 | class GDBRemoteCommunicationClient : public GDBRemoteClientBase { |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 36 | public: |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 37 | GDBRemoteCommunicationClient(); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 38 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 39 | ~GDBRemoteCommunicationClient() override; |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 40 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 41 | //------------------------------------------------------------------ |
| 42 | // After connecting, send the handshake to the server to make sure |
| 43 | // we are communicating with it. |
| 44 | //------------------------------------------------------------------ |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 45 | bool HandshakeWithServer(Status *error_ptr); |
Greg Clayton | 1cb6496 | 2011-03-24 04:28:38 +0000 | [diff] [blame] | 46 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 47 | // For packets which specify a range of output to be returned, |
| 48 | // return all of the output via a series of request packets of the form |
| 49 | // <prefix>0,<size> |
| 50 | // <prefix><size>,<size> |
| 51 | // <prefix><size>*2,<size> |
| 52 | // <prefix><size>*3,<size> |
| 53 | // ... |
| 54 | // until a "$l..." packet is received, indicating the end. |
| 55 | // (size is in hex; this format is used by a standard gdbserver to |
| 56 | // return the given portion of the output specified by <prefix>; |
| 57 | // for example, "qXfer:libraries-svr4:read::fff,1000" means |
| 58 | // "return a chunk of the xml description file for shared |
| 59 | // library load addresses, where the chunk starts at offset 0xfff |
| 60 | // and continues for 0x1000 bytes"). |
| 61 | // Concatenate the resulting server response packets together and |
| 62 | // return in response_string. If any packet fails, the return value |
| 63 | // indicates that failure and the returned string value is undefined. |
| 64 | PacketResult |
| 65 | SendPacketsAndConcatenateResponses(const char *send_payload_prefix, |
| 66 | std::string &response_string); |
Steve Pucci | 5ae54ae | 2014-01-25 05:46:51 +0000 | [diff] [blame] | 67 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 68 | bool GetThreadSuffixSupported(); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 69 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 70 | // This packet is usually sent first and the boolean return value |
| 71 | // indicates if the packet was send and any response was received |
| 72 | // even in the response is UNIMPLEMENTED. If the packet failed to |
| 73 | // get a response, then false is returned. This quickly tells us |
| 74 | // if we were able to connect and communicate with the remote GDB |
| 75 | // server |
| 76 | bool QueryNoAckModeSupported(); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 77 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 78 | void GetListThreadsInStopReplySupported(); |
Greg Clayton | 4463399 | 2012-04-10 03:22:03 +0000 | [diff] [blame] | 79 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 80 | lldb::pid_t GetCurrentProcessID(bool allow_lazy = true); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 81 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 82 | bool GetLaunchSuccess(std::string &error_str); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 83 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 84 | bool LaunchGDBServer(const char *remote_accept_hostname, lldb::pid_t &pid, |
| 85 | uint16_t &port, std::string &socket_name); |
Tamas Berghammer | ccd6cff | 2015-12-08 14:08:19 +0000 | [diff] [blame] | 86 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 87 | size_t QueryGDBServer( |
| 88 | std::vector<std::pair<uint16_t, std::string>> &connection_urls); |
Tamas Berghammer | ccd6cff | 2015-12-08 14:08:19 +0000 | [diff] [blame] | 89 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 90 | bool KillSpawnedProcess(lldb::pid_t pid); |
Greg Clayton | 8b82f08 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 91 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 92 | //------------------------------------------------------------------ |
| 93 | /// Sends a GDB remote protocol 'A' packet that delivers program |
| 94 | /// arguments to the remote server. |
| 95 | /// |
| 96 | /// @param[in] argv |
| 97 | /// A NULL terminated array of const C strings to use as the |
| 98 | /// arguments. |
| 99 | /// |
| 100 | /// @return |
| 101 | /// Zero if the response was "OK", a positive value if the |
| 102 | /// the response was "Exx" where xx are two hex digits, or |
| 103 | /// -1 if the call is unsupported or any other unexpected |
| 104 | /// response was received. |
| 105 | //------------------------------------------------------------------ |
| 106 | int SendArgumentsPacket(const ProcessLaunchInfo &launch_info); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 107 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 108 | //------------------------------------------------------------------ |
| 109 | /// Sends a "QEnvironment:NAME=VALUE" packet that will build up the |
| 110 | /// environment that will get used when launching an application |
| 111 | /// in conjunction with the 'A' packet. This function can be called |
| 112 | /// multiple times in a row in order to pass on the desired |
| 113 | /// environment that the inferior should be launched with. |
| 114 | /// |
| 115 | /// @param[in] name_equal_value |
| 116 | /// A NULL terminated C string that contains a single environment |
| 117 | /// in the format "NAME=VALUE". |
| 118 | /// |
| 119 | /// @return |
| 120 | /// Zero if the response was "OK", a positive value if the |
| 121 | /// the response was "Exx" where xx are two hex digits, or |
| 122 | /// -1 if the call is unsupported or any other unexpected |
| 123 | /// response was received. |
| 124 | //------------------------------------------------------------------ |
| 125 | int SendEnvironmentPacket(char const *name_equal_value); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 126 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 127 | int SendLaunchArchPacket(const char *arch); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 128 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 129 | int SendLaunchEventDataPacket(const char *data, |
| 130 | bool *was_supported = nullptr); |
Vince Harron | e0be425 | 2015-02-06 18:32:57 +0000 | [diff] [blame] | 131 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 132 | //------------------------------------------------------------------ |
| 133 | /// Sends a "vAttach:PID" where PID is in hex. |
| 134 | /// |
| 135 | /// @param[in] pid |
| 136 | /// A process ID for the remote gdb server to attach to. |
| 137 | /// |
| 138 | /// @param[out] response |
| 139 | /// The response received from the gdb server. If the return |
| 140 | /// value is zero, \a response will contain a stop reply |
| 141 | /// packet. |
| 142 | /// |
| 143 | /// @return |
| 144 | /// Zero if the attach was successful, or an error indicating |
| 145 | /// an error code. |
| 146 | //------------------------------------------------------------------ |
| 147 | int SendAttach(lldb::pid_t pid, StringExtractorGDBRemote &response); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 148 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 149 | //------------------------------------------------------------------ |
| 150 | /// Sends a GDB remote protocol 'I' packet that delivers stdin |
| 151 | /// data to the remote process. |
| 152 | /// |
| 153 | /// @param[in] data |
| 154 | /// A pointer to stdin data. |
| 155 | /// |
| 156 | /// @param[in] data_len |
| 157 | /// The number of bytes available at \a data. |
| 158 | /// |
| 159 | /// @return |
| 160 | /// Zero if the attach was successful, or an error indicating |
| 161 | /// an error code. |
| 162 | //------------------------------------------------------------------ |
| 163 | int SendStdinNotification(const char *data, size_t data_len); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 164 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 165 | //------------------------------------------------------------------ |
| 166 | /// Sets the path to use for stdin/out/err for a process |
| 167 | /// that will be launched with the 'A' packet. |
| 168 | /// |
| 169 | /// @param[in] path |
| 170 | /// The path to use for stdin/out/err |
| 171 | /// |
| 172 | /// @return |
| 173 | /// Zero if the for success, or an error code for failure. |
| 174 | //------------------------------------------------------------------ |
| 175 | int SetSTDIN(const FileSpec &file_spec); |
| 176 | int SetSTDOUT(const FileSpec &file_spec); |
| 177 | int SetSTDERR(const FileSpec &file_spec); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 178 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 179 | //------------------------------------------------------------------ |
| 180 | /// Sets the disable ASLR flag to \a enable for a process that will |
| 181 | /// be launched with the 'A' packet. |
| 182 | /// |
| 183 | /// @param[in] enable |
| 184 | /// A boolean value indicating whether to disable ASLR or not. |
| 185 | /// |
| 186 | /// @return |
| 187 | /// Zero if the for success, or an error code for failure. |
| 188 | //------------------------------------------------------------------ |
| 189 | int SetDisableASLR(bool enable); |
Greg Clayton | fbb7634 | 2013-11-20 21:07:01 +0000 | [diff] [blame] | 190 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 191 | //------------------------------------------------------------------ |
| 192 | /// Sets the DetachOnError flag to \a enable for the process controlled by the |
| 193 | /// stub. |
| 194 | /// |
| 195 | /// @param[in] enable |
| 196 | /// A boolean value indicating whether to detach on error or not. |
| 197 | /// |
| 198 | /// @return |
| 199 | /// Zero if the for success, or an error code for failure. |
| 200 | //------------------------------------------------------------------ |
| 201 | int SetDetachOnError(bool enable); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 202 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 203 | //------------------------------------------------------------------ |
| 204 | /// Sets the working directory to \a path for a process that will |
| 205 | /// be launched with the 'A' packet for non platform based |
| 206 | /// connections. If this packet is sent to a GDB server that |
| 207 | /// implements the platform, it will change the current working |
| 208 | /// directory for the platform process. |
| 209 | /// |
| 210 | /// @param[in] working_dir |
| 211 | /// The path to a directory to use when launching our process |
| 212 | /// |
| 213 | /// @return |
| 214 | /// Zero if the for success, or an error code for failure. |
| 215 | //------------------------------------------------------------------ |
| 216 | int SetWorkingDir(const FileSpec &working_dir); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 217 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 218 | //------------------------------------------------------------------ |
| 219 | /// Gets the current working directory of a remote platform GDB |
| 220 | /// server. |
| 221 | /// |
| 222 | /// @param[out] working_dir |
| 223 | /// The current working directory on the remote platform. |
| 224 | /// |
| 225 | /// @return |
| 226 | /// Boolean for success |
| 227 | //------------------------------------------------------------------ |
| 228 | bool GetWorkingDir(FileSpec &working_dir); |
Greg Clayton | 37a0a24 | 2012-04-11 00:24:49 +0000 | [diff] [blame] | 229 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 230 | lldb::addr_t AllocateMemory(size_t size, uint32_t permissions); |
Greg Clayton | 46fb558 | 2011-11-18 07:03:08 +0000 | [diff] [blame] | 231 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 232 | bool DeallocateMemory(lldb::addr_t addr); |
Johnny Chen | 6463720 | 2012-05-23 21:09:52 +0000 | [diff] [blame] | 233 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 234 | Status Detach(bool keep_stopped); |
Enrico Granata | f04a219 | 2012-07-13 23:18:48 +0000 | [diff] [blame] | 235 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 236 | Status GetMemoryRegionInfo(lldb::addr_t addr, MemoryRegionInfo &range_info); |
Jason Molenda | f17b5ac | 2012-12-19 02:54:03 +0000 | [diff] [blame] | 237 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 238 | Status GetWatchpointSupportInfo(uint32_t &num); |
Jason Molenda | f17b5ac | 2012-12-19 02:54:03 +0000 | [diff] [blame] | 239 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 240 | Status GetWatchpointSupportInfo(uint32_t &num, bool &after, |
| 241 | const ArchSpec &arch); |
Steve Pucci | 5ae54ae | 2014-01-25 05:46:51 +0000 | [diff] [blame] | 242 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 243 | Status GetWatchpointsTriggerAfterInstruction(bool &after, |
| 244 | const ArchSpec &arch); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 245 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 246 | const ArchSpec &GetHostArchitecture(); |
Hafiz Abid Qadeer | 9a78cdf | 2013-08-29 09:09:45 +0000 | [diff] [blame] | 247 | |
Pavel Labath | 3aa0491 | 2016-10-31 17:19:42 +0000 | [diff] [blame] | 248 | std::chrono::seconds GetHostDefaultPacketTimeout(); |
Jason Molenda | bdc4f12 | 2014-05-06 02:59:39 +0000 | [diff] [blame] | 249 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 250 | const ArchSpec &GetProcessArchitecture(); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 251 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 252 | void GetRemoteQSupported(); |
Ewan Crawford | 78baa19 | 2015-05-13 09:18:18 +0000 | [diff] [blame] | 253 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 254 | bool GetVContSupported(char flavor); |
Greg Clayton | 1cb6496 | 2011-03-24 04:28:38 +0000 | [diff] [blame] | 255 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 256 | bool GetpPacketSupported(lldb::tid_t tid); |
Greg Clayton | 1cb6496 | 2011-03-24 04:28:38 +0000 | [diff] [blame] | 257 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 258 | bool GetxPacketSupported(); |
Greg Clayton | 1cb6496 | 2011-03-24 04:28:38 +0000 | [diff] [blame] | 259 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 260 | bool GetVAttachOrWaitSupported(); |
Greg Clayton | 1cb6496 | 2011-03-24 04:28:38 +0000 | [diff] [blame] | 261 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 262 | bool GetSyncThreadStateSupported(); |
Greg Clayton | 37a0a24 | 2012-04-11 00:24:49 +0000 | [diff] [blame] | 263 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 264 | void ResetDiscoverableSettings(bool did_exec); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 265 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 266 | bool GetHostInfo(bool force = false); |
Greg Clayton | 32e0a75 | 2011-03-30 18:16:51 +0000 | [diff] [blame] | 267 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 268 | bool GetDefaultThreadId(lldb::tid_t &tid); |
Greg Clayton | 32e0a75 | 2011-03-30 18:16:51 +0000 | [diff] [blame] | 269 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 270 | bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update); |
Greg Clayton | 32e0a75 | 2011-03-30 18:16:51 +0000 | [diff] [blame] | 271 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 272 | bool GetOSBuildString(std::string &s); |
| 273 | |
| 274 | bool GetOSKernelDescription(std::string &s); |
| 275 | |
| 276 | ArchSpec GetSystemArchitecture(); |
| 277 | |
| 278 | bool GetHostname(std::string &s); |
| 279 | |
| 280 | lldb::addr_t GetShlibInfoAddr(); |
| 281 | |
| 282 | bool GetSupportsThreadSuffix(); |
| 283 | |
| 284 | bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &process_info); |
| 285 | |
| 286 | uint32_t FindProcesses(const ProcessInstanceInfoMatch &process_match_info, |
| 287 | ProcessInstanceInfoList &process_infos); |
| 288 | |
| 289 | bool GetUserName(uint32_t uid, std::string &name); |
| 290 | |
| 291 | bool GetGroupName(uint32_t gid, std::string &name); |
| 292 | |
| 293 | bool HasFullVContSupport() { return GetVContSupported('A'); } |
| 294 | |
| 295 | bool HasAnyVContSupport() { return GetVContSupported('a'); } |
| 296 | |
| 297 | bool GetStopReply(StringExtractorGDBRemote &response); |
| 298 | |
| 299 | bool GetThreadStopInfo(lldb::tid_t tid, StringExtractorGDBRemote &response); |
| 300 | |
| 301 | bool SupportsGDBStoppointPacket(GDBStoppointType type) { |
| 302 | switch (type) { |
| 303 | case eBreakpointSoftware: |
| 304 | return m_supports_z0; |
| 305 | case eBreakpointHardware: |
| 306 | return m_supports_z1; |
| 307 | case eWatchpointWrite: |
| 308 | return m_supports_z2; |
| 309 | case eWatchpointRead: |
| 310 | return m_supports_z3; |
| 311 | case eWatchpointReadWrite: |
| 312 | return m_supports_z4; |
| 313 | default: |
| 314 | return false; |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 315 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 316 | } |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 317 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 318 | uint8_t SendGDBStoppointTypePacket( |
| 319 | GDBStoppointType type, // Type of breakpoint or watchpoint |
| 320 | bool insert, // Insert or remove? |
| 321 | lldb::addr_t addr, // Address of breakpoint or watchpoint |
| 322 | uint32_t length); // Byte Size of breakpoint or watchpoint |
Greg Clayton | 8b82f08 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 323 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 324 | bool SetNonStopMode(const bool enable); |
Greg Clayton | 8b82f08 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 325 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 326 | void TestPacketSpeed(const uint32_t num_packets, uint32_t max_send, |
Pavel Labath | 2fd9a1e | 2016-11-04 11:49:06 +0000 | [diff] [blame] | 327 | uint32_t max_recv, uint64_t recv_amount, bool json, |
| 328 | Stream &strm); |
Eugene Zelenko | edb35d9 | 2015-10-24 01:08:35 +0000 | [diff] [blame] | 329 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 330 | // This packet is for testing the speed of the interface only. Both |
| 331 | // the client and server need to support it, but this allows us to |
| 332 | // measure the packet speed without any other work being done on the |
| 333 | // other end and avoids any of that work affecting the packet send |
| 334 | // and response times. |
| 335 | bool SendSpeedTestPacket(uint32_t send_size, uint32_t recv_size); |
Greg Clayton | 8b82f08 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 336 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 337 | bool SetCurrentThread(uint64_t tid); |
Ewan Crawford | 78baa19 | 2015-05-13 09:18:18 +0000 | [diff] [blame] | 338 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 339 | bool SetCurrentThreadForRun(uint64_t tid); |
Greg Clayton | 9b1e1cd | 2011-04-04 18:18:57 +0000 | [diff] [blame] | 340 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 341 | bool GetQXferAuxvReadSupported(); |
Greg Clayton | 8b82f08 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 342 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 343 | bool GetQXferLibrariesReadSupported(); |
Steve Pucci | 03904ac | 2014-03-04 23:18:46 +0000 | [diff] [blame] | 344 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 345 | bool GetQXferLibrariesSVR4ReadSupported(); |
Steve Pucci | 5ae54ae | 2014-01-25 05:46:51 +0000 | [diff] [blame] | 346 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 347 | uint64_t GetRemoteMaxPacketSize(); |
Steve Pucci | 5ae54ae | 2014-01-25 05:46:51 +0000 | [diff] [blame] | 348 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 349 | bool GetEchoSupported(); |
Steve Pucci | 5ae54ae | 2014-01-25 05:46:51 +0000 | [diff] [blame] | 350 | |
Eugene Zemtsov | 7993cc5 | 2017-03-07 21:34:40 +0000 | [diff] [blame] | 351 | bool GetQPassSignalsSupported(); |
| 352 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 353 | bool GetAugmentedLibrariesSVR4ReadSupported(); |
Greg Clayton | b30c50c | 2015-05-29 00:01:55 +0000 | [diff] [blame] | 354 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 355 | bool GetQXferFeaturesReadSupported(); |
Steve Pucci | 5ae54ae | 2014-01-25 05:46:51 +0000 | [diff] [blame] | 356 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 357 | LazyBool SupportsAllocDeallocMemory() // const |
| 358 | { |
| 359 | // Uncomment this to have lldb pretend the debug server doesn't respond to |
| 360 | // alloc/dealloc memory packets. |
| 361 | // m_supports_alloc_dealloc_memory = lldb_private::eLazyBoolNo; |
| 362 | return m_supports_alloc_dealloc_memory; |
| 363 | } |
Colin Riley | c3c95b2 | 2015-04-16 15:51:33 +0000 | [diff] [blame] | 364 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 365 | size_t GetCurrentThreadIDs(std::vector<lldb::tid_t> &thread_ids, |
| 366 | bool &sequence_mutex_unavailable); |
Greg Clayton | 2a48f52 | 2011-05-14 01:50:35 +0000 | [diff] [blame] | 367 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 368 | lldb::user_id_t OpenFile(const FileSpec &file_spec, uint32_t flags, |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 369 | mode_t mode, Status &error); |
Daniel Malea | e0f8f57 | 2013-08-26 23:57:52 +0000 | [diff] [blame] | 370 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 371 | bool CloseFile(lldb::user_id_t fd, Status &error); |
Greg Clayton | fbb7634 | 2013-11-20 21:07:01 +0000 | [diff] [blame] | 372 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 373 | lldb::user_id_t GetFileSize(const FileSpec &file_spec); |
Greg Clayton | fbb7634 | 2013-11-20 21:07:01 +0000 | [diff] [blame] | 374 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 375 | Status GetFilePermissions(const FileSpec &file_spec, |
| 376 | uint32_t &file_permissions); |
Chaoren Lin | d3173f3 | 2015-05-29 19:52:29 +0000 | [diff] [blame] | 377 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 378 | Status SetFilePermissions(const FileSpec &file_spec, |
| 379 | uint32_t file_permissions); |
Chaoren Lin | d3173f3 | 2015-05-29 19:52:29 +0000 | [diff] [blame] | 380 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 381 | uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst, |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 382 | uint64_t dst_len, Status &error); |
Daniel Malea | e0f8f57 | 2013-08-26 23:57:52 +0000 | [diff] [blame] | 383 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 384 | uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src, |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 385 | uint64_t src_len, Status &error); |
Greg Clayton | f74cf86 | 2013-11-13 23:28:31 +0000 | [diff] [blame] | 386 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 387 | Status CreateSymlink(const FileSpec &src, const FileSpec &dst); |
Greg Clayton | f74cf86 | 2013-11-13 23:28:31 +0000 | [diff] [blame] | 388 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 389 | Status Unlink(const FileSpec &file_spec); |
Pavel Labath | 56d7262 | 2016-08-17 08:53:31 +0000 | [diff] [blame] | 390 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 391 | Status MakeDirectory(const FileSpec &file_spec, uint32_t mode); |
Pavel Labath | 56d7262 | 2016-08-17 08:53:31 +0000 | [diff] [blame] | 392 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 393 | bool GetFileExists(const FileSpec &file_spec); |
Pavel Labath | 56d7262 | 2016-08-17 08:53:31 +0000 | [diff] [blame] | 394 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 395 | Status RunShellCommand( |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 396 | const char *command, // Shouldn't be nullptr |
| 397 | const FileSpec &working_dir, // Pass empty FileSpec to use the current |
| 398 | // working directory |
| 399 | int *status_ptr, // Pass nullptr if you don't want the process exit status |
| 400 | int *signo_ptr, // Pass nullptr if you don't want the signal that caused |
| 401 | // the process to exit |
| 402 | std::string |
| 403 | *command_output, // Pass nullptr if you don't want the command output |
| 404 | uint32_t timeout_sec); // Timeout in seconds to wait for shell program to |
| 405 | // finish |
Jason Molenda | a332978 | 2014-03-29 18:54:20 +0000 | [diff] [blame] | 406 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 407 | bool CalculateMD5(const FileSpec &file_spec, uint64_t &high, uint64_t &low); |
Pavel Labath | 27402d2 | 2016-08-18 12:32:41 +0000 | [diff] [blame] | 408 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 409 | lldb::DataBufferSP ReadRegister( |
| 410 | lldb::tid_t tid, |
| 411 | uint32_t |
| 412 | reg_num); // Must be the eRegisterKindProcessPlugin register number |
Jason Molenda | a332978 | 2014-03-29 18:54:20 +0000 | [diff] [blame] | 413 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 414 | lldb::DataBufferSP ReadAllRegisters(lldb::tid_t tid); |
Jason Molenda | a332978 | 2014-03-29 18:54:20 +0000 | [diff] [blame] | 415 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 416 | bool |
| 417 | WriteRegister(lldb::tid_t tid, |
| 418 | uint32_t reg_num, // eRegisterKindProcessPlugin register number |
| 419 | llvm::ArrayRef<uint8_t> data); |
Greg Clayton | 358cf1e | 2015-06-25 21:46:34 +0000 | [diff] [blame] | 420 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 421 | bool WriteAllRegisters(lldb::tid_t tid, llvm::ArrayRef<uint8_t> data); |
Jason Molenda | 705b180 | 2014-06-13 02:37:02 +0000 | [diff] [blame] | 422 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 423 | bool SaveRegisterState(lldb::tid_t tid, uint32_t &save_id); |
Jason Molenda | 20ee21b | 2015-07-10 23:15:22 +0000 | [diff] [blame] | 424 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 425 | bool RestoreRegisterState(lldb::tid_t tid, uint32_t save_id); |
Jason Molenda | 3739735 | 2016-07-22 00:17:55 +0000 | [diff] [blame] | 426 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 427 | bool SyncThreadState(lldb::tid_t tid); |
Oleksiy Vyalov | 6801be3 | 2015-02-25 22:15:44 +0000 | [diff] [blame] | 428 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 429 | const char *GetGDBServerProgramName(); |
Colin Riley | c3c95b2 | 2015-04-16 15:51:33 +0000 | [diff] [blame] | 430 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 431 | uint32_t GetGDBServerProgramVersion(); |
Greg Clayton | 0b90be1 | 2015-06-23 21:27:50 +0000 | [diff] [blame] | 432 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 433 | bool AvoidGPackets(ProcessGDBRemote *process); |
Todd Fiala | 7593001 | 2016-08-19 04:21:48 +0000 | [diff] [blame] | 434 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 435 | StructuredData::ObjectSP GetThreadsInfo(); |
Todd Fiala | 7593001 | 2016-08-19 04:21:48 +0000 | [diff] [blame] | 436 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 437 | bool GetThreadExtendedInfoSupported(); |
| 438 | |
| 439 | bool GetLoadedDynamicLibrariesInfosSupported(); |
| 440 | |
| 441 | bool GetSharedCacheInfoSupported(); |
| 442 | |
| 443 | bool GetModuleInfo(const FileSpec &module_file_spec, |
| 444 | const ArchSpec &arch_spec, ModuleSpec &module_spec); |
| 445 | |
Pavel Labath | 2f1fbae | 2016-09-08 10:07:04 +0000 | [diff] [blame] | 446 | llvm::Optional<std::vector<ModuleSpec>> |
| 447 | GetModulesInfo(llvm::ArrayRef<FileSpec> module_file_specs, |
| 448 | const llvm::Triple &triple); |
| 449 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 450 | bool ReadExtFeature(const lldb_private::ConstString object, |
| 451 | const lldb_private::ConstString annex, std::string &out, |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 452 | lldb_private::Status &err); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 453 | |
| 454 | void ServeSymbolLookups(lldb_private::Process *process); |
| 455 | |
Eugene Zemtsov | 7993cc5 | 2017-03-07 21:34:40 +0000 | [diff] [blame] | 456 | // Sends QPassSignals packet to the server with given signals to ignore. |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 457 | Status SendSignalsToIgnore(llvm::ArrayRef<int32_t> signals); |
Eugene Zemtsov | 7993cc5 | 2017-03-07 21:34:40 +0000 | [diff] [blame] | 458 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 459 | //------------------------------------------------------------------ |
| 460 | /// Return the feature set supported by the gdb-remote server. |
| 461 | /// |
| 462 | /// This method returns the remote side's response to the qSupported |
| 463 | /// packet. The response is the complete string payload returned |
| 464 | /// to the client. |
| 465 | /// |
| 466 | /// @return |
| 467 | /// The string returned by the server to the qSupported query. |
| 468 | //------------------------------------------------------------------ |
| 469 | const std::string &GetServerSupportedFeatures() const { |
| 470 | return m_qSupported_response; |
| 471 | } |
| 472 | |
| 473 | //------------------------------------------------------------------ |
| 474 | /// Return the array of async JSON packet types supported by the remote. |
| 475 | /// |
| 476 | /// This method returns the remote side's array of supported JSON |
| 477 | /// packet types as a list of type names. Each of the results are |
| 478 | /// expected to have an Enable{type_name} command to enable and configure |
| 479 | /// the related feature. Each type_name for an enabled feature will |
| 480 | /// possibly send async-style packets that contain a payload of a |
| 481 | /// binhex-encoded JSON dictionary. The dictionary will have a |
| 482 | /// string field named 'type', that contains the type_name of the |
| 483 | /// supported packet type. |
| 484 | /// |
| 485 | /// There is a Plugin category called structured-data plugins. |
| 486 | /// A plugin indicates whether it knows how to handle a type_name. |
| 487 | /// If so, it can be used to process the async JSON packet. |
| 488 | /// |
| 489 | /// @return |
| 490 | /// The string returned by the server to the qSupported query. |
| 491 | //------------------------------------------------------------------ |
| 492 | lldb_private::StructuredData::Array *GetSupportedStructuredDataPlugins(); |
| 493 | |
| 494 | //------------------------------------------------------------------ |
| 495 | /// Configure a StructuredData feature on the remote end. |
| 496 | /// |
| 497 | /// @see \b Process::ConfigureStructuredData(...) for details. |
| 498 | //------------------------------------------------------------------ |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 499 | Status |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 500 | ConfigureRemoteStructuredData(const ConstString &type_name, |
| 501 | const StructuredData::ObjectSP &config_sp); |
Todd Fiala | 7593001 | 2016-08-19 04:21:48 +0000 | [diff] [blame] | 502 | |
Ravitheja Addepally | e714c4f | 2017-05-26 11:46:27 +0000 | [diff] [blame] | 503 | lldb::user_id_t SendStartTracePacket(const TraceOptions &options, |
| 504 | Status &error); |
| 505 | |
| 506 | Status SendStopTracePacket(lldb::user_id_t uid, lldb::tid_t thread_id); |
| 507 | |
| 508 | Status SendGetDataPacket(lldb::user_id_t uid, lldb::tid_t thread_id, |
| 509 | llvm::MutableArrayRef<uint8_t> &buffer, |
| 510 | size_t offset = 0); |
| 511 | |
| 512 | Status SendGetMetaDataPacket(lldb::user_id_t uid, lldb::tid_t thread_id, |
| 513 | llvm::MutableArrayRef<uint8_t> &buffer, |
| 514 | size_t offset = 0); |
| 515 | |
| 516 | Status SendGetTraceConfigPacket(lldb::user_id_t uid, TraceOptions &options); |
| 517 | |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 518 | protected: |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 519 | LazyBool m_supports_not_sending_acks; |
| 520 | LazyBool m_supports_thread_suffix; |
| 521 | LazyBool m_supports_threads_in_stop_reply; |
| 522 | LazyBool m_supports_vCont_all; |
| 523 | LazyBool m_supports_vCont_any; |
| 524 | LazyBool m_supports_vCont_c; |
| 525 | LazyBool m_supports_vCont_C; |
| 526 | LazyBool m_supports_vCont_s; |
| 527 | LazyBool m_supports_vCont_S; |
| 528 | LazyBool m_qHostInfo_is_valid; |
| 529 | LazyBool m_curr_pid_is_valid; |
| 530 | LazyBool m_qProcessInfo_is_valid; |
| 531 | LazyBool m_qGDBServerVersion_is_valid; |
| 532 | LazyBool m_supports_alloc_dealloc_memory; |
| 533 | LazyBool m_supports_memory_region_info; |
| 534 | LazyBool m_supports_watchpoint_support_info; |
| 535 | LazyBool m_supports_detach_stay_stopped; |
| 536 | LazyBool m_watchpoints_trigger_after_instruction; |
| 537 | LazyBool m_attach_or_wait_reply; |
| 538 | LazyBool m_prepare_for_reg_writing_reply; |
| 539 | LazyBool m_supports_p; |
| 540 | LazyBool m_supports_x; |
| 541 | LazyBool m_avoid_g_packets; |
| 542 | LazyBool m_supports_QSaveRegisterState; |
| 543 | LazyBool m_supports_qXfer_auxv_read; |
| 544 | LazyBool m_supports_qXfer_libraries_read; |
| 545 | LazyBool m_supports_qXfer_libraries_svr4_read; |
| 546 | LazyBool m_supports_qXfer_features_read; |
| 547 | LazyBool m_supports_augmented_libraries_svr4_read; |
| 548 | LazyBool m_supports_jThreadExtendedInfo; |
| 549 | LazyBool m_supports_jLoadedDynamicLibrariesInfos; |
| 550 | LazyBool m_supports_jGetSharedCacheInfo; |
Eugene Zemtsov | 7993cc5 | 2017-03-07 21:34:40 +0000 | [diff] [blame] | 551 | LazyBool m_supports_QPassSignals; |
Steve Pucci | 5ae54ae | 2014-01-25 05:46:51 +0000 | [diff] [blame] | 552 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 553 | bool m_supports_qProcessInfoPID : 1, m_supports_qfProcessInfo : 1, |
| 554 | m_supports_qUserName : 1, m_supports_qGroupName : 1, |
| 555 | m_supports_qThreadStopInfo : 1, m_supports_z0 : 1, m_supports_z1 : 1, |
| 556 | m_supports_z2 : 1, m_supports_z3 : 1, m_supports_z4 : 1, |
| 557 | m_supports_QEnvironment : 1, m_supports_QEnvironmentHexEncoded : 1, |
| 558 | m_supports_qSymbol : 1, m_qSymbol_requests_done : 1, |
Pavel Labath | 2f1fbae | 2016-09-08 10:07:04 +0000 | [diff] [blame] | 559 | m_supports_qModuleInfo : 1, m_supports_jThreadsInfo : 1, |
| 560 | m_supports_jModulesInfo : 1; |
Greg Clayton | 8b82f08 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 561 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 562 | lldb::pid_t m_curr_pid; |
| 563 | lldb::tid_t m_curr_tid; // Current gdb remote protocol thread index for all |
| 564 | // other operations |
| 565 | lldb::tid_t m_curr_tid_run; // Current gdb remote protocol thread index for |
| 566 | // continue, step, etc |
Johnny Chen | 6463720 | 2012-05-23 21:09:52 +0000 | [diff] [blame] | 567 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 568 | uint32_t m_num_supported_hardware_watchpoints; |
Todd Fiala | 7593001 | 2016-08-19 04:21:48 +0000 | [diff] [blame] | 569 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 570 | ArchSpec m_host_arch; |
| 571 | ArchSpec m_process_arch; |
| 572 | uint32_t m_os_version_major; |
| 573 | uint32_t m_os_version_minor; |
| 574 | uint32_t m_os_version_update; |
| 575 | std::string m_os_build; |
| 576 | std::string m_os_kernel; |
| 577 | std::string m_hostname; |
| 578 | std::string m_gdb_server_name; // from reply to qGDBServerVersion, empty if |
| 579 | // qGDBServerVersion is not supported |
| 580 | uint32_t m_gdb_server_version; // from reply to qGDBServerVersion, zero if |
| 581 | // qGDBServerVersion is not supported |
Pavel Labath | 3aa0491 | 2016-10-31 17:19:42 +0000 | [diff] [blame] | 582 | std::chrono::seconds m_default_packet_timeout; |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 583 | uint64_t m_max_packet_size; // as returned by qSupported |
| 584 | std::string m_qSupported_response; // the complete response to qSupported |
Jason Molenda | 91ffe0a | 2015-06-18 21:46:06 +0000 | [diff] [blame] | 585 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 586 | bool m_supported_async_json_packets_is_valid; |
| 587 | lldb_private::StructuredData::ObjectSP m_supported_async_json_packets_sp; |
Eugene Zelenko | edb35d9 | 2015-10-24 01:08:35 +0000 | [diff] [blame] | 588 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 589 | bool GetCurrentProcessInfo(bool allow_lazy_pid = true); |
Eugene Zelenko | edb35d9 | 2015-10-24 01:08:35 +0000 | [diff] [blame] | 590 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 591 | bool GetGDBServerVersion(); |
Eugene Zelenko | edb35d9 | 2015-10-24 01:08:35 +0000 | [diff] [blame] | 592 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 593 | // Given the list of compression types that the remote debug stub can support, |
| 594 | // possibly enable compression if we find an encoding we can handle. |
| 595 | void MaybeEnableCompression(std::vector<std::string> supported_compressions); |
Eugene Zelenko | edb35d9 | 2015-10-24 01:08:35 +0000 | [diff] [blame] | 596 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 597 | bool DecodeProcessInfoResponse(StringExtractorGDBRemote &response, |
| 598 | ProcessInstanceInfo &process_info); |
Pavel Labath | 8c1b6bd | 2016-08-09 12:04:46 +0000 | [diff] [blame] | 599 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 600 | void OnRunPacketSent(bool first) override; |
| 601 | |
| 602 | PacketResult SendThreadSpecificPacketAndWaitForResponse( |
| 603 | lldb::tid_t tid, StreamString &&payload, |
| 604 | StringExtractorGDBRemote &response, bool send_async); |
Pavel Labath | 4b6f959 | 2016-08-18 08:30:03 +0000 | [diff] [blame] | 605 | |
Ravitheja Addepally | e714c4f | 2017-05-26 11:46:27 +0000 | [diff] [blame] | 606 | Status SendGetTraceDataPacket(StreamGDBRemote &packet, lldb::user_id_t uid, |
| 607 | lldb::tid_t thread_id, |
| 608 | llvm::MutableArrayRef<uint8_t> &buffer, |
| 609 | size_t offset); |
| 610 | |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 611 | private: |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 612 | DISALLOW_COPY_AND_ASSIGN(GDBRemoteCommunicationClient); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 613 | }; |
| 614 | |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 615 | } // namespace process_gdb_remote |
| 616 | } // namespace lldb_private |
| 617 | |
Eugene Zelenko | edb35d9 | 2015-10-24 01:08:35 +0000 | [diff] [blame] | 618 | #endif // liblldb_GDBRemoteCommunicationClient_h_ |