Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Novice gdb question
@ 2009-07-03 20:04 ikorot
  2009-07-03 22:15 ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: ikorot @ 2009-07-03 20:04 UTC (permalink / raw)
  To: gdb

Hi, ALL
When I try to debug a program that has inline function (C++) with gdb
and MSVC debugger I get an incnsistent behavior.

Scenario:
I am stepping in the function that is inline:

class Foo
{
   void inlineFunc( int param ) { m_member = param; };
   void nonInlineFunc();

private:
   int m_member;
};

Calling code:

Foo f;
...........
f.inlineFunc( 5 );
f.noninlineFunc();

Then I hit next.

Result:
In MSVC debugger, when I hit next standing on the inline function call
I will end up on the line "f.inlineFunc( 5 );"
In gdb when I hit next standing on the inline function call I will end up
on the line "f.noninlineFunc();"

Is it possible to make gdb aware of the inline-ness and make it work as MSVC
debugger?

Thank you.


^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: Novice gdb question
@ 2009-07-06  3:11 ikorot
  2009-07-06  3:26 ` Paul Pluzhnikov
  0 siblings, 1 reply; 5+ messages in thread
From: ikorot @ 2009-07-06  3:11 UTC (permalink / raw)
  To: gdb

Hi, Paul,
I'm sorry if my question was not clear enough.
Let me put some clarification on it.

-----Original Message-----
>From: Paul Pluzhnikov <ppluzhnikov@google.com>
>Sent: Jul 4, 2009 8:19 PM
>To: ikorot@earthlink.net, "gdb@sourceware.org" <gdb@sourceware.org>
>Subject: Re: Novice gdb question
>
>On Fri, Jul 3, 2009 at 3:15 PM, Daniel Jacobowitz<drow@false.org> wrote:
>> On Fri, Jul 03, 2009 at 01:04:16PM -0700, ikorot@earthlink.net wrote:
>>> Is it possible to make gdb aware of the inline-ness and make it work as MSVC
>>> debugger?
>>
>> Build GDB from CVS.  Inline function support was added last week.
>
>It will work, but not the same way MSVC does.
>
>It's not clear from OP description whether he used debug (no actual
>inlining happening!) or optimized (AFAICT no source level debugging
>AFACT) build. In addition, at least in VC2008 there is no "next", only
>"step over" (F10) and "step into" (F11). Finally, if there actually is
>a version of MSVC which behaves as OP described, that behavior is
>arguably more broken that GDB's was before inline fixes.

Consider following code snippet:

class Foo
{
public:
       int inilineGetParam() { return m_member; };
       void Bar( int param );
private:
       int m_member;
}

int main()
{
     Foo f;
     f.Bar( f.inlineGetParam() );
    printf( "Done!");
}

In MSVC debugger and gdb, when I hit F11 standing on the line "f.Bar(....)", I will 
go to the "f.inilineFunc()" line. Now in MSVC hitting F10, brings me back to the line
"f.Bar(...)" so I can decide whether I want to go to the "printf" line or step inside "f.Bar"
In gdb saying "next", which I believe the same as F10 function in MSVC debugger, brings
me to the line with the "printf();"

If you are saying that this what will happen in the next release of gdb I will just wait for it.

Thank you.

>
>
>-- 
>Paul Pluzhnikov


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

end of thread, other threads:[~2009-07-06  3:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-03 20:04 Novice gdb question ikorot
2009-07-03 22:15 ` Daniel Jacobowitz
2009-07-05  0:19   ` Paul Pluzhnikov
2009-07-06  3:11 ikorot
2009-07-06  3:26 ` Paul Pluzhnikov

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