Go to the documentation of this file.
9 #ifndef LLDB_TARGET_PROCESS_H
10 #define LLDB_TARGET_PROCESS_H
12 #include "lldb/Host/Config.h"
21 #include <unordered_set>
55 #include "llvm/ADT/ArrayRef.h"
56 #include "llvm/Support/Threading.h"
57 #include "llvm/Support/VersionTuple.h"
61 template <
typename B,
typename S>
struct Range;
121 ProcessInfo::operator=(launch_info);
298 "Called SetRunningUtilityFunction(false) without calling "
299 "SetRunningUtilityFunction(true) before?");
311 return lldb::EventSP();
338 class Process :
public std::enable_shared_from_this<Process>,
392 void (*initialize)(
void *baton,
Process *process);
393 void (*process_state_changed)(
void *baton,
Process *process,
498 static lldb::ProcessSP
FindPlugin(lldb::TargetSP target_sp,
499 llvm::StringRef plugin_name,
500 lldb::ListenerSP listener_sp,
544 virtual bool CanDebug(lldb::TargetSP target,
545 bool plugin_specified_by_name) = 0;
599 error.SetErrorStringWithFormatv(
600 "error: {0} does not support loading core files.",
GetPluginName());
633 llvm::function_ref<std::unique_ptr<UtilityFunction>()> factory);
663 return llvm::make_error<llvm::StringError>(
"Not implemented.",
664 llvm::inconvertibleErrorCode());
671 return llvm::createStringError(llvm::inconvertibleErrorCode(),
683 virtual llvm::Expected<bool>
SaveCore(llvm::StringRef outfile);
839 Status Halt(
bool clear_thread_plans =
false,
bool use_run_lock =
true);
906 bool wait_for_launch);
915 bool wait_for_launch) {
928 error.SetErrorString(
"remote connections are not supported");
949 error.SetErrorStringWithFormatv(
950 "error: {0} does not support attaching to a process by pid",
972 error.SetErrorString(
"attach by name is not supported");
1039 error.SetErrorStringWithFormatv(
1040 "error: {0} does not support launching processes",
GetPluginName());
1074 error.SetErrorStringWithFormatv(
1075 "error: {0} does not support resuming processes",
GetPluginName());
1109 error.SetErrorStringWithFormatv(
1110 "error: {0} does not support halting processes",
GetPluginName());
1135 error.SetErrorStringWithFormatv(
1136 "error: {0} does not support detaching from processes",
1166 error.SetErrorStringWithFormatv(
1167 "error: {0} does not support sending signals to processes",
1310 const std::vector<lldb::addr_t> &load_addresses) {
1416 virtual bool SetExitStatus(
int exit_status,
const char *cstr);
1543 size_t byte_size, uint64_t fail_value,
1574 error.SetErrorStringWithFormatv(
1575 "error: {0} does not support writing to processes",
GetPluginName());
1612 bool is_signed,
Scalar &scalar,
1657 error.SetErrorStringWithFormatv(
1658 "error: {0} does not support allocating in the debug process",
1740 virtual llvm::Expected<std::vector<lldb::addr_t>>
1764 const std::vector<lldb::addr_t> &tags);
1823 error.SetErrorString(
"Process::GetWatchpointSupportInfo() not supported");
1831 error.SetErrorString(
"Process::GetWatchpointSupportInfo() not supported");
1837 size_t size_to_read = 512);
1910 error.SetErrorStringWithFormatv(
1911 "error: {0} does not support deallocating in the debug process",
2006 error.SetErrorString(
"stdin unsupported");
2030 error.SetErrorStringWithFormatv(
2031 "error: {0} does not support enabling breakpoints",
GetPluginName());
2037 error.SetErrorStringWithFormatv(
2038 "error: {0} does not support disabling breakpoints",
GetPluginName());
2073 lldb::BreakpointSiteSP &bp_site_sp);
2142 lldb::EventSP *event_sp_ptr =
nullptr,
2143 bool wait_always =
true,
2144 lldb::ListenerSP hijack_listener = lldb::ListenerSP(),
2145 Stream *stream =
nullptr,
bool use_run_lock =
true);
2185 bool &pop_process_io_handler);
2227 const lldb::ABISP &
GetABI();
2291 bool condense_trivial,
bool skip_unreported_plans);
2311 bool internal,
bool condense_trivial,
2312 bool skip_unreported_plans);
2344 return lldb::StackFrameSP();
2383 Status return_error(
"Sending an event is not supported for this process.");
2384 return return_error;
2389 lldb::InstrumentationRuntimeSP
2414 const llvm::Triple &triple) {}
2432 return Status(
"Not supported");
2514 const lldb::StructuredDataPluginSP &plugin_sp);
2526 lldb::StructuredDataPluginSP
2534 Process(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp);
2538 Process(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,
2539 const lldb::UnixSignalsSP &unix_signals_sp);
2561 return llvm::make_error<UnimplementedError>();
2573 return llvm::make_error<UnimplementedError>();
2585 return llvm::make_error<UnimplementedError>();
2596 virtual llvm::Expected<std::vector<uint8_t>>
2598 return llvm::make_error<UnimplementedError>();
2604 bool trap_exceptions =
false);
2661 return Status(
"Process::DoGetMemoryRegionInfo() not supported");
2803 virtual llvm::Expected<std::vector<uint8_t>>
2805 return llvm::createStringError(
2806 llvm::inconvertibleErrorCode(),
2807 llvm::formatv(
"{0} does not support reading memory tags",
2830 const std::vector<uint8_t> &tags) {
2838 typedef std::map<lldb::LanguageType, lldb::LanguageRuntimeSP>
2853 std::map<ConstString, lldb::StructuredDataPluginSP>;
2981 uint8_t *buf)
const;
3072 lldb::EventSP &event_sp);
3096 #endif // LLDB_TARGET_PROCESS_H
void SetDetachOnError(bool enable)
void MapSupportedStructuredDataPlugins(const StructuredData::Array &supported_type_names)
Loads any plugins associated with asynchronous structured data and maps the relevant supported type n...
bool IsValid() const
Return whether this object is valid (i.e.
virtual llvm::Error LoadModules()
Sometimes processes know how to retrieve and load shared libraries.
const char * GetExitString() override
enum lldb_private::Process::@32 m_can_jit
std::chrono::seconds GetInterruptTimeout() const
ProcessRunLock::ProcessRunLocker StopLocker
bool GetDetachOnError() const
const Process & operator=(const Process &)=delete
uint32_t m_process_unique_id
Each lldb_private::Process class that is created gets a unique integer ID that increments with each n...
void PrintWarningOptimization(const SymbolContext &sc)
Print a user-visible warning about a module being built with optimization.
bool StartPrivateStateThread(bool is_secondary_thread=false)
bool GetDisableMemoryCache() const
std::vector< std::string > m_restarted_reasons
bool m_can_interpret_function_calls
std::vector< std::string > m_profile_data
void SetOSPluginReportsAllThreads(bool does_report)
ThreadSafeValue< lldb::StateType > m_public_state
std::weak_ptr< Target > m_target_wp
The target that owns this process.
uint32_t GetStopID() const
bool GetShouldDetach() const
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)
lldb::addr_t AllocateMemory(size_t size, uint32_t permissions, Status &error)
The public interface to allocating memory in the process.
void SetStopEventForLastNaturalStopID(lldb::EventSP event_sp)
OperatingSystem * GetOperatingSystem()
Status DeallocateMemory(lldb::addr_t ptr)
The public interface to deallocating memory in the process.
void GetStatus(Stream &ostrm)
AllocatedMemoryCache m_allocated_memory_cache
virtual void DidAttach(ArchSpec &process_arch)
Called after attaching a process.
bool GetWarningsOptimization() const
virtual void RefreshStateAfterStop()=0
Currently called as part of ShouldStop.
ProcessProperties(lldb_private::Process *process)
ThreadList m_thread_list
The threads for this process as the user will see them.
virtual bool DestroyRequiresHalt()
void SetResumeCount(uint32_t c)
jLLDBTraceGetBinaryData gdb-remote packet
bool PrivateStateThreadIsValid() const
Status StopForDestroyOrDetach(lldb::EventSP &exit_event_sp)
virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Status &error)
Read of memory from a process.
QueueIterable Queues()
Iterate over the list of queues.
void SendAsyncInterrupt()
Process(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp)
Construct with a shared pointer to a target, and the Process listener.
#define LLDB_INVALID_PROCESS_ID
uint32_t GetResumeID() const
size_t RemoveBreakpointOpcodesFromBuffer(lldb::addr_t addr, size_t size, uint8_t *buf) const
MemoryCache m_memory_cache
static bool GetInterruptedFromEvent(const Event *event_ptr)
void SetInterrupted(bool new_value)
size_t ReadScalarIntegerFromMemory(lldb::addr_t addr, uint32_t byte_size, bool is_signed, Scalar &scalar, Status &error)
static lldb::StateType GetStateFromEvent(const Event *event_ptr)
virtual void DidVForkDone()
Called after reported vfork completion.
bool ProcessIOHandlerExists() const
void SetRunningUserExpression(bool on)
bool GetContinueOnceAttached() const
A notification structure that can be used by clients to listen for changes in a process's lifetime.
FileSpec GetPythonOSPluginPath() const
virtual JITLoaderList & GetJITLoaders()
@ eBroadcastInternalStateControlResume
std::atomic< bool > m_finalizing
This is set at the beginning of Process::Finalize() to stop functions from looking up or creating thi...
ConstString & GetBroadcasterClass() const override
This needs to be filled in if you are going to register the broadcaster with the broadcaster manager ...
bool GetEventsPrivate(lldb::EventSP &event_sp, const Timeout< std::micro > &timeout, bool control_only)
virtual void DidSignal()
Called after sending a signal to a process.
virtual ArchSpec GetSystemArchitecture()
Get the system architecture for this process.
virtual lldb::addr_t DoAllocateMemory(size_t size, uint32_t permissions, Status &error)
Actually allocate memory in the process.
ThreadSafeValue< lldb::StateType > m_private_state
Status WillAttachToProcessWithName(const char *process_name, bool wait_for_launch)
Called before attaching to a process.
bool m_force_next_event_delivery
uint32_t m_extended_thread_stop_id
The natural stop id when extended_thread_list was last updated.
const char * GetExitDescription()
Get a textual description of what the process exited.
bool MemoryIDEqual(const ProcessModID &compare) const
lldb::StateType GetPrivateState()
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.
uint32_t GetLastNaturalStopID() const
Status PrivateResume()
The "private" side of resuming a process.
ExpressionResults
The results of expression evaluation.
Predicate< uint32_t > m_iohandler_sync
~ProcessProperties() override
virtual Status EnableSoftwareBreakpoint(BreakpointSite *bp_site)
virtual void ModulesDidLoad(ModuleList &module_list)
void PruneThreadPlans()
Prune ThreadPlanStacks for all unreported threads.
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.
bool GetOSPluginReportsAllThreads() const
QueueList & GetQueueList()
std::unique_ptr< ProcessExperimentalProperties > m_experimental_properties_up
ProcessEventHijacker(Process &process, lldb::ListenerSP listener_sp)
bool RemoveInvalidMemoryRange(const LoadRange ®ion)
lldb::StateType m_last_broadcast_state
const ProcessModID & GetModIDRef() const
Status GetMemoryRegionInfo(lldb::addr_t load_addr, MemoryRegionInfo &range_info)
Locate the memory region that contains load_addr.
const ProcessModID & operator=(const ProcessModID &rhs)
void SetDisableLangRuntimeUnwindPlans(bool disable)
lldb::StateType GetStateChangedEventsPrivate(lldb::EventSP &event_sp, const Timeout< std::micro > &timeout)
virtual bool CanDebug(lldb::TargetSP target, bool plugin_specified_by_name)=0
Check if a plug-in instance can debug the file in module.
void SetDynamicLoader(lldb::DynamicLoaderUP dyld)
std::string m_plugin_name
void SetCodeAddressMask(lldb::addr_t code_address_mask)
std::chrono::seconds GetUtilityExpressionTimeout() const
Status WillLaunch(Module *module)
Called before launching to a process.
lldb::ModuleSP ReadModuleFromMemory(const FileSpec &file_spec, lldb::addr_t header_addr, size_t size_to_read=512)
void SetDynamicCheckers(DynamicCheckerFunctions *dynamic_checkers)
StructuredDataPluginMap m_structured_data_plugin_map
virtual void DidResume()
Called after resuming a process.
virtual llvm::Expected< LoadedModuleInfoList > GetLoadedModuleList()
Query remote GDBServer for a detailed loaded library list.
QueueList m_queue_list
The list of libdispatch queues at a given stop point.
Status ClearBreakpointSiteByID(lldb::user_id_t break_id)
BreakpointSiteList & GetBreakpointSiteList()
lldb::OperatingSystemUP m_os_up
ThreadList & GetThreadList()
virtual Status DoAttachToProcessWithID(lldb::pid_t pid, const ProcessAttachInfo &attach_info)
Attach to an existing process using a process ID.
virtual Status GetMemoryRegions(lldb_private::MemoryRegionInfos ®ion_list)
Obtain all the mapped memory regions within this process.
Target & GetTarget()
Get the target object pointer for this module.
std::map< lldb::InstrumentationRuntimeType, lldb::InstrumentationRuntimeSP > InstrumentationRuntimeCollection
LanguageRuntimeCollection m_language_runtimes
Should we detach if the process object goes away with an explicit call to Kill or Detach?
virtual Status ConnectRemote(llvm::StringRef remote_url)
Attach to a remote system via a URL.
virtual bool StopNoticingNewThreads()
Call this to turn off the stop & notice new threads mode.
uint32_t AssignIndexIDToThread(uint64_t thread_id)
void SetStopOnSharedLibraryEvents(bool stop)
LanguageType
Programming language type.
void SetCanInterpretFunctionCalls(bool can_interpret_function_calls)
Sets whether executing function calls using the interpreter is possible for this process.
lldb::ListenerSP GetListener() const
std::string m_stderr_data
int64_t ReadSignedIntegerFromMemory(lldb::addr_t load_addr, size_t byte_size, int64_t fail_value, Status &error)
virtual Status UpdateAutomaticSignalFiltering()
lldb::pid_t GetProcessID() const
lldb::EventSP GetStopEventForStopID(uint32_t stop_id) const
virtual EventActionResult PerformAction(lldb::EventSP &event_sp)=0
bool GetUnwindOnErrorInExpressions() const
void ClearPreResumeAction(PreResumeActionCallback callback, void *baton)
ProcessModID GetModID() const
Get the Modification ID of the process.
lldb::IOHandlerSP m_process_input_reader
virtual Status DoDetach(bool keep_stopped)
Detaches from a running or stopped process.
virtual Status DoConnectRemote(llvm::StringRef remote_url)
Attach to a remote system via a URL.
virtual void DoDidExec()
Subclasses of Process should implement this function if they need to do anything after a process exec...
std::mutex m_exit_status_mutex
Mutex so m_exit_status m_exit_string can be safely accessed from multiple threads.
void SetErrorStringWithFormatv(const char *format, Args &&... args)
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.
virtual bool IsAlive()
Check if a process is still alive.
lldb::DynamicCheckerFunctionsUP m_dynamic_checkers_up
The functions used by the expression parser to validate data that expressions use.
virtual ~NextEventAction()=default
virtual Status DoHalt(bool &caused_stop)
Halts a running process.
virtual llvm::Expected< std::vector< uint8_t > > TraceGetBinaryData(const TraceGetBinaryDataRequest &request)
Get binary data given a trace technology and a data identifier.
void AppendSTDERR(const char *s, size_t len)
lldb::ListenerSP m_private_state_listener_sp
bool GetDetachKeepsStopped() const
void SetID(lldb::pid_t new_pid)
Sets the stored pid.
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.
Status Halt(bool clear_thread_plans=false, bool use_run_lock=true)
Halts a running process.
~ProcessEventData() override
lldb::UnixSignalsSP m_unix_signals_sp
ProcessRunLock & GetRunLock()
bool UpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list)
Update the thread list.
ThreadPlanStack * FindThreadPlans(lldb::tid_t tid)
Find the thread plan stack associated with thread with tid.
void SetPrivateState(lldb::StateType state)
void SetUnwindOnErrorInExpressions(bool ignore)
void SetListener(const lldb::ListenerSP &listener_sp)
void AddRestartedReason(const char *reason)
size_t WriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, Status &error)
Write memory to a process.
bool PopProcessIOHandler()
std::unique_ptr< UtilityFunction > m_dlopen_utility_func_up
void SetContinueOnceAttached(bool b)
virtual StructuredData::DictionarySP GetMetadata()
Fetch process defined metadata.
void PrintWarningUnsupportedLanguage(const SymbolContext &sc)
Print a user-visible warning about a function written in a language that this version of LLDB doesn't...
virtual Status WillDetach()
Called before detaching from a process.
void RestoreProcessEvents()
Restores the process event broadcasting to its normal state.
virtual llvm::Error TraceStart(const llvm::json::Value &request)
Start tracing a process or its threads.
uint32_t m_last_user_expression_resume
void SynchronouslyNotifyStateChanged(lldb::StateType state)
void BroadcastAsyncProfileData(const std::string &one_profile_data)
virtual bool WarnBeforeDetach() const
Before lldb detaches from a process, it warns the user that they are about to lose their debug sessio...
lldb::thread_result_t RunPrivateStateThread(bool is_secondary_thread)
virtual llvm::StringRef GetPluginName()=0
bool GetInterrupted() const
std::map< lldb::LanguageType, lldb::LanguageRuntimeSP > LanguageRuntimeCollection
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.
virtual size_t GetAsyncProfileData(char *buf, size_t buf_size, Status &error)
Get any available profile data.
lldb::InstrumentationRuntimeSP GetInstrumentationRuntime(lldb::InstrumentationRuntimeType type)
virtual void PrefetchModuleSpecs(llvm::ArrayRef< FileSpec > module_file_specs, const llvm::Triple &triple)
virtual void DidExec()
Called after a process re-execs itself.
lldb::StateType GetState()
Get accessor for the current process state.
void SetProcessPluginName(llvm::StringRef plugin)
QueueList::QueueIterable Queues()
size_t ReadMemoryFromInferior(lldb::addr_t vm_addr, void *buf, size_t size, Status &error)
Read of memory from a process.
@ eStateExited
Process has exited and can't be examined.
uint32_t GetIOHandlerID() const
lldb::ListenerSP GetListenerForProcess(Debugger &debugger)
lldb::ListenerSP m_listener_sp
Status Signal(int signal)
Sends a process a UNIX signal signal.
bool CurrentThreadIsPrivateStateThread()
bool CanJIT()
Determines whether executing JIT-compiled code in this process is possible.
uint32_t GetMemoryID() const
void SetRunningUtilityFunction(bool on)
Status DestroyImpl(bool force_kill)
Status DisableBreakpointSiteByID(lldb::user_id_t break_id)
static void SetInterruptedInEvent(Event *event_ptr, bool new_value)
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...
static bool HandleProcessStateChangedEvent(const lldb::EventSP &event_sp, Stream *stream, bool &pop_process_io_handler)
Centralize the code that handles and prints descriptions for process state changes.
FollowForkMode GetFollowForkMode() const
size_t WriteMemoryPrivate(lldb::addr_t addr, const void *buf, size_t size, Status &error)
bool RouteAsyncStructuredData(const StructuredData::ObjectSP object_sp)
Route the incoming structured data dictionary to the right plugin.
bool operator==(const Address &lhs, const Address &rhs)
@ eBroadcastInternalStateControlStop
virtual bool DoUpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list)=0
Update the thread list following process plug-in's specific logic.
virtual lldb::addr_t ResolveIndirectFunction(const Address *address, Status &error)
Resolve dynamically loaded indirect functions.
bool m_continue_once_attached
static llvm::raw_ostream & error(Stream &strm)
virtual llvm::Expected< std::string > TraceGetState(llvm::StringRef type)
Get the current tracing state of the process and its threads.
std::vector< Notifications > m_notifications
The list of notifications that this process can deliver.
void ClearPreResumeActions()
void Flush()
Flush all data in the process.
bool HasAssignedIndexIDToThread(uint64_t sb_thread_id)
lldb::addr_t m_code_address_mask
Mask for code an data addresses.
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.
bool ShouldBroadcastEvent(Event *event_ptr)
This is the part of the event handling that for a process event.
void HandlePrivateEvent(lldb::EventSP &event_sp)
lldb::ProcessSP GetProcessSP() const
virtual const char * GetExitString()=0
bool UnregisterNotificationCallbacks(const Process::Notifications &callbacks)
Unregister for process and thread notifications.
ThreadedCommunication m_stdio_communication
bool CallVoidArgVoidPtrReturn(const Address *address, lldb::addr_t &returned_func, bool trap_exceptions=false)
void SetPythonOSPluginPath(const FileSpec &file)
DynamicCheckerFunctions * GetDynamicCheckers()
ThreadList::ThreadIterable Threads()
size_t GetSoftwareBreakpointTrapOpcode(BreakpointSite *bp_site)
bool GetWarningsUnsupportedLanguage() const
@ eBroadcastBitProfileData
virtual bool IsLiveDebugSession() const
void LoadOperatingSystemPlugin(bool flush)
void SetRunningUtilityFunction(bool on)
static const Process::ProcessEventData * GetEventDataFromEvent(const Event *event_ptr)
virtual Status DoWillAttachToProcessWithName(const char *process_name, bool wait_for_launch)
Called before attaching to a process.
bool GetIgnoreBreakpointsInExpressions() const
static void STDIOReadThreadBytesReceived(void *baton, const void *src, size_t src_len)
virtual llvm::Error TraceStop(const TraceStopRequest &request)
Stop tracing a live process or its threads.
virtual Status DoDestroy()=0
virtual llvm::Expected< TraceSupportedResponse > TraceSupported()
Get the processor tracing type supported for this process.
lldb::EventSP m_last_natural_stop_event
void SetDataAddressMask(lldb::addr_t data_address_mask)
virtual Status DisableSoftwareBreakpoint(BreakpointSite *bp_site)
std::map< ConstString, lldb::StructuredDataPluginSP > StructuredDataPluginMap
int m_exit_status
The exit status of the process, or -1 if not set.
void ForceNextEventDelivery()
NextEventAction(Process *process)
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...
lldb::addr_t GetCodeAddressMask()
static ConstString GetFlavorString()
std::shared_ptr< Object > ObjectSP
Status EnableBreakpointSiteByID(lldb::user_id_t break_id)
lldb::DynamicLoaderUP m_dyld_up
ProcessModID m_mod_id
Tracks the state of the process over stops and other alterations.
static const char * ExecutionResultAsCString(lldb::ExpressionResults result)
virtual bool SetExitStatus(int exit_status, const char *cstr)
Set accessor for the process exit status (return code).
static lldb::ProcessSP GetProcessFromEvent(const Event *event_ptr)
bool GetStopOnExec() const
virtual Status ConfigureStructuredData(ConstString type_name, const StructuredData::ObjectSP &config_sp)
Configure asynchronous structured data feature.
virtual void Finalize()
This object is about to be destroyed, do any necessary cleanup.
virtual bool SupportsMemoryTagging()
Check whether the process supports memory tagging.
static bool GetRestartedFromEvent(const Event *event_ptr)
virtual llvm::VersionTuple GetHostMacCatalystVersion()
uint32_t GetNextThreadIndexID(uint64_t thread_id)
void RemoveOwnerFromBreakpointSite(lldb::user_id_t owner_id, lldb::user_id_t owner_loc_id, lldb::BreakpointSiteSP &bp_site_sp)
uint32_t GetAddressByteSize() const
void AddPreResumeAction(PreResumeActionCallback callback, void *baton)
Status Destroy(bool force_kill)
Kills the process and shuts down all threads that were spawned to track and monitor the process.
virtual llvm::Expected< bool > SaveCore(llvm::StringRef outfile)
Save core dump into the specified file.
lldb::StateType GetState() const
virtual DataExtractor GetAuxvData()
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 ThreadIterable Threads()
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 ().
std::unique_ptr< NextEventAction > m_next_event_action_up
bool GetSteppingRunsAllThreads() const
void UpdateThreadListIfNeeded()
uint32_t m_queue_list_stop_id
The natural stop id when queue list was last fetched.
std::mutex m_run_thread_plan_lock
uint32_t GetLastNaturalStopID() const
lldb::ABISP m_abi_sp
This is the current signal set for this process.
ProcessRunLock m_public_run_lock
static ProcessProperties & GetGlobalProperties()
lldb::ListenerSP GetListener() const
@ eStateDetached
Process has been detached and can't be examined.
virtual size_t PutSTDIN(const char *buf, size_t buf_size, Status &error)
Puts data into this process's STDIN.
std::shared_ptr< Dictionary > DictionarySP
EventActionResult HandleBeingInterrupted() override
llvm::Expected< const MemoryTagManager * > GetMemoryTagManager()
If this architecture and process supports memory tagging, return a tag manager that can be used to ma...
virtual Status Attach(ProcessAttachInfo &attach_info)
Attach to an existing process using the process attach info.
void SetHijackListener(const lldb::ListenerSP &listener_sp)
std::recursive_mutex m_thread_mutex
llvm::once_flag m_dlopen_utility_func_flag_once
HostThread m_private_state_thread
Thread ID for the thread that watches internal state events.
lldb::ThreadCollectionSP GetHistoryThreads(lldb::addr_t addr)
Status ResumeSynchronous(Stream *stream)
bool PruneThreadPlansForTID(lldb::tid_t tid)
Prune ThreadPlanStacks for unreported threads.
virtual bool StartNoticingNewThreads()
Call this to set the lldb in the mode where it breaks on new thread creations, and then auto-restarts...
virtual Status WillResume()
Called before resuming to a process.
virtual DynamicLoader * GetDynamicLoader()
Get the dynamic loader plug-in for this process.
bool m_currently_handling_do_on_removals
string(SUBSTRING ${p} 10 -1 pStripped) if($
uint32_t m_running_utility_function
~AttachCompletionHandler() override=default
bool GetRestarted() const
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...
std::string m_exit_string
A textual description of why a process exited.
void SetUnixSignals(lldb::UnixSignalsSP &&signals_sp)
virtual void DidHalt()
Called after halting a process.
virtual void DidLaunch()
Called after launching a process.
const lldb::UnixSignalsSP & GetUnixSignals()
ProcessAttachInfo()=default
virtual Status SendEventData(const char *data)
virtual Status WillHalt()
Called before halting to a process.
void ResumePrivateStateThread()
bool operator!=(const Address &lhs, const Address &rhs)
@ eBroadcastInternalStateControlPause
void SetShouldDetach(bool b)
void SetNextEventAction(Process::NextEventAction *next_event_action)
std::vector< LanguageRuntime * > GetLanguageRuntimes()
int GetExitStatus()
Get the exit status for a process.
void ControlPrivateStateThread(uint32_t signal)
ProcessModID(const ProcessModID &rhs)
void AddInvalidMemoryRegion(const LoadRange ®ion)
uint32_t m_last_natural_stop_id
lldb::TargetSP CalculateTarget() override
static void SettingsInitialize()
uint32_t GetResumeCount() const
lldb::EventSP GetStopEventForStopID(uint32_t stop_id) const
bool GetDisableLangRuntimeUnwindPlans() const
virtual Status DoSignal(int signal)
Sends a process a UNIX signal signal.
uint32_t m_running_user_expression
ThreadList & GetExtendedThreadList()
virtual bool DetachRequiresHalt()
jLLDBTraceStop gdb-remote packet
virtual lldb_private::StructuredData::ObjectSP GetDynamicLoaderProcessState()
virtual Status GetWatchpointSupportInfo(uint32_t &num)
lldb::ThreadSP CreateOSPluginThread(lldb::tid_t tid, lldb::addr_t context)
Range< lldb::addr_t, lldb::addr_t > LoadRange
static void AddRestartedReason(Event *event_ptr, const char *reason)
size_t GetNumRestartedReasons()
const char * GetProcessPluginName() const
virtual size_t GetSTDOUT(char *buf, size_t buf_size, Status &error)
Get any available STDOUT.
void SetIgnoreBreakpointsInExpressions(bool ignore)
lldb::pid_t GetParentProcessID() const
uint32_t GetUniqueID() const
bool IsPossibleDynamicValue(ValueObject &in_value)
void SetPublicState(lldb::StateType new_state, bool restarted)
static void SetRestartedInEvent(Event *event_ptr, bool new_value)
uint32_t GetResumeCount() const
lldb::ListenerSP m_hijack_listener_sp
uint32_t GetLastUserExpressionResumeID() const
virtual llvm::VersionTuple GetHostOSVersion()
Sometimes the connection to a process can detect the host OS version that the process is running on.
Broadcaster m_private_state_broadcaster
void SetRunningUserExpression(bool on)
bool StateChangedIsExternallyHijacked()
virtual lldb_private::StructuredData::ObjectSP GetLoadedDynamicLibrariesInfos()
virtual Status DoWillAttachToProcessWithID(lldb::pid_t pid)
Called before attaching to a process.
virtual Status DoAttachToProcessWithName(const char *process_name, const ProcessAttachInfo &attach_info)
Attach to an existing process using a partial process name.
std::recursive_mutex m_language_runtimes_mutex
ThreadList m_extended_thread_list
Owner for extended threads that may be generated, cleared on natural stops.
bool StopIDEqual(const ProcessModID &compare) const
lldb::StateType WaitForProcessStopPrivate(lldb::EventSP &event_sp, const Timeout< std::micro > &timeout)
virtual Status DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info)
Launch a new process.
BreakpointSiteList m_breakpoint_site_list
This is the list of breakpoint locations we intend to insert in the target.
bool GetStopOnSharedLibraryEvents() const
virtual SystemRuntime * GetSystemRuntime()
Get the system runtime plug-in for this process.
size_t AddImageToken(lldb::addr_t image_ptr)
void SetDetachKeepsStopped(bool keep_stopped)
PreResumeCallbackAndBaton(PreResumeActionCallback in_callback, void *in_baton)
InstrumentationRuntimeCollection m_instrumentation_runtimes
const char * GetProcessPluginName() const
virtual Status Launch(ProcessLaunchInfo &launch_info)
Launch a new process.
lldb::SystemRuntimeUP m_system_runtime_up
void SetVirtualAddressableBits(uint32_t bits)
bool GetIgnoreExisting() const
virtual EventActionResult HandleBeingInterrupted()=0
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.
virtual Status EnableWatchpoint(Watchpoint *wp, bool notify=true)
lldb::StateType GetNextEvent(lldb::EventSP &event_sp)
void RegisterNotificationCallbacks(const Process::Notifications &callbacks)
Register for process and thread notifications.
void SetIgnoreExisting(bool b)
LanguageRuntime * GetLanguageRuntime(lldb::LanguageType language)
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)
Status Detach(bool keep_stopped)
Detaches from a running or stopped process.
Address AdvanceAddressToNextBranchInstruction(Address default_stop_addr, AddressRange range_bounds)
Find the next branch instruction to set a breakpoint on.
uint32_t m_thread_index_id
Each thread is created with a 1 based index that won't get re-used.
lldb::addr_t m_data_address_mask
std::vector< lldb::addr_t > m_image_tokens
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.
lldb::StructuredDataPluginSP GetStructuredDataPlugin(ConstString type_name) const
Returns the StructuredDataPlugin associated with a given type name, if there is one.
bool CanInterpretFunctionCalls()
Determines whether executing function calls using the interpreter is possible for this process.
virtual void DidVFork(lldb::pid_t child_pid, lldb::tid_t child_tid)
Called after a reported vfork.
lldb::ProcessSP CalculateProcess() override
RAII guard that should be acquired when an utility function is called within a given process.
void AppendSTDOUT(const char *s, size_t len)
lldb::ListenerSP GetHijackListener() const
void Dump(Stream *s) const override
virtual void WillPublicStop()
Called when the process is about to broadcast a public stop.
bool WritePointerToMemory(lldb::addr_t vm_addr, lldb::addr_t ptr_value, Status &error)
bool PushProcessIOHandler()
#define LLDB_INVALID_ADDRESS
std::vector< PreResumeCallbackAndBaton > m_pre_resume_actions
bool RunPreResumeActions()
virtual Status LoadCore()
@ eBroadcastBitStructuredData
static ConstString & GetStaticBroadcasterClass()
void DisableAllBreakpointSites()
lldb::pid_t GetID() const
Returns the pid of the process or LLDB_INVALID_PROCESS_ID if there is no known pid.
virtual void DidDetach()
Called after detaching from a process.
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.
lldb::ListenerSP m_listener_sp
Shared pointer to the listener used for public events.
ProcessExperimentalProperties()
ThreadPlanStackMap m_thread_plans
This is the list of thread plans for threads in m_thread_list, as well as threads we knew existed,...
ProcessAttachInfo(const ProcessLaunchInfo &launch_info)
uint32_t GetLastUserExpressionResumeID() const
virtual Status DoDeallocateMemory(lldb::addr_t ptr)
Actually deallocate memory in the process.
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.
bool ProcessIOHandlerIsActive()
virtual void DidDestroy()
virtual Status DoLoadCore()
Status LaunchPrivate(ProcessLaunchInfo &launch_info, lldb::StateType &state, lldb::EventSP &event_sp)
uint64_t GetMemoryCacheLineSize() const
virtual lldb::addr_t GetImageInfoAddress()
Get the image information address for the current process.
A class that represents a running process on the host machine.
bool m_destroy_in_process
std::string m_exit_string
virtual lldb_private::StructuredData::ObjectSP GetLoadedDynamicLibrariesInfos(const std::vector< lldb::addr_t > &load_addresses)
const std::vector< lldb::addr_t > & GetImageTokens()
Get the image vector for the current process.
bool StateChangedIsHijackedForSynchronousResume()
virtual Status GetWatchpointSupportInfo(uint32_t &num, bool &after)
virtual Status WillDestroy()
static void SettingsTerminate()
FileSpec & GetExecutableFile()
~Process() override
Destructor.
void SetUpdateStateOnRemoval()
lldb::addr_t GetImagePtrFromToken(size_t token) const
void SetExtraStartupCommands(const Args &args)
lldb::ProcessWP m_process_wp
virtual Status EnableBreakpointSite(BreakpointSite *bp_site)
Args GetExtraStartupCommands() const
virtual Status WriteObjectFile(std::vector< ObjectFile::LoadableData > entries)
EventActionResult PerformAction(lldb::EventSP &event_sp) override
bool operator==(const PreResumeCallbackAndBaton &rhs)
lldb::StackFrameSP CalculateStackFrame() override
const lldb::ABISP & GetABI()
Status Resume()
Resumes all of a process's threads as configured using the Thread run control functions.
virtual size_t GetSTDERR(char *buf, size_t buf_size, Status &error)
Get any available STDERR.
lldb::break_id_t CreateBreakpointSite(const lldb::BreakpointLocationSP &owner, bool use_hardware)
ThreadList m_thread_list_real
The threads for this process as are known to the protocol we are debugging with.
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.
StateType
Process and Thread States.
lldb::ByteOrder GetByteOrder() const
virtual lldb_private::StructuredData::ObjectSP GetSharedCacheInfo()
std::string m_stdout_data
Remember if stdin must be forwarded to remote debug server.
virtual Status DisableWatchpoint(Watchpoint *wp, bool notify=true)
std::map< uint64_t, uint32_t > m_thread_id_to_index_id_map
Encapsulates dynamic check functions used by expressions.
T GetValue() const
Value get accessor.
lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error)
uint32_t GetResumeID() const
bool GetWaitForLaunch() const
static uint32_t bits(const uint32_t val, const uint32_t msbit, const uint32_t lsbit)
std::recursive_mutex m_stdio_communication_mutex
UtilityFunctionScope(Process *p)
virtual Status GetFileLoadAddress(const FileSpec &file, bool &is_loaded, lldb::addr_t &load_addr)
Try to find the load address of a file.
ConstString GetFlavor() const override
void SetCanJIT(bool can_jit)
Sets whether executing JIT-compiled code in this process is possible.
bool IsRunningUtilityFunction() const
virtual Status DoWillLaunch(Module *module)
Called before launching to a process.
lldb::ExpressionResults RunThreadPlan(ExecutionContext &exe_ctx, lldb::ThreadPlanSP &thread_plan_sp, const EvaluateExpressionOptions &options, DiagnosticManager &diagnostic_manager)
std::map< lldb::addr_t, lldb::addr_t > m_resolved_indirect_addresses
This helps with the Public event coalescing in ShouldBroadcastEvent.
bool GetDetachOnError() const
void Clear()
Clears the object state.
virtual void DidFork(lldb::pid_t child_pid, lldb::tid_t child_tid)
Called after a reported fork.
uint32_t GetStopID() const
friend bool operator==(const ProcessModID &lhs, const ProcessModID &rhs)
lldb::ListenerSP GetHijackListener() const
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.
virtual CommandObject * GetPluginCommandObject()
Return a multi-word command object that can be used to expose plug-in specific commands.
Broadcaster m_private_state_control_broadcaster
@ eBroadcastBitStateChanged
std::recursive_mutex m_profile_data_comm_mutex
void SetRestarted(bool new_value)
const Target & GetTarget() const
Get the const target object pointer for this module.
void DoOnRemoval(Event *event_ptr) override
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.
virtual void UpdateQueueListIfNeeded()
void SetCanRunCode(bool can_run_code)
Sets whether executing code in this process is possible.
bool IsLastResumeForUserExpression() const
AttachCompletionHandler(Process *process, uint32_t exec_count)
Status WillAttachToProcessWithID(lldb::pid_t pid)
Called before attaching to a process.
uint32_t GetVirtualAddressableBits() const
void SyncIOHandler(uint32_t iohandler_id, const Timeout< std::micro > &timeout)
Waits for the process state to be running within a given msec timeout.
void SetWaitForLaunch(bool b)
void BroadcastStructuredData(const StructuredData::ObjectSP &object_sp, const lldb::StructuredDataPluginSP &plugin_sp)
Broadcasts the given structured data object from the given plugin.
lldb::addr_t GetDataAddressMask()
ProcessRunLock m_private_run_lock
void SetSTDIOFileDescriptor(int file_descriptor)
Status WriteMemoryTags(lldb::addr_t addr, size_t len, const std::vector< lldb::addr_t > &tags)
Write memory tags for a range of memory.
void PausePrivateStateThread()
virtual bool GetProcessInfo(ProcessInstanceInfo &info)
Event * PeekAtStateChangedEvents()
lldb::StateType GetStateChangedEvents(lldb::EventSP &event_sp, const Timeout< std::micro > &timeout, lldb::ListenerSP hijack_listener)
bool() PreResumeActionCallback(void *)
virtual Status DoResume()
Resumes all of a process's threads as configured using the Thread run control functions.
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
void CalculateExecutionContext(ExecutionContext &exe_ctx) override
Reconstruct the object's execution context into sc.
virtual void HandleBeingUnshipped()
bool ProcessInfoSpecified() const
const char * GetRestartedReasonAtIndex(size_t idx)
virtual bool GetLoadAddressPermissions(lldb::addr_t load_addr, uint32_t &permissions)
Attempt to get the attributes for a region of memory in the process.
InstrumentationRuntimeType
ByteOrder
Byte ordering definitions.
const ProcessEventData & operator=(const ProcessEventData &)=delete
virtual bool ShouldStop(Event *event_ptr, bool &found_valid_stopinfo)
void StopPrivateStateThread()
lldb::ThreadSP CalculateThread() override
void ResetImageToken(size_t token)
bool m_clear_thread_plans_on_stop
virtual Status WillSignal()
Called before sending a signal to a process.
lldb::JITLoaderListUP m_jit_loaders_up
virtual Status DisableBreakpointSite(BreakpointSite *bp_site)