1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 13:07:46 +00:00

AK: Move memory streams from LibCore

This commit is contained in:
Tim Schumacher 2023-01-25 20:19:05 +01:00 committed by Andrew Kaster
parent 11550f582b
commit 093cf428a3
46 changed files with 213 additions and 203 deletions

View file

@ -8,7 +8,7 @@
#include "DwarfInfo.h"
#include <AK/LEB128.h>
#include <LibCore/MemoryStream.h>
#include <AK/MemoryStream.h>
namespace Debug::Dwarf {
@ -21,7 +21,7 @@ AbbreviationsMap::AbbreviationsMap(DwarfInfo const& dwarf_info, u32 offset)
ErrorOr<void> AbbreviationsMap::populate_map()
{
auto abbreviation_stream = TRY(Core::Stream::FixedMemoryStream::construct(m_dwarf_info.abbreviation_data()));
auto abbreviation_stream = TRY(FixedMemoryStream::construct(m_dwarf_info.abbreviation_data()));
TRY(abbreviation_stream->discard(m_offset));
Core::Stream::WrapInAKInputStream wrapped_abbreviation_stream { *abbreviation_stream };

View file

@ -9,7 +9,7 @@
#include "DwarfInfo.h"
#include <AK/ByteBuffer.h>
#include <AK/LEB128.h>
#include <LibCore/MemoryStream.h>
#include <AK/MemoryStream.h>
namespace Debug::Dwarf {
@ -23,7 +23,7 @@ ErrorOr<void> DIE::rehydrate_from(u32 offset, Optional<u32> parent_offset)
{
m_offset = offset;
auto stream = TRY(Core::Stream::FixedMemoryStream::construct(m_compilation_unit.dwarf_info().debug_info_data()));
auto stream = TRY(FixedMemoryStream::construct(m_compilation_unit.dwarf_info().debug_info_data()));
// Note: We can't just slice away from the input data here, since get_attribute_value will try to recover the original offset using seek().
TRY(stream->seek(m_offset));
Core::Stream::WrapInAKInputStream wrapped_stream { *stream };
@ -52,7 +52,7 @@ ErrorOr<void> DIE::rehydrate_from(u32 offset, Optional<u32> parent_offset)
ErrorOr<Optional<AttributeValue>> DIE::get_attribute(Attribute const& attribute) const
{
auto stream = TRY(Core::Stream::FixedMemoryStream::construct(m_compilation_unit.dwarf_info().debug_info_data()));
auto stream = TRY(FixedMemoryStream::construct(m_compilation_unit.dwarf_info().debug_info_data()));
// Note: We can't just slice away from the input data here, since get_attribute_value will try to recover the original offset using seek().
TRY(stream->seek(m_data_offset));

View file

@ -11,7 +11,7 @@
#include <AK/ByteReader.h>
#include <AK/LEB128.h>
#include <LibCore/MemoryStream.h>
#include <AK/MemoryStream.h>
#include <LibDebug/DebugInfo.h>
namespace Debug::Dwarf {
@ -47,8 +47,8 @@ ErrorOr<void> DwarfInfo::populate_compilation_units()
if (!m_debug_info_data.data())
return {};
auto debug_info_stream = TRY(Core::Stream::FixedMemoryStream::construct(m_debug_info_data));
auto line_info_stream = TRY(Core::Stream::FixedMemoryStream::construct(m_debug_line_data));
auto debug_info_stream = TRY(FixedMemoryStream::construct(m_debug_info_data));
auto line_info_stream = TRY(FixedMemoryStream::construct(m_debug_line_data));
while (!debug_info_stream->is_eof()) {
auto unit_offset = TRY(debug_info_stream->tell());
@ -321,14 +321,14 @@ ErrorOr<void> DwarfInfo::build_cached_dies() const
Vector<DIERange> entries;
if (die.compilation_unit().dwarf_version() == 5) {
auto range_lists_stream = TRY(Core::Stream::FixedMemoryStream::construct(debug_range_lists_data()));
auto range_lists_stream = TRY(FixedMemoryStream::construct(debug_range_lists_data()));
TRY(range_lists_stream->seek(offset));
AddressRangesV5 address_ranges(move(range_lists_stream), die.compilation_unit());
TRY(address_ranges.for_each_range([&entries](auto range) {
entries.empend(range.start, range.end);
}));
} else {
auto ranges_stream = TRY(Core::Stream::FixedMemoryStream::construct(debug_ranges_data()));
auto ranges_stream = TRY(FixedMemoryStream::construct(debug_ranges_data()));
TRY(ranges_stream->seek(offset));
AddressRangesV4 address_ranges(move(ranges_stream), die.compilation_unit());
TRY(address_ranges.for_each_range([&entries](auto range) {

View file

@ -7,14 +7,14 @@
#include "Expression.h"
#include <AK/Format.h>
#include <LibCore/MemoryStream.h>
#include <AK/MemoryStream.h>
#include <sys/arch/regs.h>
namespace Debug::Dwarf::Expression {
ErrorOr<Value> evaluate(ReadonlyBytes bytes, [[maybe_unused]] PtraceRegisters const& regs)
{
auto stream = TRY(Core::Stream::FixedMemoryStream::construct(bytes));
auto stream = TRY(FixedMemoryStream::construct(bytes));
while (!stream->is_eof()) {
auto opcode = TRY(stream->read_value<u8>());