Wednesday, January 16, 2008

Create google android strace tool

Prerequisite, you already have the cross compiler downloaded from download GNU toolchain site, make sure you select ARM GNU/Linux, and IA32 GNU/Linux.

  1. Download the strace source distribution from SourceForge strace project
  2. Extract the strace package on your linux machine
  3. Set your cross compiler information with command: # export CC=your_cross_compiler_folder/bin/arm-none-linux-gnueabi-gcc
  4. Add your_cross_compiler_folder/bin into your $PATH for path searching
  5. Change your current folder to strace package extract folder, use command: # ./configure -host=arm-linux
  6. You have the Makefile generated, edit it, append -static after CFLAGS variable in Makefile
  7. Compile it with simple command: # make
  8. You have the strace now, verify it with command: # file strace, you shall see "strace: ELF 32-bit LSB executable, ARM, version 1 (SYSV), for GNU/Linux 2.6.14, statically linked, not stripped"
Done, you have another powerful tool for your android


Maxwell said...

According guide,I ran my strace on my android emulator shell.However I got a error like this,
# ./strace ./hello
execve("./hello", ["./hello"], [/* 10 vars */]) = 0
syscall: unknown syscall trap 0xe8bd8010.
Could you help me?Thanks

rtm said...

It looks your "hello" can not be executed. Do you have error if you just run "./hello"? How is your hello created? It must be a static linked executable or dynamic linked to bionic libc.

sasha said...

The Team Android phenomenon is spreading like wildfire. Lots of people are turning to the openness and diversity of Android smartphones when choosing a mobile device.
best android apps

best iphone apps

jenifer said...

That an interesting post. I never thought about this before. But, looking back at different situations, this might be right. Keep it up friend!
best online pharmacy

Anonymous said...

Very happy to see your article, I very much to like and agree with your point of view. Thank you for sharing. At the same time,i love best pram very much .Welcome to look at my website and blog articles.Hope we can become good friends, and exchange and to help each other! Thanks!!
wedding dresses

Pharmacy Blogger said...

I want to express my admiration of your writing skill and ability to make readers read from the beginning to the end.
Generic Plavix

jean-michel said...

give us directly the binary

Pop Neo said...

We offer wedding dresses, bridesmaid dresses, beach wedding dresses,my friends welcome to visit and see!
wedding dresses

JAMES DEAN said...

Wow!! What a great writing, really I appreciate such kind of topics. It will be very helpful for us. Waiting for more articles, blogs like this. I’m going bookmark your blog for future reference. Thanks a lot for sharing this.
advertising | top advertising agencies in Pakistan | Marketing Agency | Advertisement

Anonymous said...

article highly qualified friend .., thanks for sharing information, if interested please visit my blogs there is a lot of articles that may be read friend, Main thing is that you need to seo work If do seo for my blog Belajar SEO dan Blog di Info Blog Indonesia as my blog have 3000+ visitor and I want 5000

Sedeeq Al-Khazraji said...

I have a strace command, but when I run it I recive the following message:
PTRACE_SYSCALL doesn't work: Function not implemented

Unknown said...

Thanks, this post solves my problem. But things have changed after this post, so here I pasted my procedures here for the followers:

building strace for android

# download sources
git clone

cd strace

# set compiler info
export COMPILER_PATH=/home/xcy/Android/Sdk/my-android-toolchain
export CC=$COMPILER_PATH/bin/arm-linux-androideabi-gcc

export STRIP=$COMPILER_PATH/bin/arm-linux-androideabi-strip

export CFLAGS="-O2 -static"


# compile

enter the source folder and do following steps,

// use autoconf to generate configure from
xcy@uxcy:~/ws/strace/strace$ autoconf error: possibly undefined macro: AM_INIT_AUTOMAKE
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation. error: possibly undefined macro: AM_MAINTAINER_MODE

xcy@uxcy:~/ws/strace/strace$ ls | grep configure

// generate
xcy@uxcy:~/ws/strace/strace$ ./bootstrap
xcy@uxcy:~/ws/strace/strace$ ls | grep Make

xcy@uxcy:~/ws/strace/strace$ ./configure --host=arm-linux

xcy@uxcy:~/ws/strace/strace$ make

xcy@uxcy:~/ws/strace/strace$ file strace
strace: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, not stripped

xcy@uxcy:~/ws/strace/strace$ $STRIP strace
xcy@uxcy:~/ws/strace/strace$ file strace
strace: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, stripped