Thread: Problem using gdb debugger.....

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    21

    Problem using gdb debugger.....

    Hi,

    I'd like to run a program in debug using gdb on SunOS 5.6, but I keep getting the following message when i start gdb:

    "This GDB was configured as "sparc-sun-solaris2.6"...(no debugging symbols found)..."

    The program is C with embedded sql, and the section of the makefile being used does the following:

    esqlc -o -o.h -f/home/test_prog.c /home/test_prog.sc
    cc -g -c -I/ingres_II/ingres/files -o /home/test_prog.o /home/test_prog.c
    cc -g -o /home/test_prog /home/test_prog.o ${LIBS}

    The -g flag is being used and the image is not stripped but still no debugging info is available.

    Any advice will be most appreciated.

    Ta,

    Manny

  2. #2
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    Did you try starting a session with dbx and see if you get any debugging symbols with it? Perhaps the -ggdb flag instead of -g would do something helpful...

  3. #3
    Registered User
    Join Date
    Jun 2006
    Posts
    21
    Hi Kermit,

    Thanks for that suggestion but that doesn't work either, it returns a warning:
    cc: Warning: illegal option -db

    Do you think one of the flags in the $LIBS variable is suppressing the debug symbols. The value of $LIBS is:

    LIBS= -L${II_SYSTEM}/ingres/lib -linterp.1 -lframe.1 -lq.1 -lcompat.1 \
    -L/opt/SUNWspro/lib -lcurses -lgen -lm -ldl -lsocket -lelf -mt -lposix4 \
    -ldl -lnsl -lm \
    /home/libraries/bbd/libs.a

    Please let me know if you have any other suggestions.

    Ta,

    Manny

    PS I have never used dbx - just tried it as follows:

    /test_box>:dbx test_prog
    ksh: dbx: not found


    Quote Originally Posted by kermit
    Did you try starting a session with dbx and see if you get any debugging symbols with it? Perhaps the -ggdb flag instead of -g would do something helpful...

  4. #4
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    I am guessing that make does not like the way you are telling it to use the -g flag.

    Have you considered using something like this:

    Code:
    CFLAGS = -Wall -g
    .....
    cc $(CFLAGS) -c -I/ingres_II/ingres/files -o /home/test_prog.o /home/test_prog.c
    To be honest, your makefile looks like it use some work - its not like any I have seen.

  5. #5
    Registered User
    Join Date
    Jun 2006
    Posts
    21
    I set CFLAGS as below but got an error:
    CFLAGS= -Wall -g -c

    The error was.......
    cc $(CFLAGS) -I/ingres_II/ingres/files -o /home/test_prog.o /home/test_prog.c
    cc: illegal option -Wall

    Not sure what I should try next really.......


    Quote Originally Posted by kermit
    I am guessing that make does not like the way you are telling it to use the -g flag.

    Have you considered using something like this:

    Code:
    CFLAGS = -Wall -g
    .....
    cc $(CFLAGS) -c -I/ingres_II/ingres/files -o /home/test_prog.o /home/test_prog.c
    To be honest, your makefile looks like it use some work - its not like any I have seen.

  6. #6
    Registered User
    Join Date
    Jun 2006
    Posts
    21
    Anybody else got any ideas or suggestions?

    Quote Originally Posted by manny
    I set CFLAGS as below but got an error:
    CFLAGS= -Wall -g -c

    The error was.......
    cc $(CFLAGS) -I/ingres_II/ingres/files -o /home/test_prog.o /home/test_prog.c
    cc: illegal option -Wall

    Not sure what I should try next really.......

  7. #7
    Registered User
    Join Date
    Aug 2002
    Location
    Hermosa Beach, CA
    Posts
    446
    Well, you can start small and build up to your program. I would try these two tests:

    1) start gdb without giving it a program to debug, ie
    # gdb
    do you still get your error message?

    2) Build a hello world program with -g. Open with gdb. Do you still see the warning message?

    3) Try to step through hello world even if you do get the message--i.e. do:

    gdb> b main
    gdb> run

    Does gdb find your source file, etc.?
    The crows maintain that a single crow could destroy the heavens. Doubtless this is so. But it proves nothing against the heavens, for the heavens signify simply: the impossibility of crows.

  8. #8
    Registered User
    Join Date
    Jun 2006
    Posts
    21
    If I create a small program and compile/run it with gdb it works fine and I am able to debug ok.
    Its only when I use the Makefile that it does not work.

    Quote Originally Posted by IfYouSaySo
    Well, you can start small and build up to your program. I would try these two tests:

    1) start gdb without giving it a program to debug, ie
    # gdb
    do you still get your error message?

    2) Build a hello world program with -g. Open with gdb. Do you still see the warning message?

    3) Try to step through hello world even if you do get the message--i.e. do:

    gdb> b main
    gdb> run

    Does gdb find your source file, etc.?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 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
  2. gdb debug issues
    By disruptivetech in forum C Programming
    Replies: 1
    Last Post: 10-20-2008, 04:08 PM
  3. gdb problem in multi-threaded app
    By IfYouSaySo in forum Linux Programming
    Replies: 1
    Last Post: 10-12-2006, 08:22 PM
  4. debugger problem with VC++ express
    By Frenzied in forum C++ Programming
    Replies: 7
    Last Post: 07-18-2006, 03:33 PM
  5. problem with output
    By Garfield in forum C Programming
    Replies: 2
    Last Post: 11-18-2001, 08:34 PM