Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

155 lines
5.4 KiB
C++

//===-- GDBRemoteCommunicationServerCommon.h --------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTECOMMUNICATIONSERVERCOMMON_H
#define LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTECOMMUNICATIONSERVERCOMMON_H
#include <string>
#include "lldb/Host/ProcessLaunchInfo.h"
#include "lldb/lldb-private-forward.h"
#include "GDBRemoteCommunicationServer.h"
class StringExtractorGDBRemote;
namespace lldb_private {
namespace process_gdb_remote {
class ProcessGDBRemote;
class GDBRemoteCommunicationServerCommon : public GDBRemoteCommunicationServer {
public:
GDBRemoteCommunicationServerCommon();
~GDBRemoteCommunicationServerCommon() override;
protected:
ProcessLaunchInfo m_process_launch_info;
Status m_process_launch_error;
ProcessInstanceInfoList m_proc_infos;
uint32_t m_proc_infos_index;
PacketResult Handle_A(StringExtractorGDBRemote &packet);
PacketResult Handle_qHostInfo(StringExtractorGDBRemote &packet);
PacketResult Handle_qProcessInfoPID(StringExtractorGDBRemote &packet);
PacketResult Handle_qfProcessInfo(StringExtractorGDBRemote &packet);
PacketResult Handle_qsProcessInfo(StringExtractorGDBRemote &packet);
PacketResult Handle_qUserName(StringExtractorGDBRemote &packet);
PacketResult Handle_qGroupName(StringExtractorGDBRemote &packet);
PacketResult Handle_qSpeedTest(StringExtractorGDBRemote &packet);
PacketResult Handle_vFile_Open(StringExtractorGDBRemote &packet);
PacketResult Handle_vFile_Close(StringExtractorGDBRemote &packet);
PacketResult Handle_vFile_pRead(StringExtractorGDBRemote &packet);
PacketResult Handle_vFile_pWrite(StringExtractorGDBRemote &packet);
PacketResult Handle_vFile_Size(StringExtractorGDBRemote &packet);
PacketResult Handle_vFile_Mode(StringExtractorGDBRemote &packet);
PacketResult Handle_vFile_Exists(StringExtractorGDBRemote &packet);
PacketResult Handle_vFile_symlink(StringExtractorGDBRemote &packet);
PacketResult Handle_vFile_unlink(StringExtractorGDBRemote &packet);
PacketResult Handle_vFile_FStat(StringExtractorGDBRemote &packet);
PacketResult Handle_vFile_Stat(StringExtractorGDBRemote &packet);
PacketResult Handle_vFile_MD5(StringExtractorGDBRemote &packet);
PacketResult Handle_qEcho(StringExtractorGDBRemote &packet);
PacketResult Handle_qModuleInfo(StringExtractorGDBRemote &packet);
PacketResult Handle_jModulesInfo(StringExtractorGDBRemote &packet);
PacketResult Handle_qPlatform_shell(StringExtractorGDBRemote &packet);
PacketResult Handle_qPlatform_mkdir(StringExtractorGDBRemote &packet);
PacketResult Handle_qPlatform_chmod(StringExtractorGDBRemote &packet);
PacketResult Handle_qSupported(StringExtractorGDBRemote &packet);
PacketResult Handle_QSetDetachOnError(StringExtractorGDBRemote &packet);
PacketResult Handle_QStartNoAckMode(StringExtractorGDBRemote &packet);
PacketResult Handle_QSetSTDIN(StringExtractorGDBRemote &packet);
PacketResult Handle_QSetSTDOUT(StringExtractorGDBRemote &packet);
PacketResult Handle_QSetSTDERR(StringExtractorGDBRemote &packet);
PacketResult Handle_qLaunchSuccess(StringExtractorGDBRemote &packet);
PacketResult Handle_QEnvironment(StringExtractorGDBRemote &packet);
PacketResult Handle_QEnvironmentHexEncoded(StringExtractorGDBRemote &packet);
PacketResult Handle_QLaunchArch(StringExtractorGDBRemote &packet);
static void CreateProcessInfoResponse(const ProcessInstanceInfo &proc_info,
StreamString &response);
static void CreateProcessInfoResponse_DebugServerStyle(
const ProcessInstanceInfo &proc_info, StreamString &response);
template <typename T>
void RegisterMemberFunctionHandler(
StringExtractorGDBRemote::ServerPacketType packet_type,
PacketResult (T::*handler)(StringExtractorGDBRemote &packet)) {
RegisterPacketHandler(packet_type,
[this, handler](StringExtractorGDBRemote packet,
Status &error, bool &interrupt,
bool &quit) {
return (static_cast<T *>(this)->*handler)(packet);
});
}
/// Launch a process with the current launch settings.
///
/// This method supports running an lldb-gdbserver or similar
/// server in a situation where the startup code has been provided
/// with all the information for a child process to be launched.
///
/// \return
/// An Status object indicating the success or failure of the
/// launch.
virtual Status LaunchProcess() = 0;
virtual FileSpec FindModuleFile(const std::string &module_path,
const ArchSpec &arch);
// Process client_features (qSupported) and return an array of server features
// to be returned in response.
virtual std::vector<std::string>
HandleFeatures(llvm::ArrayRef<llvm::StringRef> client_features);
private:
ModuleSpec GetModuleInfo(llvm::StringRef module_path, llvm::StringRef triple);
};
} // namespace process_gdb_remote
} // namespace lldb_private
#endif // LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTECOMMUNICATIONSERVERCOMMON_H