The function viewstack.asm belongs in the programmer's tool kit. Its purpose is to show to the programmer the state of the system stack centered at the top of stack (rsp) at a specific place in the program being developed.
"viewstack.asm" is a tool to aid debugging. Its prototype is:
long unsigned int viewstack(long id, long unsigned int number_qwords_outside_stack, long unsigned int number_qwords_inside_stack);
It can be called from any of the 3 languages we study: C++, C, or X86.
Sample call in C++ or C: address_next = viewstack(25,8,18); //25 is a label, 8 is number of qwords outside of stack, 18 is qwords inside of stack
Sample call in X86
mov rdi,25
mov rsi,8
mov rdx,18
call viewstack