papyrus-lang
papyrus-lang copied to clipboard
When debugging, pause only on meaningful operations.
trafficstars
Currently pausing at the instruction level, but should instead do so at the expression evaluation level or simply where operators and member access are ignored.
For opcode reference: https://github.com/Orvid/Champollion/blob/master/Pex/Instruction.cpp
I've commented out the codes I think we should ignore.
static const OpCodeInfo OPCODES[Pex::OpCode::MAX_OPCODE] = {
// {"nop", 0, false},
// {"iadd", 3, false},
// {"fadd", 3, false},
// {"isub", 3, false},
// {"fsub", 3, false},
// {"imul", 3, false},
// {"fmul", 3, false},
// {"idiv", 3, false},
// {"fdiv", 3, false},
// {"imod", 3, false},
// {"not", 2, false},
// {"ineg", 2, false},
// {"fneg", 2, false},
{"assign", 2, false},
{"cast", 2, false},
// {"cmp_eq", 3, false},
// {"cmp_lt", 3, false},
// {"cmp_lte", 3, false},
// {"cmp_gt", 3, false},
// {"comp_gte", 3, false},
// {"jmp", 1, false},
// {"jmpt", 2, false},
// {"jmpf", 2, false},
{"callmethod", 3, true},
{"callparent", 2, true},
{"callstatic", 3, true},
{"return", 1, false},
// {"strcat", 3, false},
{"propget", 3, false},
{"propset", 3, false},
{"array_create", 2, false},
// {"array_length", 2, false},
{"array_getlement", 3, false},
{"array_setelement", 3, false},
{"array_findelement", 4, false},
{"array_rfindelement", 4, false},
// {"is", 3, false},
{"struct_create", 1, false},
// {"struct_get", 3, false},
// {"struct_set", 3, false},
{"array_findstruct", 5, false},
{"array_rfindstruct", 5, false},
{"array_add", 3, false},
{"array_insert", 3, false},
{"array_removelast", 1, false},
{"array_remove", 3, false},
{"array_clear", 1, false}
};
I overheard this is about half done. It just needs some line history tracking from what I read in discord chat.
This is a little bit tricky because the logic for what should be paused on can depend on a sequence of operations. Will just need to come back to this at some point.