LLDB  mainline
Process.h
Go to the documentation of this file.
1 //===-- Process.h -----------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_TARGET_PROCESS_H
10 #define LLDB_TARGET_PROCESS_H
11 
12 #include "lldb/Host/Config.h"
13 
14 #include <climits>
15 
16 #include <chrono>
17 #include <list>
18 #include <memory>
19 #include <mutex>
20 #include <string>
21 #include <unordered_set>
22 #include <vector>
23 
30 #include "lldb/Host/HostThread.h"
33 #include "lldb/Symbol/ObjectFile.h"
36 #include "lldb/Target/Memory.h"
38 #include "lldb/Target/QueueList.h"
39 #include "lldb/Target/ThreadList.h"
41 #include "lldb/Target/Trace.h"
42 #include "lldb/Utility/ArchSpec.h"
44 #include "lldb/Utility/Event.h"
45 #include "lldb/Utility/Listener.h"
48 #include "lldb/Utility/Status.h"
53 #include "lldb/lldb-private.h"
54 
55 #include "llvm/ADT/ArrayRef.h"
56 #include "llvm/Support/Threading.h"
57 #include "llvm/Support/VersionTuple.h"
58 
59 namespace lldb_private {
60 
61 template <typename B, typename S> struct Range;
62 
64 public:
66 };
67 
68 class ProcessProperties : public Properties {
69 public:
70  // Pass nullptr for "process" if the ProcessProperties are to be the global
71  // copy
73 
74  ~ProcessProperties() override;
75 
76  bool GetDisableMemoryCache() const;
77  uint64_t GetMemoryCacheLineSize() const;
79  void SetExtraStartupCommands(const Args &args);
83  void SetPythonOSPluginPath(const FileSpec &file);
85  void SetIgnoreBreakpointsInExpressions(bool ignore);
86  bool GetUnwindOnErrorInExpressions() const;
87  void SetUnwindOnErrorInExpressions(bool ignore);
88  bool GetStopOnSharedLibraryEvents() const;
89  void SetStopOnSharedLibraryEvents(bool stop);
91  void SetDisableLangRuntimeUnwindPlans(bool disable);
92  bool GetDetachKeepsStopped() const;
93  void SetDetachKeepsStopped(bool keep_stopped);
94  bool GetWarningsOptimization() const;
95  bool GetWarningsUnsupportedLanguage() const;
96  bool GetStopOnExec() const;
97  std::chrono::seconds GetUtilityExpressionTimeout() const;
98  std::chrono::seconds GetInterruptTimeout() const;
99  bool GetOSPluginReportsAllThreads() const;
100  void SetOSPluginReportsAllThreads(bool does_report);
101  bool GetSteppingRunsAllThreads() const;
103 
104 protected:
105  Process *m_process; // Can be nullptr for global ProcessProperties
106  std::unique_ptr<ProcessExperimentalProperties> m_experimental_properties_up;
107 };
108 
109 typedef std::shared_ptr<ProcessProperties> ProcessPropertiesSP;
110 
111 // ProcessAttachInfo
112 //
113 // Describes any information that is required to attach to a process.
114 
116 public:
119  m_plugin_name() {}
120 
125  m_detach_on_error(true), m_async(false) {
126  ProcessInfo::operator=(launch_info);
128  SetResumeCount(launch_info.GetResumeCount());
129  SetListener(launch_info.GetListener());
130  SetHijackListener(launch_info.GetHijackListener());
131  m_detach_on_error = launch_info.GetDetachOnError();
132  }
133 
134  bool GetWaitForLaunch() const { return m_wait_for_launch; }
135 
136  void SetWaitForLaunch(bool b) { m_wait_for_launch = b; }
137 
138  bool GetAsync() const { return m_async; }
139 
140  void SetAsync(bool b) { m_async = b; }
141 
142  bool GetIgnoreExisting() const { return m_ignore_existing; }
143 
144  void SetIgnoreExisting(bool b) { m_ignore_existing = b; }
145 
147 
149 
151 
153 
154  const char *GetProcessPluginName() const {
155  return (m_plugin_name.empty() ? nullptr : m_plugin_name.c_str());
156  }
157 
158  void SetProcessPluginName(llvm::StringRef plugin) {
159  m_plugin_name = std::string(plugin);
160  }
161 
162  void Clear() {
164  m_plugin_name.clear();
165  m_resume_count = 0;
166  m_wait_for_launch = false;
167  m_ignore_existing = true;
168  m_continue_once_attached = false;
169  }
170 
171  bool ProcessInfoSpecified() const {
172  if (GetExecutableFile())
173  return true;
175  return true;
177  return true;
178  return false;
179  }
180 
181  lldb::ListenerSP GetHijackListener() const { return m_hijack_listener_sp; }
182 
183  void SetHijackListener(const lldb::ListenerSP &listener_sp) {
184  m_hijack_listener_sp = listener_sp;
185  }
186 
187  bool GetDetachOnError() const { return m_detach_on_error; }
188 
189  void SetDetachOnError(bool enable) { m_detach_on_error = enable; }
190 
191  // Get and set the actual listener that will be used for the process events
192  lldb::ListenerSP GetListener() const { return m_listener_sp; }
193 
194  void SetListener(const lldb::ListenerSP &listener_sp) {
195  m_listener_sp = listener_sp;
196  }
197 
198  lldb::ListenerSP GetListenerForProcess(Debugger &debugger);
199 
200 protected:
201  lldb::ListenerSP m_listener_sp;
202  lldb::ListenerSP m_hijack_listener_sp;
204  uint32_t m_resume_count = 0; // How many times do we resume after launching
205  bool m_wait_for_launch = false;
206  bool m_ignore_existing = true;
207  bool m_continue_once_attached = false; // Supports the use-case scenario of
208  // immediately continuing the process
209  // once attached.
211  true; // If we are debugging remotely, instruct the stub to
212  // detach rather than killing the target on error.
213  bool m_async =
214  false; // Use an async attach where we start the attach and return
215  // immediately (used by GUI programs with --waitfor so they can
216  // call SBProcess::Stop() to cancel attach)
217 };
218 
219 // This class tracks the Modification state of the process. Things that can
220 // currently modify the program are running the program (which will up the
221 // StopID) and writing memory (which will up the MemoryID.)
222 // FIXME: Should we also include modification of register states?
223 
225  friend bool operator==(const ProcessModID &lhs, const ProcessModID &rhs);
226 
227 public:
228  ProcessModID() = default;
229 
232 
233  const ProcessModID &operator=(const ProcessModID &rhs) {
234  if (this != &rhs) {
235  m_stop_id = rhs.m_stop_id;
236  m_memory_id = rhs.m_memory_id;
237  }
238  return *this;
239  }
240 
241  ~ProcessModID() = default;
242 
243  void BumpStopID() {
244  m_stop_id++;
247  }
248 
249  void BumpMemoryID() { m_memory_id++; }
250 
251  void BumpResumeID() {
252  m_resume_id++;
255  }
256 
258  return m_running_utility_function > 0;
259  }
260 
261  uint32_t GetStopID() const { return m_stop_id; }
263  uint32_t GetMemoryID() const { return m_memory_id; }
264  uint32_t GetResumeID() const { return m_resume_id; }
267  }
268 
269  bool MemoryIDEqual(const ProcessModID &compare) const {
270  return m_memory_id == compare.m_memory_id;
271  }
272 
273  bool StopIDEqual(const ProcessModID &compare) const {
274  return m_stop_id == compare.m_stop_id;
275  }
276 
278 
279  bool IsValid() const { return m_stop_id != UINT32_MAX; }
280 
282  // If we haven't yet resumed the target, then it can't be for a user
283  // expression...
284  if (m_resume_id == 0)
285  return false;
286 
288  }
289 
290  void SetRunningUserExpression(bool on) {
291  if (on)
293  else
295  }
296 
298  if (on)
300  else {
301  assert(m_running_utility_function > 0 &&
302  "Called SetRunningUtilityFunction(false) without calling "
303  "SetRunningUtilityFunction(true) before?");
305  }
306  }
307 
308  void SetStopEventForLastNaturalStopID(lldb::EventSP event_sp) {
309  m_last_natural_stop_event = std::move(event_sp);
310  }
311 
312  lldb::EventSP GetStopEventForStopID(uint32_t stop_id) const {
313  if (stop_id == m_last_natural_stop_id)
315  return lldb::EventSP();
316  }
317 
318 private:
327 };
328 
329 inline bool operator==(const ProcessModID &lhs, const ProcessModID &rhs) {
330  if (lhs.StopIDEqual(rhs) && lhs.MemoryIDEqual(rhs))
331  return true;
332  else
333  return false;
334 }
335 
336 inline bool operator!=(const ProcessModID &lhs, const ProcessModID &rhs) {
337  return (!lhs.StopIDEqual(rhs) || !lhs.MemoryIDEqual(rhs));
338 }
339 
340 /// \class Process Process.h "lldb/Target/Process.h"
341 /// A plug-in interface definition class for debugging a process.
342 class Process : public std::enable_shared_from_this<Process>,
343  public ProcessProperties,
344  public Broadcaster,
345  public ExecutionContextScope,
346  public PluginInterface {
347  friend class FunctionCaller; // For WaitForStateChangeEventsPrivate
348  friend class Debugger; // For PopProcessIOHandler and ProcessIOHandlerIsActive
349  friend class DynamicLoader; // For LoadOperatingSystemPlugin
350  friend class ProcessEventData;
351  friend class StopInfo;
352  friend class Target;
353  friend class ThreadList;
354 
355 public:
356  /// Broadcaster event bits definitions.
357  enum {
364  };
365 
366  enum {
370  };
371 
372  /// Process warning types.
374 
376  // We use a read/write lock to allow on or more clients to access the process
377  // state while the process is stopped (reader). We lock the write lock to
378  // control access to the process while it is running (readers, or clients
379  // that want the process stopped can block waiting for the process to stop,
380  // or just try to lock it to see if they can immediately access the stopped
381  // process. If the try read lock fails, then the process is running.
383 
384  // These two functions fill out the Broadcaster interface:
385 
387 
388  ConstString &GetBroadcasterClass() const override {
389  return GetStaticBroadcasterClass();
390  }
391 
392 /// A notification structure that can be used by clients to listen
393 /// for changes in a process's lifetime.
394 ///
395 /// \see RegisterNotificationCallbacks (const Notifications&) @see
396 /// UnregisterNotificationCallbacks (const Notifications&)
397  typedef struct {
398  void *baton;
399  void (*initialize)(void *baton, Process *process);
400  void (*process_state_changed)(void *baton, Process *process,
401  lldb::StateType state);
402  } Notifications;
403 
404  class ProcessEventData : public EventData {
405  friend class Process;
406 
407  public:
409  ProcessEventData(const lldb::ProcessSP &process, lldb::StateType state);
410 
411  ~ProcessEventData() override;
412 
413  static ConstString GetFlavorString();
414 
415  ConstString GetFlavor() const override;
416 
417  lldb::ProcessSP GetProcessSP() const { return m_process_wp.lock(); }
418 
419  lldb::StateType GetState() const { return m_state; }
420  bool GetRestarted() const { return m_restarted; }
421 
422  size_t GetNumRestartedReasons() { return m_restarted_reasons.size(); }
423 
424  const char *GetRestartedReasonAtIndex(size_t idx) {
425  return ((idx < m_restarted_reasons.size())
426  ? m_restarted_reasons[idx].c_str()
427  : nullptr);
428  }
429 
430  bool GetInterrupted() const { return m_interrupted; }
431 
432  void Dump(Stream *s) const override;
433 
434  virtual bool ShouldStop(Event *event_ptr, bool &found_valid_stopinfo);
435 
436  void DoOnRemoval(Event *event_ptr) override;
437 
438  static const Process::ProcessEventData *
439  GetEventDataFromEvent(const Event *event_ptr);
440 
441  static lldb::ProcessSP GetProcessFromEvent(const Event *event_ptr);
442 
443  static lldb::StateType GetStateFromEvent(const Event *event_ptr);
444 
445  static bool GetRestartedFromEvent(const Event *event_ptr);
446 
447  static size_t GetNumRestartedReasons(const Event *event_ptr);
448 
449  static const char *GetRestartedReasonAtIndex(const Event *event_ptr,
450  size_t idx);
451 
452  static void AddRestartedReason(Event *event_ptr, const char *reason);
453 
454  static void SetRestartedInEvent(Event *event_ptr, bool new_value);
455 
456  static bool GetInterruptedFromEvent(const Event *event_ptr);
457 
458  static void SetInterruptedInEvent(Event *event_ptr, bool new_value);
459 
460  static bool SetUpdateStateOnRemoval(Event *event_ptr);
461 
462  private:
464 
465  void SetRestarted(bool new_value) { m_restarted = new_value; }
466 
467  void SetInterrupted(bool new_value) { m_interrupted = new_value; }
468 
469  void AddRestartedReason(const char *reason) {
470  m_restarted_reasons.push_back(reason);
471  }
472 
473  lldb::ProcessWP m_process_wp;
475  std::vector<std::string> m_restarted_reasons;
476  bool m_restarted = false; // For "eStateStopped" events, this is true if the
477  // target was automatically restarted.
478  int m_update_state = 0;
479  bool m_interrupted = false;
480 
481  ProcessEventData(const ProcessEventData &) = delete;
482  const ProcessEventData &operator=(const ProcessEventData &) = delete;
483  };
484 
485  /// Construct with a shared pointer to a target, and the Process listener.
486  /// Uses the Host UnixSignalsSP by default.
487  Process(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp);
488 
489  /// Construct with a shared pointer to a target, the Process listener, and
490  /// the appropriate UnixSignalsSP for the process.
491  Process(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,
492  const lldb::UnixSignalsSP &unix_signals_sp);
493 
494  /// Destructor.
495  ///
496  /// The destructor is virtual since this class is designed to be inherited
497  /// from by the plug-in instance.
498  ~Process() override;
499 
500  static void SettingsInitialize();
501 
502  static void SettingsTerminate();
503 
505 
506  /// Find a Process plug-in that can debug \a module using the currently
507  /// selected architecture.
508  ///
509  /// Scans all loaded plug-in interfaces that implement versions of the
510  /// Process plug-in interface and returns the first instance that can debug
511  /// the file.
512  ///
513  /// \see Process::CanDebug ()
514  static lldb::ProcessSP FindPlugin(lldb::TargetSP target_sp,
515  llvm::StringRef plugin_name,
516  lldb::ListenerSP listener_sp,
517  const FileSpec *crash_file_path,
518  bool can_connect);
519 
520  /// Static function that can be used with the \b host function
521  /// Host::StartMonitoringChildProcess ().
522  ///
523  /// This function can be used by lldb_private::Process subclasses when they
524  /// want to watch for a local process and have its exit status automatically
525  /// set when the host child process exits. Subclasses should call
526  /// Host::StartMonitoringChildProcess () with:
527  /// callback = Process::SetHostProcessExitStatus
528  /// pid = Process::GetID()
529  /// monitor_signals = false
530  static bool
531  SetProcessExitStatus(lldb::pid_t pid, // The process ID we want to monitor
532  bool exited,
533  int signo, // Zero for no signal
534  int status); // Exit value of process if signal is zero
535 
537 
539 
540  /// Returns the pid of the process or LLDB_INVALID_PROCESS_ID if there is
541  /// no known pid.
542  lldb::pid_t GetID() const { return m_pid; }
543 
544  /// Sets the stored pid.
545  ///
546  /// This does not change the pid of underlying process.
547  void SetID(lldb::pid_t new_pid) { m_pid = new_pid; }
548 
550 
551  /// Check if a plug-in instance can debug the file in \a module.
552  ///
553  /// Each plug-in is given a chance to say whether it can debug the file in
554  /// \a module. If the Process plug-in instance can debug a file on the
555  /// current system, it should return \b true.
556  ///
557  /// \return
558  /// Returns \b true if this Process plug-in instance can
559  /// debug the executable, \b false otherwise.
560  virtual bool CanDebug(lldb::TargetSP target,
561  bool plugin_specified_by_name) = 0;
562 
563  /// This object is about to be destroyed, do any necessary cleanup.
564  ///
565  /// Subclasses that override this method should always call this superclass
566  /// method.
567  virtual void Finalize();
568 
569  /// Return whether this object is valid (i.e. has not been finalized.)
570  ///
571  /// \return
572  /// Returns \b true if this Process has not been finalized
573  /// and \b false otherwise.
574  bool IsValid() const { return !m_finalizing; }
575 
576  /// Return a multi-word command object that can be used to expose plug-in
577  /// specific commands.
578  ///
579  /// This object will be used to resolve plug-in commands and can be
580  /// triggered by a call to:
581  ///
582  /// (lldb) process command <args>
583  ///
584  /// \return
585  /// A CommandObject which can be one of the concrete subclasses
586  /// of CommandObject like CommandObjectRaw, CommandObjectParsed,
587  /// or CommandObjectMultiword.
588  virtual CommandObject *GetPluginCommandObject() { return nullptr; }
589 
590  /// Launch a new process.
591  ///
592  /// Launch a new process by spawning a new process using the target object's
593  /// executable module's file as the file to launch.
594  ///
595  /// This function is not meant to be overridden by Process subclasses. It
596  /// will first call Process::WillLaunch (Module *) and if that returns \b
597  /// true, Process::DoLaunch (Module*, char const *[],char const *[],const
598  /// char *,const char *, const char *) will be called to actually do the
599  /// launching. If DoLaunch returns \b true, then Process::DidLaunch() will
600  /// be called.
601  ///
602  /// \param[in] launch_info
603  /// Details regarding the environment, STDIN/STDOUT/STDERR
604  /// redirection, working path, etc. related to the requested launch.
605  ///
606  /// \return
607  /// An error object. Call GetID() to get the process ID if
608  /// the error object is success.
609  virtual Status Launch(ProcessLaunchInfo &launch_info);
610 
611  virtual Status LoadCore();
612 
613  virtual Status DoLoadCore() {
614  Status error;
615  error.SetErrorStringWithFormat(
616  "error: %s does not support loading core files.",
617  GetPluginName().GetCString());
618  return error;
619  }
620 
621  // FUTURE WORK: GetLoadImageUtilityFunction are the first use we've
622  // had of having other plugins cache data in the Process. This is handy for
623  // long-living plugins - like the Platform - which manage interactions whose
624  // lifetime is governed by the Process lifetime. If we find we need to do
625  // this more often, we should construct a general solution to the problem.
626  // The consensus suggestion was that we have a token based registry in the
627  // Process. Some undecided questions are (1) who manages the tokens. It's
628  // probably best that you add the element and get back a token that
629  // represents it. That will avoid collisions. But there may be some utility
630  // in the registerer controlling the token? (2) whether the thing added
631  // should be simply owned by Process, and just go away when it does (3)
632  // whether the registree should be notified of the Process' demise.
633  //
634  // We are postponing designing this till we have at least a second use case.
635  /// Get the cached UtilityFunction that assists in loading binary images
636  /// into the process.
637  ///
638  /// \param[in] platform
639  /// The platform fetching the UtilityFunction.
640  /// \param[in] factory
641  /// A function that will be called only once per-process in a
642  /// thread-safe way to create the UtilityFunction if it has not
643  /// been initialized yet.
644  ///
645  /// \return
646  /// The cached utility function or null if the platform is not the
647  /// same as the target's platform.
649  Platform *platform,
650  llvm::function_ref<std::unique_ptr<UtilityFunction>()> factory);
651 
652  /// Get the dynamic loader plug-in for this process.
653  ///
654  /// The default action is to let the DynamicLoader plug-ins check the main
655  /// executable and the DynamicLoader will select itself automatically.
656  /// Subclasses can override this if inspecting the executable is not
657  /// desired, or if Process subclasses can only use a specific DynamicLoader
658  /// plug-in.
659  virtual DynamicLoader *GetDynamicLoader();
660 
661  // Returns AUXV structure found in many ELF-based environments.
662  //
663  // The default action is to return an empty data buffer.
664  //
665  // \return
666  // A data extractor containing the contents of the AUXV data.
667  virtual DataExtractor GetAuxvData();
668 
669  /// Sometimes processes know how to retrieve and load shared libraries. This
670  /// is normally done by DynamicLoader plug-ins, but sometimes the connection
671  /// to the process allows retrieving this information. The dynamic loader
672  /// plug-ins can use this function if they can't determine the current
673  /// shared library load state.
674  ///
675  /// \return
676  /// A status object indicating if the operation was sucessful or not.
678  return llvm::make_error<llvm::StringError>("Not implemented.",
679  llvm::inconvertibleErrorCode());
680  }
681 
682  /// Query remote GDBServer for a detailed loaded library list
683  /// \return
684  /// The list of modules currently loaded by the process, or an error.
685  virtual llvm::Expected<LoadedModuleInfoList> GetLoadedModuleList() {
686  return llvm::createStringError(llvm::inconvertibleErrorCode(),
687  "Not implemented");
688  }
689 
690  /// Save core dump into the specified file.
691  ///
692  /// \param[in] outfile
693  /// Path to store core dump in.
694  ///
695  /// \return
696  /// true if saved successfully, false if saving the core dump
697  /// is not supported by the plugin, error otherwise.
698  virtual llvm::Expected<bool> SaveCore(llvm::StringRef outfile);
699 
700 protected:
701  virtual JITLoaderList &GetJITLoaders();
702 
703 public:
704  /// Get the system runtime plug-in for this process.
705  ///
706  /// \return
707  /// Returns a pointer to the SystemRuntime plugin for this Process
708  /// if one is available. Else returns nullptr.
709  virtual SystemRuntime *GetSystemRuntime();
710 
711  /// Attach to an existing process using the process attach info.
712  ///
713  /// This function is not meant to be overridden by Process subclasses. It
714  /// will first call WillAttach (lldb::pid_t) or WillAttach (const char *),
715  /// and if that returns \b true, DoAttach (lldb::pid_t) or DoAttach (const
716  /// char *) will be called to actually do the attach. If DoAttach returns \b
717  /// true, then Process::DidAttach() will be called.
718  ///
719  /// \param[in] attach_info
720  /// The process attach info.
721  ///
722  /// \return
723  /// Returns \a pid if attaching was successful, or
724  /// LLDB_INVALID_PROCESS_ID if attaching fails.
725  virtual Status Attach(ProcessAttachInfo &attach_info);
726 
727  /// Attach to a remote system via a URL
728  ///
729  /// \param[in] remote_url
730  /// The URL format that we are connecting to.
731  ///
732  /// \return
733  /// Returns an error object.
734  virtual Status ConnectRemote(llvm::StringRef remote_url);
735 
736  bool GetShouldDetach() const { return m_should_detach; }
737 
738  void SetShouldDetach(bool b) { m_should_detach = b; }
739 
740  /// Get the image vector for the current process.
741  ///
742  /// \return
743  /// The constant reference to the member m_image_tokens.
744  const std::vector<lldb::addr_t>& GetImageTokens() { return m_image_tokens; }
745 
746  /// Get the image information address for the current process.
747  ///
748  /// Some runtimes have system functions that can help dynamic loaders locate
749  /// the dynamic loader information needed to observe shared libraries being
750  /// loaded or unloaded. This function is in the Process interface (as
751  /// opposed to the DynamicLoader interface) to ensure that remote debugging
752  /// can take advantage of this functionality.
753  ///
754  /// \return
755  /// The address of the dynamic loader information, or
756  /// LLDB_INVALID_ADDRESS if this is not supported by this
757  /// interface.
759 
760  /// Called when the process is about to broadcast a public stop.
761  ///
762  /// There are public and private stops. Private stops are when the process
763  /// is doing things like stepping and the client doesn't need to know about
764  /// starts and stop that implement a thread plan. Single stepping over a
765  /// source line in code might end up being implemented by one or more
766  /// process starts and stops. Public stops are when clients will be notified
767  /// that the process is stopped. These events typically trigger UI updates
768  /// (thread stack frames to be displayed, variables to be displayed, and
769  /// more). This function can be overriden and allows process subclasses to
770  /// do something before the eBroadcastBitStateChanged event is sent to
771  /// public clients.
772  virtual void WillPublicStop() {}
773 
774 /// Register for process and thread notifications.
775 ///
776 /// Clients can register notification callbacks by filling out a
777 /// Process::Notifications structure and calling this function.
778 ///
779 /// \param[in] callbacks
780 /// A structure that contains the notification baton and
781 /// callback functions.
782 ///
783 /// \see Process::Notifications
785 
786 /// Unregister for process and thread notifications.
787 ///
788 /// Clients can unregister notification callbacks by passing a copy of the
789 /// original baton and callbacks in \a callbacks.
790 ///
791 /// \param[in] callbacks
792 /// A structure that contains the notification baton and
793 /// callback functions.
794 ///
795 /// \return
796 /// Returns \b true if the notification callbacks were
797 /// successfully removed from the process, \b false otherwise.
798 ///
799 /// \see Process::Notifications
801 
802  //==================================================================
803  // Built in Process Control functions
804  //==================================================================
805  /// Resumes all of a process's threads as configured using the Thread run
806  /// control functions.
807  ///
808  /// Threads for a process should be updated with one of the run control
809  /// actions (resume, step, or suspend) that they should take when the
810  /// process is resumed. If no run control action is given to a thread it
811  /// will be resumed by default.
812  ///
813  /// This function is not meant to be overridden by Process subclasses. This
814  /// function will take care of disabling any breakpoints that threads may be
815  /// stopped at, single stepping, and re-enabling breakpoints, and enabling
816  /// the basic flow control that the plug-in instances need not worry about.
817  ///
818  /// N.B. This function also sets the Write side of the Run Lock, which is
819  /// unset when the corresponding stop event is pulled off the Public Event
820  /// Queue. If you need to resume the process without setting the Run Lock,
821  /// use PrivateResume (though you should only do that from inside the
822  /// Process class.
823  ///
824  /// \return
825  /// Returns an error object.
826  ///
827  /// \see Thread:Resume()
828  /// \see Thread:Step()
829  /// \see Thread:Suspend()
830  Status Resume();
831 
833 
834  /// Halts a running process.
835  ///
836  /// This function is not meant to be overridden by Process subclasses. If
837  /// the process is successfully halted, a eStateStopped process event with
838  /// GetInterrupted will be broadcast. If false, we will halt the process
839  /// with no events generated by the halt.
840  ///
841  /// \param[in] clear_thread_plans
842  /// If true, when the process stops, clear all thread plans.
843  ///
844  /// \param[in] use_run_lock
845  /// Whether to release the run lock after the stop.
846  ///
847  /// \return
848  /// Returns an error object. If the error is empty, the process is
849  /// halted.
850  /// otherwise the halt has failed.
851  Status Halt(bool clear_thread_plans = false, bool use_run_lock = true);
852 
853  /// Detaches from a running or stopped process.
854  ///
855  /// This function is not meant to be overridden by Process subclasses.
856  ///
857  /// \param[in] keep_stopped
858  /// If true, don't resume the process on detach.
859  ///
860  /// \return
861  /// Returns an error object.
862  Status Detach(bool keep_stopped);
863 
864  /// Kills the process and shuts down all threads that were spawned to track
865  /// and monitor the process.
866  ///
867  /// This function is not meant to be overridden by Process subclasses.
868  ///
869  /// \param[in] force_kill
870  /// Whether lldb should force a kill (instead of a detach) from
871  /// the inferior process. Normally if lldb launched a binary and
872  /// Destory is called, lldb kills it. If lldb attached to a
873  /// running process and Destory is called, lldb detaches. If
874  /// this behavior needs to be over-ridden, this is the bool that
875  /// can be used.
876  ///
877  /// \return
878  /// Returns an error object.
879  Status Destroy(bool force_kill);
880 
881  /// Sends a process a UNIX signal \a signal.
882  ///
883  /// This function is not meant to be overridden by Process subclasses.
884  ///
885  /// \return
886  /// Returns an error object.
887  Status Signal(int signal);
888 
889  void SetUnixSignals(lldb::UnixSignalsSP &&signals_sp);
890 
891  const lldb::UnixSignalsSP &GetUnixSignals();
892 
893  //==================================================================
894  // Plug-in Process Control Overrides
895  //==================================================================
896 
897  /// Called before attaching to a process.
898  ///
899  /// Allow Process plug-ins to execute some code before attaching a process.
900  ///
901  /// \return
902  /// Returns an error object.
904 
905  /// Called before attaching to a process.
906  ///
907  /// Allow Process plug-ins to execute some code before attaching a process.
908  ///
909  /// \return
910  /// Returns an error object.
911  virtual Status WillAttachToProcessWithName(const char *process_name,
912  bool wait_for_launch) {
913  return Status();
914  }
915 
916  /// Attach to a remote system via a URL
917  ///
918  /// \param[in] remote_url
919  /// The URL format that we are connecting to.
920  ///
921  /// \return
922  /// Returns an error object.
923  virtual Status DoConnectRemote(llvm::StringRef remote_url) {
924  Status error;
925  error.SetErrorString("remote connections are not supported");
926  return error;
927  }
928 
929  /// Attach to an existing process using a process ID.
930  ///
931  /// \param[in] pid
932  /// The process ID that we should attempt to attach to.
933  ///
934  /// \param[in] attach_info
935  /// Information on how to do the attach. For example, GetUserID()
936  /// will return the uid to attach as.
937  ///
938  /// \return
939  /// Returns a successful Status attaching was successful, or
940  /// an appropriate (possibly platform-specific) error code if
941  /// attaching fails.
942  /// hanming : need flag
944  const ProcessAttachInfo &attach_info) {
945  Status error;
946  error.SetErrorStringWithFormat(
947  "error: %s does not support attaching to a process by pid",
948  GetPluginName().GetCString());
949  return error;
950  }
951 
952  /// Attach to an existing process using a partial process name.
953  ///
954  /// \param[in] process_name
955  /// The name of the process to attach to.
956  ///
957  /// \param[in] attach_info
958  /// Information on how to do the attach. For example, GetUserID()
959  /// will return the uid to attach as.
960  ///
961  /// \return
962  /// Returns a successful Status attaching was successful, or
963  /// an appropriate (possibly platform-specific) error code if
964  /// attaching fails.
965  virtual Status
966  DoAttachToProcessWithName(const char *process_name,
967  const ProcessAttachInfo &attach_info) {
968  Status error;
969  error.SetErrorString("attach by name is not supported");
970  return error;
971  }
972 
973  /// Called after attaching a process.
974  ///
975  /// \param[in] process_arch
976  /// If you can figure out the process architecture after attach, fill it
977  /// in here.
978  ///
979  /// Allow Process plug-ins to execute some code after attaching to a
980  /// process.
981  virtual void DidAttach(ArchSpec &process_arch) { process_arch.Clear(); }
982 
983  /// Called after a process re-execs itself.
984  ///
985  /// Allow Process plug-ins to execute some code after a process has exec'ed
986  /// itself. Subclasses typically should override DoDidExec() as the
987  /// lldb_private::Process class needs to remove its dynamic loader, runtime,
988  /// ABI and other plug-ins, as well as unload all shared libraries.
989  virtual void DidExec();
990 
991  /// Subclasses of Process should implement this function if they need to do
992  /// anything after a process exec's itself.
993  virtual void DoDidExec() {}
994 
995  /// Called after a reported fork.
996  virtual void DidFork(lldb::pid_t child_pid, lldb::tid_t child_tid) {}
997 
998  /// Called after a reported vfork.
999  virtual void DidVFork(lldb::pid_t child_pid, lldb::tid_t child_tid) {}
1000 
1001  /// Called after reported vfork completion.
1002  virtual void DidVForkDone() {}
1003 
1004  /// Called before launching to a process.
1005  ///
1006  /// Allow Process plug-ins to execute some code before launching a process.
1007  ///
1008  /// \return
1009  /// Returns an error object.
1010  virtual Status WillLaunch(Module *module) { return Status(); }
1011 
1012  /// Launch a new process.
1013  ///
1014  /// Launch a new process by spawning a new process using \a exe_module's
1015  /// file as the file to launch. Launch details are provided in \a
1016  /// launch_info.
1017  ///
1018  /// \param[in] exe_module
1019  /// The module from which to extract the file specification and
1020  /// launch.
1021  ///
1022  /// \param[in] launch_info
1023  /// Details (e.g. arguments, stdio redirection, etc.) for the
1024  /// requested launch.
1025  ///
1026  /// \return
1027  /// An Status instance indicating success or failure of the
1028  /// operation.
1029  virtual Status DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) {
1030  Status error;
1031  error.SetErrorStringWithFormat(
1032  "error: %s does not support launching processes",
1033  GetPluginName().GetCString());
1034  return error;
1035  }
1036 
1037  /// Called after launching a process.
1038  ///
1039  /// Allow Process plug-ins to execute some code after launching a process.
1040  virtual void DidLaunch() {}
1041 
1042  /// Called before resuming to a process.
1043  ///
1044  /// Allow Process plug-ins to execute some code before resuming a process.
1045  ///
1046  /// \return
1047  /// Returns an error object.
1048  virtual Status WillResume() { return Status(); }
1049 
1050  /// Resumes all of a process's threads as configured using the Thread run
1051  /// control functions.
1052  ///
1053  /// Threads for a process should be updated with one of the run control
1054  /// actions (resume, step, or suspend) that they should take when the
1055  /// process is resumed. If no run control action is given to a thread it
1056  /// will be resumed by default.
1057  ///
1058  /// \return
1059  /// Returns \b true if the process successfully resumes using
1060  /// the thread run control actions, \b false otherwise.
1061  ///
1062  /// \see Thread:Resume()
1063  /// \see Thread:Step()
1064  /// \see Thread:Suspend()
1065  virtual Status DoResume() {
1066  Status error;
1067  error.SetErrorStringWithFormat(
1068  "error: %s does not support resuming processes",
1069  GetPluginName().GetCString());
1070  return error;
1071  }
1072 
1073  /// Called after resuming a process.
1074  ///
1075  /// Allow Process plug-ins to execute some code after resuming a process.
1076  virtual void DidResume() {}
1077 
1078  /// Called before halting to a process.
1079  ///
1080  /// Allow Process plug-ins to execute some code before halting a process.
1081  ///
1082  /// \return
1083  /// Returns an error object.
1084  virtual Status WillHalt() { return Status(); }
1085 
1086  /// Halts a running process.
1087  ///
1088  /// DoHalt must produce one and only one stop StateChanged event if it
1089  /// actually stops the process. If the stop happens through some natural
1090  /// event (for instance a SIGSTOP), then forwarding that event will do.
1091  /// Otherwise, you must generate the event manually. This function is called
1092  /// from the context of the private state thread.
1093  ///
1094  /// \param[out] caused_stop
1095  /// If true, then this Halt caused the stop, otherwise, the
1096  /// process was already stopped.
1097  ///
1098  /// \return
1099  /// Returns \b true if the process successfully halts, \b false
1100  /// otherwise.
1101  virtual Status DoHalt(bool &caused_stop) {
1102  Status error;
1103  error.SetErrorStringWithFormat(
1104  "error: %s does not support halting processes",
1105  GetPluginName().GetCString());
1106  return error;
1107  }
1108 
1109  /// Called after halting a process.
1110  ///
1111  /// Allow Process plug-ins to execute some code after halting a process.
1112  virtual void DidHalt() {}
1113 
1114  /// Called before detaching from a process.
1115  ///
1116  /// Allow Process plug-ins to execute some code before detaching from a
1117  /// process.
1118  ///
1119  /// \return
1120  /// Returns an error object.
1121  virtual Status WillDetach() { return Status(); }
1122 
1123  /// Detaches from a running or stopped process.
1124  ///
1125  /// \return
1126  /// Returns \b true if the process successfully detaches, \b
1127  /// false otherwise.
1128  virtual Status DoDetach(bool keep_stopped) {
1129  Status error;
1130  error.SetErrorStringWithFormat(
1131  "error: %s does not support detaching from processes",
1132  GetPluginName().GetCString());
1133  return error;
1134  }
1135 
1136  /// Called after detaching from a process.
1137  ///
1138  /// Allow Process plug-ins to execute some code after detaching from a
1139  /// process.
1140  virtual void DidDetach() {}
1141 
1142  virtual bool DetachRequiresHalt() { return false; }
1143 
1144  /// Called before sending a signal to a process.
1145  ///
1146  /// Allow Process plug-ins to execute some code before sending a signal to a
1147  /// process.
1148  ///
1149  /// \return
1150  /// Returns no error if it is safe to proceed with a call to
1151  /// Process::DoSignal(int), otherwise an error describing what
1152  /// prevents the signal from being sent.
1153  virtual Status WillSignal() { return Status(); }
1154 
1155  /// Sends a process a UNIX signal \a signal.
1156  ///
1157  /// \return
1158  /// Returns an error object.
1159  virtual Status DoSignal(int signal) {
1160  Status error;
1161  error.SetErrorStringWithFormat(
1162  "error: %s does not support sending signals to processes",
1163  GetPluginName().GetCString());
1164  return error;
1165  }
1166 
1167  virtual Status WillDestroy() { return Status(); }
1168 
1169  virtual Status DoDestroy() = 0;
1170 
1171  virtual void DidDestroy() {}
1172 
1173  virtual bool DestroyRequiresHalt() { return true; }
1174 
1175  /// Called after sending a signal to a process.
1176  ///
1177  /// Allow Process plug-ins to execute some code after sending a signal to a
1178  /// process.
1179  virtual void DidSignal() {}
1180 
1181  /// Currently called as part of ShouldStop.
1182  /// FIXME: Should really happen when the target stops before the
1183  /// event is taken from the queue...
1184  ///
1185  /// This callback is called as the event
1186  /// is about to be queued up to allow Process plug-ins to execute some code
1187  /// prior to clients being notified that a process was stopped. Common
1188  /// operations include updating the thread list, invalidating any thread
1189  /// state (registers, stack, etc) prior to letting the notification go out.
1190  ///
1191  virtual void RefreshStateAfterStop() = 0;
1192 
1193  /// Sometimes the connection to a process can detect the host OS version
1194  /// that the process is running on. The current platform should be checked
1195  /// first in case the platform is connected, but clients can fall back onto
1196  /// this function if the platform fails to identify the host OS version. The
1197  /// platform should be checked first in case you are running a simulator
1198  /// platform that might itself be running natively, but have different
1199  /// heuristics for figuring out which OS is is emulating.
1200  ///
1201  /// \return
1202  /// Returns the version tuple of the host OS. In case of failure an empty
1203  /// VersionTuple is returner.
1204  virtual llvm::VersionTuple GetHostOSVersion() { return llvm::VersionTuple(); }
1205 
1206  /// \return the macCatalyst version of the host OS.
1207  virtual llvm::VersionTuple GetHostMacCatalystVersion() { return {}; }
1208 
1209  /// Get the target object pointer for this module.
1210  ///
1211  /// \return
1212  /// A Target object pointer to the target that owns this
1213  /// module.
1214  Target &GetTarget() { return *m_target_wp.lock(); }
1215 
1216  /// Get the const target object pointer for this module.
1217  ///
1218  /// \return
1219  /// A const Target object pointer to the target that owns this
1220  /// module.
1221  const Target &GetTarget() const { return *m_target_wp.lock(); }
1222 
1223  /// Flush all data in the process.
1224  ///
1225  /// Flush the memory caches, all threads, and any other cached data in the
1226  /// process.
1227  ///
1228  /// This function can be called after a world changing event like adding a
1229  /// new symbol file, or after the process makes a large context switch (from
1230  /// boot ROM to booted into an OS).
1231  void Flush();
1232 
1233  /// Get accessor for the current process state.
1234  ///
1235  /// \return
1236  /// The current state of the process.
1237  ///
1238  /// \see lldb::StateType
1240 
1242  RunThreadPlan(ExecutionContext &exe_ctx, lldb::ThreadPlanSP &thread_plan_sp,
1243  const EvaluateExpressionOptions &options,
1244  DiagnosticManager &diagnostic_manager);
1245 
1246  static const char *ExecutionResultAsCString(lldb::ExpressionResults result);
1247 
1248  void GetStatus(Stream &ostrm);
1249 
1250  size_t GetThreadStatus(Stream &ostrm, bool only_threads_with_stop_reason,
1251  uint32_t start_frame, uint32_t num_frames,
1252  uint32_t num_frames_with_source,
1253  bool stop_format);
1254 
1255  void SendAsyncInterrupt();
1256 
1257  // Notify this process class that modules got loaded.
1258  //
1259  // If subclasses override this method, they must call this version before
1260  // doing anything in the subclass version of the function.
1261  virtual void ModulesDidLoad(ModuleList &module_list);
1262 
1263  /// Retrieve the list of shared libraries that are loaded for this process
1264  /// This method is used on pre-macOS 10.12, pre-iOS 10, pre-tvOS 10, pre-
1265  /// watchOS 3 systems. The following two methods are for newer versions of
1266  /// those OSes.
1267  ///
1268  /// For certain platforms, the time it takes for the DynamicLoader plugin to
1269  /// read all of the shared libraries out of memory over a slow communication
1270  /// channel may be too long. In that instance, the gdb-remote stub may be
1271  /// able to retrieve the necessary information about the solibs out of
1272  /// memory and return a concise summary sufficient for the DynamicLoader
1273  /// plugin.
1274  ///
1275  /// \param [in] image_list_address
1276  /// The address where the table of shared libraries is stored in memory,
1277  /// if that is appropriate for this platform. Else this may be
1278  /// passed as LLDB_INVALID_ADDRESS.
1279  ///
1280  /// \param [in] image_count
1281  /// The number of shared libraries that are present in this process, if
1282  /// that is appropriate for this platofrm Else this may be passed as
1283  /// LLDB_INVALID_ADDRESS.
1284  ///
1285  /// \return
1286  /// A StructuredDataSP object which, if non-empty, will contain the
1287  /// information the DynamicLoader needs to get the initial scan of
1288  /// solibs resolved.
1291  lldb::addr_t image_count) {
1292  return StructuredData::ObjectSP();
1293  }
1294 
1295  // On macOS 10.12, tvOS 10, iOS 10, watchOS 3 and newer, debugserver can
1296  // return the full list of loaded shared libraries without needing any input.
1299  return StructuredData::ObjectSP();
1300  }
1301 
1302  // On macOS 10.12, tvOS 10, iOS 10, watchOS 3 and newer, debugserver can
1303  // return information about binaries given their load addresses.
1305  const std::vector<lldb::addr_t> &load_addresses) {
1306  return StructuredData::ObjectSP();
1307  }
1308 
1309  // Get information about the library shared cache, if that exists
1310  //
1311  // On macOS 10.12, tvOS 10, iOS 10, watchOS 3 and newer, debugserver can
1312  // return information about the library shared cache (a set of standard
1313  // libraries that are loaded at the same location for all processes on a
1314  // system) in use.
1316  return StructuredData::ObjectSP();
1317  }
1318 
1319  /// Print a user-visible warning about a module being built with
1320  /// optimization
1321  ///
1322  /// Prints a async warning message to the user one time per Module where a
1323  /// function is found that was compiled with optimization, per Process.
1324  ///
1325  /// \param [in] sc
1326  /// A SymbolContext with eSymbolContextFunction and eSymbolContextModule
1327  /// pre-computed.
1328  void PrintWarningOptimization(const SymbolContext &sc);
1329 
1330  /// Print a user-visible warning about a function written in a
1331  /// language that this version of LLDB doesn't support.
1332  ///
1333  /// \see PrintWarningOptimization
1335 
1336  virtual bool GetProcessInfo(ProcessInstanceInfo &info);
1337 
1338  /// Get the exit status for a process.
1339  ///
1340  /// \return
1341  /// The process's return code, or -1 if the current process
1342  /// state is not eStateExited.
1343  int GetExitStatus();
1344 
1345  /// Get a textual description of what the process exited.
1346  ///
1347  /// \return
1348  /// The textual description of why the process exited, or nullptr
1349  /// if there is no description available.
1350  const char *GetExitDescription();
1351 
1352  virtual void DidExit() {}
1353 
1356 
1357  void SetCodeAddressMask(lldb::addr_t code_address_mask) {
1358  m_code_address_mask = code_address_mask;
1359  }
1360 
1361  void SetDataAddressMask(lldb::addr_t data_address_mask) {
1362  m_data_address_mask = data_address_mask;
1363  }
1364 
1365  /// Get the Modification ID of the process.
1366  ///
1367  /// \return
1368  /// The modification ID of the process.
1369  ProcessModID GetModID() const { return m_mod_id; }
1370 
1371  const ProcessModID &GetModIDRef() const { return m_mod_id; }
1372 
1373  uint32_t GetStopID() const { return m_mod_id.GetStopID(); }
1374 
1376 
1379  }
1380 
1382  return m_mod_id.GetLastNaturalStopID();
1383  }
1384 
1385  lldb::EventSP GetStopEventForStopID(uint32_t stop_id) const {
1386  return m_mod_id.GetStopEventForStopID(stop_id);
1387  }
1388 
1389  /// Set accessor for the process exit status (return code).
1390  ///
1391  /// Sometimes a child exits and the exit can be detected by global functions
1392  /// (signal handler for SIGCHLD for example). This accessor allows the exit
1393  /// status to be set from an external source.
1394  ///
1395  /// Setting this will cause a eStateExited event to be posted to the process
1396  /// event queue.
1397  ///
1398  /// \param[in] exit_status
1399  /// The value for the process's return code.
1400  ///
1401  /// \see lldb::StateType
1402  virtual bool SetExitStatus(int exit_status, const char *cstr);
1403 
1404  /// Check if a process is still alive.
1405  ///
1406  /// \return
1407  /// Returns \b true if the process is still valid, \b false
1408  /// otherwise.
1409  virtual bool IsAlive();
1410 
1411  virtual bool IsLiveDebugSession() const { return true; };
1412 
1413  /// Before lldb detaches from a process, it warns the user that they are
1414  /// about to lose their debug session. In some cases, this warning doesn't
1415  /// need to be emitted -- for instance, with core file debugging where the
1416  /// user can reconstruct the "state" by simply re-running the debugger on
1417  /// the core file.
1418  ///
1419  /// \return
1420  /// Returns \b true if the user should be warned about detaching from
1421  /// this process.
1422  virtual bool WarnBeforeDetach() const { return true; }
1423 
1424  /// Read of memory from a process.
1425  ///
1426  /// This function will read memory from the current process's address space
1427  /// and remove any traps that may have been inserted into the memory.
1428  ///
1429  /// This function is not meant to be overridden by Process subclasses, the
1430  /// subclasses should implement Process::DoReadMemory (lldb::addr_t, size_t,
1431  /// void *).
1432  ///
1433  /// \param[in] vm_addr
1434  /// A virtual load address that indicates where to start reading
1435  /// memory from.
1436  ///
1437  /// \param[out] buf
1438  /// A byte buffer that is at least \a size bytes long that
1439  /// will receive the memory bytes.
1440  ///
1441  /// \param[in] size
1442  /// The number of bytes to read.
1443  ///
1444  /// \param[out] error
1445  /// An error that indicates the success or failure of this
1446  /// operation. If error indicates success (error.Success()),
1447  /// then the value returned can be trusted, otherwise zero
1448  /// will be returned.
1449  ///
1450  /// \return
1451  /// The number of bytes that were actually read into \a buf. If
1452  /// the returned number is greater than zero, yet less than \a
1453  /// size, then this function will get called again with \a
1454  /// vm_addr, \a buf, and \a size updated appropriately. Zero is
1455  /// returned in the case of an error.
1456  virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size,
1457  Status &error);
1458 
1459  /// Read of memory from a process.
1460  ///
1461  /// This function has the same semantics of ReadMemory except that it
1462  /// bypasses caching.
1463  ///
1464  /// \param[in] vm_addr
1465  /// A virtual load address that indicates where to start reading
1466  /// memory from.
1467  ///
1468  /// \param[out] buf
1469  /// A byte buffer that is at least \a size bytes long that
1470  /// will receive the memory bytes.
1471  ///
1472  /// \param[in] size
1473  /// The number of bytes to read.
1474  ///
1475  /// \param[out] error
1476  /// An error that indicates the success or failure of this
1477  /// operation. If error indicates success (error.Success()),
1478  /// then the value returned can be trusted, otherwise zero
1479  /// will be returned.
1480  ///
1481  /// \return
1482  /// The number of bytes that were actually read into \a buf. If
1483  /// the returned number is greater than zero, yet less than \a
1484  /// size, then this function will get called again with \a
1485  /// vm_addr, \a buf, and \a size updated appropriately. Zero is
1486  /// returned in the case of an error.
1487  size_t ReadMemoryFromInferior(lldb::addr_t vm_addr, void *buf, size_t size,
1488  Status &error);
1489 
1490  /// Read a NULL terminated string from memory
1491  ///
1492  /// This function will read a cache page at a time until a NULL string
1493  /// terminator is found. It will stop reading if an aligned sequence of NULL
1494  /// termination \a type_width bytes is not found before reading \a
1495  /// cstr_max_len bytes. The results are always guaranteed to be NULL
1496  /// terminated, and that no more than (max_bytes - type_width) bytes will be
1497  /// read.
1498  ///
1499  /// \param[in] vm_addr
1500  /// The virtual load address to start the memory read.
1501  ///
1502  /// \param[in] str
1503  /// A character buffer containing at least max_bytes.
1504  ///
1505  /// \param[in] max_bytes
1506  /// The maximum number of bytes to read.
1507  ///
1508  /// \param[in] error
1509  /// The error status of the read operation.
1510  ///
1511  /// \param[in] type_width
1512  /// The size of the null terminator (1 to 4 bytes per
1513  /// character). Defaults to 1.
1514  ///
1515  /// \return
1516  /// The error status or the number of bytes prior to the null terminator.
1517  size_t ReadStringFromMemory(lldb::addr_t vm_addr, char *str, size_t max_bytes,
1518  Status &error, size_t type_width = 1);
1519 
1520  /// Read a NULL terminated C string from memory
1521  ///
1522  /// This function will read a cache page at a time until the NULL
1523  /// C string terminator is found. It will stop reading if the NULL
1524  /// termination byte isn't found before reading \a cstr_max_len bytes, and
1525  /// the results are always guaranteed to be NULL terminated (at most
1526  /// cstr_max_len - 1 bytes will be read).
1527  size_t ReadCStringFromMemory(lldb::addr_t vm_addr, char *cstr,
1528  size_t cstr_max_len, Status &error);
1529 
1530  size_t ReadCStringFromMemory(lldb::addr_t vm_addr, std::string &out_str,
1531  Status &error);
1532 
1533  /// Reads an unsigned integer of the specified byte size from process
1534  /// memory.
1535  ///
1536  /// \param[in] load_addr
1537  /// A load address of the integer to read.
1538  ///
1539  /// \param[in] byte_size
1540  /// The size in byte of the integer to read.
1541  ///
1542  /// \param[in] fail_value
1543  /// The value to return if we fail to read an integer.
1544  ///
1545  /// \param[out] error
1546  /// An error that indicates the success or failure of this
1547  /// operation. If error indicates success (error.Success()),
1548  /// then the value returned can be trusted, otherwise zero
1549  /// will be returned.
1550  ///
1551  /// \return
1552  /// The unsigned integer that was read from the process memory
1553  /// space. If the integer was smaller than a uint64_t, any
1554  /// unused upper bytes will be zero filled. If the process
1555  /// byte order differs from the host byte order, the integer
1556  /// value will be appropriately byte swapped into host byte
1557  /// order.
1558  uint64_t ReadUnsignedIntegerFromMemory(lldb::addr_t load_addr,
1559  size_t byte_size, uint64_t fail_value,
1560  Status &error);
1561 
1562  int64_t ReadSignedIntegerFromMemory(lldb::addr_t load_addr, size_t byte_size,
1563  int64_t fail_value, Status &error);
1564 
1566 
1567  bool WritePointerToMemory(lldb::addr_t vm_addr, lldb::addr_t ptr_value,
1568  Status &error);
1569 
1570  /// Actually do the writing of memory to a process.
1571  ///
1572  /// \param[in] vm_addr
1573  /// A virtual load address that indicates where to start writing
1574  /// memory to.
1575  ///
1576  /// \param[in] buf
1577  /// A byte buffer that is at least \a size bytes long that
1578  /// contains the data to write.
1579  ///
1580  /// \param[in] size
1581  /// The number of bytes to write.
1582  ///
1583  /// \param[out] error
1584  /// An error value in case the memory write fails.
1585  ///
1586  /// \return
1587  /// The number of bytes that were actually written.
1588  virtual size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf,
1589  size_t size, Status &error) {
1590  error.SetErrorStringWithFormat(
1591  "error: %s does not support writing to processes",
1592  GetPluginName().GetCString());
1593  return 0;
1594  }
1595 
1596  /// Write all or part of a scalar value to memory.
1597  ///
1598  /// The value contained in \a scalar will be swapped to match the byte order
1599  /// of the process that is being debugged. If \a size is less than the size
1600  /// of scalar, the least significant \a size bytes from scalar will be
1601  /// written. If \a size is larger than the byte size of scalar, then the
1602  /// extra space will be padded with zeros and the scalar value will be
1603  /// placed in the least significant bytes in memory.
1604  ///
1605  /// \param[in] vm_addr
1606  /// A virtual load address that indicates where to start writing
1607  /// memory to.
1608  ///
1609  /// \param[in] scalar
1610  /// The scalar to write to the debugged process.
1611  ///
1612  /// \param[in] size
1613  /// This value can be smaller or larger than the scalar value
1614  /// itself. If \a size is smaller than the size of \a scalar,
1615  /// the least significant bytes in \a scalar will be used. If
1616  /// \a size is larger than the byte size of \a scalar, then
1617  /// the extra space will be padded with zeros. If \a size is
1618  /// set to UINT32_MAX, then the size of \a scalar will be used.
1619  ///
1620  /// \param[out] error
1621  /// An error value in case the memory write fails.
1622  ///
1623  /// \return
1624  /// The number of bytes that were actually written.
1625  size_t WriteScalarToMemory(lldb::addr_t vm_addr, const Scalar &scalar,
1626  size_t size, Status &error);
1627 
1628  size_t ReadScalarIntegerFromMemory(lldb::addr_t addr, uint32_t byte_size,
1629  bool is_signed, Scalar &scalar,
1630  Status &error);
1631 
1632  /// Write memory to a process.
1633  ///
1634  /// This function will write memory to the current process's address space
1635  /// and maintain any traps that might be present due to software
1636  /// breakpoints.
1637  ///
1638  /// This function is not meant to be overridden by Process subclasses, the
1639  /// subclasses should implement Process::DoWriteMemory (lldb::addr_t,
1640  /// size_t, void *).
1641  ///
1642  /// \param[in] vm_addr
1643  /// A virtual load address that indicates where to start writing
1644  /// memory to.
1645  ///
1646  /// \param[in] buf
1647  /// A byte buffer that is at least \a size bytes long that
1648  /// contains the data to write.
1649  ///
1650  /// \param[in] size
1651  /// The number of bytes to write.
1652  ///
1653  /// \return
1654  /// The number of bytes that were actually written.
1655  // TODO: change this to take an ArrayRef<uint8_t>
1656  size_t WriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size,
1657  Status &error);
1658 
1659  /// Actually allocate memory in the process.
1660  ///
1661  /// This function will allocate memory in the process's address space. This
1662  /// can't rely on the generic function calling mechanism, since that
1663  /// requires this function.
1664  ///
1665  /// \param[in] size
1666  /// The size of the allocation requested.
1667  ///
1668  /// \return
1669  /// The address of the allocated buffer in the process, or
1670  /// LLDB_INVALID_ADDRESS if the allocation failed.
1671 
1672  virtual lldb::addr_t DoAllocateMemory(size_t size, uint32_t permissions,
1673  Status &error) {
1674  error.SetErrorStringWithFormat(
1675  "error: %s does not support allocating in the debug process",
1676  GetPluginName().GetCString());
1677  return LLDB_INVALID_ADDRESS;
1678  }
1679 
1680  virtual Status WriteObjectFile(std::vector<ObjectFile::LoadableData> entries);
1681 
1682  /// The public interface to allocating memory in the process.
1683  ///
1684  /// This function will allocate memory in the process's address space. This
1685  /// can't rely on the generic function calling mechanism, since that
1686  /// requires this function.
1687  ///
1688  /// \param[in] size
1689  /// The size of the allocation requested.
1690  ///
1691  /// \param[in] permissions
1692  /// Or together any of the lldb::Permissions bits. The permissions on
1693  /// a given memory allocation can't be changed after allocation. Note
1694  /// that a block that isn't set writable can still be written on from
1695  /// lldb,
1696  /// just not by the process itself.
1697  ///
1698  /// \param[in,out] error
1699  /// An error object to fill in if things go wrong.
1700  /// \return
1701  /// The address of the allocated buffer in the process, or
1702  /// LLDB_INVALID_ADDRESS if the allocation failed.
1703  lldb::addr_t AllocateMemory(size_t size, uint32_t permissions, Status &error);
1704 
1705  /// The public interface to allocating memory in the process, this also
1706  /// clears the allocated memory.
1707  ///
1708  /// This function will allocate memory in the process's address space. This
1709  /// can't rely on the generic function calling mechanism, since that
1710  /// requires this function.
1711  ///
1712  /// \param[in] size
1713  /// The size of the allocation requested.
1714  ///
1715  /// \param[in] permissions
1716  /// Or together any of the lldb::Permissions bits. The permissions on
1717  /// a given memory allocation can't be changed after allocation. Note
1718  /// that a block that isn't set writable can still be written on from
1719  /// lldb,
1720  /// just not by the process itself.
1721  ///
1722  /// \param[in,out] error
1723  /// An error object to fill in if things go wrong.
1724  ///
1725  /// \return
1726  /// The address of the allocated buffer in the process, or
1727  /// LLDB_INVALID_ADDRESS if the allocation failed.
1728 
1729  lldb::addr_t CallocateMemory(size_t size, uint32_t permissions,
1730  Status &error);
1731 
1732  /// If this architecture and process supports memory tagging, return a tag
1733  /// manager that can be used to maniupulate those memory tags.
1734  ///
1735  /// \return
1736  /// Either a valid pointer to a tag manager or an error describing why one
1737  /// could not be provided.
1738  llvm::Expected<const MemoryTagManager *> GetMemoryTagManager();
1739 
1740  /// Read memory tags for the range addr to addr+len. It is assumed
1741  /// that this range has already been granule aligned.
1742  /// (see MemoryTagManager::MakeTaggedRange)
1743  ///
1744  /// This calls DoReadMemoryTags to do the target specific operations.
1745  ///
1746  /// \param[in] addr
1747  /// Start of memory range to read tags for.
1748  ///
1749  /// \param[in] len
1750  /// Length of memory range to read tags for (in bytes).
1751  ///
1752  /// \return
1753  /// If this architecture or process does not support memory tagging,
1754  /// an error saying so.
1755  /// If it does, either the memory tags or an error describing a
1756  /// failure to read or unpack them.
1757  llvm::Expected<std::vector<lldb::addr_t>> ReadMemoryTags(lldb::addr_t addr,
1758  size_t len);
1759 
1760  /// Write memory tags for a range of memory.
1761  /// (calls DoWriteMemoryTags to do the target specific work)
1762  ///
1763  /// \param[in] addr
1764  /// The address to start writing tags from. It is assumed that this
1765  /// address is granule aligned.
1766  ///
1767  /// \param[in] len
1768  /// The size of the range to write tags for. It is assumed that this
1769  /// is some multiple of the granule size. This len can be different
1770  /// from (number of tags * granule size) in the case where you want
1771  /// lldb-server to repeat tags across the range.
1772  ///
1773  /// \param[in] tags
1774  /// Allocation tags to be written. Since lldb-server can repeat tags for a
1775  /// range, the number of tags doesn't have to match the number of granules
1776  /// in the range. (though most of the time it will)
1777  ///
1778  /// \return
1779  /// A Status telling you if the write succeeded or not.
1780  Status WriteMemoryTags(lldb::addr_t addr, size_t len,
1781  const std::vector<lldb::addr_t> &tags);
1782 
1783  /// Resolve dynamically loaded indirect functions.
1784  ///
1785  /// \param[in] address
1786  /// The load address of the indirect function to resolve.
1787  ///
1788  /// \param[out] error
1789  /// An error value in case the resolve fails.
1790  ///
1791  /// \return
1792  /// The address of the resolved function.
1793  /// LLDB_INVALID_ADDRESS if the resolution failed.
1794  virtual lldb::addr_t ResolveIndirectFunction(const Address *address,
1795  Status &error);
1796 
1797  /// Locate the memory region that contains load_addr.
1798  ///
1799  /// If load_addr is within the address space the process has mapped
1800  /// range_info will be filled in with the start and end of that range as
1801  /// well as the permissions for that range and range_info.GetMapped will
1802  /// return true.
1803  ///
1804  /// If load_addr is outside any mapped region then range_info will have its
1805  /// start address set to load_addr and the end of the range will indicate
1806  /// the start of the next mapped range or be set to LLDB_INVALID_ADDRESS if
1807  /// there are no valid mapped ranges between load_addr and the end of the
1808  /// process address space.
1809  ///
1810  /// GetMemoryRegionInfo will only return an error if it is unimplemented for
1811  /// the current process.
1812  ///
1813  /// \param[in] load_addr
1814  /// The load address to query the range_info for.
1815  ///
1816  /// \param[out] range_info
1817  /// An range_info value containing the details of the range.
1818  ///
1819  /// \return
1820  /// An error value.
1822  MemoryRegionInfo &range_info) {
1823  Status error;
1824  error.SetErrorString("Process::GetMemoryRegionInfo() not supported");
1825  return error;
1826  }
1827 
1828  /// Obtain all the mapped memory regions within this process.
1829  ///
1830  /// \param[out] region_list
1831  /// A vector to contain MemoryRegionInfo objects for all mapped
1832  /// ranges.
1833  ///
1834  /// \return
1835  /// An error value.
1836  virtual Status
1838 
1840  Status error;
1841  num = 0;
1842  error.SetErrorString("Process::GetWatchpointSupportInfo() not supported");
1843  return error;
1844  }
1845 
1846  virtual Status GetWatchpointSupportInfo(uint32_t &num, bool &after) {
1847  Status error;
1848  num = 0;
1849  after = true;
1850  error.SetErrorString("Process::GetWatchpointSupportInfo() not supported");
1851  return error;
1852  }
1853 
1854  lldb::ModuleSP ReadModuleFromMemory(const FileSpec &file_spec,
1855  lldb::addr_t header_addr,
1856  size_t size_to_read = 512);
1857 
1858  /// Attempt to get the attributes for a region of memory in the process.
1859  ///
1860  /// It may be possible for the remote debug server to inspect attributes for
1861  /// a region of memory in the process, such as whether there is a valid page
1862  /// of memory at a given address or whether that page is
1863  /// readable/writable/executable by the process.
1864  ///
1865  /// \param[in] load_addr
1866  /// The address of interest in the process.
1867  ///
1868  /// \param[out] permissions
1869  /// If this call returns successfully, this bitmask will have
1870  /// its Permissions bits set to indicate whether the region is
1871  /// readable/writable/executable. If this call fails, the
1872  /// bitmask values are undefined.
1873  ///
1874  /// \return
1875  /// Returns true if it was able to determine the attributes of the
1876  /// memory region. False if not.
1877  virtual bool GetLoadAddressPermissions(lldb::addr_t load_addr,
1878  uint32_t &permissions);
1879 
1880  /// Determines whether executing JIT-compiled code in this process is
1881  /// possible.
1882  ///
1883  /// \return
1884  /// True if execution of JIT code is possible; false otherwise.
1885  bool CanJIT();
1886 
1887  /// Sets whether executing JIT-compiled code in this process is possible.
1888  ///
1889  /// \param[in] can_jit
1890  /// True if execution of JIT code is possible; false otherwise.
1891  void SetCanJIT(bool can_jit);
1892 
1893  /// Determines whether executing function calls using the interpreter is
1894  /// possible for this process.
1895  ///
1896  /// \return
1897  /// True if possible; false otherwise.
1899 
1900  /// Sets whether executing function calls using the interpreter is possible
1901  /// for this process.
1902  ///
1903  /// \param[in] can_interpret_function_calls
1904  /// True if possible; false otherwise.
1905  void SetCanInterpretFunctionCalls(bool can_interpret_function_calls) {
1906  m_can_interpret_function_calls = can_interpret_function_calls;
1907  }
1908 
1909  /// Sets whether executing code in this process is possible. This could be
1910  /// either through JIT or interpreting.
1911  ///
1912  /// \param[in] can_run_code
1913  /// True if execution of code is possible; false otherwise.
1914  void SetCanRunCode(bool can_run_code);
1915 
1916  /// Actually deallocate memory in the process.
1917  ///
1918  /// This function will deallocate memory in the process's address space that
1919  /// was allocated with AllocateMemory.
1920  ///
1921  /// \param[in] ptr
1922  /// A return value from AllocateMemory, pointing to the memory you
1923  /// want to deallocate.
1924  ///
1925  /// \return
1926  /// \btrue if the memory was deallocated, \bfalse otherwise.
1928  Status error;
1929  error.SetErrorStringWithFormat(
1930  "error: %s does not support deallocating in the debug process",
1931  GetPluginName().GetCString());
1932  return error;
1933  }
1934 
1935  /// The public interface to deallocating memory in the process.
1936  ///
1937  /// This function will deallocate memory in the process's address space that
1938  /// was allocated with AllocateMemory.
1939  ///
1940  /// \param[in] ptr
1941  /// A return value from AllocateMemory, pointing to the memory you
1942  /// want to deallocate.
1943  ///
1944  /// \return
1945  /// \btrue if the memory was deallocated, \bfalse otherwise.
1947 
1948  /// Get any available STDOUT.
1949  ///
1950  /// Calling this method is a valid operation only if all of the following
1951  /// conditions are true: 1) The process was launched, and not attached to.
1952  /// 2) The process was not launched with eLaunchFlagDisableSTDIO. 3) The
1953  /// process was launched without supplying a valid file path
1954  /// for STDOUT.
1955  ///
1956  /// Note that the implementation will probably need to start a read thread
1957  /// in the background to make sure that the pipe is drained and the STDOUT
1958  /// buffered appropriately, to prevent the process from deadlocking trying
1959  /// to write to a full buffer.
1960  ///
1961  /// Events will be queued indicating that there is STDOUT available that can
1962  /// be retrieved using this function.
1963  ///
1964  /// \param[out] buf
1965  /// A buffer that will receive any STDOUT bytes that are
1966  /// currently available.
1967  ///
1968  /// \param[in] buf_size
1969  /// The size in bytes for the buffer \a buf.
1970  ///
1971  /// \return
1972  /// The number of bytes written into \a buf. If this value is
1973  /// equal to \a buf_size, another call to this function should
1974  /// be made to retrieve more STDOUT data.
1975  virtual size_t GetSTDOUT(char *buf, size_t buf_size, Status &error);
1976 
1977  /// Get any available STDERR.
1978  ///
1979  /// Calling this method is a valid operation only if all of the following
1980  /// conditions are true: 1) The process was launched, and not attached to.
1981  /// 2) The process was not launched with eLaunchFlagDisableSTDIO. 3) The
1982  /// process was launched without supplying a valid file path
1983  /// for STDERR.
1984  ///
1985  /// Note that the implementation will probably need to start a read thread
1986  /// in the background to make sure that the pipe is drained and the STDERR
1987  /// buffered appropriately, to prevent the process from deadlocking trying
1988  /// to write to a full buffer.
1989  ///
1990  /// Events will be queued indicating that there is STDERR available that can
1991  /// be retrieved using this function.
1992  ///
1993  /// \param[in] buf
1994  /// A buffer that will receive any STDERR bytes that are
1995  /// currently available.
1996  ///
1997  /// \param[out] buf_size
1998  /// The size in bytes for the buffer \a buf.
1999  ///
2000  /// \return
2001  /// The number of bytes written into \a buf. If this value is
2002  /// equal to \a buf_size, another call to this function should
2003  /// be made to retrieve more STDERR data.
2004  virtual size_t GetSTDERR(char *buf, size_t buf_size, Status &error);
2005 
2006  /// Puts data into this process's STDIN.
2007  ///
2008  /// Calling this method is a valid operation only if all of the following
2009  /// conditions are true: 1) The process was launched, and not attached to.
2010  /// 2) The process was not launched with eLaunchFlagDisableSTDIO. 3) The
2011  /// process was launched without supplying a valid file path
2012  /// for STDIN.
2013  ///
2014  /// \param[in] buf
2015  /// A buffer that contains the data to write to the process's STDIN.
2016  ///
2017  /// \param[in] buf_size
2018  /// The size in bytes for the buffer \a buf.
2019  ///
2020  /// \return
2021  /// The number of bytes written into \a buf. If this value is
2022  /// less than \a buf_size, another call to this function should
2023  /// be made to write the rest of the data.
2024  virtual size_t PutSTDIN(const char *buf, size_t buf_size, Status &error) {
2025  error.SetErrorString("stdin unsupported");
2026  return 0;
2027  }
2028 
2029  /// Get any available profile data.
2030  ///
2031  /// \param[out] buf
2032  /// A buffer that will receive any profile data bytes that are
2033  /// currently available.
2034  ///
2035  /// \param[out] buf_size
2036  /// The size in bytes for the buffer \a buf.
2037  ///
2038  /// \return
2039  /// The number of bytes written into \a buf. If this value is
2040  /// equal to \a buf_size, another call to this function should
2041  /// be made to retrieve more profile data.
2042  virtual size_t GetAsyncProfileData(char *buf, size_t buf_size, Status &error);
2043 
2044  // Process Breakpoints
2046 
2048  Status error;
2049  error.SetErrorStringWithFormat(
2050  "error: %s does not support enabling breakpoints",
2051  GetPluginName().GetCString());
2052  return error;
2053  }
2054 
2056  Status error;
2057  error.SetErrorStringWithFormat(
2058  "error: %s does not support disabling breakpoints",
2059  GetPluginName().GetCString());
2060  return error;
2061  }
2062 
2063  // This is implemented completely using the lldb::Process API. Subclasses
2064  // don't need to implement this function unless the standard flow of read
2065  // existing opcode, write breakpoint opcode, verify breakpoint opcode doesn't
2066  // work for a specific process plug-in.
2068 
2069  // This is implemented completely using the lldb::Process API. Subclasses
2070  // don't need to implement this function unless the standard flow of
2071  // restoring original opcode in memory and verifying the restored opcode
2072  // doesn't work for a specific process plug-in.
2074 
2076 
2078 
2080 
2082 
2083  lldb::break_id_t CreateBreakpointSite(const lldb::BreakpointLocationSP &owner,
2084  bool use_hardware);
2085 
2087 
2089 
2090  // BreakpointLocations use RemoveOwnerFromBreakpointSite to remove themselves
2091  // from the owner's list of this breakpoint sites.
2093  lldb::user_id_t owner_loc_id,
2094  lldb::BreakpointSiteSP &bp_site_sp);
2095 
2096  // Process Watchpoints (optional)
2097  virtual Status EnableWatchpoint(Watchpoint *wp, bool notify = true);
2098 
2099  virtual Status DisableWatchpoint(Watchpoint *wp, bool notify = true);
2100 
2101  // Thread Queries
2102 
2103  /// Update the thread list.
2104  ///
2105  /// This method performs some general clean up before invoking
2106  /// \a DoUpdateThreadList, which should be implemented by each
2107  /// process plugin.
2108  ///
2109  /// \return
2110  /// \b true if the new thread list could be generated, \b false otherwise.
2111  bool UpdateThreadList(ThreadList &old_thread_list,
2112  ThreadList &new_thread_list);
2113 
2114  void UpdateThreadListIfNeeded();
2115 
2117 
2118  // When ExtendedBacktraces are requested, the HistoryThreads that are created
2119  // need an owner -- they're saved here in the Process. The threads in this
2120  // list are not iterated over - driver programs need to request the extended
2121  // backtrace calls starting from a root concrete thread one by one.
2123 
2125 
2126  uint32_t GetNextThreadIndexID(uint64_t thread_id);
2127 
2128  lldb::ThreadSP CreateOSPluginThread(lldb::tid_t tid, lldb::addr_t context);
2129 
2130  // Returns true if an index id has been assigned to a thread.
2131  bool HasAssignedIndexIDToThread(uint64_t sb_thread_id);
2132 
2133  // Given a thread_id, it will assign a more reasonable index id for display
2134  // to the user. If the thread_id has previously been assigned, the same index
2135  // id will be used.
2136  uint32_t AssignIndexIDToThread(uint64_t thread_id);
2137 
2138  // Queue Queries
2139 
2140  void UpdateQueueListIfNeeded();
2141 
2144  return m_queue_list;
2145  }
2146 
2149  return m_queue_list.Queues();
2150  }
2151 
2152  // Event Handling
2153  lldb::StateType GetNextEvent(lldb::EventSP &event_sp);
2154 
2155  // Returns the process state when it is stopped. If specified, event_sp_ptr
2156  // is set to the event which triggered the stop. If wait_always = false, and
2157  // the process is already stopped, this function returns immediately. If the
2158  // process is hijacked and use_run_lock is true (the default), then this
2159  // function releases the run lock after the stop. Setting use_run_lock to
2160  // false will avoid this behavior.
2163  lldb::EventSP *event_sp_ptr = nullptr,
2164  bool wait_always = true,
2165  lldb::ListenerSP hijack_listener = lldb::ListenerSP(),
2166  Stream *stream = nullptr, bool use_run_lock = true);
2167 
2169 
2170  /// Waits for the process state to be running within a given msec timeout.
2171  ///
2172  /// The main purpose of this is to implement an interlock waiting for
2173  /// HandlePrivateEvent to push an IOHandler.
2174  ///
2175  /// \param[in] timeout
2176  /// The maximum time length to wait for the process to transition to the
2177  /// eStateRunning state.
2178  void SyncIOHandler(uint32_t iohandler_id, const Timeout<std::micro> &timeout);
2179 
2181  lldb::EventSP &event_sp, const Timeout<std::micro> &timeout,
2182  lldb::ListenerSP
2183  hijack_listener); // Pass an empty ListenerSP to use builtin listener
2184 
2185  /// Centralize the code that handles and prints descriptions for process
2186  /// state changes.
2187  ///
2188  /// \param[in] event_sp
2189  /// The process state changed event
2190  ///
2191  /// \param[in] stream
2192  /// The output stream to get the state change description
2193  ///
2194  /// \param[in,out] pop_process_io_handler
2195  /// If this value comes in set to \b true, then pop the Process IOHandler
2196  /// if needed.
2197  /// Else this variable will be set to \b true or \b false to indicate if
2198  /// the process
2199  /// needs to have its process IOHandler popped.
2200  ///
2201  /// \return
2202  /// \b true if the event describes a process state changed event, \b false
2203  /// otherwise.
2204  static bool HandleProcessStateChangedEvent(const lldb::EventSP &event_sp,
2205  Stream *stream,
2206  bool &pop_process_io_handler);
2207 
2209 
2211  public:
2212  ProcessEventHijacker(Process &process, lldb::ListenerSP listener_sp)
2213  : m_process(process) {
2214  m_process.HijackProcessEvents(std::move(listener_sp));
2215  }
2216 
2218 
2219  private:
2221  };
2222 
2223  friend class ProcessEventHijacker;
2224  friend class ProcessProperties;
2225  /// If you need to ensure that you and only you will hear about some public
2226  /// event, then make a new listener, set to listen to process events, and
2227  /// then call this with that listener. Then you will have to wait on that
2228  /// listener explicitly for events (rather than using the GetNextEvent &
2229  /// WaitFor* calls above. Be sure to call RestoreProcessEvents when you are
2230  /// done.
2231  ///
2232  /// \param[in] listener_sp
2233  /// This is the new listener to whom all process events will be delivered.
2234  ///
2235  /// \return
2236  /// Returns \b true if the new listener could be installed,
2237  /// \b false otherwise.
2238  bool HijackProcessEvents(lldb::ListenerSP listener_sp);
2239 
2240  /// Restores the process event broadcasting to its normal state.
2241  ///
2242  void RestoreProcessEvents();
2243 
2245 
2247 
2248  const lldb::ABISP &GetABI();
2249 
2251 
2252  std::vector<LanguageRuntime *> GetLanguageRuntimes();
2253 
2255 
2256  bool IsPossibleDynamicValue(ValueObject &in_value);
2257 
2258  bool IsRunning() const;
2259 
2261  return m_dynamic_checkers_up.get();
2262  }
2263 
2264  void SetDynamicCheckers(DynamicCheckerFunctions *dynamic_checkers);
2265 
2266 /// Prune ThreadPlanStacks for unreported threads.
2267 ///
2268 /// \param[in] tid
2269 /// The tid whose Plan Stack we are seeking to prune.
2270 ///
2271 /// \return
2272 /// \b true if the TID is found or \b false if not.
2274 
2275 /// Prune ThreadPlanStacks for all unreported threads.
2276 void PruneThreadPlans();
2277 
2278  /// Find the thread plan stack associated with thread with \a tid.
2279  ///
2280  /// \param[in] tid
2281  /// The tid whose Plan Stack we are seeking.
2282  ///
2283  /// \return
2284  /// Returns a ThreadPlan if the TID is found or nullptr if not.
2286 
2287  /// Dump the thread plans associated with thread with \a tid.
2288  ///
2289  /// \param[in,out] strm
2290  /// The stream to which to dump the output
2291  ///
2292  /// \param[in] tid
2293  /// The tid whose Plan Stack we are dumping
2294  ///
2295  /// \param[in] desc_level
2296  /// How much detail to dump
2297  ///
2298  /// \param[in] internal
2299  /// If \b true dump all plans, if false only user initiated plans
2300  ///
2301  /// \param[in] condense_trivial
2302  /// If true, only dump a header if the plan stack is just the base plan.
2303  ///
2304  /// \param[in] skip_unreported_plans
2305  /// If true, only dump a plan if it is currently backed by an
2306  /// lldb_private::Thread *.
2307  ///
2308  /// \return
2309  /// Returns \b true if TID was found, \b false otherwise
2310  bool DumpThreadPlansForTID(Stream &strm, lldb::tid_t tid,
2311  lldb::DescriptionLevel desc_level, bool internal,
2312  bool condense_trivial, bool skip_unreported_plans);
2313 
2314  /// Dump all the thread plans for this process.
2315  ///
2316  /// \param[in,out] strm
2317  /// The stream to which to dump the output
2318  ///
2319  /// \param[in] desc_level
2320  /// How much detail to dump
2321  ///
2322  /// \param[in] internal
2323  /// If \b true dump all plans, if false only user initiated plans
2324  ///
2325  /// \param[in] condense_trivial
2326  /// If true, only dump a header if the plan stack is just the base plan.
2327  ///
2328  /// \param[in] skip_unreported_plans
2329  /// If true, skip printing all thread plan stacks that don't currently
2330  /// have a backing lldb_private::Thread *.
2331  void DumpThreadPlans(Stream &strm, lldb::DescriptionLevel desc_level,
2332  bool internal, bool condense_trivial,
2333  bool skip_unreported_plans);
2334 
2335  /// Call this to set the lldb in the mode where it breaks on new thread
2336  /// creations, and then auto-restarts. This is useful when you are trying
2337  /// to run only one thread, but either that thread or the kernel is creating
2338  /// new threads in the process. If you stop when the thread is created, you
2339  /// can immediately suspend it, and keep executing only the one thread you
2340  /// intend.
2341  ///
2342  /// \return
2343  /// Returns \b true if we were able to start up the notification
2344  /// \b false otherwise.
2345  virtual bool StartNoticingNewThreads() { return true; }
2346 
2347  /// Call this to turn off the stop & notice new threads mode.
2348  ///
2349  /// \return
2350  /// Returns \b true if we were able to start up the notification
2351  /// \b false otherwise.
2352  virtual bool StopNoticingNewThreads() { return true; }
2353 
2354  void SetRunningUserExpression(bool on);
2355  void SetRunningUtilityFunction(bool on);
2356 
2357  // lldb::ExecutionContextScope pure virtual functions
2358  lldb::TargetSP CalculateTarget() override;
2359 
2360  lldb::ProcessSP CalculateProcess() override { return shared_from_this(); }
2361 
2362  lldb::ThreadSP CalculateThread() override { return lldb::ThreadSP(); }
2363 
2364  lldb::StackFrameSP CalculateStackFrame() override {
2365  return lldb::StackFrameSP();
2366  }
2367 
2368  void CalculateExecutionContext(ExecutionContext &exe_ctx) override;
2369 
2370  void SetSTDIOFileDescriptor(int file_descriptor);
2371 
2372  // Add a permanent region of memory that should never be read or written to.
2373  // This can be used to ensure that memory reads or writes to certain areas of
2374  // memory never end up being sent to the DoReadMemory or DoWriteMemory
2375  // functions which can improve performance.
2376  void AddInvalidMemoryRegion(const LoadRange &region);
2377 
2378  // Remove a permanent region of memory that should never be read or written
2379  // to that was previously added with AddInvalidMemoryRegion.
2380  bool RemoveInvalidMemoryRange(const LoadRange &region);
2381 
2382  // If the setup code of a thread plan needs to do work that might involve
2383  // calling a function in the target, it should not do that work directly in
2384  // one of the thread plan functions (DidPush/WillResume) because such work
2385  // needs to be handled carefully. Instead, put that work in a
2386  // PreResumeAction callback, and register it with the process. It will get
2387  // done before the actual "DoResume" gets called.
2388 
2389  typedef bool(PreResumeActionCallback)(void *);
2390 
2391  void AddPreResumeAction(PreResumeActionCallback callback, void *baton);
2392 
2393  bool RunPreResumeActions();
2394 
2395  void ClearPreResumeActions();
2396 
2397  void ClearPreResumeAction(PreResumeActionCallback callback, void *baton);
2398 
2400 
2402 
2403  virtual Status SendEventData(const char *data) {
2404  Status return_error("Sending an event is not supported for this process.");
2405  return return_error;
2406  }
2407 
2408  lldb::ThreadCollectionSP GetHistoryThreads(lldb::addr_t addr);
2409 
2410  lldb::InstrumentationRuntimeSP
2412 
2413  /// Try to fetch the module specification for a module with the given file
2414  /// name and architecture. Process sub-classes have to override this method
2415  /// if they support platforms where the Platform object can't get the module
2416  /// spec for all module.
2417  ///
2418  /// \param[in] module_file_spec
2419  /// The file name of the module to get specification for.
2420  ///
2421  /// \param[in] arch
2422  /// The architecture of the module to get specification for.
2423  ///
2424  /// \param[out] module_spec
2425  /// The fetched module specification if the return value is
2426  /// \b true, unchanged otherwise.
2427  ///
2428  /// \return
2429  /// Returns \b true if the module spec fetched successfully,
2430  /// \b false otherwise.
2431  virtual bool GetModuleSpec(const FileSpec &module_file_spec,
2432  const ArchSpec &arch, ModuleSpec &module_spec);
2433 
2434  virtual void PrefetchModuleSpecs(llvm::ArrayRef<FileSpec> module_file_specs,
2435  const llvm::Triple &triple) {}
2436 
2437  /// Try to find the load address of a file.
2438  /// The load address is defined as the address of the first memory region
2439  /// what contains data mapped from the specified file.
2440  ///
2441  /// \param[in] file
2442  /// The name of the file whose load address we are looking for
2443  ///
2444  /// \param[out] is_loaded
2445  /// \b True if the file is loaded into the memory and false
2446  /// otherwise.
2447  ///
2448  /// \param[out] load_addr
2449  /// The load address of the file if it is loaded into the
2450  /// processes address space, LLDB_INVALID_ADDRESS otherwise.
2451  virtual Status GetFileLoadAddress(const FileSpec &file, bool &is_loaded,
2452  lldb::addr_t &load_addr) {
2453  return Status("Not supported");
2454  }
2455 
2456  size_t AddImageToken(lldb::addr_t image_ptr);
2457 
2458  lldb::addr_t GetImagePtrFromToken(size_t token) const;
2459 
2460  void ResetImageToken(size_t token);
2461 
2462  /// Find the next branch instruction to set a breakpoint on
2463  ///
2464  /// When instruction stepping through a source line, instead of stepping
2465  /// through each instruction, we can put a breakpoint on the next branch
2466  /// instruction (within the range of instructions we are stepping through)
2467  /// and continue the process to there, yielding significant performance
2468  /// benefits over instruction stepping.
2469  ///
2470  /// \param[in] default_stop_addr
2471  /// The address of the instruction where lldb would put a
2472  /// breakpoint normally.
2473  ///
2474  /// \param[in] range_bounds
2475  /// The range which the breakpoint must be contained within.
2476  /// Typically a source line.
2477  ///
2478  /// \return
2479  /// The address of the next branch instruction, or the end of
2480  /// the range provided in range_bounds. If there are any
2481  /// problems with the disassembly or getting the instructions,
2482  /// the original default_stop_addr will be returned.
2484  AddressRange range_bounds);
2485 
2486  /// Configure asynchronous structured data feature.
2487  ///
2488  /// Each Process type that supports using an asynchronous StructuredData
2489  /// feature should implement this to enable/disable/configure the feature.
2490  /// The default implementation here will always return an error indiciating
2491  /// the feature is unsupported.
2492  ///
2493  /// StructuredDataPlugin implementations will call this to configure a
2494  /// feature that has been reported as being supported.
2495  ///
2496  /// \param[in] type_name
2497  /// The StructuredData type name as previously discovered by
2498  /// the Process-derived instance.
2499  ///
2500  /// \param[in] config_sp
2501  /// Configuration data for the feature being enabled. This config
2502  /// data, which may be null, will be passed along to the feature
2503  /// to process. The feature will dictate whether this is a dictionary,
2504  /// an array or some other object. If the feature needs to be
2505  /// set up properly before it can be enabled, then the config should
2506  /// also take an enable/disable flag.
2507  ///
2508  /// \return
2509  /// Returns the result of attempting to configure the feature.
2510  virtual Status
2512  const StructuredData::ObjectSP &config_sp);
2513 
2514  /// Broadcasts the given structured data object from the given plugin.
2515  ///
2516  /// StructuredDataPlugin instances can use this to optionally broadcast any
2517  /// of their data if they want to make it available for clients. The data
2518  /// will come in on the structured data event bit
2519  /// (eBroadcastBitStructuredData).
2520  ///
2521  /// \param[in] object_sp
2522  /// The structured data object to broadcast.
2523  ///
2524  /// \param[in] plugin_sp
2525  /// The plugin that will be reported in the event's plugin
2526  /// parameter.
2527  void BroadcastStructuredData(const StructuredData::ObjectSP &object_sp,
2528  const lldb::StructuredDataPluginSP &plugin_sp);
2529 
2530  /// Returns the StructuredDataPlugin associated with a given type name, if
2531  /// there is one.
2532  ///
2533  /// There will only be a plugin for a given StructuredDataType if the
2534  /// debugged process monitor claims that the feature is supported. This is
2535  /// one way to tell whether a feature is available.
2536  ///
2537  /// \return
2538  /// The plugin if one is available for the specified feature;
2539  /// otherwise, returns an empty shared pointer.
2540  lldb::StructuredDataPluginSP
2541  GetStructuredDataPlugin(ConstString type_name) const;
2542 
2543 protected:
2544  friend class Trace;
2545  /// Get the processor tracing type supported for this process.
2546  /// Responses might be different depending on the architecture and
2547  /// capabilities of the underlying OS.
2548  ///
2549  /// \return
2550  /// The supported trace type or an \a llvm::Error if tracing is
2551  /// not supported for the inferior.
2552  virtual llvm::Expected<TraceSupportedResponse> TraceSupported();
2553 
2554  /// Start tracing a process or its threads.
2555  ///
2556  /// \param[in] request
2557  /// JSON object with the information necessary to start tracing. In the
2558  /// case of gdb-remote processes, this JSON object should conform to the
2559  /// jLLDBTraceStart packet.
2560  ///
2561  /// \return
2562  /// \a llvm::Error::success if the operation was successful, or
2563  /// \a llvm::Error otherwise.
2564  virtual llvm::Error TraceStart(const llvm::json::Value &request) {
2565  return llvm::make_error<UnimplementedError>();
2566  }
2567 
2568  /// Stop tracing a live process or its threads.
2569  ///
2570  /// \param[in] request
2571  /// The information determining which threads or process to stop tracing.
2572  ///
2573  /// \return
2574  /// \a llvm::Error::success if the operation was successful, or
2575  /// \a llvm::Error otherwise.
2576  virtual llvm::Error TraceStop(const TraceStopRequest &request) {
2577  return llvm::make_error<UnimplementedError>();
2578  }
2579 
2580  /// Get the current tracing state of the process and its threads.
2581  ///
2582  /// \param[in] type
2583  /// Tracing technology type to consider.
2584  ///
2585  /// \return
2586  /// A JSON object string with custom data depending on the trace
2587  /// technology, or an \a llvm::Error in case of errors.
2588  virtual llvm::Expected<std::string> TraceGetState(llvm::StringRef type) {
2589  return llvm::make_error<UnimplementedError>();
2590  }
2591 
2592  /// Get binary data given a trace technology and a data identifier.
2593  ///
2594  /// \param[in] request
2595  /// Object with the params of the requested data.
2596  ///
2597  /// \return
2598  /// A vector of bytes with the requested data, or an \a llvm::Error in
2599  /// case of failures.
2600  virtual llvm::Expected<std::vector<uint8_t>>
2602  return llvm::make_error<UnimplementedError>();
2603  }
2604 
2605  // This calls a function of the form "void * (*)(void)".
2606  bool CallVoidArgVoidPtrReturn(const Address *address,
2607  lldb::addr_t &returned_func,
2608  bool trap_exceptions = false);
2609 
2610  /// Update the thread list following process plug-in's specific logic.
2611  ///
2612  /// This method should only be invoked by \a UpdateThreadList.
2613  ///
2614  /// \return
2615  /// \b true if the new thread list could be generated, \b false otherwise.
2616  virtual bool DoUpdateThreadList(ThreadList &old_thread_list,
2617  ThreadList &new_thread_list) = 0;
2618 
2619  /// Actually do the reading of memory from a process.
2620  ///
2621  /// Subclasses must override this function and can return fewer bytes than
2622  /// requested when memory requests are too large. This class will break up
2623  /// the memory requests and keep advancing the arguments along as needed.
2624  ///
2625  /// \param[in] vm_addr
2626  /// A virtual load address that indicates where to start reading
2627  /// memory from.
2628  ///
2629  /// \param[in] size
2630  /// The number of bytes to read.
2631  ///
2632  /// \param[out] buf
2633  /// A byte buffer that is at least \a size bytes long that
2634  /// will receive the memory bytes.
2635  ///
2636  /// \param[out] error
2637  /// An error that indicates the success or failure of this
2638  /// operation. If error indicates success (error.Success()),
2639  /// then the value returned can be trusted, otherwise zero
2640  /// will be returned.
2641  ///
2642  /// \return
2643  /// The number of bytes that were actually read into \a buf.
2644  /// Zero is returned in the case of an error.
2645  virtual size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size,
2646  Status &error) = 0;
2647 
2649 
2650  /// The "private" side of resuming a process. This doesn't alter the state
2651  /// of m_run_lock, but just causes the process to resume.
2652  ///
2653  /// \return
2654  /// An Status object describing the success or failure of the resume.
2656 
2657  // Called internally
2658  void CompleteAttach();
2659 
2660  /// Print a user-visible warning one time per Process
2661  ///
2662  /// A facility for printing a warning to the user once per repeat_key.
2663  ///
2664  /// warning_type is from the Process::Warnings enums. repeat_key is a
2665  /// pointer value that will be used to ensure that the warning message is
2666  /// not printed multiple times. For instance, with a warning about a
2667  /// function being optimized, you can pass the CompileUnit pointer to have
2668  /// the warning issued for only the first function in a CU, or the Function
2669  /// pointer to have it issued once for every function, or a Module pointer
2670  /// to have it issued once per Module.
2671  ///
2672  /// Classes outside Process should call a specific PrintWarning method so
2673  /// that the warning strings are all centralized in Process, instead of
2674  /// calling PrintWarning() directly.
2675  ///
2676  /// \param [in] warning_type
2677  /// One of the types defined in Process::Warnings.
2678  ///
2679  /// \param [in] repeat_key
2680  /// A pointer value used to ensure that the warning is only printed once.
2681  /// May be nullptr, indicating that the warning is printed unconditionally
2682  /// every time.
2683  ///
2684  /// \param [in] fmt
2685  /// printf style format string
2686  void PrintWarning(uint64_t warning_type, const void *repeat_key,
2687  const char *fmt, ...) __attribute__((format(printf, 4, 5)));
2688 
2689  // NextEventAction provides a way to register an action on the next event
2690  // that is delivered to this process. There is currently only one next event
2691  // action allowed in the process at one time. If a new "NextEventAction" is
2692  // added while one is already present, the old action will be discarded (with
2693  // HandleBeingUnshipped called after it is discarded.)
2694  //
2695  // If you want to resume the process as a result of a resume action, call
2696  // RequestResume, don't call Resume directly.
2698  public:
2702  eEventActionExit
2703  };
2704 
2705  NextEventAction(Process *process) : m_process(process) {}
2706 
2707  virtual ~NextEventAction() = default;
2708 
2709  virtual EventActionResult PerformAction(lldb::EventSP &event_sp) = 0;
2710  virtual void HandleBeingUnshipped() {}
2711  virtual EventActionResult HandleBeingInterrupted() = 0;
2712  virtual const char *GetExitString() = 0;
2714 
2715  protected:
2717  };
2718 
2720  if (m_next_event_action_up.get())
2721  m_next_event_action_up->HandleBeingUnshipped();
2722 
2723  m_next_event_action_up.reset(next_event_action);
2724  }
2725 
2726  // This is the completer for Attaching:
2728  public:
2729  AttachCompletionHandler(Process *process, uint32_t exec_count);
2730 
2731  ~AttachCompletionHandler() override = default;
2732 
2733  EventActionResult PerformAction(lldb::EventSP &event_sp) override;
2735  const char *GetExitString() override;
2736 
2737  private:
2740  };
2741 
2744  return state != lldb::eStateInvalid && state != lldb::eStateDetached &&
2746  }
2747 
2749 
2750  /// Loads any plugins associated with asynchronous structured data and maps
2751  /// the relevant supported type name to the plugin.
2752  ///
2753  /// Processes can receive asynchronous structured data from the process
2754  /// monitor. This method will load and map any structured data plugins that
2755  /// support the given set of supported type names. Later, if any of these
2756  /// features are enabled, the process monitor is free to generate
2757  /// asynchronous structured data. The data must come in as a single \b
2758  /// StructuredData::Dictionary. That dictionary must have a string field
2759  /// named 'type', with a value that equals the relevant type name string
2760  /// (one of the values in \b supported_type_names).
2761  ///
2762  /// \param[in] supported_type_names
2763  /// An array of zero or more type names. Each must be unique.
2764  /// For each entry in the list, a StructuredDataPlugin will be
2765  /// searched for that supports the structured data type name.
2767  const StructuredData::Array &supported_type_names);
2768 
2769  /// Route the incoming structured data dictionary to the right plugin.
2770  ///
2771  /// The incoming structured data must be a dictionary, and it must have a
2772  /// key named 'type' that stores a string value. The string value must be
2773  /// the name of the structured data feature that knows how to handle it.
2774  ///
2775  /// \param[in] object_sp
2776  /// When non-null and pointing to a dictionary, the 'type'
2777  /// key's string value is used to look up the plugin that
2778  /// was registered for that structured data type. It then
2779  /// calls the following method on the StructuredDataPlugin
2780  /// instance:
2781  ///
2782  /// virtual void
2783  /// HandleArrivalOfStructuredData(Process &process,
2784  /// ConstString type_name,
2785  /// const StructuredData::ObjectSP
2786  /// &object_sp)
2787  ///
2788  /// \return
2789  /// True if the structured data was routed to a plugin; otherwise,
2790  /// false.
2791  bool RouteAsyncStructuredData(const StructuredData::ObjectSP object_sp);
2792 
2793  /// Check whether the process supports memory tagging.
2794  ///
2795  /// \return
2796  /// true if the process supports memory tagging,
2797  /// false otherwise.
2798  virtual bool SupportsMemoryTagging() { return false; }
2799 
2800  /// Does the final operation to read memory tags. E.g. sending a GDB packet.
2801  /// It assumes that ReadMemoryTags has checked that memory tagging is enabled
2802  /// and has expanded the memory range as needed.
2803  ///
2804  /// \param[in] addr
2805  /// Start of address range to read memory tags for.
2806  ///
2807  /// \param[in] len
2808  /// Length of the memory range to read tags for (in bytes).
2809  ///
2810  /// \param[in] type
2811  /// Type of tags to read (get this from a MemoryTagManager)
2812  ///
2813  /// \return
2814  /// The packed tag data received from the remote or an error
2815  /// if the read failed.
2816  virtual llvm::Expected<std::vector<uint8_t>>
2817  DoReadMemoryTags(lldb::addr_t addr, size_t len, int32_t type) {
2818  return llvm::createStringError(llvm::inconvertibleErrorCode(),
2819  "%s does not support reading memory tags",
2820  GetPluginName().GetCString());
2821  }
2822 
2823  /// Does the final operation to write memory tags. E.g. sending a GDB packet.
2824  /// It assumes that WriteMemoryTags has checked that memory tagging is enabled
2825  /// and has packed the tag data.
2826  ///
2827  /// \param[in] addr
2828  /// Start of address range to write memory tags for.
2829  ///
2830  /// \param[in] len
2831  /// Length of the memory range to write tags for (in bytes).
2832  ///
2833  /// \param[in] type
2834  /// Type of tags to read (get this from a MemoryTagManager)
2835  ///
2836  /// \param[in] tags
2837  /// Packed tags to be written.
2838  ///
2839  /// \return
2840  /// Status telling you whether the write succeeded.
2841  virtual Status DoWriteMemoryTags(lldb::addr_t addr, size_t len, int32_t type,
2842  const std::vector<uint8_t> &tags) {
2843  return Status("%s does not support writing memory tags",
2844  GetPluginName().GetCString());
2845  }
2846 
2847  // Type definitions
2848  typedef std::map<lldb::LanguageType, lldb::LanguageRuntimeSP>
2850  typedef std::unordered_set<const void *> WarningsPointerSet;
2851  typedef std::map<uint64_t, WarningsPointerSet> WarningsCollection;
2852 
2854  bool (*callback)(void *);
2855  void *baton;
2857  void *in_baton)
2858  : callback(in_callback), baton(in_baton) {}
2860  return callback == rhs.callback && baton == rhs.baton;
2861  }
2862  };
2863 
2864  using StructuredDataPluginMap =
2865  std::map<ConstString, lldb::StructuredDataPluginSP>;
2866 
2867  // Member variables
2868  std::weak_ptr<Target> m_target_wp; ///< The target that owns this process.
2872  m_private_state; // The actual state of our process
2873  Broadcaster m_private_state_broadcaster; // This broadcaster feeds state
2874  // changed events into the private
2875  // state thread's listener.
2877  // broadcaster, used to
2878  // pause, resume & stop the
2879  // private state thread.
2880  lldb::ListenerSP m_private_state_listener_sp; // This is the listener for the
2881  // private state thread.
2882  HostThread m_private_state_thread; ///< Thread ID for the thread that watches
2883  ///internal state events
2884  ProcessModID m_mod_id; ///< Tracks the state of the process over stops and
2885  ///other alterations.
2886  uint32_t m_process_unique_id; ///< Each lldb_private::Process class that is
2887  ///created gets a unique integer ID that
2888  ///increments with each new instance
2889  uint32_t m_thread_index_id; ///< Each thread is created with a 1 based index
2890  ///that won't get re-used.
2891  std::map<uint64_t, uint32_t> m_thread_id_to_index_id_map;
2892  int m_exit_status; ///< The exit status of the process, or -1 if not set.
2893  std::string m_exit_string; ///< A textual description of why a process exited.
2894  std::mutex m_exit_status_mutex; ///< Mutex so m_exit_status m_exit_string can
2895  ///be safely accessed from multiple threads
2896  std::recursive_mutex m_thread_mutex;
2897  ThreadList m_thread_list_real; ///< The threads for this process as are known
2898  ///to the protocol we are debugging with
2899  ThreadList m_thread_list; ///< The threads for this process as the user will
2900  ///see them. This is usually the same as
2901  ///< m_thread_list_real, but might be different if there is an OS plug-in
2902  ///creating memory threads
2903  ThreadPlanStackMap m_thread_plans; ///< This is the list of thread plans for
2904  /// threads in m_thread_list, as well as
2905  /// threads we knew existed, but haven't
2906  /// determined that they have died yet.
2907  ThreadList m_extended_thread_list; ///< Owner for extended threads that may be
2908  ///generated, cleared on natural stops
2909  uint32_t m_extended_thread_stop_id; ///< The natural stop id when
2910  ///extended_thread_list was last updated
2911  QueueList
2912  m_queue_list; ///< The list of libdispatch queues at a given stop point
2913  uint32_t m_queue_list_stop_id; ///< The natural stop id when queue list was
2914  ///last fetched
2915  std::vector<Notifications> m_notifications; ///< The list of notifications
2916  ///that this process can deliver.
2917  std::vector<lldb::addr_t> m_image_tokens;
2918  lldb::ListenerSP m_listener_sp; ///< Shared pointer to the listener used for
2919  ///public events. Can not be empty.
2920  BreakpointSiteList m_breakpoint_site_list; ///< This is the list of breakpoint
2921  ///locations we intend to insert in
2922  ///the target.
2923  lldb::DynamicLoaderUP m_dyld_up;
2924  lldb::JITLoaderListUP m_jit_loaders_up;
2925  lldb::DynamicCheckerFunctionsUP m_dynamic_checkers_up; ///< The functions used
2926  /// by the expression
2927  /// parser to validate
2928  /// data that
2929  /// expressions use.
2930  lldb::OperatingSystemUP m_os_up;
2931  lldb::SystemRuntimeUP m_system_runtime_up;
2932  lldb::UnixSignalsSP
2933  m_unix_signals_sp; /// This is the current signal set for this process.
2934  lldb::ABISP m_abi_sp;
2935  lldb::IOHandlerSP m_process_input_reader;
2937  std::recursive_mutex m_stdio_communication_mutex;
2938  bool m_stdin_forward; /// Remember if stdin must be forwarded to remote debug
2939  /// server
2942  std::recursive_mutex m_profile_data_comm_mutex;
2943  std::vector<std::string> m_profile_data;
2947  bool m_should_detach; /// Should we detach if the process object goes away
2948  /// with an explicit call to Kill or Detach?
2950  std::recursive_mutex m_language_runtimes_mutex;
2952  std::unique_ptr<NextEventAction> m_next_event_action_up;
2953  std::vector<PreResumeCallbackAndBaton> m_pre_resume_actions;
2957  bool m_resume_requested; // If m_currently_handling_event or
2958  // m_currently_handling_do_on_removals are true,
2959  // Resume will only request a resume, using this
2960  // flag to check.
2961 
2962  /// This is set at the beginning of Process::Finalize() to stop functions
2963  /// from looking up or creating things during or after a finalize call.
2964  std::atomic<bool> m_finalizing;
2965 
2966  /// Mask for code an data addresses. The default value (0) means no mask is
2967  /// set. The bits set to 1 indicate bits that are NOT significant for
2968  /// addressing.
2969  /// @{
2972  /// @}
2973 
2976  lldb::StateType m_last_broadcast_state; /// This helps with the Public event
2977  /// coalescing in
2978  /// ShouldBroadcastEvent.
2979  std::map<lldb::addr_t, lldb::addr_t> m_resolved_indirect_addresses;
2981  bool m_can_interpret_function_calls; // Some targets, e.g the OSX kernel,
2982  // don't support the ability to modify
2983  // the stack.
2984  WarningsCollection m_warnings_issued; // A set of object pointers which have
2985  // already had warnings printed
2988 
2990 
2991  std::unique_ptr<UtilityFunction> m_dlopen_utility_func_up;
2993 
2994  size_t RemoveBreakpointOpcodesFromBuffer(lldb::addr_t addr, size_t size,
2995  uint8_t *buf) const;
2996 
2998 
2999  void SetPublicState(lldb::StateType new_state, bool restarted);
3000 
3001  void SetPrivateState(lldb::StateType state);
3002 
3003  bool StartPrivateStateThread(bool is_secondary_thread = false);
3004 
3005  void StopPrivateStateThread();
3006 
3007  void PausePrivateStateThread();
3008 
3009  void ResumePrivateStateThread();
3010 
3011 private:
3015  Process *process;
3017  };
3018 
3019  // arg is a pointer to a new'ed PrivateStateThreadArgs structure.
3020  // PrivateStateThread will free it for you.
3021  static lldb::thread_result_t PrivateStateThread(void *arg);
3022 
3023  // The starts up the private state thread that will watch for events from the
3024  // debugee. Pass true for is_secondary_thread in the case where you have to
3025  // temporarily spin up a secondary state thread to handle events from a hand-
3026  // called function on the primary private state thread.
3027 
3028  lldb::thread_result_t RunPrivateStateThread(bool is_secondary_thread);
3029 
3030 protected:
3031  void HandlePrivateEvent(lldb::EventSP &event_sp);
3032 
3033  Status HaltPrivate();
3034 
3035  lldb::StateType WaitForProcessStopPrivate(lldb::EventSP &event_sp,
3036  const Timeout<std::micro> &timeout);
3037 
3038  // This waits for both the state change broadcaster, and the control
3039  // broadcaster. If control_only, it only waits for the control broadcaster.
3040 
3041  bool GetEventsPrivate(lldb::EventSP &event_sp,
3042  const Timeout<std::micro> &timeout, bool control_only);
3043 
3045  GetStateChangedEventsPrivate(lldb::EventSP &event_sp,
3046  const Timeout<std::micro> &timeout);
3047 
3048  size_t WriteMemoryPrivate(lldb::addr_t addr, const void *buf, size_t size,
3049  Status &error);
3050 
3051  void AppendSTDOUT(const char *s, size_t len);
3052 
3053  void AppendSTDERR(const char *s, size_t len);
3054 
3055  void BroadcastAsyncProfileData(const std::string &one_profile_data);
3056 
3057  static void STDIOReadThreadBytesReceived(void *baton, const void *src,
3058  size_t src_len);
3059 
3060  bool PushProcessIOHandler();
3061 
3062  bool PopProcessIOHandler();
3063 
3064  bool ProcessIOHandlerIsActive();
3065 
3066  bool ProcessIOHandlerExists() const {
3067  return static_cast<bool>(m_process_input_reader);
3068  }
3069 
3070  Status StopForDestroyOrDetach(lldb::EventSP &exit_event_sp);
3071 
3073 
3074  void LoadOperatingSystemPlugin(bool flush);
3075 
3076 private:
3077  Status DestroyImpl(bool force_kill);
3078 
3079  /// This is the part of the event handling that for a process event. It
3080  /// decides what to do with the event and returns true if the event needs to
3081  /// be propagated to the user, and false otherwise. If the event is not
3082  /// propagated, this call will most likely set the target to executing
3083  /// again. There is only one place where this call should be called,
3084  /// HandlePrivateEvent. Don't call it from anywhere else...
3085  ///
3086  /// \param[in] event_ptr
3087  /// This is the event we are handling.
3088  ///
3089  /// \return
3090  /// Returns \b true if the event should be reported to the
3091  /// user, \b false otherwise.
3092  bool ShouldBroadcastEvent(Event *event_ptr);
3093 
3094  void ControlPrivateStateThread(uint32_t signal);
3095 
3096  Process(const Process &) = delete;
3097  const Process &operator=(const Process &) = delete;
3098 };
3099 
3100 /// RAII guard that should be acquired when an utility function is called within
3101 /// a given process.
3104 
3105 public:
3107  if (m_process)
3109  }
3111  if (m_process)
3113  }
3114 };
3115 
3116 } // namespace lldb_private
3117 
3118 #endif // LLDB_TARGET_PROCESS_H
lldb_private::Process::ProcessEventData::m_interrupted
bool m_interrupted
Definition: Process.h:479
lldb_private::ProcessAttachInfo::SetDetachOnError
void SetDetachOnError(bool enable)
Definition: Process.h:189
lldb_private::Process::MapSupportedStructuredDataPlugins
void MapSupportedStructuredDataPlugins(const StructuredData::Array &supported_type_names)
Loads any plugins associated with asynchronous structured data and maps the relevant supported type n...
Definition: Process.cpp:5925
lldb_private::Process::IsValid
bool IsValid() const
Return whether this object is valid (i.e.
Definition: Process.h:574
lldb_private::Process::LoadModules
virtual llvm::Error LoadModules()
Sometimes processes know how to retrieve and load shared libraries.
Definition: Process.h:677
lldb_private::Process::AttachCompletionHandler::GetExitString
const char * GetExitString() override
Definition: Process.cpp:2743
lldb_private::ProcessModID::ProcessModID
ProcessModID()=default
lldb_private::ProcessModID::m_memory_id
uint32_t m_memory_id
Definition: Process.h:322
lldb_private::ProcessInstanceInfo
Definition: ProcessInfo.h:108
lldb_private::ProcessProperties::GetInterruptTimeout
std::chrono::seconds GetInterruptTimeout() const
Definition: Process.cpp:314
lldb_private::Process::StopLocker
ProcessRunLock::ProcessRunLocker StopLocker
Definition: Process.h:382
lldb_private::ProcessLaunchInfo::GetDetachOnError
bool GetDetachOnError() const
Definition: ProcessLaunchInfo.h:146
lldb_private::Process::operator=
const Process & operator=(const Process &)=delete
lldb_private::Process::m_process_unique_id
uint32_t m_process_unique_id
Each lldb_private::Process class that is created gets a unique integer ID that increments with each n...
Definition: Process.h:2886
lldb_private::UtilityFunctionScope::~UtilityFunctionScope
~UtilityFunctionScope()
Definition: Process.h:3110
lldb_private::Process::PrintWarningOptimization
void PrintWarningOptimization(const SymbolContext &sc)
Print a user-visible warning about a module being built with optimization.
Definition: Process.cpp:5750
lldb_private::Process::StartPrivateStateThread
bool StartPrivateStateThread(bool is_secondary_thread=false)
Definition: Process.cpp:3499
lldb_private::ProcessProperties::GetDisableMemoryCache
bool GetDisableMemoryCache() const
Definition: Process.cpp:189
lldb_private::Process::ProcessEventData::m_restarted_reasons
std::vector< std::string > m_restarted_reasons
Definition: Process.h:475
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::Process::eBroadcastInternalStateControlStop
@ eBroadcastInternalStateControlStop
Definition: Process.h:367
lldb_private::Process::m_can_interpret_function_calls
bool m_can_interpret_function_calls
Definition: Process.h:2981
lldb_private::Process::m_can_jit
enum lldb_private::Process::@34 m_can_jit
lldb_private::Process::WillLaunch
virtual Status WillLaunch(Module *module)
Called before launching to a process.
Definition: Process.h:1010
lldb_private::Process::m_profile_data
std::vector< std::string > m_profile_data
Definition: Process.h:2943
lldb_private::ProcessProperties::SetOSPluginReportsAllThreads
void SetOSPluginReportsAllThreads(bool does_report)
Definition: Process.cpp:340
lldb_private::Process::m_public_state
ThreadSafeValue< lldb::StateType > m_public_state
Definition: Process.h:2870
lldb_private::Process::m_target_wp
std::weak_ptr< Target > m_target_wp
The target that owns this process.
Definition: Process.h:2868
lldb_private::ProcessModID::GetStopID
uint32_t GetStopID() const
Definition: Process.h:261
lldb_private::Process::GetShouldDetach
bool GetShouldDetach() const
Definition: Process.h:736
lldb_private::Process::GetThreadStatus
size_t GetThreadStatus(Stream &ostrm, bool only_threads_with_stop_reason, uint32_t start_frame, uint32_t num_frames, uint32_t num_frames_with_source, bool stop_format)
Definition: Process.cpp:5497
lldb_private::Process::AllocateMemory
lldb::addr_t AllocateMemory(size_t size, uint32_t permissions, Status &error)
The public interface to allocating memory in the process.
Definition: Process.cpp:2297
lldb_private::Process::eWarningsOptimization
@ eWarningsOptimization
Definition: Process.h:373
lldb_private::ArchSpec
Definition: ArchSpec.h:33
lldb_private::ProcessModID::SetStopEventForLastNaturalStopID
void SetStopEventForLastNaturalStopID(lldb::EventSP event_sp)
Definition: Process.h:308
lldb_private::ThreadSafeValue::GetValue
T GetValue() const
Definition: ThreadSafeValue.h:25
lldb_private::Process::GetOperatingSystem
OperatingSystem * GetOperatingSystem()
Definition: Process.h:2250
lldb_private::Process::NextEventAction::eEventActionRetry
@ eEventActionRetry
Definition: Process.h:2701
lldb_private::Process::DeallocateMemory
Status DeallocateMemory(lldb::addr_t ptr)
The public interface to deallocating memory in the process.
Definition: Process.cpp:2368
lldb_private::Process::GetStatus
void GetStatus(Stream &ostrm)
Definition: Process.cpp:5477
lldb_private::Process::m_should_detach
bool m_should_detach
Definition: Process.h:2947
lldb_private::Process::m_allocated_memory_cache
AllocatedMemoryCache m_allocated_memory_cache
Definition: Process.h:2946
lldb_private::Process::DidAttach
virtual void DidAttach(ArchSpec &process_arch)
Called after attaching a process.
Definition: Process.h:981
lldb_private::ProcessProperties::GetWarningsOptimization
bool GetWarningsOptimization() const
Definition: Process.cpp:289
lldb_private::Process::RefreshStateAfterStop
virtual void RefreshStateAfterStop()=0
Currently called as part of ShouldStop.
lldb_private::ProcessProperties::ProcessProperties
ProcessProperties(lldb_private::Process *process)
Definition: Process.cpp:158
lldb_private::Process::eBroadcastInternalStateControlResume
@ eBroadcastInternalStateControlResume
Definition: Process.h:369
lldb_private::Process::m_thread_list
ThreadList m_thread_list
The threads for this process as the user will see them.
Definition: Process.h:2899
lldb_private::Process::DestroyRequiresHalt
virtual bool DestroyRequiresHalt()
Definition: Process.h:1173
lldb_private::ProcessModID::SetInvalid
void SetInvalid()
Definition: Process.h:277
lldb_private::ProcessAttachInfo::SetResumeCount
void SetResumeCount(uint32_t c)
Definition: Process.h:152
lldb_private::Process::m_stdin_forward
bool m_stdin_forward
Definition: Process.h:2938
lldb_private::ProcessModID::IsValid
bool IsValid() const
Definition: Process.h:279
lldb_private::TraceGetBinaryDataRequest
jLLDBTraceGetBinaryData gdb-remote packet
Definition: TraceGDBRemotePackets.h:132
lldb_private::Process::PrivateStateThreadIsValid
bool PrivateStateThreadIsValid() const
Definition: Process.h:2742
lldb_private::Process::StopForDestroyOrDetach
Status StopForDestroyOrDetach(lldb::EventSP &exit_event_sp)
Definition: Process.cpp:3133
lldb_private::Event
Definition: Event.h:180
lldb_private::Process::ReadMemory
virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Status &error)
Read of memory from a process.
Definition: Process.cpp:1914
lldb_private::QueueList::Queues
QueueIterable Queues()
Iterate over the list of queues.
Definition: QueueList.h:60
lldb_private::Process::SendAsyncInterrupt
void SendAsyncInterrupt()
Definition: Process.cpp:3619
lldb_private::Process::Process
Process(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp)
Construct with a shared pointer to a target, and the Process listener.
LLDB_INVALID_PROCESS_ID
#define LLDB_INVALID_PROCESS_ID
Definition: lldb-defines.h:93
lldb_private::Process::GetResumeID
uint32_t GetResumeID() const
Definition: Process.h:1375
lldb_private::Process::RemoveBreakpointOpcodesFromBuffer
size_t RemoveBreakpointOpcodesFromBuffer(lldb::addr_t addr, size_t size, uint8_t *buf) const
Definition: Process.cpp:1707
lldb_private::JITLoaderList
Definition: JITLoaderList.h:22
lldb_private::Process::m_memory_cache
MemoryCache m_memory_cache
Definition: Process.h:2945
lldb_private::Process::ProcessEventData::GetInterruptedFromEvent
static bool GetInterruptedFromEvent(const Event *event_ptr)
Definition: Process.cpp:4169
lldb_private::ProcessAttachInfo::m_resume_count
uint32_t m_resume_count
Definition: Process.h:204
lldb_private::Process::ProcessEventData::SetInterrupted
void SetInterrupted(bool new_value)
Definition: Process.h:467
lldb_private::Process::ReadScalarIntegerFromMemory
size_t ReadScalarIntegerFromMemory(lldb::addr_t addr, uint32_t byte_size, bool is_signed, Scalar &scalar, Status &error)
Definition: Process.cpp:2255
lldb_private::Process::ProcessEventData::GetStateFromEvent
static lldb::StateType GetStateFromEvent(const Event *event_ptr)
Definition: Process.cpp:4116
lldb_private::Process::DidVForkDone
virtual void DidVForkDone()
Called after reported vfork completion.
Definition: Process.h:1002
lldb_private::ProcessInstanceInfo::Clear
void Clear()
Definition: ProcessInfo.h:116
lldb_private::Process::ProcessIOHandlerExists
bool ProcessIOHandlerExists() const
Definition: Process.h:3066
lldb_private::StructuredData::Array
Definition: StructuredData.h:165
lldb_private::Process::SetRunningUserExpression
void SetRunningUserExpression(bool on)
Definition: Process.cpp:1465
lldb_private::HostThread
Definition: HostThread.h:29
lldb_private::ProcessAttachInfo::GetContinueOnceAttached
bool GetContinueOnceAttached() const
Definition: Process.h:146
lldb_private::Process::Notifications
A notification structure that can be used by clients to listen for changes in a process's lifetime.
Definition: Process.h:397
lldb_private::ProcessProperties::GetPythonOSPluginPath
FileSpec GetPythonOSPluginPath() const
Definition: Process.cpp:213
lldb_private::Process::GetJITLoaders
virtual JITLoaderList & GetJITLoaders()
Definition: Process.cpp:2657
StructuredData.h
lldb_private::Process::m_finalizing
std::atomic< bool > m_finalizing
This is set at the beginning of Process::Finalize() to stop functions from looking up or creating thi...
Definition: Process.h:2964
lldb_private::Process::GetBroadcasterClass
ConstString & GetBroadcasterClass() const override
This needs to be filled in if you are going to register the broadcaster with the broadcaster manager ...
Definition: Process.h:388
lldb_private::Process::GetEventsPrivate
bool GetEventsPrivate(lldb::EventSP &event_sp, const Timeout< std::micro > &timeout, bool control_only)
Definition: Process.cpp:1017
lldb_private::Process::DidSignal
virtual void DidSignal()
Called after sending a signal to a process.
Definition: Process.h:1179
lldb_private::UtilityFunctionScope::m_process
Process * m_process
Definition: Process.h:3103
lldb_private::Process::DoAllocateMemory
virtual lldb::addr_t DoAllocateMemory(size_t size, uint32_t permissions, Status &error)
Actually allocate memory in the process.
Definition: Process.h:1672
lldb_private::Predicate< uint32_t >
lldb_private::Process::m_private_state
ThreadSafeValue< lldb::StateType > m_private_state
Definition: Process.h:2872
lldb_private::Process::m_force_next_event_delivery
bool m_force_next_event_delivery
Definition: Process.h:2975
lldb_private::Process::m_extended_thread_stop_id
uint32_t m_extended_thread_stop_id
The natural stop id when extended_thread_list was last updated.
Definition: Process.h:2909
lldb_private::Process::GetExitDescription
const char * GetExitDescription()
Get a textual description of what the process exited.
Definition: Process.cpp:1042
lldb_private::Process::eBroadcastBitSTDOUT
@ eBroadcastBitSTDOUT
Definition: Process.h:360
lldb_private::ProcessModID::MemoryIDEqual
bool MemoryIDEqual(const ProcessModID &compare) const
Definition: Process.h:269
lldb_private::Process::GetPrivateState
lldb::StateType GetPrivateState()
Definition: Process.cpp:1404
lldb_private::Process::DoWriteMemoryTags
virtual Status DoWriteMemoryTags(lldb::addr_t addr, size_t len, int32_t type, const std::vector< uint8_t > &tags)
Does the final operation to write memory tags.
Definition: Process.h:2841
InstrumentationRuntime.h
lldb_private::Process::GetLastNaturalStopID
uint32_t GetLastNaturalStopID() const
Definition: Process.h:1381
lldb_private::Process::PrivateResume
Status PrivateResume()
The "private" side of resuming a process.
Definition: Process.cpp:3035
lldb::ExpressionResults
ExpressionResults
The results of expression evaluation.
Definition: lldb-enumerations.h:270
lldb_private::PluginInterface
Definition: PluginInterface.h:16
lldb_private::Process::m_iohandler_sync
Predicate< uint32_t > m_iohandler_sync
Definition: Process.h:2944
lldb_private::ProcessProperties::~ProcessProperties
~ProcessProperties() override
lldb_private::Process::EnableSoftwareBreakpoint
virtual Status EnableSoftwareBreakpoint(BreakpointSite *bp_site)
Definition: Process.cpp:1744
lldb_private::Process::ModulesDidLoad
virtual void ModulesDidLoad(ModuleList &module_list)
Definition: Process.cpp:5686
lldb_private::Process::PruneThreadPlans
void PruneThreadPlans()
Prune ThreadPlanStacks for all unreported threads.
Definition: Process.cpp:1234
lldb_private::Process::DumpThreadPlansForTID
bool DumpThreadPlansForTID(Stream &strm, lldb::tid_t tid, lldb::DescriptionLevel desc_level, bool internal, bool condense_trivial, bool skip_unreported_plans)
Dump the thread plans associated with thread with tid.
Definition: Process.cpp:1238
lldb_private::ProcessProperties::GetOSPluginReportsAllThreads
bool GetOSPluginReportsAllThreads() const
Definition: Process.cpp:327
ProcessLaunchInfo.h
lldb_private::Process::GetQueueList
QueueList & GetQueueList()
Definition: Process.h:2142
lldb_private::ProcessProperties::m_experimental_properties_up
std::unique_ptr< ProcessExperimentalProperties > m_experimental_properties_up
Definition: Process.h:106
lldb_private::Process::ProcessEventHijacker::ProcessEventHijacker
ProcessEventHijacker(Process &process, lldb::ListenerSP listener_sp)
Definition: Process.h:2212
lldb_private::Process::RemoveInvalidMemoryRange
bool RemoveInvalidMemoryRange(const LoadRange &region)
Definition: Process.cpp:5547
lldb_private::Process::m_last_broadcast_state
lldb::StateType m_last_broadcast_state
Definition: Process.h:2976
lldb_private::Process::GetModIDRef
const ProcessModID & GetModIDRef() const
Definition: Process.h:1371
lldb_private::ProcessModID::operator=
const ProcessModID & operator=(const ProcessModID &rhs)
Definition: Process.h:233
lldb_private::ProcessProperties::SetDisableLangRuntimeUnwindPlans
void SetDisableLangRuntimeUnwindPlans(bool disable)
Definition: Process.cpp:272
lldb_private::Process::GetStateChangedEventsPrivate
lldb::StateType GetStateChangedEventsPrivate(lldb::EventSP &event_sp, const Timeout< std::micro > &timeout)
Definition: Process.cpp:999
lldb_private::Process::CanDebug
virtual bool CanDebug(lldb::TargetSP target, bool plugin_specified_by_name)=0
Check if a plug-in instance can debug the file in module.
lldb_private::ProcessAttachInfo::m_plugin_name
std::string m_plugin_name
Definition: Process.h:203
lldb_private::Process::SetCodeAddressMask
void SetCodeAddressMask(lldb::addr_t code_address_mask)
Definition: Process.h:1357
lldb_private::ProcessProperties::GetUtilityExpressionTimeout
std::chrono::seconds GetUtilityExpressionTimeout() const
Definition: Process.cpp:307
lldb_private::Process::ReadModuleFromMemory
lldb::ModuleSP ReadModuleFromMemory(const FileSpec &file_spec, lldb::addr_t header_addr, size_t size_to_read=512)
Definition: Process.cpp:2388
lldb_private::Process::SetDynamicCheckers
void SetDynamicCheckers(DynamicCheckerFunctions *dynamic_checkers)
Definition: Process.cpp:1550
lldb_private::Scalar
Definition: Scalar.h:34
lldb_private::Process::HaltPrivate
Status HaltPrivate()
Definition: Process.cpp:3738
lldb_private::Process::m_structured_data_plugin_map
StructuredDataPluginMap m_structured_data_plugin_map
Definition: Process.h:2987
lldb_private::Process::DidResume
virtual void DidResume()
Called after resuming a process.
Definition: Process.h:1076
lldb_private::Process
Definition: Process.h:342
lldb_private::Process::GetLoadedModuleList
virtual llvm::Expected< LoadedModuleInfoList > GetLoadedModuleList()
Query remote GDBServer for a detailed loaded library list.
Definition: Process.h:685
lldb_private::Process::NextEventAction::RequestResume
void RequestResume()
Definition: Process.h:2713
lldb_private::EventData
Definition: Event.h:36
lldb_private::Process::m_queue_list
QueueList m_queue_list
The list of libdispatch queues at a given stop point.
Definition: Process.h:2912
lldb_private::ProcessModID::BumpResumeID
void BumpResumeID()
Definition: Process.h:251
lldb_private::Process::ClearBreakpointSiteByID
Status ClearBreakpointSiteByID(lldb::user_id_t break_id)
Definition: Process.cpp:1569
lldb_private::Process::GetBreakpointSiteList
BreakpointSiteList & GetBreakpointSiteList()
Definition: Process.cpp:1554
lldb_private::Process::m_os_up
lldb::OperatingSystemUP m_os_up
Definition: Process.h:2930
lldb_private::Process::GetThreadList
ThreadList & GetThreadList()
Definition: Process.h:2116
lldb_private::Process::DoAttachToProcessWithID
virtual Status DoAttachToProcessWithID(lldb::pid_t pid, const ProcessAttachInfo &attach_info)
Attach to an existing process using a process ID.
Definition: Process.h:943
lldb_private::Process::GetMemoryRegions
virtual Status GetMemoryRegions(lldb_private::MemoryRegionInfos &region_list)
Obtain all the mapped memory regions within this process.
Definition: Process.cpp:5891
lldb_private::Process::GetTarget
Target & GetTarget()
Get the target object pointer for this module.
Definition: Process.h:1214
lldb_private::InstrumentationRuntimeCollection
std::map< lldb::InstrumentationRuntimeType, lldb::InstrumentationRuntimeSP > InstrumentationRuntimeCollection
Definition: InstrumentationRuntime.h:25
lldb_private::Process::m_language_runtimes
LanguageRuntimeCollection m_language_runtimes
Should we detach if the process object goes away with an explicit call to Kill or Detach?
Definition: Process.h:2949
lldb_private::Process::ConnectRemote
virtual Status ConnectRemote(llvm::StringRef remote_url)
Attach to a remote system via a URL.
Definition: Process.cpp:3003
lldb_private::EvaluateExpressionOptions
Definition: Target.h:262
lldb_private::ProcessRunLock::ProcessRunLocker
Definition: ProcessRunLock.h:36
lldb_private::Process::StopNoticingNewThreads
virtual bool StopNoticingNewThreads()
Call this to turn off the stop & notice new threads mode.
Definition: Process.h:2352
lldb_private::Process::AssignIndexIDToThread
uint32_t AssignIndexIDToThread(uint64_t thread_id)
Definition: Process.cpp:1281
lldb_private::ProcessProperties::SetStopOnSharedLibraryEvents
void SetStopOnSharedLibraryEvents(bool stop)
Definition: Process.cpp:261
lldb::LanguageType
LanguageType
Programming language type.
Definition: lldb-enumerations.h:436
lldb_private::Process::SetCanInterpretFunctionCalls
void SetCanInterpretFunctionCalls(bool can_interpret_function_calls)
Sets whether executing function calls using the interpreter is possible for this process.
Definition: Process.h:1905
lldb_private::ProcessAttachInfo::GetListener
lldb::ListenerSP GetListener() const
Definition: Process.h:192
BreakpointSiteList.h
lldb_private::Process::m_stderr_data
std::string m_stderr_data
Definition: Process.h:2941
lldb_private::Module
Definition: Module.h:84
lldb_private::Process::ReadSignedIntegerFromMemory
int64_t ReadSignedIntegerFromMemory(lldb::addr_t load_addr, size_t byte_size, int64_t fail_value, Status &error)
Definition: Process.cpp:2111
ProcessRunLock.h
lldb_private::SystemRuntime
Definition: SystemRuntime.h:43
lldb_private::Process::UpdateAutomaticSignalFiltering
virtual Status UpdateAutomaticSignalFiltering()
Definition: Process.cpp:6032
lldb_private::ProcessInfo::GetProcessID
lldb::pid_t GetProcessID() const
Definition: ProcessInfo.h:67
lldb_private::Process::GetStopEventForStopID
lldb::EventSP GetStopEventForStopID(uint32_t stop_id) const
Definition: Process.h:1385
Trace.h
lldb_private::ProcessProperties::GetUnwindOnErrorInExpressions
bool GetUnwindOnErrorInExpressions() const
Definition: Process.cpp:244
lldb_private::Process::ClearPreResumeAction
void ClearPreResumeAction(PreResumeActionCallback callback, void *baton)
Definition: Process.cpp:5571
lldb_private::Process::GetModID
ProcessModID GetModID() const
Get the Modification ID of the process.
Definition: Process.h:1369
lldb_private::Process::m_process_input_reader
lldb::IOHandlerSP m_process_input_reader
Definition: Process.h:2935
ThreadPlanStack.h
lldb_private::Process::DoDetach
virtual Status DoDetach(bool keep_stopped)
Detaches from a running or stopped process.
Definition: Process.h:1128
lldb_private::MemoryRegionInfo
Definition: MemoryRegionInfo.h:21
lldb_private::Process::DoConnectRemote
virtual Status DoConnectRemote(llvm::StringRef remote_url)
Attach to a remote system via a URL.
Definition: Process.h:923
lldb_private::Process::eWarningsUnsupportedLanguage
@ eWarningsUnsupportedLanguage
Definition: Process.h:373
lldb_private::Process::DoDidExec
virtual void DoDidExec()
Subclasses of Process should implement this function if they need to do anything after a process exec...
Definition: Process.h:993
lldb_private::Process::PreResumeCallbackAndBaton
Definition: Process.h:2853
lldb_private::Process::m_exit_status_mutex
std::mutex m_exit_status_mutex
Mutex so m_exit_status m_exit_string can be safely accessed from multiple threads.
Definition: Process.h:2894
lldb_private::Process::DoReadMemoryTags
virtual llvm::Expected< std::vector< uint8_t > > DoReadMemoryTags(lldb::addr_t addr, size_t len, int32_t type)
Does the final operation to read memory tags.
Definition: Process.h:2817
lldb_private::Process::IsAlive
virtual bool IsAlive()
Check if a process is still alive.
Definition: Process.cpp:1085
lldb_private::Process::m_dynamic_checkers_up
lldb::DynamicCheckerFunctionsUP m_dynamic_checkers_up
The functions used by the expression parser to validate data that expressions use.
Definition: Process.h:2925
lldb_private::Process::DoHalt
virtual Status DoHalt(bool &caused_stop)
Halts a running process.
Definition: Process.h:1101
lldb_private::Process::TraceGetBinaryData
virtual llvm::Expected< std::vector< uint8_t > > TraceGetBinaryData(const TraceGetBinaryDataRequest &request)
Get binary data given a trace technology and a data identifier.
Definition: Process.h:2601
lldb_private::Process::AppendSTDERR
void AppendSTDERR(const char *s, size_t len)
Definition: Process.cpp:4231
lldb_private::Process::ProcessEventData::ProcessEventData
ProcessEventData()
Definition: Process.cpp:3887
lldb_private::Process::Warnings
Warnings
Process warning types.
Definition: Process.h:373
lldb_private::Process::m_private_state_listener_sp
lldb::ListenerSP m_private_state_listener_sp
Definition: Process.h:2880
lldb_private::Process::PrivateStateThreadArgs::is_secondary_thread
bool is_secondary_thread
Definition: Process.h:3016
lldb_private::ProcessProperties::GetDetachKeepsStopped
bool GetDetachKeepsStopped() const
Definition: Process.cpp:278
lldb_private::Stream
Definition: Stream.h:28
lldb_private::Process::SetID
void SetID(lldb::pid_t new_pid)
Sets the stored pid.
Definition: Process.h:547
lldb_private::Process::PrivateStateThreadArgs
Definition: Process.h:3012
lldb_private::Process::ReadCStringFromMemory
size_t ReadCStringFromMemory(lldb::addr_t vm_addr, char *cstr, size_t cstr_max_len, Status &error)
Read a NULL terminated C string from memory.
Definition: Process.cpp:2028
lldb_private::Args
Definition: Args.h:33
lldb_private::Process::Halt
Status Halt(bool clear_thread_plans=false, bool use_run_lock=true)
Halts a running process.
Definition: Process.cpp:3092
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::Process::ProcessEventData::~ProcessEventData
~ProcessEventData() override
lldb_private::Process::m_unix_signals_sp
lldb::UnixSignalsSP m_unix_signals_sp
Definition: Process.h:2933
lldb_private::Process::GetRunLock
ProcessRunLock & GetRunLock()
Definition: Process.cpp:5581
lldb_private::Process::UpdateThreadList
bool UpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list)
Update the thread list.
Definition: Process.cpp:1133
lldb_private::Process::FindThreadPlans
ThreadPlanStack * FindThreadPlans(lldb::tid_t tid)
Find the thread plan stack associated with thread with tid.
Definition: Process.cpp:1226
lldb_private::Process::SetPrivateState
void SetPrivateState(lldb::StateType state)
Definition: Process.cpp:1406
lldb_private::Process::eBroadcastBitInterrupt
@ eBroadcastBitInterrupt
Definition: Process.h:359
lldb_private::ProcessProperties::SetUnwindOnErrorInExpressions
void SetUnwindOnErrorInExpressions(bool ignore)
Definition: Process.cpp:250
lldb_private::ProcessAttachInfo::m_async
bool m_async
Definition: Process.h:213
lldb_private::ProcessAttachInfo::SetListener
void SetListener(const lldb::ListenerSP &listener_sp)
Definition: Process.h:194
lldb_private::Process::ProcessEventData::AddRestartedReason
void AddRestartedReason(const char *reason)
Definition: Process.h:469
lldb_private::Process::WriteMemory
size_t WriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, Status &error)
Write memory to a process.
Definition: Process.cpp:2158
lldb_private::Process::PopProcessIOHandler
bool PopProcessIOHandler()
Definition: Process.cpp:4507
lldb_private::Process::m_dlopen_utility_func_up
std::unique_ptr< UtilityFunction > m_dlopen_utility_func_up
Definition: Process.h:2991
lldb_private::ProcessAttachInfo::SetContinueOnceAttached
void SetContinueOnceAttached(bool b)
Definition: Process.h:148
Listener.h
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::Target
Definition: Target.h:454
lldb_private::Process::PrintWarningUnsupportedLanguage
void PrintWarningUnsupportedLanguage(const SymbolContext &sc)
Print a user-visible warning about a function written in a language that this version of LLDB doesn't...
Definition: Process.cpp:5764
lldb_private::Process::WillDetach
virtual Status WillDetach()
Called before detaching from a process.
Definition: Process.h:1121
lldb_private::Process::RestoreProcessEvents
void RestoreProcessEvents()
Restores the process event broadcasting to its normal state.
Definition: Process.cpp:953
lldb_private::Process::TraceStart
virtual llvm::Error TraceStart(const llvm::json::Value &request)
Start tracing a process or its threads.
Definition: Process.h:2564
lldb_private::ProcessModID::m_last_user_expression_resume
uint32_t m_last_user_expression_resume
Definition: Process.h:323
lldb_private::Process::SynchronouslyNotifyStateChanged
void SynchronouslyNotifyStateChanged(lldb::StateType state)
Definition: Process.cpp:593
lldb_private::Process::BroadcastAsyncProfileData
void BroadcastAsyncProfileData(const std::string &one_profile_data)
Definition: Process.cpp:4238
lldb_private::Process::WarnBeforeDetach
virtual bool WarnBeforeDetach() const
Before lldb detaches from a process, it warns the user that they are about to lose their debug sessio...
Definition: Process.h:1422
lldb_private::Process::RunPrivateStateThread
lldb::thread_result_t RunPrivateStateThread(bool is_secondary_thread)
Definition: Process.cpp:3760
lldb_private::Process::ProcessEventData::GetInterrupted
bool GetInterrupted() const
Definition: Process.h:430
lldb_private::Process::eBroadcastBitSTDERR
@ eBroadcastBitSTDERR
Definition: Process.h:361
lldb_private::Process::LanguageRuntimeCollection
std::map< lldb::LanguageType, lldb::LanguageRuntimeSP > LanguageRuntimeCollection
Definition: Process.h:2849
lldb_private::Process::CallocateMemory
lldb::addr_t CallocateMemory(size_t size, uint32_t permissions, Status &error)
The public interface to allocating memory in the process, this also clears the allocated memory.
Definition: Process.cpp:2320
lldb_private::Process::GetAsyncProfileData
virtual size_t GetAsyncProfileData(char *buf, size_t buf_size, Status &error)
Get any available profile data.
Definition: Process.cpp:4261
lldb_private::Process::GetInstrumentationRuntime
lldb::InstrumentationRuntimeSP GetInstrumentationRuntime(lldb::InstrumentationRuntimeType type)
Definition: Process.cpp:5810
lldb_private::Process::PrefetchModuleSpecs
virtual void PrefetchModuleSpecs(llvm::ArrayRef< FileSpec > module_file_specs, const llvm::Triple &triple)
Definition: Process.h:2434
lldb_private::Process::DidExec
virtual void DidExec()
Called after a process re-execs itself.
Definition: Process.cpp:5622
lldb_private::Process::GetState
lldb::StateType GetState()
Get accessor for the current process state.
Definition: Process.cpp:1295
lldb_private::ProcessAttachInfo::SetProcessPluginName
void SetProcessPluginName(llvm::StringRef plugin)
Definition: Process.h:158
lldb_private::Process::Queues
QueueList::QueueIterable Queues()
Definition: Process.h:2147
lldb_private::Process::ReadMemoryFromInferior
size_t ReadMemoryFromInferior(lldb::addr_t vm_addr, void *buf, size_t size, Status &error)
Read of memory from a process.
Definition: Process.cpp:2074
lldb::eStateExited
@ eStateExited
Process has exited and can't be examined.
Definition: lldb-enumerations.h:90
lldb_private::Process::NextEventAction::m_process
Process * m_process
Definition: Process.h:2716
lldb_private::Process::GetIOHandlerID
uint32_t GetIOHandlerID() const
Definition: Process.h:2168
lldb_private::ProcessAttachInfo::GetListenerForProcess
lldb::ListenerSP GetListenerForProcess(Debugger &debugger)
Definition: Process.cpp:2747
lldb_private::Process::NextEventAction
Definition: Process.h:2697
lldb_private::ProcessAttachInfo::m_listener_sp
lldb::ListenerSP m_listener_sp
Definition: Process.h:201
lldb_private::Process::Signal
Status Signal(int signal)
Sends a process a UNIX signal signal.
Definition: Process.cpp:3316
Broadcaster.h
lldb_private::Process::CurrentThreadIsPrivateStateThread
bool CurrentThreadIsPrivateStateThread()
Definition: Process.cpp:5588
lldb_private::Process::CanJIT
bool CanJIT()
Determines whether executing JIT-compiled code in this process is possible.
Definition: Process.cpp:2330
lldb_private::ProcessModID::GetMemoryID
uint32_t GetMemoryID() const
Definition: Process.h:263
lldb_private::Process::SetRunningUtilityFunction
void SetRunningUtilityFunction(bool on)
Definition: Process.cpp:1469
lldb_private::Process::DestroyImpl
Status DestroyImpl(bool force_kill)
Definition: Process.cpp:3246
lldb_private::Process::DisableBreakpointSiteByID
Status DisableBreakpointSiteByID(lldb::user_id_t break_id)
Definition: Process.cpp:1578
lldb_private::Process::ProcessEventData::SetInterruptedInEvent
static void SetInterruptedInEvent(Event *event_ptr, bool new_value)
Definition: Process.cpp:4178
lldb_private::Communication
Definition: Communication.h:84
lldb_private::Process::HijackProcessEvents
bool HijackProcessEvents(lldb::ListenerSP listener_sp)
If you need to ensure that you and only you will hear about some public event, then make a new listen...
Definition: Process.cpp:945
lldb_private::Properties
Definition: UserSettingsController.h:33
lldb_private::Process::HandleProcessStateChangedEvent
static bool HandleProcessStateChangedEvent(const lldb::EventSP &event_sp, Stream *stream, bool &pop_process_io_handler)
Centralize the code that handles and prints descriptions for process state changes.
Definition: Process.cpp:714
lldb_private::ProcessProperties::GetFollowForkMode
FollowForkMode GetFollowForkMode() const
Definition: Process.cpp:350
lldb_private::Process::WriteMemoryPrivate
size_t WriteMemoryPrivate(lldb::addr_t addr, const void *buf, size_t size, Status &error)
Definition: Process.cpp:2142
lldb_private::Process::RouteAsyncStructuredData
bool RouteAsyncStructuredData(const StructuredData::ObjectSP object_sp)
Route the incoming structured data dictionary to the right plugin.
Definition: Process.cpp:6003
lldb_private::Process::WillAttachToProcessWithID
virtual Status WillAttachToProcessWithID(lldb::pid_t pid)
Called before attaching to a process.
Definition: Process.h:903
lldb_private::Process::eBroadcastBitProfileData
@ eBroadcastBitProfileData
Definition: Process.h:362
lldb_private::Trace
Definition: Trace.h:46
lldb_private::operator==
bool operator==(const Address &lhs, const Address &rhs)
Definition: Address.cpp:999
lldb_private::LockingAdaptedIterable
Definition: Iterable.h:171
lldb_private::Process::DoUpdateThreadList
virtual bool DoUpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list)=0
Update the thread list following process plug-in's specific logic.
lldb_private::FileSpec
Definition: FileSpec.h:56
lldb_private::Process::ResolveIndirectFunction
virtual lldb::addr_t ResolveIndirectFunction(const Address *address, Status &error)
Resolve dynamically loaded indirect functions.
Definition: Process.cpp:5656
lldb_private::ProcessAttachInfo::m_continue_once_attached
bool m_continue_once_attached
Definition: Process.h:207
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::Process::m_pid
lldb::pid_t m_pid
Definition: Process.h:2869
lldb_private::Process::TraceGetState
virtual llvm::Expected< std::string > TraceGetState(llvm::StringRef type)
Get the current tracing state of the process and its threads.
Definition: Process.h:2588
lldb_private::Process::m_notifications
std::vector< Notifications > m_notifications
The list of notifications that this process can deliver.
Definition: Process.h:2915
lldb_private::Process::ClearPreResumeActions
void ClearPreResumeActions()
Definition: Process.cpp:5569
lldb_private::Process::Flush
void Flush()
Flush all data in the process.
Definition: Process.cpp:5594
lldb_private::Process::HasAssignedIndexIDToThread
bool HasAssignedIndexIDToThread(uint64_t sb_thread_id)
Definition: Process.cpp:1276
lldb_private::Process::m_code_address_mask
lldb::addr_t m_code_address_mask
Mask for code an data addresses.
Definition: Process.h:2970
lldb_private::Process::DumpThreadPlans
void DumpThreadPlans(Stream &strm, lldb::DescriptionLevel desc_level, bool internal, bool condense_trivial, bool skip_unreported_plans)
Dump all the thread plans for this process.
Definition: Process.cpp:1245
lldb_private::Process::ShouldBroadcastEvent
bool ShouldBroadcastEvent(Event *event_ptr)
This is the part of the event handling that for a process event.
Definition: Process.cpp:3344
lldb_private::Process::PrivateStateThreadArgs::process
Process * process
Definition: Process.h:3014
ProcessInfo.h
HostThread.h
lldb_private::Process::HandlePrivateEvent
void HandlePrivateEvent(lldb::EventSP &event_sp)
Definition: Process.cpp:3627
lldb_private::Process::CompleteAttach
void CompleteAttach()
Definition: Process.cpp:2875
lldb_private::Process::ProcessEventData::m_restarted
bool m_restarted
Definition: Process.h:476
lldb_private::Process::ProcessEventData::GetProcessSP
lldb::ProcessSP GetProcessSP() const
Definition: Process.h:417
lldb_private::Process::UnregisterNotificationCallbacks
bool UnregisterNotificationCallbacks(const Process::Notifications &callbacks)
Unregister for process and thread notifications.
Definition: Process.cpp:580
lldb_private::BreakpointSite
Definition: BreakpointSite.h:35
lldb_private::ProcessRunLock
Definition: ProcessRunLock.h:25
lldb_private::Process::CallVoidArgVoidPtrReturn
bool CallVoidArgVoidPtrReturn(const Address *address, lldb::addr_t &returned_func, bool trap_exceptions=false)
Definition: Process.cpp:6055
ThreadSafeValue.h
lldb_private::ProcessProperties::SetPythonOSPluginPath
void SetPythonOSPluginPath(const FileSpec &file)
Definition: Process.cpp:228
lldb_private::Process::GetDynamicCheckers
DynamicCheckerFunctions * GetDynamicCheckers()
Definition: Process.h:2260
lldb_private::Process::ProcessEventData::m_state
lldb::StateType m_state
Definition: Process.h:474
lldb_private::Process::Threads
ThreadList::ThreadIterable Threads()
Definition: Process.h:2124
lldb_private::Process::GetSoftwareBreakpointTrapOpcode
size_t GetSoftwareBreakpointTrapOpcode(BreakpointSite *bp_site)
Definition: Process.cpp:1737
lldb_private::ProcessProperties::GetWarningsUnsupportedLanguage
bool GetWarningsUnsupportedLanguage() const
Definition: Process.cpp:295
lldb_private::ProcessLaunchInfo
Definition: ProcessLaunchInfo.h:31
lldb_private::DataExtractor
Definition: DataExtractor.h:48
lldb_private::ModuleList
Definition: ModuleList.h:72
lldb_private::Process::IsLiveDebugSession
virtual bool IsLiveDebugSession() const
Definition: Process.h:1411
lldb_private::ExecutionContextScope
Definition: ExecutionContextScope.h:32
lldb_private::Process::LoadOperatingSystemPlugin
void LoadOperatingSystemPlugin(bool flush)
Definition: Process.cpp:2467
lldb_private::ProcessModID::SetRunningUtilityFunction
void SetRunningUtilityFunction(bool on)
Definition: Process.h:297
lldb_private::ProcessAttachInfo::Clear
void Clear()
Definition: Process.h:162
lldb_private::Process::ProcessEventData::GetEventDataFromEvent
static const Process::ProcessEventData * GetEventDataFromEvent(const Event *event_ptr)
Definition: Process.cpp:4097
lldb_private::ProcessProperties::GetIgnoreBreakpointsInExpressions
bool GetIgnoreBreakpointsInExpressions() const
Definition: Process.cpp:233
lldb_private::Process::STDIOReadThreadBytesReceived
static void STDIOReadThreadBytesReceived(void *baton, const void *src, size_t src_len)
Definition: Process.cpp:4324
lldb_private::Process::TraceStop
virtual llvm::Error TraceStop(const TraceStopRequest &request)
Stop tracing a live process or its threads.
Definition: Process.h:2576
lldb_private::Process::DoDestroy
virtual Status DoDestroy()=0
lldb_private::Process::TraceSupported
virtual llvm::Expected< TraceSupportedResponse > TraceSupported()
Get the processor tracing type supported for this process.
Definition: Process.cpp:6048
lldb_private::ProcessModID::m_last_natural_stop_event
lldb::EventSP m_last_natural_stop_event
Definition: Process.h:326
lldb_private::Process::SetDataAddressMask
void SetDataAddressMask(lldb::addr_t data_address_mask)
Definition: Process.h:1361
lldb_private::Process::DisableSoftwareBreakpoint
virtual Status DisableSoftwareBreakpoint(BreakpointSite *bp_site)
Definition: Process.cpp:1820
UnimplementedError.h
lldb_private::Process::StructuredDataPluginMap
std::map< ConstString, lldb::StructuredDataPluginSP > StructuredDataPluginMap
Definition: Process.h:2865
lldb_private::Process::m_exit_status
int m_exit_status
The exit status of the process, or -1 if not set.
Definition: Process.h:2892
lldb_private::Process::ForceNextEventDelivery
void ForceNextEventDelivery()
Definition: Process.h:2748
lldb_private::Watchpoint
Definition: Watchpoint.h:24
lldb_private::Process::NextEventAction::NextEventAction
NextEventAction(Process *process)
Definition: Process.h:2705
lldb_private::Process::GetLoadedDynamicLibrariesInfos
virtual lldb_private::StructuredData::ObjectSP GetLoadedDynamicLibrariesInfos(lldb::addr_t image_list_address, lldb::addr_t image_count)
Retrieve the list of shared libraries that are loaded for this process This method is used on pre-mac...
Definition: Process.h:1290
NameMatches.h
lldb_private::Process::IsRunning
bool IsRunning() const
Definition: Process.cpp:1030
lldb_private::Process::GetCodeAddressMask
lldb::addr_t GetCodeAddressMask()
Definition: Process.cpp:5602
lldb_private::Process::WillAttachToProcessWithName
virtual Status WillAttachToProcessWithName(const char *process_name, bool wait_for_launch)
Called before attaching to a process.
Definition: Process.h:911
lldb_private::Process::ProcessEventData::GetFlavorString
static ConstString GetFlavorString()
Definition: Process.cpp:3899
lldb_private::Process::ReadStringFromMemory
size_t ReadStringFromMemory(lldb::addr_t vm_addr, char *str, size_t max_bytes, Status &error, size_t type_width=1)
Read a NULL terminated string from memory.
Definition: Process.cpp:1975
lldb_private::StructuredData::ObjectSP
std::shared_ptr< Object > ObjectSP
Definition: StructuredData.h:59
lldb_private::Process::EnableBreakpointSiteByID
Status EnableBreakpointSiteByID(lldb::user_id_t break_id)
Definition: Process.cpp:1592
lldb_private::Process::m_dyld_up
lldb::DynamicLoaderUP m_dyld_up
Definition: Process.h:2923
lldb_private::Process::GetMemoryRegionInfo
virtual Status GetMemoryRegionInfo(lldb::addr_t load_addr, MemoryRegionInfo &range_info)
Locate the memory region that contains load_addr.
Definition: Process.h:1821
lldb_private::Process::ProcessEventData
Definition: Process.h:404
lldb_private::Process::m_mod_id
ProcessModID m_mod_id
Tracks the state of the process over stops and other alterations.
Definition: Process.h:2884
lldb_private::Process::ExecutionResultAsCString
static const char * ExecutionResultAsCString(lldb::ExpressionResults result)
Definition: Process.cpp:5440
lldb_private::Process::SetExitStatus
virtual bool SetExitStatus(int exit_status, const char *cstr)
Set accessor for the process exit status (return code).
Definition: Process.cpp:1050
lldb_private::Process::ProcessEventData::GetProcessFromEvent
static lldb::ProcessSP GetProcessFromEvent(const Event *event_ptr)
Definition: Process.cpp:4108
lldb_private::MemoryRegionInfos
Definition: MemoryRegionInfo.h:164
lldb_private::ProcessProperties::GetStopOnExec
bool GetStopOnExec() const
Definition: Process.cpp:301
lldb_private::Process::ConfigureStructuredData
virtual Status ConfigureStructuredData(ConstString type_name, const StructuredData::ObjectSP &config_sp)
Configure asynchronous structured data feature.
Definition: Process.cpp:5917
lldb_private::ProcessModID::m_stop_id
uint32_t m_stop_id
Definition: Process.h:319
lldb_private::Process::PreResumeCallbackAndBaton::callback
bool(* callback)(void *)
Definition: Process.h:2854
lldb_private::ThreadPlanStackMap
Definition: ThreadPlanStack.h:116
lldb_private::Process::Finalize
virtual void Finalize()
This object is about to be destroyed, do any necessary cleanup.
Definition: Process.cpp:511
lldb_private::Process::SupportsMemoryTagging
virtual bool SupportsMemoryTagging()
Check whether the process supports memory tagging.
Definition: Process.h:2798
lldb_private::Process::ProcessEventData::m_update_state
int m_update_state
Definition: Process.h:478
lldb::break_id_t
int32_t break_id_t
Definition: lldb-types.h:88
lldb_private::Process::PrivateStateThreadArgs::PrivateStateThreadArgs
PrivateStateThreadArgs(Process *p, bool s)
Definition: Process.h:3013
lldb_private::ProcessAttachInfo::SetAsync
void SetAsync(bool b)
Definition: Process.h:140
lldb_private::Process::ProcessEventData::GetRestartedFromEvent
static bool GetRestartedFromEvent(const Event *event_ptr)
Definition: Process.cpp:4124
lldb_private::Process::GetHostMacCatalystVersion
virtual llvm::VersionTuple GetHostMacCatalystVersion()
Definition: Process.h:1207
lldb_private::Process::GetNextThreadIndexID
uint32_t GetNextThreadIndexID(uint64_t thread_id)
Definition: Process.cpp:1272
lldb_private::Process::RemoveOwnerFromBreakpointSite
void RemoveOwnerFromBreakpointSite(lldb::user_id_t owner_id, lldb::user_id_t owner_loc_id, lldb::BreakpointSiteSP &bp_site_sp)
Definition: Process.cpp:1695
lldb_private::Process::GetAddressByteSize
uint32_t GetAddressByteSize() const
Definition: Process.cpp:3340
lldb_private::ThreadList
Definition: ThreadList.h:26
lldb_private::Process::AddPreResumeAction
void AddPreResumeAction(PreResumeActionCallback callback, void *baton)
Definition: Process.cpp:5552
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::Process::Destroy
Status Destroy(bool force_kill)
Kills the process and shuts down all threads that were spawned to track and monitor the process.
Definition: Process.cpp:3238
lldb_private::Process::SaveCore
virtual llvm::Expected< bool > SaveCore(llvm::StringRef outfile)
Save core dump into the specified file.
Definition: Process.cpp:2653
lldb_private::Process::ProcessEventData::GetState
lldb::StateType GetState() const
Definition: Process.h:419
lldb_private::Process::GetAuxvData
virtual DataExtractor GetAuxvData()
Definition: Process.cpp:2651
lldb_private::Process::DoReadMemory
virtual size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Status &error)=0
Actually do the reading of memory from a process.
lldb_private::ThreadCollection::Threads
virtual ThreadIterable Threads()
Definition: ThreadCollection.h:46
lldb_private::Process::SetProcessExitStatus
static bool SetProcessExitStatus(lldb::pid_t pid, bool exited, int signo, int status)
Static function that can be used with the host function Host::StartMonitoringChildProcess ().
Definition: Process.cpp:1105
lldb_private::AddressRange
Definition: AddressRange.h:25
lldb_private::Process::m_next_event_action_up
std::unique_ptr< NextEventAction > m_next_event_action_up
Definition: Process.h:2952
lldb_private::ProcessProperties::GetSteppingRunsAllThreads
bool GetSteppingRunsAllThreads() const
Definition: Process.cpp:321
lldb_private::Process::UpdateThreadListIfNeeded
void UpdateThreadListIfNeeded()
Definition: Process.cpp:1139
lldb_private::Process::m_queue_list_stop_id
uint32_t m_queue_list_stop_id
The natural stop id when queue list was last fetched.
Definition: Process.h:2913
lldb_private::Process::m_run_thread_plan_lock
std::mutex m_run_thread_plan_lock
Definition: Process.h:2986
lldb_private::ProcessModID::GetLastNaturalStopID
uint32_t GetLastNaturalStopID() const
Definition: Process.h:262
lldb_private::Process::m_abi_sp
lldb::ABISP m_abi_sp
This is the current signal set for this process.
Definition: Process.h:2934
lldb_private::Process::m_public_run_lock
ProcessRunLock m_public_run_lock
Definition: Process.h:2954
lldb_private::OperatingSystem
Definition: OperatingSystem.h:27
PluginInterface.h
lldb_private::Range
Definition: Process.h:61
lldb_private::ProcessLaunchInfo::GetListener
lldb::ListenerSP GetListener() const
Definition: ProcessLaunchInfo.h:128
lldb_private::DynamicLoader
Definition: DynamicLoader.h:52
lldb::eStateDetached
@ eStateDetached
Process has been detached and can't be examined.
Definition: lldb-enumerations.h:89
lldb_private::Process::PutSTDIN
virtual size_t PutSTDIN(const char *buf, size_t buf_size, Status &error)
Puts data into this process's STDIN.
Definition: Process.h:2024
lldb_private::Process::AttachCompletionHandler::HandleBeingInterrupted
EventActionResult HandleBeingInterrupted() override
Definition: Process.cpp:2739
lldb_private::Process::GetMemoryTagManager
llvm::Expected< const MemoryTagManager * > GetMemoryTagManager()
If this architecture and process supports memory tagging, return a tag manager that can be used to ma...
Definition: Process.cpp:6110
lldb_private::Process::GetGlobalProperties
static const ProcessPropertiesSP & GetGlobalProperties()
Definition: Process.cpp:503
lldb_private::Process::Attach
virtual Status Attach(ProcessAttachInfo &attach_info)
Attach to an existing process using the process attach info.
Definition: Process.cpp:2754
lldb_private::ProcessAttachInfo::SetHijackListener
void SetHijackListener(const lldb::ListenerSP &listener_sp)
Definition: Process.h:183
lldb_private::Process::m_thread_mutex
std::recursive_mutex m_thread_mutex
Definition: Process.h:2896
lldb_private::Process::m_dlopen_utility_func_flag_once
llvm::once_flag m_dlopen_utility_func_flag_once
Definition: Process.h:2992
lldb_private::Process::m_private_state_thread
HostThread m_private_state_thread
Thread ID for the thread that watches internal state events.
Definition: Process.h:2882
lldb_private::Debugger
Definition: Debugger.h:70
lldb_private::Process::GetHistoryThreads
lldb::ThreadCollectionSP GetHistoryThreads(lldb::addr_t addr)
Definition: Process.cpp:5793
lldb_private::Process::ResumeSynchronous
Status ResumeSynchronous(Stream *stream)
Definition: Process.cpp:1349
lldb_private::Process::PruneThreadPlansForTID
bool PruneThreadPlansForTID(lldb::tid_t tid)
Prune ThreadPlanStacks for unreported threads.
Definition: Process.cpp:1230
lldb_private::Process::StartNoticingNewThreads
virtual bool StartNoticingNewThreads()
Call this to set the lldb in the mode where it breaks on new thread creations, and then auto-restarts...
Definition: Process.h:2345
lldb_private::LanguageRuntime
Definition: LanguageRuntime.h:60
lldb_private::Process::WarningsPointerSet
std::unordered_set< const void * > WarningsPointerSet
Definition: Process.h:2850
ThreadList.h
lldb_private::Process::WillResume
virtual Status WillResume()
Called before resuming to a process.
Definition: Process.h:1048
lldb_private::Process::GetDynamicLoader
virtual DynamicLoader * GetDynamicLoader()
Get the dynamic loader plug-in for this process.
Definition: Process.cpp:2645
lldb_private::Process::m_currently_handling_do_on_removals
bool m_currently_handling_do_on_removals
Definition: Process.h:2956
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::ProcessModID::m_running_utility_function
uint32_t m_running_utility_function
Definition: Process.h:325
lldb_private::Process::AttachCompletionHandler::~AttachCompletionHandler
~AttachCompletionHandler() override=default
Communication.h
lldb_private::Process::ProcessEventData::GetRestarted
bool GetRestarted() const
Definition: Process.h:420
lldb_private::ProcessAttachInfo::GetAsync
bool GetAsync() const
Definition: Process.h:138
lldb_private::Process::eCanJITNo
@ eCanJITNo
Definition: Process.h:2989
lldb_private::Process::m_exit_string
std::string m_exit_string
A textual description of why a process exited.
Definition: Process.h:2893
lldb_private::Process::SetUnixSignals
void SetUnixSignals(lldb::UnixSignalsSP &&signals_sp)
Definition: Process.cpp:3326
lldb_private::Process::DidHalt
virtual void DidHalt()
Called after halting a process.
Definition: Process.h:1112
lldb_private::Process::m_stdio_communication
Communication m_stdio_communication
Definition: Process.h:2936
lldb_private::Process::DidLaunch
virtual void DidLaunch()
Called after launching a process.
Definition: Process.h:1040
lldb_private::ProcessProperties::m_process
Process * m_process
Definition: Process.h:105
lldb_private::Process::GetUnixSignals
const lldb::UnixSignalsSP & GetUnixSignals()
Definition: Process.cpp:3331
Event.h
LoadedModuleInfoList.h
lldb_private::Process::SendEventData
virtual Status SendEventData(const char *data)
Definition: Process.h:2403
lldb_private::Process::WillHalt
virtual Status WillHalt()
Called before halting to a process.
Definition: Process.h:1084
lldb_private::Process::ResumePrivateStateThread
void ResumePrivateStateThread()
Definition: Process.cpp:3554
lldb_private::operator!=
bool operator!=(const Address &lhs, const Address &rhs)
Definition: Address.cpp:1005
lldb_private::Process::SetShouldDetach
void SetShouldDetach(bool b)
Definition: Process.h:738
lldb_private::ProcessAttachInfo
Definition: Process.h:115
ObjectFile.h
lldb-private.h
lldb_private::Process::SetNextEventAction
void SetNextEventAction(Process::NextEventAction *next_event_action)
Definition: Process.h:2719
lldb_private::Process::GetLanguageRuntimes
std::vector< LanguageRuntime * > GetLanguageRuntimes()
Definition: Process.cpp:1481
lldb_private::Process::GetExitStatus
int GetExitStatus()
Get the exit status for a process.
Definition: Process.cpp:1034
lldb_private::Process::ControlPrivateStateThread
void ControlPrivateStateThread(uint32_t signal)
Definition: Process.cpp:3569
lldb_private::ProcessModID::ProcessModID
ProcessModID(const ProcessModID &rhs)
Definition: Process.h:230
lldb_private::Process::AddInvalidMemoryRegion
void AddInvalidMemoryRegion(const LoadRange &region)
Definition: Process.cpp:5543
lldb_private::CommandObject
Definition: CommandObject.h:67
lldb_private::ProcessModID::m_last_natural_stop_id
uint32_t m_last_natural_stop_id
Definition: Process.h:320
UserIDResolver.h
lldb_private::Process::CalculateTarget
lldb::TargetSP CalculateTarget() override
Definition: Process.cpp:4196
lldb_private::Process::SettingsInitialize
static void SettingsInitialize()
Definition: Process.cpp:4515
lldb_private::ProcessAttachInfo::GetResumeCount
uint32_t GetResumeCount() const
Definition: Process.h:150
lldb_private::ProcessModID::GetStopEventForStopID
lldb::EventSP GetStopEventForStopID(uint32_t stop_id) const
Definition: Process.h:312
lldb_private::ProcessProperties::GetDisableLangRuntimeUnwindPlans
bool GetDisableLangRuntimeUnwindPlans() const
Definition: Process.cpp:266
lldb_private::Process::DoSignal
virtual Status DoSignal(int signal)
Sends a process a UNIX signal signal.
Definition: Process.h:1159
lldb_private::ProcessModID::m_running_user_expression
uint32_t m_running_user_expression
Definition: Process.h:324
lldb_private::Process::GetExtendedThreadList
ThreadList & GetExtendedThreadList()
Definition: Process.h:2122
lldb_private::Process::DetachRequiresHalt
virtual bool DetachRequiresHalt()
Definition: Process.h:1142
lldb_private::TraceStopRequest
jLLDBTraceStop gdb-remote packet
Definition: TraceGDBRemotePackets.h:62
lldb_private::Process::GetWatchpointSupportInfo
virtual Status GetWatchpointSupportInfo(uint32_t &num)
Definition: Process.h:1839
lldb_private::Process::CreateOSPluginThread
lldb::ThreadSP CreateOSPluginThread(lldb::tid_t tid, lldb::addr_t context)
Definition: Process.cpp:1265
lldb_private::Process::LoadRange
Range< lldb::addr_t, lldb::addr_t > LoadRange
Definition: Process.h:375
lldb_private::Process::AttachCompletionHandler
Definition: Process.h:2727
lldb_private::Process::ProcessEventData::AddRestartedReason
static void AddRestartedReason(Event *event_ptr, const char *reason)
Definition: Process.cpp:4161
lldb_private::Process::ProcessEventData::GetNumRestartedReasons
size_t GetNumRestartedReasons()
Definition: Process.h:422
lldb_private::ProcessLaunchInfo::GetProcessPluginName
const char * GetProcessPluginName() const
Definition: ProcessLaunchInfo.cpp:132
lldb_private::Process::GetSTDOUT
virtual size_t GetSTDOUT(char *buf, size_t buf_size, Status &error)
Get any available STDOUT.
Definition: Process.cpp:4286
lldb_private::ModuleSpec
Definition: ModuleSpec.h:26
lldb_private::ProcessModID::m_resume_id
uint32_t m_resume_id
Definition: Process.h:321
lldb_private::ProcessProperties::SetIgnoreBreakpointsInExpressions
void SetIgnoreBreakpointsInExpressions(bool ignore)
Definition: Process.cpp:239
lldb_private::ProcessInstanceInfo::GetParentProcessID
lldb::pid_t GetParentProcessID() const
Definition: ProcessInfo.h:135
lldb_private::Process::GetUniqueID
uint32_t GetUniqueID() const
Definition: Process.h:549
lldb_private::Process::IsPossibleDynamicValue
bool IsPossibleDynamicValue(ValueObject &in_value)
Definition: Process.cpp:1529
lldb_private::Process::SetPublicState
void SetPublicState(lldb::StateType new_state, bool restarted)
Definition: Process.cpp:1299
lldb_private::Process::ProcessEventData::SetRestartedInEvent
static void SetRestartedInEvent(Event *event_ptr, bool new_value)
Definition: Process.cpp:4132
lldb_private::Status
Definition: Status.h:44
lldb_private::ValueObject
ValueObject:
Definition: ValueObject.h:105
lldb_private::ProcessLaunchInfo::GetResumeCount
uint32_t GetResumeCount() const
Definition: ProcessLaunchInfo.h:80
lldb_private::ProcessAttachInfo::m_hijack_listener_sp
lldb::ListenerSP m_hijack_listener_sp
Definition: Process.h:202
lldb_private::Timeout< std::micro >
lldb_private::Process::GetLastUserExpressionResumeID
uint32_t GetLastUserExpressionResumeID() const
Definition: Process.h:1377
lldb_private::Process::GetHostOSVersion
virtual llvm::VersionTuple GetHostOSVersion()
Sometimes the connection to a process can detect the host OS version that the process is running on.
Definition: Process.h:1204
lldb_private::Process::m_private_state_broadcaster
Broadcaster m_private_state_broadcaster
Definition: Process.h:2873
lldb_private::ProcessModID::SetRunningUserExpression
void SetRunningUserExpression(bool on)
Definition: Process.h:290
lldb_private::Process::StateChangedIsExternallyHijacked
bool StateChangedIsExternallyHijacked()
Definition: Process.cpp:1384
lldb_private::Process::DidExit
virtual void DidExit()
Definition: Process.h:1352
lldb_private::Process::GetLoadedDynamicLibrariesInfos
virtual lldb_private::StructuredData::ObjectSP GetLoadedDynamicLibrariesInfos()
Definition: Process.h:1298
uint32_t
lldb_private::AllocatedMemoryCache
Definition: Memory.h:112
lldb_private::Process::DoAttachToProcessWithName
virtual Status DoAttachToProcessWithName(const char *process_name, const ProcessAttachInfo &attach_info)
Attach to an existing process using a partial process name.
Definition: Process.h:966
lldb_private::Process::eCanJITYes
@ eCanJITYes
Definition: Process.h:2989
UserSettingsController.h
lldb_private::Process::m_language_runtimes_mutex
std::recursive_mutex m_language_runtimes_mutex
Definition: Process.h:2950
lldb_private::ProcessModID::BumpStopID
void BumpStopID()
Definition: Process.h:243
lldb_private::Process::m_extended_thread_list
ThreadList m_extended_thread_list
Owner for extended threads that may be generated, cleared on natural stops.
Definition: Process.h:2907
Memory.h
lldb_private::ProcessModID::StopIDEqual
bool StopIDEqual(const ProcessModID &compare) const
Definition: Process.h:273
lldb::thread_result_t
void * thread_result_t
Definition: lldb-types.h:62
lldb_private::Process::WaitForProcessStopPrivate
lldb::StateType WaitForProcessStopPrivate(lldb::EventSP &event_sp, const Timeout< std::micro > &timeout)
Definition: Process.cpp:2446
lldb_private::Process::DoLaunch
virtual Status DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info)
Launch a new process.
Definition: Process.h:1029
lldb_private::Process::m_breakpoint_site_list
BreakpointSiteList m_breakpoint_site_list
This is the list of breakpoint locations we intend to insert in the target.
Definition: Process.h:2920
lldb_private::ProcessProperties::GetStopOnSharedLibraryEvents
bool GetStopOnSharedLibraryEvents() const
Definition: Process.cpp:255
lldb_private::Process::GetSystemRuntime
virtual SystemRuntime * GetSystemRuntime()
Get the system runtime plug-in for this process.
Definition: Process.cpp:2665
lldb_private::Address
Definition: Address.h:59
lldb_private::Process::AddImageToken
size_t AddImageToken(lldb::addr_t image_ptr)
Definition: Process.cpp:5825
lldb_private::ProcessProperties::SetDetachKeepsStopped
void SetDetachKeepsStopped(bool keep_stopped)
Definition: Process.cpp:284
lldb_private::Process::PreResumeCallbackAndBaton::PreResumeCallbackAndBaton
PreResumeCallbackAndBaton(PreResumeActionCallback in_callback, void *in_baton)
Definition: Process.h:2856
lldb_private::Process::m_instrumentation_runtimes
InstrumentationRuntimeCollection m_instrumentation_runtimes
Definition: Process.h:2951
lldb_private::FollowForkMode
FollowForkMode
Definition: lldb-private-enumerations.h:176
lldb_private::Process::ProcessEventHijacker::~ProcessEventHijacker
~ProcessEventHijacker()
Definition: Process.h:2217
lldb_private::Process::eBroadcastBitStructuredData
@ eBroadcastBitStructuredData
Definition: Process.h:363
lldb_private::ProcessModID
Definition: Process.h:224
lldb_private::ProcessAttachInfo::GetProcessPluginName
const char * GetProcessPluginName() const
Definition: Process.h:154
lldb::pid_t
uint64_t pid_t
Definition: lldb-types.h:85
lldb_private::Process::Launch
virtual Status Launch(ProcessLaunchInfo &launch_info)
Launch a new process.
Definition: Process.cpp:2475
lldb_private::Process::PrintWarning
void PrintWarning(uint64_t warning_type, const void *repeat_key, const char *fmt,...) __attribute__((format(printf
Print a user-visible warning one time per Process.
Definition: Process.cpp:5720
lldb_private::MemoryCache
Definition: Memory.h:21
lldb_private::Process::m_system_runtime_up
lldb::SystemRuntimeUP m_system_runtime_up
Definition: Process.h:2931
lldb_private::ProcessProperties::SetVirtualAddressableBits
void SetVirtualAddressableBits(uint32_t bits)
Definition: Process.cpp:224
lldb_private::ProcessAttachInfo::GetIgnoreExisting
bool GetIgnoreExisting() const
Definition: Process.h:142
lldb_private::Process::GetModuleSpec
virtual bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch, ModuleSpec &module_spec)
Try to fetch the module specification for a module with the given file name and architecture.
Definition: Process.cpp:5819
ExecutionContextScope.h
lldb_private::Process::EnableWatchpoint
virtual Status EnableWatchpoint(Watchpoint *wp, bool notify=true)
Definition: Process.cpp:2433
lldb_private::Process::GetNextEvent
lldb::StateType GetNextEvent(lldb::EventSP &event_sp)
Definition: Process.cpp:614
lldb_private::ProcessAttachInfo::m_detach_on_error
bool m_detach_on_error
Definition: Process.h:210
lldb_private::Process::RegisterNotificationCallbacks
void RegisterNotificationCallbacks(const Process::Notifications &callbacks)
Register for process and thread notifications.
Definition: Process.cpp:574
lldb_private::ProcessAttachInfo::SetIgnoreExisting
void SetIgnoreExisting(bool b)
Definition: Process.h:144
lldb_private::Process::WarningsCollection
std::map< uint64_t, WarningsPointerSet > WarningsCollection
Definition: Process.h:2851
lldb_private::DiagnosticManager
Definition: DiagnosticManager.h:93
lldb_private::Process::GetLanguageRuntime
LanguageRuntime * GetLanguageRuntime(lldb::LanguageType language)
Definition: Process.cpp:1501
ArchSpec.h
lldb_private::Process::WaitForProcessToStop
lldb::StateType WaitForProcessToStop(const Timeout< std::micro > &timeout, lldb::EventSP *event_sp_ptr=nullptr, bool wait_always=true, lldb::ListenerSP hijack_listener=lldb::ListenerSP(), Stream *stream=nullptr, bool use_run_lock=true)
Definition: Process.cpp:646
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:31
lldb_private::Process::Detach
Status Detach(bool keep_stopped)
Detaches from a running or stopped process.
Definition: Process.cpp:3186
lldb_private::Process::AdvanceAddressToNextBranchInstruction
Address AdvanceAddressToNextBranchInstruction(Address default_stop_addr, AddressRange range_bounds)
Find the next branch instruction to set a breakpoint on.
Definition: Process.cpp:5842
lldb_private::Process::m_thread_index_id
uint32_t m_thread_index_id
Each thread is created with a 1 based index that won't get re-used.
Definition: Process.h:2889
lldb_private::Process::m_data_address_mask
lldb::addr_t m_data_address_mask
Definition: Process.h:2971
lldb_private::ProcessExperimentalProperties
Definition: Process.h:63
lldb_private::Process::m_image_tokens
std::vector< lldb::addr_t > m_image_tokens
Definition: Process.h:2917
lldb_private::Process::DoWriteMemory
virtual size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, Status &error)
Actually do the writing of memory to a process.
Definition: Process.h:1588
lldb_private::Process::GetStructuredDataPlugin
lldb::StructuredDataPluginSP GetStructuredDataPlugin(ConstString type_name) const
Returns the StructuredDataPlugin associated with a given type name, if there is one.
Definition: Process.cpp:4253
lldb_private::Process::CanInterpretFunctionCalls
bool CanInterpretFunctionCalls()
Determines whether executing function calls using the interpreter is possible for this process.
Definition: Process.h:1898
lldb_private::Process::DidVFork
virtual void DidVFork(lldb::pid_t child_pid, lldb::tid_t child_tid)
Called after a reported vfork.
Definition: Process.h:999
lldb_private::Process::CalculateProcess
lldb::ProcessSP CalculateProcess() override
Definition: Process.h:2360
lldb_private::UtilityFunctionScope
RAII guard that should be acquired when an utility function is called within a given process.
Definition: Process.h:3102
lldb_private::Process::AppendSTDOUT
void AppendSTDOUT(const char *s, size_t len)
Definition: Process.cpp:4224
lldb_private::ProcessLaunchInfo::GetHijackListener
lldb::ListenerSP GetHijackListener() const
Definition: ProcessLaunchInfo.h:134
lldb_private::Process::ProcessEventData::Dump
void Dump(Stream *s) const override
Definition: Process.cpp:4084
lldb_private::Process::WillPublicStop
virtual void WillPublicStop()
Called when the process is about to broadcast a public stop.
Definition: Process.h:772
lldb_private::Process::WritePointerToMemory
bool WritePointerToMemory(lldb::addr_t vm_addr, lldb::addr_t ptr_value, Status &error)
Definition: Process.cpp:2130
lldb_private::Process::PushProcessIOHandler
bool PushProcessIOHandler()
Definition: Process.cpp:4488
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:86
lldb_private::Process::m_pre_resume_actions
std::vector< PreResumeCallbackAndBaton > m_pre_resume_actions
Definition: Process.h:2953
lldb_private::Process::RunPreResumeActions
bool RunPreResumeActions()
Definition: Process.cpp:5557
lldb_private::Process::LoadCore
virtual Status LoadCore()
Definition: Process.cpp:2599
lldb_private::Platform
Definition: Platform.h:72
lldb_private::Process::Notifications::baton
void * baton
Definition: Process.h:398
lldb_private::Process::GetStaticBroadcasterClass
static ConstString & GetStaticBroadcasterClass()
Definition: Process.cpp:398
lldb_private::Process::DisableAllBreakpointSites
void DisableAllBreakpointSites()
Definition: Process.cpp:1562
lldb_private::Process::GetID
lldb::pid_t GetID() const
Returns the pid of the process or LLDB_INVALID_PROCESS_ID if there is no known pid.
Definition: Process.h:542
lldb_private::Process::DidDetach
virtual void DidDetach()
Called after detaching from a process.
Definition: Process.h:1140
lldb_private::Process::WriteScalarToMemory
size_t WriteScalarToMemory(lldb::addr_t vm_addr, const Scalar &scalar, size_t size, Status &error)
Write all or part of a scalar value to memory.
Definition: Process.cpp:2237
lldb_private::Process::m_listener_sp
lldb::ListenerSP m_listener_sp
Shared pointer to the listener used for public events.
Definition: Process.h:2918
lldb_private::ProcessExperimentalProperties::ProcessExperimentalProperties
ProcessExperimentalProperties()
Definition: Process.cpp:152
lldb_private::Process::m_thread_plans
ThreadPlanStackMap m_thread_plans
This is the list of thread plans for threads in m_thread_list, as well as threads we knew existed,...
Definition: Process.h:2903
lldb_private::ProcessAttachInfo::ProcessAttachInfo
ProcessAttachInfo(const ProcessLaunchInfo &launch_info)
Definition: Process.h:121
lldb_private::ThreadPlanStack
Definition: ThreadPlanStack.h:31
lldb_private::ProcessModID::BumpMemoryID
void BumpMemoryID()
Definition: Process.h:249
lldb_private::Process::ProcessEventHijacker
Definition: Process.h:2210
lldb_private::ProcessModID::GetLastUserExpressionResumeID
uint32_t GetLastUserExpressionResumeID() const
Definition: Process.h:265
lldb_private::Process::eBroadcastInternalStateControlPause
@ eBroadcastInternalStateControlPause
Definition: Process.h:368
lldb_private::Process::DoDeallocateMemory
virtual Status DoDeallocateMemory(lldb::addr_t ptr)
Actually deallocate memory in the process.
Definition: Process.h:1927
Status.h
lldb::user_id_t
uint64_t user_id_t
Definition: lldb-types.h:84
lldb_private::Process::ReadMemoryTags
llvm::Expected< std::vector< lldb::addr_t > > ReadMemoryTags(lldb::addr_t addr, size_t len)
Read memory tags for the range addr to addr+len.
Definition: Process.cpp:6130
lldb_private::Process::ProcessIOHandlerIsActive
bool ProcessIOHandlerIsActive()
Definition: Process.cpp:4482
lldb_private::Process::DidDestroy
virtual void DidDestroy()
Definition: Process.h:1171
lldb_private::Process::DoLoadCore
virtual Status DoLoadCore()
Definition: Process.h:613
lldb_private::HostThread::IsJoinable
bool IsJoinable() const
Definition: HostThread.cpp:30
lldb_private::ProcessProperties::GetMemoryCacheLineSize
uint64_t GetMemoryCacheLineSize() const
Definition: Process.cpp:195
lldb_private::Process::GetImageInfoAddress
virtual lldb::addr_t GetImageInfoAddress()
Get the image information address for the current process.
Definition: Process.cpp:1473
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::Process::m_destroy_in_process
bool m_destroy_in_process
Definition: Process.h:2980
lldb_private::Process::AttachCompletionHandler::m_exit_string
std::string m_exit_string
Definition: Process.h:2739
lldb_private::Process::GetLoadedDynamicLibrariesInfos
virtual lldb_private::StructuredData::ObjectSP GetLoadedDynamicLibrariesInfos(const std::vector< lldb::addr_t > &load_addresses)
Definition: Process.h:1304
lldb_private::Process::GetImageTokens
const std::vector< lldb::addr_t > & GetImageTokens()
Get the image vector for the current process.
Definition: Process.h:744
lldb_private::Process::PreResumeCallbackAndBaton::baton
void * baton
Definition: Process.h:2855
lldb_private::Process::StateChangedIsHijackedForSynchronousResume
bool StateChangedIsHijackedForSynchronousResume()
Definition: Process.cpp:1394
lldb_private::Process::GetWatchpointSupportInfo
virtual Status GetWatchpointSupportInfo(uint32_t &num, bool &after)
Definition: Process.h:1846
lldb_private::Process::WillDestroy
virtual Status WillDestroy()
Definition: Process.h:1167
lldb_private::Process::SettingsTerminate
static void SettingsTerminate()
Definition: Process.cpp:4517
lldb_private::ProcessAttachInfo::m_wait_for_launch
bool m_wait_for_launch
Definition: Process.h:205
lldb_private::StopInfo
Definition: StopInfo.h:20
Error
llvm::Error Error
Definition: UdtRecordCompleter.cpp:29
lldb_private::ProcessInfo::GetExecutableFile
FileSpec & GetExecutableFile()
Definition: ProcessInfo.h:42
lldb_private::Process::PrivateStateThread
static lldb::thread_result_t PrivateStateThread(void *arg)
Definition: Process.cpp:3752
lldb_private::ProcessAttachInfo::ProcessAttachInfo
ProcessAttachInfo()
Definition: Process.h:117
lldb_private::Process::~Process
~Process() override
Destructor.
Definition: Process.cpp:492
lldb_private::Process::ProcessEventData::SetUpdateStateOnRemoval
void SetUpdateStateOnRemoval()
Definition: Process.h:463
lldb_private::Process::GetImagePtrFromToken
lldb::addr_t GetImagePtrFromToken(size_t token) const
Definition: Process.cpp:5830
lldb_private::ProcessProperties::SetExtraStartupCommands
void SetExtraStartupCommands(const Args &args)
Definition: Process.cpp:208
lldb::eStateInvalid
@ eStateInvalid
Definition: lldb-enumerations.h:74
lldb_private::Process::ProcessEventData::m_process_wp
lldb::ProcessWP m_process_wp
Definition: Process.h:473
lldb_private::Process::EnableBreakpointSite
virtual Status EnableBreakpointSite(BreakpointSite *bp_site)
Definition: Process.h:2047
lldb_private::ProcessPropertiesSP
std::shared_ptr< ProcessProperties > ProcessPropertiesSP
Definition: Process.h:109
lldb_private::ProcessProperties::GetExtraStartupCommands
Args GetExtraStartupCommands() const
Definition: Process.cpp:201
lldb_private::Process::WriteObjectFile
virtual Status WriteObjectFile(std::vector< ObjectFile::LoadableData > entries)
Definition: Process.cpp:2285
lldb_private::Process::NextEventAction::eEventActionSuccess
@ eEventActionSuccess
Definition: Process.h:2700
lldb_private::Process::AttachCompletionHandler::PerformAction
EventActionResult PerformAction(lldb::EventSP &event_sp) override
Definition: Process.cpp:2682
lldb_private::Process::PreResumeCallbackAndBaton::operator==
bool operator==(const PreResumeCallbackAndBaton &rhs)
Definition: Process.h:2859
lldb_private::Process::CalculateStackFrame
lldb::StackFrameSP CalculateStackFrame() override
Definition: Process.h:2364
lldb_private::Process::GetABI
const lldb::ABISP & GetABI()
Definition: Process.cpp:1475
lldb_private::Process::Resume
Status Resume()
Resumes all of a process's threads as configured using the Thread run control functions.
Definition: Process.cpp:1330
lldb_private::Process::m_resume_requested
bool m_resume_requested
Definition: Process.h:2957
lldb_private::Process::GetSTDERR
virtual size_t GetSTDERR(char *buf, size_t buf_size, Status &error)
Get any available STDERR.
Definition: Process.cpp:4305
lldb_private::Process::eBroadcastBitStateChanged
@ eBroadcastBitStateChanged
Definition: Process.h:358
lldb_private::Process::CreateBreakpointSite
lldb::break_id_t CreateBreakpointSite(const lldb::BreakpointLocationSP &owner, bool use_hardware)
Definition: Process.cpp:1606
lldb_private::QueueList
Definition: QueueList.h:28
lldb_private::Process::m_thread_list_real
ThreadList m_thread_list_real
The threads for this process as are known to the protocol we are debugging with.
Definition: Process.h:2897
lldb_private::ThreadSafeValue< lldb::StateType >
lldb_private::Process::ReadUnsignedIntegerFromMemory
uint64_t ReadUnsignedIntegerFromMemory(lldb::addr_t load_addr, size_t byte_size, uint64_t fail_value, Status &error)
Reads an unsigned integer of the specified byte size from process memory.
Definition: Process.cpp:2100
lldb::StateType
StateType
Process and Thread States.
Definition: lldb-enumerations.h:73
lldb_private::Process::ProcessEventHijacker::m_process
Process & m_process
Definition: Process.h:2220
lldb_private::Process::GetByteOrder
lldb::ByteOrder GetByteOrder() const
Definition: Process.cpp:3336
lldb_private::Process::GetSharedCacheInfo
virtual lldb_private::StructuredData::ObjectSP GetSharedCacheInfo()
Definition: Process.h:1315
lldb_private::Process::AttachCompletionHandler::m_exec_count
uint32_t m_exec_count
Definition: Process.h:2738
lldb_private::Process::m_stdout_data
std::string m_stdout_data
Remember if stdin must be forwarded to remote debug server.
Definition: Process.h:2940
lldb_private::PluginInterface::GetPluginName
virtual ConstString GetPluginName()=0
lldb_private::Process::DisableWatchpoint
virtual Status DisableWatchpoint(Watchpoint *wp, bool notify=true)
Definition: Process.cpp:2439
lldb_private::Process::m_thread_id_to_index_id_map
std::map< uint64_t, uint32_t > m_thread_id_to_index_id_map
Definition: Process.h:2891
lldb_private::DynamicCheckerFunctions
Encapsulates dynamic check functions used by expressions.
Definition: DynamicCheckerFunctions.h:30
lldb_private::Predicate::GetValue
T GetValue() const
Value get accessor.
Definition: Predicate.h:71
lldb_private::Process::ReadPointerFromMemory
lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error)
Definition: Process.cpp:2122
lldb_private::ProcessProperties
Definition: Process.h:68
lldb_private::ProcessModID::GetResumeID
uint32_t GetResumeID() const
Definition: Process.h:264
lldb_private::ProcessAttachInfo::GetWaitForLaunch
bool GetWaitForLaunch() const
Definition: Process.h:134
lldb_private::bits
static uint32_t bits(const uint32_t val, const uint32_t msbit, const uint32_t lsbit)
Definition: ARMUtils.h:264
lldb_private::Process::m_stdio_communication_mutex
std::recursive_mutex m_stdio_communication_mutex
Definition: Process.h:2937
lldb_private::UtilityFunctionScope::UtilityFunctionScope
UtilityFunctionScope(Process *p)
Definition: Process.h:3106
lldb_private::Process::GetFileLoadAddress
virtual Status GetFileLoadAddress(const FileSpec &file, bool &is_loaded, lldb::addr_t &load_addr)
Try to find the load address of a file.
Definition: Process.h:2451
lldb_private::Process::ProcessEventData::GetFlavor
ConstString GetFlavor() const override
Definition: Process.cpp:3904
lldb_private::Process::SetCanJIT
void SetCanJIT(bool can_jit)
Sets whether executing JIT-compiled code in this process is possible.
Definition: Process.cpp:2359
lldb_private::ProcessModID::IsRunningUtilityFunction
bool IsRunningUtilityFunction() const
Definition: Process.h:257
lldb_private::Process::RunThreadPlan
lldb::ExpressionResults RunThreadPlan(ExecutionContext &exe_ctx, lldb::ThreadPlanSP &thread_plan_sp, const EvaluateExpressionOptions &options, DiagnosticManager &diagnostic_manager)
Definition: Process.cpp:4651
lldb_private::Process::m_resolved_indirect_addresses
std::map< lldb::addr_t, lldb::addr_t > m_resolved_indirect_addresses
This helps with the Public event coalescing in ShouldBroadcastEvent.
Definition: Process.h:2979
lldb_private::ProcessAttachInfo::GetDetachOnError
bool GetDetachOnError() const
Definition: Process.h:187
lldb_private::ArchSpec::Clear
void Clear()
Clears the object state.
Definition: ArchSpec.cpp:527
lldb_private::Process::NextEventAction::EventActionResult
EventActionResult
Definition: Process.h:2699
lldb_private::Process::DidFork
virtual void DidFork(lldb::pid_t child_pid, lldb::tid_t child_tid)
Called after a reported fork.
Definition: Process.h:996
lldb_private::Broadcaster
Definition: Broadcaster.h:242
lldb_private::Process::GetStopID
uint32_t GetStopID() const
Definition: Process.h:1373
lldb_private::ProcessModID::operator==
friend bool operator==(const ProcessModID &lhs, const ProcessModID &rhs)
Definition: Process.h:329
lldb_private::ProcessAttachInfo::GetHijackListener
lldb::ListenerSP GetHijackListener() const
Definition: Process.h:181
lldb_private::Process::GetLoadImageUtilityFunction
UtilityFunction * GetLoadImageUtilityFunction(Platform *platform, llvm::function_ref< std::unique_ptr< UtilityFunction >()> factory)
Get the cached UtilityFunction that assists in loading binary images into the process.
Definition: Process.cpp:6038
lldb_private::Process::GetPluginCommandObject
virtual CommandObject * GetPluginCommandObject()
Return a multi-word command object that can be used to expose plug-in specific commands.
Definition: Process.h:588
lldb_private::Process::m_private_state_control_broadcaster
Broadcaster m_private_state_control_broadcaster
Definition: Process.h:2876
MemoryTagManager.h
lldb_private::Process::m_profile_data_comm_mutex
std::recursive_mutex m_profile_data_comm_mutex
Definition: Process.h:2942
lldb_private::Process::ProcessEventData::SetRestarted
void SetRestarted(bool new_value)
Definition: Process.h:465
lldb_private::Process::GetTarget
const Target & GetTarget() const
Get the const target object pointer for this module.
Definition: Process.h:1221
lldb_private::Process::ProcessEventData::DoOnRemoval
void DoOnRemoval(Event *event_ptr) override
Definition: Process.cpp:4016
lldb_private::Process::FindPlugin
static lldb::ProcessSP FindPlugin(lldb::TargetSP target_sp, llvm::StringRef plugin_name, lldb::ListenerSP listener_sp, const FileSpec *crash_file_path, bool can_connect)
Find a Process plug-in that can debug module using the currently selected architecture.
Definition: Process.cpp:356
lldb_private::Process::UpdateQueueListIfNeeded
void UpdateQueueListIfNeeded()
Definition: Process.cpp:1252
lldb_private::Process::SetCanRunCode
void SetCanRunCode(bool can_run_code)
Sets whether executing code in this process is possible.
Definition: Process.cpp:2363
lldb_private::ProcessModID::IsLastResumeForUserExpression
bool IsLastResumeForUserExpression() const
Definition: Process.h:281
lldb_private::Process::AttachCompletionHandler::AttachCompletionHandler
AttachCompletionHandler(Process *process, uint32_t exec_count)
Definition: Process.cpp:2671
lldb_private::Process::m_warnings_issued
WarningsCollection m_warnings_issued
Definition: Process.h:2984
lldb_private::ProcessProperties::GetVirtualAddressableBits
uint32_t GetVirtualAddressableBits() const
Definition: Process.cpp:218
lldb_private::Process::SyncIOHandler
void SyncIOHandler(uint32_t iohandler_id, const Timeout< std::micro > &timeout)
Waits for the process state to be running within a given msec timeout.
Definition: Process.cpp:625
lldb_private::ProcessAttachInfo::SetWaitForLaunch
void SetWaitForLaunch(bool b)
Definition: Process.h:136
lldb_private::Process::eCanJITDontKnow
@ eCanJITDontKnow
Definition: Process.h:2989
TraceGDBRemotePackets.h
lldb_private::BreakpointSiteList
Definition: BreakpointSiteList.h:23
QueueList.h
lldb_private::ProcessModID::~ProcessModID
~ProcessModID()=default
lldb_private::Process::BroadcastStructuredData
void BroadcastStructuredData(const StructuredData::ObjectSP &object_sp, const lldb::StructuredDataPluginSP &plugin_sp)
Broadcasts the given structured data object from the given plugin.
Definition: Process.cpp:4245
lldb_private::Process::GetDataAddressMask
lldb::addr_t GetDataAddressMask()
Definition: Process.cpp:5612
lldb_private::Process::m_private_run_lock
ProcessRunLock m_private_run_lock
Definition: Process.h:2955
lldb_private::Process::SetSTDIOFileDescriptor
void SetSTDIOFileDescriptor(int file_descriptor)
Definition: Process.cpp:4465
lldb_private::Process::WriteMemoryTags
Status WriteMemoryTags(lldb::addr_t addr, size_t len, const std::vector< lldb::addr_t > &tags)
Write memory tags for a range of memory.
Definition: Process.cpp:6146
lldb_private::Process::PausePrivateStateThread
void PausePrivateStateThread()
Definition: Process.cpp:3550
lldb_private::Process::GetProcessInfo
virtual bool GetProcessInfo(ProcessInstanceInfo &info)
Definition: Process.cpp:5783
lldb_private::Process::PeekAtStateChangedEvents
Event * PeekAtStateChangedEvents()
Definition: Process.cpp:979
lldb_private::Process::GetStateChangedEvents
lldb::StateType GetStateChangedEvents(lldb::EventSP &event_sp, const Timeout< std::micro > &timeout, lldb::ListenerSP hijack_listener)
Definition: Process.cpp:955
lldb_private::Process::PreResumeActionCallback
bool() PreResumeActionCallback(void *)
Definition: Process.h:2389
lldb_private::Process::DoResume
virtual Status DoResume()
Resumes all of a process's threads as configured using the Thread run control functions.
Definition: Process.h:1065
lldb::DescriptionLevel
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
Definition: lldb-enumerations.h:207
lldb_private::Process::CalculateExecutionContext
void CalculateExecutionContext(ExecutionContext &exe_ctx) override
Reconstruct the object's execution context into sc.
Definition: Process.cpp:4198
lldb_private::UtilityFunction
Definition: UtilityFunction.h:30
lldb_private::Process::NextEventAction::HandleBeingUnshipped
virtual void HandleBeingUnshipped()
Definition: Process.h:2710
lldb_private::ProcessAttachInfo::ProcessInfoSpecified
bool ProcessInfoSpecified() const
Definition: Process.h:171
lldb_private::Process::ProcessEventData::GetRestartedReasonAtIndex
const char * GetRestartedReasonAtIndex(size_t idx)
Definition: Process.h:424
lldb_private::Process::GetLoadAddressPermissions
virtual bool GetLoadAddressPermissions(lldb::addr_t load_addr, uint32_t &permissions)
Attempt to get the attributes for a region of memory in the process.
Definition: Process.cpp:2408
lldb::tid_t
uint64_t tid_t
Definition: lldb-types.h:86
lldb::InstrumentationRuntimeType
InstrumentationRuntimeType
Definition: lldb-enumerations.h:485
lldb::ByteOrder
ByteOrder
Byte ordering definitions.
Definition: lldb-enumerations.h:138
lldb_private::Process::ProcessEventData::operator=
const ProcessEventData & operator=(const ProcessEventData &)=delete
lldb_private::Process::ProcessEventData::ShouldStop
virtual bool ShouldStop(Event *event_ptr, bool &found_valid_stopinfo)
Definition: Process.cpp:3908
lldb_private::FunctionCaller
Definition: FunctionCaller.h:56
lldb_private::Process::StopPrivateStateThread
void StopPrivateStateThread()
Definition: Process.cpp:3558
lldb_private::Process::CalculateThread
lldb::ThreadSP CalculateThread() override
Definition: Process.h:2362
lldb_private::Process::ResetImageToken
void ResetImageToken(size_t token)
Definition: Process.cpp:5836
lldb_private::Process::m_clear_thread_plans_on_stop
bool m_clear_thread_plans_on_stop
Definition: Process.h:2974
lldb_private::Process::WillSignal
virtual Status WillSignal()
Called before sending a signal to a process.
Definition: Process.h:1153
lldb_private::Process::m_jit_loaders_up
lldb::JITLoaderListUP m_jit_loaders_up
Definition: Process.h:2924
lldb_private::ProcessAttachInfo::m_ignore_existing
bool m_ignore_existing
Definition: Process.h:206
lldb_private::Process::DisableBreakpointSite
virtual Status DisableBreakpointSite(BreakpointSite *bp_site)
Definition: Process.h:2055