From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2744 invoked by alias); 14 Feb 2006 16:29:09 -0000 Received: (qmail 2736 invoked by uid 22791); 14 Feb 2006 16:29:09 -0000 X-Spam-Check-By: sourceware.org Received: from mailrelay.tu-graz.ac.at (HELO mailrelay2.tu-graz.ac.at) (129.27.2.202) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 14 Feb 2006 16:29:04 +0000 Received: from [192.168.1.2] (chello084115131198.3.graz.surfer.at [84.115.131.198]) (authenticated bits=0) by mailrelay2.tu-graz.ac.at (8.13.5/8.13.5) with ESMTP id k1EGSxKx026185 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 14 Feb 2006 17:29:00 +0100 (CET) From: Florian Hackenberger To: gdb@sourceware.org Subject: breakpoints in shared libraries Date: Tue, 14 Feb 2006 16:29:00 -0000 User-Agent: KMail/1.9.1 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200602141729.09355.f.hackenberger@chello.at> X-IsSubscribed: yes 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-02/txt/msg00129.txt.bz2 Dear fellows, This question pops up from time to time, but while skimming through the archives I was not able to find any suggestions. The problem I have is that I am not able to stop at breakpoints within some shared libraries. The layout of the program I'm trying to debug is as following (arrows indicate dynamic linkage against some library) testHoap2Collision ->libhoap2.so -> libroboop.so, libnewmat.so, libController.so, libCGAL.so The project is built using libtool and the autotools and the following flags: configure: --enable-debug=full g++: -O0 -g3 All libraries apart from libController.so and libCGAL.so are built using the same autotools environment (one ./configure for all). What I'm trying to do is to set a breakpoint within libroboop.so within the following method: Quaternion::Quaternion(const Real angle, const ColumnVector & axis) //! @brief Constructor. { if(axis.Nrows() != 3) { cerr << "Quaternion::Quaternion, size of axis != 3" << endl; exit(1); } // make sure axis is a unit vector Real norm_axis = sqrt(DotProduct(axis, axis)); if(norm_axis != 1) { cerr << "Quaternion::Quaternion(angle, axis), axis is not unit." << endl; cerr << "Make the axis unit." << endl; v_ = sin(angle/2) * axis/norm_axis; } else v_ = sin(angle/2) * axis; s_ = cos(angle/2); } It does not matter where the breakpoint is set within this method, but I would like to set it on the line: cerr << "Make the axis unit." << endl; Here is the declaration of the method: Quaternion(const Real angle_in_rad, const ColumnVector & axis); So, it's not inline or anything fancy, just a plain constructor. The following happens: After starting gdb (libtool --mode=execute gdb testHoap2Collision) I try the following: (gdb) break quaternion.cpp:100 No source file named quaternion.cpp. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 1 (quaternion.cpp:100) pending. Ok, that's fine, now let's see if the breakpoint is set: (gdb) run Starting program: msl/debug/libhoap2/examples/testCollision/.libs/lt-testHoap2Collision [Thread debugging using libthread_db enabled] [New Thread -1216158016 (LWP 16481)] Breakpoint 3 at 0xb7e73147: file msl/libroboop/source/quaternion.cpp, line 100. Pending breakpoint "quaternion.cpp:100" resolved Quaternion::Quaternion(angle, axis), axis is not unit. Make the axis unit. That tells me: 1. The breakpoint was set. 2. The breakpoint did not work, as I can see the output "Make the axis unit." and that's the line where my breakpoint was supposed to interrupt the execution. So that's the problem. Can anyone help me? Here's some info about my environment: GNU gdb 6.3 g++ (GCC) 3.4.3-20050110 A "typical call to g++": g++ -DHAVE_CONFIG_H -I. -I/home/hacki/Documents/sandbox/master_project/msl-2.0_automake/msl/libhoap2/examples/testCollision -I../../.. -I/home/hacki/Documents/sandbox/master_project/msl-2.0_automake/msl/libhoap2 -I/home/hacki/Documents/sandbox/master_project/msl-2.0_automake/msl/libnewmat -I/home/hacki/Documents/sandbox/master_project/msl-2.0_automake/msl/libroboop/source -I/usr/qt/3/include -I/usr/local/webots/include -I/home/hacki/Documents/sandbox/master_project/msl-2.0_automake/msl/external_include -I/home/hacki/Documents/sandbox/master_project/msl-2.0_automake/msl/../CGAL-3.1/include/CGAL/config/i686_Linux-2.6.15-suspend2-r3_g++-3.4.3 -I/home/hacki/Documents/sandbox/master_project/msl-2.0_automake/msl/../CGAL-3.1/include -O0 -g3 -MT testHoap2Collision.o -MD -MP -MF ".deps/testHoap2Collision.Tpo" -c -o testHoap2Collision.o /home/hacki/Documents/sandbox/master_project/msl-2.0_automake/msl/libhoap2/examples/testCollision/testHoap2Collision.cpp The call to link the executable: g++ -O0 -g3 -o .libs/testHoap2Collision testHoap2Collision.o ../../../libhoap2/.libs/libhoap2.so -L/home/hacki/Documents/sandbox/master_project/msl-2.0_automake/msl/../CGAL-3.1/lib/i686_Linux-2.6.15-suspend2-r3_g++-3.4.3 -L/usr/local/webots/lib -L/usr/i686-pc-linux-gnu/bin -L/usr/i686-pc-linux-gnu/lib /home/hacki/Documents/sandbox/master_project/msl-2.0_automake/msl/debug/libroboop/source/.libs/libroboop.so /home/hacki/Documents/sandbox/master_project/msl-2.0_automake/msl/debug/libnewmat/.libs/libnewmat.so -lController -lCGAL //usr/lib/gcc/i686-pc-linux-gnu/3.4.3-20050110/libstdc++.so -Wl,--rpath -Wl,/usr/local/lib -Wl,--rpath -Wl,//usr/lib/gcc/i686-pc-linux-gnu/3.4.3-20050110 Sincerely Yours, Florian -- Florian Hackenberger student @ University of Technology Graz, Austria florian@hackenberger.at www.hackenberger.at