Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* breakpoints in shared libraries
@ 2001-11-13  9:05 Tom Tromey
  2001-11-13  9:41 ` Daniel Jacobowitz
  2001-11-13 10:20 ` Per Bothner
  0 siblings, 2 replies; 16+ messages in thread
From: Tom Tromey @ 2001-11-13  9:05 UTC (permalink / raw)
  To: Gdb List

A while back I changed Insight so that it would save and restore
breakpoints.  This is really handy, but it has a problem that I think
requires changes to gdb itself.

Suppose I set a breakpoint in a shared library.  I find on my Linux
box I can only do this after the inferior has been started.  So I use
`b main', then `run', then set the breakpoints I really care about.
(This gets old fast, btw.)

When Insight saves breakpoints, it doesn't know about this.  How could
it?  So it saves everything.  When I restart Insight and load my old
session, the breakpoints that are interesting to me don't load,
because gdb doesn't yet know about the shared libraries.

How can this be fixed?  I don't know the answer.  One idea I had is to
annotate each breakpoint with information about what shared library it
comes from.  Then, defer processing for that breakpoint until the
shared library is actually loaded by the inferior.

Maybe there would be other ways to accomplish the same thing.  It
would be nice if I didn't ever have to do the whole `b main; r' thing
in the first place.  But as it stands this problem is a real
impediment to my typical uses for gdb.

Tom


^ permalink raw reply	[flat|nested] 16+ messages in thread
* breakpoints in shared libraries
@ 2006-02-14 16:29 Florian Hackenberger
  2006-02-14 17:00 ` Daniel Jacobowitz
  2006-02-14 17:08 ` Mark Kettenis
  0 siblings, 2 replies; 16+ messages in thread
From: Florian Hackenberger @ 2006-02-14 16:29 UTC (permalink / raw)
  To: gdb

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2006-02-14 18:00 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-13  9:05 breakpoints in shared libraries Tom Tromey
2001-11-13  9:41 ` Daniel Jacobowitz
2001-11-13 10:11   ` Tom Tromey
2001-11-13 10:20 ` Per Bothner
2006-02-14 16:29 Florian Hackenberger
2006-02-14 17:00 ` Daniel Jacobowitz
2006-02-14 17:10   ` Florian Hackenberger
2006-02-14 17:13     ` Daniel Jacobowitz
2006-02-14 17:52       ` Paul Koning
2006-02-14 18:00         ` Florian Hackenberger
2006-02-14 17:21   ` Mark Kettenis
2006-02-14 17:23     ` Bob Rossi
2006-02-14 17:31     ` Daniel Jacobowitz
2006-02-14 17:47       ` Mark Kettenis
2006-02-14 17:08 ` Mark Kettenis
2006-02-14 17:20   ` Florian Hackenberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox