aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2020-11-04 08:21:36 -0700
committerTom Tromey <tromey@adacore.com>2020-11-04 08:22:05 -0700
commit93f9561e0fa112bab102dc2c22dd114c84c06a16 (patch)
treef94d27ff133866e178795c6c7cd39ea11b926d5d /gdb/dwarf2
parentad1b5e48d5ddc9e23b31cfee1ba8c0be7d8a2d32 (diff)
downloadgdb-93f9561e0fa112bab102dc2c22dd114c84c06a16.zip
gdb-93f9561e0fa112bab102dc2c22dd114c84c06a16.tar.gz
gdb-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.
Diffstat (limited to 'gdb/dwarf2')
-rw-r--r--gdb/dwarf2/leb.h9
1 files changed, 1 insertions, 8 deletions
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