Process.h revision 6e4c5ce0f697eb9899a54854a2a9004e961b0de2
1//===-- Process.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_Process_h_ 11#define liblldb_Process_h_ 12 13// C Includes 14// C++ Includes 15#include <list> 16 17// Other libraries and framework includes 18// Project includes 19#include "lldb/lldb-private.h" 20#include "lldb/Interpreter/Args.h" 21#include "lldb/Interpreter/Options.h" 22#include "lldb/Core/Broadcaster.h" 23#include "lldb/Core/Error.h" 24#include "lldb/Core/Event.h" 25#include "lldb/Core/StringList.h" 26#include "lldb/Core/ThreadSafeValue.h" 27#include "lldb/Core/ThreadSafeSTLMap.h" 28#include "lldb/Core/PluginInterface.h" 29#include "lldb/Core/UserSettingsController.h" 30#include "lldb/Breakpoint/BreakpointSiteList.h" 31#include "lldb/Expression/ClangPersistentVariables.h" 32#include "lldb/Expression/IRDynamicChecks.h" 33#include "lldb/Target/ExecutionContextScope.h" 34#include "lldb/Target/ObjCObjectPrinter.h" 35#include "lldb/Target/ThreadList.h" 36#include "lldb/Target/UnixSignals.h" 37 38namespace lldb_private { 39 40class ProcessInstanceSettings : public InstanceSettings 41{ 42public: 43 44 ProcessInstanceSettings (UserSettingsController &owner, const char *name = NULL); 45 46 ProcessInstanceSettings (const ProcessInstanceSettings &rhs); 47 48 virtual 49 ~ProcessInstanceSettings (); 50 51 ProcessInstanceSettings& 52 operator= (const ProcessInstanceSettings &rhs); 53 54 55 void 56 UpdateInstanceSettingsVariable (const ConstString &var_name, 57 const char *index_value, 58 const char *value, 59 const ConstString &instance_name, 60 const SettingEntry &entry, 61 lldb::VarSetOperationType op, 62 Error &err, 63 bool pending); 64 65 void 66 GetInstanceSettingsValue (const SettingEntry &entry, 67 const ConstString &var_name, 68 StringList &value); 69 70 71protected: 72 73 void 74 CopyInstanceSettings (const lldb::InstanceSettingsSP &new_settings, 75 bool pending); 76 77 const ConstString 78 CreateInstanceName (); 79 80 const ConstString & 81 RunArgsVarName (); 82 83 const ConstString & 84 EnvVarsVarName (); 85 86 const ConstString & 87 InputPathVarName (); 88 89 const ConstString & 90 OutputPathVarName (); 91 92 const ConstString & 93 ErrorPathVarName (); 94 95 const ConstString & 96 PluginVarName (); 97 98 const ConstString & 99 DisableASLRVarName(); 100 101 102private: 103 104 Args m_run_args; 105 std::map<std::string, std::string> m_env_vars; 106 std::string m_input_path; 107 std::string m_output_path; 108 std::string m_error_path; 109 lldb::ProcessPlugins m_plugin; 110 bool m_disable_aslr; 111}; 112 113 114//---------------------------------------------------------------------- 115/// @class Process Process.h "lldb/Target/Process.h" 116/// @brief A plug-in interface definition class for debugging a process. 117//---------------------------------------------------------------------- 118class Process : 119 public UserID, 120 public Broadcaster, 121 public ExecutionContextScope, 122 public PluginInterface, 123 public ProcessInstanceSettings 124{ 125friend class ThreadList; 126 127public: 128 129 //------------------------------------------------------------------ 130 /// Broadcaster event bits definitions. 131 //------------------------------------------------------------------ 132 enum 133 { 134 eBroadcastBitStateChanged = (1 << 0), 135 eBroadcastBitInterrupt = (1 << 1), 136 eBroadcastBitSTDOUT = (1 << 2), 137 eBroadcastBitSTDERR = (1 << 3) 138 }; 139 140 enum 141 { 142 eBroadcastInternalStateControlStop = (1<<0), 143 eBroadcastInternalStateControlPause = (1<<1), 144 eBroadcastInternalStateControlResume = (1<<2) 145 }; 146 147 //------------------------------------------------------------------ 148 /// A notification structure that can be used by clients to listen 149 /// for changes in a process's lifetime. 150 /// 151 /// @see RegisterNotificationCallbacks (const Notifications&) 152 /// @see UnregisterNotificationCallbacks (const Notifications&) 153 //------------------------------------------------------------------ 154#ifndef SWIG 155 typedef struct 156 { 157 void *baton; 158 void (*initialize)(void *baton, Process *process); 159 void (*process_state_changed) (void *baton, Process *process, lldb::StateType state); 160 } Notifications; 161 162 class ProcessEventData : 163 public EventData 164 { 165 public: 166 ProcessEventData (); 167 ProcessEventData (const lldb::ProcessSP &process, lldb::StateType state); 168 169 virtual ~ProcessEventData(); 170 171 static const ConstString & 172 GetFlavorString (); 173 174 virtual const ConstString & 175 GetFlavor () const; 176 177 const lldb::ProcessSP & 178 GetProcessSP() const; 179 180 lldb::StateType 181 GetState() const; 182 183 bool 184 GetRestarted () const; 185 186 virtual void 187 Dump (Stream *s) const; 188 189 virtual void 190 DoOnRemoval (Event *event_ptr); 191 192 static const Process::ProcessEventData * 193 GetEventDataFromEvent (const Event *event_ptr); 194 195 static lldb::ProcessSP 196 GetProcessFromEvent (const Event *event_ptr); 197 198 static lldb::StateType 199 GetStateFromEvent (const Event *event_ptr); 200 201 static bool 202 GetRestartedFromEvent (const Event *event_ptr); 203 204 static void 205 SetRestartedInEvent (Event *event_ptr, bool new_value); 206 207 static bool 208 SetUpdateStateOnRemoval (Event *event_ptr); 209 210 211 private: 212 213 void 214 SetUpdateStateOnRemoval(); 215 216 void 217 SetRestarted (bool new_value); 218 219 lldb::ProcessSP m_process_sp; 220 lldb::StateType m_state; 221 bool m_restarted; // For "eStateStopped" events, this is true if the target was automatically restarted. 222 bool m_update_state; 223 DISALLOW_COPY_AND_ASSIGN (ProcessEventData); 224 225 }; 226 227 class ProcessSettingsController : public UserSettingsController 228 { 229 public: 230 231 ProcessSettingsController (); 232 233 virtual 234 ~ProcessSettingsController (); 235 236 void 237 UpdateGlobalVariable (const ConstString &var_name, 238 const char *index_value, 239 const char *value, 240 const SettingEntry &entry, 241 lldb::VarSetOperationType op, 242 Error&err); 243 244 void 245 GetGlobalSettingsValue (const ConstString &var_name, 246 StringList &value); 247 248 static SettingEntry global_settings_table[]; 249 static SettingEntry instance_settings_table[]; 250 251 protected: 252 253 lldb::InstanceSettingsSP 254 CreateNewInstanceSettings (); 255 256 static lldb::OptionEnumValueElement g_plugins[]; 257 258 private: 259 260 // Class-wide settings. 261 262 DISALLOW_COPY_AND_ASSIGN (ProcessSettingsController); 263 }; 264 265#endif 266 267 static lldb::UserSettingsControllerSP 268 GetSettingsController (bool finish = false); 269 270 //------------------------------------------------------------------ 271 /// Construct with a shared pointer to a target, and the Process listener. 272 //------------------------------------------------------------------ 273 Process(Target &target, Listener &listener); 274 275 //------------------------------------------------------------------ 276 /// Destructor. 277 /// 278 /// The destructor is virtual since this class is designed to be 279 /// inherited from by the plug-in instance. 280 //------------------------------------------------------------------ 281 virtual 282 ~Process(); 283 284 //------------------------------------------------------------------ 285 /// Find a Process plug-in that can debug \a module using the 286 /// currently selected architecture. 287 /// 288 /// Scans all loaded plug-in interfaces that implement versions of 289 /// the Process plug-in interface and returns the first instance 290 /// that can debug the file. 291 /// 292 /// @param[in] module_sp 293 /// The module shared pointer that this process will debug. 294 /// 295 /// @param[in] plugin_name 296 /// If NULL, select the best plug-in for the binary. If non-NULL 297 /// then look for a plugin whose PluginInfo's name matches 298 /// this string. 299 /// 300 /// @see Process::CanDebug () 301 //------------------------------------------------------------------ 302 static Process* 303 FindPlugin (Target &target, const char *plugin_name, Listener &listener); 304 305 306 307 //------------------------------------------------------------------ 308 /// Static function that can be used with the \b host function 309 /// Host::StartMonitoringChildProcess (). 310 /// 311 /// This function can be used by lldb_private::Process subclasses 312 /// when they want to watch for a local process and have its exit 313 /// status automatically set when the host child process exits. 314 /// Subclasses should call Host::StartMonitoringChildProcess () 315 /// with: 316 /// callback = Process::SetHostProcessExitStatus 317 /// callback_baton = NULL 318 /// pid = Process::GetID() 319 /// monitor_signals = false 320 //------------------------------------------------------------------ 321 static bool 322 SetProcessExitStatus (void *callback_baton, // The callback baton which should be set to NULL 323 lldb::pid_t pid, // The process ID we want to monitor 324 int signo, // Zero for no signal 325 int status); // Exit value of process if signal is zero 326 327 //------------------------------------------------------------------ 328 /// Check if a plug-in instance can debug the file in \a module. 329 /// 330 /// Each plug-in is given a chance to say wether it can debug 331 /// the file in \a module. If the Process plug-in instance can 332 /// debug a file on the current system, it should return \b true. 333 /// 334 /// @return 335 /// Returns \b true if this Process plug-in instance can 336 /// debug the executable, \b false otherwise. 337 //------------------------------------------------------------------ 338 virtual bool 339 CanDebug (Target &target) = 0; 340 341 342 //------------------------------------------------------------------ 343 /// This object is about to be destroyed, do any necessary cleanup. 344 /// 345 /// Subclasses that override this method should always call this 346 /// superclass method. 347 //------------------------------------------------------------------ 348 virtual void 349 Finalize(); 350 351 //------------------------------------------------------------------ 352 /// Launch a new process. 353 /// 354 /// Launch a new process by spawning a new process using the 355 /// target object's executable module's file as the file to launch. 356 /// Arguments are given in \a argv, and the environment variables 357 /// are in \a envp. Standard input and output files can be 358 /// optionally re-directed to \a stdin_path, \a stdout_path, and 359 /// \a stderr_path. 360 /// 361 /// This function is not meant to be overridden by Process 362 /// subclasses. It will first call Process::WillLaunch (Module *) 363 /// and if that returns \b true, Process::DoLaunch (Module*, 364 /// char const *[],char const *[],const char *,const char *, 365 /// const char *) will be called to actually do the launching. If 366 /// DoLaunch returns \b true, then Process::DidLaunch() will be 367 /// called. 368 /// 369 /// @param[in] argv 370 /// The argument array. 371 /// 372 /// @param[in] envp 373 /// The environment array. 374 /// 375 /// @param[in] launch_flags 376 /// Flags to modify the launch (@see lldb::LaunchFlags) 377 /// 378 /// @param[in] stdin_path 379 /// The path to use when re-directing the STDIN of the new 380 /// process. If all stdXX_path arguments are NULL, a pseudo 381 /// terminal will be used. 382 /// 383 /// @param[in] stdout_path 384 /// The path to use when re-directing the STDOUT of the new 385 /// process. If all stdXX_path arguments are NULL, a pseudo 386 /// terminal will be used. 387 /// 388 /// @param[in] stderr_path 389 /// The path to use when re-directing the STDERR of the new 390 /// process. If all stdXX_path arguments are NULL, a pseudo 391 /// terminal will be used. 392 /// 393 /// @return 394 /// An error object. Call GetID() to get the process ID if 395 /// the error object is success. 396 //------------------------------------------------------------------ 397 virtual Error 398 Launch (char const *argv[], 399 char const *envp[], 400 uint32_t launch_flags, 401 const char *stdin_path, 402 const char *stdout_path, 403 const char *stderr_path); 404 405 //------------------------------------------------------------------ 406 /// Attach to an existing process using a process ID. 407 /// 408 /// This function is not meant to be overridden by Process 409 /// subclasses. It will first call Process::WillAttach (lldb::pid_t) 410 /// and if that returns \b true, Process::DoAttach (lldb::pid_t) will 411 /// be called to actually do the attach. If DoAttach returns \b 412 /// true, then Process::DidAttach() will be called. 413 /// 414 /// @param[in] pid 415 /// The process ID that we should attempt to attach to. 416 /// 417 /// @return 418 /// Returns \a pid if attaching was successful, or 419 /// LLDB_INVALID_PROCESS_ID if attaching fails. 420 //------------------------------------------------------------------ 421 virtual Error 422 Attach (lldb::pid_t pid); 423 424 //------------------------------------------------------------------ 425 /// Attach to an existing process by process name. 426 /// 427 /// This function is not meant to be overridden by Process 428 /// subclasses. It will first call 429 /// Process::WillAttach (const char *) and if that returns \b 430 /// true, Process::DoAttach (const char *) will be called to 431 /// actually do the attach. If DoAttach returns \b true, then 432 /// Process::DidAttach() will be called. 433 /// 434 /// @param[in] process_name 435 /// A process name to match against the current process list. 436 /// 437 /// @return 438 /// Returns \a pid if attaching was successful, or 439 /// LLDB_INVALID_PROCESS_ID if attaching fails. 440 //------------------------------------------------------------------ 441 virtual Error 442 Attach (const char *process_name, bool wait_for_launch); 443 444 //------------------------------------------------------------------ 445 /// List the processes matching the given partial name. 446 /// 447 /// FIXME: Is it too heavyweight to create an entire process object to do this? 448 /// The problem is for remote processes we're going to have to set up the same transport 449 /// to get this data as to actually attach. So we need to factor out transport 450 /// and process before we can do this separately from the process. 451 /// 452 /// @param[in] name 453 /// A partial name to match against the current process list. 454 /// 455 /// @param[out] matches 456 /// The list of process names matching \a name. 457 /// 458 /// @param[in] pids 459 /// A vector filled with the pids that correspond to the names in \a matches. 460 /// 461 /// @return 462 /// Returns the number of matching processes. 463 //------------------------------------------------------------------ 464 465 virtual uint32_t 466 ListProcessesMatchingName (const char *name, StringList &matches, std::vector<lldb::pid_t> &pids); 467 468 //------------------------------------------------------------------ 469 /// Find the architecture of a process by pid. 470 /// 471 /// FIXME: See comment for ListProcessesMatchingName. 472 /// 473 /// @param[in] pid 474 /// A pid to inspect. 475 /// 476 /// @return 477 /// Returns the architecture of the process or an invalid architecture if the process can't be found. 478 //------------------------------------------------------------------ 479 virtual ArchSpec 480 GetArchSpecForExistingProcess (lldb::pid_t pid); 481 482 //------------------------------------------------------------------ 483 /// Find the architecture of a process by name. 484 /// 485 /// FIXME: See comment for ListProcessesMatchingName. 486 /// 487 /// @param[in] process_name 488 /// The process name to inspect. 489 /// 490 /// @return 491 /// Returns the architecture of the process or an invalid architecture if the process can't be found. 492 //------------------------------------------------------------------ 493 virtual ArchSpec 494 GetArchSpecForExistingProcess (const char *process_name); 495 496 uint32_t 497 GetAddressByteSize(); 498 499 //------------------------------------------------------------------ 500 /// Get the image information address for the current process. 501 /// 502 /// Some runtimes have system functions that can help dynamic 503 /// loaders locate the dynamic loader information needed to observe 504 /// shared libraries being loaded or unloaded. This function is 505 /// in the Process interface (as opposed to the DynamicLoader 506 /// interface) to ensure that remote debugging can take advantage of 507 /// this functionality. 508 /// 509 /// @return 510 /// The address of the dynamic loader information, or 511 /// LLDB_INVALID_ADDRESS if this is not supported by this 512 /// interface. 513 //------------------------------------------------------------------ 514 virtual lldb::addr_t 515 GetImageInfoAddress (); 516 517 //------------------------------------------------------------------ 518 /// Register for process and thread notifications. 519 /// 520 /// Clients can register nofication callbacks by filling out a 521 /// Process::Notifications structure and calling this function. 522 /// 523 /// @param[in] callbacks 524 /// A structure that contains the notification baton and 525 /// callback functions. 526 /// 527 /// @see Process::Notifications 528 //------------------------------------------------------------------ 529#ifndef SWIG 530 void 531 RegisterNotificationCallbacks (const Process::Notifications& callbacks); 532#endif 533 //------------------------------------------------------------------ 534 /// Unregister for process and thread notifications. 535 /// 536 /// Clients can unregister nofication callbacks by passing a copy of 537 /// the original baton and callbacks in \a callbacks. 538 /// 539 /// @param[in] callbacks 540 /// A structure that contains the notification baton and 541 /// callback functions. 542 /// 543 /// @return 544 /// Returns \b true if the notification callbacks were 545 /// successfully removed from the process, \b false otherwise. 546 /// 547 /// @see Process::Notifications 548 //------------------------------------------------------------------ 549#ifndef SWIG 550 bool 551 UnregisterNotificationCallbacks (const Process::Notifications& callbacks); 552#endif 553 //================================================================== 554 // Built in Process Control functions 555 //================================================================== 556 //------------------------------------------------------------------ 557 /// Resumes all of a process's threads as configured using the 558 /// Thread run control functions. 559 /// 560 /// Threads for a process should be updated with one of the run 561 /// control actions (resume, step, or suspend) that they should take 562 /// when the process is resumed. If no run control action is given 563 /// to a thread it will be resumed by default. 564 /// 565 /// This function is not meant to be overridden by Process 566 /// subclasses. This function will take care of disabling any 567 /// breakpoints that threads may be stopped at, single stepping, and 568 /// re-enabling breakpoints, and enabling the basic flow control 569 /// that the plug-in instances need not worry about. 570 /// 571 /// @return 572 /// Returns an error object. 573 /// 574 /// @see Thread:Resume() 575 /// @see Thread:Step() 576 /// @see Thread:Suspend() 577 //------------------------------------------------------------------ 578 virtual Error 579 Resume (); 580 581 //------------------------------------------------------------------ 582 /// Halts a running process. 583 /// 584 /// This function is not meant to be overridden by Process 585 /// subclasses. 586 /// 587 /// @return 588 /// Returns an error object. 589 //------------------------------------------------------------------ 590 virtual Error 591 Halt (); 592 593 //------------------------------------------------------------------ 594 /// Detaches from a running or stopped process. 595 /// 596 /// This function is not meant to be overridden by Process 597 /// subclasses. 598 /// 599 /// @return 600 /// Returns an error object. 601 //------------------------------------------------------------------ 602 virtual Error 603 Detach (); 604 605 //------------------------------------------------------------------ 606 /// Kills the process and shuts down all threads that were spawned 607 /// to track and monitor the process. 608 /// 609 /// This function is not meant to be overridden by Process 610 /// subclasses. 611 /// 612 /// @return 613 /// Returns an error object. 614 //------------------------------------------------------------------ 615 virtual Error 616 Destroy(); 617 618 //------------------------------------------------------------------ 619 /// Sends a process a UNIX signal \a signal. 620 /// 621 /// This function is not meant to be overridden by Process 622 /// subclasses. 623 /// 624 /// @return 625 /// Returns an error object. 626 //------------------------------------------------------------------ 627 virtual Error 628 Signal (int signal); 629 630 virtual UnixSignals & 631 GetUnixSignals (); 632 633 634 //================================================================== 635 // Plug-in Process Control Overrides 636 //================================================================== 637 638 //------------------------------------------------------------------ 639 /// Called before attaching to a process. 640 /// 641 /// Allow Process plug-ins to execute some code before attaching a 642 /// process. 643 /// 644 /// @return 645 /// Returns an error object. 646 //------------------------------------------------------------------ 647 virtual Error 648 WillAttachToProcessWithID (lldb::pid_t pid) 649 { 650 return Error(); 651 } 652 653 //------------------------------------------------------------------ 654 /// Called before attaching to a process. 655 /// 656 /// Allow Process plug-ins to execute some code before attaching a 657 /// process. 658 /// 659 /// @return 660 /// Returns an error object. 661 //------------------------------------------------------------------ 662 virtual Error 663 WillAttachToProcessWithName (const char *process_name, bool wait_for_launch) 664 { 665 return Error(); 666 } 667 668 //------------------------------------------------------------------ 669 /// Attach to an existing process using a process ID. 670 /// 671 /// @param[in] pid 672 /// The process ID that we should attempt to attach to. 673 /// 674 /// @return 675 /// Returns \a pid if attaching was successful, or 676 /// LLDB_INVALID_PROCESS_ID if attaching fails. 677 //------------------------------------------------------------------ 678 virtual Error 679 DoAttachToProcessWithID (lldb::pid_t pid) = 0; 680 681 //------------------------------------------------------------------ 682 /// Attach to an existing process using a partial process name. 683 /// 684 /// @param[in] process_name 685 /// The name of the process to attach to. 686 /// 687 /// @param[in] wait_for_launch 688 /// If \b true, wait for the process to be launched and attach 689 /// as soon as possible after it does launch. If \b false, then 690 /// search for a matching process the currently exists. 691 /// 692 /// @return 693 /// Returns \a pid if attaching was successful, or 694 /// LLDB_INVALID_PROCESS_ID if attaching fails. 695 //------------------------------------------------------------------ 696 virtual Error 697 DoAttachToProcessWithName (const char *process_name, bool wait_for_launch) 698 { 699 Error error; 700 error.SetErrorString("attach by name is not supported"); 701 return error; 702 } 703 704 //------------------------------------------------------------------ 705 /// Called after attaching a process. 706 /// 707 /// Allow Process plug-ins to execute some code after attaching to 708 /// a process. 709 //------------------------------------------------------------------ 710 virtual void 711 DidAttach () {} 712 713 714 //------------------------------------------------------------------ 715 /// Called before launching to a process. 716 /// 717 /// Allow Process plug-ins to execute some code before launching a 718 /// process. 719 /// 720 /// @return 721 /// Returns an error object. 722 //------------------------------------------------------------------ 723 virtual Error 724 WillLaunch (Module* module) 725 { 726 return Error(); 727 } 728 729 //------------------------------------------------------------------ 730 /// Launch a new process. 731 /// 732 /// Launch a new process by spawning a new process using \a module's 733 /// file as the file to launch. Arguments are given in \a argv, 734 /// and the environment variables are in \a envp. Standard input 735 /// and output files can be optionally re-directed to \a stdin_path, 736 /// \a stdout_path, and \a stderr_path. 737 /// 738 /// @param[in] module 739 /// The module from which to extract the file specification and 740 /// launch. 741 /// 742 /// @param[in] argv 743 /// The argument array. 744 /// 745 /// @param[in] envp 746 /// The environment array. 747 /// 748 /// @param[in] launch_flags 749 /// Flags to modify the launch (@see lldb::LaunchFlags) 750 /// 751 /// @param[in] stdin_path 752 /// The path to use when re-directing the STDIN of the new 753 /// process. If all stdXX_path arguments are NULL, a pseudo 754 /// terminal will be used. 755 /// 756 /// @param[in] stdout_path 757 /// The path to use when re-directing the STDOUT of the new 758 /// process. If all stdXX_path arguments are NULL, a pseudo 759 /// terminal will be used. 760 /// 761 /// @param[in] stderr_path 762 /// The path to use when re-directing the STDERR of the new 763 /// process. If all stdXX_path arguments are NULL, a pseudo 764 /// terminal will be used. 765 /// 766 /// @return 767 /// A new valid process ID, or LLDB_INVALID_PROCESS_ID if 768 /// launching fails. 769 //------------------------------------------------------------------ 770 virtual Error 771 DoLaunch (Module* module, 772 char const *argv[], 773 char const *envp[], 774 uint32_t launch_flags, 775 const char *stdin_path, 776 const char *stdout_path, 777 const char *stderr_path) = 0; 778 779 //------------------------------------------------------------------ 780 /// Called after launching a process. 781 /// 782 /// Allow Process plug-ins to execute some code after launching 783 /// a process. 784 //------------------------------------------------------------------ 785 virtual void 786 DidLaunch () {} 787 788 789 790 //------------------------------------------------------------------ 791 /// Called before resuming to a process. 792 /// 793 /// Allow Process plug-ins to execute some code before resuming a 794 /// process. 795 /// 796 /// @return 797 /// Returns an error object. 798 //------------------------------------------------------------------ 799 virtual Error 800 WillResume () { return Error(); } 801 802 //------------------------------------------------------------------ 803 /// Resumes all of a process's threads as configured using the 804 /// Thread run control functions. 805 /// 806 /// Threads for a process should be updated with one of the run 807 /// control actions (resume, step, or suspend) that they should take 808 /// when the process is resumed. If no run control action is given 809 /// to a thread it will be resumed by default. 810 /// 811 /// @return 812 /// Returns \b true if the process successfully resumes using 813 /// the thread run control actions, \b false otherwise. 814 /// 815 /// @see Thread:Resume() 816 /// @see Thread:Step() 817 /// @see Thread:Suspend() 818 //------------------------------------------------------------------ 819 virtual Error 820 DoResume () = 0; 821 822 //------------------------------------------------------------------ 823 /// Called after resuming a process. 824 /// 825 /// Allow Process plug-ins to execute some code after resuming 826 /// a process. 827 //------------------------------------------------------------------ 828 virtual void 829 DidResume () {} 830 831 832 //------------------------------------------------------------------ 833 /// Called before halting to a process. 834 /// 835 /// Allow Process plug-ins to execute some code before halting a 836 /// process. 837 /// 838 /// @return 839 /// Returns an error object. 840 //------------------------------------------------------------------ 841 virtual Error 842 WillHalt () { return Error(); } 843 844 //------------------------------------------------------------------ 845 /// Halts a running process. 846 /// 847 /// @return 848 /// Returns \b true if the process successfully halts, \b false 849 /// otherwise. 850 //------------------------------------------------------------------ 851 virtual Error 852 DoHalt () = 0; 853 854 //------------------------------------------------------------------ 855 /// Called after halting a process. 856 /// 857 /// Allow Process plug-ins to execute some code after halting 858 /// a process. 859 //------------------------------------------------------------------ 860 virtual void 861 DidHalt () {} 862 863 //------------------------------------------------------------------ 864 /// Called before detaching from a process. 865 /// 866 /// Allow Process plug-ins to execute some code before detaching 867 /// from a process. 868 /// 869 /// @return 870 /// Returns an error object. 871 //------------------------------------------------------------------ 872 virtual Error 873 WillDetach () 874 { 875 return Error(); 876 } 877 878 //------------------------------------------------------------------ 879 /// Detaches from a running or stopped process. 880 /// 881 /// @return 882 /// Returns \b true if the process successfully detaches, \b 883 /// false otherwise. 884 //------------------------------------------------------------------ 885 virtual Error 886 DoDetach () = 0; 887 888 //------------------------------------------------------------------ 889 /// Called after detaching from a process. 890 /// 891 /// Allow Process plug-ins to execute some code after detaching 892 /// from a process. 893 //------------------------------------------------------------------ 894 virtual void 895 DidDetach () {} 896 897 //------------------------------------------------------------------ 898 /// Called before sending a signal to a process. 899 /// 900 /// Allow Process plug-ins to execute some code before sending a 901 /// signal to a process. 902 /// 903 /// @return 904 /// Returns no error if it is safe to proceed with a call to 905 /// Process::DoSignal(int), otherwise an error describing what 906 /// prevents the signal from being sent. 907 //------------------------------------------------------------------ 908 virtual Error 909 WillSignal () { return Error(); } 910 911 //------------------------------------------------------------------ 912 /// Sends a process a UNIX signal \a signal. 913 /// 914 /// @return 915 /// Returns an error object. 916 //------------------------------------------------------------------ 917 virtual Error 918 DoSignal (int signal) = 0; 919 920 921 922 virtual Error 923 WillDestroy () { return Error(); } 924 925 virtual Error 926 DoDestroy () = 0; 927 928 virtual void 929 DidDestroy () { } 930 931 932 //------------------------------------------------------------------ 933 /// Called after sending a signal to a process. 934 /// 935 /// Allow Process plug-ins to execute some code after sending a 936 /// signal to a process. 937 //------------------------------------------------------------------ 938 virtual void 939 DidSignal () {} 940 941 942 //------------------------------------------------------------------ 943 /// Currently called as part of ShouldStop. 944 /// FIXME: Should really happen when the target stops before the 945 /// event is taken from the queue... 946 /// 947 /// This callback is called as the event 948 /// is about to be queued up to allow Process plug-ins to execute 949 /// some code prior to clients being notified that a process was 950 /// stopped. Common operations include updating the thread list, 951 /// invalidating any thread state (registers, stack, etc) prior to 952 /// letting the notification go out. 953 /// 954 //------------------------------------------------------------------ 955 virtual void 956 RefreshStateAfterStop () = 0; 957 958 //------------------------------------------------------------------ 959 /// Get the target object pointer for this module. 960 /// 961 /// @return 962 /// A Target object pointer to the target that owns this 963 /// module. 964 //------------------------------------------------------------------ 965 Target & 966 GetTarget (); 967 968 //------------------------------------------------------------------ 969 /// Get the const target object pointer for this module. 970 /// 971 /// @return 972 /// A const Target object pointer to the target that owns this 973 /// module. 974 //------------------------------------------------------------------ 975 const Target & 976 GetTarget () const; 977 978 //------------------------------------------------------------------ 979 /// Get accessor for the current process state. 980 /// 981 /// @return 982 /// The current state of the process. 983 /// 984 /// @see lldb::StateType 985 //------------------------------------------------------------------ 986 lldb::StateType 987 GetState (); 988 989protected: 990 friend class CommandObjectProcessLaunch; 991 friend class ProcessEventData; 992 friend class CommandObjectBreakpointCommand; 993 994 void 995 SetState (lldb::EventSP &event_sp); 996 997 lldb::StateType 998 GetPrivateState (); 999 1000public: 1001 //------------------------------------------------------------------ 1002 /// Get the exit status for a process. 1003 /// 1004 /// @return 1005 /// The process's return code, or -1 if the current process 1006 /// state is not eStateExited. 1007 //------------------------------------------------------------------ 1008 int 1009 GetExitStatus (); 1010 1011 //------------------------------------------------------------------ 1012 /// Get a textual description of what the process exited. 1013 /// 1014 /// @return 1015 /// The textual description of why the process exited, or NULL 1016 /// if there is no description available. 1017 //------------------------------------------------------------------ 1018 const char * 1019 GetExitDescription (); 1020 1021 1022 virtual void 1023 DidExit () 1024 { 1025 } 1026 1027 //------------------------------------------------------------------ 1028 /// Get the number of times this process has posted a stop event. 1029 /// 1030 /// @return 1031 /// The number of times this process has stopped while being 1032 /// debugged. 1033 //------------------------------------------------------------------ 1034 uint32_t 1035 GetStopID () const; 1036 1037 //------------------------------------------------------------------ 1038 /// Set accessor for the process exit status (return code). 1039 /// 1040 /// Sometimes a child exits and the exit can be detected by global 1041 /// functions (signal handler for SIGCHLD for example). This 1042 /// accessor allows the exit status to be set from an external 1043 /// source. 1044 /// 1045 /// Setting this will cause a eStateExited event to be posted to 1046 /// the process event queue. 1047 /// 1048 /// @param[in] exit_status 1049 /// The value for the process's return code. 1050 /// 1051 /// @see lldb::StateType 1052 //------------------------------------------------------------------ 1053 virtual void 1054 SetExitStatus (int exit_status, const char *cstr); 1055 1056 //------------------------------------------------------------------ 1057 /// Check if a process is still alive. 1058 /// 1059 /// @return 1060 /// Returns \b true if the process is still valid, \b false 1061 /// otherwise. 1062 //------------------------------------------------------------------ 1063 virtual bool 1064 IsAlive () = 0; 1065 1066 //------------------------------------------------------------------ 1067 /// Actually do the reading of memory from a process. 1068 /// 1069 /// Subclasses must override this function and can return fewer 1070 /// bytes than requested when memory requests are too large. This 1071 /// class will break up the memory requests and keep advancing the 1072 /// arguments along as needed. 1073 /// 1074 /// @param[in] vm_addr 1075 /// A virtual load address that indicates where to start reading 1076 /// memory from. 1077 /// 1078 /// @param[in] size 1079 /// The number of bytes to read. 1080 /// 1081 /// @param[out] buf 1082 /// A byte buffer that is at least \a size bytes long that 1083 /// will receive the memory bytes. 1084 /// 1085 /// @return 1086 /// The number of bytes that were actually read into \a buf. 1087 //------------------------------------------------------------------ 1088 virtual size_t 1089 DoReadMemory (lldb::addr_t vm_addr, 1090 void *buf, 1091 size_t size, 1092 Error &error) = 0; 1093 1094 //------------------------------------------------------------------ 1095 /// Read of memory from a process. 1096 /// 1097 /// This function will read memory from the current process's 1098 /// address space and remove any traps that may have been inserted 1099 /// into the memory. 1100 /// 1101 /// This function is not meant to be overridden by Process 1102 /// subclasses, the subclasses should implement 1103 /// Process::DoReadMemory (lldb::addr_t, size_t, void *). 1104 /// 1105 /// @param[in] vm_addr 1106 /// A virtual load address that indicates where to start reading 1107 /// memory from. 1108 /// 1109 /// @param[out] buf 1110 /// A byte buffer that is at least \a size bytes long that 1111 /// will receive the memory bytes. 1112 /// 1113 /// @param[in] size 1114 /// The number of bytes to read. 1115 /// 1116 /// @return 1117 /// The number of bytes that were actually read into \a buf. If 1118 /// the returned number is greater than zero, yet less than \a 1119 /// size, then this function will get called again with \a 1120 /// vm_addr, \a buf, and \a size updated appropriately. Zero is 1121 /// returned to indicate an error. 1122 //------------------------------------------------------------------ 1123 size_t 1124 ReadMemory (lldb::addr_t vm_addr, 1125 void *buf, 1126 size_t size, 1127 Error &error); 1128 1129 //------------------------------------------------------------------ 1130 /// Actually do the writing of memory to a process. 1131 /// 1132 /// @param[in] vm_addr 1133 /// A virtual load address that indicates where to start writing 1134 /// memory to. 1135 /// 1136 /// @param[in] buf 1137 /// A byte buffer that is at least \a size bytes long that 1138 /// contains the data to write. 1139 /// 1140 /// @param[in] size 1141 /// The number of bytes to write. 1142 /// 1143 /// @return 1144 /// The number of bytes that were actually written. 1145 //------------------------------------------------------------------ 1146 virtual size_t 1147 DoWriteMemory (lldb::addr_t vm_addr, const void *buf, size_t size, Error &error) = 0; 1148 1149 //------------------------------------------------------------------ 1150 /// Write memory to a process. 1151 /// 1152 /// This function will write memory to the current process's 1153 /// address space and maintain any traps that might be present due 1154 /// to software breakpoints. 1155 /// 1156 /// This function is not meant to be overridden by Process 1157 /// subclasses, the subclasses should implement 1158 /// Process::DoWriteMemory (lldb::addr_t, size_t, void *). 1159 /// 1160 /// @param[in] vm_addr 1161 /// A virtual load address that indicates where to start writing 1162 /// memory to. 1163 /// 1164 /// @param[in] buf 1165 /// A byte buffer that is at least \a size bytes long that 1166 /// contains the data to write. 1167 /// 1168 /// @param[in] size 1169 /// The number of bytes to write. 1170 /// 1171 /// @return 1172 /// The number of bytes that were actually written. 1173 //------------------------------------------------------------------ 1174 size_t 1175 WriteMemory (lldb::addr_t vm_addr, const void *buf, size_t size, Error &error); 1176 1177 1178 //------------------------------------------------------------------ 1179 /// Actually allocate memory in the process. 1180 /// 1181 /// This function will allocate memory in the process's address 1182 /// space. This can't rely on the generic function calling mechanism, 1183 /// since that requires this function. 1184 /// 1185 /// @param[in] size 1186 /// The size of the allocation requested. 1187 /// 1188 /// @return 1189 /// The address of the allocated buffer in the process, or 1190 /// LLDB_INVALID_ADDRESS if the allocation failed. 1191 //------------------------------------------------------------------ 1192 1193 virtual lldb::addr_t 1194 DoAllocateMemory (size_t size, uint32_t permissions, Error &error) = 0; 1195 1196 //------------------------------------------------------------------ 1197 /// The public interface to allocating memory in the process. 1198 /// 1199 /// This function will allocate memory in the process's address 1200 /// space. This can't rely on the generic function calling mechanism, 1201 /// since that requires this function. 1202 /// 1203 /// @param[in] size 1204 /// The size of the allocation requested. 1205 /// 1206 /// @param[in] permissions 1207 /// Or together any of the lldb::Permissions bits. The permissions on 1208 /// a given memory allocation can't be changed after allocation. Note 1209 /// that a block that isn't set writable can still be written on from lldb, 1210 /// just not by the process itself. 1211 /// 1212 /// @return 1213 /// The address of the allocated buffer in the process, or 1214 /// LLDB_INVALID_ADDRESS if the allocation failed. 1215 //------------------------------------------------------------------ 1216 1217 lldb::addr_t 1218 AllocateMemory (size_t size, uint32_t permissions, Error &error); 1219 1220 //------------------------------------------------------------------ 1221 /// Actually deallocate memory in the process. 1222 /// 1223 /// This function will deallocate memory in the process's address 1224 /// space that was allocated with AllocateMemory. 1225 /// 1226 /// @param[in] ptr 1227 /// A return value from AllocateMemory, pointing to the memory you 1228 /// want to deallocate. 1229 /// 1230 /// @return 1231 /// \btrue if the memory was deallocated, \bfalse otherwise. 1232 //------------------------------------------------------------------ 1233 1234 virtual Error 1235 DoDeallocateMemory (lldb::addr_t ptr) = 0; 1236 1237 //------------------------------------------------------------------ 1238 /// The public interface to deallocating memory in the process. 1239 /// 1240 /// This function will deallocate memory in the process's address 1241 /// space that was allocated with AllocateMemory. 1242 /// 1243 /// @param[in] ptr 1244 /// A return value from AllocateMemory, pointing to the memory you 1245 /// want to deallocate. 1246 /// 1247 /// @return 1248 /// \btrue if the memory was deallocated, \bfalse otherwise. 1249 //------------------------------------------------------------------ 1250 1251 Error 1252 DeallocateMemory (lldb::addr_t ptr); 1253 1254 //------------------------------------------------------------------ 1255 /// Get any available STDOUT. 1256 /// 1257 /// If the process was launched without supplying valid file paths 1258 /// for stdin, stdout, and stderr, then the Process class might 1259 /// try to cache the STDOUT for the process if it is able. Events 1260 /// will be queued indicating that there is STDOUT available that 1261 /// can be retrieved using this function. 1262 /// 1263 /// @param[out] buf 1264 /// A buffer that will receive any STDOUT bytes that are 1265 /// currently available. 1266 /// 1267 /// @param[out] buf_size 1268 /// The size in bytes for the buffer \a buf. 1269 /// 1270 /// @return 1271 /// The number of bytes written into \a buf. If this value is 1272 /// equal to \a buf_size, another call to this function should 1273 /// be made to retrieve more STDOUT data. 1274 //------------------------------------------------------------------ 1275 virtual size_t 1276 GetSTDOUT (char *buf, size_t buf_size, Error &error) 1277 { 1278 error.SetErrorString("stdout unsupported"); 1279 return 0; 1280 } 1281 1282 1283 //------------------------------------------------------------------ 1284 /// Get any available STDERR. 1285 /// 1286 /// If the process was launched without supplying valid file paths 1287 /// for stdin, stdout, and stderr, then the Process class might 1288 /// try to cache the STDERR for the process if it is able. Events 1289 /// will be queued indicating that there is STDERR available that 1290 /// can be retrieved using this function. 1291 /// 1292 /// @param[out] buf 1293 /// A buffer that will receive any STDERR bytes that are 1294 /// currently available. 1295 /// 1296 /// @param[out] buf_size 1297 /// The size in bytes for the buffer \a buf. 1298 /// 1299 /// @return 1300 /// The number of bytes written into \a buf. If this value is 1301 /// equal to \a buf_size, another call to this function should 1302 /// be made to retrieve more STDERR data. 1303 //------------------------------------------------------------------ 1304 virtual size_t 1305 GetSTDERR (char *buf, size_t buf_size, Error &error) 1306 { 1307 error.SetErrorString("stderr unsupported"); 1308 return 0; 1309 } 1310 1311 virtual size_t 1312 PutSTDIN (const char *buf, size_t buf_size, Error &error) 1313 { 1314 error.SetErrorString("stdin unsupported"); 1315 return 0; 1316 } 1317 1318 //---------------------------------------------------------------------- 1319 // Process Breakpoints 1320 //---------------------------------------------------------------------- 1321 virtual size_t 1322 GetSoftwareBreakpointTrapOpcode (BreakpointSite* bp_site) = 0; 1323 1324 virtual Error 1325 EnableBreakpoint (BreakpointSite *bp_site) = 0; 1326 1327 virtual Error 1328 DisableBreakpoint (BreakpointSite *bp_site) = 0; 1329 1330 // This is implemented completely using the lldb::Process API. Subclasses 1331 // don't need to implement this function unless the standard flow of 1332 // read existing opcode, write breakpoint opcode, verify breakpoint opcode 1333 // doesn't work for a specific process plug-in. 1334 virtual Error 1335 EnableSoftwareBreakpoint (BreakpointSite *bp_site); 1336 1337 // This is implemented completely using the lldb::Process API. Subclasses 1338 // don't need to implement this function unless the standard flow of 1339 // restoring original opcode in memory and verifying the restored opcode 1340 // doesn't work for a specific process plug-in. 1341 virtual Error 1342 DisableSoftwareBreakpoint (BreakpointSite *bp_site); 1343 1344 BreakpointSiteList & 1345 GetBreakpointSiteList(); 1346 1347 const BreakpointSiteList & 1348 GetBreakpointSiteList() const; 1349 1350 void 1351 DisableAllBreakpointSites (); 1352 1353 Error 1354 ClearBreakpointSiteByID (lldb::user_id_t break_id); 1355 1356 lldb::break_id_t 1357 CreateBreakpointSite (lldb::BreakpointLocationSP &owner, 1358 bool use_hardware); 1359 1360 Error 1361 DisableBreakpointSiteByID (lldb::user_id_t break_id); 1362 1363 Error 1364 EnableBreakpointSiteByID (lldb::user_id_t break_id); 1365 1366 1367 // BreakpointLocations use RemoveOwnerFromBreakpointSite to remove 1368 // themselves from the owner's list of this breakpoint sites. This has to 1369 // be a static function because you can't be sure that removing the 1370 // breakpoint from it's containing map won't delete the breakpoint site, 1371 // and doing that in an instance method isn't copasetic. 1372 void 1373 RemoveOwnerFromBreakpointSite (lldb::user_id_t owner_id, 1374 lldb::user_id_t owner_loc_id, 1375 lldb::BreakpointSiteSP &bp_site_sp); 1376 1377 //---------------------------------------------------------------------- 1378 // Process Watchpoints (optional) 1379 //---------------------------------------------------------------------- 1380 virtual Error 1381 EnableWatchpoint (WatchpointLocation *bp_loc); 1382 1383 virtual Error 1384 DisableWatchpoint (WatchpointLocation *bp_loc); 1385 1386 //------------------------------------------------------------------ 1387 // Thread Queries 1388 //------------------------------------------------------------------ 1389 virtual uint32_t 1390 UpdateThreadListIfNeeded () = 0; 1391 1392 ThreadList & 1393 GetThreadList (); 1394 1395 const ThreadList & 1396 GetThreadList () const; 1397 1398 uint32_t 1399 GetNextThreadIndexID (); 1400 1401 //------------------------------------------------------------------ 1402 // Event Handling 1403 //------------------------------------------------------------------ 1404 lldb::StateType 1405 GetNextEvent (lldb::EventSP &event_sp); 1406 1407 lldb::StateType 1408 WaitForProcessToStop (const TimeValue *timeout); 1409 1410 lldb::StateType 1411 WaitForStateChangedEvents (const TimeValue *timeout, lldb::EventSP &event_sp); 1412 1413 Event * 1414 PeekAtStateChangedEvents (); 1415 1416 //------------------------------------------------------------------ 1417 /// This is the part of the event handling that for a process event. 1418 /// It decides what to do with the event and returns true if the 1419 /// event needs to be propagated to the user, and false otherwise. 1420 /// If the event is not propagated, this call will most likely set 1421 /// the target to executing again. 1422 /// 1423 /// @param[in] event_ptr 1424 /// This is the event we are handling. 1425 /// 1426 /// @return 1427 /// Returns \b true if the event should be reported to the 1428 /// user, \b false otherwise. 1429 //------------------------------------------------------------------ 1430 bool 1431 ShouldBroadcastEvent (Event *event_ptr); 1432 1433 //------------------------------------------------------------------ 1434 /// Gets the byte order for this process. 1435 /// 1436 /// @return 1437 /// A valid ByteOrder enumeration, or eByteOrderInvalid. 1438 //------------------------------------------------------------------ 1439 virtual lldb::ByteOrder 1440 GetByteOrder () const = 0; 1441 1442 const ConstString & 1443 GetTargetTriple () 1444 { 1445 return m_target_triple; 1446 } 1447 1448 const ABI * 1449 GetABI (); 1450 1451 virtual DynamicLoader * 1452 GetDynamicLoader (); 1453 1454 lldb::addr_t 1455 GetSectionLoadAddress (const Section *section) const; 1456 1457 bool 1458 ResolveLoadAddress (lldb::addr_t load_addr, Address &so_addr) const; 1459 1460 bool 1461 SectionLoaded (const Section *section, lldb::addr_t load_addr); 1462 1463 // The old load address should be specified when unloading to ensure we get 1464 // the correct instance of the section as a shared library could be loaded 1465 // at more than one location. 1466 bool 1467 SectionUnloaded (const Section *section, lldb::addr_t load_addr); 1468 1469 // Unload all instances of a section. This function can be used on systems 1470 // that don't support multiple copies of the same shared library to be 1471 // loaded at the same time. 1472 size_t 1473 SectionUnloaded (const Section *section); 1474 1475 bool 1476 IsRunning () const; 1477 1478 DynamicCheckerFunctions *GetDynamicCheckers() 1479 { 1480 return m_dynamic_checkers.get(); 1481 } 1482 1483 void SetDynamicCheckers(DynamicCheckerFunctions *dynamic_checkers) 1484 { 1485 m_dynamic_checkers.reset(dynamic_checkers); 1486 } 1487 1488 //------------------------------------------------------------------ 1489 // lldb::ExecutionContextScope pure virtual functions 1490 //------------------------------------------------------------------ 1491 virtual Target * 1492 CalculateTarget (); 1493 1494 virtual Process * 1495 CalculateProcess (); 1496 1497 virtual Thread * 1498 CalculateThread (); 1499 1500 virtual StackFrame * 1501 CalculateStackFrame (); 1502 1503 virtual void 1504 Calculate (ExecutionContext &exe_ctx); 1505 1506 lldb::ProcessSP 1507 GetSP (); 1508 1509 ClangPersistentVariables & 1510 GetPersistentVariables(); 1511 1512 ObjCObjectPrinter & 1513 GetObjCObjectPrinter(); 1514 1515protected: 1516 typedef ThreadSafeSTLMap<lldb::addr_t, const Section *> SectionLoadColl; 1517 //------------------------------------------------------------------ 1518 // Member variables 1519 //------------------------------------------------------------------ 1520 Target & m_target; ///< The target that owns this process. 1521 SectionLoadColl m_section_load_info; ///< A mapping of all currently loaded sections. 1522 ThreadSafeValue<lldb::StateType> m_public_state; 1523 ThreadSafeValue<lldb::StateType> m_private_state; // The actual state of our process 1524 Broadcaster m_private_state_broadcaster; // This broadcaster feeds state changed events into the private state thread's listener. 1525 Broadcaster m_private_state_control_broadcaster; // This is the control broadcaster, used to pause, resume & stop the private state thread. 1526 Listener m_private_state_listener; // This is the listener for the private state thread. 1527 Predicate<bool> m_private_state_control_wait; /// This Predicate is used to signal that a control operation is complete. 1528 lldb::thread_t m_private_state_thread; // Thread ID for the thread that watches interal state events 1529 uint32_t m_stop_id; ///< A count of many times the process has stopped. 1530 uint32_t m_thread_index_id; ///< Each thread is created with a 1 based index that won't get re-used. 1531 int m_exit_status; ///< The exit status of the process, or -1 if not set. 1532 std::string m_exit_string; ///< A textual description of why a process exited. 1533 ThreadList m_thread_list; ///< The threads for this process. 1534 std::vector<Notifications> m_notifications; ///< The list of notifications that this process can deliver. 1535 Listener &m_listener; 1536 BreakpointSiteList m_breakpoint_site_list; ///< This is the list of breakpoint locations we intend 1537 ///< to insert in the target. 1538 ClangPersistentVariables m_persistent_vars; ///< These are the persistent variables associated with this process for the expression parser. 1539 std::auto_ptr<DynamicCheckerFunctions> m_dynamic_checkers; ///< The functions used by the expression parser to validate data that expressions use. 1540 UnixSignals m_unix_signals; /// This is the current signal set for this process. 1541 ConstString m_target_triple; 1542 lldb::ABISP m_abi_sp; 1543 ObjCObjectPrinter m_objc_object_printer; 1544 1545 size_t 1546 RemoveBreakpointOpcodesFromBuffer (lldb::addr_t addr, size_t size, uint8_t *buf) const; 1547 1548 void 1549 SynchronouslyNotifyStateChanged (lldb::StateType state); 1550 1551 void 1552 SetPublicState (lldb::StateType new_state); 1553 1554 void 1555 SetPrivateState (lldb::StateType state); 1556 1557 bool 1558 StartPrivateStateThread (); 1559 1560 void 1561 StopPrivateStateThread (); 1562 1563 void 1564 PausePrivateStateThread (); 1565 1566 void 1567 ResumePrivateStateThread (); 1568 1569 static void * 1570 PrivateStateThread (void *arg); 1571 1572 void * 1573 RunPrivateStateThread (); 1574 1575 void 1576 HandlePrivateEvent (lldb::EventSP &event_sp); 1577 1578 lldb::StateType 1579 WaitForProcessStopPrivate (const TimeValue *timeout, lldb::EventSP &event_sp); 1580 1581 Error 1582 CompleteAttach (); 1583 1584 1585 // This waits for both the state change broadcaster, and the control broadcaster. 1586 // If control_only, it only waits for the control broadcaster. 1587 1588 bool 1589 WaitForEventsPrivate (const TimeValue *timeout, lldb::EventSP &event_sp, bool control_only); 1590 1591 lldb::StateType 1592 WaitForStateChangedEventsPrivate (const TimeValue *timeout, lldb::EventSP &event_sp); 1593 1594 lldb::StateType 1595 WaitForState (const TimeValue *timeout, 1596 const lldb::StateType *match_states, 1597 const uint32_t num_match_states); 1598 1599 size_t 1600 WriteMemoryPrivate (lldb::addr_t addr, const void *buf, size_t size, Error &error); 1601 1602private: 1603 //------------------------------------------------------------------ 1604 // For Process only 1605 //------------------------------------------------------------------ 1606 void ControlPrivateStateThread (uint32_t signal); 1607 1608 DISALLOW_COPY_AND_ASSIGN (Process); 1609 1610}; 1611 1612} // namespace lldb_private 1613 1614#endif // liblldb_Process_h_ 1615