Comment 15 for bug 2041396

Revision history for this message
Zixing Liu (liushuyu-011) wrote (last edit ):

Verification Report
===================

The test is conducted on an RK3399 device (with 4x ARM Cortex-A53 cores + 2x ARM Cortex-A72 cores).

Test (1) original Rust program test (associated-types.rs)
---------------------------------------------------------

GDB 12.1-0ubuntu1~22.04 (unpatched)
Rust 1.70.0+dfsg0ubuntu1~bpo2-0ubuntu0.22.04.2

Test program source: https://github.com/rust-lang/rust/blob/1.68.2/tests/debuginfo/associated-types.rs

GDB script content:
```
b associated-types.rs:111
r
c
```

Result:

```
Breakpoint 1 at 0x4838: file associated-types.rs, line 111.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".

Breakpoint 1, associated_types::assoc_struct<i32> (arg=...) at associated-types.rs:111
111 zzz(); // #break

Program received signal SIGILL, Illegal instruction.
0x00404ec4 in core::slice::cmp::{impl#5}::equal<u8, u8> (self=..., other=...) at library/core/src/slice/cmp.rs:91
91 library/core/src/slice/cmp.rs: No such file or directory.
```

>>> SRU'ed package:

GDB 12.1-0ubuntu1~22.04.1 (patched)
GCC 11.4.0-1ubuntu1~22.04

Result:
```
Breakpoint 1 at 0x4838: file associated-types.rs, line 111.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".

Breakpoint 1, associated_types::assoc_struct<i32> (arg=...) at associated-types.rs:111
111 zzz(); // #break
[Inferior 1 (process 3621) exited normally]
```

Test (2) simplified C program test (test.c)
-------------------------------------------

GDB 12.1-0ubuntu1~22.04 (unpatched)
GCC 11.4.0-1ubuntu1~22.04

Test program source:
```
__attribute__((target("arm"), noinline))
int thumb_func() {
  return 42;
}

__attribute__((target("thumb")))
int main() { return thumb_func(); }
```

Commands:
```
gcc -Og -ggdb3 test.c -o test
printf "b 3\nr\nc\n" > repro
gdb --batch -x ./repro ./test
```

Result:
```
Breakpoint 1 at 0x4d8: file test.c, line 3.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".

Breakpoint 1, thumb_func () at test.c:3
3 return 42;

Program received signal SIGILL, Illegal instruction.
0x00401004 in ?? ()
```

Disassembly of the crash site (ARM code):

```
=> 0x004004d8 <+0>: mov r0, #42 ; 0x2a
   0x004004dc <+4>: bx lr
```

Disassembly of the call site (Thumb code, +2 bytes):
```
   0x004004e0 <+0>: push {r3, lr}
   0x004004e2 <+2>: blx 0x4004d8 <thumb_func>
=> 0x004004e6 <+6>: pop {r3, pc}
```

>>> SRU'ed package:

GDB 12.1-0ubuntu1~22.04.1 (patched)
GCC 11.4.0-1ubuntu1~22.04

Result:
```
Breakpoint 1 at 0x4d8: file test.c, line 3.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".

Breakpoint 1, thumb_func () at test.c:3
3 return 42;
[Inferior 1 (process 3611) exited with code 052]
```

Conclusion
----------
GDB 12.1-0ubuntu1~22.04.1 package correctly fixed the issue described in the bug report.