1 //===-- PlatformRemoteGDBServer.cpp -----------------------------*- 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 #include "lldb/lldb-python.h" 11 12 #include "PlatformRemoteGDBServer.h" 13 #include "lldb/Host/Config.h" 14 15 // C++ Includes 16 // Other libraries and framework includes 17 // Project includes 18 #include "lldb/Breakpoint/BreakpointLocation.h" 19 #include "lldb/Core/ConnectionFileDescriptor.h" 20 #include "lldb/Core/Debugger.h" 21 #include "lldb/Core/Error.h" 22 #include "lldb/Core/Log.h" 23 #include "lldb/Core/Module.h" 24 #include "lldb/Core/ModuleList.h" 25 #include "lldb/Core/PluginManager.h" 26 #include "lldb/Core/StreamString.h" 27 #include "lldb/Host/FileSpec.h" 28 #include "lldb/Host/Host.h" 29 #include "lldb/Target/Process.h" 30 #include "lldb/Target/Target.h" 31 32 using namespace lldb; 33 using namespace lldb_private; 34 35 static bool g_initialized = false; 36 37 void 38 PlatformRemoteGDBServer::Initialize () 39 { 40 if (g_initialized == false) 41 { 42 g_initialized = true; 43 PluginManager::RegisterPlugin (PlatformRemoteGDBServer::GetPluginNameStatic(), 44 PlatformRemoteGDBServer::GetDescriptionStatic(), 45 PlatformRemoteGDBServer::CreateInstance); 46 } 47 } 48 49 void 50 PlatformRemoteGDBServer::Terminate () 51 { 52 if (g_initialized) 53 { 54 g_initialized = false; 55 PluginManager::UnregisterPlugin (PlatformRemoteGDBServer::CreateInstance); 56 } 57 } 58 59 Platform* 60 PlatformRemoteGDBServer::CreateInstance (bool force, const lldb_private::ArchSpec *arch) 61 { 62 bool create = force; 63 if (!create) 64 { 65 create = !arch->TripleVendorWasSpecified() && !arch->TripleOSWasSpecified(); 66 } 67 if (create) 68 return new PlatformRemoteGDBServer (); 69 return NULL; 70 } 71 72 73 lldb_private::ConstString 74 PlatformRemoteGDBServer::GetPluginNameStatic() 75 { 76 static ConstString g_name("remote-gdb-server"); 77 return g_name; 78 } 79 80 const char * 81 PlatformRemoteGDBServer::GetDescriptionStatic() 82 { 83 return "A platform that uses the GDB remote protocol as the communication transport."; 84 } 85 86 const char * 87 PlatformRemoteGDBServer::GetDescription () 88 { 89 if (m_platform_description.empty()) 90 { 91 if (IsConnected()) 92 { 93 // Send the get description packet 94 } 95 } 96 97 if (!m_platform_description.empty()) 98 return m_platform_description.c_str(); 99 return GetDescriptionStatic(); 100 } 101 102 Error 103 PlatformRemoteGDBServer::ResolveExecutable (const FileSpec &exe_file, 104 const ArchSpec &exe_arch, 105 lldb::ModuleSP &exe_module_sp, 106 const FileSpecList *module_search_paths_ptr) 107 { 108 Error error; 109 //error.SetErrorString ("PlatformRemoteGDBServer::ResolveExecutable() is unimplemented"); 110 if (m_gdb_client.GetFileExists(exe_file)) 111 return error; 112 // TODO: get the remote end to somehow resolve this file 113 error.SetErrorString("file not found on remote end"); 114 return error; 115 } 116 117 Error 118 PlatformRemoteGDBServer::GetFileWithUUID (const FileSpec &platform_file, 119 const UUID *uuid_ptr, 120 FileSpec &local_file) 121 { 122 // Default to the local case 123 local_file = platform_file; 124 return Error(); 125 } 126 127 //------------------------------------------------------------------ 128 /// Default Constructor 129 //------------------------------------------------------------------ 130 PlatformRemoteGDBServer::PlatformRemoteGDBServer () : 131 Platform(false), // This is a remote platform 132 m_gdb_client(true) 133 { 134 } 135 136 //------------------------------------------------------------------ 137 /// Destructor. 138 /// 139 /// The destructor is virtual since this class is designed to be 140 /// inherited from by the plug-in instance. 141 //------------------------------------------------------------------ 142 PlatformRemoteGDBServer::~PlatformRemoteGDBServer() 143 { 144 } 145 146 bool 147 PlatformRemoteGDBServer::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch) 148 { 149 return false; 150 } 151 152 size_t 153 PlatformRemoteGDBServer::GetSoftwareBreakpointTrapOpcode (Target &target, BreakpointSite *bp_site) 154 { 155 // This isn't needed if the z/Z packets are supported in the GDB remote 156 // server. But we might need a packet to detect this. 157 return 0; 158 } 159 160 bool 161 PlatformRemoteGDBServer::GetRemoteOSVersion () 162 { 163 uint32_t major, minor, update; 164 if (m_gdb_client.GetOSVersion (major, minor, update)) 165 { 166 m_major_os_version = major; 167 m_minor_os_version = minor; 168 m_update_os_version = update; 169 return true; 170 } 171 return false; 172 } 173 174 bool 175 PlatformRemoteGDBServer::GetRemoteOSBuildString (std::string &s) 176 { 177 return m_gdb_client.GetOSBuildString (s); 178 } 179 180 bool 181 PlatformRemoteGDBServer::GetRemoteOSKernelDescription (std::string &s) 182 { 183 return m_gdb_client.GetOSKernelDescription (s); 184 } 185 186 // Remote Platform subclasses need to override this function 187 ArchSpec 188 PlatformRemoteGDBServer::GetRemoteSystemArchitecture () 189 { 190 return m_gdb_client.GetSystemArchitecture(); 191 } 192 193 lldb_private::ConstString 194 PlatformRemoteGDBServer::GetRemoteWorkingDirectory() 195 { 196 if (IsConnected()) 197 { 198 Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); 199 std::string cwd; 200 if (m_gdb_client.GetWorkingDir(cwd)) 201 { 202 ConstString working_dir(cwd.c_str()); 203 if (log) 204 log->Printf("PlatformRemoteGDBServer::GetRemoteWorkingDirectory() -> '%s'", working_dir.GetCString()); 205 return working_dir; 206 } 207 else 208 { 209 return ConstString(); 210 } 211 } 212 else 213 { 214 return Platform::GetRemoteWorkingDirectory(); 215 } 216 } 217 218 bool 219 PlatformRemoteGDBServer::SetRemoteWorkingDirectory(const lldb_private::ConstString &path) 220 { 221 if (IsConnected()) 222 { 223 // Clear the working directory it case it doesn't get set correctly. This will 224 // for use to re-read it 225 Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); 226 if (log) 227 log->Printf("PlatformRemoteGDBServer::SetRemoteWorkingDirectory('%s')", path.GetCString()); 228 return m_gdb_client.SetWorkingDir(path.GetCString()) == 0; 229 } 230 else 231 return Platform::SetRemoteWorkingDirectory(path); 232 } 233 234 bool 235 PlatformRemoteGDBServer::IsConnected () const 236 { 237 return m_gdb_client.IsConnected(); 238 } 239 240 Error 241 PlatformRemoteGDBServer::ConnectRemote (Args& args) 242 { 243 Error error; 244 if (IsConnected()) 245 { 246 error.SetErrorStringWithFormat ("the platform is already connected to '%s', execute 'platform disconnect' to close the current connection", 247 GetHostname()); 248 } 249 else 250 { 251 if (args.GetArgumentCount() == 1) 252 { 253 const char *url = args.GetArgumentAtIndex(0); 254 m_gdb_client.SetConnection (new ConnectionFileDescriptor()); 255 const ConnectionStatus status = m_gdb_client.Connect(url, &error); 256 if (status == eConnectionStatusSuccess) 257 { 258 if (m_gdb_client.HandshakeWithServer(&error)) 259 { 260 m_gdb_client.GetHostInfo(); 261 // If a working directory was set prior to connecting, send it down now 262 if (m_working_dir) 263 m_gdb_client.SetWorkingDir(m_working_dir.GetCString()); 264 } 265 else 266 { 267 m_gdb_client.Disconnect(); 268 if (error.Success()) 269 error.SetErrorString("handshake failed"); 270 } 271 } 272 } 273 else 274 { 275 error.SetErrorString ("\"platform connect\" takes a single argument: <connect-url>"); 276 } 277 } 278 279 return error; 280 } 281 282 Error 283 PlatformRemoteGDBServer::DisconnectRemote () 284 { 285 Error error; 286 m_gdb_client.Disconnect(&error); 287 return error; 288 } 289 290 const char * 291 PlatformRemoteGDBServer::GetHostname () 292 { 293 m_gdb_client.GetHostname (m_name); 294 if (m_name.empty()) 295 return NULL; 296 return m_name.c_str(); 297 } 298 299 const char * 300 PlatformRemoteGDBServer::GetUserName (uint32_t uid) 301 { 302 // Try and get a cache user name first 303 const char *cached_user_name = Platform::GetUserName(uid); 304 if (cached_user_name) 305 return cached_user_name; 306 std::string name; 307 if (m_gdb_client.GetUserName(uid, name)) 308 return SetCachedUserName(uid, name.c_str(), name.size()); 309 310 SetUserNameNotFound(uid); // Negative cache so we don't keep sending packets 311 return NULL; 312 } 313 314 const char * 315 PlatformRemoteGDBServer::GetGroupName (uint32_t gid) 316 { 317 const char *cached_group_name = Platform::GetGroupName(gid); 318 if (cached_group_name) 319 return cached_group_name; 320 std::string name; 321 if (m_gdb_client.GetGroupName(gid, name)) 322 return SetCachedGroupName(gid, name.c_str(), name.size()); 323 324 SetGroupNameNotFound(gid); // Negative cache so we don't keep sending packets 325 return NULL; 326 } 327 328 uint32_t 329 PlatformRemoteGDBServer::FindProcesses (const ProcessInstanceInfoMatch &match_info, 330 ProcessInstanceInfoList &process_infos) 331 { 332 return m_gdb_client.FindProcesses (match_info, process_infos); 333 } 334 335 bool 336 PlatformRemoteGDBServer::GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &process_info) 337 { 338 return m_gdb_client.GetProcessInfo (pid, process_info); 339 } 340 341 342 Error 343 PlatformRemoteGDBServer::LaunchProcess (ProcessLaunchInfo &launch_info) 344 { 345 Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PLATFORM)); 346 Error error; 347 lldb::pid_t pid = LLDB_INVALID_PROCESS_ID; 348 349 if (log) 350 log->Printf ("PlatformRemoteGDBServer::%s() called", __FUNCTION__); 351 352 m_gdb_client.SetSTDIN ("/dev/null"); 353 m_gdb_client.SetSTDOUT ("/dev/null"); 354 m_gdb_client.SetSTDERR ("/dev/null"); 355 m_gdb_client.SetDisableASLR (launch_info.GetFlags().Test (eLaunchFlagDisableASLR)); 356 m_gdb_client.SetDetachOnError (launch_info.GetFlags().Test (eLaunchFlagDetachOnError)); 357 358 const char *working_dir = launch_info.GetWorkingDirectory(); 359 if (working_dir && working_dir[0]) 360 { 361 m_gdb_client.SetWorkingDir (working_dir); 362 } 363 364 // Send the environment and the program + arguments after we connect 365 const char **envp = launch_info.GetEnvironmentEntries().GetConstArgumentVector(); 366 367 if (envp) 368 { 369 const char *env_entry; 370 for (int i=0; (env_entry = envp[i]); ++i) 371 { 372 if (m_gdb_client.SendEnvironmentPacket(env_entry) != 0) 373 break; 374 } 375 } 376 377 ArchSpec arch_spec = launch_info.GetArchitecture(); 378 const char *arch_triple = arch_spec.GetTriple().str().c_str(); 379 380 m_gdb_client.SendLaunchArchPacket(arch_triple); 381 if (log) 382 log->Printf ("PlatformRemoteGDBServer::%s() set launch architecture triple to '%s'", __FUNCTION__, arch_triple ? arch_triple : "<NULL>"); 383 384 const uint32_t old_packet_timeout = m_gdb_client.SetPacketTimeout (5); 385 int arg_packet_err = m_gdb_client.SendArgumentsPacket (launch_info); 386 m_gdb_client.SetPacketTimeout (old_packet_timeout); 387 if (arg_packet_err == 0) 388 { 389 std::string error_str; 390 if (m_gdb_client.GetLaunchSuccess (error_str)) 391 { 392 pid = m_gdb_client.GetCurrentProcessID (); 393 if (pid != LLDB_INVALID_PROCESS_ID) 394 { 395 launch_info.SetProcessID (pid); 396 if (log) 397 log->Printf ("PlatformRemoteGDBServer::%s() pid %" PRIu64 " launched successfully", __FUNCTION__, pid); 398 } 399 else 400 { 401 if (log) 402 log->Printf ("PlatformRemoteGDBServer::%s() launch succeeded but we didn't get a valid process id back!", __FUNCTION__); 403 // FIXME isn't this an error condition? Do we need to set an error here? Check with Greg. 404 } 405 } 406 else 407 { 408 error.SetErrorString (error_str.c_str()); 409 if (log) 410 log->Printf ("PlatformRemoteGDBServer::%s() launch failed: %s", __FUNCTION__, error.AsCString ()); 411 } 412 } 413 else 414 { 415 error.SetErrorStringWithFormat("'A' packet returned an error: %i", arg_packet_err); 416 } 417 return error; 418 } 419 420 lldb::ProcessSP 421 PlatformRemoteGDBServer::DebugProcess (lldb_private::ProcessLaunchInfo &launch_info, 422 lldb_private::Debugger &debugger, 423 lldb_private::Target *target, // Can be NULL, if NULL create a new target, else use existing one 424 lldb_private::Listener &listener, 425 lldb_private::Error &error) 426 { 427 lldb::ProcessSP process_sp; 428 if (IsRemote()) 429 { 430 if (IsConnected()) 431 { 432 lldb::pid_t debugserver_pid = LLDB_INVALID_PROCESS_ID; 433 ArchSpec remote_arch = GetRemoteSystemArchitecture(); 434 llvm::Triple &remote_triple = remote_arch.GetTriple(); 435 uint16_t port = 0; 436 if (remote_triple.getVendor() == llvm::Triple::Apple && remote_triple.getOS() == llvm::Triple::IOS) 437 { 438 // When remote debugging to iOS, we use a USB mux that always talks 439 // to localhost, so we will need the remote debugserver to accept connections 440 // only from localhost, no matter what our current hostname is 441 port = m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid, "127.0.0.1"); 442 } 443 else 444 { 445 // All other hosts should use their actual hostname 446 port = m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid, NULL); 447 } 448 449 if (port == 0) 450 { 451 error.SetErrorStringWithFormat ("unable to launch a GDB server on '%s'", GetHostname ()); 452 } 453 else 454 { 455 if (target == NULL) 456 { 457 TargetSP new_target_sp; 458 459 error = debugger.GetTargetList().CreateTarget (debugger, 460 NULL, 461 NULL, 462 false, 463 NULL, 464 new_target_sp); 465 target = new_target_sp.get(); 466 } 467 else 468 error.Clear(); 469 470 if (target && error.Success()) 471 { 472 debugger.GetTargetList().SetSelectedTarget(target); 473 474 // The darwin always currently uses the GDB remote debugger plug-in 475 // so even when debugging locally we are debugging remotely! 476 process_sp = target->CreateProcess (listener, "gdb-remote", NULL); 477 478 if (process_sp) 479 { 480 char connect_url[256]; 481 const char *override_hostname = getenv("LLDB_PLATFORM_REMOTE_GDB_SERVER_HOSTNAME"); 482 const char *port_offset_c_str = getenv("LLDB_PLATFORM_REMOTE_GDB_SERVER_PORT_OFFSET"); 483 int port_offset = port_offset_c_str ? ::atoi(port_offset_c_str) : 0; 484 const int connect_url_len = ::snprintf (connect_url, 485 sizeof(connect_url), 486 "connect://%s:%u", 487 override_hostname ? override_hostname : GetHostname (), 488 port + port_offset); 489 assert (connect_url_len < (int)sizeof(connect_url)); 490 error = process_sp->ConnectRemote (NULL, connect_url); 491 if (error.Success()) 492 error = process_sp->Launch(launch_info); 493 else if (debugserver_pid != LLDB_INVALID_PROCESS_ID) 494 m_gdb_client.KillSpawnedProcess(debugserver_pid); 495 } 496 } 497 } 498 } 499 else 500 { 501 error.SetErrorString("not connected to remote gdb server"); 502 } 503 } 504 return process_sp; 505 506 } 507 508 lldb::ProcessSP 509 PlatformRemoteGDBServer::Attach (lldb_private::ProcessAttachInfo &attach_info, 510 Debugger &debugger, 511 Target *target, // Can be NULL, if NULL create a new target, else use existing one 512 Listener &listener, 513 Error &error) 514 { 515 lldb::ProcessSP process_sp; 516 if (IsRemote()) 517 { 518 if (IsConnected()) 519 { 520 lldb::pid_t debugserver_pid = LLDB_INVALID_PROCESS_ID; 521 ArchSpec remote_arch = GetRemoteSystemArchitecture(); 522 llvm::Triple &remote_triple = remote_arch.GetTriple(); 523 uint16_t port = 0; 524 if (remote_triple.getVendor() == llvm::Triple::Apple && remote_triple.getOS() == llvm::Triple::IOS) 525 { 526 // When remote debugging to iOS, we use a USB mux that always talks 527 // to localhost, so we will need the remote debugserver to accept connections 528 // only from localhost, no matter what our current hostname is 529 port = m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid, "127.0.0.1"); 530 } 531 else 532 { 533 // All other hosts should use their actual hostname 534 port = m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid, NULL); 535 } 536 537 if (port == 0) 538 { 539 error.SetErrorStringWithFormat ("unable to launch a GDB server on '%s'", GetHostname ()); 540 } 541 else 542 { 543 if (target == NULL) 544 { 545 TargetSP new_target_sp; 546 547 error = debugger.GetTargetList().CreateTarget (debugger, 548 NULL, 549 NULL, 550 false, 551 NULL, 552 new_target_sp); 553 target = new_target_sp.get(); 554 } 555 else 556 error.Clear(); 557 558 if (target && error.Success()) 559 { 560 debugger.GetTargetList().SetSelectedTarget(target); 561 562 // The darwin always currently uses the GDB remote debugger plug-in 563 // so even when debugging locally we are debugging remotely! 564 process_sp = target->CreateProcess (listener, "gdb-remote", NULL); 565 566 if (process_sp) 567 { 568 char connect_url[256]; 569 const char *override_hostname = getenv("LLDB_PLATFORM_REMOTE_GDB_SERVER_HOSTNAME"); 570 const char *port_offset_c_str = getenv("LLDB_PLATFORM_REMOTE_GDB_SERVER_PORT_OFFSET"); 571 int port_offset = port_offset_c_str ? ::atoi(port_offset_c_str) : 0; 572 const int connect_url_len = ::snprintf (connect_url, 573 sizeof(connect_url), 574 "connect://%s:%u", 575 override_hostname ? override_hostname : GetHostname (), 576 port + port_offset); 577 assert (connect_url_len < (int)sizeof(connect_url)); 578 error = process_sp->ConnectRemote (NULL, connect_url); 579 if (error.Success()) 580 error = process_sp->Attach(attach_info); 581 else if (debugserver_pid != LLDB_INVALID_PROCESS_ID) 582 { 583 m_gdb_client.KillSpawnedProcess(debugserver_pid); 584 } 585 } 586 } 587 } 588 } 589 else 590 { 591 error.SetErrorString("not connected to remote gdb server"); 592 } 593 } 594 return process_sp; 595 } 596 597 Error 598 PlatformRemoteGDBServer::MakeDirectory (const char *path, uint32_t mode) 599 { 600 Error error = m_gdb_client.MakeDirectory(path,mode); 601 Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); 602 if (log) 603 log->Printf ("PlatformRemoteGDBServer::MakeDirectory(path='%s', mode=%o) error = %u (%s)", path, mode, error.GetError(), error.AsCString()); 604 return error; 605 } 606 607 608 Error 609 PlatformRemoteGDBServer::GetFilePermissions (const char *path, uint32_t &file_permissions) 610 { 611 Error error = m_gdb_client.GetFilePermissions(path, file_permissions); 612 Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); 613 if (log) 614 log->Printf ("PlatformRemoteGDBServer::GetFilePermissions(path='%s', file_permissions=%o) error = %u (%s)", path, file_permissions, error.GetError(), error.AsCString()); 615 return error; 616 } 617 618 Error 619 PlatformRemoteGDBServer::SetFilePermissions (const char *path, uint32_t file_permissions) 620 { 621 Error error = m_gdb_client.SetFilePermissions(path, file_permissions); 622 Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); 623 if (log) 624 log->Printf ("PlatformRemoteGDBServer::SetFilePermissions(path='%s', file_permissions=%o) error = %u (%s)", path, file_permissions, error.GetError(), error.AsCString()); 625 return error; 626 } 627 628 629 lldb::user_id_t 630 PlatformRemoteGDBServer::OpenFile (const lldb_private::FileSpec& file_spec, 631 uint32_t flags, 632 uint32_t mode, 633 Error &error) 634 { 635 return m_gdb_client.OpenFile (file_spec, flags, mode, error); 636 } 637 638 bool 639 PlatformRemoteGDBServer::CloseFile (lldb::user_id_t fd, Error &error) 640 { 641 return m_gdb_client.CloseFile (fd, error); 642 } 643 644 lldb::user_id_t 645 PlatformRemoteGDBServer::GetFileSize (const lldb_private::FileSpec& file_spec) 646 { 647 return m_gdb_client.GetFileSize(file_spec); 648 } 649 650 uint64_t 651 PlatformRemoteGDBServer::ReadFile (lldb::user_id_t fd, 652 uint64_t offset, 653 void *dst, 654 uint64_t dst_len, 655 Error &error) 656 { 657 return m_gdb_client.ReadFile (fd, offset, dst, dst_len, error); 658 } 659 660 uint64_t 661 PlatformRemoteGDBServer::WriteFile (lldb::user_id_t fd, 662 uint64_t offset, 663 const void* src, 664 uint64_t src_len, 665 Error &error) 666 { 667 return m_gdb_client.WriteFile (fd, offset, src, src_len, error); 668 } 669 670 lldb_private::Error 671 PlatformRemoteGDBServer::PutFile (const lldb_private::FileSpec& source, 672 const lldb_private::FileSpec& destination, 673 uint32_t uid, 674 uint32_t gid) 675 { 676 return Platform::PutFile(source,destination,uid,gid); 677 } 678 679 Error 680 PlatformRemoteGDBServer::CreateSymlink (const char *src, // The name of the link is in src 681 const char *dst) // The symlink points to dst 682 { 683 Error error = m_gdb_client.CreateSymlink (src, dst); 684 Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); 685 if (log) 686 log->Printf ("PlatformRemoteGDBServer::CreateSymlink(src='%s', dst='%s') error = %u (%s)", src, dst, error.GetError(), error.AsCString()); 687 return error; 688 } 689 690 Error 691 PlatformRemoteGDBServer::Unlink (const char *path) 692 { 693 Error error = m_gdb_client.Unlink (path); 694 Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); 695 if (log) 696 log->Printf ("PlatformRemoteGDBServer::Unlink(path='%s') error = %u (%s)", path, error.GetError(), error.AsCString()); 697 return error; 698 } 699 700 bool 701 PlatformRemoteGDBServer::GetFileExists (const lldb_private::FileSpec& file_spec) 702 { 703 return m_gdb_client.GetFileExists (file_spec); 704 } 705 706 lldb_private::Error 707 PlatformRemoteGDBServer::RunShellCommand (const char *command, // Shouldn't be NULL 708 const char *working_dir, // Pass NULL to use the current working directory 709 int *status_ptr, // Pass NULL if you don't want the process exit status 710 int *signo_ptr, // Pass NULL if you don't want the signal that caused the process to exit 711 std::string *command_output, // Pass NULL if you don't want the command output 712 uint32_t timeout_sec) // Timeout in seconds to wait for shell program to finish 713 { 714 return m_gdb_client.RunShellCommand (command, working_dir, status_ptr, signo_ptr, command_output, timeout_sec); 715 } 716 717 void 718 PlatformRemoteGDBServer::CalculateTrapHandlerSymbolNames () 719 { 720 m_trap_handlers.push_back (ConstString ("_sigtramp")); 721 } 722