Thread: using gdb to debug.

  1. #1
    Registered User
    Join Date
    May 2010

    using gdb to debug.

    To the next problem. My book tells me to debug the program a.out that I have written and saved. However I am not getting the same results executing the command as are given in the book. The second line is the first thing I am missing completely in my output. I also have no idea if this is spitted out or typed in my me as when I press enter after a.out my next line results in "(gdb)". The following result is what I should get:
    reader:~/booksrc $ gdb -q ./a.out
    Using host libthread_db library "/lib/tls/i686/cmov/".
    (gdb) break main
    Breakpoint 1 at 0x804837a
    (gdb) run
    Starting program: /home/reader/booksrc/a.out
    Breakpoint 1, 0x0804837a in main ()
    (gdb) info registers
    eax            0xbffff894       -1073743724
    ecx            0x48e0fe81       1222704769
    edx            0x1      1
    ebx            0xb7fd6ff4       -1208127500
    esp            0xbffff800       0xbffff800
    ebp            0xbffff808       0xbffff808
    esi            0xb8000ce0       -1207956256
    edi            0x0      0
    eip            0x804837a        0x804837a <main+6>
    eflags         0x286    [ PF SF IF ]
    cs             0x73     115
    ss             0x7b     123
    ds             0x7b     123
    es             0x7b     123
    fs             0x0      0
    gs             0x33     51
    (gdb) quit
    The program is running.  Exit anyway? (y or n) y
    reader:~/booksrc $
    This is the result I am getting:
    root:~#gdb -q ./a.out
    (no debugging symbols found)
    (gdb) break main
    Breakpoint 1 at 0x804837a
    (gdb) run
    Starting program: /root/a.out
    (no debugging symbols found)
    (no debugging symbols found)
    (no debugging symbols found)
    Breakpoint 1 at 0x804837a in main ()

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Waterloo, Texas
    Looks like you didn't compile with debugging symbols 'on'. If you're using gcc, the compiler switch is -g. Otherwise, you'll need to consult your manual...
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
        return std::pow
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    You'll probably get some information from info registers even without the symbols. But you won't get variable names, or line numbers, or a lot of anything else.

    As to "Using host libthread_db library "/lib/tls/i686/cmov/"", did you compile your program with the thread_db library?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. gdb debug issues
    By disruptivetech in forum C Programming
    Replies: 1
    Last Post: 10-20-2008, 04:08 PM
  2. buffered vs unbuffered question
    By Overworked_PhD in forum Linux Programming
    Replies: 6
    Last Post: 07-04-2008, 04:57 PM
  3. Contiguous Array version of Linked List
    By ampersand11 in forum C Programming
    Replies: 19
    Last Post: 10-07-2007, 03:05 AM
  4. Too much output in GDB
    By MacNilly in forum Tech Board
    Replies: 0
    Last Post: 09-13-2006, 12:45 PM
  5. does gdb lie?
    By dinjas in forum C Programming
    Replies: 8
    Last Post: 03-10-2005, 05:17 PM