Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Debug and Library Questions

Status
Not open for further replies.

lehe

Programmer
Jul 18, 2008
5
0
0
US
Hi,
I have two questions. Thanks in advance for pointing out what you think about them!

1. This is a question of GDB. How to step over instead of stepping into in the following code:

for(int i = 0; i < argc; i++)
cout << (i > 0 ? " " : "") << argv << (i < argc - 1 ? " \\" : "")
<< endl;

I try to use next to step over, but always step into some other source file as I get the information:

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;

If I try to step out, I get:

(gdb) finish
"finish" not meaningful in the outermost frame.

The Makefile is something like:

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

2. On the contrary, sometimes I'd like to get inside the implementation of some library, say libpng, but when I try to debug into it I can't. I download its source code, which contains all the .c files, from After ./configure, make and make install, the .h files gets into /usr/local/include/libpng12/, the library files get into /usr/local/lib/, but no .c files get into /usr/local/src/ or /usr/src. Is that why there is no source file to debug? How could I fix it?

Thanks a lot!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top