![]() |
| | #1 |
| Registered User Join Date: Jan 2009
Posts: 156
| Questions about Debug and Library I have two questions. Thanks in advance for helping me out! 1. This is a question of GDB. How to step over instead of stepping into in the following code: Code: for(int i = 0; i < argc; i++)
cout << (i > 0 ? " " : "") << argv << (i < argc - 1 ? " \\" : "")
<< endl;
Code: 517 __ostream_insert(__out, __s,
(gdb)
444 { return __check_facet(_M_ctype).widen(__c); }
(gdb)
53 if (!__f)
(gdb)
873 if (_M_widen_ok)
(gdb)
1169 __tmp[__i] = __i;
(gdb)
1168 for (size_t __i = 0; __i < sizeof(_M_widen); ++__i)
(gdb)
1169 __tmp[__i] = __i;
(gdb)
1168 for (size_t __i = 0; __i < sizeof(_M_widen); ++__i)
(gdb)
1169 __tmp[__i] = __i;
Code: (gdb) finish "finish" not meaningful in the outermost frame. Code: LDFLAGS=-static -lm -ljpeg -lpng -lz
OPTIMIZE_FLAG = -ggdb3 -DDEBUG
CXXFLAGS = -Wall $(OPTIMIZE_FLAG)
absurdity: xxx.o
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
Makefile.depend: *.h *.cc Makefile
$(CC) -M *.cc > Makefile.depend
include Makefile.depend
Thanks a lot! |
| lehe is offline | |
| | #2 |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| I can't really answer question 1 - you should use next and it should go to the next line. For question 2: Most likely, if you want to step into a library, you need to build it with debug symbols, and most of the time, the default build doesn't do that. -- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. |
| matsp is offline | |
| | #3 |
| Registered User Join Date: Jan 2009
Posts: 156
| Thanks Mats! I looked into the configure file. Although not completely understand it, I did ./configure debug=yes. Now I can debug into the implementation of libpng. However the source code .c files are still in the directory where I put my downloaded installation files, which means "make install" does not put .c files into some system directory like /usr/local/src or /usr/src. How to specify a directory for the source files when calling ./configure? Thank you! |
| lehe is offline | |
| | #4 |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| I have no idea how you tell ./configure where to install the source (if it at all has the capabilty of installing the source). I also don't really see the point of copying the source to /usr/src/... What benefit would that be? I often work on more than one version of some particular source code [changes for different reasons] - so I _LIKE_ the idea of each library knowing where the source code was that it got compiled from. And most of the time, if you do NOT move the source code, it will find it from wherever you had it when you built the library. -- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. |
| matsp is offline | |
| | #5 |
| Registered User Join Date: Jan 2009
Posts: 156
| Thanks! So it means don't delete the directory from where I built the library if debugging into the source code is desired? I am honestly not clear about the benefit, just some intuition from previous experience that the system directory might be a relatively better place to put the source files in. If the place from where I complied the source files is Desktop or some place that I frequently clean up, then the source code will not be able to traced by debugger. I used to program in Visual C++. If not wrong, I remember a library is usually by default installed under C:/program files/libraryname/, and header files are put under C:/program files/libraryname/include, library file under C:/program files/libraryname/lib and source files under C:/program files/libraryname/src. |
| lehe is offline | |
| | #6 |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| Well, if you store files that you need later on the desktop, then I suggest you find a better way to keep your files organized. I tend to have a "project" folder which I have directories for each project inside. If a project has several versions, I may have /project/blah/v1.1 and /project/blah/v1.2 or some such. Ultimately, you need to KEEP the source code in a place you can find back to. If that means that you copy the source to /usr/src, then that's your decision. But it's not where I would store anything other than the SYSTEM source code (e.g. the linux source). -- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. |
| matsp is offline | |
| | #7 |
| Registered User Join Date: Jan 2009
Posts: 156
| Thank you! Last edited by lehe; 01-30-2009 at 11:21 AM. |
| lehe is offline | |
![]() |
| Tags |
| debug, gdb, library |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Debug into Source | lehe | C++ Programming | 4 | 02-18-2009 10:45 AM |
| Linker errors in VC++ 2005 | C+/- | C++ Programming | 0 | 05-18-2007 07:42 AM |
| VC++ 6 question: browsing into a library | maxhavoc | Tech Board | 4 | 09-15-2006 06:57 AM |
| direct 3d x debug library required? | Rune Hunter | Game Programming | 12 | 10-30-2005 06:08 PM |
| very weird .h problem | royuco77 | C++ Programming | 1 | 09-11-2005 07:55 AM |