brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · 3beba26 Raw
68 lines · c
1//===-- EventHelper.h -----------------------------------------------------===//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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLDB_TOOLS_LLDB_DAP_EVENTHELPER_H10#define LLDB_TOOLS_LLDB_DAP_EVENTHELPER_H11 12#include "DAPForward.h"13#include "Protocol/ProtocolEvents.h"14#include "lldb/lldb-defines.h"15#include "lldb/lldb-types.h"16#include "llvm/ADT/ArrayRef.h"17#include "llvm/Support/Error.h"18 19namespace lldb_dap {20struct DAP;21 22enum LaunchMethod { Launch, Attach, AttachForSuspendedLaunch };23 24/// Sends target based capabilities and lldb-dap custom capabilities.25void SendExtraCapabilities(DAP &dap);26 27void SendProcessEvent(DAP &dap, LaunchMethod launch_method);28 29llvm::Error SendThreadStoppedEvent(DAP &dap, bool on_entry = false);30 31void SendTerminatedEvent(DAP &dap);32 33void SendStdOutStdErr(DAP &dap, lldb::SBProcess &process);34 35void SendContinuedEvent(DAP &dap);36 37void SendProcessExitedEvent(DAP &dap, lldb::SBProcess &process);38 39void SendInvalidatedEvent(40    DAP &dap, llvm::ArrayRef<protocol::InvalidatedEventBody::Area> areas,41    lldb::tid_t tid = LLDB_INVALID_THREAD_ID);42 43void SendMemoryEvent(DAP &dap, lldb::SBValue variable);44 45/// Event thread function that handles debugger events for multiple DAP sessions46/// sharing the same debugger instance. This runs in its own thread and47/// dispatches events to the appropriate DAP instance.48///49/// \param debugger The debugger instance to listen for events from.50/// \param broadcaster The broadcaster for stop event thread notifications.51/// \param client_name The client name for thread naming/logging purposes.52/// \param log The log instance for logging.53void EventThread(lldb::SBDebugger debugger, lldb::SBBroadcaster broadcaster,54                 llvm::StringRef client_name, Log *log);55 56/// Event handler functions called by EventThread.57/// These handlers extract the necessary objects from events and find the58/// appropriate DAP instance to handle them.59void HandleProcessEvent(const lldb::SBEvent &event, bool &done, Log *log);60void HandleTargetEvent(const lldb::SBEvent &event, Log *log);61void HandleBreakpointEvent(const lldb::SBEvent &event, Log *log);62void HandleThreadEvent(const lldb::SBEvent &event, Log *log);63void HandleDiagnosticEvent(const lldb::SBEvent &event, Log *log);64 65} // namespace lldb_dap66 67#endif68