Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* gdb-5.x and step over inline functions
@ 2002-02-24  2:37 Iso-H
  2002-02-24  3:12 ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Iso-H @ 2002-02-24  2:37 UTC (permalink / raw)
  To: gdb


 Is there any way to step over inline functions 
 when using gdb >= 5.1 ? Some (commandline or other)option 
 perhaps?

 gdb-5.0 works as expected, but now I have problem
 with gcc >= 3.x because gdb-5.0 won't work with binaries
 compiled by gcc-3.x; when I start gdb, it only says:

    ...Dwarf Error: Cannot handle DW_FORM_strp in DWARF reader.

 And if I use gdb-5.1 (/gdb-5.1-20020124) it shows
 internals of inline-functions which is really annoying,
 turning gdb-5.1 to almost useless tool!

 I have used gcc option "-g3" with compilations and
 my host/target arch is GNULinux-alpha (ev56/ev67) but
 I think that this "step over inline functions" problem
 exist on other archs too.

-- 

Iso-H



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

* Re: gdb-5.x and step over inline functions
  2002-02-24  2:37 gdb-5.x and step over inline functions Iso-H
@ 2002-02-24  3:12 ` Eli Zaretskii
  0 siblings, 0 replies; 14+ messages in thread
From: Eli Zaretskii @ 2002-02-24  3:12 UTC (permalink / raw)
  To: Iso-H; +Cc: gdb


On Sun, 24 Feb 2002, Iso-H wrote:

>  Is there any way to step over inline functions 
>  when using gdb >= 5.1 ? Some (commandline or other)option 
>  perhaps?

Doesn't `until' do that?  That is, given that line 123 calls an inline 
function, and line 124 is the one after the inline function returns, you 
should be able to say "until 124" and get what you want.  Does that work?

>  I have used gcc option "-g3" with compilations and
>  my host/target arch is GNULinux-alpha (ev56/ev67) but
>  I think that this "step over inline functions" problem
>  exist on other archs too.

Does it help to use -gstabs+ instead of -g3?  (I assume the latter is a
synonym for -gdwarf-2 on your system.)


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

* Re: gdb-5.x and step over inline functions
  2002-02-24 10:34       ` Daniel Jacobowitz
@ 2002-08-19  8:48         ` Daniel Jacobowitz
  0 siblings, 0 replies; 14+ messages in thread
From: Daniel Jacobowitz @ 2002-08-19  8:48 UTC (permalink / raw)
  To: Iso-H, gdb

On Sun, Feb 24, 2002 at 01:34:15PM -0500, Daniel Jacobowitz wrote:
> On Sun, Feb 24, 2002 at 08:09:11PM +0200, Iso-H wrote:
> > On Sun, 24 Feb 2002, Iso-H wrote:
> > 
> > > On Sun, 24 Feb 2002, Daniel Jacobowitz wrote:
> > > 
> > > > On Sun, Feb 24, 2002 at 03:14:00PM +0200, Iso-H wrote:
> > > > > 
> > > > > On Sun, 24 Feb 2002, Eli Zaretskii wrote:
> > > > > 
> > > > > > 
> > > > > > On Sun, 24 Feb 2002, Iso-H wrote:
> > > > > > 
> > > > > > >  Is there any way to step over inline functions 
> > > > > > >  when using gdb >= 5.1 ? Some (commandline or other)option 
> > > > > > >  perhaps?
> > > > > > ....
> > > > 
> > > > Could you provide a small testcase, with source and a compile
> > > > commandline?  
> > > 
> > >   It seems to be so that it is difficult to create 
> > >   just simple "demo", but I'll try...
> > >
> > 
> >  Ok. here it is; one file only ;)
> 
> >  As you can see, gdb doesn't show "f_func", but Demo_t's
> >  constructor instead !
> 
> Thanks!  I think I see what's going on; I'll take a better look at it
> later tonight.

And, eight months later...

This is unfortunately a GCC bug.  The debug information says that the
beginning of the function is on line 17, in the inline constructor;
nothing GDB can do about that.  I'm not quite sure if this is fixed or
avoided in GCC 3.1, but the problem doesn't show up.

If you use GCC 3.1, you'll notice that list behaves properly but break
drops you in an inline function; that's symptomatic of two things:
  - GDB's lack of proper support for inline functions
  - GDB's prologue skipping, as Andrew was discussing this weekend.

Both of these should be resolved but there's no clear time frame on
either.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


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

* Re: gdb-5.x and step over inline functions
  2002-02-24 13:29 ` Iso-H
@ 2002-02-25 23:44   ` Iso-H
  0 siblings, 0 replies; 14+ messages in thread
From: Iso-H @ 2002-02-25 23:44 UTC (permalink / raw)
  To: gdb

On Sun, 24 Feb 2002, Iso-H wrote:

> On Sun, 24 Feb 2002, Michael Elizabeth Chastain wrote:
> 
> > ...
> > 
> > You wrote:
> > > gdb-5.0 works as expected, but now I have problem ...
> > > 
> > >     ...Dwarf Error: Cannot handle DW_FORM_strp in DWARF reader.
> > 
> > I am suggesting that you try gdb 5.0, gcc 3.x, and "-gstabs+" when you
> > ....
> 
>   Yes, I tried exactly that without success, but perhaps
>   I messed up something; I have to try that again later, I don't
>   have gdb-5.0 here at work...
> 

  Doesn't work (perfectly); here are the results:

     gcc          gdb
  ------------------------------------------------
     2.95.3       5.0:  gdb works as expected
     3.0.1        5.0:  gdb starts, but gdb can't list anything
                        ie. if I say: 'list f_somefunction' then
                        gdb says: 'Function "f_somefunction" not defined.'
                        even if "f_somefunction" is there.
     3.0.3        5.0:  same
     3.1-20020114 5.0:  gdb starts if source is compiled with
                        "-gstabs+", but I still can't list anything
     x.x.x    5.1-20020124: gdb works, but with "inline problem"

> 
> > 
> > Michael C
> > 
> 
> 

-- 

Iso-H



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

* Re: gdb-5.x and step over inline functions
  2002-02-24 12:33 Michael Elizabeth Chastain
@ 2002-02-24 13:29 ` Iso-H
  2002-02-25 23:44   ` Iso-H
  0 siblings, 1 reply; 14+ messages in thread
From: Iso-H @ 2002-02-24 13:29 UTC (permalink / raw)
  To: gdb

On Sun, 24 Feb 2002, Michael Elizabeth Chastain wrote:

> I was unclear, I am sorry.

  I think I was more unclear, double sorry ;)

> 
> You wrote:
> > gdb-5.0 works as expected, but now I have problem
> > with gcc >= 3.x because gdb-5.0 won't work with binaries
> >  compiled by gcc-3.x; when I start gdb, it only says:
> > 
> >     ...Dwarf Error: Cannot handle DW_FORM_strp in DWARF reader.
> 
> I was responding to that part.
> 
> I am suggesting that you try gdb 5.0, gcc 3.x, and "-gstabs+" when you
> compile.  Then you can have the "step over inline functions" behavior
> that you want in gdb 5.0, while avoiding any problems with the dwarf
> symbol reader in gdb 5.0.

  Yes, I tried exactly that without success, but perhaps
  I messed up something; I have to try that again later, I don't
  have gdb-5.0 here at work...


> 
> Michael C
> 

-- 

Iso-H



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

* Re: gdb-5.x and step over inline functions
@ 2002-02-24 12:33 Michael Elizabeth Chastain
  2002-02-24 13:29 ` Iso-H
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Elizabeth Chastain @ 2002-02-24 12:33 UTC (permalink / raw)
  To: gdb, jd

I was unclear, I am sorry.

You wrote:
> gdb-5.0 works as expected, but now I have problem
> with gcc >= 3.x because gdb-5.0 won't work with binaries
>  compiled by gcc-3.x; when I start gdb, it only says:
> 
>     ...Dwarf Error: Cannot handle DW_FORM_strp in DWARF reader.

I was responding to that part.

I am suggesting that you try gdb 5.0, gcc 3.x, and "-gstabs+" when you
compile.  Then you can have the "step over inline functions" behavior
that you want in gdb 5.0, while avoiding any problems with the dwarf
symbol reader in gdb 5.0.

Michael C


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

* Re: gdb-5.x and step over inline functions
  2002-02-24 11:33 Michael Elizabeth Chastain
@ 2002-02-24 11:45 ` Iso-H
  0 siblings, 0 replies; 14+ messages in thread
From: Iso-H @ 2002-02-24 11:45 UTC (permalink / raw)
  To: gdb

On Sun, 24 Feb 2002, Michael Elizabeth Chastain wrote:

> You could try a different debug option ("gcc -gstabs+ ...").  I don't
> know if that will work on your platform but it will avoid the dwarf 2
> reader issue with gdb 5.0.

  I tried already, it didn't make any difference.

> 
> Michael C
> 

-- 

Iso-H



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

* Re: gdb-5.x and step over inline functions
@ 2002-02-24 11:33 Michael Elizabeth Chastain
  2002-02-24 11:45 ` Iso-H
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Elizabeth Chastain @ 2002-02-24 11:33 UTC (permalink / raw)
  To: gdb, jd

You could try a different debug option ("gcc -gstabs+ ...").  I don't
know if that will work on your platform but it will avoid the dwarf 2
reader issue with gdb 5.0.

Michael C


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

* Re: gdb-5.x and step over inline functions
  2002-02-24 10:09     ` Iso-H
@ 2002-02-24 10:34       ` Daniel Jacobowitz
  2002-08-19  8:48         ` Daniel Jacobowitz
  0 siblings, 1 reply; 14+ messages in thread
From: Daniel Jacobowitz @ 2002-02-24 10:34 UTC (permalink / raw)
  To: Iso-H; +Cc: gdb

On Sun, Feb 24, 2002 at 08:09:11PM +0200, Iso-H wrote:
> On Sun, 24 Feb 2002, Iso-H wrote:
> 
> > On Sun, 24 Feb 2002, Daniel Jacobowitz wrote:
> > 
> > > On Sun, Feb 24, 2002 at 03:14:00PM +0200, Iso-H wrote:
> > > > 
> > > > On Sun, 24 Feb 2002, Eli Zaretskii wrote:
> > > > 
> > > > > 
> > > > > On Sun, 24 Feb 2002, Iso-H wrote:
> > > > > 
> > > > > >  Is there any way to step over inline functions 
> > > > > >  when using gdb >= 5.1 ? Some (commandline or other)option 
> > > > > >  perhaps?
> > > > > ....
> > > 
> > > Could you provide a small testcase, with source and a compile
> > > commandline?  
> > 
> >   It seems to be so that it is difficult to create 
> >   just simple "demo", but I'll try...
> >
> 
>  Ok. here it is; one file only ;)

>  As you can see, gdb doesn't show "f_func", but Demo_t's
>  constructor instead !

Thanks!  I think I see what's going on; I'll take a better look at it
later tonight.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


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

* Re: gdb-5.x and step over inline functions
  2002-02-24  9:25   ` Iso-H
@ 2002-02-24 10:09     ` Iso-H
  2002-02-24 10:34       ` Daniel Jacobowitz
  0 siblings, 1 reply; 14+ messages in thread
From: Iso-H @ 2002-02-24 10:09 UTC (permalink / raw)
  To: gdb

On Sun, 24 Feb 2002, Iso-H wrote:

> On Sun, 24 Feb 2002, Daniel Jacobowitz wrote:
> 
> > On Sun, Feb 24, 2002 at 03:14:00PM +0200, Iso-H wrote:
> > > 
> > > On Sun, 24 Feb 2002, Eli Zaretskii wrote:
> > > 
> > > > 
> > > > On Sun, 24 Feb 2002, Iso-H wrote:
> > > > 
> > > > >  Is there any way to step over inline functions 
> > > > >  when using gdb >= 5.1 ? Some (commandline or other)option 
> > > > >  perhaps?
> > > > ....
> > 
> > Could you provide a small testcase, with source and a compile
> > commandline?  
> 
>   It seems to be so that it is difficult to create 
>   just simple "demo", but I'll try...
>

 Ok. here it is; one file only ;)

 ---------------------------------------------------------------

    #include <stdio.h>
    #include <sys/types.h>

    class Demo_t
    {
        public:
            inline Demo_t(int32_t);
            inline int32_t m_demomethod(int32_t);

        private:
            int32_t a_1;
            int32_t a_2;
    };

    Demo_t::Demo_t(int32_t p_arg)
    {
        a_1 = p_arg;
        a_2 = 0;
    }

    int32_t Demo_t::m_demomethod(
            int32_t p_arg
    )
    {
        return a_1 + p_arg;
    }


    int f_func( int32_t p_arg);

    //###############################################
    int
    main(
            int32_t     p_argc,
            int8_t**    pp_argv
    )
    {
        printf("value: %d\n", f_func(2));
    }


    //###############################################
    int
    f_func(
            int32_t     p_arg
    )
    {
        Demo_t a(1);

        printf("value: %d\n", a.m_demomethod(2));
    }

 ---------------------------------------------------------------

 and compiling command is:
     g++  -O2 -g3  gdb-5.x-inline-test.cxx -o test.bin

 And here is gdb session:
 -------------------------------------------------------


    #gdb test.bin       
    GNU gdb 20020124
    Copyright 2002 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, 
    and you are welcome to change it and/or distribute copies of it 
    under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB.  Type "show warranty" for 
    details.
    This GDB was configured as "alphaev56-unknown-linux-gnu"...
    (gdb) list f_func
    12              int32_t a_1;
    13              int32_t a_2;
    14      };
    15
    16      Demo_t::Demo_t(int32_t p_arg)
    17      {
    18          a_1 = p_arg;
    19          a_2 = 0;
    20      }
    21
    (gdb) q
    #

 -------------------------------------------------------

 As you can see, gdb doesn't show "f_func", but Demo_t's
 constructor instead !

 There is also some variation; if constructor's "p_arg" parameter
 is removed then list dump is correct!?


> 
> > 
> > 
> 
> 

-- 

Iso-H



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

* Re: gdb-5.x and step over inline functions
  2002-02-24  8:40 ` Daniel Jacobowitz
@ 2002-02-24  9:25   ` Iso-H
  2002-02-24 10:09     ` Iso-H
  0 siblings, 1 reply; 14+ messages in thread
From: Iso-H @ 2002-02-24  9:25 UTC (permalink / raw)
  To: gdb

On Sun, 24 Feb 2002, Daniel Jacobowitz wrote:

> On Sun, Feb 24, 2002 at 03:14:00PM +0200, Iso-H wrote:
> > 
> > On Sun, 24 Feb 2002, Eli Zaretskii wrote:
> > 
> > > 
> > > On Sun, 24 Feb 2002, Iso-H wrote:
> > > 
> > > >  Is there any way to step over inline functions 
> > > >  when using gdb >= 5.1 ? Some (commandline or other)option 
> > > >  perhaps?
> > > 
> > > Doesn't `until' do that?  That is, given that line 123 calls an inline 
> > > function, and line 124 is the one after the inline function returns, you 
> > > should be able to say "until 124" and get what you want.  Does that work?
> > 
> >   It isn't same; for example if I want to say: "list f_MyFunction"
> >   and if there is (==beginning of "f_MyFunction") some objects 
> >   which have inline constructors I get list of those constructor(s)
> >   NOT list of "f_MyFunction" as I expected/wanted.  Besides, 
> >   I have to check what is the line number from source code by editor 
> >   because gdb can't show that line to me.
> > 
> >   Same goes with "next"; if I set breakpoint: "b f_MyFunction"
> >   I don't get what I want, because I end up to inside of those
> >   f*king inline constructor(s) again when breakpoint is reached!
> > 
> >   All this works with gdb-5.0, so gdb-5.1.x behaves
> >   differently here...
> 
> Could you provide a small testcase, with source and a compile
> commandline?  By small I also mean including no system headers.  I'll
> try to see what has changed.

  It seems to be so that it is difficult to create 
  just simple "demo", but I'll try...

> 
> 

-- 

Iso-H



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

* Re: gdb-5.x and step over inline functions
  2002-02-24  5:14 Iso-H
@ 2002-02-24  8:40 ` Daniel Jacobowitz
  2002-02-24  9:25   ` Iso-H
  0 siblings, 1 reply; 14+ messages in thread
From: Daniel Jacobowitz @ 2002-02-24  8:40 UTC (permalink / raw)
  To: Iso-H; +Cc: gdb

On Sun, Feb 24, 2002 at 03:14:00PM +0200, Iso-H wrote:
> 
> On Sun, 24 Feb 2002, Eli Zaretskii wrote:
> 
> > 
> > On Sun, 24 Feb 2002, Iso-H wrote:
> > 
> > >  Is there any way to step over inline functions 
> > >  when using gdb >= 5.1 ? Some (commandline or other)option 
> > >  perhaps?
> > 
> > Doesn't `until' do that?  That is, given that line 123 calls an inline 
> > function, and line 124 is the one after the inline function returns, you 
> > should be able to say "until 124" and get what you want.  Does that work?
> 
>   It isn't same; for example if I want to say: "list f_MyFunction"
>   and if there is (==beginning of "f_MyFunction") some objects 
>   which have inline constructors I get list of those constructor(s)
>   NOT list of "f_MyFunction" as I expected/wanted.  Besides, 
>   I have to check what is the line number from source code by editor 
>   because gdb can't show that line to me.
> 
>   Same goes with "next"; if I set breakpoint: "b f_MyFunction"
>   I don't get what I want, because I end up to inside of those
>   f*king inline constructor(s) again when breakpoint is reached!
> 
>   All this works with gdb-5.0, so gdb-5.1.x behaves
>   differently here...

Could you provide a small testcase, with source and a compile
commandline?  By small I also mean including no system headers.  I'll
try to see what has changed.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


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

* Re: gdb-5.x and step over inline functions
@ 2002-02-24  8:30 Salman Khilji
  0 siblings, 0 replies; 14+ messages in thread
From: Salman Khilji @ 2002-02-24  8:30 UTC (permalink / raw)
  To: gdb

I totally agree.  I downloaded the ACE application framework 
(www.cs.wustl.edu/~schmidt.  Download and compile 
%ACE_ROOT%/examples/C++Npv1.  There are plenty of inline functions there.  
My experience was the gdb was pretty much a useless tool for stepping thru 
the example code.  It was jumping back and forth to places of code that I 
didn't care about.    If you want to see for yourself step thru the ::open 
function included in the Logging_Server class.

I also would like to see this "stepping into inlines" an optional feature 
turned off by default.

The ACE framework uses a macro named ACE_INLINE for inline functions.  I 
dont' know what exactly this macro does.

Salman

>   All this works with gdb-5.0, so gdb-5.1.x behaves
>   differently here...
>


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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

* Re: gdb-5.x and step over inline functions
@ 2002-02-24  5:14 Iso-H
  2002-02-24  8:40 ` Daniel Jacobowitz
  0 siblings, 1 reply; 14+ messages in thread
From: Iso-H @ 2002-02-24  5:14 UTC (permalink / raw)
  To: gdb


On Sun, 24 Feb 2002, Eli Zaretskii wrote:

> 
> On Sun, 24 Feb 2002, Iso-H wrote:
> 
> >  Is there any way to step over inline functions 
> >  when using gdb >= 5.1 ? Some (commandline or other)option 
> >  perhaps?
> 
> Doesn't `until' do that?  That is, given that line 123 calls an inline 
> function, and line 124 is the one after the inline function returns, you 
> should be able to say "until 124" and get what you want.  Does that work?

  It isn't same; for example if I want to say: "list f_MyFunction"
  and if there is (==beginning of "f_MyFunction") some objects 
  which have inline constructors I get list of those constructor(s)
  NOT list of "f_MyFunction" as I expected/wanted.  Besides, 
  I have to check what is the line number from source code by editor 
  because gdb can't show that line to me.

  Same goes with "next"; if I set breakpoint: "b f_MyFunction"
  I don't get what I want, because I end up to inside of those
  f*king inline constructor(s) again when breakpoint is reached!

  All this works with gdb-5.0, so gdb-5.1.x behaves
  differently here...

> 
> >  I have used gcc option "-g3" with compilations and
> >  my host/target arch is GNULinux-alpha (ev56/ev67) but
> >  I think that this "step over inline functions" problem
> >  exist on other archs too.
> 
> Does it help to use -gstabs+ instead of -g3?  (I assume the latter is a
> synonym for -gdwarf-2 on your system.)

  I tried, but it didn't help...

> 

-- 

Iso-H



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

end of thread, other threads:[~2002-08-19 15:48 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-24  2:37 gdb-5.x and step over inline functions Iso-H
2002-02-24  3:12 ` Eli Zaretskii
2002-02-24  5:14 Iso-H
2002-02-24  8:40 ` Daniel Jacobowitz
2002-02-24  9:25   ` Iso-H
2002-02-24 10:09     ` Iso-H
2002-02-24 10:34       ` Daniel Jacobowitz
2002-08-19  8:48         ` Daniel Jacobowitz
2002-02-24  8:30 Salman Khilji
2002-02-24 11:33 Michael Elizabeth Chastain
2002-02-24 11:45 ` Iso-H
2002-02-24 12:33 Michael Elizabeth Chastain
2002-02-24 13:29 ` Iso-H
2002-02-25 23:44   ` Iso-H

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