LLDB  mainline
ScriptedProcess.cpp
Go to the documentation of this file.
1 //===-- ScriptedProcess.cpp -----------------------------------------------===//
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 #include "ScriptedProcess.h"
10 
11 #include "lldb/Core/Debugger.h"
12 #include "lldb/Core/Module.h"
14 
15 #include "lldb/Host/OptionParser.h"
23 #include "lldb/Utility/LLDBLog.h"
24 #include "lldb/Utility/State.h"
25 
26 #include <mutex>
27 
29 
30 using namespace lldb;
31 using namespace lldb_private;
32 
33 llvm::StringRef ScriptedProcess::GetPluginDescriptionStatic() {
34  return "Scripted Process plug-in.";
35 }
36 
39 };
40 
41 bool ScriptedProcess::IsScriptLanguageSupported(lldb::ScriptLanguage language) {
42  llvm::ArrayRef<lldb::ScriptLanguage> supported_languages =
43  llvm::makeArrayRef(g_supported_script_languages);
44 
45  return llvm::is_contained(supported_languages, language);
46 }
47 
48 void ScriptedProcess::CheckInterpreterAndScriptObject() const {
49  lldbassert(m_interpreter && "Invalid Script Interpreter.");
50  lldbassert(m_script_object_sp && "Invalid Script Object.");
51 }
52 
53 lldb::ProcessSP ScriptedProcess::CreateInstance(lldb::TargetSP target_sp,
54  lldb::ListenerSP listener_sp,
55  const FileSpec *file,
56  bool can_connect) {
57  if (!target_sp ||
58  !IsScriptLanguageSupported(target_sp->GetDebugger().GetScriptLanguage()))
59  return nullptr;
60 
61  Status error;
62  ScriptedProcess::ScriptedProcessInfo scripted_process_info(
63  target_sp->GetProcessLaunchInfo());
64 
65  auto process_sp = std::shared_ptr<ScriptedProcess>(new ScriptedProcess(
66  target_sp, listener_sp, scripted_process_info, error));
67 
68  if (error.Fail() || !process_sp || !process_sp->m_script_object_sp ||
69  !process_sp->m_script_object_sp->IsValid()) {
70  LLDB_LOGF(GetLog(LLDBLog::Process), "%s", error.AsCString());
71  return nullptr;
72  }
73 
74  return process_sp;
75 }
76 
77 bool ScriptedProcess::CanDebug(lldb::TargetSP target_sp,
78  bool plugin_specified_by_name) {
79  return true;
80 }
81 
82 ScriptedProcess::ScriptedProcess(
83  lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,
84  const ScriptedProcess::ScriptedProcessInfo &scripted_process_info,
85  Status &error)
86  : Process(target_sp, listener_sp),
87  m_scripted_process_info(scripted_process_info) {
88 
89  if (!target_sp) {
90  error.SetErrorStringWithFormat("ScriptedProcess::%s () - ERROR: %s",
91  __FUNCTION__, "Invalid target");
92  return;
93  }
94 
95  m_interpreter = target_sp->GetDebugger().GetScriptInterpreter();
96 
97  if (!m_interpreter) {
98  error.SetErrorStringWithFormat("ScriptedProcess::%s () - ERROR: %s",
99  __FUNCTION__,
100  "Debugger has no Script Interpreter");
101  return;
102  }
103 
104  ExecutionContext exe_ctx(target_sp, /*get_process=*/false);
105 
107  m_scripted_process_info.GetClassName().c_str(), exe_ctx,
109 
110  if (!object_sp || !object_sp->IsValid()) {
111  error.SetErrorStringWithFormat("ScriptedProcess::%s () - ERROR: %s",
112  __FUNCTION__,
113  "Failed to create valid script object");
114  return;
115  }
116 
117  m_script_object_sp = object_sp;
118 }
119 
121  Clear();
122  // We need to call finalize on the process before destroying ourselves to
123  // make sure all of the broadcaster cleanup goes as planned. If we destruct
124  // this class, then Process::~Process() might have problems trying to fully
125  // destroy the broadcaster.
126  Finalize();
127 }
128 
130  static llvm::once_flag g_once_flag;
131 
132  llvm::call_once(g_once_flag, []() {
135  });
136 }
137 
140 }
141 
144 
145  return DoLaunch(nullptr, launch_info);
146 }
147 
149  ProcessLaunchInfo &launch_info) {
151 
152  /* FIXME: This doesn't reflect how lldb actually launches a process.
153  In reality, it attaches to debugserver, then resume the process. */
156 
157  if (error.Fail())
158  return error;
159 
160  // TODO: Fetch next state from stopped event queue then send stop event
161  // const StateType state = SetThreadStopInfo(response);
162  // if (state != eStateInvalid) {
163  // SetPrivateState(state);
164 
166 
167  return {};
168 }
169 
174 }
175 
178 
179  Log *log = GetLog(LLDBLog::Process);
180  // FIXME: Fetch data from thread.
181  const StateType thread_resume_state = eStateRunning;
182  LLDB_LOGF(log, "ScriptedProcess::%s thread_resume_state = %s", __FUNCTION__,
183  StateAsCString(thread_resume_state));
184 
185  bool resume = (thread_resume_state == eStateRunning);
186  assert(thread_resume_state == eStateRunning && "invalid thread resume state");
187 
188  Status error;
189  if (resume) {
190  LLDB_LOGF(log, "ScriptedProcess::%s sending resume", __FUNCTION__);
191 
194  error = GetInterface().Resume();
195  }
196 
197  return error;
198 }
199 
202 
203  Log *log = GetLog(LLDBLog::Process);
204 
205  if (GetInterface().ShouldStop()) {
207  LLDB_LOGF(log, "ScriptedProcess::%s Immediate stop", __FUNCTION__);
208  return {};
209  }
210 
211  LLDB_LOGF(log, "ScriptedProcess::%s Delayed stop", __FUNCTION__);
212  return GetInterface().Stop();
213 }
214 
216 
219  return GetInterface().IsAlive();
220  return false;
221 }
222 
223 size_t ScriptedProcess::DoReadMemory(lldb::addr_t addr, void *buf, size_t size,
224  Status &error) {
225  if (!m_interpreter)
226  return ScriptedInterface::ErrorWithMessage<size_t>(
227  LLVM_PRETTY_FUNCTION, "No interpreter.", error);
228 
229  lldb::DataExtractorSP data_extractor_sp =
230  GetInterface().ReadMemoryAtAddress(addr, size, error);
231 
232  if (!data_extractor_sp || !data_extractor_sp->GetByteSize() || error.Fail())
233  return 0;
234 
235  offset_t bytes_copied = data_extractor_sp->CopyByteOrderedData(
236  0, data_extractor_sp->GetByteSize(), buf, size, GetByteOrder());
237 
238  if (!bytes_copied || bytes_copied == LLDB_INVALID_OFFSET)
239  return ScriptedInterface::ErrorWithMessage<size_t>(
240  LLVM_PRETTY_FUNCTION, "Failed to copy read memory to buffer.", error);
241 
242  return size;
243 }
244 
246  return GetTarget().GetArchitecture();
247 }
248 
250  MemoryRegionInfo &region) {
252 
253  Status error;
254  if (auto region_or_err =
255  GetInterface().GetMemoryRegionContainingAddress(load_addr, error))
256  region = *region_or_err;
257 
258  return error;
259 }
260 
263 
264  Status error;
265  lldb::addr_t address = 0;
266 
267  while (auto region_or_err =
268  GetInterface().GetMemoryRegionContainingAddress(address, error)) {
269  if (error.Fail())
270  break;
271 
272  MemoryRegionInfo &mem_region = *region_or_err;
273  auto range = mem_region.GetRange();
274  address += range.GetRangeBase() + range.GetByteSize();
275  region_list.push_back(mem_region);
276  }
277 
278  return error;
279 }
280 
282 
284  ThreadList &new_thread_list) {
285  // TODO: Implement
286  // This is supposed to get the current set of threads, if any of them are in
287  // old_thread_list then they get copied to new_thread_list, and then any
288  // actually new threads will get added to new_thread_list.
289 
292 
293  Status error;
295 
296  if (language != eScriptLanguagePython)
297  return ScriptedInterface::ErrorWithMessage<bool>(
298  LLVM_PRETTY_FUNCTION,
299  llvm::Twine("ScriptInterpreter language (" +
300  llvm::Twine(m_interpreter->LanguageToString(language)) +
301  llvm::Twine(") not supported."))
302  .str(),
303  error);
304 
306 
307  if (!thread_info_sp)
308  return ScriptedInterface::ErrorWithMessage<bool>(
309  LLVM_PRETTY_FUNCTION,
310  "Couldn't fetch thread list from Scripted Process.", error);
311 
312  // Because `StructuredData::Dictionary` uses a `std::map<ConstString,
313  // ObjectSP>` for storage, each item is sorted based on the key alphabetical
314  // order. Since `GetThreadsInfo` provides thread indices as the key element,
315  // thread info comes ordered alphabetically, instead of numerically, so we
316  // need to sort the thread indices before creating thread.
317 
318  StructuredData::ArraySP keys = thread_info_sp->GetKeys();
319 
320  std::map<size_t, StructuredData::ObjectSP> sorted_threads;
321  auto sort_keys = [&sorted_threads,
322  &thread_info_sp](StructuredData::Object *item) -> bool {
323  if (!item)
324  return false;
325 
326  llvm::StringRef key = item->GetStringValue();
327  size_t idx = 0;
328 
329  // Make sure the provided index is actually an integer
330  if (!llvm::to_integer(key, idx))
331  return false;
332 
333  sorted_threads[idx] = thread_info_sp->GetValueForKey(key);
334  return true;
335  };
336 
337  size_t thread_count = thread_info_sp->GetSize();
338 
339  if (!keys->ForEach(sort_keys) || sorted_threads.size() != thread_count)
340  // Might be worth showing the unsorted thread list instead of return early.
341  return ScriptedInterface::ErrorWithMessage<bool>(
342  LLVM_PRETTY_FUNCTION, "Couldn't sort thread list.", error);
343 
344  auto create_scripted_thread =
345  [this, &error, &new_thread_list](
346  const std::pair<size_t, StructuredData::ObjectSP> pair) -> bool {
347  size_t idx = pair.first;
348  StructuredData::ObjectSP object_sp = pair.second;
349 
350  if (!object_sp)
351  return ScriptedInterface::ErrorWithMessage<bool>(
352  LLVM_PRETTY_FUNCTION, "Invalid thread info object", error);
353 
354  auto thread_or_error =
355  ScriptedThread::Create(*this, object_sp->GetAsGeneric());
356 
357  if (!thread_or_error)
358  return ScriptedInterface::ErrorWithMessage<bool>(
359  LLVM_PRETTY_FUNCTION, toString(thread_or_error.takeError()), error);
360 
361  ThreadSP thread_sp = thread_or_error.get();
362  lldbassert(thread_sp && "Couldn't initialize scripted thread.");
363 
364  RegisterContextSP reg_ctx_sp = thread_sp->GetRegisterContext();
365  if (!reg_ctx_sp)
366  return ScriptedInterface::ErrorWithMessage<bool>(
367  LLVM_PRETTY_FUNCTION,
368  llvm::Twine("Invalid Register Context for thread " + llvm::Twine(idx))
369  .str(),
370  error);
371 
372  new_thread_list.AddThread(thread_sp);
373 
374  return true;
375  };
376 
377  llvm::for_each(sorted_threads, create_scripted_thread);
378 
379  return new_thread_list.GetSize(false) > 0;
380 }
381 
383  // Let all threads recover from stopping and do any clean up based on the
384  // previous thread state (if any).
386 }
387 
389  info.Clear();
390  info.SetProcessID(GetID());
392  lldb::ModuleSP module_sp = GetTarget().GetExecutableModule();
393  if (module_sp) {
394  const bool add_exe_file_as_first_arg = false;
395  info.SetExecutableFile(GetTarget().GetExecutableModule()->GetFileSpec(),
396  add_exe_file_as_first_arg);
397  }
398  return true;
399 }
400 
404 
405  Status error;
406  auto error_with_message = [&error](llvm::StringRef message) {
407  return ScriptedInterface::ErrorWithMessage<bool>(LLVM_PRETTY_FUNCTION,
408  message.data(), error);
409  };
410 
412 
413  if (!loaded_images_sp || !loaded_images_sp->GetSize())
414  return ScriptedInterface::ErrorWithMessage<StructuredData::ObjectSP>(
415  LLVM_PRETTY_FUNCTION, "No loaded images.", error);
416 
417  ModuleList module_list;
418  Target &target = GetTarget();
419 
420  auto reload_image = [&target, &module_list, &error_with_message](
421  StructuredData::Object *obj) -> bool {
423 
424  if (!dict)
425  return error_with_message("Couldn't cast image object into dictionary.");
426 
427  ModuleSpec module_spec;
428  llvm::StringRef value;
429 
430  bool has_path = dict->HasKey("path");
431  bool has_uuid = dict->HasKey("uuid");
432  if (!has_path && !has_uuid)
433  return error_with_message("Dictionary should have key 'path' or 'uuid'");
434  if (!dict->HasKey("load_addr"))
435  return error_with_message("Dictionary is missing key 'load_addr'");
436 
437  if (has_path) {
438  dict->GetValueForKeyAsString("path", value);
439  module_spec.GetFileSpec().SetPath(value);
440  }
441 
442  if (has_uuid) {
443  dict->GetValueForKeyAsString("uuid", value);
444  module_spec.GetUUID().SetFromStringRef(value);
445  }
446  module_spec.GetArchitecture() = target.GetArchitecture();
447 
448  ModuleSP module_sp =
449  target.GetOrCreateModule(module_spec, true /* notify */);
450 
451  if (!module_sp)
452  return error_with_message("Couldn't create or get module.");
453 
456  dict->GetValueForKeyAsInteger("load_addr", load_addr);
457  dict->GetValueForKeyAsInteger("slide", slide);
458  if (load_addr == LLDB_INVALID_ADDRESS)
459  return error_with_message(
460  "Couldn't get valid load address or slide offset.");
461 
462  if (slide != LLDB_INVALID_OFFSET)
463  load_addr += slide;
464 
465  bool changed = false;
466  module_sp->SetLoadAddress(target, load_addr, false /*=value_is_offset*/,
467  changed);
468 
469  if (!changed && !module_sp->GetObjectFile())
470  return error_with_message("Couldn't set the load address for module.");
471 
472  dict->GetValueForKeyAsString("path", value);
473  FileSpec objfile(value);
474  module_sp->SetFileSpecAndObjectName(objfile, objfile.GetFilename());
475 
476  return module_list.AppendIfNeeded(module_sp);
477  };
478 
479  if (!loaded_images_sp->ForEach(reload_image))
480  return ScriptedInterface::ErrorWithMessage<StructuredData::ObjectSP>(
481  LLVM_PRETTY_FUNCTION, "Couldn't reload all images.", error);
482 
483  target.ModulesDidLoad(module_list);
484 
485  return loaded_images_sp;
486 }
487 
490 
492 
493  Status error;
494  if (!metadata_sp || !metadata_sp->GetSize())
495  return ScriptedInterface::ErrorWithMessage<StructuredData::DictionarySP>(
496  LLVM_PRETTY_FUNCTION, "No metadata.", error);
497 
498  return metadata_sp;
499 }
500 
503 }
lldb_private::toString
const char * toString(AppleArm64ExceptionClass EC)
Definition: AppleArm64ExceptionClass.h:38
lldb_private::ProcessInstanceInfo
Definition: ProcessInfo.h:106
lldb_private::ScriptedProcessInterface::GetLoadedImages
virtual StructuredData::ArraySP GetLoadedImages()
Definition: ScriptedProcessInterface.h:59
lldb_private::Range::GetRangeBase
BaseType GetRangeBase() const
Definition: RangeMap.h:46
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb::ScriptLanguage
ScriptLanguage
Script interpreter types.
Definition: lldb-enumerations.h:217
lldb_private::StructuredData::Dictionary
Definition: StructuredData.h:368
lldb_private::ArchSpec
Definition: ArchSpec.h:32
lldb_private::Process::m_thread_list
ThreadList m_thread_list
The threads for this process as the user will see them.
Definition: Process.h:2878
lldb_private::ProcessInfo::SetExecutableFile
void SetExecutableFile(const FileSpec &exe_file, bool add_exe_file_as_first_arg)
Definition: ProcessInfo.cpp:60
lldb_private::ProcessInfo::SetArchitecture
void SetArchitecture(const ArchSpec &arch)
Definition: ProcessInfo.h:64
lldb_private::ProcessInstanceInfo::Clear
void Clear()
Definition: ProcessInfo.h:114
lldb_private::StructuredData::GenericSP
std::shared_ptr< Generic > GenericSP
Definition: StructuredData.h:68
lldb_private::ScriptedProcessInterface::CreatePluginObject
StructuredData::GenericSP CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx, StructuredData::DictionarySP args_sp, StructuredData::Generic *script_obj=nullptr) override
Definition: ScriptedProcessInterface.h:24
lldb_private::Target::GetOrCreateModule
lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify, Status *error_ptr=nullptr)
Find a binary on the system and return its Module, or return an existing Module that is already in th...
Definition: Target.cpp:2082
lldb_private::ScriptedProcess::GetInterface
ScriptedProcessInterface & GetInterface() const
Definition: ScriptedProcess.cpp:501
lldb_private::ScriptedProcess::GetMetadata
lldb_private::StructuredData::DictionarySP GetMetadata() override
Fetch process defined metadata.
Definition: ScriptedProcess.cpp:488
lldb_private::ScriptedProcess::CreateInstance
static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp, const FileSpec *crash_file_path, bool can_connect)
Definition: ScriptedProcess.cpp:53
lldb_private::ScriptedProcess::DoDestroy
Status DoDestroy() override
Definition: ScriptedProcess.cpp:215
LLDB_LOGF
#define LLDB_LOGF(log,...)
Definition: Log.h:344
lldb_private::Process
Definition: Process.h:338
lldb_private::ScriptedProcess::DoLoadCore
Status DoLoadCore() override
Definition: ScriptedProcess.cpp:142
lldb_private::Target::GetExecutableModule
lldb::ModuleSP GetExecutableModule()
Gets the module for the main executable.
Definition: Target.cpp:1371
lldb_private::ScriptedProcessInterface::GetMetadata
virtual StructuredData::DictionarySP GetMetadata()
Definition: ScriptedProcessInterface.h:69
Module.h
lldb_private::Process::GetTarget
Target & GetTarget()
Get the target object pointer for this module.
Definition: Process.h:1219
lldb_private::StateAsCString
const char * StateAsCString(lldb::StateType state)
Converts a StateType to a C string.
Definition: State.cpp:14
lldb_private::ThreadList::RefreshStateAfterStop
void RefreshStateAfterStop()
Definition: ThreadList.cpp:486
lldb_private::Module
Definition: Module.h:86
OptionArgParser.h
lldb_private::FileSpec::GetFilename
const ConstString & GetFilename() const
Filename string const get accessor.
Definition: FileSpec.h:239
lldb_private::ScriptedProcess::GetPluginNameStatic
static llvm::StringRef GetPluginNameStatic()
Definition: ScriptedProcess.h:49
lldb::offset_t
uint64_t offset_t
Definition: lldb-types.h:87
lldb_private::MemoryRegionInfo
Definition: MemoryRegionInfo.h:21
lldb_private::ProcessInfo::SetProcessID
void SetProcessID(lldb::pid_t pid)
Definition: ProcessInfo.h:68
lldb_private::ThreadPlanStackMap::ClearThreadCache
void ClearThreadCache()
Clear the Thread* cache that each ThreadPlan contains.
Definition: ThreadPlanStack.h:154
lldb_private::ScriptedProcess::DoUpdateThreadList
bool DoUpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list) override
Update the thread list following process plug-in's specific logic.
Definition: ScriptedProcess.cpp:283
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::Process::SetPrivateState
void SetPrivateState(lldb::StateType state)
Definition: Process.cpp:1416
lldb_private::ScriptedProcess::GetProcessInfo
bool GetProcessInfo(ProcessInstanceInfo &info) override
Definition: ScriptedProcess.cpp:388
lldb_private::FileSpec::SetPath
void SetPath(llvm::StringRef p)
Temporary helper for FileSystem change.
Definition: FileSpec.h:278
lldb_private::ScriptedProcess::DidLaunch
void DidLaunch() override
Called after launching a process.
Definition: ScriptedProcess.cpp:170
lldb_private::ScriptInterpreter::GetScriptedProcessInterface
ScriptedProcessInterface & GetScriptedProcessInterface()
Definition: ScriptInterpreter.h:569
ThreadLauncher.h
Debugger.h
lldb_private::Target
Definition: Target.h:469
lldb_private::ScriptedProcess::GetPluginDescriptionStatic
static llvm::StringRef GetPluginDescriptionStatic()
Definition: ScriptedProcess.cpp:33
lldb_private::ScriptedProcess::Clear
void Clear()
Definition: ScriptedProcess.cpp:281
lldb_private::StructuredData::Dictionary::GetValueForKeyAsInteger
bool GetValueForKeyAsInteger(llvm::StringRef key, IntType &result) const
Definition: StructuredData.h:429
lldb_private::ScriptedProcess::DoReadMemory
size_t DoReadMemory(lldb::addr_t addr, void *buf, size_t size, Status &error) override
Actually do the reading of memory from a process.
Definition: ScriptedProcess.cpp:223
lldb::eStateStopped
@ eStateStopped
Process or thread is stopped and can be examined.
Definition: lldb-enumerations.h:85
lldb_private::ModuleSpec::GetUUID
UUID & GetUUID()
Definition: ModuleSpec.h:99
lldb_private::ScriptInterpreter::GetLanguage
lldb::ScriptLanguage GetLanguage()
Definition: ScriptInterpreter.h:567
lldb_private::FileSpec
Definition: FileSpec.h:55
lldb_private::ThreadList::Clear
void Clear()
Definition: ThreadList.cpp:471
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::Process::m_pid
lldb::pid_t m_pid
Definition: Process.h:2848
lldb_private::ScriptedProcessInterface::GetProcessID
virtual lldb::pid_t GetProcessID()
Definition: ScriptedProcessInterface.h:61
lldb_private::PluginManager::UnregisterPlugin
static bool UnregisterPlugin(ABICreateInstance create_callback)
Definition: PluginManager.cpp:293
lldb_private::ScriptedProcess::RefreshStateAfterStop
void RefreshStateAfterStop() override
Currently called as part of ShouldStop.
Definition: ScriptedProcess.cpp:382
LLDB_INVALID_OFFSET
#define LLDB_INVALID_OFFSET
Definition: lldb-defines.h:85
lldb_private::ProcessLaunchInfo
Definition: ProcessLaunchInfo.h:31
lldb_private::ModuleList
Definition: ModuleList.h:82
MemoryRegionInfo.h
ScriptedProcess.h
lldb_private::ScriptedProcessInterface::ReadMemoryAtAddress
virtual lldb::DataExtractorSP ReadMemoryAtAddress(lldb::addr_t address, size_t size, Status &error)
Definition: ScriptedProcessInterface.h:55
lldb_private::ScriptedProcessInterface::GetThreadsInfo
virtual StructuredData::DictionarySP GetThreadsInfo()
Definition: ScriptedProcessInterface.h:44
lldb_private::StructuredData::ObjectSP
std::shared_ptr< Object > ObjectSP
Definition: StructuredData.h:59
lldb_private::LLDBLog::Process
@ Process
lldb_private::MemoryRegionInfos
Definition: MemoryRegionInfo.h:172
lldb_private::ScriptedProcess::GetArchitecture
ArchSpec GetArchitecture()
Definition: ScriptedProcess.cpp:245
lldb_private::Process::Finalize
virtual void Finalize()
This object is about to be destroyed, do any necessary cleanup.
Definition: Process.cpp:512
lldb_private::ThreadList
Definition: ThreadList.h:26
lldb::eScriptLanguagePython
@ eScriptLanguagePython
Definition: lldb-enumerations.h:219
lldb_private::ScriptedProcessInterface::Launch
virtual Status Launch()
Definition: ScriptedProcessInterface.h:30
lldb_private::ScriptedProcess::m_script_object_sp
lldb_private::StructuredData::ObjectSP m_script_object_sp
Definition: ScriptedProcess.h:116
lldb_private::ScriptedProcessInterface::Resume
virtual Status Resume()
Definition: ScriptedProcessInterface.h:32
lldb_private::StructuredData::DictionarySP
std::shared_ptr< Dictionary > DictionarySP
Definition: StructuredData.h:67
lldb_private::ScriptedProcess::Initialize
static void Initialize()
Definition: ScriptedProcess.cpp:129
lldb_private::ScriptedProcess::DoGetMemoryRegionInfo
Status DoGetMemoryRegionInfo(lldb::addr_t load_addr, MemoryRegionInfo &range_info) override
DoGetMemoryRegionInfo is called by GetMemoryRegionInfo after it has removed non address bits from loa...
Definition: ScriptedProcess.cpp:249
lldb_private::ScriptedProcess::Terminate
static void Terminate()
Definition: ScriptedProcess.cpp:138
lldb_private::ScriptedProcess::GetLoadedDynamicLibrariesInfos
lldb_private::StructuredData::ObjectSP GetLoadedDynamicLibrariesInfos() override
Definition: ScriptedProcess.cpp:402
lldb_private::ScriptedProcess::ScriptedProcessInfo::GetClassName
std::string GetClassName() const
Definition: ScriptedProcess.h:31
lldb_private::TargetProperties::GetProcessLaunchInfo
const ProcessLaunchInfo & GetProcessLaunchInfo() const
Definition: Target.cpp:4634
lldb_private::ScriptedProcessInterface::IsAlive
virtual bool IsAlive()
Definition: ScriptedProcessInterface.h:63
lldbassert
#define lldbassert(x)
Definition: LLDBAssert.h:15
lldb_private::ScriptedProcess::m_scripted_process_info
const ScriptedProcessInfo m_scripted_process_info
Definition: ScriptedProcess.h:114
lldb_private::ModuleSpec::GetFileSpec
FileSpec & GetFileSpec()
Definition: ModuleSpec.h:53
lldb_private::ModuleSpec
Definition: ModuleSpec.h:27
lldb_private::Target::GetArchitecture
const ArchSpec & GetArchitecture() const
Definition: Target.h:989
lldb_private::ScriptedThread::Create
static llvm::Expected< std::shared_ptr< ScriptedThread > > Create(ScriptedProcess &process, StructuredData::Generic *script_object=nullptr)
Definition: ScriptedThread.cpp:31
lldb_private::Status
Definition: Status.h:44
message
message(FATAL_ERROR "invalid libipt include path provided") endif() include_directories($
Definition: Plugins/Trace/intel-pt/CMakeLists.txt:6
lldb_private::ScriptedProcessInterface::Stop
virtual Status Stop()
Definition: ScriptedProcessInterface.h:36
lldb_private::ScriptedProcessInterface
Definition: ScriptedProcessInterface.h:21
lldb_private::Target::ModulesDidLoad
void ModulesDidLoad(ModuleList &module_list)
Definition: Target.cpp:1645
lldb_private::ScriptedProcess::~ScriptedProcess
~ScriptedProcess() override
Definition: ScriptedProcess.cpp:120
lldb_private::ScriptedProcess
Definition: ScriptedProcess.h:22
lldb_private::UUID::SetFromStringRef
bool SetFromStringRef(llvm::StringRef str)
Definition: UUID.cpp:97
lldb_private::StructuredData::Object::GetAsDictionary
Dictionary * GetAsDictionary()
Definition: StructuredData.h:91
lldb_private::ThreadList::GetSize
uint32_t GetSize(bool can_update=true)
Definition: ThreadList.cpp:83
lldb_private::StructuredData::Dictionary::HasKey
bool HasKey(llvm::StringRef key) const
Definition: StructuredData.h:514
lldb_private::ScriptedProcess::IsAlive
bool IsAlive() override
Check if a process is still alive.
Definition: ScriptedProcess.cpp:217
lldb_private::ScriptInterpreter::LanguageToString
static std::string LanguageToString(lldb::ScriptLanguage language)
Definition: ScriptInterpreter.cpp:63
lldb_private::ScriptedProcess::DoLaunch
Status DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) override
Launch a new process.
Definition: ScriptedProcess.cpp:148
PluginManager.h
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:74
lldb_private::ModuleSpec::GetArchitecture
ArchSpec & GetArchitecture()
Definition: ModuleSpec.h:89
lldb_private::Process::GetID
lldb::pid_t GetID() const
Returns the pid of the process or LLDB_INVALID_PROCESS_ID if there is no known pid.
Definition: Process.h:526
lldb_private::MemoryRegionInfo::GetRange
RangeType & GetRange()
Definition: MemoryRegionInfo.h:38
lldb_private::Process::m_thread_plans
ThreadPlanStackMap m_thread_plans
This is the list of thread plans for threads in m_thread_list, as well as threads we knew existed,...
Definition: Process.h:2882
lldb_private::ScriptedProcess::DoResume
Status DoResume() override
Resumes all of a process's threads as configured using the Thread run control functions.
Definition: ScriptedProcess.cpp:176
lldb_private::PluginManager::RegisterPlugin
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
Definition: PluginManager.cpp:287
g_supported_script_languages
static constexpr lldb::ScriptLanguage g_supported_script_languages[]
Definition: ScriptedProcess.cpp:37
OptionParser.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
CommandInterpreter.h
State.h
lldb_private::ThreadCollection::AddThread
void AddThread(const lldb::ThreadSP &thread_sp)
Definition: ThreadCollection.cpp:24
OptionGroupBoolean.h
lldb_private::ScriptedProcess::ScriptedProcessInfo::GetArgsSP
StructuredData::DictionarySP GetArgsSP() const
Definition: ScriptedProcess.h:32
lldb::StateType
StateType
Process and Thread States.
Definition: lldb-enumerations.h:74
lldb_private::Process::GetByteOrder
lldb::ByteOrder GetByteOrder() const
Definition: Process.cpp:3362
LLDB_PLUGIN_DEFINE
#define LLDB_PLUGIN_DEFINE(PluginName)
Definition: PluginManager.h:31
lldb_private::Log
Definition: Log.h:115
lldb_private::StructuredData::ArraySP
std::shared_ptr< Array > ArraySP
Definition: StructuredData.h:62
lldb_private::StructuredData::Dictionary::GetValueForKeyAsString
bool GetValueForKeyAsString(llvm::StringRef key, llvm::StringRef &result) const
Definition: StructuredData.h:449
lldb_private::ScriptedProcess::GetMemoryRegions
Status GetMemoryRegions(lldb_private::MemoryRegionInfos &region_list) override
Obtain all the mapped memory regions within this process.
Definition: ScriptedProcess.cpp:261
lldb_private::ScriptedProcess::DoStop
Status DoStop()
Definition: ScriptedProcess.cpp:200
lldb_private::GetLog
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:309
ScriptInterpreter.h
lldb_private::ScriptedProcess::ScriptedProcessInfo
Definition: ScriptedProcess.h:24
lldb_private::ScriptedProcess::CheckInterpreterAndScriptObject
void CheckInterpreterAndScriptObject() const
Definition: ScriptedProcess.cpp:48
lldb_private::StructuredData::Object
Definition: StructuredData.h:70
lldb
Definition: SBAddress.h:15
lldb::eStateRunning
@ eStateRunning
Process or thread is running and can't be examined.
Definition: lldb-enumerations.h:86
RegisterContext.h
lldb_private::ScriptedProcess::m_interpreter
lldb_private::ScriptInterpreter * m_interpreter
Definition: ScriptedProcess.h:115
LLDBLog.h