Mail Archives: djgpp/2001/04/11/23:30:23
Eli Zaretskii wrote:
[...]
> I do see that after "run", the program doesn't stop on the first
> executable line of the `main' function, which is this:
>
> count = 0;
>
> Instead, it stops here:
>
> count += 2;
>
> which is _after_ Paths::car7() was called.
Yes, that is another thing I have noticed several times with
different versions of gdb. I set a breakpoint and run, and
the program either runs to completion, or stops someplace other
than the place where I put the breakpoint. This is one of
the reasons I just concluded that gdb was unusable, and so
I didn't ever try very hard to use it.
> So I set a breakpoint on the first executable line of `main':
>
> (gdb) b 19
> (gdb) run
> (gdb) n
>
> And _now_ it indeed runs very slowly.
>
> The problem seems to be that GCC inlines the call to Paths::car7(),
> and that confuses GDB's "next" command. When "next" sees a call to a
> function, it single-steps into the function over which it wants to
> step, then sets a temporary breakpoint at the return address of that
> function. But with an inlined function, there is no return address to
> put a breakpoint on, and so GDB ends up single-stepping the whole
> region of the instructions in the inlined call.
>
> One way to avoid this is tell GCC not to inline (with the
> "-fno-default-inline" option).
Yes. Thanks. That option seems to make it work properly,
with either -g or with -gstabs.
> Another way is to not use the `n'
> command, and instead use "tb +1" and "c" commands. The first sets a
> temporary breakpoint on the next source line, the second runs the
> program until that breakpoint.
Well, OK, so, is there a way to define a single character command that
will do the equivalent of the "tb +1" and "c" commands?
That would help me out a lot, if I could do that.
Dennis Yelle
--
I am a computer programmer and I am looking for a job.
There is a link to my resume here:
http://table.jps.net/~vert/
- Raw text -