Bug 29432 - [gdb, tdep/s390x/ppc64] Self test failed: self-test failed at arm-tdep.c:14482 (selftest arm-record)
Summary: [gdb, tdep/s390x/ppc64] Self test failed: self-test failed at arm-tdep.c:1448...
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: tdep (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 13.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-30 08:08 UTC by Tom de Vries
Modified: 2022-09-07 17:25 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2022-07-30 08:08:11 UTC
The gdb-fedora-s390x buildbot fails, alternatively with checkout problems and an actual failure.

For an example of the latter, see https://builder.sourceware.org/buildbot/#/builders/75/builds/839 :
...
Ran 3640 unit tests, 1 failed
(gdb) PASS: gdb.gdb/unittest.exp: no executable loaded: maintenance selftest, ran some tests
FAIL: gdb.gdb/unittest.exp: no executable loaded: maintenance selftest, failed none
...

In more detail:
...
Running selftest arm-record.
Process record and replay target doesn't support syscall number -2036195
Process record does not support instruction 0x7f70ee1d at address 0x0.
Self test failed: self-test failed at ../../binutils-gdb/gdb/arm-tdep.c:14482
...

The failure is in the "ret == 0" selftest:
...
    static const uint16_t insns[] = {
      /* 1d ee 70 7f     mrc    15, 0, r7, cr13, cr0, {3} */
      0xee1d, 0x7f70,
    };

    enum bfd_endian endian = gdbarch_byte_order_for_code (arm_record.gdbarch);
    instruction_reader_thumb reader (endian, insns);
    int ret = decode_insn (reader, &arm_record, THUMB2_RECORD,
                           THUMB2_INSN_SIZE_BYTES);

    SELF_CHECK (ret == 0);
    SELF_CHECK (arm_record.mem_rec_count == 0);
    SELF_CHECK (arm_record.reg_rec_count == 1);
    SELF_CHECK (arm_record.arm_regs[0] == 7);
...

Note that the:
...
Process record does not support instruction 0x7f70ee1d at address 0x0.
...
message corresponds to the insns array.  Hm, process record seems to think that it's one insn, while in fact there are two.
Comment 1 Tom de Vries 2022-07-30 09:26:37 UTC
(In reply to Tom de Vries from comment #0)
> Hm, process record seems to think
> that it's one insn, while in fact there are two.

Scrap that.  It's one insn, but:
...
    static const uint16_t insns[] = {
      /* 1d ee 70 7f     mrc    15, 0, r7, cr13, cr0, {3} */
      0xee1d, 0x7f70,
    };
...
written out as two half-words.
Comment 2 Mark Wielaard 2022-07-30 11:29:26 UTC
Same test fails on ppc64 (big endian)

Also see
https://sourceware.org/pipermail/gdb/2022-July/050215.html
and
https://sourceware.org/pipermail/gdb/2022-July/050217.html
Comment 3 Luis Machado 2022-08-03 11:58:28 UTC
This seems to be a problem with the arm instruction test and endianness confusion. I'll try to come up with a fix.
Comment 4 Luis Machado 2022-08-03 11:58:50 UTC
I don't think this has anything to do with ppc64 or s390x.