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