* Why GDB always jumps in and jumps out and seems uncontrollable?
@ 2006-03-23 18:50 Erming Pei
2006-03-23 19:17 ` Jim Blandy
0 siblings, 1 reply; 2+ messages in thread
From: Erming Pei @ 2006-03-23 18:50 UTC (permalink / raw)
To: choo, bug-gdb, mato, mcelrath, gdb
Hi, choo,
I found you email by surfing the webpage. Could you help me with a
problem of debugging with GDB on LINUX?
If you have no time to see this problem, would you recommand some
webpage or some mail addresses to me?
When I debug a program made by c and c++ code using gdb, it always
enters into the inner side of standard funtions and even their libraries;
That didnt happened when I only debug program that only made by c. (not
c/c++)
e.g.
#1 the following is a part of my program.
....
118 char *homeDir;
119 if ( (homeDir=getenv("ATLPROD_ROOT_DIR"))==NULL) ////
120 {
121 *messages << MSG::ERROR << "ATLPROD_ROOT_DIR not set !" << endreq;
122 exit(-1);
123 }
124 //
remove lock files
125 string pipo(homeDir);
126 string com="rm "+pipo+"/jobs/lock*";
127 system(com.c_str());
128
129 asite.connexionToServer("localhost",const_cast<char
*>((theParameters->getPort()).c_str()));
130
131 int SERV=asite.getDist();
#2 the scence of debugging:
#from line 119, when input "next" command, it entered into
/usr/include/c++/3.2.3/bits/char_traits.h. but I dont want to see that,
I only want to see the line 120!!
......
119 if ( (homeDir=getenv("ATLPROD_ROOT_DIR"))==NULL) //<---main.cpp
(gdb)n
664 allocator() throw() {} //<---Why this?
(gdb)n
956 {
(gdb)n
957 basic_string<_CharT, _Traits, _Alloc> __str(__lhs);
(gdb)n
135 { return strlen(__s); }
(gdb)n
957 basic_string<_CharT, _Traits, _Alloc> __str(__lhs);
(gdb)n
135 { return strlen(__s); }
(gdb) bt
#0 main (argc=1, argv=0xbfff9b80)
at /usr/include/c++/3.2.3/bits/char_traits.h:135
(gdb) n
229 { return _M_dataplus._M_p; }
(gdb)n
668 ~allocator() throw() {}
(gdb)n
229 { return _M_dataplus._M_p; }
(gdb)n
665 allocator(const allocator&) throw() {}
(gdb)n
38 {
(gdb)n
40 __asm__ __volatile__ ("lock; xaddl %0,%2"
(gdb)n
38 {
(gdb)n
229 { return _M_dataplus._M_p; }
(gdb)n
119 { __c1 = __c2; }
(gdb)n
781 {
(gdb)n
Detaching after fork from child process 13210.
229 { return _M_dataplus._M_p; }
(gdb)n
119 { __c1 = __c2; }
(gdb)n
781 {
(gdb)n
229 { return _M_dataplus._M_p; }
(gdb)n
668 ~allocator() throw() {}
(gdb)n
229 { return _M_dataplus._M_p; }
(gdb)n
38 {
(gdb)n
40 __asm__ __volatile__ ("lock; xaddl %0,%2"
(gdb)n
38 {
(gdb)n
131 int SERV=asite.getDist(); //<---- It jumped to line 131 of
main.cpp when input "next" continously. it skiped the midlines(119-130)
(gdb)
133 string temp = theParameters->getPassword();
It always happens when I try to debug the program. it jumps in and out.
Furthermore, when I want to stop the program at a line e.g.
Core.cpp:437. Gdb is not able to stop at this line.
But it can execute this line when I run the program normally. It's so
strange.
Besides, I've set the step-mode off. And before debug, I set CFLAGS=-g
-O2 CXXFLAGS= -g -O2 CC = gcc CPP = gcc -E CXX = g++ CPPFLAGS = -Wall
-g -Wno-deprecated.
Is that any relations with STL or multi-threads or multi-processes or
else??
The gdb version is: GNU gdb Red Hat Linux (6.3.0.0-0.30.1rh)
Any hint from you would be greatly appreciated.
Cheers,
Erming.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Why GDB always jumps in and jumps out and seems uncontrollable?
2006-03-23 18:50 Why GDB always jumps in and jumps out and seems uncontrollable? Erming Pei
@ 2006-03-23 19:17 ` Jim Blandy
0 siblings, 0 replies; 2+ messages in thread
From: Jim Blandy @ 2006-03-23 19:17 UTC (permalink / raw)
To: Erming Pei; +Cc: choo, bug-gdb, mato, mcelrath, gdb
Try compiling your program without optimization, and then debugging that.
Inlining and instruction scheduling can make it hard to correlate the
behavior of the compiled program with that of the source program.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-03-23 18:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-23 18:50 Why GDB always jumps in and jumps out and seems uncontrollable? Erming Pei
2006-03-23 19:17 ` Jim Blandy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox