LibDebug: Use InputMemoryStream instead of BufferStream.

This removes another call to ByteBuffer::wrap(const void*, size_t).
This commit is contained in:
asynts 2020-08-05 10:55:36 +02:00 committed by Andreas Kling
parent 5bfa7749c3
commit ac9f6fd1f8
Notes: sideshowbarker 2024-07-19 04:14:19 +09:00
12 changed files with 125 additions and 106 deletions
Libraries/LibDebug

View file

@ -26,6 +26,7 @@
#include "DebugInfo.h"
#include <AK/QuickSort.h>
#include <AK/Stream.h>
#include <LibDebug/Dwarf/CompilationUnit.h>
#include <LibDebug/Dwarf/DwarfInfo.h>
#include <LibDebug/Dwarf/Expression.h>
@ -104,10 +105,10 @@ void DebugInfo::prepare_lines()
return;
auto buffer = section.wrapping_byte_buffer();
BufferStream stream(buffer);
InputMemoryStream stream { buffer.span() };
Vector<LineProgram::LineInfo> all_lines;
while (!stream.at_end()) {
while (!stream.eof()) {
LineProgram program(stream);
all_lines.append(program.lines());
}
@ -204,7 +205,7 @@ static void parse_variable_location(const Dwarf::DIE& variable_die, DebugInfo::V
}
if (location_info.value().type == Dwarf::DIE::AttributeValue::Type::DwarfExpression) {
auto expression_bytes = ByteBuffer::wrap(location_info.value().data.as_raw_bytes.bytes, location_info.value().data.as_raw_bytes.length);
auto expression_bytes = ReadonlyBytes { location_info.value().data.as_raw_bytes.bytes, location_info.value().data.as_raw_bytes.length };
auto value = Dwarf::Expression::evaluate(expression_bytes, regs);
if (value.type != Dwarf::Expression::Type::None) {