Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / source / Plugins / JITLoader / GDB / JITLoaderGDB.h
blob2b337b3e9844eb7e01cc91e628d7ffe7fca80b50
1 //===-- JITLoaderGDB.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 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SOURCE_PLUGINS_JITLOADER_GDB_JITLOADERGDB_H
10 #define LLDB_SOURCE_PLUGINS_JITLOADER_GDB_JITLOADERGDB_H
12 #include <map>
14 #include "lldb/Target/JITLoader.h"
15 #include "lldb/Target/Process.h"
17 class JITLoaderGDB : public lldb_private::JITLoader {
18 public:
19 JITLoaderGDB(lldb_private::Process *process);
21 ~JITLoaderGDB() override;
23 // Static Functions
24 static void Initialize();
26 static void Terminate();
28 static llvm::StringRef GetPluginNameStatic() { return "gdb"; }
30 static llvm::StringRef GetPluginDescriptionStatic();
32 static lldb::JITLoaderSP CreateInstance(lldb_private::Process *process,
33 bool force);
35 static void DebuggerInitialize(lldb_private::Debugger &debugger);
37 // PluginInterface protocol
38 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
40 // JITLoader interface
41 void DidAttach() override;
43 void DidLaunch() override;
45 void ModulesDidLoad(lldb_private::ModuleList &module_list) override;
47 private:
48 lldb::addr_t GetSymbolAddress(lldb_private::ModuleList &module_list,
49 lldb_private::ConstString name,
50 lldb::SymbolType symbol_type) const;
52 void SetJITBreakpoint(lldb_private::ModuleList &module_list);
54 bool DidSetJITBreakpoint() const;
56 bool ReadJITDescriptor(bool all_entries);
58 template <typename ptr_t> bool ReadJITDescriptorImpl(bool all_entries);
60 static bool
61 JITDebugBreakpointHit(void *baton,
62 lldb_private::StoppointCallbackContext *context,
63 lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
65 static void ProcessStateChangedCallback(void *baton,
66 lldb_private::Process *process,
67 lldb::StateType state);
69 // A collection of in-memory jitted object addresses and their corresponding
70 // modules
71 typedef std::map<lldb::addr_t, const lldb::ModuleSP> JITObjectMap;
72 JITObjectMap m_jit_objects;
74 lldb::user_id_t m_jit_break_id;
75 lldb::addr_t m_jit_descriptor_addr;
78 #endif // LLDB_SOURCE_PLUGINS_JITLOADER_GDB_JITLOADERGDB_H