LLDB mainline
LLDBServerAcceleratorPlugin.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_LLDBSERVERACCELERATORPLUGIN_H
10#define LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_LLDBSERVERACCELERATORPLUGIN_H
11
12#include "lldb/Host/MainLoop.h"
15#include "llvm/ADT/StringRef.h"
16#include <memory>
17#include <optional>
18
19namespace lldb_private {
20
21namespace process_gdb_remote {
23} // namespace process_gdb_remote
24
25namespace lldb_server {
26
28public:
31
32 LLDBServerAcceleratorPlugin(GDBServer &native_gdb_server,
33 MainLoop &native_main_loop);
35
36 virtual llvm::StringRef GetPluginName() = 0;
37
38 /// Return the LLDB settings needed to debug this accelerator.
39 ///
40 /// The settings select the accelerator dynamic loader and identify this
41 /// server-side plugin. They also determine whether dynamic-loader packets
42 /// are sent over the accelerator or native connection.
43 virtual std::optional<LLDBSettings> GetLLDBSettings() {
44 LLDBSettings settings;
45 settings.dyld_plugin_name = "accelerator-gdb-remote";
47 settings.send_dyld_packet_to_accelerator = true;
48 return settings;
49 }
50
51 virtual std::optional<AcceleratorActions> GetInitializeActions() = 0;
52
53 virtual llvm::Expected<AcceleratorBreakpointHitResponse>
55
56 /// Notify the plugin when the native process exits.
57 virtual void NativeProcessDidExit(const WaitStatus &exit_status) = 0;
58
59 /// Create an AcceleratorActions with an identifier unique within this plugin,
60 /// so identifiers from different actions don't collide.
65
66 virtual std::optional<AcceleratorDynamicLoaderResponse>
68 return std::nullopt;
69 }
70
71protected:
74 std::unique_ptr<Manager> m_process_manager_up;
75 std::unique_ptr<GDBServer> m_accelerator_gdb_server;
77};
78
79} // namespace lldb_server
80} // namespace lldb_private
81
82#endif // LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_LLDBSERVERACCELERATORPLUGIN_H
virtual std::optional< AcceleratorActions > GetInitializeActions()=0
virtual std::optional< LLDBSettings > GetLLDBSettings()
Return the LLDB settings needed to debug this accelerator.
virtual llvm::Expected< AcceleratorBreakpointHitResponse > BreakpointWasHit(AcceleratorBreakpointHitArgs &args)=0
virtual std::optional< AcceleratorDynamicLoaderResponse > GetDynamicLoaderLibraryInfos(const AcceleratorDynamicLoaderArgs &args)
LLDBServerAcceleratorPlugin(GDBServer &native_gdb_server, MainLoop &native_main_loop)
virtual void NativeProcessDidExit(const WaitStatus &exit_status)=0
Notify the plugin when the native process exits.
AcceleratorActions GetNewAcceleratorAction()
Create an AcceleratorActions with an identifier unique within this plugin, so identifiers from differ...
process_gdb_remote::GDBRemoteCommunicationServerLLGS GDBServer
A class that represents a running process on the host machine.
MainLoopPosix MainLoop
Definition MainLoop.h:20
Actions to be performed in the native process on behalf of an accelerator plugin.
Sent by the client when a plugin-requested breakpoint is hit.
Arguments for the jAcceleratorPluginGetDynamicLoaderLibraryInfo packet.
LLDB-specific settings for a process debugged over GDB-remote.
std::string accelerator_plugin_name
The server-side accelerator plugin associated with this process, if any.
bool send_dyld_packet_to_accelerator
Send the dynamic-loader packet to the accelerator connection when true, or the native process's conne...
std::string dyld_plugin_name
The name of the DynamicLoader plugin to use.