From 7e53abd75355caa817532c71a935b6a231b3cd9e Mon Sep 17 00:00:00 2001 From: hachem Date: Fri, 26 Sep 2025 16:58:48 +0200 Subject: feat: attempt to add a profiler...didn't work --- src/debugger/debugger.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/debugger/debugger.h') diff --git a/src/debugger/debugger.h b/src/debugger/debugger.h index 06b6ae9..5e154b2 100644 --- a/src/debugger/debugger.h +++ b/src/debugger/debugger.h @@ -3,6 +3,7 @@ #include "core/result.h" #include "debugger/types.h" +#include #include #include #include @@ -49,6 +50,11 @@ namespace Hsdbg auto find_breakpoint(uint32_t id) -> Breakpoint*; auto breakpoints() const -> std::span { return m_breakpoints; } + auto add_trace(std::string_view function) -> uint32_t; + auto remove_trace(uint32_t id) -> bool; + auto clear_traces() -> void; + auto traces() const -> std::span { return m_traces; } + auto threads() const -> std::span { return m_threads; } auto call_stack() const -> std::span { return m_call_stack; } auto locals() const -> std::span { return m_locals; } @@ -61,6 +67,8 @@ namespace Hsdbg auto read_memory(uint64_t address, size_t size) -> Result>; auto console_output() const -> std::span { return m_console_output; } + auto resident_memory() const -> uint64_t { return m_resident_memory; } + auto select_thread(uint64_t thread_id) -> bool; auto select_frame(uint32_t frame_index) -> bool; auto select_symbol(uint64_t file_address) -> bool; @@ -101,6 +109,12 @@ namespace Hsdbg auto refresh_source_files() -> void; auto refresh_disassembly() -> void; auto load_disassembly(uint64_t file_address) -> void; + auto sample_process_stats() -> void; + + auto resolve_trace(FunctionTrace& trace) -> void; + + auto handle_trace_stop() -> bool; + auto trace_now() const -> double; std::unique_ptr m_session; @@ -113,6 +127,9 @@ namespace Hsdbg std::vector m_breakpoints; uint32_t m_next_breakpoint_id = 1; + std::vector m_traces; + uint32_t m_next_trace_id = 1; + std::vector m_threads; std::vector m_call_stack; std::vector m_locals; @@ -127,5 +144,8 @@ namespace Hsdbg uint32_t m_selected_frame = 0; uint64_t m_selected_symbol = 0; uint64_t m_stop_count = 0; + uint64_t m_resident_memory = 0; + + std::chrono::steady_clock::time_point m_trace_epoch = std::chrono::steady_clock::now(); }; } -- cgit v1.3