The description for rot function from https://sourceware.org/gdb/onlinedocs/gdb/Bytecode-Descriptions.html specifies that rot should do the rotation a b c -> c b a. However, in the implementation (gdb_eval_agent_expr) the rotation is a b c -> c a b Here is the code that does this: case gdb_agent_op_rot: { ULONGEST tem = stack[sp - 1]; stack[sp - 1] = stack[sp - 2]; stack[sp - 2] = top; top = tem; } break;
Was fixed by this commit: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=791fb3d7a58b86e5f30229625dfd33659f33fd6e