You're looking for the dump_stack()
function.
https://ton.org/docs/develop/func/stdlib/#dump_stack
It dumps the last 255 values in the stack and shows the total stack depth.
() dump_stack() impure asm "DUMPSTK";
There's also the ~dump
and ~strdump
built-ins.