Build gdb on illumos

Claim: Since illumos provides its own debugger: mdb, I don’t want to convince anybody to use gdb instead of mdb. Compile and use gdb is just my personal hobby.

I use OmniOS, and I think this material should also apply to other illumos OSs and even Solaris:

(1) Download and extract gdb source code (currently the newest versin is 8.3);
(2) Enter the gdb directory and do configuration:

# cd gdb-8.3
# mkdir build
# ../configure CC='gcc -m64'  CXX='g++ -m64'

(3) Build it:

# gmake

After compiling, testing it:

# ./gdb-8.3/build/gdb/gdb --data-directory=./gdb-8.3/build/gdb/data-directory/ -q a.out
Reading symbols from a.out...
(gdb) start
Temporary breakpoint 1 at 0x4011b6: file test.c, line 4.
Starting program: /root/a.out
[Thread debugging using libthread_db enabled]
[New Thread 1 (LWP 1)]
[Switching to Thread 1 (LWP 1)]

Thread 2 hit Temporary breakpoint 1, main () at test.c:4
4               printf("%d\n", sizeof(long unsigned int));
(gdb) n
8
5               return 0;
(gdb)
6       }
(gdb)

So far so good!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.