diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2022-04-01 20:58:27 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-04-01 21:24:45 +0100 |
commit | 086969277e74d8ba065bf8145d3aeb0dec0bfee5 (patch) | |
tree | 02b3699a66735ef806d9b46353491f18f8e4e7b4 /Userland/DevTools/HackStudio/Debugger | |
parent | 0376c127f6e98e03607700d0b3f5154b7014b2f8 (diff) | |
download | serenity-086969277e74d8ba065bf8145d3aeb0dec0bfee5.zip |
Everywhere: Run clang-format
Diffstat (limited to 'Userland/DevTools/HackStudio/Debugger')
21 files changed, 71 insertions, 71 deletions
diff --git a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp index 0ae6152e44..432dfbab1e 100644 --- a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp @@ -10,7 +10,7 @@ namespace HackStudio { -NonnullRefPtr<BacktraceModel> BacktraceModel::create(Debug::ProcessInspector const& inspector, const PtraceRegisters& regs) +NonnullRefPtr<BacktraceModel> BacktraceModel::create(Debug::ProcessInspector const& inspector, PtraceRegisters const& regs) { return adopt_ref(*new BacktraceModel(create_backtrace(inspector, regs))); } diff --git a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h index 4eefb54a89..74aedfc412 100644 --- a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h +++ b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h @@ -43,7 +43,7 @@ public: Optional<Debug::DebugInfo::SourcePosition> m_source_position; }; - const Vector<FrameInfo>& frames() const { return m_frames; } + Vector<FrameInfo> const& frames() const { return m_frames; } private: explicit BacktraceModel(Vector<FrameInfo>&& frames) diff --git a/Userland/DevTools/HackStudio/Debugger/BreakpointCallback.h b/Userland/DevTools/HackStudio/Debugger/BreakpointCallback.h index 45a3207c08..98d7b30edc 100644 --- a/Userland/DevTools/HackStudio/Debugger/BreakpointCallback.h +++ b/Userland/DevTools/HackStudio/Debugger/BreakpointCallback.h @@ -17,5 +17,5 @@ enum class BreakpointChange { Removed, }; -using BreakpointChangeCallback = Function<void(const String& file, size_t line, BreakpointChange)>; +using BreakpointChangeCallback = Function<void(String const& file, size_t line, BreakpointChange)>; } diff --git a/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp b/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp index 997b8a91b2..4ff7c4148c 100644 --- a/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp +++ b/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp @@ -89,7 +89,7 @@ DebugInfoWidget::DebugInfoWidget() }; } -bool DebugInfoWidget::does_variable_support_writing(const Debug::DebugInfo::VariableInfo* variable) +bool DebugInfoWidget::does_variable_support_writing(Debug::DebugInfo::VariableInfo const* variable) { if (variable->location_type != Debug::DebugInfo::VariableInfo::LocationType::Address) return false; @@ -102,7 +102,7 @@ RefPtr<GUI::Menu> DebugInfoWidget::get_context_menu_for_variable(const GUI::Mode return nullptr; auto context_menu = GUI::Menu::construct(); - auto* variable = static_cast<const Debug::DebugInfo::VariableInfo*>(index.internal_data()); + auto* variable = static_cast<Debug::DebugInfo::VariableInfo const*>(index.internal_data()); if (does_variable_support_writing(variable)) { context_menu->add_action(GUI::Action::create("Change value", [&](auto&) { String value; @@ -155,7 +155,7 @@ NonnullRefPtr<GUI::Widget> DebugInfoWidget::build_registers_tab() return registers_widget; } -void DebugInfoWidget::update_state(Debug::ProcessInspector& inspector, const PtraceRegisters& regs) +void DebugInfoWidget::update_state(Debug::ProcessInspector& inspector, PtraceRegisters const& regs) { m_variables_view->set_model(VariablesModel::create(inspector, regs)); m_backtrace_view->set_model(BacktraceModel::create(inspector, regs)); diff --git a/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.h b/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.h index 0cf30d5648..2f72f4c285 100644 --- a/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.h +++ b/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.h @@ -38,7 +38,7 @@ private: NonnullRefPtr<GUI::Widget> build_variables_tab(); NonnullRefPtr<GUI::Widget> build_registers_tab(); - bool does_variable_support_writing(const Debug::DebugInfo::VariableInfo*); + bool does_variable_support_writing(Debug::DebugInfo::VariableInfo const*); RefPtr<GUI::Menu> get_context_menu_for_variable(const GUI::ModelIndex&); RefPtr<GUI::TreeView> m_variables_view; diff --git a/Userland/DevTools/HackStudio/Debugger/Debugger.cpp b/Userland/DevTools/HackStudio/Debugger/Debugger.cpp index 9a02d5962a..71d8bf39b7 100644 --- a/Userland/DevTools/HackStudio/Debugger/Debugger.cpp +++ b/Userland/DevTools/HackStudio/Debugger/Debugger.cpp @@ -19,7 +19,7 @@ Debugger& Debugger::the() void Debugger::initialize( String source_root, - Function<HasControlPassedToUser(const PtraceRegisters&)> on_stop_callback, + Function<HasControlPassedToUser(PtraceRegisters const&)> on_stop_callback, Function<void()> on_continue_callback, Function<void()> on_exit_callback) { @@ -33,7 +33,7 @@ bool Debugger::is_initialized() Debugger::Debugger( String source_root, - Function<HasControlPassedToUser(const PtraceRegisters&)> on_stop_callback, + Function<HasControlPassedToUser(PtraceRegisters const&)> on_stop_callback, Function<void()> on_continue_callback, Function<void()> on_exit_callback) : m_source_root(source_root) @@ -45,14 +45,14 @@ Debugger::Debugger( pthread_cond_init(&m_ui_action_cond, nullptr); } -void Debugger::on_breakpoint_change(const String& file, size_t line, BreakpointChange change_type) +void Debugger::on_breakpoint_change(String const& file, size_t line, BreakpointChange change_type) { auto position = create_source_position(file, line); if (change_type == BreakpointChange::Added) { m_breakpoints.append(position); } else { - m_breakpoints.remove_all_matching([&](const Debug::DebugInfo::SourcePosition& val) { return val == position; }); + m_breakpoints.remove_all_matching([&](Debug::DebugInfo::SourcePosition const& val) { return val == position; }); } auto session = Debugger::the().session(); @@ -77,7 +77,7 @@ void Debugger::on_breakpoint_change(const String& file, size_t line, BreakpointC } } -bool Debugger::set_execution_position(const String& file, size_t line) +bool Debugger::set_execution_position(String const& file, size_t line) { auto position = create_source_position(file, line); auto session = Debugger::the().session(); @@ -92,7 +92,7 @@ bool Debugger::set_execution_position(const String& file, size_t line) return true; } -Debug::DebugInfo::SourcePosition Debugger::create_source_position(const String& file, size_t line) +Debug::DebugInfo::SourcePosition Debugger::create_source_position(String const& file, size_t line) { if (file.starts_with("/")) return { file, line + 1 }; @@ -121,7 +121,7 @@ void Debugger::start() m_debug_session = Debug::DebugSession::exec_and_attach(m_executable_path, m_source_root, move(child_setup_callback)); VERIFY(!!m_debug_session); - for (const auto& breakpoint : m_breakpoints) { + for (auto const& breakpoint : m_breakpoints) { dbgln("inserting breakpoint at: {}:{}", breakpoint.file_path, breakpoint.line_number); auto address = m_debug_session->get_address_from_source_position(breakpoint.file_path, breakpoint.line_number); if (address.has_value()) { @@ -218,7 +218,7 @@ void Debugger::DebuggingState::set_single_stepping(Debug::DebugInfo::SourcePosit m_original_source_position = original_source_position; } -bool Debugger::DebuggingState::should_stop_single_stepping(const Debug::DebugInfo::SourcePosition& current_source_position) const +bool Debugger::DebuggingState::should_stop_single_stepping(Debug::DebugInfo::SourcePosition const& current_source_position) const { VERIFY(m_state == State::SingleStepping); return m_original_source_position.value() != current_source_position; @@ -243,7 +243,7 @@ void Debugger::DebuggingState::add_temporary_breakpoint(FlatPtr address) m_addresses_of_temporary_breakpoints.append(address); } -void Debugger::do_step_out(const PtraceRegisters& regs) +void Debugger::do_step_out(PtraceRegisters const& regs) { // To step out, we simply insert a temporary breakpoint at the // instruction the current function returns to, and continue @@ -251,7 +251,7 @@ void Debugger::do_step_out(const PtraceRegisters& regs) insert_temporary_breakpoint_at_return_address(regs); } -void Debugger::do_step_over(const PtraceRegisters& regs) +void Debugger::do_step_over(PtraceRegisters const& regs) { // To step over, we insert a temporary breakpoint at each line in the current function, // as well as at the current function's return point, and continue execution. @@ -265,13 +265,13 @@ void Debugger::do_step_over(const PtraceRegisters& regs) } VERIFY(current_function.has_value()); auto lines_in_current_function = lib->debug_info->source_lines_in_scope(current_function.value()); - for (const auto& line : lines_in_current_function) { + for (auto const& line : lines_in_current_function) { insert_temporary_breakpoint(line.address_of_first_statement.value() + lib->base_address); } insert_temporary_breakpoint_at_return_address(regs); } -void Debugger::insert_temporary_breakpoint_at_return_address(const PtraceRegisters& regs) +void Debugger::insert_temporary_breakpoint_at_return_address(PtraceRegisters const& regs) { auto frame_info = Debug::StackFrameUtils::get_info(*m_debug_session, regs.bp()); VERIFY(frame_info.has_value()); diff --git a/Userland/DevTools/HackStudio/Debugger/Debugger.h b/Userland/DevTools/HackStudio/Debugger/Debugger.h index eca9d30b76..eaf14e5a5c 100644 --- a/Userland/DevTools/HackStudio/Debugger/Debugger.h +++ b/Userland/DevTools/HackStudio/Debugger/Debugger.h @@ -27,17 +27,17 @@ public: static void initialize( String source_root, - Function<HasControlPassedToUser(const PtraceRegisters&)> on_stop_callback, + Function<HasControlPassedToUser(PtraceRegisters const&)> on_stop_callback, Function<void()> on_continue_callback, Function<void()> on_exit_callback); static bool is_initialized(); - void on_breakpoint_change(const String& file, size_t line, BreakpointChange change_type); - bool set_execution_position(const String& file, size_t line); + void on_breakpoint_change(String const& file, size_t line, BreakpointChange change_type); + bool set_execution_position(String const& file, size_t line); - void set_executable_path(const String& path) { m_executable_path = path; } - void set_source_root(const String& source_root) { m_source_root = source_root; } + void set_executable_path(String const& path) { m_executable_path = path; } + void set_source_root(String const& source_root) { m_source_root = source_root; } Debug::DebugSession* session() { return m_debug_session.ptr(); } @@ -78,10 +78,10 @@ private: void set_stepping_out() { m_state = State::SteppingOut; } void set_stepping_over() { m_state = State::SteppingOver; } - bool should_stop_single_stepping(const Debug::DebugInfo::SourcePosition& current_source_position) const; + bool should_stop_single_stepping(Debug::DebugInfo::SourcePosition const& current_source_position) const; void clear_temporary_breakpoints(); void add_temporary_breakpoint(FlatPtr address); - const Vector<FlatPtr>& temporary_breakpoints() const { return m_addresses_of_temporary_breakpoints; } + Vector<FlatPtr> const& temporary_breakpoints() const { return m_addresses_of_temporary_breakpoints; } private: State m_state { Normal }; @@ -91,20 +91,20 @@ private: explicit Debugger( String source_root, - Function<HasControlPassedToUser(const PtraceRegisters&)> on_stop_callback, + Function<HasControlPassedToUser(PtraceRegisters const&)> on_stop_callback, Function<void()> on_continue_callback, Function<void()> on_exit_callback); - Debug::DebugInfo::SourcePosition create_source_position(const String& file, size_t line); + Debug::DebugInfo::SourcePosition create_source_position(String const& file, size_t line); void start(); int debugger_loop(); void remove_temporary_breakpoints(); - void do_step_out(const PtraceRegisters&); - void do_step_over(const PtraceRegisters&); + void do_step_out(PtraceRegisters const&); + void do_step_over(PtraceRegisters const&); void insert_temporary_breakpoint(FlatPtr address); - void insert_temporary_breakpoint_at_return_address(const PtraceRegisters&); + void insert_temporary_breakpoint_at_return_address(PtraceRegisters const&); OwnPtr<Debug::DebugSession> m_debug_session; String m_source_root; @@ -118,7 +118,7 @@ private: String m_executable_path; - Function<HasControlPassedToUser(const PtraceRegisters&)> m_on_stopped_callback; + Function<HasControlPassedToUser(PtraceRegisters const&)> m_on_stopped_callback; Function<void()> m_on_continue_callback; Function<void()> m_on_exit_callback; Function<ErrorOr<void>()> m_child_setup_callback; diff --git a/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.cpp b/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.cpp index 90e8abe82e..70822d9299 100644 --- a/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.cpp +++ b/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.cpp @@ -58,7 +58,7 @@ JS::ThrowCompletionOr<bool> DebuggerGlobalJSObject::internal_set(JS::PropertyKey return vm().throw_completion<JS::TypeError>(const_cast<DebuggerGlobalJSObject&>(*this), move(error_string)); } -Optional<JS::Value> DebuggerGlobalJSObject::debugger_to_js(const Debug::DebugInfo::VariableInfo& variable) const +Optional<JS::Value> DebuggerGlobalJSObject::debugger_to_js(Debug::DebugInfo::VariableInfo const& variable) const { if (variable.location_type != Debug::DebugInfo::VariableInfo::LocationType::Address) return {}; @@ -94,7 +94,7 @@ Optional<JS::Value> DebuggerGlobalJSObject::debugger_to_js(const Debug::DebugInf return JS::Value(object); } -Optional<u32> DebuggerGlobalJSObject::js_to_debugger(JS::Value value, const Debug::DebugInfo::VariableInfo& variable) const +Optional<u32> DebuggerGlobalJSObject::js_to_debugger(JS::Value value, Debug::DebugInfo::VariableInfo const& variable) const { if (value.is_string() && variable.type_name == "char") { auto string = value.as_string().string(); diff --git a/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.h b/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.h index cb1560ab28..a1f3b09e01 100644 --- a/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.h +++ b/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.h @@ -24,8 +24,8 @@ public: virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyKey const&, JS::Value receiver) const override; virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyKey const&, JS::Value value, JS::Value receiver) override; - Optional<JS::Value> debugger_to_js(const Debug::DebugInfo::VariableInfo&) const; - Optional<u32> js_to_debugger(JS::Value value, const Debug::DebugInfo::VariableInfo&) const; + Optional<JS::Value> debugger_to_js(Debug::DebugInfo::VariableInfo const&) const; + Optional<u32> js_to_debugger(JS::Value value, Debug::DebugInfo::VariableInfo const&) const; private: NonnullOwnPtrVector<Debug::DebugInfo::VariableInfo> m_variables; diff --git a/Userland/DevTools/HackStudio/Debugger/DebuggerVariableJSObject.cpp b/Userland/DevTools/HackStudio/Debugger/DebuggerVariableJSObject.cpp index 063f1fd4cb..97db4eeffe 100644 --- a/Userland/DevTools/HackStudio/Debugger/DebuggerVariableJSObject.cpp +++ b/Userland/DevTools/HackStudio/Debugger/DebuggerVariableJSObject.cpp @@ -15,12 +15,12 @@ namespace HackStudio { -DebuggerVariableJSObject* DebuggerVariableJSObject::create(DebuggerGlobalJSObject& global_object, const Debug::DebugInfo::VariableInfo& variable_info) +DebuggerVariableJSObject* DebuggerVariableJSObject::create(DebuggerGlobalJSObject& global_object, Debug::DebugInfo::VariableInfo const& variable_info) { return global_object.heap().allocate<DebuggerVariableJSObject>(global_object, variable_info, *global_object.object_prototype()); } -DebuggerVariableJSObject::DebuggerVariableJSObject(const Debug::DebugInfo::VariableInfo& variable_info, JS::Object& prototype) +DebuggerVariableJSObject::DebuggerVariableJSObject(Debug::DebugInfo::VariableInfo const& variable_info, JS::Object& prototype) : JS::Object(prototype) , m_variable_info(variable_info) { diff --git a/Userland/DevTools/HackStudio/Debugger/DebuggerVariableJSObject.h b/Userland/DevTools/HackStudio/Debugger/DebuggerVariableJSObject.h index c44c0e907d..195e978225 100644 --- a/Userland/DevTools/HackStudio/Debugger/DebuggerVariableJSObject.h +++ b/Userland/DevTools/HackStudio/Debugger/DebuggerVariableJSObject.h @@ -20,9 +20,9 @@ class DebuggerVariableJSObject final : public JS::Object { using Base = JS::Object; public: - static DebuggerVariableJSObject* create(DebuggerGlobalJSObject&, const Debug::DebugInfo::VariableInfo& variable_info); + static DebuggerVariableJSObject* create(DebuggerGlobalJSObject&, Debug::DebugInfo::VariableInfo const& variable_info); - DebuggerVariableJSObject(const Debug::DebugInfo::VariableInfo& variable_info, JS::Object& prototype); + DebuggerVariableJSObject(Debug::DebugInfo::VariableInfo const& variable_info, JS::Object& prototype); virtual ~DebuggerVariableJSObject() override = default; virtual StringView class_name() const override { return m_variable_info.type_name; } @@ -32,7 +32,7 @@ public: private: DebuggerGlobalJSObject& debugger_object() const; - const Debug::DebugInfo::VariableInfo& m_variable_info; + Debug::DebugInfo::VariableInfo const& m_variable_info; }; } diff --git a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp index 22d99180fd..3861ae7626 100644 --- a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp @@ -17,7 +17,7 @@ namespace HackStudio { -DisassemblyModel::DisassemblyModel(const Debug::DebugSession& debug_session, const PtraceRegisters& regs) +DisassemblyModel::DisassemblyModel(Debug::DebugSession const& debug_session, PtraceRegisters const& regs) { auto lib = debug_session.library_at(regs.ip()); if (!lib) @@ -51,7 +51,7 @@ DisassemblyModel::DisassemblyModel(const Debug::DebugSession& debug_session, con auto view = symbol.value().raw_data(); X86::ELFSymbolProvider symbol_provider(*elf); - X86::SimpleInstructionStream stream((const u8*)view.characters_without_null_termination(), view.length()); + X86::SimpleInstructionStream stream((u8 const*)view.characters_without_null_termination(), view.length()); X86::Disassembler disassembler(stream); size_t offset_into_symbol = 0; diff --git a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h index 6daaea3cc2..10efc05af4 100644 --- a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h +++ b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h @@ -29,7 +29,7 @@ struct InstructionData { class DisassemblyModel final : public GUI::Model { public: - static NonnullRefPtr<DisassemblyModel> create(const Debug::DebugSession& debug_session, const PtraceRegisters& regs) + static NonnullRefPtr<DisassemblyModel> create(Debug::DebugSession const& debug_session, PtraceRegisters const& regs) { return adopt_ref(*new DisassemblyModel(debug_session, regs)); } @@ -49,7 +49,7 @@ public: virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; private: - DisassemblyModel(const Debug::DebugSession&, const PtraceRegisters&); + DisassemblyModel(Debug::DebugSession const&, PtraceRegisters const&); Vector<InstructionData> m_instructions; }; diff --git a/Userland/DevTools/HackStudio/Debugger/DisassemblyWidget.cpp b/Userland/DevTools/HackStudio/Debugger/DisassemblyWidget.cpp index ff49fdf897..f2cfe33ae1 100644 --- a/Userland/DevTools/HackStudio/Debugger/DisassemblyWidget.cpp +++ b/Userland/DevTools/HackStudio/Debugger/DisassemblyWidget.cpp @@ -39,7 +39,7 @@ DisassemblyWidget::DisassemblyWidget() hide_disassembly("Program isn't running"); } -void DisassemblyWidget::update_state(const Debug::DebugSession& debug_session, const PtraceRegisters& regs) +void DisassemblyWidget::update_state(Debug::DebugSession const& debug_session, PtraceRegisters const& regs) { m_disassembly_view->set_model(DisassemblyModel::create(debug_session, regs)); @@ -73,7 +73,7 @@ void DisassemblyWidget::show_disassembly() m_unavailable_disassembly_widget->set_visible(false); } -void DisassemblyWidget::hide_disassembly(const String& reason) +void DisassemblyWidget::hide_disassembly(String const& reason) { m_top_container->set_visible(false); m_disassembly_view->set_visible(false); diff --git a/Userland/DevTools/HackStudio/Debugger/DisassemblyWidget.h b/Userland/DevTools/HackStudio/Debugger/DisassemblyWidget.h index 09254737f7..5805c722ad 100644 --- a/Userland/DevTools/HackStudio/Debugger/DisassemblyWidget.h +++ b/Userland/DevTools/HackStudio/Debugger/DisassemblyWidget.h @@ -21,11 +21,11 @@ class UnavailableDisassemblyWidget final : public GUI::Frame { public: virtual ~UnavailableDisassemblyWidget() override { } - const String& reason() const { return m_reason; } - void set_reason(const String& text) { m_reason = text; } + String const& reason() const { return m_reason; } + void set_reason(String const& text) { m_reason = text; } private: - UnavailableDisassemblyWidget(const String& reason) + UnavailableDisassemblyWidget(String const& reason) : m_reason(reason) { } @@ -40,14 +40,14 @@ class DisassemblyWidget final : public GUI::Widget { public: virtual ~DisassemblyWidget() override { } - void update_state(const Debug::DebugSession&, const PtraceRegisters&); + void update_state(Debug::DebugSession const&, PtraceRegisters const&); void program_stopped(); private: DisassemblyWidget(); void show_disassembly(); - void hide_disassembly(const String&); + void hide_disassembly(String const&); RefPtr<GUI::Widget> m_top_container; RefPtr<GUI::TableView> m_disassembly_view; diff --git a/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.cpp b/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.cpp index d31f8ae12e..c1fc9a7058 100644 --- a/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.cpp +++ b/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.cpp @@ -103,7 +103,7 @@ void EvaluateExpressionDialog::build(Window* parent_window) m_text_editor->set_focus(true); } -void EvaluateExpressionDialog::handle_evaluation(const String& expression) +void EvaluateExpressionDialog::handle_evaluation(String const& expression) { m_output_container->remove_all_children(); m_output_view->update(); diff --git a/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.h b/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.h index d33873c3bb..201c3c8190 100644 --- a/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.h +++ b/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.h @@ -18,7 +18,7 @@ private: explicit EvaluateExpressionDialog(Window* parent_window); void build(Window* parent_window); - void handle_evaluation(const String& expression); + void handle_evaluation(String const& expression); void set_output(StringView html); NonnullOwnPtr<JS::Interpreter> m_interpreter; diff --git a/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp b/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp index 3bac9fce93..949b6202e6 100644 --- a/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp @@ -9,7 +9,7 @@ namespace HackStudio { -RegistersModel::RegistersModel(const PtraceRegisters& regs) +RegistersModel::RegistersModel(PtraceRegisters const& regs) : m_raw_registers(regs) { #if ARCH(I386) @@ -52,7 +52,7 @@ RegistersModel::RegistersModel(const PtraceRegisters& regs) m_registers.append({ "gs", regs.gs }); } -RegistersModel::RegistersModel(const PtraceRegisters& current_regs, const PtraceRegisters& previous_regs) +RegistersModel::RegistersModel(PtraceRegisters const& current_regs, PtraceRegisters const& previous_regs) : m_raw_registers(current_regs) { #if ARCH(I386) diff --git a/Userland/DevTools/HackStudio/Debugger/RegistersModel.h b/Userland/DevTools/HackStudio/Debugger/RegistersModel.h index 91651e798a..a0e86c1915 100644 --- a/Userland/DevTools/HackStudio/Debugger/RegistersModel.h +++ b/Userland/DevTools/HackStudio/Debugger/RegistersModel.h @@ -21,12 +21,12 @@ struct RegisterData { class RegistersModel final : public GUI::Model { public: - static RefPtr<RegistersModel> create(const PtraceRegisters& regs) + static RefPtr<RegistersModel> create(PtraceRegisters const& regs) { return adopt_ref(*new RegistersModel(regs)); } - static RefPtr<RegistersModel> create(const PtraceRegisters& current_regs, const PtraceRegisters& previous_regs) + static RefPtr<RegistersModel> create(PtraceRegisters const& current_regs, PtraceRegisters const& previous_regs) { return adopt_ref(*new RegistersModel(current_regs, previous_regs)); } @@ -44,11 +44,11 @@ public: virtual String column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; - const PtraceRegisters& raw_registers() const { return m_raw_registers; } + PtraceRegisters const& raw_registers() const { return m_raw_registers; } private: - explicit RegistersModel(const PtraceRegisters& regs); - RegistersModel(const PtraceRegisters& current_regs, const PtraceRegisters& previous_regs); + explicit RegistersModel(PtraceRegisters const& regs); + RegistersModel(PtraceRegisters const& current_regs, PtraceRegisters const& previous_regs); PtraceRegisters m_raw_registers; Vector<RegisterData> m_registers; diff --git a/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp b/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp index 02f57c81d6..5e014b63c1 100644 --- a/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp @@ -17,7 +17,7 @@ GUI::ModelIndex VariablesModel::index(int row, int column, const GUI::ModelIndex return {}; return create_index(row, column, &m_variables[row]); } - auto* parent = static_cast<const Debug::DebugInfo::VariableInfo*>(parent_index.internal_data()); + auto* parent = static_cast<Debug::DebugInfo::VariableInfo const*>(parent_index.internal_data()); if (static_cast<size_t>(row) >= parent->members.size()) return {}; auto* child = &parent->members[row]; @@ -28,7 +28,7 @@ GUI::ModelIndex VariablesModel::parent_index(const GUI::ModelIndex& index) const { if (!index.is_valid()) return {}; - auto* child = static_cast<const Debug::DebugInfo::VariableInfo*>(index.internal_data()); + auto* child = static_cast<Debug::DebugInfo::VariableInfo const*>(index.internal_data()); auto* parent = child->parent; if (parent == nullptr) return {}; @@ -51,11 +51,11 @@ int VariablesModel::row_count(const GUI::ModelIndex& index) const { if (!index.is_valid()) return m_variables.size(); - auto* node = static_cast<const Debug::DebugInfo::VariableInfo*>(index.internal_data()); + auto* node = static_cast<Debug::DebugInfo::VariableInfo const*>(index.internal_data()); return node->members.size(); } -static String variable_value_as_string(const Debug::DebugInfo::VariableInfo& variable) +static String variable_value_as_string(Debug::DebugInfo::VariableInfo const& variable) { if (variable.location_type != Debug::DebugInfo::VariableInfo::LocationType::Address) return "N/A"; @@ -65,7 +65,7 @@ static String variable_value_as_string(const Debug::DebugInfo::VariableInfo& var if (variable.is_enum_type()) { auto value = Debugger::the().session()->peek(variable_address); VERIFY(value.has_value()); - auto it = variable.type->members.find_if([&enumerator_value = value.value()](const auto& enumerator) { + auto it = variable.type->members.find_if([&enumerator_value = value.value()](auto const& enumerator) { return enumerator->constant_data.as_u32 == enumerator_value; }); if (it.is_end()) @@ -94,7 +94,7 @@ static String variable_value_as_string(const Debug::DebugInfo::VariableInfo& var return String::formatted("type: {} @ {:p}, ", variable.type_name, variable_address); } -static Optional<u32> string_to_variable_value(StringView string_value, const Debug::DebugInfo::VariableInfo& variable) +static Optional<u32> string_to_variable_value(StringView string_value, Debug::DebugInfo::VariableInfo const& variable) { if (variable.is_enum_type()) { auto prefix_string = String::formatted("{}::", variable.type_name); @@ -102,7 +102,7 @@ static Optional<u32> string_to_variable_value(StringView string_value, const Deb if (string_value.starts_with(prefix_string)) string_to_use = string_value.substring_view(prefix_string.length(), string_value.length() - prefix_string.length()); - auto it = variable.type->members.find_if([string_to_use](const auto& enumerator) { + auto it = variable.type->members.find_if([string_to_use](auto const& enumerator) { return enumerator->name == string_to_use; }); @@ -131,7 +131,7 @@ static Optional<u32> string_to_variable_value(StringView string_value, const Deb void VariablesModel::set_variable_value(const GUI::ModelIndex& index, StringView string_value, GUI::Window* parent_window) { - auto variable = static_cast<const Debug::DebugInfo::VariableInfo*>(index.internal_data()); + auto variable = static_cast<Debug::DebugInfo::VariableInfo const*>(index.internal_data()); auto value = string_to_variable_value(string_value, *variable); @@ -150,7 +150,7 @@ void VariablesModel::set_variable_value(const GUI::ModelIndex& index, StringView GUI::Variant VariablesModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const { - auto* variable = static_cast<const Debug::DebugInfo::VariableInfo*>(index.internal_data()); + auto* variable = static_cast<Debug::DebugInfo::VariableInfo const*>(index.internal_data()); switch (role) { case GUI::ModelRole::Display: { auto value_as_string = variable_value_as_string(*variable); diff --git a/Userland/DevTools/HackStudio/Debugger/VariablesModel.h b/Userland/DevTools/HackStudio/Debugger/VariablesModel.h index a46a7641ed..c32019bb31 100644 --- a/Userland/DevTools/HackStudio/Debugger/VariablesModel.h +++ b/Userland/DevTools/HackStudio/Debugger/VariablesModel.h @@ -28,7 +28,7 @@ public: Debug::ProcessInspector& inspector() { return m_inspector; } private: - explicit VariablesModel(Debug::ProcessInspector& inspector, NonnullOwnPtrVector<Debug::DebugInfo::VariableInfo>&& variables, const PtraceRegisters& regs) + explicit VariablesModel(Debug::ProcessInspector& inspector, NonnullOwnPtrVector<Debug::DebugInfo::VariableInfo>&& variables, PtraceRegisters const& regs) : m_variables(move(variables)) , m_regs(regs) , m_inspector(inspector) |