🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.unix.programmer
3 messages
3 total messages Started by Fred Ma Wed, 16 Apr 2003 05:33
gdb can't locate breakpoint of inline function
#3519
Author: Fred Ma
Date: Wed, 16 Apr 2003 05:33
22 lines
1916 bytes
Hello,

I'm using g++ 3.2.1 on solaris 8.  I used both
-g and "-gstabs+ -DDBUG" options to get extra
gnu debugging information.  The problem I'm
seeing is that I can't view the source code and
step through it if I set a breakpoint on an inline
function (gdb 5.3).  If I try to display the frame,
it just shows the starting point of main.  However,
if I make the same function non-inline and move
it from its hpp file to a cpp file, I can breakpoint
at that function and view the source code.

Normally, I'd just assume that inline functions
can't be viewed at the source level.  But it turns
out that inline member functions of a class *can*
have a breakpoint set on it, and I can view the
source code.  Maybe it's because member
functions are special.  Is this normal gdb
behaviour?

Fred
Re: gdb can't locate breakpoint of inline function
#3520
Author: Dennis Melentyev
Date: Wed, 16 Apr 2003 06:43
31 lines
2583 bytes
Hello, Fred!
You wrote  on Wed, 16 Apr 2003 01:33:56 -0400:

 FM> Hello,

 FM> I'm using g++ 3.2.1 on solaris 8.  I used both -g and "-gstabs+
 FM> -DDBUG" options to get extra gnu debugging information.  The problem
 FM> I'm seeing is that I can't view the source code and step through it
 FM> if I set a breakpoint on an inline function (gdb 5.3).  If I try to
 FM> display the frame, it just shows the starting point of main.
 FM> However, if I make the same function non-inline and move it from its
 FM> hpp file to a cpp file, I can breakpoint at that function and view
 FM> the source code.
I'm almost sure you have -O flag in command line. Remove it, or gdb will not
be able to stop at most methods in *.h files.
If this is not your case - I'm sorry.

 FM> Normally, I'd just assume that inline functions can't be viewed at
 FM> the source level.  But it turns out that inline member functions of
 FM> a class *can*
 FM> have a breakpoint set on it, and I can view the source code.  Maybe
 FM> it's because member functions are special.  Is this normal gdb
 FM> behaviour?

 FM> Fred

--
Dennis Melentyev
SW Developer @ KSF, Kiev, Ukraine
www.ksfltd.com
UIN: 83986781
Re: gdb can't locate breakpoint of inline function
#3521
Author: Fred Ma
Date: Wed, 16 Apr 2003 15:35
35 lines
2736 bytes
Dennis Melentyev wrote:

> Hello, Fred!
> You wrote  on Wed, 16 Apr 2003 01:33:56 -0400:
>
>  FM> Hello,
>
>  FM> I'm using g++ 3.2.1 on solaris 8.  I used both -g and "-gstabs+
>  FM> -DDBUG" options to get extra gnu debugging information.  The problem
>  FM> I'm seeing is that I can't view the source code and step through it
>  FM> if I set a breakpoint on an inline function (gdb 5.3).  If I try to
>  FM> display the frame, it just shows the starting point of main.
>  FM> However, if I make the same function non-inline and move it from its
>  FM> hpp file to a cpp file, I can breakpoint at that function and view
>  FM> the source code.
> I'm almost sure you have -O flag in command line. Remove it, or gdb will not
> be able to stop at most methods in *.h files.
> If this is not your case - I'm sorry.

Well, it's understandable why you think I have optimization
turned on.  That's the first thing I suspected.  But I've learned
the lesson long ago not to turn it on unless I really need the
speed.  Not only can I not debug with it, it takes way too long
to compile in the code development cycle.

In fact, that's not the only anomaly I've encountered.  I'm
finding that invoking member functions of STL containers
(such as "print MyVector.size()") does not do what it should, which
is to return the size in the above example.  It just continues
running the program as if I typed "continue".  Same with
trying to "print MyString", where MyString is of class string.

Anyway, thanks for your attempt to help.

Fred
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads