Question

I need to fill all available stack space with specific character for profiling purposes.

First of all, is there a safe way to do this on Android(some compiler specific functions maybe) in C++? If not, may I assume the address of first variable declared in a function is the "start" of "unused" stack? If not is there a way to get current stack pointer, something like ESP value on x86?

Was it helpful?

Solution

With ARM, you need to think about calling convention since a function with more than four arguments would have them spilled to stack. I find it much safer to use GCC's __builtin_frame_address.

Built-in Function: void * __builtin_frame_address (unsigned int level)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top