How to Compile Android’s gdbserver

Download source code from https://android.googlesource.com/toolchain/gdb/ and place it into local computer as follow:

comp01

comp02

Modify the build-gdbserver.sh shell script in C:\NDK\build\tools as follows for placement of build workspace:

comp03

To use the latest version, you can set the DEFAULT_GDB_VERSION shell variable as follow:

comp04

Activates bash shell and enter the command below:

comp05

Assuming that NDK is located at C:\NDK, and the script starts to roll on, sit, relax, and pray 🙂

Seems my prayer is not answered by God, because I’ve these error messages in seconds as below:

comp06

Checking at the said directory, this is what I only got:

comp07

So, I abandoned my desire to try to compile to highest version of gdbserver, and reverted back to version allowed by NDK framework. This is done by commenting out the DEFAULT_GDB_VERSION above. Maybe later I will use it after downloading latest Android NDK.

Execute the script, and crossing finger again. It took about several minutes rolling now, but oh no. It stops again:

comp08

So, lets examine thinking process behind make, but to cut the time short, let’s skip the configuring process and goes straight thru make phase:

comp09

In the generated file we have:

comp10

The config.status file already sits nicely in the build directory, but where the hell is Makefile.in file ? Because the purpose is to build gdbserver, so I assume I should get this file from D:\Projects\Android\toolchain\gdb\gdb-7.3.x\gdb\gdbserver and place it into the build directory.

comp11

Again, copy configure file from gdbserver directory.

comp12

Feeding at what it needed, I arrive at:

comp13

After several complains about the files, then I realized, that I should copied the entire folder from D:\Projects\Android\toolchain\gdb\gdb-7.3.x\gdb to D:\Projects\Android\toolchain\gdb\tmp\myndk\build by leaving the generated gdbserver alone with directory structures as follow:

comp14

comp15

The source of the above folder is from D:\Projects\Android\toolchain\gdb\gdb-7.3.x\gdb and the rest of files inside gdbserver folder such as inferiors.c etc, is copied from D:\Projects\Android\toolchain\gdb\gdb-7.3.x\gdb\gdbserver.

By performing the make again, the gdbserver for Android is at last in my hand 🙂

comp16

comp17

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: