diff --git a/Userland/Libraries/LibDebug/DebugInfo.cpp b/Userland/Libraries/LibDebug/DebugInfo.cpp index d1c69120fe..6d6994cdfc 100644 --- a/Userland/Libraries/LibDebug/DebugInfo.cpp +++ b/Userland/Libraries/LibDebug/DebugInfo.cpp @@ -231,7 +231,7 @@ static ErrorOr parse_variable_location(Dwarf::DIE const& variable_die, Deb break; case Dwarf::AttributeValue::Type::DwarfExpression: { auto expression_bytes = location_info.value().as_raw_bytes(); - auto value = Dwarf::Expression::evaluate(expression_bytes, regs); + auto value = TRY(Dwarf::Expression::evaluate(expression_bytes, regs)); if (value.type != Dwarf::Expression::Type::None) { VERIFY(value.type == Dwarf::Expression::Type::UnsignedInteger); diff --git a/Userland/Libraries/LibDebug/Dwarf/Expression.cpp b/Userland/Libraries/LibDebug/Dwarf/Expression.cpp index 11acb72b53..74ae6f5149 100644 --- a/Userland/Libraries/LibDebug/Dwarf/Expression.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/Expression.cpp @@ -7,18 +7,17 @@ #include "Expression.h" #include -#include +#include #include namespace Debug::Dwarf::Expression { -Value evaluate(ReadonlyBytes bytes, [[maybe_unused]] PtraceRegisters const& regs) +ErrorOr evaluate(ReadonlyBytes bytes, [[maybe_unused]] PtraceRegisters const& regs) { - InputMemoryStream stream(bytes); + auto stream = TRY(Core::Stream::FixedMemoryStream::construct(bytes)); - while (!stream.eof()) { - u8 opcode = 0; - stream >> opcode; + while (!stream->is_eof()) { + auto opcode = TRY(stream->read_value()); switch (static_cast(opcode)) { diff --git a/Userland/Libraries/LibDebug/Dwarf/Expression.h b/Userland/Libraries/LibDebug/Dwarf/Expression.h index ce98787d07..44652afa90 100644 --- a/Userland/Libraries/LibDebug/Dwarf/Expression.h +++ b/Userland/Libraries/LibDebug/Dwarf/Expression.h @@ -32,6 +32,6 @@ enum class Operations : u8 { FbReg = 0x91, }; -Value evaluate(ReadonlyBytes, PtraceRegisters const&); +ErrorOr evaluate(ReadonlyBytes, PtraceRegisters const&); }