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