Issue 138536
Summary [LLDB] [GDB server] Host byte order incorrectly used for `g`, `G`, `p`, `P` packet types
Labels new issue
Assignees
Reporter whitequark
    The [GDB server protocol specification](https://sourceware.org/gdb/current/onlinedocs/gdb.html/Packets.html#Packets) is very clear on the topic:

> ‘g’
> Read general registers.
> 
> Reply:
> 
> ‘XX…’
> Each byte of register data is described by two hex digits. The bytes with the register are transmitted in **target byte order**. The size of each register and their position within the ‘g’ packet are determined by the target description (see [Target Descriptions](https://sourceware.org/gdb/current/onlinedocs/gdb.html/Target-Descriptions.html#Target-Descriptions)); in the absence of a target description, this is done using code internal to GDB; typically this is some customary register layout for the architecture in question.

However, LLDB incorrectly uses the **debugger host byte order** (which may not be the same as the target byte order):

https://github.com/llvm/llvm-project/blob/f33821628d0e03f5389e1f4339b4d10f6a8883b5/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp#L3566-L3578
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to