Fix big-endian register parsing for GDB RSP adapter#1003
Merged
Conversation
When connecting to big-endian targets like PowerPC via QEMU, register values were being incorrectly parsed using little-endian byte order. This caused wrong PC values and prevented proper memory reads. Changes: - Parse <endian> element from target description XML when available - Add IsBigEndianArchitecture() fallback for known BE architectures (PowerPC, SPARC, M68K, S/390) - Add m_isBigEndian member variable to track target endianness - Add parseBigEndianHexToUint512() for reading BE register values - Add uint512ToBigEndianHex() for writing BE register values - Update ReadAllRegisters() and WriteRegister() to use correct endianness based on target Fixes #1000 (partial - the crash fix was in PR #1001, this addresses the endianness issue that remained after the crash was fixed) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…rations Right-justify bytes in the 64-byte buffer before calling intx::be::load, which expects MSB at buffer[0] for a full 512-bit value. Without this, a 4-byte register like PC=0x4082e4c0 was placed at buffer[0..3] and interpreted as the top 32 bits of a 512-bit number. Also add forward declarations for IsBigEndianArchitecture to fix compilation errors (function defined after first use in LoadRegisterInfo). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
<endian>element) with fallback to architecture-based detection (PowerPC, SPARC, m68k, S/390)parseBigEndianHexToUint512to right-justify bytes in the 64-byte buffer beforeintx::be::load, which previously placed a 4-byte register value like0x4082e4c0into the top 32 bits of a 512-bit numberFixes #1002
Test plan
🤖 Generated with Claude Code