Compiling and Using GDB

GDB is the GNU Project Debugger.

I have some errors on compiling GDB:

  • gdb configure error: no termcap library found.
    On searching, I find this solution to install ncurses-devel.
    I downloaded and extracted ncurses-devel-5.2-2.i386.rpm.html.
    Normally, you can install rpm by
    rpm -i –nodeps ncurses-devel-5.2-2.i386.rpm
    If this fails because it requires superuser access, you can extract with rpm2cpio using
    rpm2cpio ncurses-devel-5.2-2.i386.rpm > ncurses-devel-5.2-2.i386.cpio
    and then with cpio
    cpio -i < ncurses-devel-5.2-2.i386.cpio

  • cc1: warnings being treated as errors
    See GDB Compiler Warnings.
    I reissue the failed command but removing -Werror from it to bypass the error.

See Debugging Extension Modules on Linux/Unix and Debugging Under Unix: gdb Tutorial.
You can debug python script as follows:

myhost> gdb
(gdb) file python
(gdb) run yourprogram.py yourargs
..
Program received signal SIGSEGV, Segmentation fault.
..
(gdb) backtrace  <- Inspecting crashes

Post a Comment

Your email is never shared. Required fields are marked *

*
*