2015年2月6日 星期五

Fatal signal 11(SIGSEGV) at 0xDEADBAAD(code=1)

Recent days, I develop an android app which need to use an open-source native library.

After running app on the target smart phone, some errors always happen when access the native code..

such as,

ABORTING: LIBC: ARGUMENT IS INVALID HEAP ADDRESS IN dlfree addr=0x769c6df8

Fatal signal 11(SIGSEGV) at 0xDEADBAAD(code=1), thread 

or

ABORTING: LIBC: ARGUMENT IS INVALID HEAP MEMORY CORRUPTION IN dlmalloc 

After searched some related information from StackOverflow and google..

Below is some possible reasons which direct me to the correct way for debug.

1. A function call being made from two different threads at the same time.

2. It is related to device's memory error. (Such as no malloc and call free in native code.)

3. About the 0xDEADBAAD error message. 0xDEADBAAD is used by the Android libc abort()             frunction when native heap corruption is detected.

In my case, following above hints, finally I found the root cause is memory align issue.

Terrible days...


[Linux] find& grep

When trace the source code of a new project which from a customer or the online opensource, we often need "find" some file name or "grep" content in a file.

Below is the instructions to achieve above behavior.

$find . -name "*.i" -print

means find all the file name end with ".i" from current folder and all folders under current folder..

$grep -rn "test" .

means find text "test" in current folder and all folders under current folder.