[HTC One S] pirlano:
If someone want to try to debug native android library using IDA Pro...

[console 1] -> one time only

adb push the gdbserver from ndk to data/local/tmp

adb shell su

adb chmod 755 gdbserver

[console 2] -> don't forget it or debug client will not connect!

adb forward tcp:1111 tcp:1111

[console 3] -> start binary you want to debug (or binary that load library that you want to debug liboemcamera.so in my case, using mm-qcamera-app) -> leave it opened

adb shell

su

echo 0 > /proc/sys/kernel/randomize_va_space (this is to disable ASLR, that cause library to be loaded at random address)

cd system/bin

./mm-qcamera-app

1 or 2

[console 4]->leave it opened

adb shell

su

echo 0 > /proc/sys/kernel/randomize_va_space (just to be sure)

ps (look at PID of mm-qcamera-app)

cd data/local/tmp

./gdbserver --attach :1111 PID_NUMBER_of_mm-qcamera-app

[console 5]

(adb pull system/lib and system/bin here->C:/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin)

(start gdb from ndk from command line)

gdb.exe

(gdb) set height 0

(gdb) set solib-search-path ./

(gdb) directory C:/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin

(gdb) target remote 127.0.0.1:1111

Remote debugging using 127.0.0.1:1111

0x4005fe48 in ?? ()

(gdb) info sharedlibrary

Reading symbols from C:/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/preb

uilt/windows-x86_64/bin/mm-qcamera-app...done.

WARNING: no debugging symbols found in C:/android-ndk-r9/toolchains/arm-linux-an

droideabi-4.6/prebuilt/windows-x86_64/bin/mm-qcamera-app.

Either the binary was compiled without debugging information

or the debugging information was removed (e.g., with strip or strip -g).

Debugger capabilities will be very limited.

For further information: http://wiki/Main/GdbFaq#No_debugging_symbols_found

From To Syms Read Shared Object Library

0x40003240 0x4000b978 No C:/android-ndk-r9/toolchains/arm-linux-andro

ideabi-4.6/prebuilt/windows-x86_64/bin/system/bin/linker

0x40055940 0x40085d0c No libc.so

0x400a07f4 0x400a0998 No libstdc++.so

0x400a4e80 0x400b5164 No libm.so

0x40044180 0x40045d44 No liblog.so

0x40027a18 0x4003059c No libcutils.so

0x4025f6a0 0x40263008 No libgemini.so

0x4022f578 0x402543cc No libmmjpeg.so

0x400ca8b0 0x40161250 No liboemcamera.so

0x40296638 0x40296b50 No libmmstillomx.so

0x402a1494 0x402a1630 No libimage-omx-common.so

0x4029a658 0x4029e414 No libimage-jpeg-enc-omx-comp.so

0x4028a284 0x40291a5c No libmmcamera_interface2.so

(gdb)

NOW you have information about library base address! Nice! Copy and paste these information

Now you can just use CTRL+C on console 4, and execute instruction for console 4 again, so we can debug using IDA this time

(IDA)

for new versions->Debugger, Debugger option, option, uncheck "Use hardware temporary breakpoints"

Debugger,Switch Debugger,Remote GDB debugger and check Set as default debugger

Debugger, Process option, applicazion path (../system/bin/blabla), input file (same or ../system/lib/libblabla.so if debugging lib), Hostname: localhost, Port 1111 (or select youself, you will need to use it for all commands) and check "Set as default network setting"

Now load the file you want to debug

File->Open->liboemcamera.so in my case->Ok/Load->Check "Manual load" from the popup->OK->Input 0:400ca8b0 in my case (base address)->Load all section or section that you need->Yes

Wait for autoanalysis, and do some static analysis by yourself, set some breakpoint, etc,etc

When you are ready to debug: Debugger,Start process, Yes

TADA! The ****ing IDA+gdb should now be able to do step by step debug, but i got a ****ing ptrace: I/O error.