From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5076 invoked by alias); 23 Mar 2006 18:40:51 -0000 Received: (qmail 4893 invoked by uid 22791); 23 Mar 2006 18:40:50 -0000 X-Spam-Check-By: sourceware.org Received: from marocco.in2p3.fr (HELO marocco.in2p3.fr) (134.158.16.54) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 23 Mar 2006 18:40:48 +0000 Received: from localhost (localhost [127.0.0.1]) by marocco.in2p3.fr (Postfix) with ESMTP id 4950137350; Thu, 23 Mar 2006 19:40:45 +0100 (CET) Received: from [134.158.16.112] (marlens.in2p3.fr [134.158.16.112]) by marocco.in2p3.fr (Postfix) with ESMTP id 840653733F; Thu, 23 Mar 2006 19:40:43 +0100 (CET) Message-ID: <4422EBAB.90806@cppm.in2p3.fr> Date: Thu, 23 Mar 2006 18:50:00 -0000 From: Erming Pei User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.1) Gecko/20060130 SeaMonkey/1.0 MIME-Version: 1.0 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? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-03/txt/msg00165.txt.bz2 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((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.