aboutsummaryrefslogtreecommitdiff
path: root/src/common/dwarf/bytereader-inl.h
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2023-08-11 00:05:04 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-08-11 00:05:04 +0000
commit4e7c6460d73c00031288165da053692764abbeb1 (patch)
treef98d11d6a158167e19fc9141c79d877280a616a6 /src/common/dwarf/bytereader-inl.h
parent8d0176459cfc11e28e9427a7eadcf7a42f654f62 (diff)
parentc3c25b3748e23f22d7eb5c0cf6ed671259a25aa0 (diff)
downloadgoogle-breakpad-4e7c6460d73c00031288165da053692764abbeb1.tar.gz
Upgrade google-breakpad to v2023.01.27 am: 332a4371ed am: c3c25b3748
Original change: https://android-review.googlesource.com/c/platform/external/google-breakpad/+/2704174 Change-Id: Id4cbd71ede58b445f8d99dbad585207ef2b97bef Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'src/common/dwarf/bytereader-inl.h')
-rw-r--r--src/common/dwarf/bytereader-inl.h37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/common/dwarf/bytereader-inl.h b/src/common/dwarf/bytereader-inl.h
index f4c068a2..21026484 100644
--- a/src/common/dwarf/bytereader-inl.h
+++ b/src/common/dwarf/bytereader-inl.h
@@ -1,4 +1,4 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+// Copyright 2006 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -10,7 +10,7 @@
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
-// * Neither the name of Google Inc. nor the names of its
+// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
@@ -34,13 +34,13 @@
#include <assert.h>
#include <stdint.h>
-namespace dwarf2reader {
+namespace google_breakpad {
-inline uint8_t ByteReader::ReadOneByte(const uint8_t *buffer) const {
+inline uint8_t ByteReader::ReadOneByte(const uint8_t* buffer) const {
return buffer[0];
}
-inline uint16_t ByteReader::ReadTwoBytes(const uint8_t *buffer) const {
+inline uint16_t ByteReader::ReadTwoBytes(const uint8_t* buffer) const {
const uint16_t buffer0 = buffer[0];
const uint16_t buffer1 = buffer[1];
if (endian_ == ENDIANNESS_LITTLE) {
@@ -50,7 +50,18 @@ inline uint16_t ByteReader::ReadTwoBytes(const uint8_t *buffer) const {
}
}
-inline uint64_t ByteReader::ReadFourBytes(const uint8_t *buffer) const {
+inline uint64_t ByteReader::ReadThreeBytes(const uint8_t* buffer) const {
+ const uint32_t buffer0 = buffer[0];
+ const uint32_t buffer1 = buffer[1];
+ const uint32_t buffer2 = buffer[2];
+ if (endian_ == ENDIANNESS_LITTLE) {
+ return buffer0 | buffer1 << 8 | buffer2 << 16;
+ } else {
+ return buffer2 | buffer1 << 8 | buffer0 << 16;
+ }
+}
+
+inline uint64_t ByteReader::ReadFourBytes(const uint8_t* buffer) const {
const uint32_t buffer0 = buffer[0];
const uint32_t buffer1 = buffer[1];
const uint32_t buffer2 = buffer[2];
@@ -62,7 +73,7 @@ inline uint64_t ByteReader::ReadFourBytes(const uint8_t *buffer) const {
}
}
-inline uint64_t ByteReader::ReadEightBytes(const uint8_t *buffer) const {
+inline uint64_t ByteReader::ReadEightBytes(const uint8_t* buffer) const {
const uint64_t buffer0 = buffer[0];
const uint64_t buffer1 = buffer[1];
const uint64_t buffer2 = buffer[2];
@@ -84,7 +95,7 @@ inline uint64_t ByteReader::ReadEightBytes(const uint8_t *buffer) const {
// information, plus one bit saying whether the number continues or
// not.
-inline uint64_t ByteReader::ReadUnsignedLEB128(const uint8_t *buffer,
+inline uint64_t ByteReader::ReadUnsignedLEB128(const uint8_t* buffer,
size_t* len) const {
uint64_t result = 0;
size_t num_read = 0;
@@ -109,7 +120,7 @@ inline uint64_t ByteReader::ReadUnsignedLEB128(const uint8_t *buffer,
// Read a signed LEB128 number. These are like regular LEB128
// numbers, except the last byte may have a sign bit set.
-inline int64_t ByteReader::ReadSignedLEB128(const uint8_t *buffer,
+inline int64_t ByteReader::ReadSignedLEB128(const uint8_t* buffer,
size_t* len) const {
int64_t result = 0;
unsigned int shift = 0;
@@ -129,18 +140,18 @@ inline int64_t ByteReader::ReadSignedLEB128(const uint8_t *buffer,
return result;
}
-inline uint64_t ByteReader::ReadOffset(const uint8_t *buffer) const {
+inline uint64_t ByteReader::ReadOffset(const uint8_t* buffer) const {
assert(this->offset_reader_);
return (this->*offset_reader_)(buffer);
}
-inline uint64_t ByteReader::ReadAddress(const uint8_t *buffer) const {
+inline uint64_t ByteReader::ReadAddress(const uint8_t* buffer) const {
assert(this->address_reader_);
return (this->*address_reader_)(buffer);
}
inline void ByteReader::SetCFIDataBase(uint64_t section_base,
- const uint8_t *buffer_base) {
+ const uint8_t* buffer_base) {
section_base_ = section_base;
buffer_base_ = buffer_base;
have_section_base_ = true;
@@ -165,6 +176,6 @@ inline void ByteReader::ClearFunctionBase() {
have_function_base_ = false;
}
-} // namespace dwarf2reader
+} // namespace google_breakpad
#endif // UTIL_DEBUGINFO_BYTEREADER_INL_H__