summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibDebug/Dwarf/Expression.cpp
blob: 373bf269407b22a0beed6e94ace7dc847c561701 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
 * Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include "Expression.h"

#include <AK/Format.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(FixedMemoryStream::construct(bytes));

    while (!stream->is_eof()) {
        auto opcode = TRY(stream->read_value<u8>());

        switch (static_cast<Operations>(opcode)) {

        default:
            dbgln("DWARF expr addr: {:p}", bytes.data());
            dbgln("unsupported opcode: {}", opcode);
            VERIFY_NOT_REACHED();
        }
    }
    VERIFY_NOT_REACHED();
}

}