Skip to content
Advertisement

How to make gdb for a target and use it there

I am trying to compile gdb-8.2 from source.
Build machine: x86-64
Host AND target: arm-linux-gnueabi

I ran:

CC=arm-linux-gnueabi-gcc ./configure --host=arm-linux-gnueabi --target=arm-linux-gnueabi  
make

Then I ran:

make DESTDIR=<Some Path>/gdb_installation install

So I got a usr folder inside gdb_installation folder. I copied the usr/local/bin/gdb to my target and ran

./gdb

Output:

#./gdb  
#

But it does not show anything. It exits without any message.

What am I missing here? Running the file command shows that the gdb executable is indeed built for my target.

PS: Running a sample hello world program using arm-linux-gnueabi-gcc works perfectly fine on the target; and file command shows the same output that it did for gdb.

Advertisement

Answer

What am I missing here?

Your build looks correct, but doesn’t work. It’s not clear why, so you need to debug that.

  1. What is the exit status of this gdb on the target?
    ./gdb --version; echo $?

  2. Does it actually do anything?
    strace ./gdb --version

  3. Is there anything interesting in the kernel message log?

Depending on answers to above questions, further guesses of what has gone wrong will be possible.

Perhaps there is some .gdbinit that tells GDB to quit? What does this do:
./gdb -nx --version?

Advertisement