summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2022-01-27 04:51:17 +0330
committerLinus Groh <mail@linusgroh.de>2022-01-28 22:51:27 +0000
commite0db9cb8760d0c6758364572cbb106c19e1ad727 (patch)
treee5881af6076baa2b3ae05c06999ce713f5eb9b9e /Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp
parentda3c4e5df542b550d58c3031fbdb76eb681f771f (diff)
downloadserenity-e0db9cb8760d0c6758364572cbb106c19e1ad727.zip
LibDebug+LibCoredump: Replace remaining reinterpret_casts and C casts
You misused your toys and I'm now taking them away, reflect on what you did wrong for a bit.
Diffstat (limited to 'Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp')
-rw-r--r--Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp
index 14cec259bd..57b3991c10 100644
--- a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp
+++ b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp
@@ -84,7 +84,7 @@ AttributeValue DwarfInfo::get_attribute_value(AttributeDataForm form, ssize_t im
value.m_compilation_unit = unit;
auto assign_raw_bytes_value = [&](size_t length) {
- value.m_data.as_raw_bytes = { reinterpret_cast<const u8*>(debug_info_data().data() + debug_info_stream.offset()), length };
+ value.m_data.as_raw_bytes = { debug_info_data().offset_pointer(debug_info_stream.offset()), length };
debug_info_stream.discard_or_error(length);
VERIFY(!debug_info_stream.has_any_error());
@@ -98,7 +98,7 @@ AttributeValue DwarfInfo::get_attribute_value(AttributeDataForm form, ssize_t im
value.m_type = AttributeValue::Type::String;
auto strings_data = debug_strings_data();
- value.m_data.as_string = reinterpret_cast<const char*>(strings_data.data() + offset);
+ value.m_data.as_string = bit_cast<const char*>(strings_data.offset_pointer(offset));
break;
}
case AttributeDataForm::Data1: {
@@ -199,7 +199,7 @@ AttributeValue DwarfInfo::get_attribute_value(AttributeDataForm form, ssize_t im
debug_info_stream >> str;
VERIFY(!debug_info_stream.has_any_error());
value.m_type = AttributeValue::Type::String;
- value.m_data.as_string = reinterpret_cast<const char*>(str_offset + debug_info_data().data());
+ value.m_data.as_string = bit_cast<const char*>(debug_info_data().offset_pointer(str_offset));
break;
}
case AttributeDataForm::Block1: {
@@ -241,7 +241,7 @@ AttributeValue DwarfInfo::get_attribute_value(AttributeDataForm form, ssize_t im
value.m_type = AttributeValue::Type::String;
auto strings_data = debug_line_strings_data();
- value.m_data.as_string = reinterpret_cast<const char*>(strings_data.data() + offset);
+ value.m_data.as_string = bit_cast<const char*>(strings_data.offset_pointer(offset));
break;
}
case AttributeDataForm::ImplicitConst: {
@@ -323,7 +323,7 @@ AttributeValue DwarfInfo::get_attribute_value(AttributeDataForm form, ssize_t im
break;
}
default:
- dbgln("Unimplemented AttributeDataForm: {}", (u32)form);
+ dbgln("Unimplemented AttributeDataForm: {}", to_underlying(form));
VERIFY_NOT_REACHED();
}
return value;