using gdb to debug.

This is a discussion on using gdb to debug. within the Linux Programming forums, part of the Platform Specific Boards category; To the next problem. My book tells me to debug the program a.out that I have written and saved. However ...

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    62

    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:
    Code:
    reader:~/booksrc $ gdb -q ./a.out
    Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
    (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:
    Code:
    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 ()
    (gdb)

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,699
    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...
    Code:
    bool fun(bool value)
    {
        return std::pow(std::exp(1), std::complex<float>(0, 1) 
        * std::complex<float>(std::atan(1)*(1 << (value + 2))))
        .real() > 0;
    }

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    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/libthread_db.so.1"", 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, 04:17 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21