Issue |
135707
|
Summary |
[LLDB] s390x, incorrect byte order issues with `Cast` and `p/x $pc`
|
Labels |
new issue
|
Assignees |
|
Reporter |
patryk4815
|
Version: `lldb 20.1.1`
Reproduction:
```console
qemu-s390x -g 1234 ./hello
```
Other terminal:
```console
(lldb) file ./hello
(lldb) gdb-remote 0:1234
(lldb) b main
Breakpoint 1: where = hello`main, address = 0x0000000001002228
(lldb) c
Process 3281862 resuming
Process 3281862 stopped
* thread #1, stop reason = breakpoint 1.1
frame #0: 0x0000000001002228 hello`main
hello`main:
0x1002228 <+0>: ear %r1, %a0
0x100222c <+4>: sllg %r4, %r1, 32
0x1002232 <+10>: stmg %r6, %r15, 48(%r15)
0x1002238 <+16>: ear %r4, %a1
(lldb) register read pc
pswa = 0x0000000001002228 hello`main
(lldb) p/x $pc
(unsigned long) 0x2822000100000000
(lldb)
```
The bug occurs for all registers, not just the `$pc`
We found out this bug, during implementing s390x support for pwndbg.
```console
In [20]: value = pwndbg.regs.by_name('r14')
In [21]: hex(int(value))
Out[21]: '0x7fb84143554a'
In [22]: hex(int(value.cast(pwndbg.aglib.typeinfo.unsigned)))
Out[22]: '0x4a554341b87f0000'
In [23]: pwndbg.aglib.typeinfo.unsigned.inner
Out[23]: unsigned long long
```
Basically internal lldb `Cast` function mess-up byte-ordering somehow.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs