~maelkum/viuavm

5172f366a1432c241af34d75acab554a986f1e80 — Marek Marecki 7 days ago 311e0e1
Report values of frame pointer and stack break in ebreak output
2 files changed, 22 insertions(+), 0 deletions(-)

M new/src/vm/ins.cpp
M new/tests/suite.py
M new/src/vm/ins.cpp => new/src/vm/ins.cpp +13 -0
@@ 1958,6 1958,19 @@ auto execute(EBREAK const, Stack& stack, ip_type const) -> void

        viua::TRACE_STREAM << "    of #" << i << viua::TRACE_STREAM.endl;

        auto const fptr = each.saved.fp;
        auto const sbrk = each.saved.sbrk;
        TRACE_STREAM << "        [fptr] "
            << "iu " << std::hex << std::setw(16)
                     << std::setfill('0') << fptr
                     << " " << std::dec << fptr
                     << '\n';
        TRACE_STREAM << "        [sbrk] "
            << "iu " << std::hex << std::setw(16)
                     << std::setfill('0') << sbrk
                     << " " << std::dec << sbrk
                     << '\n';

        dump_registers(each.parameters, "p");
        dump_registers(each.registers, "l");
    }

M new/tests/suite.py => new/tests/suite.py +9 -0
@@ 57,6 57,7 @@ SKIP_DISASSEMBLER_TESTS = False

EBREAK_LINE_BOXED = re.compile(r'\[(\d+)\.([lap])\] (\*?[a-zA-Z_][a-zA-Z_0-9]*) = (.*)')
EBREAK_LINE_PRIMITIVE = re.compile(r'\[(\d+)\.([lap])\] (is|iu|fl|db) (.*)')
EBREAK_LINE_SPECIAL = re.compile(r'\[(fptr|sbrk)\] (is|iu|fl|db) (.*)')
EBREAK_MEMORY_LINE = re.compile(r'([0-9a-f]{16})  ((?:[0-9a-f]{2} ){16}) \| (.{16})')
PERF_OPS_AND_RUNTIME = re.compile(r'\[vm:perf\] executed ops (\d+), run time (.+)')
PERF_APPROX_FREQ = re.compile(r'\[vm:perf\] approximate frequency (.+ [kMG]?Hz)')


@@ 345,6 346,14 @@ def consume_register_contents(ebreak_lines):

                ebreak_lines.pop(0)
                continue
            elif (m := EBREAK_LINE_SPECIAL.match(ebreak_lines[0])):
                special_register = m.group(1)
                object_type = m.group(2)
                object_value = m.group(3)
                registers[special_register] = (object_type, object_value,)

                ebreak_lines.pop(0)
                continue

            break