This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [RFA] Testsuite addition for x86 linux GDB and SIGALRM fix


Andrew Cagney wrote:
> 
> > Michael Snyder wrote:
> >
> >>
> >> I must disagree.  Often, when you reach this line and you
> >> want to step into foo, you will not notice the call to bar
> >> until it is too late and you have stepped into bar.
> >>
> >> When that happens, the only way to reach foo is to "finish" from
> >> bar, and then step again.
> >>
> >
> >
> > As I have explained in this thread (one month ago), the single stepping
> > caused by finish would stop as soon as foo is entered -- exactly the
> > behavior you want.
> 
> I think that would be very counter intuitive.  The primatives are:
> 
>         o       step executes instructions until you
>                 leave the current line
>                 (be it enter a function or reach a new
>                 line)
> 

'step' should never leave you in the same line from where you've issued
it.  That is counter intuitive, even if you had a stop-finish in the
middle.

>         o       finish leaves the current function
>                 (reducing the stack depth by one)

Exactly.  We are talking about a source line with 'foo (bar ())' on it.

The problem (as I said one month ago) is that we do not have a "finishi'
which could perfectly leave the program at the return point, without
concerns of return value handling, source line numbers etc.  But
"finish" is a source level command and source level commands should not
leave you in the middle of source lines.

Once finished the call it was in it should either:
1) stop at the beginning of the next source level instruction -- the one
after the call (remember, it is a source level command)
2) stop after the prolog of a subroutine if there is another call in the
same originating upper level source line.


When the user issues a "step" on 'foo (bar ())' source line, he/she may
want to enter either bar() or foo().  We cannot know that, so we must
stop at each one and he/she can go to the next by issuing "finish",
i.e., "finish _this_ subroutine".  When he/she doesn't want to stop
anymore (i.e., bar() was the one they were interested into), a "next"
can be used.




-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]