[0/2] fix for gdb.reverse/finish-precsave.exp and gdb.reverse/finish-reverse.exp

Message ID 78f3d00844cc59549c79885a59fee4161bf021ba.camel@us.ibm.com
Series fix for gdb.reverse/finish-precsave.exp and gdb.reverse/finish-reverse.exp |


Carl Love Jan. 11, 2023, 6:27 p.m. UTC
  GDB maintainers:

This patch set fixes a couple of issues with the gdb.reverse tests
finish-precsave.exp and finish-reverse.exp.

The first issue is when doing a reverse-finish command from a function,
gdb should stop at the first instruction of the source code line where
the call was made.  The behavior should look the same as doing a
reverse-next from the first line of the function.  Currently gdb stops
at the last instruction in the caller source code line.  Issuing
reverse-step or reverse-next stops at the first instruction in the same
source code line.  It then requires a second reverse step or next
command to reach the previous source code line in the caller.  It
should only require one reverse step or next command to reach the
previous line.

The first patch in this series fixes the above issue on X86.  A number
of additional testcases require updating since the output is slightly
different or the test case no longer needs to issue the two reverse
step/next instructions.  The step_until proceedure in test
gdb.reverse/step-indirect-call-thunk.exp was moved to lib/gdb.exp and
renamed cmd_until.  The proceedure is used to test the reverse-finish
command when returning from the entry point of the function.

The second issue with the reverse-finish command is that on PowerPC the
reverse-finish doesn't stop at the function call.  The issue is PowerPC
uses two entry points.  PowerPC calls the two entry points the local
entry point (LEP) and the global entry point (GEP).  The LEP is
normally used when calling a function.  The GEP is used when the table
of contents (TOC) needs to be setup before continuing execution at the
LEP.  GDB is not handling the two entry points correctly.  The second
patch fixes the reverse-finish behavior on PowerPC.  On systems that
don't use two entry points the LEP and the GEP are the same.

A new testcase is added to verify the reverse-finish command works
correctly for X86 when returning from the body of a function and from
the entry point.  Note, the finish_backward function must handle the
two scenarios slightly differently.

The new testcase is expanded in the PPC patch to add tests for the two
scenarios for a function called via the GEP.  The initial set of tests
added in the X86 patch take care of the function being called via the
LEP on PowerPC.

The patches have been tested on PowerPC and X86 with no new

Please let me know if the patches are acceptable for mainline.  Thanks.