aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-09-04 07:04:49 +0200
committerhachem <im@hachem.wtf>2026-09-04 07:04:49 +0200
commitdcb23f8b4b889061e96d43949d570581469cab84 (patch)
tree2931979a4ba011104cc1931f3d7c30b02538f14b /src
parentd3a1b908fd3b0c47da2c33c16d18ebeb00da3b97 (diff)
refactor: slight cleanup
Diffstat (limited to 'src')
-rw-r--r--src/core/window.cpp4
-rw-r--r--src/core/window.h2
-rw-r--r--src/core/window_manager.cpp2
-rw-r--r--src/core/window_manager.h4
-rw-r--r--src/debugger/debugger.cpp41
-rw-r--r--src/debugger/debugger.h4
-rw-r--r--src/ui/animated_image.cpp26
-rw-r--r--src/ui/macro_expander.cpp26
-rw-r--r--src/ui/profiler.cpp6
-rw-r--r--src/ui/profiler.h2
-rw-r--r--src/ui/source_view.cpp52
-rw-r--r--src/ui/source_view.h2
-rw-r--r--src/ui/ui.cpp66
-rw-r--r--src/ui/ui.h12
14 files changed, 125 insertions, 124 deletions
diff --git a/src/core/window.cpp b/src/core/window.cpp
index 66500db..a87798a 100644
--- a/src/core/window.cpp
+++ b/src/core/window.cpp
@@ -106,9 +106,9 @@ namespace Hsdbg
m_vsync = enabled;
}
- auto Window::set_title(std::string_view title) -> void
+ auto Window::set_title(std::string_view window_title) -> void
{
- m_title = title;
+ m_title = window_title;
glfwSetWindowTitle(m_handle, m_title.c_str());
}
diff --git a/src/core/window.h b/src/core/window.h
index 6a4f747..d5cdaaf 100644
--- a/src/core/window.h
+++ b/src/core/window.h
@@ -34,7 +34,7 @@ namespace Hsdbg
auto swap_buffers() -> void;
auto set_vsync(bool enabled) -> void;
- auto set_title(std::string_view title) -> void;
+ auto set_title(std::string_view window_title) -> void;
auto handle() const -> GLFWwindow* { return m_handle; }
auto title() const -> const std::string& { return m_title; }
diff --git a/src/core/window_manager.cpp b/src/core/window_manager.cpp
index f2e4af3..2b131d1 100644
--- a/src/core/window_manager.cpp
+++ b/src/core/window_manager.cpp
@@ -18,7 +18,7 @@ namespace Hsdbg
glfwSetErrorCallback(on_error);
- const bool initialized = glfwInit() == GLFW_TRUE;
+ [[maybe_unused]] const bool initialized = glfwInit() == GLFW_TRUE;
HSDBG_ASSERT(initialized, "failed to initialize glfw");
Log::info("glfw {}", glfwGetVersionString());
diff --git a/src/core/window_manager.h b/src/core/window_manager.h
index d3a915c..1101db9 100644
--- a/src/core/window_manager.h
+++ b/src/core/window_manager.h
@@ -23,8 +23,8 @@ namespace Hsdbg
auto create_window(const WindowSpec& spec) -> Window&;
auto destroy_window(const Window& window) -> void;
- auto poll_events() -> void;
- auto wait_events(double timeout_seconds) -> void;
+ static auto poll_events() -> void;
+ static auto wait_events(double timeout_seconds) -> void;
auto window_count() const -> size_t { return m_windows.size(); }
diff --git a/src/debugger/debugger.cpp b/src/debugger/debugger.cpp
index d5dccee..aba3aca 100644
--- a/src/debugger/debugger.cpp
+++ b/src/debugger/debugger.cpp
@@ -9,6 +9,7 @@
#include <array>
#include <cctype>
#include <cstdio>
+#include <iterator>
#include <set>
#include <source_location>
@@ -69,6 +70,10 @@ namespace Hsdbg
{
const std::vector<std::filesystem::path> candidates = debug_server_candidates();
+ // on windows the list is empty by design and this returns before the
+ // warning below; cppcheck only sees the platform it runs on, where the
+ // list is never empty
+ // cppcheck-suppress knownConditionTrueFalse
if (candidates.empty())
return;
@@ -182,7 +187,7 @@ namespace Hsdbg
return std::filesystem::path(buffer.data());
}
- auto read_back(lldb::SBTarget& target, lldb::SBBreakpoint& source, Breakpoint& breakpoint) -> void
+ auto read_back(const lldb::SBTarget& target, lldb::SBBreakpoint& source, Breakpoint& breakpoint) -> void
{
breakpoint.enabled = source.IsEnabled();
breakpoint.hit_count = source.GetHitCount();
@@ -289,7 +294,7 @@ namespace Hsdbg
return thread.GetFrameAtIndex(frame_index);
}
- auto instruction_of(lldb::SBTarget& target,
+ auto instruction_of(const lldb::SBTarget& target,
lldb::SBInstruction source,
lldb::addr_t program_counter) -> Instruction
{
@@ -313,7 +318,7 @@ namespace Hsdbg
return entry;
}
- auto instructions_of(lldb::SBTarget& target,
+ auto instructions_of(const lldb::SBTarget& target,
lldb::SBInstructionList source,
lldb::addr_t program_counter) -> std::vector<Instruction>
{
@@ -684,8 +689,8 @@ namespace Hsdbg
std::vector<const char*> arguments;
arguments.reserve(spec.arguments.size() + 1);
- for (const std::string& argument : spec.arguments)
- arguments.push_back(argument.c_str());
+ std::ranges::transform(spec.arguments, std::back_inserter(arguments),
+ [](const std::string& argument) { return argument.c_str(); });
arguments.push_back(nullptr);
@@ -697,8 +702,8 @@ namespace Hsdbg
std::vector<const char*> environment;
environment.reserve(spec.environment.size() + 1);
- for (const std::string& entry : spec.environment)
- environment.push_back(entry.c_str());
+ std::ranges::transform(spec.environment, std::back_inserter(environment),
+ [](const std::string& entry) { return entry.c_str(); });
environment.push_back(nullptr);
@@ -786,7 +791,7 @@ namespace Hsdbg
return {};
}
- auto Debugger::attach(uint64_t process_id) -> Result<void>
+ auto Debugger::attach(uint64_t pid) -> Result<void>
{
if (is_alive(m_session->process))
return fail("already attached to pid {}", m_process_id);
@@ -800,7 +805,7 @@ namespace Hsdbg
return fail("could not create a target to attach with");
}
- lldb::SBAttachInfo info(static_cast<lldb::pid_t>(process_id));
+ lldb::SBAttachInfo info(static_cast<lldb::pid_t>(pid));
info.SetListener(m_session->listener);
set_state(TargetState::Launching);
@@ -813,7 +818,7 @@ namespace Hsdbg
set_state(m_target_path.empty() ? TargetState::NoTarget : TargetState::Loaded);
return fail("could not attach to pid {}: {}",
- process_id,
+ pid,
message_of(error, "unknown error"));
}
@@ -1794,8 +1799,8 @@ namespace Hsdbg
auto Debugger::take_sample_and_resume() -> bool
{
// a real breakpoint landing at the same time is a genuine stop, not a sample
- const uint32_t threads = m_session->process.GetNumThreads();
- for (uint32_t index = 0; index < threads; ++index)
+ const uint32_t thread_count = m_session->process.GetNumThreads();
+ for (uint32_t index = 0; index < thread_count; ++index)
{
lldb::SBThread thread = m_session->process.GetThreadAtIndex(index);
if (thread.IsValid() && thread.GetStopReason() == lldb::eStopReasonBreakpoint)
@@ -1810,11 +1815,11 @@ namespace Hsdbg
auto Debugger::take_sample() -> void
{
const double now = trace_now();
- const uint32_t threads = m_session->process.GetNumThreads();
+ const uint32_t thread_count = m_session->process.GetNumThreads();
std::vector<uint32_t> stack;
- for (uint32_t index = 0; index < threads; ++index)
+ for (uint32_t index = 0; index < thread_count; ++index)
{
lldb::SBThread thread = m_session->process.GetThreadAtIndex(index);
if (!thread.IsValid())
@@ -2448,13 +2453,13 @@ namespace Hsdbg
}
}
- auto Debugger::set_state(TargetState state) -> void
+ auto Debugger::set_state(TargetState next_state) -> void
{
- if (m_state == state)
+ if (m_state == next_state)
return;
- Log::debug("debugger: {} -> {}", to_string(m_state), to_string(state));
+ Log::debug("debugger: {} -> {}", to_string(m_state), to_string(next_state));
- m_state = state;
+ m_state = next_state;
}
}
diff --git a/src/debugger/debugger.h b/src/debugger/debugger.h
index e2f4c62..840dff1 100644
--- a/src/debugger/debugger.h
+++ b/src/debugger/debugger.h
@@ -35,7 +35,7 @@ namespace Hsdbg
auto load_target(const std::filesystem::path& executable) -> Result<void>;
auto unload_target() -> void;
auto launch(const LaunchSpec& spec) -> Result<void>;
- auto attach(uint64_t process_id) -> Result<void>;
+ auto attach(uint64_t pid) -> Result<void>;
auto detach() -> Result<void>;
auto terminate() -> Result<void>;
@@ -128,7 +128,7 @@ namespace Hsdbg
// keeps the lldb headers out of everything that talks to the debugger
struct Session;
- auto set_state(TargetState state) -> void;
+ auto set_state(TargetState next_state) -> void;
auto resolve_breakpoint(Breakpoint& breakpoint) -> void;
auto sync_breakpoints() -> void;
diff --git a/src/ui/animated_image.cpp b/src/ui/animated_image.cpp
index d7c6536..94ad8bc 100644
--- a/src/ui/animated_image.cpp
+++ b/src/ui/animated_image.cpp
@@ -130,25 +130,25 @@ namespace Hsdbg
}
const auto length = static_cast<int>(bytes.size());
- int width = 0;
- int height = 0;
+ int pixel_width = 0;
+ int pixel_height = 0;
int comp = 0;
int frames = 0;
int* delays = nullptr;
if (stbi_uc* data = stbi_load_gif_from_memory(bytes.data(), length, &delays,
- &width, &height, &frames, &comp, 4))
+ &pixel_width, &pixel_height, &frames, &comp, 4))
{
- m_width = width;
- m_height = height;
+ m_width = pixel_width;
+ m_height = pixel_height;
for (int index = 0; index < frames; ++index)
{
- stbi_uc* frame = data + static_cast<std::size_t>(index) * width * height * 4;
+ stbi_uc* frame = data + static_cast<std::size_t>(index) * pixel_width * pixel_height * 4;
- bleed_edges(frame, width, height);
- m_frames.push_back(upload(frame, width, height));
+ bleed_edges(frame, pixel_width, pixel_height);
+ m_frames.push_back(upload(frame, pixel_width, pixel_height));
const float seconds = delays != nullptr
? static_cast<float>(delays[index]) / 1000.0f
@@ -161,12 +161,12 @@ namespace Hsdbg
std::free(delays);
}
else if (stbi_uc* still = stbi_load_from_memory(bytes.data(), length,
- &width, &height, &comp, 4))
+ &pixel_width, &pixel_height, &comp, 4))
{
- m_width = width;
- m_height = height;
- bleed_edges(still, width, height);
- m_frames.push_back(upload(still, width, height));
+ m_width = pixel_width;
+ m_height = pixel_height;
+ bleed_edges(still, pixel_width, pixel_height);
+ m_frames.push_back(upload(still, pixel_width, pixel_height));
m_delays.push_back(MIN_FRAME_SECONDS);
stbi_image_free(still);
}
diff --git a/src/ui/macro_expander.cpp b/src/ui/macro_expander.cpp
index f4588c3..a2ca62c 100644
--- a/src/ui/macro_expander.cpp
+++ b/src/ui/macro_expander.cpp
@@ -3,6 +3,7 @@
#include <algorithm>
#include <cctype>
#include <fstream>
+#include <iterator>
namespace Hsdbg
{
@@ -111,15 +112,17 @@ namespace Hsdbg
"^=", "++", "--", ".*",
};
- for (const std::string_view op : multis)
+ const auto multi = std::ranges::find_if(multis, [&](std::string_view op)
{
- if (text.compare(at, op.size(), op) == 0)
- {
- at += op.size();
- token.kind = PpKind::Punct;
- token.text = std::string(op);
- return token;
- }
+ return text.compare(at, op.size(), op) == 0;
+ });
+
+ if (multi != std::end(multis))
+ {
+ at += multi->size();
+ token.kind = PpKind::Punct;
+ token.text = std::string(*multi);
+ return token;
}
token.kind = PpKind::Punct;
@@ -508,8 +511,11 @@ namespace Hsdbg
ArgList expanded_args;
expanded_args.reserve(args.size());
- for (const std::vector<PpToken>& arg : args)
- expanded_args.push_back(expand_full(table, arg));
+ std::ranges::transform(args, std::back_inserter(expanded_args),
+ [&](const std::vector<PpToken>& arg)
+ {
+ return expand_full(table, arg);
+ });
std::vector<PpToken> repl = substitute(*def, args, expanded_args);
diff --git a/src/ui/profiler.cpp b/src/ui/profiler.cpp
index df22a20..b917704 100644
--- a/src/ui/profiler.cpp
+++ b/src/ui/profiler.cpp
@@ -1,5 +1,7 @@
#include "ui/profiler.h"
+#include <numeric>
+
namespace Hsdbg
{
auto TimeSeries::push(float value) -> void
@@ -32,9 +34,7 @@ namespace Hsdbg
if (m_count == 0)
return 0.0f;
- float sum = 0.0f;
- for (int i = 0; i < m_count; ++i)
- sum += m_values[i];
+ const float sum = std::accumulate(m_values.begin(), m_values.begin() + m_count, 0.0f);
return sum / static_cast<float>(m_count);
}
diff --git a/src/ui/profiler.h b/src/ui/profiler.h
index 0ceb740..db16f8e 100644
--- a/src/ui/profiler.h
+++ b/src/ui/profiler.h
@@ -50,7 +50,7 @@ namespace Hsdbg
auto target_memory_mb() const -> const TimeSeries& { return m_target_memory_mb; }
auto paused() const -> bool { return m_paused; }
- auto set_paused(bool paused) -> void { m_paused = paused; }
+ auto set_paused(bool value) -> void { m_paused = value; }
private:
TimeSeries m_frame_ms;
diff --git a/src/ui/source_view.cpp b/src/ui/source_view.cpp
index 7638f17..0a6a230 100644
--- a/src/ui/source_view.cpp
+++ b/src/ui/source_view.cpp
@@ -11,6 +11,7 @@
#include <cctype>
#include <fstream>
#include <optional>
+#include <span>
#include <string_view>
#include <unordered_set>
@@ -91,13 +92,10 @@ namespace Hsdbg
auto only_space_before(const std::string& line, uint32_t upto) -> bool
{
- for (uint32_t index = 0; index < upto; ++index)
+ return std::ranges::all_of(line.begin(), line.begin() + upto, [](char character)
{
- if (std::isspace(static_cast<unsigned char>(line[index])) == 0)
- return false;
- }
-
- return true;
+ return std::isspace(static_cast<unsigned char>(character)) != 0;
+ });
}
// splits every line into contiguous coloured spans. the whole file is
@@ -372,11 +370,11 @@ namespace Hsdbg
}
}
- auto SourceView::open(const std::filesystem::path& path) -> Result<void>
+ auto SourceView::open(const std::filesystem::path& file_path) -> Result<void>
{
- std::ifstream file(path);
+ std::ifstream file(file_path);
if (!file.is_open())
- return fail("could not open '{}'", path.string());
+ return fail("could not open '{}'", file_path.string());
std::vector<std::string> lines;
std::string line;
@@ -389,9 +387,9 @@ namespace Hsdbg
lines.push_back(std::move(line));
}
- const std::optional<Language> language = language_of(path);
+ const std::optional<Language> language = language_of(file_path);
- m_path = path;
+ m_path = file_path;
m_lines = std::move(lines);
m_highlight = language.has_value();
@@ -400,11 +398,11 @@ namespace Hsdbg
m_macros.clear();
if (language == Language::Cpp)
- m_macros.build(m_lines, path.parent_path());
+ m_macros.build(m_lines, file_path.parent_path());
m_spans = language ? highlight_lines(m_lines, *language, m_macros)
: std::vector<std::vector<SourceSpan>>{};
- m_path_input = path.string();
+ m_path_input = file_path.string();
m_error.clear();
m_highlighted_line = 0;
@@ -519,16 +517,12 @@ namespace Hsdbg
if (ImGui::InvisibleButton("##gutter", ImVec2(GUTTER_WIDTH, text_height)))
{
- const Breakpoint* existing = nullptr;
-
- for (const Breakpoint& breakpoint : debugger.breakpoints())
+ const std::span<const Breakpoint> breakpoints = debugger.breakpoints();
+ const auto found = std::ranges::find_if(breakpoints, [&](const Breakpoint& candidate)
{
- if (breakpoint.file == m_path && breakpoint.line == line_number)
- {
- existing = &breakpoint;
- break;
- }
- }
+ return candidate.file == m_path && candidate.line == line_number;
+ });
+ const Breakpoint* existing = found != breakpoints.end() ? &*found : nullptr;
if (existing != nullptr)
debugger.remove_breakpoint(existing->id);
@@ -540,16 +534,12 @@ namespace Hsdbg
ImGui::PopID();
- const Breakpoint* breakpoint = nullptr;
-
- for (const Breakpoint& candidate : debugger.breakpoints())
+ const std::span<const Breakpoint> breakpoints = debugger.breakpoints();
+ const auto found = std::ranges::find_if(breakpoints, [&](const Breakpoint& candidate)
{
- if (candidate.file == m_path && candidate.line == line_number)
- {
- breakpoint = &candidate;
- break;
- }
- }
+ return candidate.file == m_path && candidate.line == line_number;
+ });
+ const Breakpoint* breakpoint = found != breakpoints.end() ? &*found : nullptr;
const ImVec2 marker_center(row_start.x + GUTTER_WIDTH * 0.5f,
row_start.y + text_height * 0.5f);
diff --git a/src/ui/source_view.h b/src/ui/source_view.h
index c8a9a21..0c10efa 100644
--- a/src/ui/source_view.h
+++ b/src/ui/source_view.h
@@ -39,7 +39,7 @@ namespace Hsdbg
class SourceView
{
public:
- auto open(const std::filesystem::path& path) -> Result<void>;
+ auto open(const std::filesystem::path& file_path) -> Result<void>;
auto close() -> void;
auto draw(Debugger& debugger) -> void;
diff --git a/src/ui/ui.cpp b/src/ui/ui.cpp
index f39b95f..14fd1d8 100644
--- a/src/ui/ui.cpp
+++ b/src/ui/ui.cpp
@@ -73,21 +73,21 @@ namespace Hsdbg
// the dim connectors drawn between a folder and its children
const ImU32 SOURCE_TREE_LINE_COLOR = IM_COL32(110, 110, 122, 160);
- auto breakpoint_at(Debugger& debugger, const Instruction& instruction) -> const Breakpoint*
+ auto breakpoint_at(const Debugger& debugger, const Instruction& instruction) -> const Breakpoint*
{
- for (const Breakpoint& candidate : debugger.breakpoints())
+ const std::span<const Breakpoint> breakpoints = debugger.breakpoints();
+ const auto found = std::ranges::find_if(breakpoints, [&](const Breakpoint& candidate)
{
if (instruction.file_address != 0 &&
candidate.file_address == instruction.file_address)
{
- return &candidate;
+ return true;
}
- if (candidate.address != 0 && candidate.address == instruction.address)
- return &candidate;
- }
+ return candidate.address != 0 && candidate.address == instruction.address;
+ });
- return nullptr;
+ return found != breakpoints.end() ? &*found : nullptr;
}
auto toggle_instruction_breakpoint(Debugger& debugger, const Instruction& instruction) -> void
@@ -128,11 +128,10 @@ namespace Hsdbg
auto find_or_add_child(std::vector<SourceNode>& nodes, std::string_view name) -> SourceNode&
{
- for (SourceNode& node : nodes)
- {
- if (node.name == name)
- return node;
- }
+ const auto existing = std::ranges::find(nodes, name, &SourceNode::name);
+
+ if (existing != nodes.end())
+ return *existing;
nodes.push_back({ std::string(name), {}, {} });
return nodes.back();
@@ -242,19 +241,20 @@ namespace Hsdbg
auto preferred_source(std::span<const std::filesystem::path> files) -> std::filesystem::path
{
- for (const std::filesystem::path& file : files)
+ const auto named_main = std::ranges::find_if(files, [](const std::filesystem::path& file)
{
- if (file.stem() == "main" && std::filesystem::exists(file))
- return file;
- }
+ return file.stem() == "main" && std::filesystem::exists(file);
+ });
- for (const std::filesystem::path& file : files)
+ if (named_main != files.end())
+ return *named_main;
+
+ const auto existing = std::ranges::find_if(files, [](const std::filesystem::path& file)
{
- if (std::filesystem::exists(file))
- return file;
- }
+ return std::filesystem::exists(file);
+ });
- return {};
+ return existing != files.end() ? *existing : std::filesystem::path{};
}
auto draw_instruction_table(Debugger& debugger,
@@ -913,7 +913,7 @@ namespace Hsdbg
ImGui::PopStyleVar(2);
}
- auto Ui::draw_status_bar(Debugger& debugger) -> void
+ auto Ui::draw_status_bar(const Debugger& debugger) -> void
{
ImGui::Separator();
@@ -1376,7 +1376,7 @@ namespace Hsdbg
ImGui::End();
}
- auto Ui::draw_source_tree_panel(Debugger& debugger) -> void
+ auto Ui::draw_source_tree_panel(const Debugger& debugger) -> void
{
if (!m_visible.source_tree)
return;
@@ -1485,7 +1485,7 @@ namespace Hsdbg
ImGui::End();
}
- auto Ui::draw_locals_panel(Debugger& debugger) -> void
+ auto Ui::draw_locals_panel(const Debugger& debugger) -> void
{
if (!m_visible.locals)
return;
@@ -1520,7 +1520,7 @@ namespace Hsdbg
ImGui::End();
}
- auto Ui::draw_registers_panel(Debugger& debugger) -> void
+ auto Ui::draw_registers_panel(const Debugger& debugger) -> void
{
if (!m_visible.registers)
return;
@@ -1944,8 +1944,8 @@ namespace Hsdbg
ImGui::InvisibleButton("##timeline_canvas", ImVec2(canvas_w, canvas_h));
const bool canvas_hovered = ImGui::IsItemHovered();
- ImDrawList* draw = ImGui::GetWindowDrawList();
- draw->PushClipRect(origin, ImVec2(origin.x + canvas_w, origin.y + canvas_h), true);
+ ImDrawList* draw_list = ImGui::GetWindowDrawList();
+ draw_list->PushClipRect(origin, ImVec2(origin.x + canvas_w, origin.y + canvas_h), true);
const float scale = canvas_w / static_cast<float>(range); // pixels per second
const float baseline = origin.y + canvas_h; // row 0 rests on the bottom
@@ -1961,15 +1961,15 @@ namespace Hsdbg
const ImU32 fill = ImColor::HSV(span.trace_id * 0.13f, 0.55f, 0.78f);
- draw->AddRectFilled(ImVec2(x0, y0), ImVec2(x0 + width, y1), fill, 2.0f);
- draw->AddRect(ImVec2(x0, y0), ImVec2(x0 + width, y1), IM_COL32(0, 0, 0, 90), 2.0f);
+ draw_list->AddRectFilled(ImVec2(x0, y0), ImVec2(x0 + width, y1), fill, 2.0f);
+ draw_list->AddRect(ImVec2(x0, y0), ImVec2(x0 + width, y1), IM_COL32(0, 0, 0, 90), 2.0f);
if (width > 24.0f)
{
- draw->PushClipRect(ImVec2(x0 + 2.0f, y0), ImVec2(x0 + width - 2.0f, y1), true);
- draw->AddText(ImVec2(x0 + 4.0f, y0 + 2.0f), IM_COL32(20, 20, 20, 255),
+ draw_list->PushClipRect(ImVec2(x0 + 2.0f, y0), ImVec2(x0 + width - 2.0f, y1), true);
+ draw_list->AddText(ImVec2(x0 + 4.0f, y0 + 2.0f), IM_COL32(20, 20, 20, 255),
name_of(span.trace_id));
- draw->PopClipRect();
+ draw_list->PopClipRect();
}
const bool over = canvas_hovered && mouse.x >= x0 && mouse.x <= x0 + width &&
@@ -1988,7 +1988,7 @@ namespace Hsdbg
}
}
- draw->PopClipRect();
+ draw_list->PopClipRect();
}
}
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 70cf691..3365e51 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -30,7 +30,7 @@ namespace Hsdbg
auto operator=(const Ui&) -> Ui& = delete;
auto operator=(Ui&&) -> Ui& = delete;
- auto begin_frame() -> void;
+ static auto begin_frame() -> void;
auto draw(Debugger& debugger) -> void;
auto end_frame() -> void;
@@ -57,11 +57,11 @@ namespace Hsdbg
};
auto apply_style() -> void;
- auto build_default_layout(uint32_t dockspace_id) -> void;
+ static auto build_default_layout(uint32_t dockspace_id) -> void;
auto draw_menu_bar(Debugger& debugger) -> void;
auto draw_toolbar(Debugger& debugger) -> void;
- auto draw_status_bar(Debugger& debugger) -> void;
+ auto draw_status_bar(const Debugger& debugger) -> void;
auto draw_load_target_popup(Debugger& debugger) -> void;
auto draw_preferences_window() -> void;
auto apply_preferences() -> void;
@@ -70,9 +70,9 @@ namespace Hsdbg
auto draw_breakpoints_panel(Debugger& debugger) -> void;
auto draw_call_stack_panel(Debugger& debugger) -> void;
auto draw_threads_panel(Debugger& debugger) -> void;
- auto draw_source_tree_panel(Debugger& debugger) -> void;
- auto draw_locals_panel(Debugger& debugger) -> void;
- auto draw_registers_panel(Debugger& debugger) -> void;
+ auto draw_source_tree_panel(const Debugger& debugger) -> void;
+ auto draw_locals_panel(const Debugger& debugger) -> void;
+ auto draw_registers_panel(const Debugger& debugger) -> void;
auto draw_symbols_panel(Debugger& debugger) -> void;
auto draw_disassembly_panel(Debugger& debugger) -> void;
auto draw_console_panel(Debugger& debugger) -> void;