[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Why GDB always jumps in and jumps out and seems uncontrollable?
From: |
Erming Pei |
Subject: |
Why GDB always jumps in and jumps out and seems uncontrollable? |
Date: |
Thu, 23 Mar 2006 19:40:43 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.1) Gecko/20060130 SeaMonkey/1.0 |
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.
- Why GDB always jumps in and jumps out and seems uncontrollable?,
Erming Pei <=