C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 02-18-2009, 10:03 AM   #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!
lehe is offline   Reply With Quote
Old 02-18-2009, 10:27 AM   #2
Registered User
 
Join Date: Jan 2009
Posts: 20
maybe replace
Code:
CFLAGS = -O3
with
Code:
CPPFLAGS = -g
stewie griffin is offline   Reply With Quote
Old 02-18-2009, 10:34 AM   #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.
lehe is offline   Reply With Quote
Old 02-18-2009, 10:38 AM   #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
stewie griffin is offline   Reply With Quote
Old 02-18-2009, 10:45 AM   #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.
lehe is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

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


All times are GMT -6. The time now is 11:33 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

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