Thread: Debug into Source

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    159

    Debug into Source

    Hi,

    I am trying but not able to debug into a library's source from my code in GDB. I firstly build the library with "gcc -g" to generate debug info. The library ANN, with its sources under "/usr/local/src/ann_1.1.1/src" and headers under "/usr/local/src/ann_1.1.1/include", has its .a files generated under "/usr/local/src/ann_1.1.1/lib". I also build my code with "gcc -g". Next I invoke GDB with my executable, setting the source directory to include the library's source path by "dir /usr/local/src/ann_1.1.1/src". With all these, however, I am not able to step into the source of the library by "s". I was wondering if someone can point out if I am making some mistakes?

    One possibility is that I don't actually generate the debug info for the library. The library has a Make-config file, where there is what I think is the options for gcc
    $(MAKE) targets \
    "ANNLIB = libANN.a" \
    "C++ = g++" \
    "CFLAGS = -O3" \
    "MAKELIB = ar ruv" \
    "RANLIB = true"
    I change "CFLAGS = -O3" to "CFLAGS = -g". In its Makefile, there is a line "cd src ; $(MAKE) $@", I believe to be what makes the compilation. The library source code and documentation can be downloaded from http://www.cs.umd.edu/~mount/ANN/Fil...n_1.1.1.tar.gz.

    The other possibility is that the source path "/usr/local/src/ann_1.1.1/src" I specified is not correct when prefixed to the path referenced by the .a file of the library to its source. How to check the path of the source referenced by the .a file?

    Thanks in advance!

  2. #2
    Registered User
    Join Date
    Jan 2009
    Posts
    20
    maybe replace
    Code:
    CFLAGS = -O3
    with
    Code:
    CPPFLAGS = -g

  3. #3
    Registered User
    Join Date
    Jan 2009
    Posts
    159
    I think CFLAGS is just the name of a variable whose value is the option for g++, and the name might be chosen arbitruarily. And CFLAGS is what the author of the library chose.

  4. #4
    Registered User
    Join Date
    Jan 2009
    Posts
    20
    if you dont specify anything else it will by defualt look for a variable named CPPFLAGS

  5. #5
    Registered User
    Join Date
    Jan 2009
    Posts
    159
    Thanks, however changing "CFLAGS" to "CPPFLAGS" doesn't work. CFLAGS is the name the author of the library chose.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. makefiles - debug & release?
    By cpjust in forum C Programming
    Replies: 6
    Last Post: 10-26-2007, 04:00 PM
  2. Class methods in header or source file?
    By TriKri in forum C++ Programming
    Replies: 13
    Last Post: 09-17-2007, 05:23 AM
  3. Debug --> Exceptions in Visual Studio 2005
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 08-10-2007, 02:12 AM
  4. Threads to keep the CPU faster than the disk?
    By matthew180 in forum C Programming
    Replies: 4
    Last Post: 06-06-2007, 03:23 PM
  5. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 09:40 PM