From: Tom Tromey Date: Wed, 4 Nov 2020 15:21:36 +0000 (-0700) Subject: Rewrite leb.h:read_3_bytes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=93f9561e0fa112bab102dc2c22dd114c84c06a16;p=binutils-gdb.git Rewrite leb.h:read_3_bytes read_3_bytes assumes little-endian data, but in fact it depends on the BFD. This patch rewrites this function to use bfd_get_24 instead. 2020-11-04 Tom Tromey * dwarf2/leb.h (read_3_bytes): Use bfd_get_24. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 373e1527fc7..188bb1e8539 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2020-11-04 Tom Tromey + + * dwarf2/leb.h (read_3_bytes): Use bfd_get_24. + 2020-11-02 Tom Tromey * Makefile.in (ALL_64_TARGET_OBS): Add amd64-ravenscar-thread.o. diff --git a/gdb/dwarf2/leb.h b/gdb/dwarf2/leb.h index f312fc261ee..d76a1f933fc 100644 --- a/gdb/dwarf2/leb.h +++ b/gdb/dwarf2/leb.h @@ -57,14 +57,7 @@ read_2_signed_bytes (bfd *abfd, const gdb_byte *buf) static inline unsigned int read_3_bytes (bfd *abfd, const gdb_byte *buf) { - unsigned int result = 0; - for (int i = 0; i < 3; ++i) - { - unsigned char byte = bfd_get_8 (abfd, buf); - buf++; - result |= ((unsigned int) byte << (i * 8)); - } - return result; + return bfd_get_24 (abfd, buf); } static inline unsigned int