How to debug native Android code on a real device

I have problems with the backend (mainly Stagefrightplayer) in Android, and I would like to understand why it is causing errors that it makes. Errors are usually typical for devices, so debugging on the emulator will not be sufficient.

Example:

I/AwesomePlayer(  147): mConnectingDataSource->connect() returned -1004
V/MediaPlayerService(  147): [332] notify (0x272830, 100, 1, -1004)
E/MediaPlayer(24881): error (1, -1004)
E/MediaPlayer(24881): Error (1,-1004)
W/PlayerListener(24881): Received error: what = 1, extra = -1004

Example 2:

E/MediaPlayer(  941): error (1, -2147483648)

I also got the player to crash completely and spit out traces.txt.

Is there a way to debug what happens, just like I am debugging Java code? Thank.

+5
source share
7 answers

, , .

, -1004 -, . -2147483648, . , , , . , .

:/frameworks/base/include/media/stagefright/MediaErrors.h

MEDIA_ERROR_BASE = -1000,

ERROR_ALREADY_CONNECTED = MEDIA_ERROR_BASE,
ERROR_NOT_CONNECTED     = MEDIA_ERROR_BASE - 1,
ERROR_UNKNOWN_HOST      = MEDIA_ERROR_BASE - 2,
ERROR_CANNOT_CONNECT    = MEDIA_ERROR_BASE - 3,
ERROR_IO                = MEDIA_ERROR_BASE - 4,
ERROR_CONNECTION_LOST   = MEDIA_ERROR_BASE - 5,
ERROR_MALFORMED         = MEDIA_ERROR_BASE - 7,
ERROR_OUT_OF_RANGE      = MEDIA_ERROR_BASE - 8,
ERROR_BUFFER_TOO_SMALL  = MEDIA_ERROR_BASE - 9,
ERROR_UNSUPPORTED       = MEDIA_ERROR_BASE - 10,
ERROR_END_OF_STREAM     = MEDIA_ERROR_BASE - 11,
+2

, ( ) .

-1004 ERROR_IO MediaErrors.h:
 https://android.googlesource.com/platform/frameworks/base/+/eclair-release/include/media/stagefright/MediaErrors.h#32

-2147483648, , UNKNOWN_ERROR, Errors.h:
https://android.googlesource.com/platform/frameworks/base/+/eclair-release/include/utils/Errors.h#49

Errors.h, errno.h, , /kernel/include/asm -generic/errno.h.

, connect() -110, - , :

#define ETIMEDOUT       110     /* Connection timed out */
+2

(gdbserver target + gdb ) C/++, . "" , , backtrace, /, .

, gdbclient Android Android, pre-build eabi gdb , , DDD . Eclipse .

+2

, Android GDB, , , Kernel Side Code. JTAG, . CPU, , Watchdog Timers.

, .

+1

. , Java, , system_server , .

, Android.

Java, system_server, Java Java framework.

, , , Java JNI, , , Android.

+1

If you do not want to debug the build level, you probably have to create a kernel yourself with the debug + debug symbols turned on. I would think that most cores on a small device would not do this by default, as this makes the kernel much larger. At this point, you can enable the kernel debugger ...

0
source

All Articles