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

Carl Love via Gdb-patches
2023-01-18T22:27:14Z

Tom and Bruno:

On Wed, 2023-01-18 at 11:55 +0100, Tom de Vries wrote:
>
> I've run into regressions due to the first patch:
> ...
> FAIL: gdb.btrace/rn-dl-bind.exp: test: reverse-next
> FAIL: gdb.btrace/tailcall.exp: reverse-next.1
> FAIL: gdb.btrace/tailcall.exp: step.1
> ...

I am looking into these failures. I tried running the rn-dl-bind.exp
test on my PowerPC and X86 box. On both systems, I get the error:

UNSUPPORTED: gdb.btrace/rn-dl-bind.exp: target does not support record-btrace
testcase /../binutils-gdb-finish-precsave/gdb/testsuite/gdb.btrace/rn-dl-bind.exp completed in 0 seconds

I tried compiling the source code and running gdb by hand on my PowerPC
machine. When I try the command record btrace, I get the message: You
can't do that when your target is `multi-thread'. Digging into the GDB
manual I see it says the following about btrace:

Hardware-supported instruction recording, supported on Intel
processors. This method does not record data. Further, the data is
collected in a ring buffer so old data will be overwritten when the
buffer is full. It allows limited reverse execution. Variables and
registers are not available during reverse execution. In remote
debugging, recording continues on disconnect. Recorded data can be
inspected after reconnecting. The recording may be stopped using
record stop.

From this I am assuming you saw the error on and Intel box not a
PowerPC box.

I tried to run the rn-dl-bind.exp test on my X66 box by hand and got
the messages:

Breakpoint 1, main () at rn-dl-bind.c:35
35 ret = test (); /* main.1 */
(gdb) record btrace pt
Intel Processor Trace support was disabled at compile time.
(gdb) record btrace bts
Could not enable branch tracing for Thread 0x7ffff7d85740 (LWP
3087787): BTS support has been disabled for the target cpu.

I found on the web page:

https://gdb-patches.sourceware.narkive.com/Y1ypJmWj/patch-btrace-diagnose-record-bt
race-pt-without-libipt

says record btrace pt neds:

This requires a system with Linux kernel 4.1 or later running on a
5th Generation Intel Core processor or later.

Since I couldn't get the test to run on an IBM machine, I built GDB on
my personal Linux laptop. Initially, I was not able to get the test to
run. The log file had the error message:

(gdb) record btrace
Could not enable branch tracing for process 3941218: You do not have
permission to record the process. Try setting
/proc/sys/kernel/perf_event_paranoid to 2 or less.

I changed /proc/sys/kernel/perf_event_paranoid from 4 to 2. Now the
test runs.

(gdb) PASS: gdb.btrace/rn-dl-bind.exp: test: reverse-next
testcase /home/carll/GDB/binutils-
build/gdb/testsuite/../../../binutils-
gdb/gdb/testsuite/gdb.btrace/rn-dl-bind.exp completed in 0 seconds

=== gdb Summary ===

# of expected passes 9

The test works fine without my patches, with just the X86 patch and
with both the X86 patch and the PPC patch. Unfortunately, I wasn't
able to run the tests on the IBM machine but I can on my personal
laptop. However, I am still not seeing any errors as a result of my
patches.

Not sure what more I can do at this point. If you have some time, can
you take a look at the failures on your machine and let me know what
you are seeing. Maybe we can figure out what is going on.

Perhaps Bruno can also check to see if the two tests were ran on his
machine. If not, hopefully the info above will help Bruno to get the
tests to run on his machine and we can see if they fail there as well.

Thanks for the help with this patch.

Carl