Re: [PATCH RFA] gdb.base/finish.exp: Allow finish to stop on call

Fernando Nasser
2001-05-23T17:21:00Z

Kevin Buettner wrote:
>
> On the IA-64, a "finish" won't stop us at the statement after the call
> due to the fact that the "call" instruction isn't the last instruction
> in the call sequence. (The global pointer still needs to be reset.)
> The patch below tweaks the finish_void test to allow for this
> eventuality.
>
> Okay to commit?
>

Nice catch Kevin. Thanks.

Your second pattern needs a small improvement though. As we are
returning to the middle of that source line, the information printed by
GDB will have the address (PC) as well. We must make sure that we test
for that so we can differentiate between returning to the beginning of
the calling line (wrong) and returning to after where the assembler jump
to subroutine was (right). You can test for that without binding to a
specific PC value -- there are several examples around.

After making this change, and testing that it works, of course, you can
commit your patch. Please post the final version for the records.

Thanks again for the fix.

Regards,
Fernando

> * gdb.base/finish.exp (finish_void): Allow "finish" command to
> stop on the call statement as well as the statement after the
> call.
>
> Index: testsuite/gdb.base/finish.exp
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.base/finish.exp,v
> retrieving revision 1.3
> diff -u -p -r1.3 finish.exp
> --- finish.exp 2001/03/06 08:21:50 1.3
> +++ finish.exp 2001/05/19 00:27:32
> @@ -77,8 +77,15 @@ proc finish_void { } {
> gdb_test "continue" "Breakpoint.* void_func.*" \
> "continue to void_func"
> send_gdb "finish\n"
> + # Some architectures will have one or more instructions after the
> + # call instruction which still is part of the call sequence, so we
> + # must be prepared for a "finish" to show us the void_func call
> + # again as well as the statement after.
> gdb_expect {
> -re ".*void_checkpoint.*$gdb_prompt $" {
> + pass "finish from void_func"
> + }
> + -re ".*call to void_func.*$gdb_prompt $" {
> pass "finish from void_func"
> }
> -re ".*$gdb_prompt $" {

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