2020-05-04 12:14:39 +03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
|
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-05-04 12:14:39 +03:00
|
|
|
*/
|
2021-05-15 00:27:09 +01:00
|
|
|
|
2020-05-04 12:14:39 +03:00
|
|
|
#include "Expression.h"
|
2020-08-05 10:55:36 +02:00
|
|
|
|
2021-05-15 22:08:44 +02:00
|
|
|
#include <AK/Format.h>
|
2023-01-25 20:19:05 +01:00
|
|
|
#include <AK/MemoryStream.h>
|
2022-10-04 05:39:57 +03:00
|
|
|
#include <sys/arch/regs.h>
|
2020-05-04 12:14:39 +03:00
|
|
|
|
2020-08-25 04:33:07 +01:00
|
|
|
namespace Debug::Dwarf::Expression {
|
2020-05-04 12:14:39 +03:00
|
|
|
|
2023-01-22 00:51:45 +01:00
|
|
|
ErrorOr<Value> evaluate(ReadonlyBytes bytes, [[maybe_unused]] PtraceRegisters const& regs)
|
2020-05-04 12:14:39 +03:00
|
|
|
{
|
2023-01-25 20:19:05 +01:00
|
|
|
auto stream = TRY(FixedMemoryStream::construct(bytes));
|
2020-05-04 12:14:39 +03:00
|
|
|
|
2023-01-22 00:51:45 +01:00
|
|
|
while (!stream->is_eof()) {
|
|
|
|
|
auto opcode = TRY(stream->read_value<u8>());
|
2020-05-04 12:14:39 +03:00
|
|
|
|
|
|
|
|
switch (static_cast<Operations>(opcode)) {
|
|
|
|
|
|
|
|
|
|
default:
|
2022-01-27 04:46:27 +03:30
|
|
|
dbgln("DWARF expr addr: {:p}", bytes.data());
|
|
|
|
|
dbgln("unsupported opcode: {}", opcode);
|
2021-02-23 20:42:32 +01:00
|
|
|
VERIFY_NOT_REACHED();
|
2020-05-04 12:14:39 +03:00
|
|
|
}
|
|
|
|
|
}
|
2021-02-23 20:42:32 +01:00
|
|
|
VERIFY_NOT_REACHED();
|
2020-05-04 12:14:39 +03:00
|
|
|
}
|
|
|
|
|
|
2020-08-05 10:55:36 +02:00
|
|
|
}
|