RE: [PATCH 2/2 ver2] PowerPC: fix for gdb.reverse/finish-precsave.exp and gdb.reverse/finish-reverse.exp

Carl Love via Gdb-patches
2023-03-20T23:22:20Z

Tom, Luis:

On Sat, 2023-03-18 at 00:05 +0100, Tom de Vries wrote:
> On 3/17/23 18:19, Ulrich Weigand wrote:
> > Carl Love <cel@us.ibm.com> wrote:
> >
> > > I have updated gdb/infrun.c per the comments from Ulrich to
> > > remove
> > > "unnecessary" code and format changes to make the diff as minimal
> > > as I
> > > can. There are no functional changes in these changes.
> > >
> > > The patch has been retested on PowerPC to make sure there are no
> > > regressions.
> > >
> > > Please let me know if this version of this patch (second in the
> > > series)
> > > is acceptable. Thanks.
> >
> > This version is OK.
>
> I'm running into these regressions on x86_64-linux:
> ...
> Running
> /data/vries/gdb/src/gdb/testsuite/gdb.reverse/finish-precsave.exp ...
> FAIL: gdb.reverse/finish-precsave.exp: reverse finish from
> long_long_func
> FAIL: gdb.reverse/finish-precsave.exp: continue to breakpoint:
> long_func
> backward
> FAIL: gdb.reverse/finish-precsave.exp: reverse finish from long_func
> FAIL: gdb.reverse/finish-precsave.exp: continue to breakpoint:
> int_func
> backward
> FAIL: gdb.reverse/finish-precsave.exp: reverse finish from int_func
> FAIL: gdb.reverse/finish-precsave.exp: continue to breakpoint:
> short_func backward
> FAIL: gdb.reverse/finish-precsave.exp: reverse finish from short_func
> FAIL: gdb.reverse/finish-precsave.exp: continue to breakpoint:
> char_func
> backward
> FAIL: gdb.reverse/finish-precsave.exp: reverse finish from char_func
> FAIL: gdb.reverse/finish-precsave.exp: continue to breakpoint:
> void_func
> backward
> FAIL: gdb.reverse/finish-precsave.exp: reverse finish from void_func
> Running /data/vries/gdb/src/gdb/testsuite/gdb.btrace/tailcall.exp ...
> FAIL: gdb.btrace/tailcall.exp: reverse-finish.1
> FAIL: gdb.btrace/tailcall.exp: reverse-step.2
> FAIL: gdb.btrace/tailcall.exp: next.1
> FAIL: gdb.btrace/tailcall.exp: reverse-next.1
> FAIL: gdb.btrace/tailcall.exp: step.1
> FAIL: gdb.btrace/tailcall.exp: finish.2
> FAIL: gdb.btrace/tailcall.exp: reverse-step.3
> FAIL: gdb.btrace/tailcall.exp: finish.3
> Running /data/vries/gdb/src/gdb/testsuite/gdb.mi/mi-reverse.exp ...
> FAIL: gdb.mi/mi-reverse.exp: reverse finish from callme (unknown
> output
> after running)
> FAIL: gdb.mi/mi-reverse.exp: reverse next to get over the call to
> do_nothing (unknown output after running)
> FAIL: gdb.mi/mi-reverse.exp: reverse step to callee1 (unknown output
> after running)
> FAIL: gdb.mi/mi-reverse.exp: reverse step to callee2 (unknown output
> after running)
> FAIL: gdb.mi/mi-reverse.exp: reverse step to callee3 (unknown output
> after running)
> FAIL: gdb.mi/mi-reverse.exp: reverse step to callee4 (unknown output
> after running)
> FAIL: gdb.mi/mi-reverse.exp: reverse-step-instruction at callee4
> (unknown output after running)
> FAIL: gdb.mi/mi-reverse.exp: reverse-next-instruction at callee4
> (unknown output after running)
> FAIL: gdb.mi/mi-reverse.exp: reverse-continue at callee3 (unknown
> output
> after running)
> Running /data/vries/gdb/src/gdb/testsuite/gdb.btrace/step.exp ...
> FAIL: gdb.btrace/step.exp: replay: reverse-finish.1
> FAIL: gdb.btrace/step.exp: replay: reverse-next.2
> FAIL: gdb.btrace/step.exp: replay: reverse-finish.2 (GDB internal
> error)
> Running /data/vries/gdb/src/gdb/testsuite/gdb.reverse/until-
> precsave.exp ...
> FAIL: gdb.reverse/until-precsave.exp: reverse-finish from marker2
> FAIL: gdb.reverse/until-precsave.exp: reverse-advance to final return
> of
> factorial
> FAIL: gdb.reverse/until-precsave.exp: reverse-until to entry of
> factorial
> Running /data/vries/gdb/src/gdb/testsuite/gdb.reverse/finish-
> reverse.exp ...
> FAIL: gdb.reverse/finish-reverse.exp: reverse finish from
> long_long_func
> FAIL: gdb.reverse/finish-reverse.exp: continue to breakpoint:
> long_func
> backward
> FAIL: gdb.reverse/finish-reverse.exp: reverse finish from long_func
> FAIL: gdb.reverse/finish-reverse.exp: continue to breakpoint:
> int_func
> backward
> FAIL: gdb.reverse/finish-reverse.exp: reverse finish from int_func
> FAIL: gdb.reverse/finish-reverse.exp: continue to breakpoint:
> short_func
> backward
> FAIL: gdb.reverse/finish-reverse.exp: reverse finish from short_func
> FAIL: gdb.reverse/finish-reverse.exp: continue to breakpoint:
> char_func
> backward
> FAIL: gdb.reverse/finish-reverse.exp: reverse finish from char_func
> FAIL: gdb.reverse/finish-reverse.exp: continue to breakpoint:
> void_func
> backward
> FAIL: gdb.reverse/finish-reverse.exp: reverse finish from void_func
> Running
> /data/vries/gdb/src/gdb/testsuite/gdb.reverse/finish-reverse-next.exp
> ...
> FAIL: gdb.reverse/finish-reverse-next.exp: reverse-finish function1
> LEP
> call from LEP
> FAIL: gdb.reverse/finish-reverse-next.exp: reverse next 1 LEP entry
> point function call from LEP
> FAIL: gdb.reverse/finish-reverse-next.exp: reverse next 2, at b = 5,
> call from LEP
> FAIL: gdb.reverse/finish-reverse-next.exp: reverse-finish function1
> LEP
> call from function body
> FAIL: gdb.reverse/finish-reverse-next.exp: reverse next 1 LEP from
> function body
> FAIL: gdb.reverse/finish-reverse-next.exp: reverse next 2 at b = 5,
> from
> function body
> FAIL: gdb.reverse/finish-reverse-next.exp: function1 GEP call call
> from GEP
> FAIL: gdb.reverse/finish-reverse-next.exp: reverse next 1 GEP entry
> point function call from GEP
> FAIL: gdb.reverse/finish-reverse-next.exp: reverse next 2 at b = 50,
> call from GEP
> FAIL: gdb.reverse/finish-reverse-next.exp: function1 GEP call call
> from
> GEP again
> FAIL: gdb.reverse/finish-reverse-next.exp: reverse next 1 GEP entry
> point function call from GEP again
> FAIL: gdb.reverse/finish-reverse-next.exp: reverse next 2 at b = 50,
> call from GEP again
> FAIL: gdb.reverse/finish-reverse-next.exp: reverse-finish function1
> GEP
> call, from function body
> FAIL: gdb.reverse/finish-reverse-next.exp: reverse next 1 GEP call
> from
> function body
> FAIL: gdb.reverse/finish-reverse-next.exp: reverse next 2 at b = 50
> from
> function body
> Running /data/vries/gdb/src/gdb/testsuite/gdb.btrace/tailcall-
> only.exp ...
> FAIL: gdb.btrace/tailcall-only.exp: reverse-step
> FAIL: gdb.btrace/tailcall-only.exp: up

I believe I have found the issue. Somewhere along the line, probably
in the code cleanup, the initialization of the new variables in
gdb/infcmd.c got out of order. Basically, alt_entry_point and
entry_point are initialized to sal.pc. However, sal has been declared
but not initialized so alt_entry_point and entry_point are always equal
to zero. That doesn't work so well. The fix is simple, just need to
move the initialization of the two variables after sal has been
initialized.

I am still running some tests to make sure everything is OK. But so
far it looks like the fix works on PowerPC and on one of the X86 boxes
I am testing on. I am double checking the results on the other X86
box. I hope to post a fix soon.

This should fix the errors on X86 and Arm.

Sorry for the regression.

Carl