diff options
author | Andreas Kling <kling@serenityos.org> | 2021-02-23 20:42:32 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-23 20:56:54 +0100 |
commit | 5d180d1f996ead27f9c5cb3db7f91e293de34d9d (patch) | |
tree | e881854dac5d749518562970d6194a0ef65736ec /Userland/Libraries/LibDebug/Dwarf | |
parent | b33a6a443e700cd80325d312f21c985b0687bb97 (diff) | |
download | serenity-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/Libraries/LibDebug/Dwarf')
-rw-r--r-- | Userland/Libraries/LibDebug/Dwarf/DIE.cpp | 36 | ||||
-rw-r--r-- | Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibDebug/Dwarf/Expression.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp | 16 |
4 files changed, 30 insertions, 30 deletions
diff --git a/Userland/Libraries/LibDebug/Dwarf/DIE.cpp b/Userland/Libraries/LibDebug/Dwarf/DIE.cpp index 4ef58947bb..5733b33fd5 100644 --- a/Userland/Libraries/LibDebug/Dwarf/DIE.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/DIE.cpp @@ -46,7 +46,7 @@ DIE::DIE(const CompilationUnit& unit, u32 offset) m_tag = EntryTag::None; } else { auto abbreviation_info = m_compilation_unit.abbreviations_map().get(m_abbreviation_code); - ASSERT(abbreviation_info.has_value()); + VERIFY(abbreviation_info.has_value()); m_tag = abbreviation_info.value().tag; m_has_children = abbreviation_info.value().has_children; @@ -76,7 +76,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::StringPointer: { u32 offset; debug_info_stream >> offset; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::String; auto strings_data = m_compilation_unit.dwarf_info().debug_strings_data(); @@ -86,7 +86,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::Data1: { u8 data; debug_info_stream >> data; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::UnsignedNumber; value.data.as_u32 = data; break; @@ -94,7 +94,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::Data2: { u16 data; debug_info_stream >> data; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::UnsignedNumber; value.data.as_u32 = data; break; @@ -102,7 +102,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::Addr: { u32 address; debug_info_stream >> address; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::UnsignedNumber; value.data.as_u32 = address; break; @@ -110,7 +110,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::SData: { ssize_t data; debug_info_stream.read_LEB128_signed(data); - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::SignedNumber; value.data.as_i32 = data; break; @@ -118,7 +118,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::SecOffset: { u32 data; debug_info_stream >> data; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::SecOffset; value.data.as_u32 = data; break; @@ -126,7 +126,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::Data4: { u32 data; debug_info_stream >> data; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::UnsignedNumber; value.data.as_u32 = data; break; @@ -134,7 +134,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::Ref4: { u32 data; debug_info_stream >> data; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::DieReference; value.data.as_u32 = data + m_compilation_unit.offset(); break; @@ -147,7 +147,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, case AttributeDataForm::ExprLoc: { size_t length; debug_info_stream.read_LEB128_unsigned(length); - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::DwarfExpression; assign_raw_bytes_value(length); break; @@ -156,7 +156,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, String str; u32 str_offset = debug_info_stream.offset(); debug_info_stream >> str; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); value.type = AttributeValue::Type::String; value.data.as_string = reinterpret_cast<const char*>(str_offset + m_compilation_unit.dwarf_info().debug_info_data().data()); break; @@ -165,7 +165,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, value.type = AttributeValue::Type::RawBytes; u8 length; debug_info_stream >> length; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); assign_raw_bytes_value(length); break; } @@ -173,7 +173,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, value.type = AttributeValue::Type::RawBytes; u16 length; debug_info_stream >> length; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); assign_raw_bytes_value(length); break; } @@ -181,7 +181,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, value.type = AttributeValue::Type::RawBytes; u32 length; debug_info_stream >> length; - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); assign_raw_bytes_value(length); break; } @@ -189,13 +189,13 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form, value.type = AttributeValue::Type::RawBytes; size_t length; debug_info_stream.read_LEB128_unsigned(length); - ASSERT(!debug_info_stream.has_any_error()); + VERIFY(!debug_info_stream.has_any_error()); assign_raw_bytes_value(length); break; } default: dbgln("Unimplemented AttributeDataForm: {}", (u32)form); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } return value; } @@ -206,7 +206,7 @@ Optional<DIE::AttributeValue> DIE::get_attribute(const Attribute& attribute) con stream.discard_or_error(m_data_offset); auto abbreviation_info = m_compilation_unit.abbreviations_map().get(m_abbreviation_code); - ASSERT(abbreviation_info.has_value()); + VERIFY(abbreviation_info.has_value()); for (const auto& attribute_spec : abbreviation_info.value().attribute_specifications) { auto value = get_attribute_value(attribute_spec.form, stream); @@ -251,7 +251,7 @@ void DIE::for_each_child(Function<void(const DIE& child)> callback) const DIE DIE::get_die_at_offset(u32 offset) const { - ASSERT(offset >= m_compilation_unit.offset() && offset < m_compilation_unit.offset() + m_compilation_unit.size()); + VERIFY(offset >= m_compilation_unit.offset() && offset < m_compilation_unit.offset() + m_compilation_unit.size()); return DIE(m_compilation_unit, offset); } diff --git a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp index 09717cfc71..fb1fdc2f42 100644 --- a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp @@ -59,8 +59,8 @@ void DwarfInfo::populate_compilation_units() CompilationUnitHeader compilation_unit_header {}; stream >> Bytes { &compilation_unit_header, sizeof(compilation_unit_header) }; - ASSERT(compilation_unit_header.address_size == sizeof(u32)); - ASSERT(compilation_unit_header.version <= 4); + VERIFY(compilation_unit_header.address_size == sizeof(u32)); + VERIFY(compilation_unit_header.version <= 4); u32 length_after_header = compilation_unit_header.length - (sizeof(CompilationUnitHeader) - offsetof(CompilationUnitHeader, version)); m_compilation_units.empend(*this, unit_offset, compilation_unit_header); diff --git a/Userland/Libraries/LibDebug/Dwarf/Expression.cpp b/Userland/Libraries/LibDebug/Dwarf/Expression.cpp index fe50d1aed3..b8f78a1e82 100644 --- a/Userland/Libraries/LibDebug/Dwarf/Expression.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/Expression.cpp @@ -55,10 +55,10 @@ Value evaluate(ReadonlyBytes bytes, const PtraceRegisters& regs) default: dbgln("DWARF expr addr: {}", (const void*)bytes.data()); dbgln("unsupported opcode: {}", (u8)opcode); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp b/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp index 649f0fe547..447bcccc99 100644 --- a/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp @@ -45,8 +45,8 @@ void LineProgram::parse_unit_header() { m_stream >> Bytes { &m_unit_header, sizeof(m_unit_header) }; - ASSERT(m_unit_header.version == DWARF_VERSION); - ASSERT(m_unit_header.opcode_base == SPECIAL_OPCODES_BASE); + VERIFY(m_unit_header.version == DWARF_VERSION); + VERIFY(m_unit_header.opcode_base == SPECIAL_OPCODES_BASE); #if DWARF_DEBUG dbgln("unit length: {}", m_unit_header.length); @@ -67,7 +67,7 @@ void LineProgram::parse_source_directories() } m_stream.handle_recoverable_error(); m_stream.discard_or_error(1); - ASSERT(!m_stream.has_any_error()); + VERIFY(!m_stream.has_any_error()); } void LineProgram::parse_source_files() @@ -87,7 +87,7 @@ void LineProgram::parse_source_files() m_source_files.append({ file_name, directory_index }); } m_stream.discard_or_error(1); - ASSERT(!m_stream.has_any_error()); + VERIFY(!m_stream.has_any_error()); } void LineProgram::append_to_line_info() @@ -131,7 +131,7 @@ void LineProgram::handle_extended_opcode() break; } case ExtendedOpcodes::SetAddress: { - ASSERT(length == sizeof(size_t) + 1); + VERIFY(length == sizeof(size_t) + 1); m_stream >> m_address; #if DWARF_DEBUG dbgln("SetAddress: {:p}", m_address); @@ -149,7 +149,7 @@ void LineProgram::handle_extended_opcode() #if DWARF_DEBUG dbgln("offset: {:p}", m_stream.offset()); #endif - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } void LineProgram::handle_standard_opcode(u8 opcode) @@ -191,7 +191,7 @@ void LineProgram::handle_standard_opcode(u8 opcode) case StandardOpcodes::AdvanceLine: { ssize_t line_delta; m_stream.read_LEB128_signed(line_delta); - ASSERT(line_delta >= 0 || m_line >= (size_t)(-line_delta)); + VERIFY(line_delta >= 0 || m_line >= (size_t)(-line_delta)); m_line += line_delta; #if DWARF_DEBUG dbgln("AdvanceLine: {}", m_line); @@ -223,7 +223,7 @@ void LineProgram::handle_standard_opcode(u8 opcode) } default: dbgln("Unhandled LineProgram opcode {}", opcode); - ASSERT_NOT_REACHED(); + VERIFY_NOT_REACHED(); } } void LineProgram::handle_sepcial_opcode(u8 opcode) |