citra/src/core/gdbstub/gdbstub.h
GPUCode 88ea66053e
Miscallenious fixes to gl backend and qt frontend (#6834)
* renderer_gl: Make rasterizer normal class member

* It doesn't need to be heap allocated anymore

* gl_rasterizer: Remove default_texture

* It's unused

* gl_rasterizer: General cleanup

* gl_rasterizer: Lower case lambdas

* Match style with review comments from vulkan backend

* rasterizer_cache: Prevent memory leak

* Since the switch from shared_ptr these surfaces were no longer being destroyed properly. Use our garbage collector for that purpose to destroy it safely for both backends

* rasterizer_cache: Make temp copy of old surface

* The custom surface would override the memory region of the old region resulting in garbage data, this ensures the custom surface is constructed correctly

* citra_qt: Manually create dialog tabs

* Allows for custom constructors which is very useful. While at it, global state is now eliminated from configuration

* citra_qt: Eliminate global system usage

* core: Remove global system usage in memory and HIO

* citra_qt: Use qOverload

* tests: Run clang format

* gl_texture_runtime: Fix surface scaling
2023-08-02 01:40:39 +03:00

138 lines
3.2 KiB
C++

// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
// Originally written by Sven Peter <sven@fail0verflow.com> for anergistic.
#pragma once
#include <span>
#include "common/common_types.h"
#include "core/hle/kernel/thread.h"
namespace Core {
class System;
}
namespace GDBStub {
/// Breakpoint Method
enum class BreakpointType {
None, ///< None
Execute, ///< Execution Breakpoint
Read, ///< Read Breakpoint
Write, ///< Write Breakpoint
Access ///< Access (R/W) Breakpoint
};
struct BreakpointAddress {
VAddr address;
BreakpointType type;
};
/**
* Set the port the gdbstub should use to listen for connections.
*
* @param port Port to listen for connection
*/
void SetServerPort(u16 port);
/**
* Starts or stops the server if possible.
*
* @param status Set the server to enabled or disabled.
*/
void ToggleServer(bool status);
/// Start the gdbstub server.
void Init();
/**
* Defer initialization of the gdbstub to the first packet processing functions.
* This avoids a case where the gdbstub thread is frozen after initialization
* and fails to respond in time to packets.
*/
void DeferStart();
/// Stop gdbstub server.
void Shutdown();
/// Checks if the gdbstub server is enabled.
bool IsServerEnabled();
/// Returns true if there is an active socket connection.
bool IsConnected();
/**
* Signal to the gdbstub server that it should halt CPU execution.
*
* @param is_memory_break If true, the break resulted from a memory breakpoint.
*/
void Break(bool is_memory_break = false);
/// Determine if there was a memory breakpoint.
bool IsMemoryBreak();
/// Read and handle packet from gdb client.
void HandlePacket(Core::System& system);
/**
* Get the nearest breakpoint of the specified type at the given address.
*
* @param addr Address to search from.
* @param type Type of breakpoint.
*/
BreakpointAddress GetNextBreakpointFromAddress(VAddr addr, GDBStub::BreakpointType type);
/**
* Check if a breakpoint of the specified type exists at the given address.
*
* @param addr Address of breakpoint.
* @param type Type of breakpoint.
*/
bool CheckBreakpoint(VAddr addr, GDBStub::BreakpointType type);
// If set to true, the CPU will halt at the beginning of the next CPU loop.
bool GetCpuHaltFlag();
/**
* If set to true, the CPU will halt at the beginning of the next CPU loop.
*
* @param halt whether to halt on the next loop
*/
void SetCpuHaltFlag(bool halt);
// If set to true and the CPU is halted, the CPU will step one instruction.
bool GetCpuStepFlag();
/**
* When set to true, the CPU will step one instruction when the CPU is halted next.
*
* @param is_step
*/
void SetCpuStepFlag(bool is_step);
/**
* Send trap signal from thread back to the gdbstub server.
*
* @param thread Sending thread.
* @param trap Trap no.
*/
void SendTrap(Kernel::Thread* thread, int trap);
/**
* Send reply to gdb client.
*
* @param reply Reply to be sent to client.
*/
void SendReply(const char* reply);
/**
* Converts input hex string characters into an array of equivalent of u8 bytes.
*
* @param src Pointer to array of output hex string characters.
* @param len Length of src array.
*/
u32 HexToInt(const u8* src, std::size_t len);
} // namespace GDBStub