0

I try to attach a process on my rooted Android and create corefile with GDB but it can't create a gcore file because the symbols could not be found.

on my phone, i open Terminal app and i input

su 

to grant root access in Terminal. i input

dumpsys meminfo

to show all running processes. i input

gdbserver :1234 --attach 5132

on my computer, i open gdb.exe (from Android NDK) and i input

(gdb) target remote 192.168.1.13:1234

and i got those infomation

(gdb) target remote 192.168.1.13:1234
Remote debugging using 192.168.1.13:1234
warning: Architecture rejected target-supplied description
Reading /system/bin/app_process32_original from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
warning: A handler for the OS ABI "Cygwin" is not built into this configuration
of GDB.  Attempting to continue with the default arm settings.

Reading /system/bin/app_process32_original from remote target...
warning: A handler for the OS ABI "Cygwin" is not built into this configuration
of GDB.  Attempting to continue with the default arm settings.

Reading symbols from target:/system/bin/app_process32_original...(no debugging symbols found)...done.
0xb6e8b0f8 in ?? ()

With my own compiled gdb.exe, i got another info

(gdb) target remote 192.168.1.13:1234
Remote debugging using 192.168.1.13:1234
warning: Can not parse XML target description; XML support was disabled at compile time
Reading /system/bin/app_process32_original from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
Reading /system/bin/app_process32_original from remote target...
Reading symbols from target:/system/bin/app_process32_original...(no debugging symbols found)...done.
Remote 'g' packet reply is too long: fcffffff605fd9be10000000ffffffff0000000008000000000000005a010000a87687b414000000000000004010c032105fd9be005fd9be1352e6b6f8b0e8b610000f204a280000000000003d0000001100000000000000000000006000000004000000d002000068010000680100003702000052000010110000001600000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004a28000072002e0073006500720076006900630065002e0056006f006900700043006f006e006e006500630074006f0072005300e83bb770e83bb77088639b70e83bb770e83bb770e83bb770e83bb770e83bb770e83bb770e83bb770e83bb770e83bb770e83bb770e83bb770e83bb770e83bb77011000060
0xb6e8b0f8 in ?? ()

i type

gcore

and it says

Can't create a corefile

I have installed the correct gdbserver binary that match with my kernel architecture in /system/bin

I tried different Android OSes below Android 4.4.4 which does not have PIE protection thing, but i still getting the same problem. I tried to use ported version gdb client and it works perfectly.

I just wanna save the corefile with my powerful device running Android 5.1.1 with 2 GB RAM, instead using gdb client on my low-end tablet that has 512 MB RAM and running Android 4.4.4, and the gdb could not fully create the corefile due to low RAM.

2 Answers2

1

When compiling the GDB, i must give the target --target arm-linux-androideabi instead --target arm-eabi and it works perfectly

1

Just download gdb source and compile with below steps:

1).Compile gdb with below command:

cd gdb-7.11/gdb
./configure --target=arm-linux-androideabi --with-python --prefix=$HOME/mybinaries/bin
make
make install

2).Compile gdbserver with below command:

cd gdb-7.11/gdb/gdbserver
CC=arm-linux-androideabi-gcc LDFLAGS="-fPIC -pie" ./configure --target=arm-linux-androideabi --host=arm-linux-androideabi --prefix=$HOME/mybinaries/bin
make
make install
beetlej
  • 1,841
  • 4
  • 13
  • 27