I'm not sure if the C or C ++ language standards talk about learning; you could possibly run a C program compiled for execution by a large group of human slaves (but that would be unethical, even if the standard correspondence). You can run a simple tiny program with pencil and paper, you can use the C interpreter, etc. Etc....
The optimizing C or C ++ compiler also translates some C statements into several machine instructions located in different places (in particular, compilers perform built-in or clone functions or even basic blocks, even without the inline
in the source code),
On most systems, you can pass a code (for example, to an assembly) a subroutine that returns its return address (i.e., the address of the caller) as a pointer value.
With GCC (and compatible compilers, perhaps Clang / LLVM), you can use __ builtin_return_address and its associated built-in functions.
Gnu Libc on Linux offers you backtrace (but I was dissolved by it when I tried).
Please note that these tricks may not work when compiling with -fno-frame-pointer
You may also consider configuring GCC, for example. with plugins or MELT extensions (MELT is a domain-specific language implemented as a GPLv3 plugin for GCC, for a GCC extension it is easier than using plugins encoded in C). Your custom GCC can insert toolkit function calls in appropriate places.
source share