diff options
author | polaris- <nagatospam@gmail.com> | 2015-09-02 14:56:38 +0200 |
---|---|---|
committer | polaris- <nagatospam@gmail.com> | 2015-10-04 17:16:59 +0200 |
commit | 31dee93e849d79a91f280faf16941806e3cb3c6b (patch) | |
tree | 22f64217b38dfa38b25a772f9fc5a9b025e1cbd6 /src/core/gdbstub/gdbstub.h | |
parent | OS X build uploading: auto-confirm SSH host key (diff) | |
download | yuzu-31dee93e849d79a91f280faf16941806e3cb3c6b.tar yuzu-31dee93e849d79a91f280faf16941806e3cb3c6b.tar.gz yuzu-31dee93e849d79a91f280faf16941806e3cb3c6b.tar.bz2 yuzu-31dee93e849d79a91f280faf16941806e3cb3c6b.tar.lz yuzu-31dee93e849d79a91f280faf16941806e3cb3c6b.tar.xz yuzu-31dee93e849d79a91f280faf16941806e3cb3c6b.tar.zst yuzu-31dee93e849d79a91f280faf16941806e3cb3c6b.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/gdbstub/gdbstub.h | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/src/core/gdbstub/gdbstub.h b/src/core/gdbstub/gdbstub.h new file mode 100644 index 000000000..11ff823c3 --- /dev/null +++ b/src/core/gdbstub/gdbstub.h @@ -0,0 +1,89 @@ +// 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 <atomic> + +namespace GDBStub { + +/// Breakpoint Method +enum class BreakpointType { + None, ///< None + Execute, ///< Execution Breakpoint + Read, ///< Read Breakpoint + Write, ///< Write Breakpoint + Access ///< Access (R/W) Breakpoint +}; + +/// If set to false, the server will never be started and no gdbstub-related functions will be executed. +extern std::atomic<bool> g_server_enabled; + +/** + * Set the port the gdbstub should use to listen for connections. + * + * @param port Port to listen for connection + */ +void SetServerPort(u16 port); + +/** + * Set the g_server_enabled flag and start or stop the server if possible. + * + * @param status Set the server to enabled or disabled. + */ +void ToggleServer(bool status); + +/// Start the gdbstub server. +void Init(); + +/// Stop gdbstub server. +void Deinit(); + +/// 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(); + +/** + * Get the nearest breakpoint of the specified type at the given address. + * + * @param addr Address to search from. + * @param type Type of breakpoint. + */ +PAddr GetNextBreakpointFromAddress(u32 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(u32 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 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); + +} |