This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
breakpoints in shared libraries
- From: Florian Hackenberger <f dot hackenberger at chello dot at>
- To: gdb at sourceware dot org
- Date: Tue, 14 Feb 2006 17:29:09 +0100
- Subject: breakpoints in shared libraries
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