1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:57:35 +00:00

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.
This commit is contained in:
Ali Mohammad Pur 2022-01-27 04:51:17 +03:30 committed by Linus Groh
parent da3c4e5df5
commit e0db9cb876
10 changed files with 68 additions and 64 deletions

View file

@ -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;