Opened 4 weeks ago

#19022 new bug

Debugger displays incorrect disassemblies when using lld

Reported by: Zardshard Owned by: anevilyak
Priority: normal Milestone: Unscheduled
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 (0)

Note: See TracTickets for help on using tickets.