Files
TheRock/compiler/amd-llvm/lldb/tools/debugserver/source/DNBArch.h
T
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

129 lines
4.7 KiB
C++

//===-- DNBArch.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
//
//===----------------------------------------------------------------------===//
//
// Created by Greg Clayton on 6/24/07.
//
//===----------------------------------------------------------------------===//
#ifndef LLDB_TOOLS_DEBUGSERVER_SOURCE_DNBARCH_H
#define LLDB_TOOLS_DEBUGSERVER_SOURCE_DNBARCH_H
#include "DNBDefs.h"
#include "MacOSX/MachException.h"
#include <cstdio>
#include <mach/mach.h>
struct DNBRegisterValue;
struct DNBRegisterSetInfo;
class DNBArchProtocol;
class MachThread;
typedef DNBArchProtocol *(*DNBArchCallbackCreate)(MachThread *thread);
typedef const DNBRegisterSetInfo *(*DNBArchCallbackGetRegisterSetInfo)(
nub_size_t *num_reg_sets);
typedef const uint8_t *(*DNBArchCallbackGetBreakpointOpcode)(
nub_size_t byte_size);
typedef struct DNBArchPluginInfoTag {
uint32_t cpu_type;
DNBArchCallbackCreate Create;
DNBArchCallbackGetRegisterSetInfo GetRegisterSetInfo;
DNBArchCallbackGetBreakpointOpcode GetBreakpointOpcode;
} DNBArchPluginInfo;
class DNBArchProtocol {
public:
static DNBArchProtocol *Create(MachThread *thread);
static uint32_t GetRegisterCPUType();
static const DNBRegisterSetInfo *GetRegisterSetInfo(nub_size_t *num_reg_sets);
static const uint8_t *GetBreakpointOpcode(nub_size_t byte_size);
static void RegisterArchPlugin(const DNBArchPluginInfo &arch_info);
static uint32_t GetCPUType();
static uint32_t GetCPUSubType();
static bool SetArchitecture(uint32_t cpu_type, uint32_t cpu_subtype = 0);
DNBArchProtocol() : m_save_id(0) {}
virtual ~DNBArchProtocol() {}
virtual bool GetRegisterValue(uint32_t set, uint32_t reg,
DNBRegisterValue *value) = 0;
virtual bool SetRegisterValue(uint32_t set, uint32_t reg,
const DNBRegisterValue *value) = 0;
virtual nub_size_t GetRegisterContext(void *buf, nub_size_t buf_len) = 0;
virtual nub_size_t SetRegisterContext(const void *buf,
nub_size_t buf_len) = 0;
virtual uint32_t SaveRegisterState() = 0;
virtual bool RestoreRegisterState(uint32_t save_id) = 0;
virtual kern_return_t GetRegisterState(int set, bool force) = 0;
virtual kern_return_t SetRegisterState(int set) = 0;
virtual bool RegisterSetStateIsValid(int set) const = 0;
virtual uint64_t GetPC(uint64_t failValue) = 0; // Get program counter
virtual kern_return_t SetPC(uint64_t value) = 0;
virtual uint64_t GetSP(uint64_t failValue) = 0; // Get stack pointer
virtual void ThreadWillResume() = 0;
virtual bool ThreadDidStop() = 0;
virtual bool NotifyException(MachException::Data &exc) { return false; }
virtual uint32_t NumSupportedHardwareBreakpoints() { return 0; }
virtual uint32_t NumSupportedHardwareWatchpoints() { return 0; }
virtual uint32_t EnableHardwareBreakpoint(nub_addr_t addr, nub_size_t size,
bool also_set_on_task) {
return INVALID_NUB_HW_INDEX;
}
virtual uint32_t EnableHardwareWatchpoint(nub_addr_t addr, nub_size_t size,
bool read, bool write,
bool also_set_on_task) {
return INVALID_NUB_HW_INDEX;
}
virtual bool DisableHardwareBreakpoint(uint32_t hw_index,
bool also_set_on_task) {
return false;
}
virtual bool DisableHardwareWatchpoint(uint32_t hw_index,
bool also_set_on_task) {
return false;
}
virtual uint32_t GetHardwareWatchpointHit(nub_addr_t &addr) {
return INVALID_NUB_HW_INDEX;
}
virtual bool StepNotComplete() { return false; }
protected:
friend class MachThread;
uint32_t GetNextRegisterStateSaveID() { return ++m_save_id; }
enum {
Trans_Pending =
0, // Transaction is pending, and checkpoint state has been snapshotted.
Trans_Done = 1, // Transaction is done, the current state is committed, and
// checkpoint state is irrelevant.
Trans_Rolled_Back = 2 // Transaction is done, the current state has been
// rolled back to the checkpoint state.
};
virtual bool StartTransForHWP() { return true; }
virtual bool RollbackTransForHWP() { return true; }
virtual bool FinishTransForHWP() { return true; }
uint32_t m_save_id; // An always incrementing integer ID used with
// SaveRegisterState/RestoreRegisterState
};
#include "MacOSX/arm64/DNBArchImplARM64.h"
#include "MacOSX/x86_64/DNBArchImplX86_64.h"
#endif