Opened 4 months ago
Last modified 7 days ago
#19022 new bug
Debugger displays incorrect disassemblies when using lld
Reported by: | Zardshard | Owned by: | anevilyak |
---|---|---|---|
Priority: | normal | Milestone: | R1/beta6 |
Component: | Applications/Debugger | Version: | R1/Development |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description
The disassemblies of a lot of functions are incorrect when using lld as the linker.
Here, for example, is an incorrect disassembly of a function:
0x000001470368c8b5: 0000 addb %al, (%rax) 0x000001470368c8b7: 007100 addb %dh, (%rcx) 0x000001470368c8ba: 0000 addb %al, (%rax) 0x000001470368c8bc: 0100 addl %eax, (%rax) 0x000001470368c8be: 0000 addb %al, (%rax)
and the correct version (made from taking the instructions in memory and decoding them with udcli
):
000001470368c8b5 55 push rbp 000001470368c8b6 4889e5 mov rbp, rsp 000001470368c8b9 488d0540eeffff lea rax, [rip-0x11c0] 000001470368c8c0 4889c7 mov rdi, rax 000001470368c8c3 e8f8000000 call 0x1470368c9c0 000001470368c8c8 b800000000 mov eax, 0x0 000001470368c8cd 5d pop rbp 000001470368c8ce c3 ret
Reproducing
Take a simple C++ file, such as
#include <OS.h> int main() { debugger(""); }
and compile it with g++ -fuse-ld=lld -g <file>
.
Run it, open Debugger, select the function main
, and switch to the disassembly view.
System information
Haiku x86_64 hrev57966
gcc version 13.3.0_2023_08_10-1
llvm17_lld version 17.0.6-3
Change History (3)
comment:1 by , 7 days ago
comment:2 by , 7 days ago
Milestone: | Unscheduled → R1/beta6 |
---|
comment:3 by , 7 days ago
Could you try adding -gdwarf-3 to the commandline to see if something changes ?
The memory offsets are the same on both counts but the instructions in hex are very different. I wonder what's going on with that?
I guess #19309 may be related to this somehow.