aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2024-07-30 12:28:04 +0100
committerNick Alcock <nick.alcock@oracle.com>2024-07-31 21:10:06 +0100
commit86fd34fde15021bb9157b7da55316c34f8c9fe1d (patch)
tree5cd8d02da9cd1725aa1268e5816e3ffd42f07f88
parent4b04e01284f29a3d0e94fa0e0dd6a11be71c9a65 (diff)
downloadgdb-86fd34fde15021bb9157b7da55316c34f8c9fe1d.zip
gdb-86fd34fde15021bb9157b7da55316c34f8c9fe1d.tar.gz
gdb-86fd34fde15021bb9157b7da55316c34f8c9fe1d.tar.bz2
libctf: fix ctf_archive_count return value on big-endian
This failed to properly byteswap its return value. The ctf_archive format predates the idea of "just write natively and flip on open", and byteswaps all over the place. It's too easy to forget one. The next revision of the archive format (not versioned, so we just tweak the magic number instead) should be native-endianned like the dicts inside it are. libctf/ * ctf-archive.c (ctf_archive_count): Byteswap return value.
-rw-r--r--libctf/ctf-archive.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libctf/ctf-archive.c b/libctf/ctf-archive.c
index 0034bf0..b73999c 100644
--- a/libctf/ctf-archive.c
+++ b/libctf/ctf-archive.c
@@ -785,7 +785,7 @@ ctf_archive_count (const ctf_archive_t *wrapper)
if (!wrapper->ctfi_is_archive)
return 1;
- return wrapper->ctfi_archive->ctfa_ndicts;
+ return le64toh (wrapper->ctfi_archive->ctfa_ndicts);
}
/* Look up a symbol in an archive by name or index (if the name is set, a lookup