LLDB  mainline
OperatingSystem.h
Go to the documentation of this file.
1 //===-- OperatingSystem.h ----------------------------------------------*- C++
2 //-*-===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLDB_TARGET_OPERATINGSYSTEM_H
11 #define LLDB_TARGET_OPERATINGSYSTEM_H
12 
14 #include "lldb/lldb-private.h"
15 
16 namespace lldb_private {
17 
18 /// \class OperatingSystem OperatingSystem.h "lldb/Target/OperatingSystem.h"
19 /// A plug-in interface definition class for halted OS helpers.
20 ///
21 /// Halted OS plug-ins can be used by any process to locate and create
22 /// OS objects, like threads, during the lifetime of a debug session.
23 /// This is commonly used when attaching to an operating system that is
24 /// halted, such as when debugging over JTAG or connecting to low level kernel
25 /// debug services.
26 
28 public:
29  /// Find a halted OS plugin for a given process.
30  ///
31  /// Scans the installed OperatingSystem plug-ins and tries to find an
32  /// instance that matches the current target triple and executable.
33  ///
34  /// \param[in] process
35  /// The process for which to try and locate a halted OS
36  /// plug-in instance.
37  ///
38  /// \param[in] plugin_name
39  /// An optional name of a specific halted OS plug-in that
40  /// should be used. If NULL, pick the best plug-in.
41  static OperatingSystem *FindPlugin(Process *process, const char *plugin_name);
42 
43  OperatingSystem(Process *process);
44 
45  // Plug-in Methods
46  virtual bool UpdateThreadList(ThreadList &old_thread_list,
47  ThreadList &real_thread_list,
48  ThreadList &new_thread_list) = 0;
49 
50  virtual void ThreadWasSelected(Thread *thread) = 0;
51 
52  virtual lldb::RegisterContextSP
54  lldb::addr_t reg_data_addr) = 0;
55 
56  virtual lldb::StopInfoSP CreateThreadStopReason(Thread *thread) = 0;
57 
58  virtual lldb::ThreadSP CreateThread(lldb::tid_t tid, lldb::addr_t context) {
59  return lldb::ThreadSP();
60  }
61 
62  virtual bool IsOperatingSystemPluginThread(const lldb::ThreadSP &thread_sp);
63 
64 protected:
65  // Member variables.
66  Process
67  *m_process; ///< The process that this dynamic loader plug-in is tracking.
68 };
69 
70 } // namespace lldb_private
71 
72 #endif // LLDB_TARGET_OPERATINGSYSTEM_H
lldb_private::OperatingSystem::ThreadWasSelected
virtual void ThreadWasSelected(Thread *thread)=0
lldb_private::PluginInterface
Definition: PluginInterface.h:16
lldb_private::OperatingSystem::OperatingSystem
OperatingSystem(Process *process)
Definition: OperatingSystem.cpp:44
lldb_private::OperatingSystem::CreateThreadStopReason
virtual lldb::StopInfoSP CreateThreadStopReason(Thread *thread)=0
lldb_private::Process
Definition: Process.h:341
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::OperatingSystem::CreateRegisterContextForThread
virtual lldb::RegisterContextSP CreateRegisterContextForThread(Thread *thread, lldb::addr_t reg_data_addr)=0
lldb_private::Thread
Definition: Thread.h:60
lldb_private::ThreadList
Definition: ThreadList.h:26
lldb_private::OperatingSystem
Definition: OperatingSystem.h:27
PluginInterface.h
lldb_private::OperatingSystem::FindPlugin
static OperatingSystem * FindPlugin(Process *process, const char *plugin_name)
Find a halted OS plugin for a given process.
Definition: OperatingSystem.cpp:16
lldb-private.h
lldb_private::OperatingSystem::UpdateThreadList
virtual bool UpdateThreadList(ThreadList &old_thread_list, ThreadList &real_thread_list, ThreadList &new_thread_list)=0
lldb_private::OperatingSystem::CreateThread
virtual lldb::ThreadSP CreateThread(lldb::tid_t tid, lldb::addr_t context)
Definition: OperatingSystem.h:58
lldb_private::OperatingSystem::m_process
Process * m_process
The process that this dynamic loader plug-in is tracking.
Definition: OperatingSystem.h:67
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::OperatingSystem::IsOperatingSystemPluginThread
virtual bool IsOperatingSystemPluginThread(const lldb::ThreadSP &thread_sp)
Definition: OperatingSystem.cpp:46
lldb::tid_t
uint64_t tid_t
Definition: lldb-types.h:86