LLDB mainline
InstrumentationRuntime.h
Go to the documentation of this file.
1//===-- InstrumentationRuntime.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_INSTRUMENTATIONRUNTIME_H
10#define LLDB_TARGET_INSTRUMENTATIONRUNTIME_H
11
12#include <map>
13#include <vector>
14
17#include "lldb/lldb-forward.h"
18#include "lldb/lldb-private.h"
19#include "lldb/lldb-types.h"
20
21namespace lldb_private {
22
26
28 : public std::enable_shared_from_this<InstrumentationRuntime>,
29 public PluginInterface {
30 /// The instrumented process.
32
33 /// The module containing the instrumentation runtime.
35
36 /// The breakpoint in the instrumentation runtime.
38
39 /// Indicates whether or not breakpoints have been registered in the
40 /// instrumentation runtime.
42
43protected:
45 : m_breakpoint_id(0), m_is_active(false) {
46 if (process_sp)
47 m_process_wp = process_sp;
48 }
49
51
53
55 m_runtime_module = std::move(module_sp);
56 }
57
59
61
63
64 /// Return a regular expression which can be used to identify a valid version
65 /// of the runtime library.
67
68 /// Check whether \p module_sp corresponds to a valid runtime library.
69 virtual bool CheckIfRuntimeIsValid(const lldb::ModuleSP module_sp) = 0;
70
71 /// Register a breakpoint in the runtime library and perform any other
72 /// necessary initialization. The runtime library
73 /// is guaranteed to be loaded.
74 virtual void Activate() = 0;
75
76public:
77 static void ModulesDidLoad(lldb_private::ModuleList &module_list,
78 Process *process,
80
81 /// Look for the instrumentation runtime in \p module_list. Register and
82 /// activate the runtime if this hasn't already
83 /// been done.
85
86 bool IsActive() const { return m_is_active; }
87
90};
91
92} // namespace lldb_private
93
94#endif // LLDB_TARGET_INSTRUMENTATIONRUNTIME_H
static char ID
Definition: HostInfoBase.h:37
lldb::ProcessWP m_process_wp
The instrumented process.
lldb::ModuleSP m_runtime_module
The module containing the instrumentation runtime.
lldb::user_id_t m_breakpoint_id
The breakpoint in the instrumentation runtime.
virtual lldb::ThreadCollectionSP GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info)
void SetRuntimeModuleSP(lldb::ModuleSP module_sp)
virtual void Activate()=0
Register a breakpoint in the runtime library and perform any other necessary initialization.
virtual bool CheckIfRuntimeIsValid(const lldb::ModuleSP module_sp)=0
Check whether module_sp corresponds to a valid runtime library.
virtual const RegularExpression & GetPatternForRuntimeLibrary()=0
Return a regular expression which can be used to identify a valid version of the runtime library.
InstrumentationRuntime(const lldb::ProcessSP &process_sp)
bool m_is_active
Indicates whether or not breakpoints have been registered in the instrumentation runtime.
static void ModulesDidLoad(lldb_private::ModuleList &module_list, Process *process, InstrumentationRuntimeCollection &runtimes)
A collection class for Module objects.
Definition: ModuleList.h:103
A plug-in interface definition class for debugging a process.
Definition: Process.h:341
std::shared_ptr< Object > ObjectSP
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
std::map< lldb::InstrumentationRuntimeType, lldb::InstrumentationRuntimeSP > InstrumentationRuntimeCollection
std::shared_ptr< lldb_private::Process > ProcessSP
Definition: lldb-forward.h:381
InstrumentationRuntimeType
std::weak_ptr< lldb_private::Process > ProcessWP
Definition: lldb-forward.h:384
uint64_t user_id_t
Definition: lldb-types.h:80
std::shared_ptr< lldb_private::InstrumentationRuntime > InstrumentationRuntimeSP
Definition: lldb-forward.h:352
std::shared_ptr< lldb_private::Module > ModuleSP
Definition: lldb-forward.h:365
std::shared_ptr< lldb_private::ThreadCollection > ThreadCollectionSP
Definition: lldb-forward.h:440