Stack trace on ARM

Stack trace on ARM
Well let me start by telling you how I got the idea. After a few talks with Stefan Glienke about some low-level stuff and about how to add assembly to ARM code I remembered about the blog post from Team Japan how they managed to link XCode generated object into Delphi. I started to wonder, hey this must be possible on Android as well is I use proper compiler so I downloaded ARM gcc for Linux. Then I thought it has to be possible to compile using NDK toolchain and compiling any unit with the arm-linux-androideabi-gcc -c works just fine.

Now when you have C compiler at hand, there are no restrictions so assembly can be used again with ease and then I began wondering there must be a way to do a stack walk somehow and after a while reading about ABI and stuff I had the first implementation that was able to walk the stack with a few quirks (that don't bother me right now that much).

But the only think I had was values of PC that say nothing about the source code and after a while I came across some Unix documentation that gave it away.

So to sum this up, I present a code that is a proof of concept stack trace library for Android (no iOS support right now, sorry) so tell me what you think ;-)
https://bitbucket.org/shadow_cs/delphi-arm-backtrace/

Comments