summaryrefslogtreecommitdiff
path: root/Userland/DevTools/HackStudio/Debugger
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-02-23 20:42:32 +0100
committerAndreas Kling <kling@serenityos.org>2021-02-23 20:56:54 +0100
commit5d180d1f996ead27f9c5cb3db7f91e293de34d9d (patch)
treee881854dac5d749518562970d6194a0ef65736ec /Userland/DevTools/HackStudio/Debugger
parentb33a6a443e700cd80325d312f21c985b0687bb97 (diff)
downloadserenity-5d180d1f996ead27f9c5cb3db7f91e293de34d9d.zip
Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
Diffstat (limited to 'Userland/DevTools/HackStudio/Debugger')
-rw-r--r--Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp2
-rw-r--r--Userland/DevTools/HackStudio/Debugger/Debugger.cpp30
-rw-r--r--Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp4
-rw-r--r--Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp2
-rw-r--r--Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp16
5 files changed, 27 insertions, 27 deletions
diff --git a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp
index fe0f6a31f5..748ba70781 100644
--- a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp
+++ b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp
@@ -68,7 +68,7 @@ Vector<BacktraceModel::FrameInfo> BacktraceModel::create_backtrace(const Debug::
frames.append({ name, current_instruction, current_ebp });
auto frame_info = Debug::StackFrameUtils::get_info(*Debugger::the().session(), current_ebp);
- ASSERT(frame_info.has_value());
+ VERIFY(frame_info.has_value());
current_instruction = frame_info.value().return_address;
current_ebp = frame_info.value().next_ebp;
} while (current_ebp && current_instruction);
diff --git a/Userland/DevTools/HackStudio/Debugger/Debugger.cpp b/Userland/DevTools/HackStudio/Debugger/Debugger.cpp
index 20527e379d..55bc4faef3 100644
--- a/Userland/DevTools/HackStudio/Debugger/Debugger.cpp
+++ b/Userland/DevTools/HackStudio/Debugger/Debugger.cpp
@@ -33,7 +33,7 @@ static Debugger* s_the;
Debugger& Debugger::the()
{
- ASSERT(s_the);
+ VERIFY(s_the);
return *s_the;
}
@@ -90,10 +90,10 @@ void Debugger::on_breakpoint_change(const String& file, size_t line, BreakpointC
if (change_type == BreakpointChange::Added) {
bool success = session->insert_breakpoint(reinterpret_cast<void*>(address.value().address));
- ASSERT(success);
+ VERIFY(success);
} else {
bool success = session->remove_breakpoint(reinterpret_cast<void*>(address.value().address));
- ASSERT(success);
+ VERIFY(success);
}
}
@@ -113,14 +113,14 @@ int Debugger::start_static()
void Debugger::start()
{
m_debug_session = Debug::DebugSession::exec_and_attach(m_executable_path, m_source_root);
- ASSERT(!!m_debug_session);
+ VERIFY(!!m_debug_session);
for (const auto& 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()) {
bool success = m_debug_session->insert_breakpoint(reinterpret_cast<void*>(address.value().address));
- ASSERT(success);
+ VERIFY(success);
} else {
dbgln("couldn't insert breakpoint");
}
@@ -131,7 +131,7 @@ void Debugger::start()
int Debugger::debugger_loop()
{
- ASSERT(m_debug_session);
+ VERIFY(m_debug_session);
m_debug_session->run(Debug::DebugSession::DesiredInitialDebugeeState::Running, [this](Debug::DebugSession::DebugBreakReason reason, Optional<PtraceRegisters> optional_regs) {
if (reason == Debug::DebugSession::DebugBreakReason::Exited) {
@@ -140,7 +140,7 @@ int Debugger::debugger_loop()
return Debug::DebugSession::DebugDecision::Detach;
}
remove_temporary_breakpoints();
- ASSERT(optional_regs.has_value());
+ VERIFY(optional_regs.has_value());
const PtraceRegisters& regs = optional_regs.value();
auto source_position = m_debug_session->get_source_position(regs.eip);
@@ -151,7 +151,7 @@ int Debugger::debugger_loop()
if (source_position.value().file_path.ends_with(".S"))
return Debug::DebugSession::DebugDecision::SingleStep;
- ASSERT(source_position.has_value());
+ VERIFY(source_position.has_value());
if (m_state.get() == Debugger::DebuggingState::SingleStepping) {
if (m_state.should_stop_single_stepping(source_position.value())) {
m_state.set_normal();
@@ -196,7 +196,7 @@ int Debugger::debugger_loop()
dbgln("Debugger exiting");
return Debug::DebugSession::DebugDecision::Detach;
}
- ASSERT_NOT_REACHED();
+ VERIFY_NOT_REACHED();
});
m_debug_session.clear();
return 0;
@@ -216,16 +216,16 @@ void Debugger::DebuggingState::set_single_stepping(Debug::DebugInfo::SourcePosit
bool Debugger::DebuggingState::should_stop_single_stepping(const Debug::DebugInfo::SourcePosition& current_source_position) const
{
- ASSERT(m_state == State::SingleStepping);
+ VERIFY(m_state == State::SingleStepping);
return m_original_source_position.value() != current_source_position;
}
void Debugger::remove_temporary_breakpoints()
{
for (auto breakpoint_address : m_state.temporary_breakpoints()) {
- ASSERT(m_debug_session->breakpoint_exists((void*)breakpoint_address));
+ VERIFY(m_debug_session->breakpoint_exists((void*)breakpoint_address));
bool rc = m_debug_session->remove_breakpoint((void*)breakpoint_address);
- ASSERT(rc);
+ VERIFY(rc);
}
m_state.clear_temporary_breakpoints();
}
@@ -259,7 +259,7 @@ void Debugger::do_step_over(const PtraceRegisters& regs)
dbgln("cannot perform step_over, failed to find containing function of: {:p}", regs.eip);
return;
}
- ASSERT(current_function.has_value());
+ 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) {
insert_temporary_breakpoint(line.address_of_first_statement.value() + lib->base_address);
@@ -270,7 +270,7 @@ void Debugger::do_step_over(const PtraceRegisters& regs)
void Debugger::insert_temporary_breakpoint_at_return_address(const PtraceRegisters& regs)
{
auto frame_info = Debug::StackFrameUtils::get_info(*m_debug_session, regs.ebp);
- ASSERT(frame_info.has_value());
+ VERIFY(frame_info.has_value());
u32 return_address = frame_info.value().return_address;
insert_temporary_breakpoint(return_address);
}
@@ -280,7 +280,7 @@ void Debugger::insert_temporary_breakpoint(FlatPtr address)
if (m_debug_session->breakpoint_exists((void*)address))
return;
bool success = m_debug_session->insert_breakpoint(reinterpret_cast<void*>(address));
- ASSERT(success);
+ VERIFY(success);
m_state.add_temporary_breakpoint(address);
}
diff --git a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp
index cb7822c60a..4ede317691 100644
--- a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp
+++ b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp
@@ -63,7 +63,7 @@ DisassemblyModel::DisassemblyModel(const Debug::DebugSession& debug_session, con
auto symbol = elf->find_symbol(containing_function.value().address_low);
if (!symbol.has_value())
return;
- ASSERT(symbol.has_value());
+ VERIFY(symbol.has_value());
auto view = symbol.value().raw_data();
@@ -104,7 +104,7 @@ String DisassemblyModel::column_name(int column) const
case Column::Disassembly:
return "Disassembly";
default:
- ASSERT_NOT_REACHED();
+ VERIFY_NOT_REACHED();
return {};
}
}
diff --git a/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp b/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp
index 92199a4c6f..33310d422f 100644
--- a/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp
+++ b/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp
@@ -87,7 +87,7 @@ String RegistersModel::column_name(int column) const
case Column::Value:
return "Value";
default:
- ASSERT_NOT_REACHED();
+ VERIFY_NOT_REACHED();
return {};
}
}
diff --git a/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp b/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp
index 425129046c..e010fa997c 100644
--- a/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp
+++ b/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp
@@ -52,14 +52,14 @@ GUI::ModelIndex VariablesModel::parent_index(const GUI::ModelIndex& index) const
for (size_t row = 0; row < m_variables.size(); row++)
if (m_variables.ptr_at(row).ptr() == parent)
return create_index(row, 0, parent);
- ASSERT_NOT_REACHED();
+ VERIFY_NOT_REACHED();
}
for (size_t row = 0; row < parent->parent->members.size(); row++) {
Debug::DebugInfo::VariableInfo* child_at_row = parent->parent->members.ptr_at(row).ptr();
if (child_at_row == parent)
return create_index(row, 0, parent);
}
- ASSERT_NOT_REACHED();
+ VERIFY_NOT_REACHED();
}
int VariablesModel::row_count(const GUI::ModelIndex& index) const
@@ -79,29 +79,29 @@ static String variable_value_as_string(const Debug::DebugInfo::VariableInfo& var
if (variable.is_enum_type()) {
auto value = Debugger::the().session()->peek((u32*)variable_address);
- ASSERT(value.has_value());
+ VERIFY(value.has_value());
auto it = variable.type->members.find_if([&enumerator_value = value.value()](const auto& enumerator) {
return enumerator->constant_data.as_u32 == enumerator_value;
});
- ASSERT(!it.is_end());
+ VERIFY(!it.is_end());
return String::formatted("{}::{}", variable.type_name, (*it)->name);
}
if (variable.type_name == "int") {
auto value = Debugger::the().session()->peek((u32*)variable_address);
- ASSERT(value.has_value());
+ VERIFY(value.has_value());
return String::formatted("{}", static_cast<int>(value.value()));
}
if (variable.type_name == "char") {
auto value = Debugger::the().session()->peek((u32*)variable_address);
- ASSERT(value.has_value());
+ VERIFY(value.has_value());
return String::formatted("'{0:c}' ({0:d})", value.value());
}
if (variable.type_name == "bool") {
auto value = Debugger::the().session()->peek((u32*)variable_address);
- ASSERT(value.has_value());
+ VERIFY(value.has_value());
return (value.value() & 1) ? "true" : "false";
}
@@ -151,7 +151,7 @@ void VariablesModel::set_variable_value(const GUI::ModelIndex& index, const Stri
if (value.has_value()) {
auto success = Debugger::the().session()->poke((u32*)variable->location_data.address, value.value());
- ASSERT(success);
+ VERIFY(success);
return;
}