Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Erming Pei <epei@cppm.in2p3.fr>
To: choo@actcom.co.il, bug-gdb@gnu.org, mato@nz.eds.com,
		mcelrath@draal.physics.wisc.edu, gdb@sourceware.org
Subject: Why GDB always jumps in and jumps out and seems uncontrollable?
Date: Thu, 23 Mar 2006 18:50:00 -0000	[thread overview]
Message-ID: <4422EBAB.90806@cppm.in2p3.fr> (raw)

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.


             reply	other threads:[~2006-03-23 18:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-23 18:50 Erming Pei [this message]
2006-03-23 19:17 ` Jim Blandy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4422EBAB.90806@cppm.in2p3.fr \
    --to=epei@cppm.in2p3.fr \
    --cc=bug-gdb@gnu.org \
    --cc=choo@actcom.co.il \
    --cc=gdb@sourceware.org \
    --cc=mato@nz.eds.com \
    --cc=mcelrath@draal.physics.wisc.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox