Gdb misreading addresses on aarch64eb
Eivind Nicolay Evensen <[email protected]> Sat, 1 Nov 2025 15:19:04 +0100
| Newsgroups | gmane.os.netbsd.ports.arm |
|---|---|
| Message-ID | <[email protected]> |
Hello.
In case somebody wants to know, I just noticed this on:
nbarm64be!ene[~]> uname -srmp
NetBSD 11.99.3 evbarm aarch64eb
nbarm64be!ene[~]> echo "int main(){return(0);}" >a.c
nbarm64be!ene[~]> cc -g a.c
nbarm64be!ene[~]> gdb ./a.out
[... infotext ...]
Reading symbols from ./a.out...
(gdb) b main
Breakpoint 1 at 0x2001008e4: file a.c, line 1.
(gdb) r
Starting program: /home/ene/a.out
Breakpoint 1, main () at a.c:1
1 int main(){return(0);}
(gdb) info reg sp
sp 0xffffffcc2d90 0xffffffcc2d90
(gdb) x/4w 0xffffffcc2d90
0x902dccffffff0000: Cannot access memory at address 0x902dccffffff0000
The address is byteswapped here. As a workaround, the emitted address
will be interpreted as the right one:
(gdb) x/4w 0x902dccffffff0000
0xffffffcc2d90: 0 0 65535 -113112848
(gdb) quit
A debugging session is active.
Inferior 1 [process 4944] will be killed.
Quit anyway? (y or n) y
nbarm64be!ene[~]>
Regards
--
Eivind Nicolay Evensen