diff options
author | Tom Tromey <tromey@adacore.com> | 2020-11-04 08:21:36 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-11-04 08:22:05 -0700 |
commit | 93f9561e0fa112bab102dc2c22dd114c84c06a16 (patch) | |
tree | f94d27ff133866e178795c6c7cd39ea11b926d5d | |
parent | ad1b5e48d5ddc9e23b31cfee1ba8c0be7d8a2d32 (diff) | |
download | binutils-93f9561e0fa112bab102dc2c22dd114c84c06a16.zip binutils-93f9561e0fa112bab102dc2c22dd114c84c06a16.tar.gz binutils-93f9561e0fa112bab102dc2c22dd114c84c06a16.tar.bz2 |
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 <tromey@adacore.com>
* dwarf2/leb.h (read_3_bytes): Use bfd_get_24.
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/dwarf2/leb.h | 9 |
2 files changed, 5 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 373e152..188bb1e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2020-11-04 Tom Tromey <tromey@adacore.com> + + * dwarf2/leb.h (read_3_bytes): Use bfd_get_24. + 2020-11-02 Tom Tromey <tromey@adacore.com> * Makefile.in (ALL_64_TARGET_OBS): Add amd64-ravenscar-thread.o. diff --git a/gdb/dwarf2/leb.h b/gdb/dwarf2/leb.h index f312fc2..d76a1f9 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 |