Thread: gdb no debugging symbols found

  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    201

    gdb no debugging symbols found

    I try compiling some large code with the -g option but when I try running the code with gdb it says the emitted code contains no debugging symbols.

    Reading symbols from /cygdrive/c/dev/dotr/src/dotr.exe...(no debugging symbols found)...
    done.

    This is cygwin on windows but I figured linux group would still be better
    Anybody know what I could do to get debugging symbols emitted?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    1. Did you invoke the linker without the -g option?
    2. There are several flavours of -g symbols, maybe you got the wrong one for your debugger.

    Is this a new issue, or have you managed to use debug symbols before on other code?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jun 2004
    Posts
    201
    Never used gdb before.
    it works on a little 1 file test project though

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    You have to compile with the cygwin version of gcc to use the cygwin version of gdb, I think (my version of cygwin is really old). If you compile your program with, say, Dev-C++, then debug it with the MinGW debugger that comes with Dev-C++.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  5. #5
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    Also make sure you're not using "strip" on the executable.
    If you understand what you're doing, you're not learning anything.

  6. #6
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    For GCC, -s strips the executable. Even if it's followed by -g it strips the executable.

    You can use file (which my cygwin doesn't have) to see if the executable is stripped:
    Code:
    $ file exe.exe
    exe.exe: Win32 executable, stripped
    $
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  7. #7
    Registered User
    Join Date
    Jun 2004
    Posts
    201
    AHA! it was stripped somewhere deep in the makefile caverns
    now the next problem ^^

  8. #8
    Registered User
    Join Date
    Jun 2004
    Posts
    201
    Just another question out of interest

    The makefiles contained -gdwarf-2 as debug format but gdb couldnt handle that apparently.
    What format is used when just -g is specified? Or is it possible to let handle gdb dwarf2?

    I got the error invalid dwarf-2 offset when i wanted to set a break. only after removing the special -g option it worked

  9. #9
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    What format is used when just -g is specified?
    It's a kind of generic debugging format. It's not as useful to specific debuggers as the special flag for that debugger, but it works debugger-wide.

    [edit] I think GDB supports the older dwarf format (from http://www.fsf.org/resources/service):
    Designed and developed all code to support the generation
    of Dwarf symbolic debugging information for System V Release
    4 in GCC2.
    [/edit]
    Last edited by dwks; 09-17-2006 at 09:00 AM.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linux Putting my children to sleep with futex!?
    By Abs in forum Linux Programming
    Replies: 18
    Last Post: 02-12-2009, 06:43 PM
  2. Can any body unfold this sentences related to GDB.
    By vlrk in forum Linux Programming
    Replies: 2
    Last Post: 11-12-2008, 05:42 AM
  3. Dynamically allocating memory...
    By Junior89 in forum C++ Programming
    Replies: 28
    Last Post: 05-08-2007, 10:17 PM
  4. gdb problem in multi-threaded app
    By IfYouSaySo in forum Linux Programming
    Replies: 1
    Last Post: 10-12-2006, 08:22 PM
  5. Too much output in GDB
    By MacNilly in forum Tech Board
    Replies: 0
    Last Post: 09-13-2006, 12:45 PM