aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/android/testing/pthread_fixes.h2
-rw-r--r--src/common/byte_cursor.h49
-rw-r--r--src/common/byte_cursor_unittest.cc12
-rw-r--r--src/common/dwarf/bytereader-inl.h18
-rw-r--r--src/common/dwarf/bytereader.cc8
-rw-r--r--src/common/dwarf/bytereader.h28
-rw-r--r--src/common/dwarf/bytereader_unittest.cc2
-rw-r--r--src/common/dwarf/cfi_assembler.cc12
-rw-r--r--src/common/dwarf/cfi_assembler.h44
-rw-r--r--src/common/dwarf/dwarf2diehandler.cc22
-rw-r--r--src/common/dwarf/dwarf2diehandler.h14
-rw-r--r--src/common/dwarf/dwarf2diehandler_unittest.cc10
-rw-r--r--src/common/dwarf/dwarf2reader.cc284
-rw-r--r--src/common/dwarf/dwarf2reader.h88
-rw-r--r--src/common/dwarf/dwarf2reader_cfi_unittest.cc52
-rw-r--r--src/common/dwarf/dwarf2reader_die_unittest.cc14
-rw-r--r--src/common/dwarf/dwarf2reader_test_common.h12
-rw-r--r--src/common/dwarf/elf_reader.cc150
-rw-r--r--src/common/dwarf/elf_reader.h36
-rw-r--r--src/common/dwarf/functioninfo.cc2
-rw-r--r--src/common/dwarf_cfi_to_module.cc12
-rw-r--r--src/common/dwarf_cfi_to_module.h28
-rw-r--r--src/common/dwarf_cfi_to_module_unittest.cc8
-rw-r--r--src/common/dwarf_cu_to_module.cc118
-rw-r--r--src/common/dwarf_cu_to_module.h36
-rw-r--r--src/common/dwarf_cu_to_module_unittest.cc170
-rw-r--r--src/common/dwarf_line_to_module.cc12
-rw-r--r--src/common/dwarf_line_to_module.h10
-rw-r--r--src/common/dwarf_line_to_module_unittest.cc8
-rw-r--r--src/common/dwarf_range_list_handler.cc2
-rw-r--r--src/common/dwarf_range_list_handler.h4
-rw-r--r--src/common/language.cc22
-rw-r--r--src/common/language.h4
-rw-r--r--src/common/linux/breakpad_getcontext.S4
-rw-r--r--src/common/linux/dump_symbols.cc44
-rw-r--r--src/common/linux/dump_symbols.h10
-rw-r--r--src/common/linux/elf_symbols_to_module.cc20
-rw-r--r--src/common/linux/elf_symbols_to_module.h6
-rw-r--r--src/common/linux/elf_symbols_to_module_unittest.cc2
-rw-r--r--src/common/linux/elfutils.cc22
-rw-r--r--src/common/linux/elfutils.h8
-rw-r--r--src/common/linux/file_id.cc6
-rw-r--r--src/common/linux/file_id_unittest.cc4
-rw-r--r--src/common/linux/guid_creator.cc8
-rw-r--r--src/common/linux/http_upload.cc56
-rw-r--r--src/common/linux/http_upload.h24
-rw-r--r--src/common/linux/libcurl_wrapper.cc10
-rw-r--r--src/common/linux/libcurl_wrapper.h26
-rw-r--r--src/common/linux/linux_libc_support.cc2
-rw-r--r--src/common/linux/symbol_upload.cc10
-rw-r--r--src/common/linux/synth_elf.cc4
-rw-r--r--src/common/linux/synth_elf.h4
-rw-r--r--src/common/linux/synth_elf_unittest.cc4
-rw-r--r--src/common/linux/tests/crash_generator.cc2
-rw-r--r--src/common/mac/MachIPC.h20
-rw-r--r--src/common/mac/MachIPC.mm26
-rw-r--r--src/common/mac/dump_syms.cc70
-rw-r--r--src/common/mac/dump_syms.h24
-rw-r--r--src/common/mac/macho_id.cc32
-rw-r--r--src/common/mac/macho_id.h28
-rw-r--r--src/common/mac/macho_reader.cc38
-rw-r--r--src/common/mac/macho_reader.h46
-rw-r--r--src/common/mac/macho_reader_unittest.cc86
-rw-r--r--src/common/mac/macho_walker.cc20
-rw-r--r--src/common/mac/macho_walker.h26
-rw-r--r--src/common/mac/string_utilities.cc4
-rw-r--r--src/common/mac/string_utilities.h2
-rw-r--r--src/common/mac/super_fat_arch.h2
-rw-r--r--src/common/md5.cc14
-rw-r--r--src/common/memory_allocator.h22
-rw-r--r--src/common/memory_allocator_unittest.cc6
-rw-r--r--src/common/module.cc56
-rw-r--r--src/common/module.h60
-rw-r--r--src/common/module_unittest.cc2
-rw-r--r--src/common/solaris/dump_symbols.cc149
-rw-r--r--src/common/solaris/dump_symbols.h2
-rw-r--r--src/common/solaris/file_id.cc36
-rw-r--r--src/common/solaris/guid_creator.cc4
-rw-r--r--src/common/stabs_reader.cc26
-rw-r--r--src/common/stabs_reader.h36
-rw-r--r--src/common/stabs_reader_unittest.cc36
-rw-r--r--src/common/stabs_to_module.cc10
-rw-r--r--src/common/stabs_to_module.h6
-rw-r--r--src/common/stabs_to_module_unittest.cc10
-rw-r--r--src/common/string_conversion.cc58
-rw-r--r--src/common/string_conversion.h8
-rw-r--r--src/common/test_assembler.cc48
-rw-r--r--src/common/test_assembler.h70
-rw-r--r--src/common/test_assembler_unittest.cc8
-rw-r--r--src/common/windows/http_upload.cc22
-rw-r--r--src/common/windows/http_upload.h4
-rw-r--r--src/common/windows/omap.cc8
-rw-r--r--src/common/windows/pdb_source_line_writer.cc48
-rw-r--r--src/common/windows/pdb_source_line_writer.h10
-rw-r--r--src/common/windows/pe_util.cc4
-rw-r--r--src/common/windows/string_utils-inl.h22
-rw-r--r--src/common/windows/string_utils.cc6
97 files changed, 1391 insertions, 1393 deletions
diff --git a/src/common/android/testing/pthread_fixes.h b/src/common/android/testing/pthread_fixes.h
index 20c12084..b0a3d82e 100644
--- a/src/common/android/testing/pthread_fixes.h
+++ b/src/common/android/testing/pthread_fixes.h
@@ -80,7 +80,7 @@ int pthread_barrier_wait(pthread_barrier_t* barrier) {
return 0;
}
-int pthread_barrier_destroy(pthread_barrier_t *barrier) {
+int pthread_barrier_destroy(pthread_barrier_t* barrier) {
barrier->count = 0;
pthread_cond_destroy(&barrier->cond);
pthread_mutex_destroy(&barrier->mutex);
diff --git a/src/common/byte_cursor.h b/src/common/byte_cursor.h
index accd54e0..28bb8e76 100644
--- a/src/common/byte_cursor.h
+++ b/src/common/byte_cursor.h
@@ -52,16 +52,16 @@ namespace google_breakpad {
// A buffer holding a series of bytes.
struct ByteBuffer {
ByteBuffer() : start(0), end(0) { }
- ByteBuffer(const uint8_t *set_start, size_t set_size)
+ ByteBuffer(const uint8_t* set_start, size_t set_size)
: start(set_start), end(set_start + set_size) { }
~ByteBuffer() { };
// Equality operators. Useful in unit tests, and when we're using
// ByteBuffers to refer to regions of a larger buffer.
- bool operator==(const ByteBuffer &that) const {
+ bool operator==(const ByteBuffer& that) const {
return start == that.start && end == that.end;
}
- bool operator!=(const ByteBuffer &that) const {
+ bool operator!=(const ByteBuffer& that) const {
return start != that.start || end != that.end;
}
@@ -71,7 +71,8 @@ struct ByteBuffer {
return end - start;
}
- const uint8_t *start, *end;
+ const uint8_t* start;
+ const uint8_t* end;
};
// A cursor pointing into a ByteBuffer that can parse numbers of various
@@ -82,8 +83,8 @@ class ByteCursor {
public:
// Create a cursor reading bytes from the start of BUFFER. By default, the
// cursor reads multi-byte values in little-endian form.
- ByteCursor(const ByteBuffer *buffer, bool big_endian = false)
- : buffer_(buffer), here_(buffer->start),
+ ByteCursor(const ByteBuffer* buffer, bool big_endian = false)
+ : buffer_(buffer), here_(buffer->start),
big_endian_(big_endian), complete_(true) { }
// Accessor and setter for this cursor's endianness flag.
@@ -92,8 +93,8 @@ class ByteCursor {
// Accessor and setter for this cursor's current position. The setter
// returns a reference to this cursor.
- const uint8_t *here() const { return here_; }
- ByteCursor &set_here(const uint8_t *here) {
+ const uint8_t* here() const { return here_; }
+ ByteCursor& set_here(const uint8_t* here) {
assert(buffer_->start <= here && here <= buffer_->end);
here_ = here;
return *this;
@@ -116,7 +117,7 @@ class ByteCursor {
// this cursor's complete_ flag, and store a dummy value in *RESULT.
// Return a reference to this cursor.
template<typename T>
- ByteCursor &Read(size_t size, bool is_signed, T *result) {
+ ByteCursor& Read(size_t size, bool is_signed, T* result) {
if (CheckAvailable(size)) {
T v = 0;
if (big_endian_) {
@@ -145,7 +146,7 @@ class ByteCursor {
// read off the end of our buffer, clear this cursor's complete_ flag.
// Return a reference to this cursor.
template<typename T>
- ByteCursor &operator>>(T &result) {
+ ByteCursor& operator>>(T& result) {
bool T_is_signed = (T)-1 < 0;
return Read(sizeof(T), T_is_signed, &result);
}
@@ -154,7 +155,7 @@ class ByteCursor {
// cursor to the end of them. If we read off the end of our buffer,
// clear this cursor's complete_ flag, and set *POINTER to NULL.
// Return a reference to this cursor.
- ByteCursor &Read(uint8_t *buffer, size_t size) {
+ ByteCursor& Read(uint8_t* buffer, size_t size) {
if (CheckAvailable(size)) {
memcpy(buffer, here_, size);
here_ += size;
@@ -166,11 +167,11 @@ class ByteCursor {
// byte buffer does not contain a terminating zero, clear this cursor's
// complete_ flag, and set STR to the empty string. Return a reference to
// this cursor.
- ByteCursor &CString(string *str) {
- const uint8_t *end
- = static_cast<const uint8_t *>(memchr(here_, '\0', Available()));
+ ByteCursor& CString(string* str) {
+ const uint8_t* end
+ = static_cast<const uint8_t*>(memchr(here_, '\0', Available()));
if (end) {
- str->assign(reinterpret_cast<const char *>(here_), end - here_);
+ str->assign(reinterpret_cast<const char*>(here_), end - here_);
here_ = end + 1;
} else {
str->clear();
@@ -193,14 +194,14 @@ class ByteCursor {
//
// - Otherwise, set *STR to a copy of those LIMIT bytes, and advance the
// cursor by LIMIT bytes.
- ByteCursor &CString(string *str, size_t limit) {
+ ByteCursor& CString(string* str, size_t limit) {
if (CheckAvailable(limit)) {
- const uint8_t *end
- = static_cast<const uint8_t *>(memchr(here_, '\0', limit));
+ const uint8_t* end
+ = static_cast<const uint8_t*>(memchr(here_, '\0', limit));
if (end)
- str->assign(reinterpret_cast<const char *>(here_), end - here_);
+ str->assign(reinterpret_cast<const char*>(here_), end - here_);
else
- str->assign(reinterpret_cast<const char *>(here_), limit);
+ str->assign(reinterpret_cast<const char*>(here_), limit);
here_ += limit;
} else {
str->clear();
@@ -213,7 +214,7 @@ class ByteCursor {
// cursor. If we read off the end of our buffer, clear this cursor's
// complete_ flag, and set *POINTER to NULL. Return a reference to this
// cursor.
- ByteCursor &PointTo(const uint8_t **pointer, size_t size = 0) {
+ ByteCursor& PointTo(const uint8_t** pointer, size_t size = 0) {
if (CheckAvailable(size)) {
*pointer = here_;
here_ += size;
@@ -226,7 +227,7 @@ class ByteCursor {
// Skip SIZE bytes at the cursor. If doing so would advance us off
// the end of our buffer, clear this cursor's complete_ flag, and
// set *POINTER to NULL. Return a reference to this cursor.
- ByteCursor &Skip(size_t size) {
+ ByteCursor& Skip(size_t size) {
if (CheckAvailable(size))
here_ += size;
return *this;
@@ -247,10 +248,10 @@ class ByteCursor {
}
// The buffer we're reading bytes from.
- const ByteBuffer *buffer_;
+ const ByteBuffer* buffer_;
// The next byte within buffer_ that we'll read.
- const uint8_t *here_;
+ const uint8_t* here_;
// True if we should read numbers in big-endian form; false if we
// should read in little-endian form.
diff --git a/src/common/byte_cursor_unittest.cc b/src/common/byte_cursor_unittest.cc
index 06bfd89d..45e6f2b4 100644
--- a/src/common/byte_cursor_unittest.cc
+++ b/src/common/byte_cursor_unittest.cc
@@ -593,7 +593,7 @@ TEST(Extractor, Signed4) {
int32_t a;
// For some reason, G++ 4.4.1 complains:
// warning: array subscript is above array bounds
- // in ByteCursor::Read(size_t, bool, T *) as it inlines this call, but
+ // in ByteCursor::Read(size_t, bool, T*) as it inlines this call, but
// I'm not able to see how such a reference would occur.
EXPECT_TRUE(cursor >> a);
EXPECT_EQ(-380377902, a);
@@ -627,7 +627,7 @@ TEST(Extractor, Unsigned4) {
uint32_t a;
// For some reason, G++ 4.4.1 complains:
// warning: array subscript is above array bounds
- // in ByteCursor::Read(size_t, bool, T *) as it inlines this call, but
+ // in ByteCursor::Read(size_t, bool, T*) as it inlines this call, but
// I'm not able to see how such a reference would occur.
EXPECT_TRUE(cursor >> a);
EXPECT_EQ(0xe953e4d2, a);
@@ -718,10 +718,10 @@ TEST(Strings, PointTo) {
ByteBuffer buffer(data, sizeof(data));
ByteCursor cursor(&buffer);
- const uint8_t *received1;
- const uint8_t *received2;
- const uint8_t *received3;
- const uint8_t *received4;
+ const uint8_t* received1;
+ const uint8_t* received2;
+ const uint8_t* received3;
+ const uint8_t* received4;
EXPECT_FALSE(cursor
.PointTo(&received1, 3)
.PointTo(&received2, 3)
diff --git a/src/common/dwarf/bytereader-inl.h b/src/common/dwarf/bytereader-inl.h
index 235d75ee..448be237 100644
--- a/src/common/dwarf/bytereader-inl.h
+++ b/src/common/dwarf/bytereader-inl.h
@@ -36,11 +36,11 @@
namespace dwarf2reader {
-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) {
@@ -61,7 +61,7 @@ inline uint64_t ByteReader::ReadThreeBytes(const uint8_t* buffer) const {
}
}
-inline uint64_t ByteReader::ReadFourBytes(const uint8_t *buffer) const {
+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];
@@ -73,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];
@@ -95,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;
@@ -120,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;
@@ -140,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;
diff --git a/src/common/dwarf/bytereader.cc b/src/common/dwarf/bytereader.cc
index 0b27dd58..ac5064a7 100644
--- a/src/common/dwarf/bytereader.cc
+++ b/src/common/dwarf/bytereader.cc
@@ -63,7 +63,7 @@ void ByteReader::SetAddressSize(uint8_t size) {
}
}
-uint64_t ByteReader::ReadInitialLength(const uint8_t *start, size_t* len) {
+uint64_t ByteReader::ReadInitialLength(const uint8_t* start, size_t* len) {
const uint64_t initial_length = ReadFourBytes(start);
start += 4;
@@ -101,9 +101,9 @@ bool ByteReader::UsableEncoding(DwarfPointerEncoding encoding) const {
}
}
-uint64_t ByteReader::ReadEncodedPointer(const uint8_t *buffer,
+uint64_t ByteReader::ReadEncodedPointer(const uint8_t* buffer,
DwarfPointerEncoding encoding,
- size_t *len) const {
+ size_t* len) const {
// UsableEncoding doesn't approve of DW_EH_PE_omit, so we shouldn't
// see it here.
assert(encoding != DW_EH_PE_omit);
@@ -130,7 +130,7 @@ uint64_t ByteReader::ReadEncodedPointer(const uint8_t *buffer,
// Round up to the next boundary.
uint64_t aligned = (offset + AddressSize() - 1) & -AddressSize();
// Convert back to a pointer.
- const uint8_t *aligned_buffer = buffer_base_ + (aligned - skew);
+ const uint8_t* aligned_buffer = buffer_base_ + (aligned - skew);
// Finally, store the length and actually fetch the pointer.
*len = aligned_buffer - buffer + AddressSize();
return ReadAddress(aligned_buffer);
diff --git a/src/common/dwarf/bytereader.h b/src/common/dwarf/bytereader.h
index d0c3b964..5d7a9a7f 100644
--- a/src/common/dwarf/bytereader.h
+++ b/src/common/dwarf/bytereader.h
@@ -62,11 +62,11 @@ class ByteReader {
// Read a single byte from BUFFER and return it as an unsigned 8 bit
// number.
- uint8_t ReadOneByte(const uint8_t *buffer) const;
+ uint8_t ReadOneByte(const uint8_t* buffer) const;
// Read two bytes from BUFFER and return them as an unsigned 16 bit
// number, using this ByteReader's endianness.
- uint16_t ReadTwoBytes(const uint8_t *buffer) const;
+ uint16_t ReadTwoBytes(const uint8_t* buffer) const;
// Read three bytes from BUFFER and return them as an unsigned 64 bit
// number, using this ByteReader's endianness. DWARF 5 uses this encoding
@@ -78,11 +78,11 @@ class ByteReader {
// a uint64_t so that it is compatible with ReadAddress and
// ReadOffset. The number it returns will never be outside the range
// of an unsigned 32 bit integer.
- uint64_t ReadFourBytes(const uint8_t *buffer) const;
+ uint64_t ReadFourBytes(const uint8_t* buffer) const;
// Read eight bytes from BUFFER and return them as an unsigned 64
// bit number, using this ByteReader's endianness.
- uint64_t ReadEightBytes(const uint8_t *buffer) const;
+ uint64_t ReadEightBytes(const uint8_t* buffer) const;
// Read an unsigned LEB128 (Little Endian Base 128) number from
// BUFFER and return it as an unsigned 64 bit integer. Set LEN to
@@ -101,7 +101,7 @@ class ByteReader {
// In other words, we break VALUE into groups of seven bits, put
// them in little-endian order, and then write them as eight-bit
// bytes with the high bit on all but the last.
- uint64_t ReadUnsignedLEB128(const uint8_t *buffer, size_t *len) const;
+ uint64_t ReadUnsignedLEB128(const uint8_t* buffer, size_t* len) const;
// Read a signed LEB128 number from BUFFER and return it as an
// signed 64 bit integer. Set LEN to the number of bytes read.
@@ -120,7 +120,7 @@ class ByteReader {
// In other words, we break VALUE into groups of seven bits, put
// them in little-endian order, and then write them as eight-bit
// bytes with the high bit on all but the last.
- int64_t ReadSignedLEB128(const uint8_t *buffer, size_t *len) const;
+ int64_t ReadSignedLEB128(const uint8_t* buffer, size_t* len) const;
// Indicate that addresses on this architecture are SIZE bytes long. SIZE
// must be either 4 or 8. (DWARF allows addresses to be any number of
@@ -143,7 +143,7 @@ class ByteReader {
// Read an address from BUFFER and return it as an unsigned 64 bit
// integer, respecting this ByteReader's endianness and address size. You
// must call SetAddressSize before calling this function.
- uint64_t ReadAddress(const uint8_t *buffer) const;
+ uint64_t ReadAddress(const uint8_t* buffer) const;
// DWARF actually defines two slightly different formats: 32-bit DWARF
// and 64-bit DWARF. This is *not* related to the size of registers or
@@ -180,14 +180,14 @@ class ByteReader {
// - The 32-bit value 0xffffffff, followed by a 64-bit byte count,
// indicating that the data whose length is being measured uses
// the 64-bit DWARF format.
- uint64_t ReadInitialLength(const uint8_t *start, size_t *len);
+ uint64_t ReadInitialLength(const uint8_t* start, size_t* len);
// Read an offset from BUFFER and return it as an unsigned 64 bit
// integer, respecting the ByteReader's endianness. In 32-bit DWARF, the
// offset is 4 bytes long; in 64-bit DWARF, the offset is eight bytes
// long. You must call ReadInitialLength or SetOffsetSize before calling
// this function; see the comments above for details.
- uint64_t ReadOffset(const uint8_t *buffer) const;
+ uint64_t ReadOffset(const uint8_t* buffer) const;
// Return the current offset size, in bytes.
// A return value of 4 indicates that we are reading 32-bit DWARF.
@@ -242,7 +242,7 @@ class ByteReader {
// is BUFFER_BASE. This allows us to find the address that a given
// byte in our buffer would have when loaded into the program the
// data describes. We need this to resolve DW_EH_PE_pcrel pointers.
- void SetCFIDataBase(uint64_t section_base, const uint8_t *buffer_base);
+ void SetCFIDataBase(uint64_t section_base, const uint8_t* buffer_base);
// Indicate that the base address of the program's ".text" section
// is TEXT_BASE. We need this to resolve DW_EH_PE_textrel pointers.
@@ -281,15 +281,15 @@ class ByteReader {
// base address this reader hasn't been given, so you should check
// with ValidEncoding and UsableEncoding first if you would rather
// die in a more helpful way.
- uint64_t ReadEncodedPointer(const uint8_t *buffer,
+ uint64_t ReadEncodedPointer(const uint8_t* buffer,
DwarfPointerEncoding encoding,
- size_t *len) const;
+ size_t* len) const;
Endianness GetEndianness() const;
private:
// Function pointer type for our address and offset readers.
- typedef uint64_t (ByteReader::*AddressReader)(const uint8_t *) const;
+ typedef uint64_t (ByteReader::*AddressReader)(const uint8_t*) const;
// Read an offset from BUFFER and return it as an unsigned 64 bit
// integer. DWARF2/3 define offsets as either 4 or 8 bytes,
@@ -312,7 +312,7 @@ class ByteReader {
bool have_section_base_, have_text_base_, have_data_base_;
bool have_function_base_;
uint64_t section_base_, text_base_, data_base_, function_base_;
- const uint8_t *buffer_base_;
+ const uint8_t* buffer_base_;
};
} // namespace dwarf2reader
diff --git a/src/common/dwarf/bytereader_unittest.cc b/src/common/dwarf/bytereader_unittest.cc
index e66062d1..3d7924b9 100644
--- a/src/common/dwarf/bytereader_unittest.cc
+++ b/src/common/dwarf/bytereader_unittest.cc
@@ -73,7 +73,7 @@ TEST_F(Reader, SimpleConstructor) {
.LEB128(-0x4f337badf4483f83LL)
.D32(0xfec319c9);
ASSERT_TRUE(section.GetContents(&contents));
- const uint8_t *data = reinterpret_cast<const uint8_t *>(contents.data());
+ const uint8_t* data = reinterpret_cast<const uint8_t*>(contents.data());
EXPECT_EQ(0xc0U, reader.ReadOneByte(data));
EXPECT_EQ(0xcf0dU, reader.ReadTwoBytes(data + 1));
EXPECT_EQ(0x96fdd219U, reader.ReadFourBytes(data + 3));
diff --git a/src/common/dwarf/cfi_assembler.cc b/src/common/dwarf/cfi_assembler.cc
index 2dc22085..858fd561 100644
--- a/src/common/dwarf/cfi_assembler.cc
+++ b/src/common/dwarf/cfi_assembler.cc
@@ -41,11 +41,11 @@ namespace google_breakpad {
using dwarf2reader::DwarfPointerEncoding;
-CFISection &CFISection::CIEHeader(uint64_t code_alignment_factor,
+CFISection& CFISection::CIEHeader(uint64_t code_alignment_factor,
int data_alignment_factor,
unsigned return_address_register,
uint8_t version,
- const string &augmentation,
+ const string& augmentation,
bool dwarf64,
uint8_t address_size,
uint8_t segment_size) {
@@ -78,7 +78,7 @@ CFISection &CFISection::CIEHeader(uint64_t code_alignment_factor,
return *this;
}
-CFISection &CFISection::FDEHeader(Label cie_pointer,
+CFISection& CFISection::FDEHeader(Label cie_pointer,
uint64_t initial_location,
uint64_t address_range,
bool dwarf64) {
@@ -113,7 +113,7 @@ CFISection &CFISection::FDEHeader(Label cie_pointer,
return *this;
}
-CFISection &CFISection::FinishEntry() {
+CFISection& CFISection::FinishEntry() {
assert(entry_length_);
Align(address_size_, dwarf2reader::DW_CFA_nop);
entry_length_->length = Here() - entry_length_->start;
@@ -123,9 +123,9 @@ CFISection &CFISection::FinishEntry() {
return *this;
}
-CFISection &CFISection::EncodedPointer(uint64_t address,
+CFISection& CFISection::EncodedPointer(uint64_t address,
DwarfPointerEncoding encoding,
- const EncodedPointerBases &bases) {
+ const EncodedPointerBases& bases) {
// Omitted data is extremely easy to emit.
if (encoding == dwarf2reader::DW_EH_PE_omit)
return *this;
diff --git a/src/common/dwarf/cfi_assembler.h b/src/common/dwarf/cfi_assembler.h
index bd7354d1..d60ecc9e 100644
--- a/src/common/dwarf/cfi_assembler.h
+++ b/src/common/dwarf/cfi_assembler.h
@@ -120,7 +120,7 @@ class CFISection: public Section {
// Use the addresses in BASES as the base addresses for encoded
// pointers in subsequent calls to FDEHeader or EncodedPointer.
// This function makes a copy of BASES.
- void SetEncodedPointerBases(const EncodedPointerBases &bases) {
+ void SetEncodedPointerBases(const EncodedPointerBases& bases) {
encoded_pointer_bases_ = bases;
}
@@ -133,11 +133,11 @@ class CFISection: public Section {
// Before calling this function, you will typically want to use Mark
// or Here to make a label to pass to FDEHeader that refers to this
// CIE's position in the section.
- CFISection &CIEHeader(uint64_t code_alignment_factor,
+ CFISection& CIEHeader(uint64_t code_alignment_factor,
int data_alignment_factor,
unsigned return_address_register,
uint8_t version = 3,
- const string &augmentation = "",
+ const string& augmentation = "",
bool dwarf64 = false,
uint8_t address_size = 8,
uint8_t segment_size = 0);
@@ -152,7 +152,7 @@ class CFISection: public Section {
// 0xffffff00 bytes. (The "initial length" is always a 32-bit
// value.) Nor does it support .debug_frame sections longer than
// 0xffffff00 bytes.
- CFISection &FDEHeader(Label cie_pointer,
+ CFISection& FDEHeader(Label cie_pointer,
uint64_t initial_location,
uint64_t address_range,
bool dwarf64 = false);
@@ -161,11 +161,11 @@ class CFISection: public Section {
// started, after padding with DW_CFA_nops for alignment. This
// defines the label representing the entry's length, cited in the
// entry's header. Return a reference to this section.
- CFISection &FinishEntry();
+ CFISection& FinishEntry();
// Append the contents of BLOCK as a DW_FORM_block value: an
// unsigned LEB128 length, followed by that many bytes of data.
- CFISection &Block(const string &block) {
+ CFISection& Block(const string& block) {
ULEB128(block.size());
Append(block);
return *this;
@@ -173,11 +173,11 @@ class CFISection: public Section {
// Append ADDRESS to this section, in the appropriate size and
// endianness. Return a reference to this section.
- CFISection &Address(uint64_t address) {
+ CFISection& Address(uint64_t address) {
Section::Append(endianness(), address_size_, address);
return *this;
}
- CFISection &Address(Label address) {
+ CFISection& Address(Label address) {
Section::Append(endianness(), address_size_, address);
return *this;
}
@@ -191,26 +191,26 @@ class CFISection: public Section {
//
// (C++ doesn't let me use default arguments here, because I want to
// refer to members of *this in the default argument expression.)
- CFISection &EncodedPointer(uint64_t address) {
+ CFISection& EncodedPointer(uint64_t address) {
return EncodedPointer(address, pointer_encoding_, encoded_pointer_bases_);
}
- CFISection &EncodedPointer(uint64_t address, DwarfPointerEncoding encoding) {
+ CFISection& EncodedPointer(uint64_t address, DwarfPointerEncoding encoding) {
return EncodedPointer(address, encoding, encoded_pointer_bases_);
}
- CFISection &EncodedPointer(uint64_t address, DwarfPointerEncoding encoding,
- const EncodedPointerBases &bases);
+ CFISection& EncodedPointer(uint64_t address, DwarfPointerEncoding encoding,
+ const EncodedPointerBases& bases);
// Restate some member functions, to keep chaining working nicely.
- CFISection &Mark(Label *label) { Section::Mark(label); return *this; }
- CFISection &D8(uint8_t v) { Section::D8(v); return *this; }
- CFISection &D16(uint16_t v) { Section::D16(v); return *this; }
- CFISection &D16(Label v) { Section::D16(v); return *this; }
- CFISection &D32(uint32_t v) { Section::D32(v); return *this; }
- CFISection &D32(const Label &v) { Section::D32(v); return *this; }
- CFISection &D64(uint64_t v) { Section::D64(v); return *this; }
- CFISection &D64(const Label &v) { Section::D64(v); return *this; }
- CFISection &LEB128(long long v) { Section::LEB128(v); return *this; }
- CFISection &ULEB128(uint64_t v) { Section::ULEB128(v); return *this; }
+ CFISection& Mark(Label* label) { Section::Mark(label); return *this; }
+ CFISection& D8(uint8_t v) { Section::D8(v); return *this; }
+ CFISection& D16(uint16_t v) { Section::D16(v); return *this; }
+ CFISection& D16(Label v) { Section::D16(v); return *this; }
+ CFISection& D32(uint32_t v) { Section::D32(v); return *this; }
+ CFISection& D32(const Label& v) { Section::D32(v); return *this; }
+ CFISection& D64(uint64_t v) { Section::D64(v); return *this; }
+ CFISection& D64(const Label& v) { Section::D64(v); return *this; }
+ CFISection& LEB128(long long v) { Section::LEB128(v); return *this; }
+ CFISection& ULEB128(uint64_t v) { Section::ULEB128(v); return *this; }
private:
// A length value that we've appended to the section, but is not yet
diff --git a/src/common/dwarf/dwarf2diehandler.cc b/src/common/dwarf/dwarf2diehandler.cc
index 63845018..f5a0683e 100644
--- a/src/common/dwarf/dwarf2diehandler.cc
+++ b/src/common/dwarf/dwarf2diehandler.cc
@@ -43,7 +43,7 @@ namespace dwarf2reader {
DIEDispatcher::~DIEDispatcher() {
while (!die_handlers_.empty()) {
- HandlerStack &entry = die_handlers_.top();
+ HandlerStack& entry = die_handlers_.top();
if (entry.handler_ != root_handler_)
delete entry.handler_;
die_handlers_.pop();
@@ -60,7 +60,7 @@ bool DIEDispatcher::StartCompilationUnit(uint64_t offset, uint8_t address_size,
bool DIEDispatcher::StartDIE(uint64_t offset, enum DwarfTag tag) {
// The stack entry for the parent of this DIE, if there is one.
- HandlerStack *parent = die_handlers_.empty() ? NULL : &die_handlers_.top();
+ HandlerStack* parent = die_handlers_.empty() ? NULL : &die_handlers_.top();
// Does this call indicate that we're done receiving the parent's
// attributes' values? If so, call its EndAttributes member function.
@@ -78,7 +78,7 @@ bool DIEDispatcher::StartDIE(uint64_t offset, enum DwarfTag tag) {
}
// Find a handler for this DIE.
- DIEHandler *handler;
+ DIEHandler* handler;
if (parent) {
if (parent->handler_)
// Ask the parent to find a handler.
@@ -115,7 +115,7 @@ bool DIEDispatcher::StartDIE(uint64_t offset, enum DwarfTag tag) {
void DIEDispatcher::EndDIE(uint64_t offset) {
assert(!die_handlers_.empty());
- HandlerStack *entry = &die_handlers_.top();
+ HandlerStack* entry = &die_handlers_.top();
if (entry->handler_) {
// This entry had better be the handler for this DIE.
assert(entry->offset_ == offset);
@@ -139,7 +139,7 @@ void DIEDispatcher::ProcessAttributeUnsigned(uint64_t offset,
enum DwarfAttribute attr,
enum DwarfForm form,
uint64_t data) {
- HandlerStack &current = die_handlers_.top();
+ HandlerStack& current = die_handlers_.top();
// This had better be an attribute of the DIE we were meant to handle.
assert(offset == current.offset_);
current.handler_->ProcessAttributeUnsigned(attr, form, data);
@@ -149,7 +149,7 @@ void DIEDispatcher::ProcessAttributeSigned(uint64_t offset,
enum DwarfAttribute attr,
enum DwarfForm form,
int64_t data) {
- HandlerStack &current = die_handlers_.top();
+ HandlerStack& current = die_handlers_.top();
// This had better be an attribute of the DIE we were meant to handle.
assert(offset == current.offset_);
current.handler_->ProcessAttributeSigned(attr, form, data);
@@ -159,7 +159,7 @@ void DIEDispatcher::ProcessAttributeReference(uint64_t offset,
enum DwarfAttribute attr,
enum DwarfForm form,
uint64_t data) {
- HandlerStack &current = die_handlers_.top();
+ HandlerStack& current = die_handlers_.top();
// This had better be an attribute of the DIE we were meant to handle.
assert(offset == current.offset_);
current.handler_->ProcessAttributeReference(attr, form, data);
@@ -168,9 +168,9 @@ void DIEDispatcher::ProcessAttributeReference(uint64_t offset,
void DIEDispatcher::ProcessAttributeBuffer(uint64_t offset,
enum DwarfAttribute attr,
enum DwarfForm form,
- const uint8_t *data,
+ const uint8_t* data,
uint64_t len) {
- HandlerStack &current = die_handlers_.top();
+ HandlerStack& current = die_handlers_.top();
// This had better be an attribute of the DIE we were meant to handle.
assert(offset == current.offset_);
current.handler_->ProcessAttributeBuffer(attr, form, data, len);
@@ -180,7 +180,7 @@ void DIEDispatcher::ProcessAttributeString(uint64_t offset,
enum DwarfAttribute attr,
enum DwarfForm form,
const string& data) {
- HandlerStack &current = die_handlers_.top();
+ HandlerStack& current = die_handlers_.top();
// This had better be an attribute of the DIE we were meant to handle.
assert(offset == current.offset_);
current.handler_->ProcessAttributeString(attr, form, data);
@@ -190,7 +190,7 @@ void DIEDispatcher::ProcessAttributeSignature(uint64_t offset,
enum DwarfAttribute attr,
enum DwarfForm form,
uint64_t signature) {
- HandlerStack &current = die_handlers_.top();
+ HandlerStack& current = die_handlers_.top();
// This had better be an attribute of the DIE we were meant to handle.
assert(offset == current.offset_);
current.handler_->ProcessAttributeSignature(attr, form, signature);
diff --git a/src/common/dwarf/dwarf2diehandler.h b/src/common/dwarf/dwarf2diehandler.h
index 871ba436..028a6d11 100644
--- a/src/common/dwarf/dwarf2diehandler.h
+++ b/src/common/dwarf/dwarf2diehandler.h
@@ -208,7 +208,7 @@ class DIEHandler {
uint64_t data) { }
virtual void ProcessAttributeBuffer(enum DwarfAttribute attr,
enum DwarfForm form,
- const uint8_t *data,
+ const uint8_t* data,
uint64_t len) { }
virtual void ProcessAttributeString(enum DwarfAttribute attr,
enum DwarfForm form,
@@ -244,7 +244,7 @@ class DIEHandler {
// it is.
//
// The default definition skips all children.
- virtual DIEHandler *FindChildHandler(uint64_t offset, enum DwarfTag tag) {
+ virtual DIEHandler* FindChildHandler(uint64_t offset, enum DwarfTag tag) {
return NULL;
}
@@ -288,7 +288,7 @@ class DIEDispatcher: public Dwarf2Handler {
// Create a Dwarf2Handler which uses ROOT_HANDLER as the handler for
// the compilation unit's root die, as described for the DIEHandler
// class.
- DIEDispatcher(RootDIEHandler *root_handler) : root_handler_(root_handler) { }
+ DIEDispatcher(RootDIEHandler* root_handler) : root_handler_(root_handler) { }
// Destroying a DIEDispatcher destroys all active handler objects
// except the root handler.
~DIEDispatcher();
@@ -311,12 +311,12 @@ class DIEDispatcher: public Dwarf2Handler {
void ProcessAttributeBuffer(uint64_t offset,
enum DwarfAttribute attr,
enum DwarfForm form,
- const uint8_t *data,
+ const uint8_t* data,
uint64_t len);
void ProcessAttributeString(uint64_t offset,
enum DwarfAttribute attr,
enum DwarfForm form,
- const string &data);
+ const string& data);
void ProcessAttributeSignature(uint64_t offset,
enum DwarfAttribute attr,
enum DwarfForm form,
@@ -335,7 +335,7 @@ class DIEDispatcher: public Dwarf2Handler {
// The handler object interested in this DIE's attributes and
// children. If NULL, we're not interested in either.
- DIEHandler *handler_;
+ DIEHandler* handler_;
// Have we reported the end of this DIE's attributes to the handler?
bool reported_attributes_end_;
@@ -358,7 +358,7 @@ class DIEDispatcher: public Dwarf2Handler {
// The root handler. We don't push it on die_handlers_ until we
// actually get the StartDIE call for the root.
- RootDIEHandler *root_handler_;
+ RootDIEHandler* root_handler_;
};
} // namespace dwarf2reader
diff --git a/src/common/dwarf/dwarf2diehandler_unittest.cc b/src/common/dwarf/dwarf2diehandler_unittest.cc
index 01b70489..552c3d11 100644
--- a/src/common/dwarf/dwarf2diehandler_unittest.cc
+++ b/src/common/dwarf/dwarf2diehandler_unittest.cc
@@ -69,9 +69,9 @@ class MockDIEHandler: public DIEHandler {
MOCK_METHOD3(ProcessAttributeReference,
void(DwarfAttribute, DwarfForm, uint64_t));
MOCK_METHOD4(ProcessAttributeBuffer,
- void(DwarfAttribute, DwarfForm, const uint8_t *, uint64_t));
+ void(DwarfAttribute, DwarfForm, const uint8_t*, uint64_t));
MOCK_METHOD3(ProcessAttributeString,
- void(DwarfAttribute, DwarfForm, const string &));
+ void(DwarfAttribute, DwarfForm, const string&));
MOCK_METHOD3(ProcessAttributeSignature,
void(DwarfAttribute, DwarfForm, uint64_t));
MOCK_METHOD0(EndAttributes, bool());
@@ -88,9 +88,9 @@ class MockRootDIEHandler: public RootDIEHandler {
MOCK_METHOD3(ProcessAttributeReference,
void(DwarfAttribute, DwarfForm, uint64_t));
MOCK_METHOD4(ProcessAttributeBuffer,
- void(DwarfAttribute, DwarfForm, const uint8_t *, uint64_t));
+ void(DwarfAttribute, DwarfForm, const uint8_t*, uint64_t));
MOCK_METHOD3(ProcessAttributeString,
- void(DwarfAttribute, DwarfForm, const string &));
+ void(DwarfAttribute, DwarfForm, const string&));
MOCK_METHOD3(ProcessAttributeSignature,
void(DwarfAttribute, DwarfForm, uint64_t));
MOCK_METHOD0(EndAttributes, bool());
@@ -339,7 +339,7 @@ TEST(Dwarf2DIEHandler, FindAndSkipChildren) {
EXPECT_CALL(mock_root_handler,
FindChildHandler(0x97412be24875de9dLL,
(DwarfTag) 0x505a068b))
- .WillOnce(Return((DIEHandler *) NULL));
+ .WillOnce(Return((DIEHandler*) NULL));
// Third child DIE.
EXPECT_CALL(mock_root_handler,
diff --git a/src/common/dwarf/dwarf2reader.cc b/src/common/dwarf/dwarf2reader.cc
index ad82a5f4..aca83677 100644
--- a/src/common/dwarf/dwarf2reader.cc
+++ b/src/common/dwarf/dwarf2reader.cc
@@ -122,9 +122,9 @@ void CompilationUnit::ReadAbbrevs() {
// The only way to check whether we are reading over the end of the
// buffer would be to first compute the size of the leb128 data by
// reading it, then go back and read it again.
- const uint8_t *abbrev_start = iter->second.first +
+ const uint8_t* abbrev_start = iter->second.first +
header_.abbrev_offset;
- const uint8_t *abbrevptr = abbrev_start;
+ const uint8_t* abbrevptr = abbrev_start;
#ifndef NDEBUG
const uint64_t abbrev_length = iter->second.second - header_.abbrev_offset;
#endif
@@ -171,7 +171,7 @@ void CompilationUnit::ReadAbbrevs() {
}
// Skips a single DIE's attributes.
-const uint8_t *CompilationUnit::SkipDIE(const uint8_t* start,
+const uint8_t* CompilationUnit::SkipDIE(const uint8_t* start,
const Abbrev& abbrev) {
for (AttributeList::const_iterator i = abbrev.attributes.begin();
i != abbrev.attributes.end();
@@ -182,7 +182,7 @@ const uint8_t *CompilationUnit::SkipDIE(const uint8_t* start,
}
// Skips a single attribute form's data.
-const uint8_t *CompilationUnit::SkipAttribute(const uint8_t *start,
+const uint8_t* CompilationUnit::SkipAttribute(const uint8_t* start,
enum DwarfForm form) {
size_t len;
@@ -219,7 +219,7 @@ const uint8_t *CompilationUnit::SkipAttribute(const uint8_t *start,
case DW_FORM_ref_sig8:
return start + 8;
case DW_FORM_string:
- return start + strlen(reinterpret_cast<const char *>(start)) + 1;
+ return start + strlen(reinterpret_cast<const char*>(start)) + 1;
case DW_FORM_udata:
case DW_FORM_ref_udata:
case DW_FORM_strx:
@@ -311,7 +311,7 @@ size_t CompilationUnit::ReadTypeOffset(const uint8_t* headerptr) {
// abbrevs, and an address size. DWARF5 adds a unit_type to distinguish
// between partial-, full-, skeleton-, split-, and type- compilation units.
void CompilationUnit::ReadHeader() {
- const uint8_t *headerptr = buffer_;
+ const uint8_t* headerptr = buffer_;
size_t initial_length_size;
assert(headerptr + 4 < buffer_ + buffer_length_);
@@ -455,8 +455,8 @@ void CompilationUnit::ProcessFormStringIndex(
// If one really wanted, you could merge SkipAttribute and
// ProcessAttribute
// This is all boring data manipulation and calling of the handler.
-const uint8_t *CompilationUnit::ProcessAttribute(
- uint64_t dieoffset, const uint8_t *start, enum DwarfAttribute attr,
+const uint8_t* CompilationUnit::ProcessAttribute(
+ uint64_t dieoffset, const uint8_t* start, enum DwarfAttribute attr,
enum DwarfForm form) {
size_t len;
@@ -490,7 +490,7 @@ const uint8_t *CompilationUnit::ProcessAttribute(
reader_->ReadEightBytes(start));
return start + 8;
case DW_FORM_string: {
- const char *str = reinterpret_cast<const char *>(start);
+ const char* str = reinterpret_cast<const char*>(start);
ProcessAttributeString(dieoffset, attr, form, str);
return start + strlen(str) + 1;
}
@@ -588,7 +588,7 @@ const uint8_t *CompilationUnit::ProcessAttribute(
const uint64_t offset = reader_->ReadOffset(start);
assert(string_buffer_ + offset < string_buffer_ + string_buffer_length_);
- const char *str = reinterpret_cast<const char *>(string_buffer_ + offset);
+ const char* str = reinterpret_cast<const char*>(string_buffer_ + offset);
ProcessAttributeString(dieoffset, attr, form, str);
return start + reader_->OffsetSize();
}
@@ -662,8 +662,8 @@ const uint8_t *CompilationUnit::ProcessAttribute(
return NULL;
}
-const uint8_t *CompilationUnit::ProcessDIE(uint64_t dieoffset,
- const uint8_t *start,
+const uint8_t* CompilationUnit::ProcessDIE(uint64_t dieoffset,
+ const uint8_t* start,
const Abbrev& abbrev) {
for (AttributeList::const_iterator i = abbrev.attributes.begin();
i != abbrev.attributes.end();
@@ -684,12 +684,12 @@ const uint8_t *CompilationUnit::ProcessDIE(uint64_t dieoffset,
}
void CompilationUnit::ProcessDIEs() {
- const uint8_t *dieptr = after_header_;
+ const uint8_t* dieptr = after_header_;
size_t len;
// lengthstart is the place the length field is based on.
// It is the point in the header after the initial length field
- const uint8_t *lengthstart = buffer_;
+ const uint8_t* lengthstart = buffer_;
// In 64 bit dwarf, the initial length is 12 bytes, because of the
// 0xffffffff at the start.
@@ -827,7 +827,7 @@ void CompilationUnit::ReadDebugSectionsFromDwo(ElfReader* elf_reader,
if (section_data != NULL)
sections->insert(std::make_pair(
base_name, std::make_pair(
- reinterpret_cast<const uint8_t *>(section_data),
+ reinterpret_cast<const uint8_t*>(section_data),
section_size)));
}
}
@@ -856,11 +856,11 @@ void DwpReader::Initialize() {
&string_buffer_size_);
version_ = byte_reader_.ReadFourBytes(
- reinterpret_cast<const uint8_t *>(cu_index_));
+ reinterpret_cast<const uint8_t*>(cu_index_));
if (version_ == 1) {
nslots_ = byte_reader_.ReadFourBytes(
- reinterpret_cast<const uint8_t *>(cu_index_)
+ reinterpret_cast<const uint8_t*>(cu_index_)
+ 3 * sizeof(uint32_t));
phash_ = cu_index_ + 4 * sizeof(uint32_t);
pindex_ = phash_ + nslots_ * sizeof(uint64_t);
@@ -870,11 +870,11 @@ void DwpReader::Initialize() {
}
} else if (version_ == 2) {
ncolumns_ = byte_reader_.ReadFourBytes(
- reinterpret_cast<const uint8_t *>(cu_index_) + sizeof(uint32_t));
+ reinterpret_cast<const uint8_t*>(cu_index_) + sizeof(uint32_t));
nunits_ = byte_reader_.ReadFourBytes(
- reinterpret_cast<const uint8_t *>(cu_index_) + 2 * sizeof(uint32_t));
+ reinterpret_cast<const uint8_t*>(cu_index_) + 2 * sizeof(uint32_t));
nslots_ = byte_reader_.ReadFourBytes(
- reinterpret_cast<const uint8_t *>(cu_index_) + 3 * sizeof(uint32_t));
+ reinterpret_cast<const uint8_t*>(cu_index_) + 3 * sizeof(uint32_t));
phash_ = cu_index_ + 4 * sizeof(uint32_t);
pindex_ = phash_ + nslots_ * sizeof(uint64_t);
offset_table_ = pindex_ + nslots_ * sizeof(uint32_t);
@@ -902,7 +902,7 @@ void DwpReader::ReadDebugSectionsForCU(uint64_t dwo_id,
// can read a list of section indexes for the debug sections
// for the CU whose dwo_id we are looking for.
int index = byte_reader_.ReadFourBytes(
- reinterpret_cast<const uint8_t *>(pindex_)
+ reinterpret_cast<const uint8_t*>(pindex_)
+ slot * sizeof(uint32_t));
const char* shndx_list = shndx_pool_ + index * sizeof(uint32_t);
for (;;) {
@@ -911,7 +911,7 @@ void DwpReader::ReadDebugSectionsForCU(uint64_t dwo_id,
return;
}
unsigned int shndx = byte_reader_.ReadFourBytes(
- reinterpret_cast<const uint8_t *>(shndx_list));
+ reinterpret_cast<const uint8_t*>(shndx_list));
shndx_list += sizeof(uint32_t);
if (shndx == 0)
break;
@@ -925,26 +925,26 @@ void DwpReader::ReadDebugSectionsForCU(uint64_t dwo_id,
section_data = elf_reader_->GetSectionByIndex(shndx, &section_size);
sections->insert(std::make_pair(
".debug_abbrev",
- std::make_pair(reinterpret_cast<const uint8_t *> (section_data),
+ std::make_pair(reinterpret_cast<const uint8_t*> (section_data),
section_size)));
} else if (!strncmp(section_name, ".debug_info", strlen(".debug_info"))) {
section_data = elf_reader_->GetSectionByIndex(shndx, &section_size);
sections->insert(std::make_pair(
".debug_info",
- std::make_pair(reinterpret_cast<const uint8_t *> (section_data),
+ std::make_pair(reinterpret_cast<const uint8_t*> (section_data),
section_size)));
} else if (!strncmp(section_name, ".debug_str_offsets",
strlen(".debug_str_offsets"))) {
section_data = elf_reader_->GetSectionByIndex(shndx, &section_size);
sections->insert(std::make_pair(
".debug_str_offsets",
- std::make_pair(reinterpret_cast<const uint8_t *> (section_data),
+ std::make_pair(reinterpret_cast<const uint8_t*> (section_data),
section_size)));
}
}
sections->insert(std::make_pair(
".debug_str",
- std::make_pair(reinterpret_cast<const uint8_t *> (string_buffer_),
+ std::make_pair(reinterpret_cast<const uint8_t*> (string_buffer_),
string_buffer_size_)));
} else if (version_ == 2) {
uint32_t index = LookupCUv2(dwo_id);
@@ -969,33 +969,33 @@ void DwpReader::ReadDebugSectionsForCU(uint64_t dwo_id,
}
for (unsigned int col = 0u; col < ncolumns_; ++col) {
uint32_t section_id =
- byte_reader_.ReadFourBytes(reinterpret_cast<const uint8_t *>(id_row)
+ byte_reader_.ReadFourBytes(reinterpret_cast<const uint8_t*>(id_row)
+ col * sizeof(uint32_t));
uint32_t offset = byte_reader_.ReadFourBytes(
- reinterpret_cast<const uint8_t *>(offset_row)
+ reinterpret_cast<const uint8_t*>(offset_row)
+ col * sizeof(uint32_t));
uint32_t size = byte_reader_.ReadFourBytes(
- reinterpret_cast<const uint8_t *>(size_row) + col * sizeof(uint32_t));
+ reinterpret_cast<const uint8_t*>(size_row) + col * sizeof(uint32_t));
if (section_id == DW_SECT_ABBREV) {
sections->insert(std::make_pair(
".debug_abbrev",
- std::make_pair(reinterpret_cast<const uint8_t *> (abbrev_data_)
+ std::make_pair(reinterpret_cast<const uint8_t*> (abbrev_data_)
+ offset, size)));
} else if (section_id == DW_SECT_INFO) {
sections->insert(std::make_pair(
".debug_info",
- std::make_pair(reinterpret_cast<const uint8_t *> (info_data_)
+ std::make_pair(reinterpret_cast<const uint8_t*> (info_data_)
+ offset, size)));
} else if (section_id == DW_SECT_STR_OFFSETS) {
sections->insert(std::make_pair(
".debug_str_offsets",
- std::make_pair(reinterpret_cast<const uint8_t *> (str_offsets_data_)
+ std::make_pair(reinterpret_cast<const uint8_t*> (str_offsets_data_)
+ offset, size)));
}
}
sections->insert(std::make_pair(
".debug_str",
- std::make_pair(reinterpret_cast<const uint8_t *> (string_buffer_),
+ std::make_pair(reinterpret_cast<const uint8_t*> (string_buffer_),
string_buffer_size_)));
}
}
@@ -1003,14 +1003,14 @@ void DwpReader::ReadDebugSectionsForCU(uint64_t dwo_id,
int DwpReader::LookupCU(uint64_t dwo_id) {
uint32_t slot = static_cast<uint32_t>(dwo_id) & (nslots_ - 1);
uint64_t probe = byte_reader_.ReadEightBytes(
- reinterpret_cast<const uint8_t *>(phash_) + slot * sizeof(uint64_t));
+ reinterpret_cast<const uint8_t*>(phash_) + slot * sizeof(uint64_t));
if (probe != 0 && probe != dwo_id) {
uint32_t secondary_hash =
(static_cast<uint32_t>(dwo_id >> 32) & (nslots_ - 1)) | 1;
do {
slot = (slot + secondary_hash) & (nslots_ - 1);
probe = byte_reader_.ReadEightBytes(
- reinterpret_cast<const uint8_t *>(phash_) + slot * sizeof(uint64_t));
+ reinterpret_cast<const uint8_t*>(phash_) + slot * sizeof(uint64_t));
} while (probe != 0 && probe != dwo_id);
}
if (probe == 0)
@@ -1021,24 +1021,24 @@ int DwpReader::LookupCU(uint64_t dwo_id) {
uint32_t DwpReader::LookupCUv2(uint64_t dwo_id) {
uint32_t slot = static_cast<uint32_t>(dwo_id) & (nslots_ - 1);
uint64_t probe = byte_reader_.ReadEightBytes(
- reinterpret_cast<const uint8_t *>(phash_) + slot * sizeof(uint64_t));
+ reinterpret_cast<const uint8_t*>(phash_) + slot * sizeof(uint64_t));
uint32_t index = byte_reader_.ReadFourBytes(
- reinterpret_cast<const uint8_t *>(pindex_) + slot * sizeof(uint32_t));
+ reinterpret_cast<const uint8_t*>(pindex_) + slot * sizeof(uint32_t));
if (index != 0 && probe != dwo_id) {
uint32_t secondary_hash =
(static_cast<uint32_t>(dwo_id >> 32) & (nslots_ - 1)) | 1;
do {
slot = (slot + secondary_hash) & (nslots_ - 1);
probe = byte_reader_.ReadEightBytes(
- reinterpret_cast<const uint8_t *>(phash_) + slot * sizeof(uint64_t));
+ reinterpret_cast<const uint8_t*>(phash_) + slot * sizeof(uint64_t));
index = byte_reader_.ReadFourBytes(
- reinterpret_cast<const uint8_t *>(pindex_) + slot * sizeof(uint32_t));
+ reinterpret_cast<const uint8_t*>(pindex_) + slot * sizeof(uint32_t));
} while (index != 0 && probe != dwo_id);
}
return index;
}
-LineInfo::LineInfo(const uint8_t *buffer, uint64_t buffer_length,
+LineInfo::LineInfo(const uint8_t* buffer, uint64_t buffer_length,
ByteReader* reader, const uint8_t* string_buffer,
size_t string_buffer_length,
const uint8_t* line_string_buffer,
@@ -1185,7 +1185,7 @@ void LineInfo::ReadFileRow(const uint8_t** lineptr,
// The header for a debug_line section is mildly complicated, because
// the line info is very tightly encoded.
void LineInfo::ReadHeader() {
- const uint8_t *lineptr = buffer_;
+ const uint8_t* lineptr = buffer_;
size_t initial_length_size;
const uint64_t initial_length
@@ -1331,12 +1331,12 @@ void LineInfo::ReadHeader() {
/* static */
bool LineInfo::ProcessOneOpcode(ByteReader* reader,
LineInfoHandler* handler,
- const struct LineInfoHeader &header,
- const uint8_t *start,
+ const struct LineInfoHeader& header,
+ const uint8_t* start,
struct LineStateMachine* lsm,
size_t* len,
uintptr pc,
- bool *lsm_passes_pc) {
+ bool* lsm_passes_pc) {
size_t oplen = 0;
size_t templen;
uint8_t opcode = reader->ReadOneByte(start);
@@ -1473,7 +1473,7 @@ bool LineInfo::ProcessOneOpcode(ByteReader* reader,
}
break;
case DW_LNE_define_file: {
- const char *filename = reinterpret_cast<const char *>(start);
+ const char* filename = reinterpret_cast<const char*>(start);
templen = strlen(filename) + 1;
start += templen;
@@ -1520,7 +1520,7 @@ void LineInfo::ReadLines() {
// lengthstart is the place the length field is based on.
// It is the point in the header after the initial length field
- const uint8_t *lengthstart = buffer_;
+ const uint8_t* lengthstart = buffer_;
// In 64 bit dwarf, the initial length is 12 bytes, because of the
// 0xffffffff at the start.
@@ -1529,7 +1529,7 @@ void LineInfo::ReadLines() {
else
lengthstart += 4;
- const uint8_t *lineptr = after_header_;
+ const uint8_t* lineptr = after_header_;
lsm.Reset(header_.default_is_stmt);
// The LineInfoHandler interface expects each line's length along
@@ -1568,8 +1568,8 @@ void LineInfo::ReadLines() {
after_header_ = lengthstart + header_.total_length;
}
-RangeListReader::RangeListReader(const uint8_t *buffer, uint64_t size,
- ByteReader *reader, RangeListHandler *handler)
+RangeListReader::RangeListReader(const uint8_t* buffer, uint64_t size,
+ ByteReader* reader, RangeListHandler* handler)
: buffer_(buffer), size_(size), reader_(reader), handler_(handler) { }
bool RangeListReader::ReadRangeList(uint64_t offset) {
@@ -1625,17 +1625,17 @@ class CallFrameInfo::Rule {
// this rule. If REG is kCFARegister, then this rule describes how to compute
// the canonical frame address. Return what the HANDLER member function
// returned.
- virtual bool Handle(Handler *handler,
+ virtual bool Handle(Handler* handler,
uint64_t address, int reg) const = 0;
// Equality on rules. We use these to decide which rules we need
// to report after a DW_CFA_restore_state instruction.
- virtual bool operator==(const Rule &rhs) const = 0;
+ virtual bool operator==(const Rule& rhs) const = 0;
- bool operator!=(const Rule &rhs) const { return ! (*this == rhs); }
+ bool operator!=(const Rule& rhs) const { return ! (*this == rhs); }
// Return a pointer to a copy of this rule.
- virtual Rule *Copy() const = 0;
+ virtual Rule* Copy() const = 0;
// If this is a base+offset rule, change its base register to REG.
// Otherwise, do nothing. (Ugly, but required for DW_CFA_def_cfa_register.)
@@ -1651,16 +1651,16 @@ class CallFrameInfo::UndefinedRule: public CallFrameInfo::Rule {
public:
UndefinedRule() { }
~UndefinedRule() { }
- bool Handle(Handler *handler, uint64_t address, int reg) const {
+ bool Handle(Handler* handler, uint64_t address, int reg) const {
return handler->UndefinedRule(address, reg);
}
- bool operator==(const Rule &rhs) const {
+ bool operator==(const Rule& rhs) const {
// dynamic_cast is allowed by the Google C++ Style Guide, if the use has
// been carefully considered; cheap RTTI-like workarounds are forbidden.
- const UndefinedRule *our_rhs = dynamic_cast<const UndefinedRule *>(&rhs);
+ const UndefinedRule* our_rhs = dynamic_cast<const UndefinedRule*>(&rhs);
return (our_rhs != NULL);
}
- Rule *Copy() const { return new UndefinedRule(*this); }
+ Rule* Copy() const { return new UndefinedRule(*this); }
};
// Rule: the register's value is the same as that it had in the caller.
@@ -1668,16 +1668,16 @@ class CallFrameInfo::SameValueRule: public CallFrameInfo::Rule {
public:
SameValueRule() { }
~SameValueRule() { }
- bool Handle(Handler *handler, uint64_t address, int reg) const {
+ bool Handle(Handler* handler, uint64_t address, int reg) const {
return handler->SameValueRule(address, reg);
}
- bool operator==(const Rule &rhs) const {
+ bool operator==(const Rule& rhs) const {
// dynamic_cast is allowed by the Google C++ Style Guide, if the use has
// been carefully considered; cheap RTTI-like workarounds are forbidden.
- const SameValueRule *our_rhs = dynamic_cast<const SameValueRule *>(&rhs);
+ const SameValueRule* our_rhs = dynamic_cast<const SameValueRule*>(&rhs);
return (our_rhs != NULL);
}
- Rule *Copy() const { return new SameValueRule(*this); }
+ Rule* Copy() const { return new SameValueRule(*this); }
};
// Rule: the register is saved at OFFSET from BASE_REGISTER. BASE_REGISTER
@@ -1687,18 +1687,18 @@ class CallFrameInfo::OffsetRule: public CallFrameInfo::Rule {
OffsetRule(int base_register, long offset)
: base_register_(base_register), offset_(offset) { }
~OffsetRule() { }
- bool Handle(Handler *handler, uint64_t address, int reg) const {
+ bool Handle(Handler* handler, uint64_t address, int reg) const {
return handler->OffsetRule(address, reg, base_register_, offset_);
}
- bool operator==(const Rule &rhs) const {
+ bool operator==(const Rule& rhs) const {
// dynamic_cast is allowed by the Google C++ Style Guide, if the use has
// been carefully considered; cheap RTTI-like workarounds are forbidden.
- const OffsetRule *our_rhs = dynamic_cast<const OffsetRule *>(&rhs);
+ const OffsetRule* our_rhs = dynamic_cast<const OffsetRule*>(&rhs);
return (our_rhs &&
base_register_ == our_rhs->base_register_ &&
offset_ == our_rhs->offset_);
}
- Rule *Copy() const { return new OffsetRule(*this); }
+ Rule* Copy() const { return new OffsetRule(*this); }
// We don't actually need SetBaseRegister or SetOffset here, since they
// are only ever applied to CFA rules, for DW_CFA_def_cfa_offset, and it
// doesn't make sense to use OffsetRule for computing the CFA: it
@@ -1716,18 +1716,18 @@ class CallFrameInfo::ValOffsetRule: public CallFrameInfo::Rule {
ValOffsetRule(int base_register, long offset)
: base_register_(base_register), offset_(offset) { }
~ValOffsetRule() { }
- bool Handle(Handler *handler, uint64_t address, int reg) const {
+ bool Handle(Handler* handler, uint64_t address, int reg) const {
return handler->ValOffsetRule(address, reg, base_register_, offset_);
}
- bool operator==(const Rule &rhs) const {
+ bool operator==(const Rule& rhs) const {
// dynamic_cast is allowed by the Google C++ Style Guide, if the use has
// been carefully considered; cheap RTTI-like workarounds are forbidden.
- const ValOffsetRule *our_rhs = dynamic_cast<const ValOffsetRule *>(&rhs);
+ const ValOffsetRule* our_rhs = dynamic_cast<const ValOffsetRule*>(&rhs);
return (our_rhs &&
base_register_ == our_rhs->base_register_ &&
offset_ == our_rhs->offset_);
}
- Rule *Copy() const { return new ValOffsetRule(*this); }
+ Rule* Copy() const { return new ValOffsetRule(*this); }
void SetBaseRegister(unsigned reg) { base_register_ = reg; }
void SetOffset(long long offset) { offset_ = offset; }
private:
@@ -1741,16 +1741,16 @@ class CallFrameInfo::RegisterRule: public CallFrameInfo::Rule {
explicit RegisterRule(int register_number)
: register_number_(register_number) { }
~RegisterRule() { }
- bool Handle(Handler *handler, uint64_t address, int reg) const {
+ bool Handle(Handler* handler, uint64_t address, int reg) const {
return handler->RegisterRule(address, reg, register_number_);
}
- bool operator==(const Rule &rhs) const {
+ bool operator==(const Rule& rhs) const {
// dynamic_cast is allowed by the Google C++ Style Guide, if the use has
// been carefully considered; cheap RTTI-like workarounds are forbidden.
- const RegisterRule *our_rhs = dynamic_cast<const RegisterRule *>(&rhs);
+ const RegisterRule* our_rhs = dynamic_cast<const RegisterRule*>(&rhs);
return (our_rhs && register_number_ == our_rhs->register_number_);
}
- Rule *Copy() const { return new RegisterRule(*this); }
+ Rule* Copy() const { return new RegisterRule(*this); }
private:
int register_number_;
};
@@ -1758,19 +1758,19 @@ class CallFrameInfo::RegisterRule: public CallFrameInfo::Rule {
// Rule: EXPRESSION evaluates to the address at which the register is saved.
class CallFrameInfo::ExpressionRule: public CallFrameInfo::Rule {
public:
- explicit ExpressionRule(const string &expression)
+ explicit ExpressionRule(const string& expression)
: expression_(expression) { }
~ExpressionRule() { }
- bool Handle(Handler *handler, uint64_t address, int reg) const {
+ bool Handle(Handler* handler, uint64_t address, int reg) const {
return handler->ExpressionRule(address, reg, expression_);
}
- bool operator==(const Rule &rhs) const {
+ bool operator==(const Rule& rhs) const {
// dynamic_cast is allowed by the Google C++ Style Guide, if the use has
// been carefully considered; cheap RTTI-like workarounds are forbidden.
- const ExpressionRule *our_rhs = dynamic_cast<const ExpressionRule *>(&rhs);
+ const ExpressionRule* our_rhs = dynamic_cast<const ExpressionRule*>(&rhs);
return (our_rhs && expression_ == our_rhs->expression_);
}
- Rule *Copy() const { return new ExpressionRule(*this); }
+ Rule* Copy() const { return new ExpressionRule(*this); }
private:
string expression_;
};
@@ -1778,20 +1778,20 @@ class CallFrameInfo::ExpressionRule: public CallFrameInfo::Rule {
// Rule: EXPRESSION evaluates to the address at which the register is saved.
class CallFrameInfo::ValExpressionRule: public CallFrameInfo::Rule {
public:
- explicit ValExpressionRule(const string &expression)
+ explicit ValExpressionRule(const string& expression)
: expression_(expression) { }
~ValExpressionRule() { }
- bool Handle(Handler *handler, uint64_t address, int reg) const {
+ bool Handle(Handler* handler, uint64_t address, int reg) const {
return handler->ValExpressionRule(address, reg, expression_);
}
- bool operator==(const Rule &rhs) const {
+ bool operator==(const Rule& rhs) const {
// dynamic_cast is allowed by the Google C++ Style Guide, if the use has
// been carefully considered; cheap RTTI-like workarounds are forbidden.
- const ValExpressionRule *our_rhs =
- dynamic_cast<const ValExpressionRule *>(&rhs);
+ const ValExpressionRule* our_rhs =
+ dynamic_cast<const ValExpressionRule*>(&rhs);
return (our_rhs && expression_ == our_rhs->expression_);
}
- Rule *Copy() const { return new ValExpressionRule(*this); }
+ Rule* Copy() const { return new ValExpressionRule(*this); }
private:
string expression_;
};
@@ -1800,51 +1800,51 @@ class CallFrameInfo::ValExpressionRule: public CallFrameInfo::Rule {
class CallFrameInfo::RuleMap {
public:
RuleMap() : cfa_rule_(NULL) { }
- RuleMap(const RuleMap &rhs) : cfa_rule_(NULL) { *this = rhs; }
+ RuleMap(const RuleMap& rhs) : cfa_rule_(NULL) { *this = rhs; }
~RuleMap() { Clear(); }
- RuleMap &operator=(const RuleMap &rhs);
+ RuleMap& operator=(const RuleMap& rhs);
// Set the rule for computing the CFA to RULE. Take ownership of RULE.
- void SetCFARule(Rule *rule) { delete cfa_rule_; cfa_rule_ = rule; }
+ void SetCFARule(Rule* rule) { delete cfa_rule_; cfa_rule_ = rule; }
// Return the current CFA rule. Unlike RegisterRule, this RuleMap retains
// ownership of the rule. We use this for DW_CFA_def_cfa_offset and
// DW_CFA_def_cfa_register, and for detecting references to the CFA before
// a rule for it has been established.
- Rule *CFARule() const { return cfa_rule_; }
+ Rule* CFARule() const { return cfa_rule_; }
// Return the rule for REG, or NULL if there is none. The caller takes
// ownership of the result.
- Rule *RegisterRule(int reg) const;
+ Rule* RegisterRule(int reg) const;
// Set the rule for computing REG to RULE. Take ownership of RULE.
- void SetRegisterRule(int reg, Rule *rule);
+ void SetRegisterRule(int reg, Rule* rule);
// Make all the appropriate calls to HANDLER as if we were changing from
// this RuleMap to NEW_RULES at ADDRESS. We use this to implement
// DW_CFA_restore_state, where lots of rules can change simultaneously.
// Return true if all handlers returned true; otherwise, return false.
- bool HandleTransitionTo(Handler *handler, uint64_t address,
- const RuleMap &new_rules) const;
+ bool HandleTransitionTo(Handler* handler, uint64_t address,
+ const RuleMap& new_rules) const;
private:
// A map from register numbers to Rules.
- typedef std::map<int, Rule *> RuleByNumber;
+ typedef std::map<int, Rule*> RuleByNumber;
// Remove all register rules and clear cfa_rule_.
void Clear();
// The rule for computing the canonical frame address. This RuleMap owns
// this rule.
- Rule *cfa_rule_;
+ Rule* cfa_rule_;
// A map from register numbers to postfix expressions to recover
// their values. This RuleMap owns the Rules the map refers to.
RuleByNumber registers_;
};
-CallFrameInfo::RuleMap &CallFrameInfo::RuleMap::operator=(const RuleMap &rhs) {
+CallFrameInfo::RuleMap& CallFrameInfo::RuleMap::operator=(const RuleMap& rhs) {
Clear();
// Since each map owns the rules it refers to, assignment must copy them.
if (rhs.cfa_rule_) cfa_rule_ = rhs.cfa_rule_->Copy();
@@ -1854,7 +1854,7 @@ CallFrameInfo::RuleMap &CallFrameInfo::RuleMap::operator=(const RuleMap &rhs) {
return *this;
}
-CallFrameInfo::Rule *CallFrameInfo::RuleMap::RegisterRule(int reg) const {
+CallFrameInfo::Rule* CallFrameInfo::RuleMap::RegisterRule(int reg) const {
assert(reg != Handler::kCFARegister);
RuleByNumber::const_iterator it = registers_.find(reg);
if (it != registers_.end())
@@ -1863,18 +1863,18 @@ CallFrameInfo::Rule *CallFrameInfo::RuleMap::RegisterRule(int reg) const {
return NULL;
}
-void CallFrameInfo::RuleMap::SetRegisterRule(int reg, Rule *rule) {
+void CallFrameInfo::RuleMap::SetRegisterRule(int reg, Rule* rule) {
assert(reg != Handler::kCFARegister);
assert(rule);
- Rule **slot = &registers_[reg];
+ Rule** slot = &registers_[reg];
delete *slot;
*slot = rule;
}
bool CallFrameInfo::RuleMap::HandleTransitionTo(
- Handler *handler,
+ Handler* handler,
uint64_t address,
- const RuleMap &new_rules) const {
+ const RuleMap& new_rules) const {
// Transition from cfa_rule_ to new_rules.cfa_rule_.
if (cfa_rule_ && new_rules.cfa_rule_) {
if (*cfa_rule_ != *new_rules.cfa_rule_ &&
@@ -1954,7 +1954,7 @@ class CallFrameInfo::State {
public:
// Create a call frame information interpreter state with the given
// reporter, reader, handler, and initial call frame info address.
- State(ByteReader *reader, Handler *handler, Reporter *reporter,
+ State(ByteReader* reader, Handler* handler, Reporter* reporter,
uint64_t address)
: reader_(reader), handler_(handler), reporter_(reporter),
address_(address), entry_(NULL), cursor_(NULL) { }
@@ -1962,11 +1962,11 @@ class CallFrameInfo::State {
// Interpret instructions from CIE, save the resulting rule set for
// DW_CFA_restore instructions, and return true. On error, report
// the problem to reporter_ and return false.
- bool InterpretCIE(const CIE &cie);
+ bool InterpretCIE(const CIE& cie);
// Interpret instructions from FDE, and return true. On error,
// report the problem to reporter_ and return false.
- bool InterpretFDE(const FDE &fde);
+ bool InterpretFDE(const FDE& fde);
private:
// The operands of a CFI instruction, for ParseOperands.
@@ -1996,7 +1996,7 @@ class CallFrameInfo::State {
// '8' an eight-byte offset (OPERANDS->offset)
// 'e' a DW_FORM_block holding a (OPERANDS->expression)
// DWARF expression
- bool ParseOperands(const char *format, Operands *operands);
+ bool ParseOperands(const char* format, Operands* operands);
// Interpret one CFI instruction from STATE's instruction stream, update
// STATE, report any rule changes to handler_, and return true. On
@@ -2019,7 +2019,7 @@ class CallFrameInfo::State {
// Specify that REG can be recovered using RULE, and return true. On
// failure, report and return false.
- bool DoRule(unsigned reg, Rule *rule);
+ bool DoRule(unsigned reg, Rule* rule);
// Specify that REG can be found at OFFSET from the CFA, and return true.
// On failure, report and return false. (Subroutine for DW_CFA_offset,
@@ -2047,23 +2047,23 @@ class CallFrameInfo::State {
}
// For reading multi-byte values with the appropriate endianness.
- ByteReader *reader_;
+ ByteReader* reader_;
// The handler to which we should report the data we find.
- Handler *handler_;
+ Handler* handler_;
// For reporting problems in the info we're parsing.
- Reporter *reporter_;
+ Reporter* reporter_;
// The code address to which the next instruction in the stream applies.
uint64_t address_;
// The entry whose instructions we are currently processing. This is
// first a CIE, and then an FDE.
- const Entry *entry_;
+ const Entry* entry_;
// The next instruction to process.
- const uint8_t *cursor_;
+ const uint8_t* cursor_;
// The current set of rules.
RuleMap rules_;
@@ -2078,7 +2078,7 @@ class CallFrameInfo::State {
std::stack<RuleMap> saved_rules_;
};
-bool CallFrameInfo::State::InterpretCIE(const CIE &cie) {
+bool CallFrameInfo::State::InterpretCIE(const CIE& cie) {
entry_ = &cie;
cursor_ = entry_->instructions;
while (cursor_ < entry_->end)
@@ -2090,7 +2090,7 @@ bool CallFrameInfo::State::InterpretCIE(const CIE &cie) {
return true;
}
-bool CallFrameInfo::State::InterpretFDE(const FDE &fde) {
+bool CallFrameInfo::State::InterpretFDE(const FDE& fde) {
entry_ = &fde;
cursor_ = entry_->instructions;
while (cursor_ < entry_->end)
@@ -2099,10 +2099,10 @@ bool CallFrameInfo::State::InterpretFDE(const FDE &fde) {
return true;
}
-bool CallFrameInfo::State::ParseOperands(const char *format,
- Operands *operands) {
+bool CallFrameInfo::State::ParseOperands(const char* format,
+ Operands* operands) {
size_t len;
- const char *operand;
+ const char* operand;
for (operand = format; *operand; operand++) {
size_t bytes_left = entry_->end - cursor_;
@@ -2161,7 +2161,7 @@ bool CallFrameInfo::State::ParseOperands(const char *format,
if (len > bytes_left || expression_length > bytes_left - len)
return ReportIncomplete();
cursor_ += len;
- operands->expression = string(reinterpret_cast<const char *>(cursor_),
+ operands->expression = string(reinterpret_cast<const char*>(cursor_),
expression_length);
cursor_ += expression_length;
break;
@@ -2176,7 +2176,7 @@ bool CallFrameInfo::State::ParseOperands(const char *format,
}
bool CallFrameInfo::State::DoInstruction() {
- CIE *cie = entry_->cie;
+ CIE* cie = entry_->cie;
Operands ops;
// Our entry's kind should have been set by now.
@@ -2266,7 +2266,7 @@ bool CallFrameInfo::State::DoInstruction() {
// Change the base register used to compute the CFA.
case DW_CFA_def_cfa_register: {
if (!ParseOperands("r", &ops)) return false;
- Rule *cfa_rule = rules_.CFARule();
+ Rule* cfa_rule = rules_.CFARule();
if (!cfa_rule) {
if (!DoDefCFA(ops.register_number, ops.offset)) {
reporter_->NoCFARule(entry_->offset, entry_->kind, CursorOffset());
@@ -2299,7 +2299,7 @@ bool CallFrameInfo::State::DoInstruction() {
case DW_CFA_def_cfa_expression: {
if (!ParseOperands("e", &ops))
return false;
- Rule *rule = new ValExpressionRule(ops.expression);
+ Rule* rule = new ValExpressionRule(ops.expression);
rules_.SetCFARule(rule);
if (!rule->Handle(handler_, address_,
Handler::kCFARegister))
@@ -2406,7 +2406,7 @@ bool CallFrameInfo::State::DoInstruction() {
CursorOffset());
return false;
}
- const RuleMap &new_rules = saved_rules_.top();
+ const RuleMap& new_rules = saved_rules_.top();
if (rules_.CFARule() && !new_rules.CFARule()) {
reporter_->ClearingCFARule(entry_->offset, entry_->kind,
CursorOffset());
@@ -2458,14 +2458,14 @@ bool CallFrameInfo::State::DoInstruction() {
}
bool CallFrameInfo::State::DoDefCFA(unsigned base_register, long offset) {
- Rule *rule = new ValOffsetRule(base_register, offset);
+ Rule* rule = new ValOffsetRule(base_register, offset);
rules_.SetCFARule(rule);
return rule->Handle(handler_, address_,
Handler::kCFARegister);
}
bool CallFrameInfo::State::DoDefCFAOffset(long offset) {
- Rule *cfa_rule = rules_.CFARule();
+ Rule* cfa_rule = rules_.CFARule();
if (!cfa_rule) {
reporter_->NoCFARule(entry_->offset, entry_->kind, CursorOffset());
return false;
@@ -2475,7 +2475,7 @@ bool CallFrameInfo::State::DoDefCFAOffset(long offset) {
Handler::kCFARegister);
}
-bool CallFrameInfo::State::DoRule(unsigned reg, Rule *rule) {
+bool CallFrameInfo::State::DoRule(unsigned reg, Rule* rule) {
rules_.SetRegisterRule(reg, rule);
return rule->Handle(handler_, address_, reg);
}
@@ -2504,7 +2504,7 @@ bool CallFrameInfo::State::DoRestore(unsigned reg) {
reporter_->RestoreInCIE(entry_->offset, CursorOffset());
return false;
}
- Rule *rule = cie_rules_.RegisterRule(reg);
+ Rule* rule = cie_rules_.RegisterRule(reg);
if (!rule) {
// This isn't really the right thing to do, but since CFI generally
// only mentions callee-saves registers, and GCC's convention for
@@ -2515,8 +2515,8 @@ bool CallFrameInfo::State::DoRestore(unsigned reg) {
return DoRule(reg, rule);
}
-bool CallFrameInfo::ReadEntryPrologue(const uint8_t *cursor, Entry *entry) {
- const uint8_t *buffer_end = buffer_ + buffer_length_;
+bool CallFrameInfo::ReadEntryPrologue(const uint8_t* cursor, Entry* entry) {
+ const uint8_t* buffer_end = buffer_ + buffer_length_;
// Initialize enough of ENTRY for use in error reporting.
entry->offset = cursor - buffer_;
@@ -2593,8 +2593,8 @@ bool CallFrameInfo::ReadEntryPrologue(const uint8_t *cursor, Entry *entry) {
return true;
}
-bool CallFrameInfo::ReadCIEFields(CIE *cie) {
- const uint8_t *cursor = cie->fields;
+bool CallFrameInfo::ReadCIEFields(CIE* cie) {
+ const uint8_t* cursor = cie->fields;
size_t len;
assert(cie->kind == kCIE);
@@ -2625,13 +2625,13 @@ bool CallFrameInfo::ReadCIEFields(CIE *cie) {
return false;
}
- const uint8_t *augmentation_start = cursor;
- const uint8_t *augmentation_end =
- reinterpret_cast<const uint8_t *>(memchr(augmentation_start, '\0',
+ const uint8_t* augmentation_start = cursor;
+ const uint8_t* augmentation_end =
+ reinterpret_cast<const uint8_t*>(memchr(augmentation_start, '\0',
cie->end - augmentation_start));
if (! augmentation_end) return ReportIncomplete(cie);
cursor = augmentation_end;
- cie->augmentation = string(reinterpret_cast<const char *>(augmentation_start),
+ cie->augmentation = string(reinterpret_cast<const char*>(augmentation_start),
cursor - augmentation_start);
// Skip the terminating '\0'.
cursor++;
@@ -2692,9 +2692,9 @@ bool CallFrameInfo::ReadCIEFields(CIE *cie) {
if (size_t(cie->end - cursor) < len + data_size)
return ReportIncomplete(cie);
cursor += len;
- const uint8_t *data = cursor;
+ const uint8_t* data = cursor;
cursor += data_size;
- const uint8_t *data_end = cursor;
+ const uint8_t* data_end = cursor;
cie->has_z_lsda = false;
cie->has_z_personality = false;
@@ -2785,8 +2785,8 @@ bool CallFrameInfo::ReadCIEFields(CIE *cie) {
return true;
}
-bool CallFrameInfo::ReadFDEFields(FDE *fde) {
- const uint8_t *cursor = fde->fields;
+bool CallFrameInfo::ReadFDEFields(FDE* fde) {
+ const uint8_t* cursor = fde->fields;
size_t size;
fde->address = reader_->ReadEncodedPointer(cursor, fde->cie->pointer_encoding,
@@ -2852,10 +2852,10 @@ bool CallFrameInfo::ReadFDEFields(FDE *fde) {
}
bool CallFrameInfo::Start() {
- const uint8_t *buffer_end = buffer_ + buffer_length_;
- const uint8_t *cursor;
+ const uint8_t* buffer_end = buffer_ + buffer_length_;
+ const uint8_t* cursor;
bool all_ok = true;
- const uint8_t *entry_end;
+ const uint8_t* entry_end;
bool ok;
// Traverse all the entries in buffer_, skipping CIEs and offering
@@ -2986,7 +2986,7 @@ bool CallFrameInfo::Start() {
return all_ok;
}
-const char *CallFrameInfo::KindName(EntryKind kind) {
+const char* CallFrameInfo::KindName(EntryKind kind) {
if (kind == CallFrameInfo::kUnknown)
return "entry";
else if (kind == CallFrameInfo::kCIE)
@@ -2999,7 +2999,7 @@ const char *CallFrameInfo::KindName(EntryKind kind) {
}
}
-bool CallFrameInfo::ReportIncomplete(Entry *entry) {
+bool CallFrameInfo::ReportIncomplete(Entry* entry) {
reporter_->Incomplete(entry->offset, entry->kind);
return false;
}
@@ -3058,7 +3058,7 @@ void CallFrameInfo::Reporter::UnrecognizedVersion(uint64_t offset, int version)
}
void CallFrameInfo::Reporter::UnrecognizedAugmentation(uint64_t offset,
- const string &aug) {
+ const string& aug) {
fprintf(stderr,
"%s: CFI frame description entry at offset 0x%" PRIx64 " in '%s':"
" CIE specifies unrecognized augmentation: '%s'\n",
diff --git a/src/common/dwarf/dwarf2reader.h b/src/common/dwarf/dwarf2reader.h
index e52f74c5..83cd6767 100644
--- a/src/common/dwarf/dwarf2reader.h
+++ b/src/common/dwarf/dwarf2reader.h
@@ -64,13 +64,13 @@ class DwpReader;
// This maps from a string naming a section to a pair containing a
// the data for the section, and the size of the section.
-typedef std::map<string, std::pair<const uint8_t *, uint64_t> > SectionMap;
+typedef std::map<string, std::pair<const uint8_t*, uint64_t> > SectionMap;
// Abstract away the difference between elf and mach-o section names.
// Elf-names use ".section_name, mach-o uses "__section_name". Pass "name" in
// the elf form, ".section_name".
const SectionMap::const_iterator GetSectionByName(const SectionMap&
- sections, const char *name);
+ sections, const char* name);
typedef std::list<std::pair<enum DwarfAttribute, enum DwarfForm> >
AttributeList;
@@ -88,7 +88,7 @@ struct LineInfoHeader {
uint8_t opcode_base;
// Use a pointer so that signalsafe_addr2line is able to use this structure
// without heap allocation problem.
- std::vector<unsigned char> *std_opcode_lengths;
+ std::vector<unsigned char>* std_opcode_lengths;
};
class LineInfo {
@@ -125,12 +125,12 @@ class LineInfo {
// lsm's old address < PC <= lsm's new address
static bool ProcessOneOpcode(ByteReader* reader,
LineInfoHandler* handler,
- const struct LineInfoHeader &header,
- const uint8_t *start,
+ const struct LineInfoHeader& header,
+ const uint8_t* start,
struct LineStateMachine* lsm,
size_t* len,
uintptr pc,
- bool *lsm_passes_pc);
+ bool* lsm_passes_pc);
private:
// Reads the DWARF2/3 header for this line info.
@@ -171,7 +171,7 @@ class LineInfo {
// buffer is the buffer for our line info, starting at exactly where
// the line info to read is. after_header is the place right after
// the end of the line information header.
- const uint8_t *buffer_;
+ const uint8_t* buffer_;
#ifndef NDEBUG
uint64_t buffer_length_;
#endif
@@ -182,7 +182,7 @@ class LineInfo {
const uint8_t* line_string_buffer_;
uint64_t line_string_buffer_length_;
- const uint8_t *after_header_;
+ const uint8_t* after_header_;
};
// This class is the main interface between the line info reader and
@@ -239,16 +239,16 @@ class RangeListHandler {
class RangeListReader {
public:
- RangeListReader(const uint8_t *buffer, uint64_t size, ByteReader *reader,
- RangeListHandler *handler);
+ RangeListReader(const uint8_t* buffer, uint64_t size, ByteReader* reader,
+ RangeListHandler* handler);
bool ReadRangeList(uint64_t offset);
private:
- const uint8_t *buffer_;
+ const uint8_t* buffer_;
uint64_t size_;
ByteReader* reader_;
- RangeListHandler *handler_;
+ RangeListHandler* handler_;
};
// This class is the main interface between the reader and the
@@ -322,7 +322,7 @@ class Dwarf2Handler {
virtual void ProcessAttributeBuffer(uint64_t offset,
enum DwarfAttribute attr,
enum DwarfForm form,
- const uint8_t *data,
+ const uint8_t* data,
uint64_t len) { }
// Called when we have an attribute with string data to give to our handler.
@@ -461,14 +461,14 @@ class CompilationUnit {
// Processes a single DIE for this compilation unit and return a new
// pointer just past the end of it
- const uint8_t *ProcessDIE(uint64_t dieoffset,
- const uint8_t *start,
+ const uint8_t* ProcessDIE(uint64_t dieoffset,
+ const uint8_t* start,
const Abbrev& abbrev);
// Processes a single attribute and return a new pointer just past the
// end of it
- const uint8_t *ProcessAttribute(uint64_t dieoffset,
- const uint8_t *start,
+ const uint8_t* ProcessAttribute(uint64_t dieoffset,
+ const uint8_t* start,
enum DwarfAttribute attr,
enum DwarfForm form);
@@ -564,11 +564,11 @@ class CompilationUnit {
// Skips the die with attributes specified in ABBREV starting at
// START, and return the new place to position the stream to.
- const uint8_t *SkipDIE(const uint8_t *start, const Abbrev& abbrev);
+ const uint8_t* SkipDIE(const uint8_t* start, const Abbrev& abbrev);
// Skips the attribute starting at START, with FORM, and return the
// new place to position the stream to.
- const uint8_t *SkipAttribute(const uint8_t *start, enum DwarfForm form);
+ const uint8_t* SkipAttribute(const uint8_t* start, enum DwarfForm form);
// Process the actual debug information in a split DWARF file.
void ProcessSplitDwarf();
@@ -587,9 +587,9 @@ class CompilationUnit {
// buffer is the buffer for our CU, starting at .debug_info + offset
// passed in from constructor.
// after_header points to right after the compilation unit header.
- const uint8_t *buffer_;
+ const uint8_t* buffer_;
uint64_t buffer_length_;
- const uint8_t *after_header_;
+ const uint8_t* after_header_;
// The associated ByteReader that handles endianness issues for us
ByteReader* reader_;
@@ -608,7 +608,7 @@ class CompilationUnit {
// String section buffer and length, if we have a string section.
// This is here to avoid doing a section lookup for strings in
// ProcessAttribute, which is in the hot path for DWARF2 reading.
- const uint8_t *string_buffer_;
+ const uint8_t* string_buffer_;
uint64_t string_buffer_length_;
// Similarly for .debug_line_string.
@@ -984,8 +984,8 @@ class CallFrameInfo {
// The mechanics of C++ exception handling, personality routines,
// and language-specific data areas are described here, rather nicely:
// http://www.codesourcery.com/public/cxx-abi/abi-eh.html
- CallFrameInfo(const uint8_t *buffer, size_t buffer_length,
- ByteReader *reader, Handler *handler, Reporter *reporter,
+ CallFrameInfo(const uint8_t* buffer, size_t buffer_length,
+ ByteReader* reader, Handler* handler, Reporter* reporter,
bool eh_frame = false)
: buffer_(buffer), buffer_length_(buffer_length),
reader_(reader), handler_(handler), reporter_(reporter),
@@ -999,7 +999,7 @@ class CallFrameInfo {
bool Start();
// Return the textual name of KIND. For error reporting.
- static const char *KindName(EntryKind kind);
+ static const char* KindName(EntryKind kind);
private:
@@ -1012,7 +1012,7 @@ class CallFrameInfo {
size_t offset;
// The start of this entry in the buffer.
- const uint8_t *start;
+ const uint8_t* start;
// Which kind of entry this is.
//
@@ -1023,16 +1023,16 @@ class CallFrameInfo {
// The end of this entry's common prologue (initial length and id), and
// the start of this entry's kind-specific fields.
- const uint8_t *fields;
+ const uint8_t* fields;
// The start of this entry's instructions.
- const uint8_t *instructions;
+ const uint8_t* instructions;
// The address past the entry's last byte in the buffer. (Note that
// since offset points to the entry's initial length field, and the
// length field is the number of bytes after that field, this is not
// simply buffer_ + offset + length.)
- const uint8_t *end;
+ const uint8_t* end;
// For both DWARF CFI and .eh_frame sections, this is the CIE id in a
// CIE, and the offset of the associated CIE in an FDE.
@@ -1040,7 +1040,7 @@ class CallFrameInfo {
// The CIE that applies to this entry, if we've parsed it. If this is a
// CIE, then this field points to this structure.
- CIE *cie;
+ CIE* cie;
};
// A common information entry (CIE).
@@ -1114,14 +1114,14 @@ class CallFrameInfo {
// true. On failure, report the problem, and return false. Even if we
// return false, set ENTRY->end to the first byte after the entry if we
// were able to figure that out, or NULL if we weren't.
- bool ReadEntryPrologue(const uint8_t *cursor, Entry *entry);
+ bool ReadEntryPrologue(const uint8_t* cursor, Entry* entry);
// Parse the fields of a CIE after the entry prologue, including any 'z'
// augmentation data. Assume that the 'Entry' fields of CIE are
// populated; use CIE->fields and CIE->end as the start and limit for
// parsing. On success, populate the rest of *CIE, and return true; on
// failure, report the problem and return false.
- bool ReadCIEFields(CIE *cie);
+ bool ReadCIEFields(CIE* cie);
// Parse the fields of an FDE after the entry prologue, including any 'z'
// augmentation data. Assume that the 'Entry' fields of *FDE are
@@ -1129,12 +1129,12 @@ class CallFrameInfo {
// parsing. Assume that FDE->cie is fully initialized. On success,
// populate the rest of *FDE, and return true; on failure, report the
// problem and return false.
- bool ReadFDEFields(FDE *fde);
+ bool ReadFDEFields(FDE* fde);
// Report that ENTRY is incomplete, and return false. This is just a
// trivial wrapper for invoking reporter_->Incomplete; it provides a
// little brevity.
- bool ReportIncomplete(Entry *entry);
+ bool ReportIncomplete(Entry* entry);
// Return true if ENCODING has the DW_EH_PE_indirect bit set.
static bool IsIndirectEncoding(DwarfPointerEncoding encoding) {
@@ -1142,17 +1142,17 @@ class CallFrameInfo {
}
// The contents of the DWARF .debug_info section we're parsing.
- const uint8_t *buffer_;
+ const uint8_t* buffer_;
size_t buffer_length_;
// For reading multi-byte values with the appropriate endianness.
- ByteReader *reader_;
+ ByteReader* reader_;
// The handler to which we should report the data we find.
- Handler *handler_;
+ Handler* handler_;
// For reporting problems in the info we're parsing.
- Reporter *reporter_;
+ Reporter* reporter_;
// True if we are processing .eh_frame-format data.
bool eh_frame_;
@@ -1185,7 +1185,7 @@ class CallFrameInfo::Handler {
// process a given FDE, the parser reiterates the appropriate CIE's
// contents at the beginning of the FDE's rules.
virtual bool Entry(size_t offset, uint64_t address, uint64_t length,
- uint8_t version, const string &augmentation,
+ uint8_t version, const string& augmentation,
unsigned return_address) = 0;
// When the Entry function returns true, the parser calls these
@@ -1234,13 +1234,13 @@ class CallFrameInfo::Handler {
// At ADDRESS, the DWARF expression EXPRESSION yields the address at
// which REG was saved.
virtual bool ExpressionRule(uint64_t address, int reg,
- const string &expression) = 0;
+ const string& expression) = 0;
// At ADDRESS, the DWARF expression EXPRESSION yields the caller's
// value for REG. (This rule doesn't provide an address at which the
// register's value is saved.)
virtual bool ValExpressionRule(uint64_t address, int reg,
- const string &expression) = 0;
+ const string& expression) = 0;
// Indicate that the rules for the address range reported by the
// last call to Entry are complete. End should return true if
@@ -1317,8 +1317,8 @@ class CallFrameInfo::Reporter {
// in a Mach-O section named __debug_frame. If we support
// Linux-style exception handling data, we could be reading an
// .eh_frame section.
- Reporter(const string &filename,
- const string &section = ".debug_frame")
+ Reporter(const string& filename,
+ const string& section = ".debug_frame")
: filename_(filename), section_(section) { }
virtual ~Reporter() { }
@@ -1358,7 +1358,7 @@ class CallFrameInfo::Reporter {
// which we don't recognize. We cannot parse DWARF CFI if it uses
// augmentations we don't recognize.
virtual void UnrecognizedAugmentation(uint64_t offset,
- const string &augmentation);
+ const string& augmentation);
// The pointer encoding ENCODING, specified by the CIE at OFFSET, is not
// a valid encoding.
diff --git a/src/common/dwarf/dwarf2reader_cfi_unittest.cc b/src/common/dwarf/dwarf2reader_cfi_unittest.cc
index ebe612e1..8e5d68b4 100644
--- a/src/common/dwarf/dwarf2reader_cfi_unittest.cc
+++ b/src/common/dwarf/dwarf2reader_cfi_unittest.cc
@@ -87,7 +87,7 @@ using testing::_;
#ifdef WRITE_ELF
void WriteELFFrameSection(const char *filename, const char *section_name,
- const CFISection &section);
+ const CFISection& section);
#define PERHAPS_WRITE_DEBUG_FRAME_FILE(name, section) \
WriteELFFrameSection("cfitest-" name, ".debug_frame", section);
#define PERHAPS_WRITE_EH_FRAME_FILE(name, section) \
@@ -100,7 +100,7 @@ void WriteELFFrameSection(const char *filename, const char *section_name,
class MockCallFrameInfoHandler: public CallFrameInfo::Handler {
public:
MOCK_METHOD6(Entry, bool(size_t offset, uint64_t address, uint64_t length,
- uint8_t version, const string &augmentation,
+ uint8_t version, const string& augmentation,
unsigned return_address));
MOCK_METHOD2(UndefinedRule, bool(uint64_t address, int reg));
MOCK_METHOD2(SameValueRule, bool(uint64_t address, int reg));
@@ -110,9 +110,9 @@ class MockCallFrameInfoHandler: public CallFrameInfo::Handler {
long offset));
MOCK_METHOD3(RegisterRule, bool(uint64_t address, int reg, int base_register));
MOCK_METHOD3(ExpressionRule, bool(uint64_t address, int reg,
- const string &expression));
+ const string& expression));
MOCK_METHOD3(ValExpressionRule, bool(uint64_t address, int reg,
- const string &expression));
+ const string& expression));
MOCK_METHOD0(End, bool());
MOCK_METHOD2(PersonalityRoutine, bool(uint64_t address, bool indirect));
MOCK_METHOD2(LanguageSpecificDataArea, bool(uint64_t address, bool indirect));
@@ -129,7 +129,7 @@ class MockCallFrameErrorReporter: public CallFrameInfo::Reporter {
MOCK_METHOD2(UnexpectedAddressSize, void(uint64_t, uint8_t));
MOCK_METHOD2(UnexpectedSegmentSize, void(uint64_t, uint8_t));
MOCK_METHOD2(UnrecognizedVersion, void(uint64_t, int version));
- MOCK_METHOD2(UnrecognizedAugmentation, void(uint64_t, const string &));
+ MOCK_METHOD2(UnrecognizedAugmentation, void(uint64_t, const string&));
MOCK_METHOD2(InvalidPointerEncoding, void(uint64_t, uint8_t));
MOCK_METHOD2(UnusablePointerEncoding, void(uint64_t, uint8_t));
MOCK_METHOD2(RestoreInCIE, void(uint64_t, uint64_t));
@@ -218,7 +218,7 @@ TEST_F(CFI, IncompleteLength32) {
ByteReader byte_reader(ENDIANNESS_BIG);
byte_reader.SetAddressSize(8);
- CallFrameInfo parser(reinterpret_cast<const uint8_t *>(contents.data()),
+ CallFrameInfo parser(reinterpret_cast<const uint8_t*>(contents.data()),
contents.size() - 2,
&byte_reader, &handler, &reporter);
EXPECT_FALSE(parser.Start());
@@ -244,7 +244,7 @@ TEST_F(CFI, IncompleteLength64) {
ByteReader byte_reader(ENDIANNESS_LITTLE);
byte_reader.SetAddressSize(4);
- CallFrameInfo parser(reinterpret_cast<const uint8_t *>(contents.data()),
+ CallFrameInfo parser(reinterpret_cast<const uint8_t*>(contents.data()),
contents.size() - 4,
&byte_reader, &handler, &reporter);
EXPECT_FALSE(parser.Start());
@@ -269,7 +269,7 @@ TEST_F(CFI, IncompleteId32) {
ByteReader byte_reader(ENDIANNESS_BIG);
byte_reader.SetAddressSize(8);
- CallFrameInfo parser(reinterpret_cast<const uint8_t *>(contents.data()),
+ CallFrameInfo parser(reinterpret_cast<const uint8_t*>(contents.data()),
contents.size(),
&byte_reader, &handler, &reporter);
EXPECT_FALSE(parser.Start());
@@ -296,7 +296,7 @@ TEST_F(CFI, BadId32) {
ByteReader byte_reader(ENDIANNESS_BIG);
byte_reader.SetAddressSize(8);
- CallFrameInfo parser(reinterpret_cast<const uint8_t *>(contents.data()),
+ CallFrameInfo parser(reinterpret_cast<const uint8_t*>(contents.data()),
contents.size(),
&byte_reader, &handler, &reporter);
EXPECT_FALSE(parser.Start());
@@ -318,7 +318,7 @@ TEST_F(CFI, SingleCIE) {
EXPECT_TRUE(section.GetContents(&contents));
ByteReader byte_reader(ENDIANNESS_LITTLE);
byte_reader.SetAddressSize(4);
- CallFrameInfo parser(reinterpret_cast<const uint8_t *>(contents.data()),
+ CallFrameInfo parser(reinterpret_cast<const uint8_t*>(contents.data()),
contents.size(),
&byte_reader, &handler, &reporter);
EXPECT_TRUE(parser.Start());
@@ -349,7 +349,7 @@ TEST_F(CFI, OneFDE) {
EXPECT_TRUE(section.GetContents(&contents));
ByteReader byte_reader(ENDIANNESS_BIG);
byte_reader.SetAddressSize(4);
- CallFrameInfo parser(reinterpret_cast<const uint8_t *>(contents.data()),
+ CallFrameInfo parser(reinterpret_cast<const uint8_t*>(contents.data()),
contents.size(),
&byte_reader, &handler, &reporter);
EXPECT_TRUE(parser.Start());
@@ -393,7 +393,7 @@ TEST_F(CFI, TwoFDEsOneCIE) {
EXPECT_TRUE(section.GetContents(&contents));
ByteReader byte_reader(ENDIANNESS_BIG);
byte_reader.SetAddressSize(4);
- CallFrameInfo parser(reinterpret_cast<const uint8_t *>(contents.data()),
+ CallFrameInfo parser(reinterpret_cast<const uint8_t*>(contents.data()),
contents.size(),
&byte_reader, &handler, &reporter);
EXPECT_TRUE(parser.Start());
@@ -443,7 +443,7 @@ TEST_F(CFI, TwoFDEsTwoCIEs) {
EXPECT_TRUE(section.GetContents(&contents));
ByteReader byte_reader(ENDIANNESS_LITTLE);
byte_reader.SetAddressSize(8);
- CallFrameInfo parser(reinterpret_cast<const uint8_t *>(contents.data()),
+ CallFrameInfo parser(reinterpret_cast<const uint8_t*>(contents.data()),
contents.size(),
&byte_reader, &handler, &reporter);
EXPECT_TRUE(parser.Start());
@@ -488,7 +488,7 @@ TEST_F(CFI, BadVersion) {
EXPECT_TRUE(section.GetContents(&contents));
ByteReader byte_reader(ENDIANNESS_BIG);
byte_reader.SetAddressSize(4);
- CallFrameInfo parser(reinterpret_cast<const uint8_t *>(contents.data()),
+ CallFrameInfo parser(reinterpret_cast<const uint8_t*>(contents.data()),
contents.size(),
&byte_reader, &handler, &reporter);
EXPECT_FALSE(parser.Start());
@@ -533,7 +533,7 @@ TEST_F(CFI, BadAugmentation) {
EXPECT_TRUE(section.GetContents(&contents));
ByteReader byte_reader(ENDIANNESS_BIG);
byte_reader.SetAddressSize(4);
- CallFrameInfo parser(reinterpret_cast<const uint8_t *>(contents.data()),
+ CallFrameInfo parser(reinterpret_cast<const uint8_t*>(contents.data()),
contents.size(),
&byte_reader, &handler, &reporter);
EXPECT_FALSE(parser.Start());
@@ -568,7 +568,7 @@ TEST_F(CFI, CIEVersion1ReturnColumn) {
EXPECT_TRUE(section.GetContents(&contents));
ByteReader byte_reader(ENDIANNESS_BIG);
byte_reader.SetAddressSize(4);
- CallFrameInfo parser(reinterpret_cast<const uint8_t *>(contents.data()),
+ CallFrameInfo parser(reinterpret_cast<const uint8_t*>(contents.data()),
contents.size(),
&byte_reader, &handler, &reporter);
EXPECT_TRUE(parser.Start());
@@ -603,7 +603,7 @@ TEST_F(CFI, CIEVersion3ReturnColumn) {
EXPECT_TRUE(section.GetContents(&contents));
ByteReader byte_reader(ENDIANNESS_BIG);
byte_reader.SetAddressSize(4);
- CallFrameInfo parser(reinterpret_cast<const uint8_t *>(contents.data()),
+ CallFrameInfo parser(reinterpret_cast<const uint8_t*>(contents.data()),
contents.size(),
&byte_reader, &handler, &reporter);
EXPECT_TRUE(parser.Start());
@@ -633,7 +633,7 @@ TEST_F(CFI, CIEVersion4AdditionalFields) {
string contents;
EXPECT_TRUE(section.GetContents(&contents));
ByteReader byte_reader(ENDIANNESS_BIG);
- CallFrameInfo parser(reinterpret_cast<const uint8_t *>(contents.data()),
+ CallFrameInfo parser(reinterpret_cast<const uint8_t*>(contents.data()),
contents.size(),
&byte_reader, &handler, &reporter);
EXPECT_TRUE(parser.Start());
@@ -663,7 +663,7 @@ TEST_F(CFI, CIEVersion4AdditionalFields32BitAddress) {
string contents;
EXPECT_TRUE(section.GetContents(&contents));
ByteReader byte_reader(ENDIANNESS_BIG);
- CallFrameInfo parser(reinterpret_cast<const uint8_t *>(contents.data()),
+ CallFrameInfo parser(reinterpret_cast<const uint8_t*>(contents.data()),
contents.size(),
&byte_reader, &handler, &reporter);
EXPECT_TRUE(parser.Start());
@@ -690,7 +690,7 @@ TEST_F(CFI, CIEVersion4AdditionalFieldsUnexpectedAddressSize) {
string contents;
EXPECT_TRUE(section.GetContents(&contents));
ByteReader byte_reader(ENDIANNESS_BIG);
- CallFrameInfo parser(reinterpret_cast<const uint8_t *>(contents.data()),
+ CallFrameInfo parser(reinterpret_cast<const uint8_t*>(contents.data()),
contents.size(),
&byte_reader, &handler, &reporter);
EXPECT_FALSE(parser.Start());
@@ -715,7 +715,7 @@ TEST_F(CFI, CIEVersion4AdditionalFieldsUnexpectedSegmentSize) {
string contents;
EXPECT_TRUE(section.GetContents(&contents));
ByteReader byte_reader(ENDIANNESS_BIG);
- CallFrameInfo parser(reinterpret_cast<const uint8_t *>(contents.data()),
+ CallFrameInfo parser(reinterpret_cast<const uint8_t*>(contents.data()),
contents.size(),
&byte_reader, &handler, &reporter);
EXPECT_FALSE(parser.Start());
@@ -797,7 +797,7 @@ struct CFIInsnFixture: public CFIFixture {
}
ByteReader byte_reader(endianness);
byte_reader.SetAddressSize(section->AddressSize());
- CallFrameInfo parser(reinterpret_cast<const uint8_t *>(contents.data()),
+ CallFrameInfo parser(reinterpret_cast<const uint8_t*>(contents.data()),
contents.size(),
&byte_reader, &handler, &reporter);
if (succeeds)
@@ -2120,10 +2120,10 @@ struct EHFrameFixture: public CFIInsnFixture {
ByteReader byte_reader(endianness);
byte_reader.SetAddressSize(section->AddressSize());
byte_reader.SetCFIDataBase(encoded_pointer_bases.cfi,
- reinterpret_cast<const uint8_t *>(contents.data()));
+ reinterpret_cast<const uint8_t*>(contents.data()));
byte_reader.SetTextBase(encoded_pointer_bases.text);
byte_reader.SetDataBase(encoded_pointer_bases.data);
- CallFrameInfo parser(reinterpret_cast<const uint8_t *>(contents.data()),
+ CallFrameInfo parser(reinterpret_cast<const uint8_t*>(contents.data()),
contents.size(),
&byte_reader, &handler, &reporter, true);
if (succeeds)
@@ -2468,7 +2468,7 @@ struct ELFSectionHeader {
uint64_t entry_size;
};
-void AppendSectionHeader(CFISection *table, const ELFSectionHeader &header) {
+void AppendSectionHeader(CFISection* table, const ELFSectionHeader& header) {
(*table)
.D32(header.name) // name, index in string tbl
.D32(header.type) // type
@@ -2483,7 +2483,7 @@ void AppendSectionHeader(CFISection *table, const ELFSectionHeader &header) {
}
void WriteELFFrameSection(const char *filename, const char *cfi_name,
- const CFISection &cfi) {
+ const CFISection& cfi) {
int elf_class = cfi.AddressSize() == 4 ? ELFCLASS32 : ELFCLASS64;
int elf_data = (cfi.endianness() == kBigEndian
? ELFDATA2MSB : ELFDATA2LSB);
diff --git a/src/common/dwarf/dwarf2reader_die_unittest.cc b/src/common/dwarf/dwarf2reader_die_unittest.cc
index ab9f7cb7..87819322 100644
--- a/src/common/dwarf/dwarf2reader_die_unittest.cc
+++ b/src/common/dwarf/dwarf2reader_die_unittest.cc
@@ -93,7 +93,7 @@ class MockDwarf2Handler: public Dwarf2Handler {
MOCK_METHOD5(ProcessAttributeBuffer, void(uint64_t offset,
enum DwarfAttribute attr,
enum DwarfForm form,
- const uint8_t *data,
+ const uint8_t* data,
uint64_t len));
MOCK_METHOD4(ProcessAttributeString, void(uint64_t offset,
enum DwarfAttribute attr,
@@ -128,17 +128,17 @@ struct DIEFixture {
// to |info|, and whose .debug_abbrev section refers to |abbrevs|. This
// function returns a reference to the same SectionMap each time; new
// calls wipe out maps established by earlier calls.
- const SectionMap &MakeSectionMap() {
+ const SectionMap& MakeSectionMap() {
// Copy the sections' contents into strings that will live as long as
// the map itself.
assert(info.GetContents(&info_contents));
assert(abbrevs.GetContents(&abbrevs_contents));
section_map.clear();
section_map[".debug_info"].first
- = reinterpret_cast<const uint8_t *>(info_contents.data());
+ = reinterpret_cast<const uint8_t*>(info_contents.data());
section_map[".debug_info"].second = info_contents.size();
section_map[".debug_abbrev"].first
- = reinterpret_cast<const uint8_t *>(abbrevs_contents.data());
+ = reinterpret_cast<const uint8_t*>(abbrevs_contents.data());
section_map[".debug_abbrev"].second = abbrevs_contents.size();
return section_map;
}
@@ -240,7 +240,7 @@ struct DwarfFormsFixture: public DIEFixture {
// childless DIE of the given tag, with one attribute of the given name
// and form. The 'info' fixture member is left just after the abbrev
// code, waiting for the attribute value to be appended.
- void StartSingleAttributeDIE(const DwarfHeaderParams &params,
+ void StartSingleAttributeDIE(const DwarfHeaderParams& params,
DwarfTag tag, DwarfAttribute name,
DwarfForm form) {
// Create the abbreviation table.
@@ -260,7 +260,7 @@ struct DwarfFormsFixture: public DIEFixture {
// Set up handler to expect a compilation unit matching |params|,
// containing one childless DIE of the given tag, in the sequence s. Stop
// just before the expectations.
- void ExpectBeginCompilationUnit(const DwarfHeaderParams &params,
+ void ExpectBeginCompilationUnit(const DwarfHeaderParams& params,
DwarfTag tag, uint64_t offset=0) {
EXPECT_CALL(handler,
StartCompilationUnit(offset, params.address_size,
@@ -279,7 +279,7 @@ struct DwarfFormsFixture: public DIEFixture {
.WillOnce(Return());
}
- void ParseCompilationUnit(const DwarfHeaderParams &params,
+ void ParseCompilationUnit(const DwarfHeaderParams& params,
uint64_t offset=0) {
ByteReader byte_reader(params.endianness == kLittleEndian ?
ENDIANNESS_LITTLE : ENDIANNESS_BIG);
diff --git a/src/common/dwarf/dwarf2reader_test_common.h b/src/common/dwarf/dwarf2reader_test_common.h
index c81d54a8..1934094d 100644
--- a/src/common/dwarf/dwarf2reader_test_common.h
+++ b/src/common/dwarf/dwarf2reader_test_common.h
@@ -70,7 +70,7 @@ class TestCompilationUnit: public google_breakpad::test_assembler::Section {
// Append a DWARF compilation unit header to the section, with the given
// DWARF version, abbrev table offset, and address size.
- TestCompilationUnit &Header(int version, const Label &abbrev_offset,
+ TestCompilationUnit& Header(int version, const Label& abbrev_offset,
size_t address_size) {
if (format_size_ == 4) {
D32(length_);
@@ -92,7 +92,7 @@ class TestCompilationUnit: public google_breakpad::test_assembler::Section {
}
// Mark the end of this header's DIEs.
- TestCompilationUnit &Finish() {
+ TestCompilationUnit& Finish() {
length_ = Size() - post_length_offset_;
return *this;
}
@@ -122,7 +122,7 @@ class TestAbbrevTable: public google_breakpad::test_assembler::Section {
// Start a new abbreviation table entry for abbreviation code |code|,
// encoding a DIE whose tag is |tag|, and which has children if and only
// if |has_children| is true.
- TestAbbrevTable &Abbrev(int code, DwarfTag tag, DwarfHasChild has_children) {
+ TestAbbrevTable& Abbrev(int code, DwarfTag tag, DwarfHasChild has_children) {
assert(code != 0);
ULEB128(code);
ULEB128(static_cast<unsigned>(tag));
@@ -132,21 +132,21 @@ class TestAbbrevTable: public google_breakpad::test_assembler::Section {
// Add an attribute to the current abbreviation code whose name is |name|
// and whose form is |form|.
- TestAbbrevTable &Attribute(DwarfAttribute name, DwarfForm form) {
+ TestAbbrevTable& Attribute(DwarfAttribute name, DwarfForm form) {
ULEB128(static_cast<unsigned>(name));
ULEB128(static_cast<unsigned>(form));
return *this;
}
// Finish the current abbreviation code.
- TestAbbrevTable &EndAbbrev() {
+ TestAbbrevTable& EndAbbrev() {
ULEB128(0);
ULEB128(0);
return *this;
}
// Finish the current abbreviation table.
- TestAbbrevTable &EndTable() {
+ TestAbbrevTable& EndTable() {
ULEB128(0);
return *this;
}
diff --git a/src/common/dwarf/elf_reader.cc b/src/common/dwarf/elf_reader.cc
index 1b665213..bbfdba68 100644
--- a/src/common/dwarf/elf_reader.cc
+++ b/src/common/dwarf/elf_reader.cc
@@ -130,11 +130,11 @@ class Elf32 {
static const int kElfClass = ELFCLASS32;
// Given a symbol pointer, return the binding type (eg STB_WEAK).
- static char Bind(const Elf32_Sym *sym) {
+ static char Bind(const Elf32_Sym* sym) {
return ELF32_ST_BIND(sym->st_info);
}
// Given a symbol pointer, return the symbol type (eg STT_FUNC).
- static char Type(const Elf32_Sym *sym) {
+ static char Type(const Elf32_Sym* sym) {
return ELF32_ST_TYPE(sym->st_info);
}
@@ -158,10 +158,10 @@ class Elf64 {
// What should be in the EI_CLASS header.
static const int kElfClass = ELFCLASS64;
- static char Bind(const Elf64_Sym *sym) {
+ static char Bind(const Elf64_Sym* sym) {
return ELF64_ST_BIND(sym->st_info);
}
- static char Type(const Elf64_Sym *sym) {
+ static char Type(const Elf64_Sym* sym) {
return ELF64_ST_TYPE(sym->st_info);
}
static int r_sym(const Elf64_Xword r_info) {
@@ -182,8 +182,8 @@ class Elf64 {
template<class ElfArch>
class ElfSectionReader {
public:
- ElfSectionReader(const char *name, const string &path, int fd,
- const typename ElfArch::Shdr &section_header)
+ ElfSectionReader(const char* name, const string& path, int fd,
+ const typename ElfArch::Shdr& section_header)
: contents_aligned_(NULL),
contents_(NULL),
header_(section_header) {
@@ -199,7 +199,7 @@ class ElfSectionReader {
contents_aligned_ = mmap(NULL, size_aligned_, PROT_READ, MAP_SHARED,
fd, offset_aligned);
// Set where the offset really should begin.
- contents_ = reinterpret_cast<char *>(contents_aligned_) +
+ contents_ = reinterpret_cast<char*>(contents_aligned_) +
(header_.sh_offset - offset_aligned);
// Check for and handle any compressed contents.
@@ -217,24 +217,24 @@ class ElfSectionReader {
}
// Return the section header for this section.
- typename ElfArch::Shdr const &header() const { return header_; }
+ typename ElfArch::Shdr const& header() const { return header_; }
// Return memory at the given offset within this section.
- const char *GetOffset(typename ElfArch::Word bytes) const {
+ const char* GetOffset(typename ElfArch::Word bytes) const {
return contents_ + bytes;
}
- const char *contents() const { return contents_; }
+ const char* contents() const { return contents_; }
size_t section_size() const { return section_size_; }
private:
// page-aligned file contents
- void *contents_aligned_;
+ void* contents_aligned_;
// contents as usable by the client. For non-compressed sections,
// pointer within contents_aligned_ to where the section data
// begins; for compressed sections, pointer to the decompressed
// data.
- char *contents_;
+ char* contents_;
// size of contents_aligned_
size_t size_aligned_;
// size of contents.
@@ -249,7 +249,7 @@ class ElfSectionReader {
template<class ElfArch>
class SymbolIterator {
public:
- SymbolIterator(ElfReaderImpl<ElfArch> *reader,
+ SymbolIterator(ElfReaderImpl<ElfArch>* reader,
typename ElfArch::Word section_type)
: symbol_section_(reader->GetSectionByType(section_type)),
string_section_(NULL),
@@ -280,7 +280,7 @@ class SymbolIterator {
// Return a pointer to the current symbol.
// REQUIRES: !done()
- const typename ElfArch::Sym *GetSymbol() const {
+ const typename ElfArch::Sym* GetSymbol() const {
return reinterpret_cast<const typename ElfArch::Sym*>(
symbol_section_->GetOffset(symbol_within_section_ *
symbol_section_->header().sh_entsize));
@@ -288,7 +288,7 @@ class SymbolIterator {
// Return the name of the current symbol, NULL if it has none.
// REQUIRES: !done()
- const char *GetSymbolName() const {
+ const char* GetSymbolName() const {
int name_offset = GetSymbol()->st_name;
if (name_offset == 0)
return NULL;
@@ -300,8 +300,8 @@ class SymbolIterator {
}
private:
- const ElfSectionReader<ElfArch> *const symbol_section_;
- const ElfSectionReader<ElfArch> *string_section_;
+ const ElfSectionReader<ElfArch>* const symbol_section_;
+ const ElfSectionReader<ElfArch>* string_section_;
int num_symbols_in_section_;
int symbol_within_section_;
};
@@ -326,7 +326,7 @@ static inline bool MyHasSuffixString(const string& str, const string& suffix) {
template<class ElfArch>
class ElfReaderImpl {
public:
- explicit ElfReaderImpl(const string &path, int fd)
+ explicit ElfReaderImpl(const string& path, int fd)
: path_(path),
fd_(fd),
section_headers_(NULL),
@@ -347,7 +347,7 @@ class ElfReaderImpl {
// "opd_section_" must always be checked for NULL before use.
opd_section_ = GetSectionInfoByName(".opd", &opd_info_);
for (unsigned int k = 0u; k < GetNumSections(); ++k) {
- const char *name = GetSectionName(section_headers_[k].sh_name);
+ const char* name = GetSectionName(section_headers_[k].sh_name);
if (strncmp(name, ".text", strlen(".text")) == 0) {
base_for_text_ =
section_headers_[k].sh_addr - section_headers_[k].sh_offset;
@@ -384,7 +384,7 @@ class ElfReaderImpl {
// to see if the ELF file appears to match the current
// architecture. If error is non-NULL, it will be set with a reason
// in case of failure.
- static bool IsArchElfFile(int fd, string *error) {
+ static bool IsArchElfFile(int fd, string* error) {
unsigned char header[EI_NIDENT];
if (pread(fd, header, sizeof(header), 0) != sizeof(header)) {
if (error != NULL) *error = "Could not read header";
@@ -415,7 +415,7 @@ class ElfReaderImpl {
}
// Return true if we can use this symbol in Address-to-Symbol map.
- bool CanUseSymbol(const char *name, const typename ElfArch::Sym *sym) {
+ bool CanUseSymbol(const char* name, const typename ElfArch::Sym* sym) {
// For now we only save FUNC and NOTYPE symbols. For now we just
// care about functions, but some functions written in assembler
// don't have a proper ELF type attached to them, so we store
@@ -444,7 +444,7 @@ class ElfReaderImpl {
// Iterate over the symbols in a section, either SHT_DYNSYM or
// SHT_SYMTAB. Add all symbols to the given SymbolMap.
/*
- void GetSymbolPositions(SymbolMap *symbols,
+ void GetSymbolPositions(SymbolMap* symbols,
typename ElfArch::Word section_type,
uint64_t mem_offset,
uint64_t file_offset) {
@@ -453,10 +453,10 @@ class ElfReaderImpl {
AddrToSymMap addr_to_sym_map;
for (SymbolIterator<ElfArch> it(this, section_type);
!it.done(); it.Next()) {
- const char *name = it.GetSymbolName();
+ const char* name = it.GetSymbolName();
if (name == NULL)
continue;
- const typename ElfArch::Sym *sym = it.GetSymbol();
+ const typename ElfArch::Sym* sym = it.GetSymbol();
if (CanUseSymbol(name, sym)) {
const int sec = sym->st_shndx;
@@ -519,9 +519,9 @@ class ElfReaderImpl {
if (addr_to_sym_map.empty()) {
return;
}
- const ElfSectionReader<ElfArch> *const symbol_section =
+ const ElfSectionReader<ElfArch>* const symbol_section =
this->GetSectionByType(section_type);
- const ElfSectionReader<ElfArch> *const string_section =
+ const ElfSectionReader<ElfArch>* const string_section =
this->GetSection(symbol_section->header().sh_link);
typename AddrToSymMap::iterator curr = addr_to_sym_map.begin();
@@ -532,8 +532,8 @@ class ElfReaderImpl {
for (; curr != addr_to_sym_map.end(); ++curr) {
const uint64_t prev_addr = prev->first;
const uint64_t curr_addr = curr->first;
- const typename ElfArch::Sym *const prev_sym = prev->second;
- const typename ElfArch::Sym *const curr_sym = curr->second;
+ const typename ElfArch::Sym* const prev_sym = prev->second;
+ const typename ElfArch::Sym* const curr_sym = curr->second;
if (prev_addr + prev_sym->st_size <= curr_addr ||
// The next condition is true if two symbols overlap like this:
//
@@ -552,7 +552,7 @@ class ElfReaderImpl {
// (e.g. 0619e071) will produce the current symbol,
// which is the desired outcome.
prev_addr + prev_sym->st_size < curr_addr + curr_sym->st_size) {
- const char *name = string_section->GetOffset(curr_sym->st_name);
+ const char* name = string_section->GetOffset(curr_sym->st_name);
symbols->AddSymbol(name, curr_addr, curr_sym->st_size);
prev = curr;
} else {
@@ -572,20 +572,20 @@ class ElfReaderImpl {
*/
void VisitSymbols(typename ElfArch::Word section_type,
- ElfReader::SymbolSink *sink) {
+ ElfReader::SymbolSink* sink) {
VisitSymbols(section_type, sink, -1, -1, false);
}
void VisitSymbols(typename ElfArch::Word section_type,
- ElfReader::SymbolSink *sink,
+ ElfReader::SymbolSink* sink,
int symbol_binding,
int symbol_type,
bool get_raw_symbol_values) {
for (SymbolIterator<ElfArch> it(this, section_type);
!it.done(); it.Next()) {
- const char *name = it.GetSymbolName();
+ const char* name = it.GetSymbolName();
if (!name) continue;
- const typename ElfArch::Sym *sym = it.GetSymbol();
+ const typename ElfArch::Sym* sym = it.GetSymbol();
if ((symbol_binding < 0 || ElfArch::Bind(sym) == symbol_binding) &&
(symbol_type < 0 || ElfArch::Type(sym) == symbol_type)) {
typename ElfArch::Sym symbol = *sym;
@@ -691,7 +691,7 @@ class ElfReaderImpl {
// Return an ElfSectionReader for the first section of the given
// type by iterating through all section headers. Returns NULL if
// the section type is not found.
- const ElfSectionReader<ElfArch> *GetSectionByType(
+ const ElfSectionReader<ElfArch>* GetSectionByType(
typename ElfArch::Word section_type) {
for (unsigned int k = 0u; k < GetNumSections(); ++k) {
if (section_headers_[k].sh_type == section_type) {
@@ -703,14 +703,14 @@ class ElfReaderImpl {
// Return the name of section "shndx". Returns NULL if the section
// is not found.
- const char *GetSectionNameByIndex(int shndx) {
+ const char* GetSectionNameByIndex(int shndx) {
return GetSectionName(section_headers_[shndx].sh_name);
}
// Return a pointer to section "shndx", and store the size in
// "size". Returns NULL if the section is not found.
- const char *GetSectionContentsByIndex(int shndx, size_t *size) {
- const ElfSectionReader<ElfArch> *section = GetSection(shndx);
+ const char* GetSectionContentsByIndex(int shndx, size_t* size) {
+ const ElfSectionReader<ElfArch>* section = GetSection(shndx);
if (section != NULL) {
*size = section->section_size();
return section->contents();
@@ -721,16 +721,16 @@ class ElfReaderImpl {
// Return a pointer to the first section of the given name by
// iterating through all section headers, and store the size in
// "size". Returns NULL if the section name is not found.
- const char *GetSectionContentsByName(const string &section_name,
- size_t *size) {
+ const char* GetSectionContentsByName(const string& section_name,
+ size_t* size) {
for (unsigned int k = 0u; k < GetNumSections(); ++k) {
// When searching for sections in a .dwp file, the sections
// we're looking for will always be at the end of the section
// table, so reverse the direction of iteration.
int shndx = is_dwp_ ? GetNumSections() - k - 1 : k;
- const char *name = GetSectionName(section_headers_[shndx].sh_name);
+ const char* name = GetSectionName(section_headers_[shndx].sh_name);
if (name != NULL && ElfReader::SectionNamesMatch(section_name, name)) {
- const ElfSectionReader<ElfArch> *section = GetSection(shndx);
+ const ElfSectionReader<ElfArch>* section = GetSection(shndx);
if (section == NULL) {
return NULL;
} else {
@@ -744,16 +744,16 @@ class ElfReaderImpl {
// This is like GetSectionContentsByName() but it returns a lot of extra
// information about the section.
- const char *GetSectionInfoByName(const string &section_name,
- ElfReader::SectionInfo *info) {
+ const char* GetSectionInfoByName(const string& section_name,
+ ElfReader::SectionInfo* info) {
for (unsigned int k = 0u; k < GetNumSections(); ++k) {
// When searching for sections in a .dwp file, the sections
// we're looking for will always be at the end of the section
// table, so reverse the direction of iteration.
int shndx = is_dwp_ ? GetNumSections() - k - 1 : k;
- const char *name = GetSectionName(section_headers_[shndx].sh_name);
+ const char* name = GetSectionName(section_headers_[shndx].sh_name);
if (name != NULL && ElfReader::SectionNamesMatch(section_name, name)) {
- const ElfSectionReader<ElfArch> *section = GetSection(shndx);
+ const ElfSectionReader<ElfArch>* section = GetSection(shndx);
if (section == NULL) {
return NULL;
} else {
@@ -797,7 +797,7 @@ class ElfReaderImpl {
// Debug sections are likely to be near the end, so reverse the
// direction of iteration.
for (int k = GetNumSections() - 1; k >= 0; --k) {
- const char *name = GetSectionName(section_headers_[k].sh_name);
+ const char* name = GetSectionName(section_headers_[k].sh_name);
if (strncmp(name, ".debug", strlen(".debug")) == 0) return true;
if (strncmp(name, ".zdebug", strlen(".zdebug")) == 0) return true;
}
@@ -816,7 +816,7 @@ class ElfReaderImpl {
}
private:
- typedef vector<pair<uint64_t, const typename ElfArch::Sym *> > AddrToSymMap;
+ typedef vector<pair<uint64_t, const typename ElfArch::Sym*> > AddrToSymMap;
static bool AddrToSymSorter(const typename AddrToSymMap::value_type& lhs,
const typename AddrToSymMap::value_type& rhs) {
@@ -854,8 +854,8 @@ class ElfReaderImpl {
// Given an offset into the section header string table, return the
// section name.
- const char *GetSectionName(typename ElfArch::Word sh_name) {
- const ElfSectionReader<ElfArch> *shstrtab =
+ const char* GetSectionName(typename ElfArch::Word sh_name) {
+ const ElfSectionReader<ElfArch>* shstrtab =
GetSection(GetStringTableIndex());
if (shstrtab != NULL) {
return shstrtab->GetOffset(sh_name);
@@ -865,15 +865,15 @@ class ElfReaderImpl {
// Return an ElfSectionReader for the given section. The reader will
// be freed when this object is destroyed.
- const ElfSectionReader<ElfArch> *GetSection(int num) {
- const char *name;
+ const ElfSectionReader<ElfArch>* GetSection(int num) {
+ const char* name;
// Hard-coding the name for the section-name string table prevents
// infinite recursion.
if (num == GetStringTableIndex())
name = ".shstrtab";
else
name = GetSectionNameByIndex(num);
- ElfSectionReader<ElfArch> *& reader = sections_[num];
+ ElfSectionReader<ElfArch>*& reader = sections_[num];
if (reader == NULL)
reader = new ElfSectionReader<ElfArch>(name, path_, fd_,
section_headers_[num]);
@@ -883,7 +883,7 @@ class ElfReaderImpl {
// Parse out the overall header information from the file and assert
// that it looks sane. This contains information like the magic
// number and target architecture.
- bool ParseHeaders(int fd, const string &path) {
+ bool ParseHeaders(int fd, const string& path) {
// Read in the global ELF header.
if (pread(fd, &header_, sizeof(header_), 0) != sizeof(header_)) {
return false;
@@ -985,11 +985,11 @@ class ElfReaderImpl {
// Array of GetNumSections() section headers, allocated when we read
// in the global header.
- typename ElfArch::Shdr *section_headers_;
+ typename ElfArch::Shdr* section_headers_;
// Array of GetNumProgramHeaders() program headers, allocated when we read
// in the global header.
- typename ElfArch::Phdr *program_headers_;
+ typename ElfArch::Phdr* program_headers_;
// An array of pointers to ElfSectionReaders. Sections are
// mmaped as they're needed and not released until this object is
@@ -1000,7 +1000,7 @@ class ElfReaderImpl {
// values for funtion symbols values. Function descriptors are kept in the
// .opd section and are dereferenced to find the function address.
ElfReader::SectionInfo opd_info_;
- const char *opd_section_; // Must be checked for NULL before use.
+ const char* opd_section_; // Must be checked for NULL before use.
int64_t base_for_text_;
// Read PLT-related sections for the current architecture.
@@ -1026,7 +1026,7 @@ class ElfReaderImpl {
bool is_dwp_;
};
-ElfReader::ElfReader(const string &path)
+ElfReader::ElfReader(const string& path)
: path_(path), fd_(-1), impl32_(NULL), impl64_(NULL) {
// linux 2.6.XX kernel can show deleted files like this:
// /var/run/nscd/dbYLJYaE (deleted)
@@ -1063,7 +1063,7 @@ ElfReader::~ElfReader() {
#endif
template <typename ElfArch>
-static bool IsElfFile(const int fd, const string &path) {
+static bool IsElfFile(const int fd, const string& path) {
if (fd < 0)
return false;
if (!ElfReaderImpl<ElfArch>::IsArchElfFile(fd, NULL)) {
@@ -1086,7 +1086,7 @@ bool ElfReader::IsElf64File() const {
}
/*
-void ElfReader::AddSymbols(SymbolMap *symbols,
+void ElfReader::AddSymbols(SymbolMap* symbols,
uint64_t mem_offset, uint64_t file_offset,
uint64_t length) {
if (fd_ < 0)
@@ -1109,17 +1109,17 @@ void ElfReader::AddSymbols(SymbolMap *symbols,
}
*/
-void ElfReader::VisitSymbols(ElfReader::SymbolSink *sink) {
+void ElfReader::VisitSymbols(ElfReader::SymbolSink* sink) {
VisitSymbols(sink, -1, -1);
}
-void ElfReader::VisitSymbols(ElfReader::SymbolSink *sink,
+void ElfReader::VisitSymbols(ElfReader::SymbolSink* sink,
int symbol_binding,
int symbol_type) {
VisitSymbols(sink, symbol_binding, symbol_type, false);
}
-void ElfReader::VisitSymbols(ElfReader::SymbolSink *sink,
+void ElfReader::VisitSymbols(ElfReader::SymbolSink* sink,
int symbol_binding,
int symbol_type,
bool get_raw_symbol_values) {
@@ -1148,7 +1148,7 @@ uint64_t ElfReader::VaddrOfFirstLoadSegment() {
}
}
-const char *ElfReader::GetSectionName(int shndx) {
+const char* ElfReader::GetSectionName(int shndx) {
if (shndx < 0 || static_cast<unsigned int>(shndx) >= GetNumSections()) return NULL;
if (IsElf32File()) {
return GetImpl32()->GetSectionNameByIndex(shndx);
@@ -1169,7 +1169,7 @@ uint64_t ElfReader::GetNumSections() {
}
}
-const char *ElfReader::GetSectionByIndex(int shndx, size_t *size) {
+const char* ElfReader::GetSectionByIndex(int shndx, size_t* size) {
if (IsElf32File()) {
return GetImpl32()->GetSectionContentsByIndex(shndx, size);
} else if (IsElf64File()) {
@@ -1179,8 +1179,8 @@ const char *ElfReader::GetSectionByIndex(int shndx, size_t *size) {
}
}
-const char *ElfReader::GetSectionByName(const string &section_name,
- size_t *size) {
+const char* ElfReader::GetSectionByName(const string& section_name,
+ size_t* size) {
if (IsElf32File()) {
return GetImpl32()->GetSectionContentsByName(section_name, size);
} else if (IsElf64File()) {
@@ -1190,8 +1190,8 @@ const char *ElfReader::GetSectionByName(const string &section_name,
}
}
-const char *ElfReader::GetSectionInfoByName(const string &section_name,
- SectionInfo *info) {
+const char* ElfReader::GetSectionInfoByName(const string& section_name,
+ SectionInfo* info) {
if (IsElf32File()) {
return GetImpl32()->GetSectionInfoByName(section_name, info);
} else if (IsElf64File()) {
@@ -1201,7 +1201,7 @@ const char *ElfReader::GetSectionInfoByName(const string &section_name,
}
}
-bool ElfReader::SectionNamesMatch(const string &name, const string &sh_name) {
+bool ElfReader::SectionNamesMatch(const string& name, const string& sh_name) {
if ((name.find(".debug_", 0) == 0) && (sh_name.find(".zdebug_", 0) == 0)) {
const string name_suffix(name, strlen(".debug_"));
const string sh_name_suffix(sh_name, strlen(".zdebug_"));
@@ -1220,14 +1220,14 @@ bool ElfReader::IsDynamicSharedObject() {
}
}
-ElfReaderImpl<Elf32> *ElfReader::GetImpl32() {
+ElfReaderImpl<Elf32>* ElfReader::GetImpl32() {
if (impl32_ == NULL) {
impl32_ = new ElfReaderImpl<Elf32>(path_, fd_);
}
return impl32_;
}
-ElfReaderImpl<Elf64> *ElfReader::GetImpl64() {
+ElfReaderImpl<Elf64>* ElfReader::GetImpl64() {
if (impl64_ == NULL) {
impl64_ = new ElfReaderImpl<Elf64>(path_, fd_);
}
@@ -1238,7 +1238,7 @@ ElfReaderImpl<Elf64> *ElfReader::GetImpl64() {
// debug info (debug_only=true) or symbol table (debug_only=false).
// Otherwise, return false.
template <typename ElfArch>
-static bool IsNonStrippedELFBinaryImpl(const string &path, const int fd,
+static bool IsNonStrippedELFBinaryImpl(const string& path, const int fd,
bool debug_only) {
if (!ElfReaderImpl<ElfArch>::IsArchElfFile(fd, NULL)) return false;
ElfReaderImpl<ElfArch> elf_reader(path, fd);
@@ -1248,7 +1248,7 @@ static bool IsNonStrippedELFBinaryImpl(const string &path, const int fd,
}
// Helper for the IsNon[Debug]StrippedELFBinary functions.
-static bool IsNonStrippedELFBinaryHelper(const string &path,
+static bool IsNonStrippedELFBinaryHelper(const string& path,
bool debug_only) {
const int fd = open(path.c_str(), O_RDONLY);
if (fd == -1) {
@@ -1264,11 +1264,11 @@ static bool IsNonStrippedELFBinaryHelper(const string &path,
return false;
}
-bool ElfReader::IsNonStrippedELFBinary(const string &path) {
+bool ElfReader::IsNonStrippedELFBinary(const string& path) {
return IsNonStrippedELFBinaryHelper(path, false);
}
-bool ElfReader::IsNonDebugStrippedELFBinary(const string &path) {
+bool ElfReader::IsNonDebugStrippedELFBinary(const string& path) {
return IsNonStrippedELFBinaryHelper(path, true);
}
} // namespace dwarf2reader
diff --git a/src/common/dwarf/elf_reader.h b/src/common/dwarf/elf_reader.h
index 8eaa5aa9..0aa92285 100644
--- a/src/common/dwarf/elf_reader.h
+++ b/src/common/dwarf/elf_reader.h
@@ -34,7 +34,7 @@ class ElfReaderImpl;
class ElfReader {
public:
- explicit ElfReader(const string &path);
+ explicit ElfReader(const string& path);
~ElfReader();
// Parse the ELF prologue of this file and return whether it was
@@ -62,29 +62,29 @@ class ElfReader {
// mem_offset - position at which the segment is mapped into memory
// file_offset - offset in the file where the mapping begins
// length - length of the mapped segment
- void AddSymbols(SymbolMap *symbols,
+ void AddSymbols(SymbolMap* symbols,
uint64_t mem_offset, uint64_t file_offset,
uint64_t length);
class SymbolSink {
public:
virtual ~SymbolSink() {}
- virtual void AddSymbol(const char *name, uint64_t address,
+ virtual void AddSymbol(const char* name, uint64_t address,
uint64_t size) = 0;
};
// Like AddSymbols above, but with no address correction.
// Processes any SHT_SYMTAB section, followed by any SHT_DYNSYM section.
- void VisitSymbols(SymbolSink *sink);
+ void VisitSymbols(SymbolSink* sink);
// Like VisitSymbols above, but for a specific symbol binding/type.
// A negative value for the binding and type parameters means any
// binding or type.
- void VisitSymbols(SymbolSink *sink, int symbol_binding, int symbol_type);
+ void VisitSymbols(SymbolSink* sink, int symbol_binding, int symbol_type);
// Like VisitSymbols above but can optionally export raw symbol values instead
// of adjusted ones.
- void VisitSymbols(SymbolSink *sink, int symbol_binding, int symbol_type,
+ void VisitSymbols(SymbolSink* sink, int symbol_binding, int symbol_type,
bool get_raw_symbol_values);
// p_vaddr of the first PT_LOAD segment (if any), or 0 if no PT_LOAD
@@ -95,7 +95,7 @@ class ElfReader {
// Return the name of section "shndx". Returns NULL if the section
// is not found.
- const char *GetSectionName(int shndx);
+ const char* GetSectionName(int shndx);
// Return the number of sections in the given ELF file.
uint64_t GetNumSections();
@@ -104,14 +104,14 @@ class ElfReader {
// the pointer to the section and store the size in "size".
// On error, return NULL. The returned section data is only valid
// until the ElfReader gets destroyed.
- const char *GetSectionByIndex(int shndx, size_t *size);
+ const char* GetSectionByIndex(int shndx, size_t* size);
// Get section with "section_name" (ex. ".text", ".symtab") in the
// given ELF file. On success, return the pointer to the section
// and store the size in "size". On error, return NULL. The
// returned section data is only valid until the ElfReader gets
// destroyed.
- const char *GetSectionByName(const string &section_name, size_t *size);
+ const char* GetSectionByName(const string& section_name, size_t* size);
// This is like GetSectionByName() but it returns a lot of extra information
// about the section. The SectionInfo structure is almost identical to
@@ -129,37 +129,37 @@ class ElfReader {
uint64_t addralign; // Section alignment.
uint64_t entsize; // Entry size if section holds a table.
};
- const char *GetSectionInfoByName(const string &section_name,
- SectionInfo *info);
+ const char* GetSectionInfoByName(const string& section_name,
+ SectionInfo* info);
// Check if "path" is an ELF binary that has not been stripped of symbol
// tables. This function supports both 32-bit and 64-bit ELF binaries.
- static bool IsNonStrippedELFBinary(const string &path);
+ static bool IsNonStrippedELFBinary(const string& path);
// Check if "path" is an ELF binary that has not been stripped of debug
// info. Unlike IsNonStrippedELFBinary, this function will return
// false for binaries passed through "strip -S".
- static bool IsNonDebugStrippedELFBinary(const string &path);
+ static bool IsNonDebugStrippedELFBinary(const string& path);
// Match a requested section name with the section name as it
// appears in the elf-file, adjusting for compressed debug section
// names. For example, returns true if name == ".debug_abbrev" and
// sh_name == ".zdebug_abbrev"
- static bool SectionNamesMatch(const string &name, const string &sh_name);
+ static bool SectionNamesMatch(const string& name, const string& sh_name);
private:
// Lazily initialize impl32_ and return it.
- ElfReaderImpl<Elf32> *GetImpl32();
+ ElfReaderImpl<Elf32>* GetImpl32();
// Ditto for impl64_.
- ElfReaderImpl<Elf64> *GetImpl64();
+ ElfReaderImpl<Elf64>* GetImpl64();
// Path of the file we're reading.
const string path_;
// Read-only file descriptor for the file. May be -1 if there was an
// error during open.
int fd_;
- ElfReaderImpl<Elf32> *impl32_;
- ElfReaderImpl<Elf64> *impl64_;
+ ElfReaderImpl<Elf32>* impl32_;
+ ElfReaderImpl<Elf64>* impl64_;
};
} // namespace dwarf2reader
diff --git a/src/common/dwarf/functioninfo.cc b/src/common/dwarf/functioninfo.cc
index 28c4f935..6b9a92a3 100644
--- a/src/common/dwarf/functioninfo.cc
+++ b/src/common/dwarf/functioninfo.cc
@@ -144,7 +144,7 @@ bool CUFunctionInfoHandler::StartDIE(uint64_t offset, enum DwarfTag tag) {
void CUFunctionInfoHandler::ProcessAttributeString(uint64_t offset,
enum DwarfAttribute attr,
enum DwarfForm form,
- const string &data) {
+ const string& data) {
if (current_function_info_) {
if (attr == DW_AT_name)
current_function_info_->name = data;
diff --git a/src/common/dwarf_cfi_to_module.cc b/src/common/dwarf_cfi_to_module.cc
index 3dd85edd..eb19c132 100644
--- a/src/common/dwarf_cfi_to_module.cc
+++ b/src/common/dwarf_cfi_to_module.cc
@@ -143,7 +143,7 @@ vector<string> DwarfCFIToModule::RegisterNames::MIPS() {
}
bool DwarfCFIToModule::Entry(size_t offset, uint64_t address, uint64_t length,
- uint8_t version, const string &augmentation,
+ uint8_t version, const string& augmentation,
unsigned return_address) {
assert(!entry_);
@@ -190,7 +190,7 @@ string DwarfCFIToModule::RegisterName(int i) {
}
void DwarfCFIToModule::Record(Module::Address address, int reg,
- const string &rule) {
+ const string& rule) {
assert(entry_);
// Place the name in our global set of strings, and then use the string
@@ -247,14 +247,14 @@ bool DwarfCFIToModule::RegisterRule(uint64_t address, int reg,
}
bool DwarfCFIToModule::ExpressionRule(uint64_t address, int reg,
- const string &expression) {
+ const string& expression) {
reporter_->ExpressionsNotSupported(entry_offset_, RegisterName(reg));
// Treat this as a non-fatal error.
return true;
}
bool DwarfCFIToModule::ValExpressionRule(uint64_t address, int reg,
- const string &expression) {
+ const string& expression) {
reporter_->ExpressionsNotSupported(entry_offset_, RegisterName(reg));
// Treat this as a non-fatal error.
return true;
@@ -274,7 +274,7 @@ void DwarfCFIToModule::Reporter::UnnamedRegister(size_t offset, int reg) {
}
void DwarfCFIToModule::Reporter::UndefinedNotSupported(size_t offset,
- const string &reg) {
+ const string& reg) {
fprintf(stderr, "%s, section '%s': "
"the call frame entry at offset 0x%zx sets the rule for "
"register '%s' to 'undefined', but the Breakpad symbol file format"
@@ -283,7 +283,7 @@ void DwarfCFIToModule::Reporter::UndefinedNotSupported(size_t offset,
}
void DwarfCFIToModule::Reporter::ExpressionsNotSupported(size_t offset,
- const string &reg) {
+ const string& reg) {
fprintf(stderr, "%s, section '%s': "
"the call frame entry at offset 0x%zx uses a DWARF expression to"
" describe how to recover register '%s', "
diff --git a/src/common/dwarf_cfi_to_module.h b/src/common/dwarf_cfi_to_module.h
index 4d2db7ee..35bdb5fd 100644
--- a/src/common/dwarf_cfi_to_module.h
+++ b/src/common/dwarf_cfi_to_module.h
@@ -71,7 +71,7 @@ class DwarfCFIToModule: public CallFrameInfo::Handler {
// stream. FILE is the name of the file we're processing, and
// SECTION is the name of the section within that file that we're
// looking at (.debug_frame, .eh_frame, etc.).
- Reporter(const string &file, const string &section)
+ Reporter(const string& file, const string& section)
: file_(file), section_(section) { }
virtual ~Reporter() { }
@@ -83,13 +83,13 @@ class DwarfCFIToModule: public CallFrameInfo::Handler {
// The DWARF CFI entry at OFFSET says that REG is undefined, but the
// Breakpad symbol file format cannot express this.
- virtual void UndefinedNotSupported(size_t offset, const string &reg);
+ virtual void UndefinedNotSupported(size_t offset, const string& reg);
// The DWARF CFI entry at OFFSET says that REG uses a DWARF
// expression to find its value, but DwarfCFIToModule is not
// capable of translating DWARF expressions to Breakpad postfix
// expressions.
- virtual void ExpressionsNotSupported(size_t offset, const string &reg);
+ virtual void ExpressionsNotSupported(size_t offset, const string& reg);
protected:
string file_, section_;
@@ -118,7 +118,7 @@ class DwarfCFIToModule: public CallFrameInfo::Handler {
private:
// Given STRINGS, an array of C strings with SIZE elements, return an
// equivalent vector<string>.
- static vector<string> MakeVector(const char * const *strings, size_t size);
+ static vector<string> MakeVector(const char* const* strings, size_t size);
};
// Create a handler for the dwarf2reader::CallFrameInfo parser that
@@ -130,15 +130,15 @@ class DwarfCFIToModule: public CallFrameInfo::Handler {
//
// Use REPORTER for reporting problems encountered in the conversion
// process.
- DwarfCFIToModule(Module *module, const vector<string> &register_names,
- Reporter *reporter)
+ DwarfCFIToModule(Module* module, const vector<string>& register_names,
+ Reporter* reporter)
: module_(module), register_names_(register_names), reporter_(reporter),
entry_(NULL), return_address_(-1), cfa_name_(".cfa"), ra_name_(".ra") {
}
virtual ~DwarfCFIToModule() { delete entry_; }
virtual bool Entry(size_t offset, uint64_t address, uint64_t length,
- uint8_t version, const string &augmentation,
+ uint8_t version, const string& augmentation,
unsigned return_address);
virtual bool UndefinedRule(uint64_t address, int reg);
virtual bool SameValueRule(uint64_t address, int reg);
@@ -148,9 +148,9 @@ class DwarfCFIToModule: public CallFrameInfo::Handler {
int base_register, long offset);
virtual bool RegisterRule(uint64_t address, int reg, int base_register);
virtual bool ExpressionRule(uint64_t address, int reg,
- const string &expression);
+ const string& expression);
virtual bool ValExpressionRule(uint64_t address, int reg,
- const string &expression);
+ const string& expression);
virtual bool End();
private:
@@ -158,19 +158,19 @@ class DwarfCFIToModule: public CallFrameInfo::Handler {
string RegisterName(int i);
// Record RULE for register REG at ADDRESS.
- void Record(Module::Address address, int reg, const string &rule);
+ void Record(Module::Address address, int reg, const string& rule);
// The module to which we should add entries.
- Module *module_;
+ Module* module_;
// Map from register numbers to register names.
- const vector<string> &register_names_;
+ const vector<string>& register_names_;
// The reporter to use to report problems.
- Reporter *reporter_;
+ Reporter* reporter_;
// The current entry we're constructing.
- Module::StackFrameEntry *entry_;
+ Module::StackFrameEntry* entry_;
// The section offset of the current frame description entry, for
// use in error messages.
diff --git a/src/common/dwarf_cfi_to_module_unittest.cc b/src/common/dwarf_cfi_to_module_unittest.cc
index 60a9a3ee..58c3cca3 100644
--- a/src/common/dwarf_cfi_to_module_unittest.cc
+++ b/src/common/dwarf_cfi_to_module_unittest.cc
@@ -47,11 +47,11 @@ using testing::Test;
using testing::_;
struct MockCFIReporter: public DwarfCFIToModule::Reporter {
- MockCFIReporter(const string &file, const string &section)
+ MockCFIReporter(const string& file, const string& section)
: Reporter(file, section) { }
MOCK_METHOD2(UnnamedRegister, void(size_t offset, int reg));
- MOCK_METHOD2(UndefinedNotSupported, void(size_t offset, const string &reg));
- MOCK_METHOD2(ExpressionsNotSupported, void(size_t offset, const string &reg));
+ MOCK_METHOD2(UndefinedNotSupported, void(size_t offset, const string& reg));
+ MOCK_METHOD2(ExpressionsNotSupported, void(size_t offset, const string& reg));
};
struct DwarfCFIToModuleFixture {
@@ -80,7 +80,7 @@ struct DwarfCFIToModuleFixture {
vector<string> register_names;
MockCFIReporter reporter;
DwarfCFIToModule handler;
- vector<Module::StackFrameEntry *> entries;
+ vector<Module::StackFrameEntry*> entries;
};
class Entry: public DwarfCFIToModuleFixture, public Test { };
diff --git a/src/common/dwarf_cu_to_module.cc b/src/common/dwarf_cu_to_module.cc
index ec2badc9..3a520857 100644
--- a/src/common/dwarf_cu_to_module.cc
+++ b/src/common/dwarf_cu_to_module.cc
@@ -128,8 +128,8 @@ struct DwarfCUToModule::FilePrivate {
AbstractOriginByOffset origins;
};
-DwarfCUToModule::FileContext::FileContext(const string &filename,
- Module *module,
+DwarfCUToModule::FileContext::FileContext(const string& filename,
+ Module* module,
bool handle_inter_cu_refs)
: filename_(filename),
module_(module),
@@ -141,7 +141,7 @@ DwarfCUToModule::FileContext::~FileContext() {
}
void DwarfCUToModule::FileContext::AddSectionToSectionMap(
- const string& name, const uint8_t *contents, uint64_t length) {
+ const string& name, const uint8_t* contents, uint64_t length) {
section_map_[name] = std::make_pair(contents, length);
}
@@ -170,8 +170,8 @@ bool DwarfCUToModule::FileContext::IsUnhandledInterCUReference(
// parsing. This is for data shared across the CU's entire DIE tree,
// and parameters from the code invoking the CU parser.
struct DwarfCUToModule::CUContext {
- CUContext(FileContext *file_context_arg, WarningReporter *reporter_arg,
- RangesHandler *ranges_handler_arg)
+ CUContext(FileContext* file_context_arg, WarningReporter* reporter_arg,
+ RangesHandler* ranges_handler_arg)
: file_context(file_context_arg),
reporter(reporter_arg),
ranges_handler(ranges_handler_arg),
@@ -181,23 +181,23 @@ struct DwarfCUToModule::CUContext {
ranges(0) {}
~CUContext() {
- for (vector<Module::Function *>::iterator it = functions.begin();
+ for (vector<Module::Function*>::iterator it = functions.begin();
it != functions.end(); ++it) {
delete *it;
}
};
// The DWARF-bearing file into which this CU was incorporated.
- FileContext *file_context;
+ FileContext* file_context;
// For printing error messages.
- WarningReporter *reporter;
+ WarningReporter* reporter;
// For reading ranges from the .debug_ranges section
- RangesHandler *ranges_handler;
+ RangesHandler* ranges_handler;
// The source language of this compilation unit.
- const Language *language;
+ const Language* language;
// Addresses covered by this CU. If high_pc_ is non-zero then the CU covers
// low_pc to high_pc, otherwise ranges is non-zero and low_pc represents
@@ -211,11 +211,11 @@ struct DwarfCUToModule::CUContext {
// assign them lines and add them to file_context->module.
//
// Destroying this destroys all the functions this vector points to.
- vector<Module::Function *> functions;
+ vector<Module::Function*> functions;
// Keep a list of forward references from DW_AT_abstract_origin and
// DW_AT_specification attributes so names can be fixed up.
- std::map<uint64_t, Module::Function *> forward_ref_die_to_func;
+ std::map<uint64_t, Module::Function*> forward_ref_die_to_func;
};
// Information about the context of a particular DIE. This is for
@@ -241,7 +241,7 @@ class DwarfCUToModule::GenericDIEHandler: public dwarf2reader::DIEHandler {
// Create a handler for the DIE at OFFSET whose compilation unit is
// described by CU_CONTEXT, and whose immediate context is described
// by PARENT_CONTEXT.
- GenericDIEHandler(CUContext *cu_context, DIEContext *parent_context,
+ GenericDIEHandler(CUContext* cu_context, DIEContext* parent_context,
uint64_t offset)
: cu_context_(cu_context),
parent_context_(parent_context),
@@ -266,7 +266,7 @@ class DwarfCUToModule::GenericDIEHandler: public dwarf2reader::DIEHandler {
// handle DW_AT_specification, or simply not override it.
void ProcessAttributeString(enum DwarfAttribute attr,
enum DwarfForm form,
- const string &data);
+ const string& data);
protected:
// Compute and return the fully-qualified name of the DIE. If this
@@ -279,8 +279,8 @@ class DwarfCUToModule::GenericDIEHandler: public dwarf2reader::DIEHandler {
// have been seen.
string ComputeQualifiedName();
- CUContext *cu_context_;
- DIEContext *parent_context_;
+ CUContext* cu_context_;
+ DIEContext* parent_context_;
uint64_t offset_;
// Place the name in the global set of strings. Even though this looks
@@ -289,7 +289,7 @@ class DwarfCUToModule::GenericDIEHandler: public dwarf2reader::DIEHandler {
// share copies of strings whenever possible.
// FIXME: Should this return something like a string_ref to avoid the
// assumption about how strings are implemented?
- string AddStringToPool(const string &str);
+ string AddStringToPool(const string& str);
// If this DIE has a DW_AT_declaration attribute, this is its value.
// It is false on DIEs with no DW_AT_declaration attribute.
@@ -298,7 +298,7 @@ class DwarfCUToModule::GenericDIEHandler: public dwarf2reader::DIEHandler {
// If this DIE has a DW_AT_specification attribute, this is the
// Specification structure for the DIE the attribute refers to.
// Otherwise, this is NULL.
- Specification *specification_;
+ Specification* specification_;
// If this DIE has a DW_AT_specification or DW_AT_abstract_origin and it is a
// forward reference, no Specification will be available. Track the reference
@@ -335,7 +335,7 @@ void DwarfCUToModule::GenericDIEHandler::ProcessAttributeReference(
uint64_t data) {
switch (attr) {
case dwarf2reader::DW_AT_specification: {
- FileContext *file_context = cu_context_->file_context;
+ FileContext* file_context = cu_context_->file_context;
if (file_context->IsUnhandledInterCUReference(
data, cu_context_->reporter->cu_offset())) {
cu_context_->reporter->UnhandledInterCUReference(offset_, data);
@@ -346,7 +346,7 @@ void DwarfCUToModule::GenericDIEHandler::ProcessAttributeReference(
// here, but it's better to leave the real work to our
// EndAttribute member function, at which point we know we have
// seen all the DIE's attributes.
- SpecificationByOffset *specifications =
+ SpecificationByOffset* specifications =
&file_context->file_private_->specifications;
SpecificationByOffset::iterator spec = specifications->find(data);
if (spec != specifications->end()) {
@@ -362,7 +362,7 @@ void DwarfCUToModule::GenericDIEHandler::ProcessAttributeReference(
}
}
-string DwarfCUToModule::GenericDIEHandler::AddStringToPool(const string &str) {
+string DwarfCUToModule::GenericDIEHandler::AddStringToPool(const string& str) {
pair<unordered_set<string>::iterator, bool> result =
cu_context_->file_context->file_private_->common_strings.insert(str);
return *result.first;
@@ -371,7 +371,7 @@ string DwarfCUToModule::GenericDIEHandler::AddStringToPool(const string &str) {
void DwarfCUToModule::GenericDIEHandler::ProcessAttributeString(
enum DwarfAttribute attr,
enum DwarfForm form,
- const string &data) {
+ const string& data) {
switch (attr) {
case dwarf2reader::DW_AT_name:
name_attribute_ = AddStringToPool(data);
@@ -404,7 +404,7 @@ string DwarfCUToModule::GenericDIEHandler::ComputeQualifiedName() {
// Use the demangled name, if one is available. Demangled names are
// preferable to those inferred from the DWARF structure because they
// include argument types.
- const string *qualified_name = NULL;
+ const string* qualified_name = NULL;
if (!demangled_name_.empty()) {
// Found it is this DIE.
qualified_name = &demangled_name_;
@@ -413,8 +413,8 @@ string DwarfCUToModule::GenericDIEHandler::ComputeQualifiedName() {
qualified_name = &specification_->qualified_name;
}
- const string *unqualified_name = NULL;
- const string *enclosing_name;
+ const string* unqualified_name = NULL;
+ const string* enclosing_name;
if (!qualified_name) {
// Find the unqualified name. If the DIE has its own DW_AT_name
// attribute, then use that; otherwise, check the specification.
@@ -466,7 +466,7 @@ string DwarfCUToModule::GenericDIEHandler::ComputeQualifiedName() {
// A handler class for DW_TAG_subprogram DIEs.
class DwarfCUToModule::FuncHandler: public GenericDIEHandler {
public:
- FuncHandler(CUContext *cu_context, DIEContext *parent_context,
+ FuncHandler(CUContext* cu_context, DIEContext* parent_context,
uint64_t offset)
: GenericDIEHandler(cu_context, parent_context, offset),
low_pc_(0), high_pc_(0), high_pc_form_(dwarf2reader::DW_FORM_addr),
@@ -605,7 +605,7 @@ void DwarfCUToModule::FuncHandler::Finish() {
Module::Range range(low_pc_, high_pc_ - low_pc_);
ranges.push_back(range);
} else {
- RangesHandler *ranges_handler = cu_context_->ranges_handler;
+ RangesHandler* ranges_handler = cu_context_->ranges_handler;
if (ranges_handler) {
if (!ranges_handler->ReadRanges(ranges_, cu_context_->low_pc, &ranges)) {
@@ -668,11 +668,11 @@ void DwarfCUToModule::FuncHandler::Finish() {
// component to their names: namespaces, classes, etc.
class DwarfCUToModule::NamedScopeHandler: public GenericDIEHandler {
public:
- NamedScopeHandler(CUContext *cu_context, DIEContext *parent_context,
+ NamedScopeHandler(CUContext* cu_context, DIEContext* parent_context,
uint64_t offset)
: GenericDIEHandler(cu_context, parent_context, offset) { }
bool EndAttributes();
- DIEHandler *FindChildHandler(uint64_t offset, enum DwarfTag tag);
+ DIEHandler* FindChildHandler(uint64_t offset, enum DwarfTag tag);
private:
DIEContext child_context_; // A context for our children.
@@ -683,7 +683,7 @@ bool DwarfCUToModule::NamedScopeHandler::EndAttributes() {
return true;
}
-dwarf2reader::DIEHandler *DwarfCUToModule::NamedScopeHandler::FindChildHandler(
+dwarf2reader::DIEHandler* DwarfCUToModule::NamedScopeHandler::FindChildHandler(
uint64_t offset,
enum DwarfTag tag) {
switch (tag) {
@@ -725,7 +725,7 @@ void DwarfCUToModule::WarningReporter::UnknownAbstractOrigin(uint64_t offset,
filename_.c_str(), offset, target);
}
-void DwarfCUToModule::WarningReporter::MissingSection(const string &name) {
+void DwarfCUToModule::WarningReporter::MissingSection(const string& name) {
CUHeading();
fprintf(stderr, "%s: warning: couldn't find DWARF '%s' section\n",
filename_.c_str(), name.c_str());
@@ -748,7 +748,7 @@ void DwarfCUToModule::WarningReporter::UncoveredHeading() {
}
void DwarfCUToModule::WarningReporter::UncoveredFunction(
- const Module::Function &function) {
+ const Module::Function& function) {
if (!uncovered_warnings_enabled_)
return;
UncoveredHeading();
@@ -757,7 +757,7 @@ void DwarfCUToModule::WarningReporter::UncoveredFunction(
function.name.c_str());
}
-void DwarfCUToModule::WarningReporter::UncoveredLine(const Module::Line &line) {
+void DwarfCUToModule::WarningReporter::UncoveredLine(const Module::Line& line) {
if (!uncovered_warnings_enabled_)
return;
UncoveredHeading();
@@ -772,7 +772,7 @@ void DwarfCUToModule::WarningReporter::UnnamedFunction(uint64_t offset) {
filename_.c_str(), offset);
}
-void DwarfCUToModule::WarningReporter::DemangleError(const string &input) {
+void DwarfCUToModule::WarningReporter::DemangleError(const string& input) {
CUHeading();
fprintf(stderr, "%s: warning: failed to demangle %s\n",
filename_.c_str(), input.c_str());
@@ -800,10 +800,10 @@ void DwarfCUToModule::WarningReporter::MissingRanges() {
"the .debug_ranges section is missing.\n", filename_.c_str());
}
-DwarfCUToModule::DwarfCUToModule(FileContext *file_context,
- LineToModuleHandler *line_reader,
- RangesHandler *ranges_handler,
- WarningReporter *reporter)
+DwarfCUToModule::DwarfCUToModule(FileContext* file_context,
+ LineToModuleHandler* line_reader,
+ RangesHandler* ranges_handler,
+ WarningReporter* reporter)
: line_reader_(line_reader),
cu_context_(new CUContext(file_context, reporter, ranges_handler)),
child_context_(new DIEContext()),
@@ -853,7 +853,7 @@ void DwarfCUToModule::ProcessAttributeUnsigned(enum DwarfAttribute attr,
void DwarfCUToModule::ProcessAttributeString(enum DwarfAttribute attr,
enum DwarfForm form,
- const string &data) {
+ const string& data) {
switch (attr) {
case dwarf2reader::DW_AT_name:
cu_context_->reporter->SetCUName(data);
@@ -870,7 +870,7 @@ bool DwarfCUToModule::EndAttributes() {
return true;
}
-dwarf2reader::DIEHandler *DwarfCUToModule::FindChildHandler(
+dwarf2reader::DIEHandler* DwarfCUToModule::FindChildHandler(
uint64_t offset,
enum DwarfTag tag) {
switch (tag) {
@@ -932,7 +932,7 @@ void DwarfCUToModule::SetLanguage(DwarfLanguage language) {
}
void DwarfCUToModule::ReadSourceLines(uint64_t offset) {
- const dwarf2reader::SectionMap &section_map
+ const dwarf2reader::SectionMap& section_map
= cu_context_->file_context->section_map();
dwarf2reader::SectionMap::const_iterator map_entry
= dwarf2reader::GetSectionByName(section_map, ".debug_line");
@@ -974,30 +974,30 @@ void DwarfCUToModule::ReadSourceLines(uint64_t offset) {
namespace {
class FunctionRange {
public:
- FunctionRange(const Module::Range &range, Module::Function *function) :
+ FunctionRange(const Module::Range& range, Module::Function* function) :
address(range.address), size(range.size), function(function) { }
- void AddLine(Module::Line &line) {
+ void AddLine(Module::Line& line) {
function->lines.push_back(line);
}
Module::Address address;
Module::Address size;
- Module::Function *function;
+ Module::Function* function;
};
// Fills an array of ranges with pointers to the functions which owns
// them. The array is sorted in ascending order and the ranges are non
// empty and non-overlapping.
-static void FillSortedFunctionRanges(vector<FunctionRange> &dest_ranges,
- vector<Module::Function *> *functions) {
- for (vector<Module::Function *>::const_iterator func_it = functions->cbegin();
+static void FillSortedFunctionRanges(vector<FunctionRange>& dest_ranges,
+ vector<Module::Function*>* functions) {
+ for (vector<Module::Function*>::const_iterator func_it = functions->cbegin();
func_it != functions->cend();
func_it++)
{
- Module::Function *func = *func_it;
- vector<Module::Range> &ranges = func->ranges;
+ Module::Function* func = *func_it;
+ vector<Module::Range>& ranges = func->ranges;
for (vector<Module::Range>::const_iterator ranges_it = ranges.cbegin();
ranges_it != ranges.cend();
++ranges_it) {
@@ -1009,7 +1009,7 @@ static void FillSortedFunctionRanges(vector<FunctionRange> &dest_ranges,
}
sort(dest_ranges.begin(), dest_ranges.end(),
- [](const FunctionRange &fr1, const FunctionRange &fr2) {
+ [](const FunctionRange& fr1, const FunctionRange& fr2) {
return fr1.address < fr2.address;
}
);
@@ -1017,7 +1017,7 @@ static void FillSortedFunctionRanges(vector<FunctionRange> &dest_ranges,
// Return true if ADDRESS falls within the range of ITEM.
template <class T>
-inline bool within(const T &item, Module::Address address) {
+inline bool within(const T& item, Module::Address address) {
// Because Module::Address is unsigned, and unsigned arithmetic
// wraps around, this will be false if ADDRESS falls before the
// start of ITEM, or if it falls after ITEM's end.
@@ -1026,8 +1026,8 @@ inline bool within(const T &item, Module::Address address) {
}
void DwarfCUToModule::AssignLinesToFunctions() {
- vector<Module::Function *> *functions = &cu_context_->functions;
- WarningReporter *reporter = cu_context_->reporter;
+ vector<Module::Function*>* functions = &cu_context_->functions;
+ WarningReporter* reporter = cu_context_->reporter;
// This would be simpler if we assumed that source line entries
// don't cross function boundaries. However, there's no real reason
@@ -1047,12 +1047,12 @@ void DwarfCUToModule::AssignLinesToFunctions() {
// The last line that we used any piece of. We use this only for
// generating warnings.
- const Module::Line *last_line_used = NULL;
+ const Module::Line* last_line_used = NULL;
// The last function and line we warned about --- so we can avoid
// doing so more than once.
- const Module::Function *last_function_cited = NULL;
- const Module::Line *last_line_cited = NULL;
+ const Module::Function* last_function_cited = NULL;
+ const Module::Line* last_line_cited = NULL;
// Prepare a sorted list of ranges with range-to-function mapping
vector<FunctionRange> sorted_ranges;
@@ -1068,8 +1068,8 @@ void DwarfCUToModule::AssignLinesToFunctions() {
// Pointers to the referents of func_it and line_it, or NULL if the
// iterator is at the end of the sequence.
- FunctionRange *range;
- const Module::Line *line;
+ FunctionRange* range;
+ const Module::Line* line;
// Start current at the beginning of the first line or function,
// whichever is earlier.
@@ -1232,7 +1232,7 @@ void DwarfCUToModule::Finish() {
if (has_source_line_info_)
ReadSourceLines(source_line_offset_);
- vector<Module::Function *> *functions = &cu_context_->functions;
+ vector<Module::Function*>* functions = &cu_context_->functions;
// Dole out lines to the appropriate functions.
AssignLinesToFunctions();
diff --git a/src/common/dwarf_cu_to_module.h b/src/common/dwarf_cu_to_module.h
index b948aec7..3e15b667 100644
--- a/src/common/dwarf_cu_to_module.h
+++ b/src/common/dwarf_cu_to_module.h
@@ -79,14 +79,14 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
// to true to handle debugging symbols with DW_FORM_ref_addr entries.
class FileContext {
public:
- FileContext(const string &filename,
- Module *module,
+ FileContext(const string& filename,
+ Module* module,
bool handle_inter_cu_refs);
~FileContext();
// Add CONTENTS of size LENGTH to the section map as NAME.
void AddSectionToSectionMap(const string& name,
- const uint8_t *contents,
+ const uint8_t* contents,
uint64_t length);
// Clear the section map for testing.
@@ -114,7 +114,7 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
dwarf2reader::SectionMap section_map_;
// The Module to which we're contributing definitions.
- Module *module_;
+ Module* module_;
// True if we are handling references between compilation units.
const bool handle_inter_cu_refs_;
@@ -163,7 +163,7 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
uint64_t string_section_length,
const uint8_t* line_string_section,
uint64_t line_string_length,
- Module *module, vector<Module::Line> *lines) = 0;
+ Module* module, vector<Module::Line>* lines) = 0;
};
// The interface DwarfCUToModule uses to report warnings. The member
@@ -174,14 +174,14 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
public:
// Warn about problems in the DWARF file FILENAME, in the
// compilation unit at OFFSET.
- WarningReporter(const string &filename, uint64_t cu_offset)
+ WarningReporter(const string& filename, uint64_t cu_offset)
: filename_(filename), cu_offset_(cu_offset), printed_cu_header_(false),
printed_unpaired_header_(false),
uncovered_warnings_enabled_(false) { }
virtual ~WarningReporter() { }
// Set the name of the compilation unit we're processing to NAME.
- virtual void SetCUName(const string &name) { cu_name_ = name; }
+ virtual void SetCUName(const string& name) { cu_name_ = name; }
// Accessor and setter for uncovered_warnings_enabled_.
// UncoveredFunction and UncoveredLine only report a problem if that is
@@ -204,17 +204,17 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
virtual void UnknownAbstractOrigin(uint64_t offset, uint64_t target);
// We were unable to find the DWARF section named SECTION_NAME.
- virtual void MissingSection(const string &section_name);
+ virtual void MissingSection(const string& section_name);
// The CU's DW_AT_stmt_list offset OFFSET is bogus.
virtual void BadLineInfoOffset(uint64_t offset);
// FUNCTION includes code covered by no line number data.
- virtual void UncoveredFunction(const Module::Function &function);
+ virtual void UncoveredFunction(const Module::Function& function);
// Line number NUMBER in LINE_FILE, of length LENGTH, includes code
// covered by no function.
- virtual void UncoveredLine(const Module::Line &line);
+ virtual void UncoveredLine(const Module::Line& line);
// The DW_TAG_subprogram DIE at OFFSET has no name specified directly
// in the DIE, nor via a DW_AT_specification or DW_AT_abstract_origin
@@ -222,7 +222,7 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
virtual void UnnamedFunction(uint64_t offset);
// __cxa_demangle() failed to demangle INPUT.
- virtual void DemangleError(const string &input);
+ virtual void DemangleError(const string& input);
// The DW_FORM_ref_addr at OFFSET to TARGET was not handled because
// FilePrivate did not retain the inter-CU specification data.
@@ -261,10 +261,10 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
// FILE_CONTEXT->module. Use LINE_READER to handle the compilation
// unit's line number data. Use REPORTER to report problems with the
// data we find.
- DwarfCUToModule(FileContext *file_context,
- LineToModuleHandler *line_reader,
- RangesHandler *ranges_handler,
- WarningReporter *reporter);
+ DwarfCUToModule(FileContext* file_context,
+ LineToModuleHandler* line_reader,
+ RangesHandler* ranges_handler,
+ WarningReporter* reporter);
~DwarfCUToModule();
void ProcessAttributeSigned(enum DwarfAttribute attr,
@@ -275,9 +275,9 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
uint64_t data);
void ProcessAttributeString(enum DwarfAttribute attr,
enum DwarfForm form,
- const string &data);
+ const string& data);
bool EndAttributes();
- DIEHandler *FindChildHandler(uint64_t offset, enum DwarfTag tag);
+ DIEHandler* FindChildHandler(uint64_t offset, enum DwarfTag tag);
// Assign all our source Lines to the Functions that cover their
// addresses, and then add them to module_.
@@ -323,7 +323,7 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
// destructor deletes them.
// The handler to use to handle line number data.
- LineToModuleHandler *line_reader_;
+ LineToModuleHandler* line_reader_;
// This compilation unit's context.
scoped_ptr<CUContext> cu_context_;
diff --git a/src/common/dwarf_cu_to_module_unittest.cc b/src/common/dwarf_cu_to_module_unittest.cc
index 1b7e2bf5..8545c67d 100644
--- a/src/common/dwarf_cu_to_module_unittest.cc
+++ b/src/common/dwarf_cu_to_module_unittest.cc
@@ -77,17 +77,17 @@ class MockLineToModuleHandler: public DwarfCUToModule::LineToModuleHandler {
class MockWarningReporter: public DwarfCUToModule::WarningReporter {
public:
- MockWarningReporter(const string &filename, uint64_t cu_offset)
+ MockWarningReporter(const string& filename, uint64_t cu_offset)
: DwarfCUToModule::WarningReporter(filename, cu_offset) { }
- MOCK_METHOD1(SetCUName, void(const string &name));
+ MOCK_METHOD1(SetCUName, void(const string& name));
MOCK_METHOD2(UnknownSpecification, void(uint64_t offset, uint64_t target));
MOCK_METHOD2(UnknownAbstractOrigin, void(uint64_t offset, uint64_t target));
- MOCK_METHOD1(MissingSection, void(const string &section_name));
+ MOCK_METHOD1(MissingSection, void(const string& section_name));
MOCK_METHOD1(BadLineInfoOffset, void(uint64_t offset));
- MOCK_METHOD1(UncoveredFunction, void(const Module::Function &function));
- MOCK_METHOD1(UncoveredLine, void(const Module::Line &line));
+ MOCK_METHOD1(UncoveredFunction, void(const Module::Function& function));
+ MOCK_METHOD1(UncoveredLine, void(const Module::Line& line));
MOCK_METHOD1(UnnamedFunction, void(uint64_t offset));
- MOCK_METHOD1(DemangleError, void(const string &input));
+ MOCK_METHOD1(DemangleError, void(const string& input));
MOCK_METHOD2(UnhandledInterCUReference, void(uint64_t offset, uint64_t target));
};
@@ -116,7 +116,7 @@ class CUFixtureBase {
class AppendLinesFunctor {
public:
explicit AppendLinesFunctor(
- const vector<Module::Line> *lines) : lines_(lines) { }
+ const vector<Module::Line>* lines) : lines_(lines) { }
void operator()(const uint8_t* program, uint64_t length,
const uint8_t* string_section,
uint64_t string_section_length,
@@ -126,7 +126,7 @@ class CUFixtureBase {
lines->insert(lines->end(), lines_->begin(), lines_->end());
}
private:
- const vector<Module::Line> *lines_;
+ const vector<Module::Line>* lines_;
};
CUFixtureBase()
@@ -169,7 +169,7 @@ class CUFixtureBase {
// when it invokes its LineToModuleHandler. Call this before calling
// StartCU.
void PushLine(Module::Address address, Module::Address size,
- const string &filename, int line_number);
+ const string& filename, int line_number);
// Use LANGUAGE for the compilation unit. More precisely, arrange
// for StartCU to pass the compilation unit's root DIE a
@@ -190,28 +190,28 @@ class CUFixtureBase {
void StartCU();
// Have HANDLER process some strange attribute/form/value triples.
- void ProcessStrangeAttributes(dwarf2reader::DIEHandler *handler);
+ void ProcessStrangeAttributes(dwarf2reader::DIEHandler* handler);
// Start a child DIE of PARENT with the given tag and name. Leave
// the handler ready to hear about children: call EndAttributes, but
// not Finish.
- DIEHandler *StartNamedDIE(DIEHandler *parent, DwarfTag tag,
- const string &name);
+ DIEHandler* StartNamedDIE(DIEHandler* parent, DwarfTag tag,
+ const string& name);
// Start a child DIE of PARENT with the given tag and a
// DW_AT_specification attribute whose value is SPECIFICATION. Leave
// the handler ready to hear about children: call EndAttributes, but
// not Finish. If NAME is non-zero, use it as the DW_AT_name
// attribute.
- DIEHandler *StartSpecifiedDIE(DIEHandler *parent, DwarfTag tag,
- uint64_t specification, const char *name = NULL);
+ DIEHandler* StartSpecifiedDIE(DIEHandler* parent, DwarfTag tag,
+ uint64_t specification, const char* name = NULL);
// Define a function as a child of PARENT with the given name, address, and
// size. If high_pc_form is DW_FORM_addr then the DW_AT_high_pc attribute
// will be written as an address; otherwise it will be written as the
// function's size. Call EndAttributes and Finish; one cannot define
// children of the defined function's DIE.
- void DefineFunction(DIEHandler *parent, const string &name,
+ void DefineFunction(DIEHandler* parent, const string& name,
Module::Address address, Module::Address size,
const char* mangled_name,
DwarfForm high_pc_form = dwarf2reader::DW_FORM_addr);
@@ -219,32 +219,32 @@ class CUFixtureBase {
// Create a declaration DIE as a child of PARENT with the given
// offset, tag and name. If NAME is the empty string, don't provide
// a DW_AT_name attribute. Call EndAttributes and Finish.
- void DeclarationDIE(DIEHandler *parent, uint64_t offset,
- DwarfTag tag, const string &name,
- const string &mangled_name);
+ void DeclarationDIE(DIEHandler* parent, uint64_t offset,
+ DwarfTag tag, const string& name,
+ const string& mangled_name);
// Create a definition DIE as a child of PARENT with the given tag
// that refers to the declaration DIE at offset SPECIFICATION as its
// specification. If NAME is non-empty, pass it as the DW_AT_name
// attribute. If SIZE is non-zero, record ADDRESS and SIZE as
// low_pc/high_pc attributes.
- void DefinitionDIE(DIEHandler *parent, DwarfTag tag,
- uint64_t specification, const string &name,
+ void DefinitionDIE(DIEHandler* parent, DwarfTag tag,
+ uint64_t specification, const string& name,
Module::Address address = 0, Module::Address size = 0);
// Create an inline DW_TAG_subprogram DIE as a child of PARENT. If
// SPECIFICATION is non-zero, then the DIE refers to the declaration DIE at
// offset SPECIFICATION as its specification. If Name is non-empty, pass it
// as the DW_AT_name attribute.
- void AbstractInstanceDIE(DIEHandler *parent, uint64_t offset,
+ void AbstractInstanceDIE(DIEHandler* parent, uint64_t offset,
DwarfInline type, uint64_t specification,
- const string &name,
+ const string& name,
DwarfForm form = dwarf2reader::DW_FORM_data1);
// Create a DW_TAG_subprogram DIE as a child of PARENT that refers to
// ORIGIN in its DW_AT_abstract_origin attribute. If NAME is the empty
// string, don't provide a DW_AT_name attribute.
- void DefineInlineInstanceDIE(DIEHandler *parent, const string &name,
+ void DefineInlineInstanceDIE(DIEHandler* parent, const string& name,
uint64_t origin, Module::Address address,
Module::Address size);
@@ -259,7 +259,7 @@ class CUFixtureBase {
// Test that the I'th function (ordered by address) in the module
// this.module_ has the given name, address, and size, and that its
// parameter size is zero.
- void TestFunction(int i, const string &name,
+ void TestFunction(int i, const string& name,
Module::Address address, Module::Address size);
// Test that the number of source lines owned by the I'th function
@@ -270,7 +270,7 @@ class CUFixtureBase {
// (again, by address) has the given address, size, filename, and
// line number.
void TestLine(int i, int j, Module::Address address, Module::Address size,
- const string &filename, int number);
+ const string& filename, int number);
// Actual objects under test.
Module module_;
@@ -308,7 +308,7 @@ class CUFixtureBase {
// If functions_filled_ is true, this is a table of functions we've
// extracted from module_, sorted by address.
- vector<Module::Function *> functions_;
+ vector<Module::Function*> functions_;
// True if we have filled the above vector with this.module_'s function list.
bool functions_filled_;
};
@@ -318,7 +318,7 @@ const size_t CUFixtureBase::dummy_line_size_ =
sizeof(CUFixtureBase::dummy_line_program_);
void CUFixtureBase::PushLine(Module::Address address, Module::Address size,
- const string &filename, int line_number) {
+ const string& filename, int line_number) {
Module::Line l;
l.address = address;
l.size = size;
@@ -376,7 +376,7 @@ void CUFixtureBase::StartCU() {
}
void CUFixtureBase::ProcessStrangeAttributes(
- dwarf2reader::DIEHandler *handler) {
+ dwarf2reader::DIEHandler* handler) {
handler->ProcessAttributeUnsigned((DwarfAttribute) 0xf560dead,
(DwarfForm) 0x4106e4db,
0xa592571997facda1ULL);
@@ -395,10 +395,10 @@ void CUFixtureBase::ProcessStrangeAttributes(
"strange string");
}
-DIEHandler *CUFixtureBase::StartNamedDIE(DIEHandler *parent,
+DIEHandler* CUFixtureBase::StartNamedDIE(DIEHandler* parent,
DwarfTag tag,
- const string &name) {
- dwarf2reader::DIEHandler *handler
+ const string& name) {
+ dwarf2reader::DIEHandler* handler
= parent->FindChildHandler(0x8f4c783c0467c989ULL, tag);
if (!handler)
return NULL;
@@ -415,11 +415,11 @@ DIEHandler *CUFixtureBase::StartNamedDIE(DIEHandler *parent,
return handler;
}
-DIEHandler *CUFixtureBase::StartSpecifiedDIE(DIEHandler *parent,
+DIEHandler* CUFixtureBase::StartSpecifiedDIE(DIEHandler* parent,
DwarfTag tag,
uint64_t specification,
- const char *name) {
- dwarf2reader::DIEHandler *handler
+ const char* name) {
+ dwarf2reader::DIEHandler* handler
= parent->FindChildHandler(0x8f4c783c0467c989ULL, tag);
if (!handler)
return NULL;
@@ -439,12 +439,12 @@ DIEHandler *CUFixtureBase::StartSpecifiedDIE(DIEHandler *parent,
return handler;
}
-void CUFixtureBase::DefineFunction(dwarf2reader::DIEHandler *parent,
- const string &name, Module::Address address,
+void CUFixtureBase::DefineFunction(dwarf2reader::DIEHandler* parent,
+ const string& name, Module::Address address,
Module::Address size,
const char* mangled_name,
DwarfForm high_pc_form) {
- dwarf2reader::DIEHandler *func
+ dwarf2reader::DIEHandler* func
= parent->FindChildHandler(0xe34797c7e68590a8LL,
dwarf2reader::DW_TAG_subprogram);
ASSERT_TRUE(func != NULL);
@@ -474,11 +474,11 @@ void CUFixtureBase::DefineFunction(dwarf2reader::DIEHandler *parent,
delete func;
}
-void CUFixtureBase::DeclarationDIE(DIEHandler *parent, uint64_t offset,
+void CUFixtureBase::DeclarationDIE(DIEHandler* parent, uint64_t offset,
DwarfTag tag,
- const string &name,
- const string &mangled_name) {
- dwarf2reader::DIEHandler *die = parent->FindChildHandler(offset, tag);
+ const string& name,
+ const string& mangled_name) {
+ dwarf2reader::DIEHandler* die = parent->FindChildHandler(offset, tag);
ASSERT_TRUE(die != NULL);
if (!name.empty())
die->ProcessAttributeString(dwarf2reader::DW_AT_name,
@@ -497,13 +497,13 @@ void CUFixtureBase::DeclarationDIE(DIEHandler *parent, uint64_t offset,
delete die;
}
-void CUFixtureBase::DefinitionDIE(DIEHandler *parent,
+void CUFixtureBase::DefinitionDIE(DIEHandler* parent,
DwarfTag tag,
uint64_t specification,
- const string &name,
+ const string& name,
Module::Address address,
Module::Address size) {
- dwarf2reader::DIEHandler *die
+ dwarf2reader::DIEHandler* die
= parent->FindChildHandler(0x6ccfea031a9e6cc9ULL, tag);
ASSERT_TRUE(die != NULL);
die->ProcessAttributeReference(dwarf2reader::DW_AT_specification,
@@ -526,13 +526,13 @@ void CUFixtureBase::DefinitionDIE(DIEHandler *parent,
delete die;
}
-void CUFixtureBase::AbstractInstanceDIE(DIEHandler *parent,
+void CUFixtureBase::AbstractInstanceDIE(DIEHandler* parent,
uint64_t offset,
DwarfInline type,
uint64_t specification,
- const string &name,
+ const string& name,
DwarfForm form) {
- dwarf2reader::DIEHandler *die
+ dwarf2reader::DIEHandler* die
= parent->FindChildHandler(offset, dwarf2reader::DW_TAG_subprogram);
ASSERT_TRUE(die != NULL);
if (specification != 0ULL)
@@ -554,12 +554,12 @@ void CUFixtureBase::AbstractInstanceDIE(DIEHandler *parent,
delete die;
}
-void CUFixtureBase::DefineInlineInstanceDIE(DIEHandler *parent,
- const string &name,
+void CUFixtureBase::DefineInlineInstanceDIE(DIEHandler* parent,
+ const string& name,
uint64_t origin,
Module::Address address,
Module::Address size) {
- dwarf2reader::DIEHandler *func
+ dwarf2reader::DIEHandler* func
= parent->FindChildHandler(0x11c70f94c6e87ccdLL,
dwarf2reader::DW_TAG_subprogram);
ASSERT_TRUE(func != NULL);
@@ -597,13 +597,13 @@ void CUFixtureBase::TestFunctionCount(size_t expected) {
ASSERT_EQ(expected, functions_.size());
}
-void CUFixtureBase::TestFunction(int i, const string &name,
+void CUFixtureBase::TestFunction(int i, const string& name,
Module::Address address,
Module::Address size) {
FillFunctions();
ASSERT_LT((size_t) i, functions_.size());
- Module::Function *function = functions_[i];
+ Module::Function* function = functions_[i];
EXPECT_EQ(name, function->name);
EXPECT_EQ(address, function->address);
EXPECT_EQ(size, function->ranges[0].size);
@@ -619,12 +619,12 @@ void CUFixtureBase::TestLineCount(int i, size_t expected) {
void CUFixtureBase::TestLine(int i, int j,
Module::Address address, Module::Address size,
- const string &filename, int number) {
+ const string& filename, int number) {
FillFunctions();
ASSERT_LT((size_t) i, functions_.size());
ASSERT_LT((size_t) j, functions_[i]->lines.size());
- Module::Line *line = &functions_[i]->lines[j];
+ Module::Line* line = &functions_[i]->lines[j];
EXPECT_EQ(address, line->address);
EXPECT_EQ(size, line->size);
EXPECT_EQ(filename, line->file->name.c_str());
@@ -711,7 +711,7 @@ TEST_F(SimpleCU, IrrelevantRootChildren) {
TEST_F(SimpleCU, IrrelevantNamedScopeChildren) {
StartCU();
- DIEHandler *class_A_handler
+ DIEHandler* class_A_handler
= StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type, "class_A");
EXPECT_TRUE(class_A_handler != NULL);
EXPECT_FALSE(class_A_handler
@@ -861,7 +861,7 @@ INSTANTIATE_TEST_CASE_P(AllSituations, FuncLinePairing,
ValuesIn(situations));
TEST_P(FuncLinePairing, Pairing) {
- const Situation &s = GetParam();
+ const Situation& s = GetParam();
PushLine(s.lines[0].start,
s.lines[0].end - s.lines[0].start,
"line-file", 67636963);
@@ -1057,7 +1057,7 @@ TEST_P(CXXQualifiedNames, TwoFunctions) {
PushLine(20, 1, "filename2", 95115701);
StartCU();
- DIEHandler *enclosure_handler = StartNamedDIE(&root_handler_, tag,
+ DIEHandler* enclosure_handler = StartNamedDIE(&root_handler_, tag,
"Enclosure");
EXPECT_TRUE(enclosure_handler != NULL);
DefineFunction(enclosure_handler, "func_B", 10, 1, NULL);
@@ -1078,11 +1078,11 @@ TEST_P(CXXQualifiedNames, FuncInEnclosureInNamespace) {
PushLine(10, 1, "line-file", 69819327);
StartCU();
- DIEHandler *namespace_handler
+ DIEHandler* namespace_handler
= StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_namespace,
"Namespace");
EXPECT_TRUE(namespace_handler != NULL);
- DIEHandler *enclosure_handler = StartNamedDIE(namespace_handler, tag,
+ DIEHandler* enclosure_handler = StartNamedDIE(namespace_handler, tag,
"Enclosure");
EXPECT_TRUE(enclosure_handler != NULL);
DefineFunction(enclosure_handler, "function", 10, 1, NULL);
@@ -1101,15 +1101,15 @@ TEST_F(CXXQualifiedNames, FunctionInClassInStructInNamespace) {
PushLine(10, 1, "filename1", 69819327);
StartCU();
- DIEHandler *namespace_handler
+ DIEHandler* namespace_handler
= StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_namespace,
"namespace_A");
EXPECT_TRUE(namespace_handler != NULL);
- DIEHandler *struct_handler
+ DIEHandler* struct_handler
= StartNamedDIE(namespace_handler, dwarf2reader::DW_TAG_structure_type,
"struct_B");
EXPECT_TRUE(struct_handler != NULL);
- DIEHandler *class_handler
+ DIEHandler* class_handler
= StartNamedDIE(struct_handler, dwarf2reader::DW_TAG_class_type,
"class_C");
DefineFunction(class_handler, "function_D", 10, 1, NULL);
@@ -1127,7 +1127,7 @@ TEST_F(CXXQualifiedNames, FunctionInClassInStructInNamespace) {
struct LanguageAndQualifiedName {
dwarf2reader::DwarfLanguage language;
- const char *name;
+ const char* name;
};
const LanguageAndQualifiedName LanguageAndQualifiedNameCases[] = {
@@ -1149,13 +1149,13 @@ INSTANTIATE_TEST_CASE_P(LanguageAndQualifiedName, QualifiedForLanguage,
ValuesIn(LanguageAndQualifiedNameCases));
TEST_P(QualifiedForLanguage, MemberFunction) {
- const LanguageAndQualifiedName &param = GetParam();
+ const LanguageAndQualifiedName& param = GetParam();
PushLine(10, 1, "line-file", 212966758);
SetLanguage(param.language);
StartCU();
- DIEHandler *class_handler
+ DIEHandler* class_handler
= StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type,
"class_A");
DefineFunction(class_handler, "function_B", 10, 1, NULL);
@@ -1172,14 +1172,14 @@ TEST_P(QualifiedForLanguage, MemberFunction) {
}
TEST_P(QualifiedForLanguage, MemberFunctionSignedLanguage) {
- const LanguageAndQualifiedName &param = GetParam();
+ const LanguageAndQualifiedName& param = GetParam();
PushLine(10, 1, "line-file", 212966758);
SetLanguage(param.language);
SetLanguageSigned(true);
StartCU();
- DIEHandler *class_handler
+ DIEHandler* class_handler
= StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type,
"class_A");
DefineFunction(class_handler, "function_B", 10, 1, NULL);
@@ -1282,7 +1282,7 @@ TEST_F(Specifications, MemberFunction) {
PushLine(0x3341a248634e7170ULL, 0x5f6938ee5553b953ULL, "line-file", 18116691);
StartCU();
- DIEHandler *class_handler
+ DIEHandler* class_handler
= StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type, "class_A");
DeclarationDIE(class_handler, 0x7d83028c431406e8ULL,
dwarf2reader::DW_TAG_subprogram, "declaration-name", "");
@@ -1305,7 +1305,7 @@ TEST_F(Specifications, FunctionDeclarationParent) {
StartCU();
{
- DIEHandler *class_handler
+ DIEHandler* class_handler
= StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type,
"class_A");
ASSERT_TRUE(class_handler != NULL);
@@ -1333,7 +1333,7 @@ TEST_F(Specifications, NamedScopeDeclarationParent) {
StartCU();
{
- DIEHandler *space_handler
+ DIEHandler* space_handler
= StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_namespace,
"space_A");
ASSERT_TRUE(space_handler != NULL);
@@ -1345,7 +1345,7 @@ TEST_F(Specifications, NamedScopeDeclarationParent) {
}
{
- DIEHandler *class_handler
+ DIEHandler* class_handler
= StartSpecifiedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type,
0x419bb1d12f9a73a2ULL, "class-definition-name");
ASSERT_TRUE(class_handler != NULL);
@@ -1437,7 +1437,7 @@ TEST_F(Specifications, LongChain) {
// space_A::space_B::struct_C::struct_D::union_E::union_F::
// class_G::class_H::func_I
{
- DIEHandler *space_A_handler
+ DIEHandler* space_A_handler
= StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_namespace,
"space_A");
DeclarationDIE(space_A_handler, 0x2e111126496596e2ULL,
@@ -1447,10 +1447,10 @@ TEST_F(Specifications, LongChain) {
}
{
- DIEHandler *space_B_handler
+ DIEHandler* space_B_handler
= StartSpecifiedDIE(&root_handler_, dwarf2reader::DW_TAG_namespace,
0x2e111126496596e2ULL);
- DIEHandler *struct_C_handler
+ DIEHandler* struct_C_handler
= StartNamedDIE(space_B_handler, dwarf2reader::DW_TAG_structure_type,
"struct_C");
DeclarationDIE(struct_C_handler, 0x20cd423bf2a25a4cULL,
@@ -1462,10 +1462,10 @@ TEST_F(Specifications, LongChain) {
}
{
- DIEHandler *struct_D_handler
+ DIEHandler* struct_D_handler
= StartSpecifiedDIE(&root_handler_, dwarf2reader::DW_TAG_structure_type,
0x20cd423bf2a25a4cULL);
- DIEHandler *union_E_handler
+ DIEHandler* union_E_handler
= StartNamedDIE(struct_D_handler, dwarf2reader::DW_TAG_union_type,
"union_E");
DeclarationDIE(union_E_handler, 0xe25c84805aa58c32ULL,
@@ -1477,10 +1477,10 @@ TEST_F(Specifications, LongChain) {
}
{
- DIEHandler *union_F_handler
+ DIEHandler* union_F_handler
= StartSpecifiedDIE(&root_handler_, dwarf2reader::DW_TAG_union_type,
0xe25c84805aa58c32ULL);
- DIEHandler *class_G_handler
+ DIEHandler* class_G_handler
= StartNamedDIE(union_F_handler, dwarf2reader::DW_TAG_class_type,
"class_G");
DeclarationDIE(class_G_handler, 0xb70d960dcc173b6eULL,
@@ -1492,7 +1492,7 @@ TEST_F(Specifications, LongChain) {
}
{
- DIEHandler *class_H_handler
+ DIEHandler* class_H_handler
= StartSpecifiedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type,
0xb70d960dcc173b6eULL);
DeclarationDIE(class_H_handler, 0x27ff829e3bf69f37ULL,
@@ -1542,7 +1542,7 @@ TEST_F(Specifications, InterCU) {
ASSERT_TRUE(root2_handler.StartRootDIE(1,
dwarf2reader::DW_TAG_compile_unit));
ASSERT_TRUE(root2_handler.EndAttributes());
- DIEHandler *class_A_handler
+ DIEHandler* class_A_handler
= StartSpecifiedDIE(&root2_handler, dwarf2reader::DW_TAG_class_type,
0xb8fbfdd5f0b26fceULL);
DeclarationDIE(class_A_handler, 0xb01fef8b380bd1a2ULL,
@@ -1565,7 +1565,7 @@ TEST_F(Specifications, InterCU) {
root3_handler.Finish();
}
- vector<Module::Function *> functions;
+ vector<Module::Function*> functions;
m.GetFunctions(&functions, functions.end());
EXPECT_EQ(1U, functions.size());
EXPECT_STREQ("class_A::member_func_B", functions[0]->name.c_str());
@@ -1602,7 +1602,7 @@ TEST_F(Specifications, UnhandledInterCU) {
dwarf2reader::DW_TAG_compile_unit));
ASSERT_TRUE(root2_handler.EndAttributes());
EXPECT_CALL(reporter_, UnhandledInterCUReference(_, _)).Times(1);
- DIEHandler *class_A_handler
+ DIEHandler* class_A_handler
= StartSpecifiedDIE(&root2_handler, dwarf2reader::DW_TAG_class_type,
0xb8fbfdd5f0b26fceULL);
DeclarationDIE(class_A_handler, 0xb01fef8b380bd1a2ULL,
@@ -1665,7 +1665,7 @@ TEST_F(Specifications, ClassDefinitionHasOwnName) {
DeclarationDIE(&root_handler_, 0xd0fe467ec2f1a58cULL,
dwarf2reader::DW_TAG_class_type, "class-declaration-name", "");
- dwarf2reader::DIEHandler *class_definition
+ dwarf2reader::DIEHandler* class_definition
= StartSpecifiedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type,
0xd0fe467ec2f1a58cULL, "class-definition-name");
ASSERT_TRUE(class_definition);
@@ -1696,7 +1696,7 @@ TEST_F(Specifications, PreferSpecificationParents) {
StartCU();
{
- dwarf2reader::DIEHandler *declaration_class_handler =
+ dwarf2reader::DIEHandler* declaration_class_handler =
StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type,
"declaration-class");
DeclarationDIE(declaration_class_handler, 0x9ddb35517455ef7aULL,
@@ -1706,7 +1706,7 @@ TEST_F(Specifications, PreferSpecificationParents) {
delete declaration_class_handler;
}
{
- dwarf2reader::DIEHandler *definition_class_handler
+ dwarf2reader::DIEHandler* definition_class_handler
= StartNamedDIE(&root_handler_, dwarf2reader::DW_TAG_class_type,
"definition-class");
DefinitionDIE(definition_class_handler, dwarf2reader::DW_TAG_subprogram,
diff --git a/src/common/dwarf_line_to_module.cc b/src/common/dwarf_line_to_module.cc
index 443d7448..fe808c08 100644
--- a/src/common/dwarf_line_to_module.cc
+++ b/src/common/dwarf_line_to_module.cc
@@ -44,18 +44,18 @@
// it until we actually have to deal with DWARF on Windows.
// Return true if PATH is an absolute path, false if it is relative.
-static bool PathIsAbsolute(const string &path) {
+static bool PathIsAbsolute(const string& path) {
return (path.size() >= 1 && path[0] == '/');
}
-static bool HasTrailingSlash(const string &path) {
+static bool HasTrailingSlash(const string& path) {
return (path.size() >= 1 && path[path.size() - 1] == '/');
}
// If PATH is an absolute path, return PATH. If PATH is a relative path,
// treat it as relative to BASE and return the combined path.
-static string ExpandPath(const string &path,
- const string &base) {
+static string ExpandPath(const string& path,
+ const string& base) {
if (PathIsAbsolute(path) || base.empty())
return path;
return base + (HasTrailingSlash(base) ? "" : "/") + path;
@@ -63,14 +63,14 @@ static string ExpandPath(const string &path,
namespace google_breakpad {
-void DwarfLineToModule::DefineDir(const string &name, uint32_t dir_num) {
+void DwarfLineToModule::DefineDir(const string& name, uint32_t dir_num) {
// Directory number zero is reserved to mean the compilation
// directory. Silently ignore attempts to redefine it.
if (dir_num != 0)
directories_[dir_num] = ExpandPath(name, compilation_dir_);
}
-void DwarfLineToModule::DefineFile(const string &name, int32_t file_num,
+void DwarfLineToModule::DefineFile(const string& name, int32_t file_num,
uint32_t dir_num, uint64_t mod_time,
uint64_t length) {
if (file_num == -1)
diff --git a/src/common/dwarf_line_to_module.h b/src/common/dwarf_line_to_module.h
index f54ccaf5..f80f1b07 100644
--- a/src/common/dwarf_line_to_module.h
+++ b/src/common/dwarf_line_to_module.h
@@ -121,7 +121,7 @@ class DwarfLineToModule: public dwarf2reader::LineInfoHandler {
// sort out which lines belong to which functions; we don't add them
// to any particular function in MODULE ourselves.
DwarfLineToModule(Module *module, const string& compilation_dir,
- vector<Module::Line> *lines)
+ vector<Module::Line>* lines)
: module_(module),
compilation_dir_(compilation_dir),
lines_(lines),
@@ -132,8 +132,8 @@ class DwarfLineToModule: public dwarf2reader::LineInfoHandler {
~DwarfLineToModule() { }
- void DefineDir(const string &name, uint32_t dir_num);
- void DefineFile(const string &name, int32_t file_num,
+ void DefineDir(const string& name, uint32_t dir_num);
+ void DefineFile(const string& name, int32_t file_num,
uint32_t dir_num, uint64_t mod_time,
uint64_t length);
void AddLine(uint64_t address, uint64_t length,
@@ -142,7 +142,7 @@ class DwarfLineToModule: public dwarf2reader::LineInfoHandler {
private:
typedef std::map<uint32_t, string> DirectoryTable;
- typedef std::map<uint32_t, Module::File *> FileTable;
+ typedef std::map<uint32_t, Module::File*> FileTable;
// The module we're contributing debugging info to. Owned by our
// client.
@@ -161,7 +161,7 @@ class DwarfLineToModule: public dwarf2reader::LineInfoHandler {
// to the appropriate function from module_ until we've read the
// function info as well. Instead, we accumulate lines here, and let
// whoever constructed this sort it all out.
- vector<Module::Line> *lines_;
+ vector<Module::Line>* lines_;
// A table mapping directory numbers to paths.
DirectoryTable directories_;
diff --git a/src/common/dwarf_line_to_module_unittest.cc b/src/common/dwarf_line_to_module_unittest.cc
index 7c0fcfd3..90b6570d 100644
--- a/src/common/dwarf_line_to_module_unittest.cc
+++ b/src/common/dwarf_line_to_module_unittest.cc
@@ -51,7 +51,7 @@ TEST(SimpleModule, One) {
h.AddLine(0x6fd126fbf74f2680LL, 0x63c9a14cf556712bLL, 0x30bf0f27,
0x4c090cbf, 0x1cf9fe0d);
- vector<Module::File *> files;
+ vector<Module::File*> files;
m.GetFiles(&files);
EXPECT_EQ(1U, files.size());
EXPECT_STREQ("/file1", files[0]->name.c_str());
@@ -86,7 +86,7 @@ TEST(SimpleModule, Many) {
h.AddLine(0xe2d72a37f8d9403aULL, 0x034dfab5b0d4d236ULL, 0x63beb4a5,
0x75047044U, 0xb6a0016cU);
- vector<Module::File *> files;
+ vector<Module::File*> files;
m.GetFiles(&files);
ASSERT_EQ(5U, files.size());
EXPECT_STREQ("/directory1/file1", files[0]->name.c_str());
@@ -133,7 +133,7 @@ TEST(Filenames, Absolute) {
h.AddLine(1, 1, 1, 0, 0);
- vector<Module::File *> files;
+ vector<Module::File*> files;
m.GetFiles(&files);
ASSERT_EQ(1U, files.size());
EXPECT_STREQ("/absolute", files[0]->name.c_str());
@@ -151,7 +151,7 @@ TEST(Filenames, Relative) {
h.AddLine(1, 1, 1, 0, 0);
- vector<Module::File *> files;
+ vector<Module::File*> files;
m.GetFiles(&files);
ASSERT_EQ(1U, files.size());
EXPECT_STREQ("/directory1/relative", files[0]->name.c_str());
diff --git a/src/common/dwarf_range_list_handler.cc b/src/common/dwarf_range_list_handler.cc
index cc9e39ce..58982aac 100644
--- a/src/common/dwarf_range_list_handler.cc
+++ b/src/common/dwarf_range_list_handler.cc
@@ -51,7 +51,7 @@ void DwarfRangeListHandler::SetBaseAddress(uint64_t base_address) {
void DwarfRangeListHandler::Finish() {
std::sort(ranges_->begin(), ranges_->end(),
- [](const Module::Range &a, const Module::Range &b) {
+ [](const Module::Range& a, const Module::Range& b) {
return a.address < b.address;
}
);
diff --git a/src/common/dwarf_range_list_handler.h b/src/common/dwarf_range_list_handler.h
index 83a34694..2adb2f9a 100644
--- a/src/common/dwarf_range_list_handler.h
+++ b/src/common/dwarf_range_list_handler.h
@@ -51,7 +51,7 @@ namespace google_breakpad {
class DwarfRangeListHandler: public dwarf2reader::RangeListHandler {
public:
- DwarfRangeListHandler(uint64_t base_address, vector<Module::Range> *ranges)
+ DwarfRangeListHandler(uint64_t base_address, vector<Module::Range>* ranges)
: base_address_(base_address), ranges_(ranges) { }
~DwarfRangeListHandler() { }
@@ -71,7 +71,7 @@ class DwarfRangeListHandler: public dwarf2reader::RangeListHandler {
uint64_t base_address_;
// The list of ranges to be populated
- vector<Module::Range> *ranges_;
+ vector<Module::Range>* ranges_;
};
} // namespace google_breakpad
diff --git a/src/common/language.cc b/src/common/language.cc
index 440d4de1..381c8bd4 100644
--- a/src/common/language.cc
+++ b/src/common/language.cc
@@ -67,8 +67,8 @@ class CPPLanguage: public Language {
public:
CPPLanguage() {}
- string MakeQualifiedName(const string &parent_name,
- const string &name) const {
+ string MakeQualifiedName(const string& parent_name,
+ const string& name) const {
return MakeQualifiedNameWithSeparator(parent_name, "::", name);
}
@@ -108,7 +108,7 @@ class CPPLanguage: public Language {
}
private:
- static bool IsMangledName(const string &name) {
+ static bool IsMangledName(const string& name) {
// NOTE: For proper cross-compilation support, this should depend on target
// binary's platform, not current build platform.
#if defined(__APPLE__)
@@ -130,8 +130,8 @@ class JavaLanguage: public Language {
public:
JavaLanguage() {}
- string MakeQualifiedName(const string &parent_name,
- const string &name) const {
+ string MakeQualifiedName(const string& parent_name,
+ const string& name) const {
return MakeQualifiedNameWithSeparator(parent_name, ".", name);
}
};
@@ -143,8 +143,8 @@ class SwiftLanguage: public Language {
public:
SwiftLanguage() {}
- string MakeQualifiedName(const string &parent_name,
- const string &name) const {
+ string MakeQualifiedName(const string& parent_name,
+ const string& name) const {
return MakeQualifiedNameWithSeparator(parent_name, ".", name);
}
@@ -167,8 +167,8 @@ class RustLanguage: public Language {
public:
RustLanguage() {}
- string MakeQualifiedName(const string &parent_name,
- const string &name) const {
+ string MakeQualifiedName(const string& parent_name,
+ const string& name) const {
return MakeQualifiedNameWithSeparator(parent_name, ".", name);
}
@@ -202,8 +202,8 @@ class AssemblerLanguage: public Language {
AssemblerLanguage() {}
bool HasFunctions() const { return false; }
- string MakeQualifiedName(const string &parent_name,
- const string &name) const {
+ string MakeQualifiedName(const string& parent_name,
+ const string& name) const {
return name;
}
};
diff --git a/src/common/language.h b/src/common/language.h
index 2d2dbcd9..892ea862 100644
--- a/src/common/language.h
+++ b/src/common/language.h
@@ -74,8 +74,8 @@ class Language {
// take into account the parent and child DIE types, allow languages
// to use their own data type for complex parent names, etc. But if
// C++ doesn't need all that, who would?
- virtual string MakeQualifiedName (const string &parent_name,
- const string &name) const = 0;
+ virtual string MakeQualifiedName (const string& parent_name,
+ const string& name) const = 0;
enum DemangleResult {
// Demangling was not performed because it’s not appropriate to attempt.
diff --git a/src/common/linux/breakpad_getcontext.S b/src/common/linux/breakpad_getcontext.S
index fea0109d..528dba7a 100644
--- a/src/common/linux/breakpad_getcontext.S
+++ b/src/common/linux/breakpad_getcontext.S
@@ -32,7 +32,7 @@
#include "common/linux/ucontext_constants.h"
-/* int getcontext (ucontext_t *ucp) */
+/* int getcontext (ucontext_t* ucp) */
#if defined(__arm__)
@@ -336,7 +336,7 @@ symbol: .frame sp, framesize, rpc;
.size function,.-function
#endif
-/* int getcontext (ucontext_t *ucp) */
+/* int getcontext (ucontext_t* ucp) */
NESTED (breakpad_getcontext, FRAME_SIZE, ra)
.mask 0x10000000, 0
diff --git a/src/common/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc
index 997977b8..8ecf0bc4 100644
--- a/src/common/linux/dump_symbols.cc
+++ b/src/common/linux/dump_symbols.cc
@@ -144,7 +144,7 @@ class MmapWrapper {
munmap(base_, size_);
}
}
- void set(void *mapped_address, size_t mapped_size) {
+ void set(void* mapped_address, size_t mapped_size) {
is_set_ = true;
base_ = mapped_address;
size_ = mapped_size;
@@ -232,7 +232,7 @@ bool LoadStabs(const typename ElfClass::Ehdr* elf_header,
// owned by a function) with the results.
class DumperRangesHandler : public DwarfCUToModule::RangesHandler {
public:
- DumperRangesHandler(const uint8_t *buffer, uint64_t size,
+ DumperRangesHandler(const uint8_t* buffer, uint64_t size,
dwarf2reader::ByteReader* reader)
: buffer_(buffer), size_(size), reader_(reader) { }
@@ -246,7 +246,7 @@ class DumperRangesHandler : public DwarfCUToModule::RangesHandler {
}
private:
- const uint8_t *buffer_;
+ const uint8_t* buffer_;
uint64_t size_;
dwarf2reader::ByteReader* reader_;
};
@@ -257,7 +257,7 @@ class DumperRangesHandler : public DwarfCUToModule::RangesHandler {
class DumperLineToModule: public DwarfCUToModule::LineToModuleHandler {
public:
// Create a line-to-module converter using BYTE_READER.
- explicit DumperLineToModule(dwarf2reader::ByteReader *byte_reader)
+ explicit DumperLineToModule(dwarf2reader::ByteReader* byte_reader)
: byte_reader_(byte_reader) { }
void StartCompilationUnit(const string& compilation_dir) {
compilation_dir_ = compilation_dir;
@@ -278,7 +278,7 @@ class DumperLineToModule: public DwarfCUToModule::LineToModuleHandler {
}
private:
string compilation_dir_;
- dwarf2reader::ByteReader *byte_reader_;
+ dwarf2reader::ByteReader* byte_reader_;
};
template<typename ElfClass>
@@ -308,7 +308,7 @@ bool LoadDwarf(const string& dwarf_filename,
string name = GetOffset<ElfClass, char>(elf_header,
section_names->sh_offset) +
section->sh_name;
- const uint8_t *contents = GetOffset<ElfClass, uint8_t>(elf_header,
+ const uint8_t* contents = GetOffset<ElfClass, uint8_t>(elf_header,
section->sh_offset);
file_context.AddSectionToSectionMap(name, contents, section->sh_size);
}
@@ -318,7 +318,7 @@ bool LoadDwarf(const string& dwarf_filename,
dwarf2reader::SectionMap::const_iterator ranges_entry =
file_context.section_map().find(".debug_ranges");
if (ranges_entry != file_context.section_map().end()) {
- const std::pair<const uint8_t *, uint64_t>& ranges_section =
+ const std::pair<const uint8_t*, uint64_t>& ranges_section =
ranges_entry->second;
ranges_handler.reset(
new DumperRangesHandler(ranges_section.first, ranges_section.second,
@@ -330,7 +330,7 @@ bool LoadDwarf(const string& dwarf_filename,
dwarf2reader::SectionMap::const_iterator debug_info_entry =
file_context.section_map().find(".debug_info");
assert(debug_info_entry != file_context.section_map().end());
- const std::pair<const uint8_t *, uint64_t>& debug_info_section =
+ const std::pair<const uint8_t*, uint64_t>& debug_info_section =
debug_info_entry->second;
// This should never have been called if the file doesn't have a
// .debug_info section.
@@ -409,7 +409,7 @@ bool LoadDwarfCFI(const string& dwarf_filename,
dwarf2reader::ENDIANNESS_BIG : dwarf2reader::ENDIANNESS_LITTLE;
// Find the call frame information and its size.
- const uint8_t *cfi =
+ const uint8_t* cfi =
GetOffset<ElfClass, uint8_t>(elf_header, section->sh_offset);
size_t cfi_size = section->sh_size;
@@ -497,13 +497,13 @@ bool IsSameFile(const char* left_abspath, const string& right_path) {
// Read the .gnu_debuglink and get the debug file name. If anything goes
// wrong, return an empty string.
-string ReadDebugLink(const uint8_t *debuglink,
+string ReadDebugLink(const uint8_t* debuglink,
const size_t debuglink_size,
const bool big_endian,
const string& obj_file,
const std::vector<string>& debug_dirs) {
// Include '\0' + CRC32 (4 bytes).
- size_t debuglink_len = strlen(reinterpret_cast<const char *>(debuglink)) + 5;
+ size_t debuglink_len = strlen(reinterpret_cast<const char*>(debuglink)) + 5;
debuglink_len = 4 * ((debuglink_len + 3) / 4); // Round up to 4 bytes.
// Sanity check.
@@ -525,7 +525,7 @@ string ReadDebugLink(const uint8_t *debuglink,
for (it = debug_dirs.begin(); it < debug_dirs.end(); ++it) {
const string& debug_dir = *it;
debuglink_path = debug_dir + "/" +
- reinterpret_cast<const char *>(debuglink);
+ reinterpret_cast<const char*>(debuglink);
// There is the annoying case of /path/to/foo.so having foo.so as the
// debug link file name. Thus this may end up opening /path/to/foo.so again,
@@ -599,7 +599,7 @@ class LoadSymbolsInfo {
// Keeps track of which sections have been loaded so sections don't
// accidentally get loaded twice from two different files.
- void LoadedSection(const string &section) {
+ void LoadedSection(const string& section) {
if (loaded_sections_.count(section) == 0) {
loaded_sections_.insert(section);
} else {
@@ -610,7 +610,7 @@ class LoadSymbolsInfo {
// The ELF file and linked debug file are expected to have the same preferred
// loading address.
- void set_loading_addr(Addr addr, const string &filename) {
+ void set_loading_addr(Addr addr, const string& filename) {
if (!has_loading_addr_) {
loading_addr_ = addr;
loaded_file_ = filename;
@@ -687,7 +687,7 @@ bool LoadSymbols(const string& obj_file,
const Shdr* section_names = sections + elf_header->e_shstrndx;
const char* names =
GetOffset<ElfClass, char>(elf_header, section_names->sh_offset);
- const char *names_end = names + section_names->sh_size;
+ const char* names_end = names + section_names->sh_size;
bool found_debug_info_section = false;
bool found_usable_info = false;
@@ -867,7 +867,7 @@ bool LoadSymbols(const string& obj_file,
names_end, elf_header->e_shnum);
if (gnu_debuglink_section) {
if (!info->debug_dirs().empty()) {
- const uint8_t *debuglink_contents =
+ const uint8_t* debuglink_contents =
GetOffset<ElfClass, uint8_t>(elf_header,
gnu_debuglink_section->sh_offset);
string debuglink_file =
@@ -964,7 +964,7 @@ bool InitModuleForElfClass(const typename ElfClass::Ehdr* elf_header,
return false;
}
- const char *architecture = ElfArchitecture<ElfClass>(elf_header);
+ const char* architecture = ElfArchitecture<ElfClass>(elf_header);
if (!architecture) {
fprintf(stderr, "%s: unrecognized ELF machine architecture: %d\n",
obj_filename.c_str(), elf_header->e_machine);
@@ -1074,12 +1074,12 @@ bool ReadSymbolDataInternal(const uint8_t* obj_file,
return false;
}
-bool WriteSymbolFile(const string &load_path,
- const string &obj_file,
- const string &obj_os,
+bool WriteSymbolFile(const string& load_path,
+ const string& obj_file,
+ const string& obj_os,
const std::vector<string>& debug_dirs,
const DumpOptions& options,
- std::ostream &sym_stream) {
+ std::ostream& sym_stream) {
Module* module;
if (!ReadSymbolData(load_path, obj_file, obj_os, debug_dirs, options,
&module))
@@ -1096,7 +1096,7 @@ bool WriteSymbolFile(const string &load_path,
bool WriteSymbolFileHeader(const string& load_path,
const string& obj_file,
const string& obj_os,
- std::ostream &sym_stream) {
+ std::ostream& sym_stream) {
MmapWrapper map_wrapper;
void* elf_header = NULL;
if (!LoadELF(load_path, &map_wrapper, &elf_header)) {
diff --git a/src/common/linux/dump_symbols.h b/src/common/linux/dump_symbols.h
index eaddd8b2..b033ce00 100644
--- a/src/common/linux/dump_symbols.h
+++ b/src/common/linux/dump_symbols.h
@@ -62,12 +62,12 @@ struct DumpOptions {
// If OBJ_FILE has been stripped but contains a .gnu_debuglink section,
// then look for the debug file in DEBUG_DIRS.
// SYMBOL_DATA allows limiting the type of symbol data written.
-bool WriteSymbolFile(const string &load_path,
- const string &obj_file,
- const string &obj_os,
+bool WriteSymbolFile(const string& load_path,
+ const string& obj_file,
+ const string& obj_os,
const std::vector<string>& debug_dirs,
const DumpOptions& options,
- std::ostream &sym_stream);
+ std::ostream& sym_stream);
// Read the selected object file's debugging information, and write out the
// header only to |stream|. Return true on success; if an error occurs, report
@@ -76,7 +76,7 @@ bool WriteSymbolFile(const string &load_path,
bool WriteSymbolFileHeader(const string& load_path,
const string& obj_file,
const string& obj_os,
- std::ostream &sym_stream);
+ std::ostream& sym_stream);
// As above, but simply return the debugging information in MODULE
// instead of writing it to a stream. The caller owns the resulting
diff --git a/src/common/linux/elf_symbols_to_module.cc b/src/common/linux/elf_symbols_to_module.cc
index 562875e1..81e985a7 100644
--- a/src/common/linux/elf_symbols_to_module.cc
+++ b/src/common/linux/elf_symbols_to_module.cc
@@ -69,7 +69,7 @@ public:
// otherwise. Assume each symbol has a 'value' field whose size is
// VALUE_SIZE.
//
- ELFSymbolIterator(const ByteBuffer *buffer, bool big_endian,
+ ELFSymbolIterator(const ByteBuffer* buffer, bool big_endian,
size_t value_size)
: value_size_(value_size), cursor_(buffer, big_endian) {
// Actually, weird sizes could be handled just fine, but they're
@@ -81,13 +81,13 @@ public:
// Move to the next symbol. This function's behavior is undefined if
// at_end() is true when it is called.
- ELFSymbolIterator &operator++() { Fetch(); symbol_.index++; return *this; }
+ ELFSymbolIterator& operator++() { Fetch(); symbol_.index++; return *this; }
// Dereferencing this iterator produces a reference to an Symbol structure
// that holds the current symbol's values. The symbol is owned by this
// SymbolIterator, and will be invalidated at the next call to operator++.
- const Symbol &operator*() const { return symbol_; }
- const Symbol *operator->() const { return &symbol_; }
+ const Symbol& operator*() const { return symbol_; }
+ const Symbol* operator->() const { return &symbol_; }
private:
// Read the symbol at cursor_, and set symbol_ appropriately.
@@ -126,21 +126,21 @@ private:
Symbol symbol_;
};
-const char *SymbolString(ptrdiff_t offset, ByteBuffer& strings) {
+const char* SymbolString(ptrdiff_t offset, ByteBuffer& strings) {
if (offset < 0 || (size_t) offset >= strings.Size()) {
// Return the null string.
offset = 0;
}
- return reinterpret_cast<const char *>(strings.start + offset);
+ return reinterpret_cast<const char*>(strings.start + offset);
}
-bool ELFSymbolsToModule(const uint8_t *symtab_section,
+bool ELFSymbolsToModule(const uint8_t* symtab_section,
size_t symtab_size,
- const uint8_t *string_section,
+ const uint8_t* string_section,
size_t string_size,
const bool big_endian,
size_t value_size,
- Module *module) {
+ Module* module) {
ByteBuffer symbols(symtab_section, symtab_size);
// Ensure that the string section is null-terminated.
if (string_section[string_size - 1] != '\0') {
@@ -156,7 +156,7 @@ bool ELFSymbolsToModule(const uint8_t *symtab_section,
while(!iterator->at_end) {
if (ELF32_ST_TYPE(iterator->info) == STT_FUNC &&
iterator->shndx != SHN_UNDEF) {
- Module::Extern *ext = new Module::Extern(iterator->value);
+ Module::Extern* ext = new Module::Extern(iterator->value);
ext->name = SymbolString(iterator->name_offset, strings);
#if !defined(__ANDROID__) // Android NDK doesn't provide abi::__cxa_demangle.
int status = 0;
diff --git a/src/common/linux/elf_symbols_to_module.h b/src/common/linux/elf_symbols_to_module.h
index 2e7c0971..861f7252 100644
--- a/src/common/linux/elf_symbols_to_module.h
+++ b/src/common/linux/elf_symbols_to_module.h
@@ -44,13 +44,13 @@ namespace google_breakpad {
class Module;
-bool ELFSymbolsToModule(const uint8_t *symtab_section,
+bool ELFSymbolsToModule(const uint8_t* symtab_section,
size_t symtab_size,
- const uint8_t *string_section,
+ const uint8_t* string_section,
size_t string_size,
const bool big_endian,
size_t value_size,
- Module *module);
+ Module* module);
} // namespace google_breakpad
diff --git a/src/common/linux/elf_symbols_to_module_unittest.cc b/src/common/linux/elf_symbols_to_module_unittest.cc
index 8984449a..3f665898 100644
--- a/src/common/linux/elf_symbols_to_module_unittest.cc
+++ b/src/common/linux/elf_symbols_to_module_unittest.cc
@@ -86,7 +86,7 @@ public:
// 4 or 8 (bytes)
size_t value_size;
- vector<Module::Extern *> externs;
+ vector<Module::Extern*> externs;
};
class ELFSymbolsToModuleTest32 : public ELFSymbolsToModuleTestFixture,
diff --git a/src/common/linux/elfutils.cc b/src/common/linux/elfutils.cc
index 9532d5ad..ce9e9c1c 100644
--- a/src/common/linux/elfutils.cc
+++ b/src/common/linux/elfutils.cc
@@ -40,11 +40,11 @@ namespace google_breakpad {
namespace {
template<typename ElfClass>
-void FindElfClassSection(const char *elf_base,
- const char *section_name,
+void FindElfClassSection(const char* elf_base,
+ const char* section_name,
typename ElfClass::Word section_type,
- const void **section_start,
- size_t *section_size) {
+ const void** section_start,
+ size_t* section_size) {
typedef typename ElfClass::Ehdr Ehdr;
typedef typename ElfClass::Shdr Shdr;
@@ -62,7 +62,7 @@ void FindElfClassSection(const char *elf_base,
const Shdr* section_names = sections + elf_header->e_shstrndx;
const char* names =
GetOffset<ElfClass, char>(elf_header, section_names->sh_offset);
- const char *names_end = names + section_names->sh_size;
+ const char* names_end = names + section_names->sh_size;
const Shdr* section =
FindElfSectionByName<ElfClass>(section_name, section_type,
@@ -76,9 +76,9 @@ void FindElfClassSection(const char *elf_base,
}
template<typename ElfClass>
-void FindElfClassSegment(const char *elf_base,
+void FindElfClassSegment(const char* elf_base,
typename ElfClass::Word segment_type,
- wasteful_vector<ElfSegment> *segments) {
+ wasteful_vector<ElfSegment>* segments) {
typedef typename ElfClass::Ehdr Ehdr;
typedef typename ElfClass::Phdr Phdr;
@@ -117,11 +117,11 @@ int ElfClass(const void* elf_base) {
return elf_header->e_ident[EI_CLASS];
}
-bool FindElfSection(const void *elf_mapped_base,
- const char *section_name,
+bool FindElfSection(const void* elf_mapped_base,
+ const char* section_name,
uint32_t section_type,
- const void **section_start,
- size_t *section_size) {
+ const void** section_start,
+ size_t* section_size) {
assert(elf_mapped_base);
assert(section_start);
assert(section_size);
diff --git a/src/common/linux/elfutils.h b/src/common/linux/elfutils.h
index aefb6cf5..ec5872a4 100644
--- a/src/common/linux/elfutils.h
+++ b/src/common/linux/elfutils.h
@@ -86,11 +86,11 @@ int ElfClass(const void* elf_base);
// in the ELF binary data at |elf_mapped_base|. On success, returns true
// and sets |*section_start| to point to the start of the section data,
// and |*section_size| to the size of the section's data.
-bool FindElfSection(const void *elf_mapped_base,
- const char *section_name,
+bool FindElfSection(const void* elf_mapped_base,
+ const char* section_name,
uint32_t section_type,
- const void **section_start,
- size_t *section_size);
+ const void** section_start,
+ size_t* section_size);
// Internal helper method, exposed for convenience for callers
// that already have more info.
diff --git a/src/common/linux/file_id.cc b/src/common/linux/file_id.cc
index 67921c45..9944af7a 100644
--- a/src/common/linux/file_id.cc
+++ b/src/common/linux/file_id.cc
@@ -61,7 +61,7 @@ FileID::FileID(const char* path) : path_(path) {}
// These functions are also used inside the crashed process, so be safe
// and use the syscall/libc wrappers instead of direct syscalls or libc.
-static bool ElfClassBuildIDNoteIdentifier(const void *section, size_t length,
+static bool ElfClassBuildIDNoteIdentifier(const void* section, size_t length,
wasteful_vector<uint8_t>& identifier) {
static_assert(sizeof(ElfClass32::Nhdr) == sizeof(ElfClass64::Nhdr),
"Elf32_Nhdr and Elf64_Nhdr should be the same");
@@ -69,7 +69,7 @@ static bool ElfClassBuildIDNoteIdentifier(const void *section, size_t length,
const void* section_end = reinterpret_cast<const char*>(section) + length;
const Nhdr* note_header = reinterpret_cast<const Nhdr*>(section);
- while (reinterpret_cast<const void *>(note_header) < section_end) {
+ while (reinterpret_cast<const void*>(note_header) < section_end) {
if (note_header->n_type == NT_GNU_BUILD_ID)
break;
note_header = reinterpret_cast<const Nhdr*>(
@@ -77,7 +77,7 @@ static bool ElfClassBuildIDNoteIdentifier(const void *section, size_t length,
NOTE_PADDING(note_header->n_namesz) +
NOTE_PADDING(note_header->n_descsz));
}
- if (reinterpret_cast<const void *>(note_header) >= section_end ||
+ if (reinterpret_cast<const void*>(note_header) >= section_end ||
note_header->n_descsz == 0) {
return false;
}
diff --git a/src/common/linux/file_id_unittest.cc b/src/common/linux/file_id_unittest.cc
index f4f9ac45..477783d9 100644
--- a/src/common/linux/file_id_unittest.cc
+++ b/src/common/linux/file_id_unittest.cc
@@ -261,7 +261,7 @@ TYPED_TEST(FileIDTest, BuildIDPH) {
elf.AddSection(".text", text, SHT_PROGBITS);
Notes notes(kLittleEndian);
notes.AddNote(0, "Linux",
- reinterpret_cast<const uint8_t *>("\0x42\0x02\0\0"), 4);
+ reinterpret_cast<const uint8_t*>("\0x42\0x02\0\0"), 4);
notes.AddNote(NT_GNU_BUILD_ID, "GNU", kExpectedIdentifierBytes,
sizeof(kExpectedIdentifierBytes));
int note_idx = elf.AddSection(".note", notes, SHT_NOTE);
@@ -292,7 +292,7 @@ TYPED_TEST(FileIDTest, BuildIDMultiplePH) {
elf.AddSection(".text", text, SHT_PROGBITS);
Notes notes1(kLittleEndian);
notes1.AddNote(0, "Linux",
- reinterpret_cast<const uint8_t *>("\0x42\0x02\0\0"), 4);
+ reinterpret_cast<const uint8_t*>("\0x42\0x02\0\0"), 4);
Notes notes2(kLittleEndian);
notes2.AddNote(NT_GNU_BUILD_ID, "GNU", kExpectedIdentifierBytes,
sizeof(kExpectedIdentifierBytes));
diff --git a/src/common/linux/guid_creator.cc b/src/common/linux/guid_creator.cc
index 03e3d781..63740638 100644
--- a/src/common/linux/guid_creator.cc
+++ b/src/common/linux/guid_creator.cc
@@ -105,7 +105,7 @@ class GUIDGenerator {
private:
#ifdef HAVE_ARC4RANDOM
static void CreateGuidFromArc4Random(GUID *guid) {
- char *buf = reinterpret_cast<char *>(guid);
+ char *buf = reinterpret_cast<char*>(guid);
for (size_t i = 0; i < sizeof(GUID); i += sizeof(uint32_t)) {
uint32_t random_data = arc4random();
@@ -129,7 +129,7 @@ class GUIDGenerator {
#if defined(HAVE_SYS_RANDOM_H) && defined(HAVE_GETRANDOM)
static bool CreateGUIDFromGetrandom(GUID *guid) {
- char *buf = reinterpret_cast<char *>(guid);
+ char *buf = reinterpret_cast<char*>(guid);
int read_bytes = getrandom(buf, sizeof(GUID), GRND_NONBLOCK);
return (read_bytes == static_cast<int>(sizeof(GUID)));
@@ -139,7 +139,7 @@ class GUIDGenerator {
// Populate the GUID using random bytes read from /dev/urandom, returns false
// if the GUID wasn't fully populated with random data.
static bool CreateGUIDFromDevUrandom(GUID *guid) {
- char *buf = reinterpret_cast<char *>(guid);
+ char *buf = reinterpret_cast<char*>(guid);
int fd = open("/dev/urandom", O_RDONLY | O_CLOEXEC);
if (fd == -1) {
@@ -154,7 +154,7 @@ class GUIDGenerator {
// Populate the GUID using a stream of random bytes obtained from rand().
static void CreateGUIDFromRand(GUID *guid) {
- char *buf = reinterpret_cast<char *>(guid);
+ char *buf = reinterpret_cast<char*>(guid);
InitOnce();
diff --git a/src/common/linux/http_upload.cc b/src/common/linux/http_upload.cc
index 702526af..ace12b84 100644
--- a/src/common/linux/http_upload.cc
+++ b/src/common/linux/http_upload.cc
@@ -36,14 +36,14 @@
namespace {
// Callback to get the response data from server.
-static size_t WriteCallback(void *ptr, size_t size,
- size_t nmemb, void *userp) {
+static size_t WriteCallback(void* ptr, size_t size,
+ size_t nmemb, void* userp) {
if (!userp)
return 0;
- string *response = reinterpret_cast<string *>(userp);
+ string* response = reinterpret_cast<string*>(userp);
size_t real_size = size * nmemb;
- response->append(reinterpret_cast<char *>(ptr), real_size);
+ response->append(reinterpret_cast<char*>(ptr), real_size);
return real_size;
}
@@ -54,15 +54,15 @@ namespace google_breakpad {
static const char kUserAgent[] = "Breakpad/1.0 (Linux)";
// static
-bool HTTPUpload::SendRequest(const string &url,
- const map<string, string> &parameters,
- const map<string, string> &files,
- const string &proxy,
- const string &proxy_user_pwd,
- const string &ca_certificate_file,
- string *response_body,
- long *response_code,
- string *error_description) {
+bool HTTPUpload::SendRequest(const string& url,
+ const map<string, string>& parameters,
+ const map<string, string>& files,
+ const string& proxy,
+ const string& proxy_user_pwd,
+ const string& ca_certificate_file,
+ string* response_body,
+ long* response_code,
+ string* error_description) {
if (response_code != NULL)
*response_code = 0;
@@ -101,7 +101,7 @@ bool HTTPUpload::SendRequest(const string &url,
CURL* (*curl_easy_init)(void);
*(void**) (&curl_easy_init) = dlsym(curl_lib, "curl_easy_init");
- CURL *curl = (*curl_easy_init)();
+ CURL* curl = (*curl_easy_init)();
if (error_description != NULL)
*error_description = "No Error";
@@ -111,7 +111,7 @@ bool HTTPUpload::SendRequest(const string &url,
}
CURLcode err_code = CURLE_OK;
- CURLcode (*curl_easy_setopt)(CURL *, CURLoption, ...);
+ CURLcode (*curl_easy_setopt)(CURL*, CURLoption, ...);
*(void**) (&curl_easy_setopt) = dlsym(curl_lib, "curl_easy_setopt");
(*curl_easy_setopt)(curl, CURLOPT_URL, url.c_str());
(*curl_easy_setopt)(curl, CURLOPT_USERAGENT, kUserAgent);
@@ -128,10 +128,10 @@ bool HTTPUpload::SendRequest(const string &url,
if (!ca_certificate_file.empty())
(*curl_easy_setopt)(curl, CURLOPT_CAINFO, ca_certificate_file.c_str());
- struct curl_httppost *formpost = NULL;
- struct curl_httppost *lastptr = NULL;
+ struct curl_httppost* formpost = NULL;
+ struct curl_httppost* lastptr = NULL;
// Add form data.
- CURLFORMcode (*curl_formadd)(struct curl_httppost **, struct curl_httppost **, ...);
+ CURLFORMcode (*curl_formadd)(struct curl_httppost**, struct curl_httppost**, ...);
*(void**) (&curl_formadd) = dlsym(curl_lib, "curl_formadd");
map<string, string>::const_iterator iter = parameters.begin();
for (; iter != parameters.end(); ++iter)
@@ -151,9 +151,9 @@ bool HTTPUpload::SendRequest(const string &url,
(*curl_easy_setopt)(curl, CURLOPT_HTTPPOST, formpost);
// Disable 100-continue header.
- struct curl_slist *headerlist = NULL;
+ struct curl_slist* headerlist = NULL;
char buf[] = "Expect:";
- struct curl_slist* (*curl_slist_append)(struct curl_slist *, const char *);
+ struct curl_slist* (*curl_slist_append)(struct curl_slist*, const char*);
*(void**) (&curl_slist_append) = dlsym(curl_lib, "curl_slist_append");
headerlist = (*curl_slist_append)(headerlist, buf);
(*curl_easy_setopt)(curl, CURLOPT_HTTPHEADER, headerlist);
@@ -161,17 +161,17 @@ bool HTTPUpload::SendRequest(const string &url,
if (response_body != NULL) {
(*curl_easy_setopt)(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
(*curl_easy_setopt)(curl, CURLOPT_WRITEDATA,
- reinterpret_cast<void *>(response_body));
+ reinterpret_cast<void*>(response_body));
}
// Fail if 400+ is returned from the web server.
(*curl_easy_setopt)(curl, CURLOPT_FAILONERROR, 1);
- CURLcode (*curl_easy_perform)(CURL *);
+ CURLcode (*curl_easy_perform)(CURL*);
*(void**) (&curl_easy_perform) = dlsym(curl_lib, "curl_easy_perform");
err_code = (*curl_easy_perform)(curl);
if (response_code != NULL) {
- CURLcode (*curl_easy_getinfo)(CURL *, CURLINFO, ...);
+ CURLcode (*curl_easy_getinfo)(CURL*, CURLINFO, ...);
*(void**) (&curl_easy_getinfo) = dlsym(curl_lib, "curl_easy_getinfo");
(*curl_easy_getinfo)(curl, CURLINFO_RESPONSE_CODE, response_code);
}
@@ -186,16 +186,16 @@ bool HTTPUpload::SendRequest(const string &url,
if (error_description != NULL)
*error_description = (*curl_easy_strerror)(err_code);
- void (*curl_easy_cleanup)(CURL *);
+ void (*curl_easy_cleanup)(CURL*);
*(void**) (&curl_easy_cleanup) = dlsym(curl_lib, "curl_easy_cleanup");
(*curl_easy_cleanup)(curl);
if (formpost != NULL) {
- void (*curl_formfree)(struct curl_httppost *);
+ void (*curl_formfree)(struct curl_httppost*);
*(void**) (&curl_formfree) = dlsym(curl_lib, "curl_formfree");
(*curl_formfree)(formpost);
}
if (headerlist != NULL) {
- void (*curl_slist_free_all)(struct curl_slist *);
+ void (*curl_slist_free_all)(struct curl_slist*);
*(void**) (&curl_slist_free_all) = dlsym(curl_lib, "curl_slist_free_all");
(*curl_slist_free_all)(headerlist);
}
@@ -211,10 +211,10 @@ bool HTTPUpload::CheckCurlLib(void* curl_lib) {
}
// static
-bool HTTPUpload::CheckParameters(const map<string, string> &parameters) {
+bool HTTPUpload::CheckParameters(const map<string, string>& parameters) {
for (map<string, string>::const_iterator pos = parameters.begin();
pos != parameters.end(); ++pos) {
- const string &str = pos->first;
+ const string& str = pos->first;
if (str.size() == 0)
return false; // disallow empty parameter names
for (unsigned int i = 0; i < str.size(); ++i) {
diff --git a/src/common/linux/http_upload.h b/src/common/linux/http_upload.h
index bc1d5d57..13f3d56c 100644
--- a/src/common/linux/http_upload.h
+++ b/src/common/linux/http_upload.h
@@ -58,21 +58,21 @@ class HTTPUpload {
// received (or 0 if the request failed before getting an HTTP response).
// If the send fails, a description of the error will be
// returned in error_description.
- static bool SendRequest(const string &url,
- const map<string, string> &parameters,
- const map<string, string> &files,
- const string &proxy,
- const string &proxy_user_pwd,
- const string &ca_certificate_file,
- string *response_body,
- long *response_code,
- string *error_description);
+ static bool SendRequest(const string& url,
+ const map<string, string>& parameters,
+ const map<string, string>& files,
+ const string& proxy,
+ const string& proxy_user_pwd,
+ const string& ca_certificate_file,
+ string* response_body,
+ long* response_code,
+ string* error_description);
private:
// Checks that the given list of parameters has only printable
// ASCII characters in the parameter name, and does not contain
// any quote (") characters. Returns true if so.
- static bool CheckParameters(const map<string, string> &parameters);
+ static bool CheckParameters(const map<string, string>& parameters);
// Checks the curl_lib parameter points to a valid curl lib.
static bool CheckCurlLib(void* curl_lib);
@@ -80,8 +80,8 @@ class HTTPUpload {
// No instances of this class should be created.
// Disallow all constructors, destructors, and operator=.
HTTPUpload();
- explicit HTTPUpload(const HTTPUpload &);
- void operator=(const HTTPUpload &);
+ explicit HTTPUpload(const HTTPUpload&);
+ void operator=(const HTTPUpload&);
~HTTPUpload();
};
diff --git a/src/common/linux/libcurl_wrapper.cc b/src/common/linux/libcurl_wrapper.cc
index e96c2038..fdb200f8 100644
--- a/src/common/linux/libcurl_wrapper.cc
+++ b/src/common/linux/libcurl_wrapper.cc
@@ -88,14 +88,14 @@ bool LibcurlWrapper::AddFile(const string& upload_file_path,
}
// Callback to get the response data from server.
-static size_t WriteCallback(void *ptr, size_t size,
- size_t nmemb, void *userp) {
+static size_t WriteCallback(void* ptr, size_t size,
+ size_t nmemb, void* userp) {
if (!userp)
return 0;
- string *response = reinterpret_cast<string *>(userp);
+ string* response = reinterpret_cast<string*>(userp);
size_t real_size = size * nmemb;
- response->append(reinterpret_cast<char *>(ptr), real_size);
+ response->append(reinterpret_cast<char*>(ptr), real_size);
return real_size;
}
@@ -250,7 +250,7 @@ bool LibcurlWrapper::SetFunctionPointers() {
SET_AND_CHECK_FUNCTION_POINTER(easy_getinfo_,
"curl_easy_getinfo",
- CURLcode(*)(CURL *, CURLINFO info, ...));
+ CURLcode(*)(CURL*, CURLINFO info, ...));
SET_AND_CHECK_FUNCTION_POINTER(easy_reset_,
"curl_easy_reset",
diff --git a/src/common/linux/libcurl_wrapper.h b/src/common/linux/libcurl_wrapper.h
index 77aa6cbb..823f83c7 100644
--- a/src/common/linux/libcurl_wrapper.h
+++ b/src/common/linux/libcurl_wrapper.h
@@ -91,27 +91,27 @@ class LibcurlWrapper {
// dealing
// with CURL.
- CURL *curl_; // Pointer for handle for CURL calls.
+ CURL* curl_; // Pointer for handle for CURL calls.
CURL* (*easy_init_)(void);
// Stateful pointers for calling into curl_formadd()
- struct curl_httppost *formpost_;
- struct curl_httppost *lastptr_;
- struct curl_slist *headerlist_;
+ struct curl_httppost* formpost_;
+ struct curl_httppost* lastptr_;
+ struct curl_slist* headerlist_;
// Function pointers into CURL library
- CURLcode (*easy_setopt_)(CURL *, CURLoption, ...);
- CURLFORMcode (*formadd_)(struct curl_httppost **,
- struct curl_httppost **, ...);
- struct curl_slist* (*slist_append_)(struct curl_slist *, const char *);
- void (*slist_free_all_)(struct curl_slist *);
- CURLcode (*easy_perform_)(CURL *);
+ CURLcode (*easy_setopt_)(CURL*, CURLoption, ...);
+ CURLFORMcode (*formadd_)(struct curl_httppost**,
+ struct curl_httppost**, ...);
+ struct curl_slist* (*slist_append_)(struct curl_slist*, const char*);
+ void (*slist_free_all_)(struct curl_slist*);
+ CURLcode (*easy_perform_)(CURL*);
const char* (*easy_strerror_)(CURLcode);
- void (*easy_cleanup_)(CURL *);
- CURLcode (*easy_getinfo_)(CURL *, CURLINFO info, ...);
+ void (*easy_cleanup_)(CURL*);
+ CURLcode (*easy_getinfo_)(CURL*, CURLINFO info, ...);
void (*easy_reset_)(CURL*);
- void (*formfree_)(struct curl_httppost *);
+ void (*formfree_)(struct curl_httppost*);
};
}
diff --git a/src/common/linux/linux_libc_support.cc b/src/common/linux/linux_libc_support.cc
index 08b0325e..dd292962 100644
--- a/src/common/linux/linux_libc_support.cc
+++ b/src/common/linux/linux_libc_support.cc
@@ -190,7 +190,7 @@ const char* my_read_decimal_ptr(uintptr_t* result, const char* s) {
}
void my_memset(void* ip, char c, size_t len) {
- char* p = (char *) ip;
+ char* p = (char*) ip;
while (len--)
*p++ = c;
}
diff --git a/src/common/linux/symbol_upload.cc b/src/common/linux/symbol_upload.cc
index 87741a0a..1d5ff719 100644
--- a/src/common/linux/symbol_upload.cc
+++ b/src/common/linux/symbol_upload.cc
@@ -46,8 +46,8 @@
namespace google_breakpad {
namespace sym_upload {
-void TokenizeByChar(const string &source_string, int c,
- std::vector<string> *results) {
+void TokenizeByChar(const string& source_string, int c,
+ std::vector<string>* results) {
assert(results);
string::size_type cur_pos = 0, next_pos = 0;
while ((next_pos = source_string.find(c, cur_pos)) != string::npos) {
@@ -62,8 +62,8 @@ void TokenizeByChar(const string &source_string, int c,
//=============================================================================
// Parse out the module line which have 5 parts.
// MODULE <os> <cpu> <uuid> <module-name>
-bool ModuleDataForSymbolFile(const string &file,
- std::vector<string> *module_parts) {
+bool ModuleDataForSymbolFile(const string& file,
+ std::vector<string>* module_parts) {
assert(module_parts);
const size_t kModulePartNumber = 5;
FILE* fp = fopen(file.c_str(), "r");
@@ -90,7 +90,7 @@ bool ModuleDataForSymbolFile(const string &file,
}
//=============================================================================
-string CompactIdentifier(const string &uuid) {
+string CompactIdentifier(const string& uuid) {
std::vector<string> components;
TokenizeByChar(uuid, '-', &components);
string result;
diff --git a/src/common/linux/synth_elf.cc b/src/common/linux/synth_elf.cc
index 98e81dab..2ba25e61 100644
--- a/src/common/linux/synth_elf.cc
+++ b/src/common/linux/synth_elf.cc
@@ -118,7 +118,7 @@ int ELF::AddSection(const string& name, const Section& section,
return index;
}
-void ELF::AppendSection(ElfSection &section) {
+void ELF::AppendSection(ElfSection& section) {
// NULL and NOBITS sections have no content, so they
// don't need to be written to the file.
if (section.type_ == SHT_NULL) {
@@ -242,7 +242,7 @@ void SymbolTable::AddSymbol(const string& name, uint64_t value,
D64(size);
}
-void Notes::AddNote(int type, const string &name, const uint8_t* desc_bytes,
+void Notes::AddNote(int type, const string& name, const uint8_t* desc_bytes,
size_t desc_size) {
// Elf32_Nhdr and Elf64_Nhdr are exactly the same.
Elf32_Nhdr note_header;
diff --git a/src/common/linux/synth_elf.h b/src/common/linux/synth_elf.h
index 1d2a20ca..90fa28c0 100644
--- a/src/common/linux/synth_elf.h
+++ b/src/common/linux/synth_elf.h
@@ -154,7 +154,7 @@ class ELF : public Section {
vector<ElfSection> sections_;
- void AppendSection(ElfSection &section);
+ void AppendSection(ElfSection& section);
};
// A class to build .symtab or .dynsym sections.
@@ -187,7 +187,7 @@ public:
}
// Add a note.
- void AddNote(int type, const string &name, const uint8_t* desc_bytes,
+ void AddNote(int type, const string& name, const uint8_t* desc_bytes,
size_t desc_size);
};
diff --git a/src/common/linux/synth_elf_unittest.cc b/src/common/linux/synth_elf_unittest.cc
index cd74c286..fb3601e6 100644
--- a/src/common/linux/synth_elf_unittest.cc
+++ b/src/common/linux/synth_elf_unittest.cc
@@ -381,9 +381,9 @@ TEST_F(ElfNotesTest, Empty) {
TEST_F(ElfNotesTest, Notes) {
Notes notes(kLittleEndian);
- notes.AddNote(1, "Linux", reinterpret_cast<const uint8_t *>("\x42\x02\0\0"),
+ notes.AddNote(1, "Linux", reinterpret_cast<const uint8_t*>("\x42\x02\0\0"),
4);
- notes.AddNote(2, "a", reinterpret_cast<const uint8_t *>("foobar"),
+ notes.AddNote(2, "a", reinterpret_cast<const uint8_t*>("foobar"),
sizeof("foobar") - 1);
const uint8_t kExpectedNotesContents[] = {
diff --git a/src/common/linux/tests/crash_generator.cc b/src/common/linux/tests/crash_generator.cc
index 6896a688..a70df28a 100644
--- a/src/common/linux/tests/crash_generator.cc
+++ b/src/common/linux/tests/crash_generator.cc
@@ -79,7 +79,7 @@ int tkill(pid_t tid, int sig) {
// Core file size limit set to 1 MB, which is big enough for test purposes.
const rlim_t kCoreSizeLimit = 1024 * 1024;
-void *thread_function(void *data) {
+void* thread_function(void* data) {
ThreadData* thread_data = reinterpret_cast<ThreadData*>(data);
volatile pid_t thread_id = gettid();
*(thread_data->thread_id_ptr) = thread_id;
diff --git a/src/common/mac/MachIPC.h b/src/common/mac/MachIPC.h
index 71419be9..a3fae5a1 100644
--- a/src/common/mac/MachIPC.h
+++ b/src/common/mac/MachIPC.h
@@ -73,7 +73,7 @@
// mach_port_t task = message.GetTranslatedPort(0);
// mach_port_t thread = message.GetTranslatedPort(1);
//
-// char *messageString = message.GetData();
+// char* messageString = message.GetData();
//
// printf("message string = %s\n", messageString);
// }
@@ -164,7 +164,7 @@ class MachMessage {
public:
// The receiver of the message can retrieve the raw data this way
- uint8_t *GetData() {
+ uint8_t* GetData() {
return GetDataLength() > 0 ? GetDataPacket()->data : NULL;
}
@@ -181,10 +181,10 @@ class MachMessage {
// Adds a descriptor (typically a mach port) to be translated
// returns true if successful, otherwise not enough space
- bool AddDescriptor(const MachMsgPortDescriptor &desc);
+ bool AddDescriptor(const MachMsgPortDescriptor& desc);
int GetDescriptorCount() const { return body.msgh_descriptor_count; }
- MachMsgPortDescriptor *GetDescriptor(int n);
+ MachMsgPortDescriptor* GetDescriptor(int n);
// Convenience method which gets the mach port described by the descriptor
mach_port_t GetTranslatedPort(int n);
@@ -193,7 +193,7 @@ class MachMessage {
bool IsSimpleMessage() const { return GetDescriptorCount() == 0; }
// Sets raw data for the message (returns false if not enough space)
- bool SetData(void *data, int32_t data_length);
+ bool SetData(void* data, int32_t data_length);
protected:
// Consider this an abstract base class - must create an actual instance
@@ -216,7 +216,7 @@ class MachMessage {
MessageDataPacket* GetDataPacket();
void SetDescriptorCount(int n);
- void SetDescriptor(int n, const MachMsgPortDescriptor &desc);
+ void SetDescriptor(int n, const MachMsgPortDescriptor& desc);
// Returns total message size setting msgh_size in the header to this value
mach_msg_size_t CalculateSize();
@@ -250,7 +250,7 @@ class MachSendMessage : public MachMessage {
class ReceivePort {
public:
// Creates a new mach port for receiving messages and registers a name for it
- explicit ReceivePort(const char *receive_port_name);
+ explicit ReceivePort(const char* receive_port_name);
// Given an already existing mach port, use it. We take ownership of the
// port and deallocate it in our destructor.
@@ -262,7 +262,7 @@ class ReceivePort {
~ReceivePort();
// Waits on the mach port until message received or timeout
- kern_return_t WaitForMessage(MachReceiveMessage *out_message,
+ kern_return_t WaitForMessage(MachReceiveMessage* out_message,
mach_msg_timeout_t timeout);
// The underlying mach port that we wrap
@@ -280,13 +280,13 @@ class ReceivePort {
class MachPortSender {
public:
// get a port with send rights corresponding to a named registered service
- explicit MachPortSender(const char *receive_port_name);
+ explicit MachPortSender(const char* receive_port_name);
// Given an already existing mach port, use it.
explicit MachPortSender(mach_port_t send_port);
- kern_return_t SendMessage(MachSendMessage &message,
+ kern_return_t SendMessage(MachSendMessage& message,
mach_msg_timeout_t timeout);
private:
diff --git a/src/common/mac/MachIPC.mm b/src/common/mac/MachIPC.mm
index dc9773f7..b41a825d 100644
--- a/src/common/mac/MachIPC.mm
+++ b/src/common/mac/MachIPC.mm
@@ -52,7 +52,7 @@ MachSendMessage::MachSendMessage(int32_t message_id) : MachMessage() {
//==============================================================================
// returns true if successful
-bool MachMessage::SetData(void *data,
+bool MachMessage::SetData(void* data,
int32_t data_length) {
// first check to make sure we have enough space
size_t size = CalculateSize();
@@ -90,9 +90,9 @@ mach_msg_size_t MachMessage::CalculateSize() {
}
//==============================================================================
-MachMessage::MessageDataPacket *MachMessage::GetDataPacket() {
+MachMessage::MessageDataPacket* MachMessage::GetDataPacket() {
size_t desc_size = sizeof(MachMsgPortDescriptor)*GetDescriptorCount();
- MessageDataPacket *packet =
+ MessageDataPacket* packet =
reinterpret_cast<MessageDataPacket*>(padding + desc_size);
return packet;
@@ -100,15 +100,15 @@ MachMessage::MessageDataPacket *MachMessage::GetDataPacket() {
//==============================================================================
void MachMessage::SetDescriptor(int n,
- const MachMsgPortDescriptor &desc) {
- MachMsgPortDescriptor *desc_array =
+ const MachMsgPortDescriptor& desc) {
+ MachMsgPortDescriptor* desc_array =
reinterpret_cast<MachMsgPortDescriptor*>(padding);
desc_array[n] = desc;
}
//==============================================================================
// returns true if successful otherwise there was not enough space
-bool MachMessage::AddDescriptor(const MachMsgPortDescriptor &desc) {
+bool MachMessage::AddDescriptor(const MachMsgPortDescriptor& desc) {
// first check to make sure we have enough space
int size = CalculateSize();
size_t new_size = size + sizeof(MachMsgPortDescriptor);
@@ -119,7 +119,7 @@ bool MachMessage::AddDescriptor(const MachMsgPortDescriptor &desc) {
// unfortunately, we need to move the data to allow space for the
// new descriptor
- u_int8_t *p = reinterpret_cast<u_int8_t*>(GetDataPacket());
+ u_int8_t* p = reinterpret_cast<u_int8_t*>(GetDataPacket());
bcopy(p, p+sizeof(MachMsgPortDescriptor), GetDataLength()+2*sizeof(int32_t));
SetDescriptor(GetDescriptorCount(), desc);
@@ -142,9 +142,9 @@ void MachMessage::SetDescriptorCount(int n) {
}
//==============================================================================
-MachMsgPortDescriptor *MachMessage::GetDescriptor(int n) {
+MachMsgPortDescriptor* MachMessage::GetDescriptor(int n) {
if (n < GetDescriptorCount()) {
- MachMsgPortDescriptor *desc =
+ MachMsgPortDescriptor* desc =
reinterpret_cast<MachMsgPortDescriptor*>(padding);
return desc + n;
}
@@ -164,7 +164,7 @@ mach_port_t MachMessage::GetTranslatedPort(int n) {
//==============================================================================
// create a new mach port for receiving messages and register a name for it
-ReceivePort::ReceivePort(const char *receive_port_name) {
+ReceivePort::ReceivePort(const char* receive_port_name) {
mach_port_t current_task = mach_task_self();
init_result_ = mach_port_allocate(current_task,
@@ -227,7 +227,7 @@ ReceivePort::~ReceivePort() {
}
//==============================================================================
-kern_return_t ReceivePort::WaitForMessage(MachReceiveMessage *out_message,
+kern_return_t ReceivePort::WaitForMessage(MachReceiveMessage* out_message,
mach_msg_timeout_t timeout) {
if (!out_message) {
return KERN_INVALID_ARGUMENT;
@@ -261,7 +261,7 @@ kern_return_t ReceivePort::WaitForMessage(MachReceiveMessage *out_message,
//==============================================================================
// get a port with send rights corresponding to a named registered service
-MachPortSender::MachPortSender(const char *receive_port_name) {
+MachPortSender::MachPortSender(const char* receive_port_name) {
mach_port_t task_bootstrap_port = 0;
init_result_ = task_get_bootstrap_port(mach_task_self(),
&task_bootstrap_port);
@@ -281,7 +281,7 @@ MachPortSender::MachPortSender(mach_port_t send_port)
}
//==============================================================================
-kern_return_t MachPortSender::SendMessage(MachSendMessage &message,
+kern_return_t MachPortSender::SendMessage(MachSendMessage& message,
mach_msg_timeout_t timeout) {
if (message.head.msgh_size == 0) {
return KERN_INVALID_VALUE; // just for safety -- never should occur
diff --git a/src/common/mac/dump_syms.cc b/src/common/mac/dump_syms.cc
index 2734ff6f..24bcd653 100644
--- a/src/common/mac/dump_syms.cc
+++ b/src/common/mac/dump_syms.cc
@@ -120,7 +120,7 @@ vector<string> list_directory(const string& directory) {
namespace google_breakpad {
-bool DumpSymbols::Read(const string &filename) {
+bool DumpSymbols::Read(const string& filename) {
struct stat st;
if (stat(filename.c_str(), &st) == -1) {
fprintf(stderr, "Could not access object file %s: %s\n",
@@ -195,7 +195,7 @@ bool DumpSymbols::Read(const string &filename) {
// Get our own copy of fat_reader's object file list.
size_t object_files_count;
- const SuperFatArch *object_files =
+ const SuperFatArch* object_files =
fat_reader.object_files(&object_files_count);
if (object_files_count == 0) {
fprintf(stderr, "Fat binary file contains *no* architectures: %s\n",
@@ -212,7 +212,7 @@ bool DumpSymbols::Read(const string &filename) {
bool DumpSymbols::SetArchitecture(cpu_type_t cpu_type,
cpu_subtype_t cpu_subtype) {
// Find the best match for the architecture the user requested.
- const SuperFatArch *best_match = FindBestMatchForArchitecture(
+ const SuperFatArch* best_match = FindBestMatchForArchitecture(
cpu_type, cpu_subtype);
if (!best_match) return false;
@@ -221,9 +221,9 @@ bool DumpSymbols::SetArchitecture(cpu_type_t cpu_type,
return true;
}
-bool DumpSymbols::SetArchitecture(const std::string &arch_name) {
+bool DumpSymbols::SetArchitecture(const std::string& arch_name) {
bool arch_set = false;
- const NXArchInfo *arch_info =
+ const NXArchInfo* arch_info =
google_breakpad::BreakpadGetArchInfoFromName(arch_name.c_str());
if (arch_info) {
arch_set = SetArchitecture(arch_info->cputype, arch_info->cpusubtype);
@@ -251,7 +251,7 @@ SuperFatArch* DumpSymbols::FindBestMatchForArchitecture(
// If all the object files can be converted to struct fat_arch, use
// NXFindBestFatArch.
if (can_convert_to_fat_arch) {
- const struct fat_arch *best_match
+ const struct fat_arch* best_match
= NXFindBestFatArch(cpu_type, cpu_subtype, &fat_arch_vector[0],
static_cast<uint32_t>(fat_arch_vector.size()));
@@ -311,7 +311,7 @@ string DumpSymbols::Identifier() {
class DumpSymbols::DumperRangesHandler:
public DwarfCUToModule::RangesHandler {
public:
- DumperRangesHandler(const uint8_t *buffer, uint64_t size,
+ DumperRangesHandler(const uint8_t* buffer, uint64_t size,
dwarf2reader::ByteReader* reader)
: buffer_(buffer), size_(size), reader_(reader) { }
@@ -325,7 +325,7 @@ class DumpSymbols::DumperRangesHandler:
}
private:
- const uint8_t *buffer_;
+ const uint8_t* buffer_;
uint64_t size_;
dwarf2reader::ByteReader* reader_;
};
@@ -337,7 +337,7 @@ class DumpSymbols::DumperLineToModule:
public DwarfCUToModule::LineToModuleHandler {
public:
// Create a line-to-module converter using BYTE_READER.
- DumperLineToModule(dwarf2reader::ByteReader *byte_reader)
+ DumperLineToModule(dwarf2reader::ByteReader* byte_reader)
: byte_reader_(byte_reader) { }
void StartCompilationUnit(const string& compilation_dir) {
@@ -357,7 +357,7 @@ class DumpSymbols::DumperLineToModule:
}
private:
string compilation_dir_;
- dwarf2reader::ByteReader *byte_reader_; // WEAK
+ dwarf2reader::ByteReader* byte_reader_; // WEAK
};
bool DumpSymbols::CreateEmptyModule(scoped_ptr<Module>& module) {
@@ -369,7 +369,7 @@ bool DumpSymbols::CreateEmptyModule(scoped_ptr<Module>& module) {
selected_object_file_ = &object_files_[0];
else {
// Look for an object file whose architecture matches our own.
- const NXArchInfo *local_arch = NXGetLocalArchInfo();
+ const NXArchInfo* local_arch = NXGetLocalArchInfo();
if (!SetArchitecture(local_arch->cputype, local_arch->cpusubtype)) {
fprintf(stderr, "%s: object file contains more than one"
" architecture, none of which match the current"
@@ -385,11 +385,11 @@ bool DumpSymbols::CreateEmptyModule(scoped_ptr<Module>& module) {
// Find the name of the selected file's architecture, to appear in
// the MODULE record and in error messages.
- const NXArchInfo *selected_arch_info =
+ const NXArchInfo* selected_arch_info =
google_breakpad::BreakpadGetArchInfoFromCpuType(
selected_object_file_->cputype, selected_object_file_->cpusubtype);
- const char *selected_arch_name = selected_arch_info->name;
+ const char* selected_arch_name = selected_arch_info->name;
if (strcmp(selected_arch_name, "i386") == 0)
selected_arch_name = "x86";
@@ -418,9 +418,9 @@ bool DumpSymbols::CreateEmptyModule(scoped_ptr<Module>& module) {
return true;
}
-void DumpSymbols::ReadDwarf(google_breakpad::Module *module,
- const mach_o::Reader &macho_reader,
- const mach_o::SectionMap &dwarf_sections,
+void DumpSymbols::ReadDwarf(google_breakpad::Module* module,
+ const mach_o::Reader& macho_reader,
+ const mach_o::SectionMap& dwarf_sections,
bool handle_inter_cu_refs) const {
// Build a byte reader of the appropriate endianness.
ByteReader byte_reader(macho_reader.big_endian()
@@ -461,7 +461,7 @@ void DumpSymbols::ReadDwarf(google_breakpad::Module *module,
dwarf2reader::SectionMap::const_iterator ranges_entry =
file_context.section_map().find("__debug_ranges");
if (ranges_entry != file_context.section_map().end()) {
- const std::pair<const uint8_t *, uint64_t>& ranges_section =
+ const std::pair<const uint8_t*, uint64_t>& ranges_section =
ranges_entry->second;
ranges_handler.reset(
new DumperRangesHandler(ranges_section.first, ranges_section.second,
@@ -490,9 +490,9 @@ void DumpSymbols::ReadDwarf(google_breakpad::Module *module,
}
}
-bool DumpSymbols::ReadCFI(google_breakpad::Module *module,
- const mach_o::Reader &macho_reader,
- const mach_o::Section &section,
+bool DumpSymbols::ReadCFI(google_breakpad::Module* module,
+ const mach_o::Reader& macho_reader,
+ const mach_o::Section& section,
bool eh_frame) const {
// Find the appropriate set of register names for this file's
// architecture.
@@ -511,7 +511,7 @@ bool DumpSymbols::ReadCFI(google_breakpad::Module *module,
register_names = DwarfCFIToModule::RegisterNames::ARM64();
break;
default: {
- const NXArchInfo *arch = google_breakpad::BreakpadGetArchInfoFromCpuType(
+ const NXArchInfo* arch = google_breakpad::BreakpadGetArchInfoFromCpuType(
macho_reader.cpu_type(), macho_reader.cpu_subtype());
fprintf(stderr, "%s: cannot convert DWARF call frame information for ",
selected_object_name_.c_str());
@@ -526,7 +526,7 @@ bool DumpSymbols::ReadCFI(google_breakpad::Module *module,
}
// Find the call frame information and its size.
- const uint8_t *cfi = section.contents.start;
+ const uint8_t* cfi = section.contents.start;
size_t cfi_size = section.contents.Size();
// Plug together the parser, handler, and their entourages.
@@ -558,9 +558,9 @@ class DumpSymbols::LoadCommandDumper:
public:
// Create a load command dumper handling load commands from READER's
// file, and adding data to MODULE.
- LoadCommandDumper(const DumpSymbols &dumper,
- google_breakpad::Module *module,
- const mach_o::Reader &reader,
+ LoadCommandDumper(const DumpSymbols& dumper,
+ google_breakpad::Module* module,
+ const mach_o::Reader& reader,
SymbolData symbol_data,
bool handle_inter_cu_refs)
: dumper_(dumper),
@@ -569,18 +569,18 @@ class DumpSymbols::LoadCommandDumper:
symbol_data_(symbol_data),
handle_inter_cu_refs_(handle_inter_cu_refs) { }
- bool SegmentCommand(const mach_o::Segment &segment);
- bool SymtabCommand(const ByteBuffer &entries, const ByteBuffer &strings);
+ bool SegmentCommand(const mach_o::Segment& segment);
+ bool SymtabCommand(const ByteBuffer& entries, const ByteBuffer& strings);
private:
- const DumpSymbols &dumper_;
- google_breakpad::Module *module_; // WEAK
- const mach_o::Reader &reader_;
+ const DumpSymbols& dumper_;
+ google_breakpad::Module* module_; // WEAK
+ const mach_o::Reader& reader_;
const SymbolData symbol_data_;
const bool handle_inter_cu_refs_;
};
-bool DumpSymbols::LoadCommandDumper::SegmentCommand(const Segment &segment) {
+bool DumpSymbols::LoadCommandDumper::SegmentCommand(const Segment& segment) {
mach_o::SectionMap section_map;
if (!reader_.MapSegmentSections(segment, &section_map))
return false;
@@ -615,8 +615,8 @@ bool DumpSymbols::LoadCommandDumper::SegmentCommand(const Segment &segment) {
return true;
}
-bool DumpSymbols::LoadCommandDumper::SymtabCommand(const ByteBuffer &entries,
- const ByteBuffer &strings) {
+bool DumpSymbols::LoadCommandDumper::SymtabCommand(const ByteBuffer& entries,
+ const ByteBuffer& strings) {
StabsToModule stabs_to_module(module_);
// Mac OS X STABS are never "unitized", and the size of the 'value' field
// matches the address size of the executable.
@@ -658,7 +658,7 @@ bool DumpSymbols::ReadSymbolData(Module** out_module) {
return true;
}
-bool DumpSymbols::WriteSymbolFile(std::ostream &stream) {
+bool DumpSymbols::WriteSymbolFile(std::ostream& stream) {
Module* module = NULL;
if (ReadSymbolData(&module) && module) {
@@ -673,7 +673,7 @@ bool DumpSymbols::WriteSymbolFile(std::ostream &stream) {
// Read the selected object file's debugging information, and write out the
// header only to |stream|. Return true on success; if an error occurs, report
// it and return false.
-bool DumpSymbols::WriteSymbolFileHeader(std::ostream &stream) {
+bool DumpSymbols::WriteSymbolFileHeader(std::ostream& stream) {
scoped_ptr<Module> module;
if (!CreateEmptyModule(module))
return false;
diff --git a/src/common/mac/dump_syms.h b/src/common/mac/dump_syms.h
index 1e57f86d..daebf876 100644
--- a/src/common/mac/dump_syms.h
+++ b/src/common/mac/dump_syms.h
@@ -70,7 +70,7 @@ class DumpSymbols {
// the name of a universal binary, a Mach-O file, or a dSYM bundle
// containing either of the above. On success, return true; if there is a
// problem reading |filename|, report it and return false.
- bool Read(const std::string &filename);
+ bool Read(const std::string& filename);
// If this dumper's file includes an object file for |cpu_type| and
// |cpu_subtype|, then select that object file for dumping, and return
@@ -91,7 +91,7 @@ class DumpSymbols {
// the dumper will dump those symbols; and if it contains more than one
// object file, then the dumper will dump the object file whose
// architecture matches that of this dumper program.
- bool SetArchitecture(const std::string &arch_name);
+ bool SetArchitecture(const std::string& arch_name);
// Return a pointer to an array of SuperFatArch structures describing the
// object files contained in this dumper's file. Set *|count| to the number
@@ -100,7 +100,7 @@ class DumpSymbols {
//
// If there are no available architectures, this function
// may return NULL.
- const SuperFatArch* AvailableArchitectures(size_t *count) {
+ const SuperFatArch* AvailableArchitectures(size_t* count) {
*count = object_files_.size();
if (object_files_.size() > 0)
return &object_files_[0];
@@ -110,12 +110,12 @@ class DumpSymbols {
// Read the selected object file's debugging information, and write it out to
// |stream|. Return true on success; if an error occurs, report it and
// return false.
- bool WriteSymbolFile(std::ostream &stream);
+ bool WriteSymbolFile(std::ostream& stream);
// Read the selected object file's debugging information, and write out the
// header only to |stream|. Return true on success; if an error occurs, report
// it and return false.
- bool WriteSymbolFileHeader(std::ostream &stream);
+ bool WriteSymbolFileHeader(std::ostream& stream);
// As above, but simply return the debugging information in module
// instead of writing it to a stream. The caller owns the resulting
@@ -142,9 +142,9 @@ class DumpSymbols {
// Read debugging information from |dwarf_sections|, which was taken from
// |macho_reader|, and add it to |module|.
- void ReadDwarf(google_breakpad::Module *module,
- const mach_o::Reader &macho_reader,
- const mach_o::SectionMap &dwarf_sections,
+ void ReadDwarf(google_breakpad::Module* module,
+ const mach_o::Reader& macho_reader,
+ const mach_o::SectionMap& dwarf_sections,
bool handle_inter_cu_refs) const;
// Read DWARF CFI or .eh_frame data from |section|, belonging to
@@ -152,9 +152,9 @@ class DumpSymbols {
// then the data is .eh_frame-format data; otherwise, it is standard DWARF
// .debug_frame data. On success, return true; on failure, report
// the problem and return false.
- bool ReadCFI(google_breakpad::Module *module,
- const mach_o::Reader &macho_reader,
- const mach_o::Section &section,
+ bool ReadCFI(google_breakpad::Module* module,
+ const mach_o::Reader& macho_reader,
+ const mach_o::Section& section,
bool eh_frame) const;
// The selection of what type of symbol data to read/write.
@@ -184,7 +184,7 @@ class DumpSymbols {
// The object file in object_files_ selected to dump, or NULL if
// SetArchitecture hasn't been called yet.
- const SuperFatArch *selected_object_file_;
+ const SuperFatArch* selected_object_file_;
// A string that identifies the selected object file, for use in error
// messages. This is usually object_filename_, but if that refers to a
diff --git a/src/common/mac/macho_id.cc b/src/common/mac/macho_id.cc
index c396ad88..3cf1d4b5 100644
--- a/src/common/mac/macho_id.cc
+++ b/src/common/mac/macho_id.cc
@@ -53,7 +53,7 @@ using google_breakpad::MD5Init;
using google_breakpad::MD5Update;
using google_breakpad::MD5Final;
-MachoID::MachoID(const char *path)
+MachoID::MachoID(const char* path)
: memory_(0),
memory_size_(0),
crc_(0),
@@ -62,7 +62,7 @@ MachoID::MachoID(const char *path)
snprintf(path_, sizeof(path_), "%s", path);
}
-MachoID::MachoID(const char *path, void *memory, size_t size)
+MachoID::MachoID(const char* path, void* memory, size_t size)
: memory_(memory),
memory_size_(size),
crc_(0),
@@ -82,7 +82,7 @@ MachoID::~MachoID() {
// MAX_BLOCK is the largest n such that 255n(n+1)/2 + (n+1)(MAX_BLOCK-1) <= 2^32-1
#define MAX_BLOCK 5552
-void MachoID::UpdateCRC(unsigned char *bytes, size_t size) {
+void MachoID::UpdateCRC(unsigned char* bytes, size_t size) {
// Unrolled loops for summing
#define DO1(buf,i) {sum1 += (buf)[i]; sum2 += sum1;}
#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
@@ -122,11 +122,11 @@ void MachoID::UpdateCRC(unsigned char *bytes, size_t size) {
}
}
-void MachoID::UpdateMD5(unsigned char *bytes, size_t size) {
+void MachoID::UpdateMD5(unsigned char* bytes, size_t size) {
MD5Update(&md5_context_, bytes, static_cast<unsigned>(size));
}
-void MachoID::Update(MachoWalker *walker, off_t offset, size_t size) {
+void MachoID::Update(MachoWalker* walker, off_t offset, size_t size) {
if (!update_function_ || !size)
return;
@@ -237,7 +237,7 @@ bool MachoID::MD5(cpu_type_t cpu_type, cpu_subtype_t cpu_subtype, unsigned char
bool MachoID::WalkHeader(cpu_type_t cpu_type,
cpu_subtype_t cpu_subtype,
MachoWalker::LoadCommandCallback callback,
- void *context) {
+ void* context) {
if (memory_) {
MachoWalker walker(memory_, memory_size_, callback, context);
return walker.WalkHeader(cpu_type, cpu_subtype);
@@ -248,9 +248,9 @@ bool MachoID::WalkHeader(cpu_type_t cpu_type,
}
// static
-bool MachoID::WalkerCB(MachoWalker *walker, load_command *cmd, off_t offset,
- bool swap, void *context) {
- MachoID *macho_id = (MachoID *)context;
+bool MachoID::WalkerCB(MachoWalker* walker, load_command* cmd, off_t offset,
+ bool swap, void* context) {
+ MachoID* macho_id = (MachoID*)context;
if (cmd->cmd == LC_SEGMENT) {
struct segment_command seg;
@@ -327,11 +327,11 @@ bool MachoID::WalkerCB(MachoWalker *walker, load_command *cmd, off_t offset,
}
// static
-bool MachoID::UUIDWalkerCB(MachoWalker *walker, load_command *cmd, off_t offset,
- bool swap, void *context) {
+bool MachoID::UUIDWalkerCB(MachoWalker* walker, load_command* cmd, off_t offset,
+ bool swap, void* context) {
if (cmd->cmd == LC_UUID) {
- struct breakpad_uuid_command *uuid_cmd =
- (struct breakpad_uuid_command *)context;
+ struct breakpad_uuid_command* uuid_cmd =
+ (struct breakpad_uuid_command*)context;
if (!walker->ReadBytes(uuid_cmd, sizeof(struct breakpad_uuid_command),
offset))
@@ -348,10 +348,10 @@ bool MachoID::UUIDWalkerCB(MachoWalker *walker, load_command *cmd, off_t offset,
}
// static
-bool MachoID::IDWalkerCB(MachoWalker *walker, load_command *cmd, off_t offset,
- bool swap, void *context) {
+bool MachoID::IDWalkerCB(MachoWalker* walker, load_command* cmd, off_t offset,
+ bool swap, void* context) {
if (cmd->cmd == LC_ID_DYLIB) {
- struct dylib_command *dylib_cmd = (struct dylib_command *)context;
+ struct dylib_command* dylib_cmd = (struct dylib_command*)context;
if (!walker->ReadBytes(dylib_cmd, sizeof(struct dylib_command), offset))
return false;
diff --git a/src/common/mac/macho_id.h b/src/common/mac/macho_id.h
index 10375491..e8874c37 100644
--- a/src/common/mac/macho_id.h
+++ b/src/common/mac/macho_id.h
@@ -45,8 +45,8 @@ namespace MacFileUtilities {
class MachoID {
public:
- MachoID(const char *path);
- MachoID(const char *path, void *memory, size_t size);
+ MachoID(const char* path);
+ MachoID(const char* path, void* memory, size_t size);
~MachoID();
// For the given |cpu_type| and |cpu_subtype|, return a UUID from the LC_UUID
@@ -78,40 +78,40 @@ class MachoID {
private:
// Signature of class member function to be called with data read from file
- typedef void (MachoID::*UpdateFunction)(unsigned char *bytes, size_t size);
+ typedef void (MachoID::*UpdateFunction)(unsigned char* bytes, size_t size);
// Update the CRC value by examining |size| |bytes| and applying the algorithm
// to each byte.
- void UpdateCRC(unsigned char *bytes, size_t size);
+ void UpdateCRC(unsigned char* bytes, size_t size);
// Update the MD5 value by examining |size| |bytes| and applying the algorithm
// to each byte.
- void UpdateMD5(unsigned char *bytes, size_t size);
+ void UpdateMD5(unsigned char* bytes, size_t size);
// Bottleneck for update routines
- void Update(MachoWalker *walker, off_t offset, size_t size);
+ void Update(MachoWalker* walker, off_t offset, size_t size);
// Factory for the MachoWalker
bool WalkHeader(cpu_type_t cpu_type, cpu_subtype_t cpu_subtype,
- MachoWalker::LoadCommandCallback callback, void *context);
+ MachoWalker::LoadCommandCallback callback, void* context);
// The callback from the MachoWalker for CRC and MD5
- static bool WalkerCB(MachoWalker *walker, load_command *cmd, off_t offset,
- bool swap, void *context);
+ static bool WalkerCB(MachoWalker* walker, load_command* cmd, off_t offset,
+ bool swap, void* context);
// The callback from the MachoWalker for LC_UUID
- static bool UUIDWalkerCB(MachoWalker *walker, load_command *cmd, off_t offset,
- bool swap, void *context);
+ static bool UUIDWalkerCB(MachoWalker* walker, load_command* cmd, off_t offset,
+ bool swap, void* context);
// The callback from the MachoWalker for LC_ID_DYLIB
- static bool IDWalkerCB(MachoWalker *walker, load_command *cmd, off_t offset,
- bool swap, void *context);
+ static bool IDWalkerCB(MachoWalker* walker, load_command* cmd, off_t offset,
+ bool swap, void* context);
// File path
char path_[PATH_MAX];
// Memory region to read from
- void *memory_;
+ void* memory_;
// Size of the memory region
size_t memory_size_;
diff --git a/src/common/mac/macho_reader.cc b/src/common/mac/macho_reader.cc
index 91e1fdd2..b42506cc 100644
--- a/src/common/mac/macho_reader.cc
+++ b/src/common/mac/macho_reader.cc
@@ -81,7 +81,7 @@ void FatReader::Reporter::MisplacedObjectFile() {
" to contain\n", filename_.c_str());
}
-bool FatReader::Read(const uint8_t *buffer, size_t size) {
+bool FatReader::Read(const uint8_t* buffer, size_t size) {
buffer_.start = buffer;
buffer_.end = buffer + size;
ByteCursor cursor(&buffer_);
@@ -196,19 +196,19 @@ void Reader::Reporter::LoadCommandTooShort(size_t i, LoadCommandType type) {
filename_.c_str(), i, type);
}
-void Reader::Reporter::SectionsMissing(const string &name) {
+void Reader::Reporter::SectionsMissing(const string& name) {
fprintf(stderr, "%s: the load command for segment '%s'"
" is too short to hold the section headers it claims to have\n",
filename_.c_str(), name.c_str());
}
-void Reader::Reporter::MisplacedSegmentData(const string &name) {
+void Reader::Reporter::MisplacedSegmentData(const string& name) {
fprintf(stderr, "%s: the segment '%s' claims its contents lie beyond"
" the end of the file\n", filename_.c_str(), name.c_str());
}
-void Reader::Reporter::MisplacedSectionData(const string &section,
- const string &segment) {
+void Reader::Reporter::MisplacedSectionData(const string& section,
+ const string& segment) {
fprintf(stderr, "%s: the section '%s' in segment '%s'"
" claims its contents lie outside the segment's contents\n",
filename_.c_str(), section.c_str(), segment.c_str());
@@ -225,7 +225,7 @@ void Reader::Reporter::UnsupportedCPUType(cpu_type_t cpu_type) {
filename_.c_str(), cpu_type);
}
-bool Reader::Read(const uint8_t *buffer,
+bool Reader::Read(const uint8_t* buffer,
size_t size,
cpu_type_t expected_cpu_type,
cpu_subtype_t expected_cpu_subtype) {
@@ -309,7 +309,7 @@ bool Reader::Read(const uint8_t *buffer,
return true;
}
-bool Reader::WalkLoadCommands(Reader::LoadCommandHandler *handler) const {
+bool Reader::WalkLoadCommands(Reader::LoadCommandHandler* handler) const {
ByteCursor list_cursor(&load_commands_, big_endian_);
for (size_t index = 0; index < load_command_count_; ++index) {
@@ -422,13 +422,13 @@ class Reader::SegmentFinder : public LoadCommandHandler {
public:
// Create a load command handler that looks for a segment named NAME,
// and sets SEGMENT to describe it if found.
- SegmentFinder(const string &name, Segment *segment)
+ SegmentFinder(const string& name, Segment* segment)
: name_(name), segment_(segment), found_() { }
// Return true if the traversal found the segment, false otherwise.
bool found() const { return found_; }
- bool SegmentCommand(const Segment &segment) {
+ bool SegmentCommand(const Segment& segment) {
if (segment.name == name_) {
*segment_ = segment;
found_ = true;
@@ -439,23 +439,23 @@ class Reader::SegmentFinder : public LoadCommandHandler {
private:
// The name of the segment our creator is looking for.
- const string &name_;
+ const string& name_;
// Where we should store the segment if found. (WEAK)
- Segment *segment_;
+ Segment* segment_;
// True if we found the segment.
bool found_;
};
-bool Reader::FindSegment(const string &name, Segment *segment) const {
+bool Reader::FindSegment(const string& name, Segment* segment) const {
SegmentFinder finder(name, segment);
WalkLoadCommands(&finder);
return finder.found();
}
-bool Reader::WalkSegmentSections(const Segment &segment,
- SectionHandler *handler) const {
+bool Reader::WalkSegmentSections(const Segment& segment,
+ SectionHandler* handler) const {
size_t word_size = segment.bits_64 ? 8 : 4;
ByteCursor cursor(&segment.section_list, big_endian_);
@@ -537,18 +537,18 @@ class Reader::SectionMapper: public SectionHandler {
public:
// Create a SectionHandler that populates MAP with an entry for
// each section it is given.
- SectionMapper(SectionMap *map) : map_(map) { }
- bool HandleSection(const Section &section) {
+ SectionMapper(SectionMap* map) : map_(map) { }
+ bool HandleSection(const Section& section) {
(*map_)[section.section_name] = section;
return true;
}
private:
// The map under construction. (WEAK)
- SectionMap *map_;
+ SectionMap* map_;
};
-bool Reader::MapSegmentSections(const Segment &segment,
- SectionMap *section_map) const {
+bool Reader::MapSegmentSections(const Segment& segment,
+ SectionMap* section_map) const {
section_map->clear();
SectionMapper mapper(section_map);
return WalkSegmentSections(segment, &mapper);
diff --git a/src/common/mac/macho_reader.h b/src/common/mac/macho_reader.h
index 145d17d1..02762c55 100644
--- a/src/common/mac/macho_reader.h
+++ b/src/common/mac/macho_reader.h
@@ -78,7 +78,7 @@ class FatReader {
class Reporter {
public:
// Create a reporter that attributes problems to |filename|.
- explicit Reporter(const string &filename) : filename_(filename) { }
+ explicit Reporter(const string& filename) : filename_(filename) { }
virtual ~Reporter() { }
@@ -101,7 +101,7 @@ class FatReader {
};
// Create a fat binary file reader that uses |reporter| to report problems.
- explicit FatReader(Reporter *reporter) : reporter_(reporter) { }
+ explicit FatReader(Reporter* reporter) : reporter_(reporter) { }
// Read the |size| bytes at |buffer| as a fat binary file. On success,
// return true; on failure, report the problem to reporter_ and return
@@ -110,7 +110,7 @@ class FatReader {
// If the data is a plain Mach-O file, rather than a fat binary file,
// then the reader behaves as if it had found a fat binary file whose
// single object file is the Mach-O file.
- bool Read(const uint8_t *buffer, size_t size);
+ bool Read(const uint8_t* buffer, size_t size);
// Return an array of 'SuperFatArch' structures describing the
// object files present in this fat binary file. Set |size| to the
@@ -130,7 +130,7 @@ class FatReader {
// possible to use the result with OS X functions like NXFindBestFatArch,
// so that the symbol dumper will behave consistently with other OS X
// utilities that work with fat binaries.
- const SuperFatArch* object_files(size_t *count) const {
+ const SuperFatArch* object_files(size_t* count) const {
*count = object_files_.size();
if (object_files_.size() > 0)
return &object_files_[0];
@@ -139,7 +139,7 @@ class FatReader {
private:
// We use this to report problems parsing the file's contents. (WEAK)
- Reporter *reporter_;
+ Reporter* reporter_;
// The contents of the fat binary or Mach-O file we're parsing. We do not
// own the storage it refers to.
@@ -240,7 +240,7 @@ class Reader {
class Reporter {
public:
// Create a reporter that attributes problems to |filename|.
- explicit Reporter(const string &filename) : filename_(filename) { }
+ explicit Reporter(const string& filename) : filename_(filename) { }
virtual ~Reporter() { }
// Reporter functions for fatal errors return void; the reader will
@@ -282,16 +282,16 @@ class Reader {
// The LC_SEGMENT or LC_SEGMENT_64 load command for the segment named
// |name| is too short to hold the sections that its header says it does.
// (This more specific than LoadCommandTooShort.)
- virtual void SectionsMissing(const string &name);
+ virtual void SectionsMissing(const string& name);
// The segment named |name| claims that its contents lie beyond the end
// of the file.
- virtual void MisplacedSegmentData(const string &name);
+ virtual void MisplacedSegmentData(const string& name);
// The section named |section| in the segment named |segment| claims that
// its contents do not lie entirely within the segment.
- virtual void MisplacedSectionData(const string &section,
- const string &segment);
+ virtual void MisplacedSectionData(const string& section,
+ const string& segment);
// The LC_SYMTAB command claims that symbol table contents are located
// beyond the end of the file.
@@ -315,7 +315,7 @@ class Reader {
// Called to report that the segment's section list contains |section|.
// This should return true if the iteration should continue, or false
// if it should stop.
- virtual bool HandleSection(const Section &section) = 0;
+ virtual bool HandleSection(const Section& section) = 0;
};
// A handler for the load commands in a Mach-O file.
@@ -341,20 +341,20 @@ class Reader {
// cannot parse the command type or its size, we call
// reporter_->IncompleteLoadCommand instead.)
virtual bool UnknownCommand(LoadCommandType type,
- const ByteBuffer &contents) {
+ const ByteBuffer& contents) {
return true;
}
// The load command is LC_SEGMENT or LC_SEGMENT_64, defining a segment
// with the properties given in |segment|.
- virtual bool SegmentCommand(const Segment &segment) {
+ virtual bool SegmentCommand(const Segment& segment) {
return true;
}
// The load command is LC_SYMTAB. |entries| holds the array of nlist
// entries, and |names| holds the strings the entries refer to.
- virtual bool SymtabCommand(const ByteBuffer &entries,
- const ByteBuffer &names) {
+ virtual bool SymtabCommand(const ByteBuffer& entries,
+ const ByteBuffer& names) {
return true;
}
@@ -362,7 +362,7 @@ class Reader {
};
// Create a Mach-O file reader that reports problems to |reporter|.
- explicit Reader(Reporter *reporter)
+ explicit Reader(Reporter* reporter)
: reporter_(reporter) { }
// Read the given data as a Mach-O file. The reader retains pointers
@@ -371,11 +371,11 @@ class Reader {
//
// At most one of these functions should be invoked once on each Reader
// instance.
- bool Read(const uint8_t *buffer,
+ bool Read(const uint8_t* buffer,
size_t size,
cpu_type_t expected_cpu_type,
cpu_subtype_t expected_cpu_subtype);
- bool Read(const ByteBuffer &buffer,
+ bool Read(const ByteBuffer& buffer,
cpu_type_t expected_cpu_type,
cpu_subtype_t expected_cpu_subtype) {
return Read(buffer.start,
@@ -402,25 +402,25 @@ class Reader {
// a handler function returns false. If we encounter a malformed load
// command, report it via reporter_ and return false. Return true if all
// load commands were parseable and all handlers returned true.
- bool WalkLoadCommands(LoadCommandHandler *handler) const;
+ bool WalkLoadCommands(LoadCommandHandler* handler) const;
// Set |segment| to describe the segment named |name|, if present. If
// found, |segment|'s byte buffers refer to a subregion of the bytes
// passed to Read. If we find the section, return true; otherwise,
// return false.
- bool FindSegment(const string &name, Segment *segment) const;
+ bool FindSegment(const string& name, Segment* segment) const;
// Apply |handler| to each section defined in |segment|. If |handler| returns
// false, stop iterating and return false. If all calls to |handler| return
// true and we reach the end of the section list, return true.
- bool WalkSegmentSections(const Segment &segment, SectionHandler *handler)
+ bool WalkSegmentSections(const Segment& segment, SectionHandler* handler)
const;
// Clear |section_map| and then populate it with a map of the sections
// in |segment|, from section names to Section structures.
// Each Section's contents refer to bytes in |segment|'s contents.
// On success, return true; if a problem occurs, report it and return false.
- bool MapSegmentSections(const Segment &segment, SectionMap *section_map)
+ bool MapSegmentSections(const Segment& segment, SectionMap* section_map)
const;
private:
@@ -429,7 +429,7 @@ class Reader {
class SectionMapper;
// We use this to report problems parsing the file's contents. (WEAK)
- Reporter *reporter_;
+ Reporter* reporter_;
// The contents of the Mach-O file we're parsing. We do not own the
// storage it refers to.
diff --git a/src/common/mac/macho_reader_unittest.cc b/src/common/mac/macho_reader_unittest.cc
index d8459d8c..dccda4e7 100644
--- a/src/common/mac/macho_reader_unittest.cc
+++ b/src/common/mac/macho_reader_unittest.cc
@@ -75,7 +75,7 @@ using testing::_;
class MockFatReaderReporter: public FatReader::Reporter {
public:
- MockFatReaderReporter(const string &filename)
+ MockFatReaderReporter(const string& filename)
: FatReader::Reporter(filename) { }
MOCK_METHOD0(BadHeader, void());
MOCK_METHOD0(MisplacedObjectFile, void());
@@ -84,7 +84,7 @@ class MockFatReaderReporter: public FatReader::Reporter {
class MockReaderReporter: public Reader::Reporter {
public:
- MockReaderReporter(const string &filename) : Reader::Reporter(filename) { }
+ MockReaderReporter(const string& filename) : Reader::Reporter(filename) { }
MOCK_METHOD0(BadHeader, void());
MOCK_METHOD4(CPUTypeMismatch, void(cpu_type_t cpu_type,
cpu_subtype_t cpu_subtype,
@@ -95,24 +95,24 @@ class MockReaderReporter: public Reader::Reporter {
MOCK_METHOD3(LoadCommandsOverrun, void(size_t claimed, size_t i,
LoadCommandType type));
MOCK_METHOD2(LoadCommandTooShort, void(size_t i, LoadCommandType type));
- MOCK_METHOD1(SectionsMissing, void(const string &name));
- MOCK_METHOD1(MisplacedSegmentData, void(const string &name));
- MOCK_METHOD2(MisplacedSectionData, void(const string &section,
- const string &segment));
+ MOCK_METHOD1(SectionsMissing, void(const string& name));
+ MOCK_METHOD1(MisplacedSegmentData, void(const string& name));
+ MOCK_METHOD2(MisplacedSectionData, void(const string& section,
+ const string& segment));
MOCK_METHOD0(MisplacedSymbolTable, void());
MOCK_METHOD1(UnsupportedCPUType, void(cpu_type_t cpu_type));
};
class MockLoadCommandHandler: public Reader::LoadCommandHandler {
public:
- MOCK_METHOD2(UnknownCommand, bool(LoadCommandType, const ByteBuffer &));
- MOCK_METHOD1(SegmentCommand, bool(const Segment &));
- MOCK_METHOD2(SymtabCommand, bool(const ByteBuffer &, const ByteBuffer &));
+ MOCK_METHOD2(UnknownCommand, bool(LoadCommandType, const ByteBuffer&));
+ MOCK_METHOD1(SegmentCommand, bool(const Segment&));
+ MOCK_METHOD2(SymtabCommand, bool(const ByteBuffer&, const ByteBuffer&));
};
class MockSectionHandler: public Reader::SectionHandler {
public:
- MOCK_METHOD1(HandleSection, bool(const Section &section));
+ MOCK_METHOD1(HandleSection, bool(const Section& section));
};
@@ -221,7 +221,7 @@ struct FatReaderFixture {
}
void ReadFat(bool expect_parse_success = true) {
ASSERT_TRUE(fat.GetContents(&contents));
- fat_bytes = reinterpret_cast<const uint8_t *>(contents.data());
+ fat_bytes = reinterpret_cast<const uint8_t*>(contents.data());
if (expect_parse_success) {
EXPECT_TRUE(reader.Read(fat_bytes, contents.size()));
size_t fat_files_count;
@@ -238,7 +238,7 @@ struct FatReaderFixture {
MockFatReaderReporter reporter;
FatReader reader;
string contents;
- const uint8_t *fat_bytes;
+ const uint8_t* fat_bytes;
vector<struct fat_arch> object_files;
};
@@ -487,16 +487,16 @@ class WithConfiguration {
private:
// The innermost WithConfiguration in whose dynamic scope we are
// currently executing.
- static WithConfiguration *current_;
+ static WithConfiguration* current_;
// The innermost WithConfiguration whose dynamic scope encloses this
// WithConfiguration.
Endianness endianness_;
size_t word_size_;
- WithConfiguration *saved_;
+ WithConfiguration* saved_;
};
-WithConfiguration *WithConfiguration::current_ = NULL;
+WithConfiguration* WithConfiguration::current_ = NULL;
// A test_assembler::Section with a size that we can cite. The start(),
// Here() and Mark() member functions of a SizedSection always represent
@@ -527,7 +527,7 @@ class SizedSection: public test_assembler::Section {
// Append SECTION to the end of this section, and call its Finish member.
// Return a reference to this section.
- SizedSection &Place(SizedSection *section) {
+ SizedSection& Place(SizedSection* section) {
assert(section->endianness() == endianness());
section->Finish();
section->start() = Here();
@@ -563,7 +563,7 @@ class LoadedSection: public SizedSection {
// Placing a loaded section within a loaded section sets the relationship
// between their addresses.
- LoadedSection &Place(LoadedSection *section) {
+ LoadedSection& Place(LoadedSection* section) {
section->address() = address() + Size();
SizedSection::Place(section);
return *this;
@@ -583,7 +583,7 @@ class SegmentLoadCommand: public SizedSection {
// The load command will refer to CONTENTS, which must be Placed in the
// file separately, at the desired position. Return a reference to this
// section.
- SegmentLoadCommand &Header(const string &name, const LoadedSection &contents,
+ SegmentLoadCommand& Header(const string& name, const LoadedSection& contents,
uint32_t maxprot, uint32_t initprot,
uint32_t flags) {
assert(contents.word_size() == word_size());
@@ -608,16 +608,16 @@ class SegmentLoadCommand: public SizedSection {
// memory. If this label is still undefined by the time we place this
// segment, it defaults to the final size of the segment's in-file
// contents. Return a reference to this load command.
- Label &vmsize() { return vmsize_; }
+ Label& vmsize() { return vmsize_; }
// Add a section entry with the given characteristics to this segment
// load command. Return a reference to this. The section entry will refer
// to CONTENTS, which must be Placed in the segment's contents
// separately, at the desired position.
- SegmentLoadCommand &AppendSectionEntry(const string &section_name,
- const string &segment_name,
+ SegmentLoadCommand& AppendSectionEntry(const string& section_name,
+ const string& segment_name,
uint32_t alignment, uint32_t flags,
- const LoadedSection &contents) {
+ const LoadedSection& contents) {
AppendCString(section_name, 16);
AppendCString(segment_name, 16);
Append(endianness(), word_size() / 8, contents.address());
@@ -671,14 +671,14 @@ class LoadCommands: public SizedSection {
Label final_command_count() const { return final_command_count_; }
// Increment the command count; return a reference to this section.
- LoadCommands &CountCommand() {
+ LoadCommands& CountCommand() {
command_count_++;
return *this;
}
// Place COMMAND, containing a load command, at the end of this section.
// Return a reference to this section.
- LoadCommands &Place(SizedSection *section) {
+ LoadCommands& Place(SizedSection* section) {
SizedSection::Place(section);
CountCommand();
return *this;
@@ -710,7 +710,7 @@ class MachOFile: public SizedSection {
// Create a Mach-O file header using the given characteristics and load
// command list. This Places COMMANDS immediately after the header.
// Return a reference to this section.
- MachOFile &Header(LoadCommands *commands,
+ MachOFile& Header(LoadCommands* commands,
cpu_type_t cpu_type = CPU_TYPE_X86,
cpu_subtype_t cpu_subtype = CPU_SUBTYPE_I386_ALL,
FileType file_type = MH_EXECUTE,
@@ -752,12 +752,12 @@ struct ReaderFixture {
EXPECT_CALL(load_command_handler, SegmentCommand(_)).Times(0);
}
- void ReadFile(MachOFile *file,
+ void ReadFile(MachOFile* file,
bool expect_parse_success,
cpu_type_t expected_cpu_type,
cpu_subtype_t expected_cpu_subtype) {
ASSERT_TRUE(file->GetContents(&file_contents));
- file_bytes = reinterpret_cast<const uint8_t *>(file_contents.data());
+ file_bytes = reinterpret_cast<const uint8_t*>(file_contents.data());
if (expect_parse_success) {
EXPECT_TRUE(reader.Read(file_bytes,
file_contents.size(),
@@ -772,7 +772,7 @@ struct ReaderFixture {
}
string file_contents;
- const uint8_t *file_bytes;
+ const uint8_t* file_bytes;
MockReaderReporter reporter;
Reader reader;
MockLoadCommandHandler load_command_handler;
@@ -1343,14 +1343,14 @@ TEST_F(LoadCommand, ThreeLoadCommands) {
EXPECT_TRUE(reader.WalkLoadCommands(&load_command_handler));
}
-static inline Matcher<const Section &> MatchSection(
+static inline Matcher<const Section&> MatchSection(
Matcher<bool> bits_64,
- Matcher<const string &> section_name,
- Matcher<const string &> segment_name,
+ Matcher<const string&> section_name,
+ Matcher<const string&> segment_name,
Matcher<uint64_t> address,
Matcher<uint32_t> alignment,
Matcher<uint32_t> flags,
- Matcher<const ByteBuffer &> contents) {
+ Matcher<const ByteBuffer&> contents) {
return AllOf(AllOf(Field(&Section::bits_64, bits_64),
Field(&Section::section_name, section_name),
Field(&Section::segment_name, segment_name),
@@ -1360,10 +1360,10 @@ static inline Matcher<const Section &> MatchSection(
Field(&Section::contents, contents)));
}
-static inline Matcher<const Section &> MatchSection(
+static inline Matcher<const Section&> MatchSection(
Matcher<bool> bits_64,
- Matcher<const string &> section_name,
- Matcher<const string &> segment_name,
+ Matcher<const string&> section_name,
+ Matcher<const string&> segment_name,
Matcher<uint64_t> address) {
return AllOf(Field(&Section::bits_64, bits_64),
Field(&Section::section_name, section_name),
@@ -1410,7 +1410,7 @@ TEST_F(LoadCommand, OneSegmentTwoSections) {
contents1.start = file_bytes + section1.start().Value();
contents1.end = contents1.start + section1.final_size().Value();
EXPECT_EQ("buddha's hand",
- string(reinterpret_cast<const char *>(contents1.start),
+ string(reinterpret_cast<const char*>(contents1.start),
contents1.Size()));
EXPECT_CALL(section_handler,
HandleSection(MatchSection(true, "mandarin", "kishu",
@@ -1422,7 +1422,7 @@ TEST_F(LoadCommand, OneSegmentTwoSections) {
contents2.start = file_bytes + section2.start().Value();
contents2.end = contents2.start + section2.final_size().Value();
EXPECT_EQ("kumquat",
- string(reinterpret_cast<const char *>(contents2.start),
+ string(reinterpret_cast<const char*>(contents2.start),
contents2.Size()));
EXPECT_CALL(section_handler,
HandleSection(MatchSection(true, "bergamot", "cara cara",
@@ -1716,7 +1716,7 @@ class StringAssembler: public SizedSection {
public:
// Add the string S to this StringAssembler, and return the string's
// offset within this compilation unit's strings.
- size_t Add(const string &s) {
+ size_t Add(const string& s) {
size_t offset = Size();
AppendCString(s);
return offset;
@@ -1728,7 +1728,7 @@ class StringAssembler: public SizedSection {
class SymbolAssembler: public SizedSection {
public:
// Create a SymbolAssembler that uses StringAssembler for its strings.
- explicit SymbolAssembler(StringAssembler *string_assembler)
+ explicit SymbolAssembler(StringAssembler* string_assembler)
: string_assembler_(string_assembler),
entry_count_(0) { }
@@ -1737,7 +1737,7 @@ class SymbolAssembler: public SizedSection {
// its compilation unit's portion of the .stabstr section; this can be a
// value generated by a StringAssembler. Return a reference to this
// SymbolAssembler.
- SymbolAssembler &Symbol(uint8_t type, uint8_t other, Label descriptor,
+ SymbolAssembler& Symbol(uint8_t type, uint8_t other, Label descriptor,
Label value, Label name) {
D32(name);
D8(type);
@@ -1749,14 +1749,14 @@ class SymbolAssembler: public SizedSection {
}
// As above, but automatically add NAME to our StringAssembler.
- SymbolAssembler &Symbol(uint8_t type, uint8_t other, Label descriptor,
- Label value, const string &name) {
+ SymbolAssembler& Symbol(uint8_t type, uint8_t other, Label descriptor,
+ Label value, const string& name) {
return Symbol(type, other, descriptor, value, string_assembler_->Add(name));
}
private:
// The strings for our STABS entries.
- StringAssembler *string_assembler_;
+ StringAssembler* string_assembler_;
// The number of entries in this compilation unit so far.
size_t entry_count_;
diff --git a/src/common/mac/macho_walker.cc b/src/common/mac/macho_walker.cc
index 1acd8665..a42128b8 100644
--- a/src/common/mac/macho_walker.cc
+++ b/src/common/mac/macho_walker.cc
@@ -47,8 +47,8 @@
namespace MacFileUtilities {
-MachoWalker::MachoWalker(const char *path, LoadCommandCallback callback,
- void *context)
+MachoWalker::MachoWalker(const char* path, LoadCommandCallback callback,
+ void* context)
: file_(-1),
memory_(NULL),
memory_size_(0),
@@ -60,8 +60,8 @@ MachoWalker::MachoWalker(const char *path, LoadCommandCallback callback,
file_ = open(path, O_RDONLY);
}
-MachoWalker::MachoWalker(void *memory, size_t size,
- LoadCommandCallback callback, void *context)
+MachoWalker::MachoWalker(void* memory, size_t size,
+ LoadCommandCallback callback, void* context)
: file_(-1),
memory_(memory),
memory_size_(size),
@@ -82,7 +82,7 @@ bool MachoWalker::WalkHeader(cpu_type_t cpu_type, cpu_subtype_t cpu_subtype) {
cpu_subtype_t valid_cpu_subtype = cpu_subtype;
// if |cpu_type| is 0, use the native cpu type.
if (cpu_type == 0) {
- const NXArchInfo *arch = NXGetLocalArchInfo();
+ const NXArchInfo* arch = NXGetLocalArchInfo();
assert(arch);
valid_cpu_type = arch->cputype;
valid_cpu_subtype = CPU_SUBTYPE_MULTIPLE;
@@ -98,7 +98,7 @@ bool MachoWalker::WalkHeader(cpu_type_t cpu_type, cpu_subtype_t cpu_subtype) {
return false;
}
-bool MachoWalker::ReadBytes(void *buffer, size_t size, off_t offset) {
+bool MachoWalker::ReadBytes(void* buffer, size_t size, off_t offset) {
if (memory_) {
if (offset < 0)
return false;
@@ -109,14 +109,14 @@ bool MachoWalker::ReadBytes(void *buffer, size_t size, off_t offset) {
size = memory_size_ - static_cast<size_t>(offset);
result = false;
}
- memcpy(buffer, static_cast<char *>(memory_) + offset, size);
+ memcpy(buffer, static_cast<char*>(memory_) + offset, size);
return result;
} else {
return pread(file_, buffer, size, offset) == (ssize_t)size;
}
}
-bool MachoWalker::CurrentHeader(struct mach_header_64 *header, off_t *offset) {
+bool MachoWalker::CurrentHeader(struct mach_header_64* header, off_t* offset) {
if (current_header_) {
memcpy(header, current_header_, sizeof(mach_header_64));
*offset = current_header_offset_;
@@ -128,7 +128,7 @@ bool MachoWalker::CurrentHeader(struct mach_header_64 *header, off_t *offset) {
bool MachoWalker::FindHeader(cpu_type_t cpu_type,
cpu_subtype_t cpu_subtype,
- off_t &offset) {
+ off_t& offset) {
// Read the magic bytes that's common amongst all mach-o files
uint32_t magic;
if (!ReadBytes(&magic, sizeof(magic), 0))
@@ -211,7 +211,7 @@ bool MachoWalker::WalkHeaderAtOffset(off_t offset) {
// Copy the data into the mach_header_64 structure. Since the 32-bit and
// 64-bit only differ in the last field (reserved), this is safe to do.
struct mach_header_64 header64;
- memcpy((void *)&header64, (const void *)&header, sizeof(header));
+ memcpy((void*)&header64, (const void*)&header, sizeof(header));
header64.reserved = 0;
current_header_ = &header64;
diff --git a/src/common/mac/macho_walker.h b/src/common/mac/macho_walker.h
index dd535814..168f30e6 100644
--- a/src/common/mac/macho_walker.h
+++ b/src/common/mac/macho_walker.h
@@ -49,12 +49,12 @@ class MachoWalker {
// beginning of the file (not header) where the command was read. If |swap|
// is set, then any command data (other than the returned load_command) should
// be swapped when read
- typedef bool (*LoadCommandCallback)(MachoWalker *walker, load_command *cmd,
- off_t offset, bool swap, void *context);
+ typedef bool (*LoadCommandCallback)(MachoWalker* walker, load_command* cmd,
+ off_t offset, bool swap, void* context);
- MachoWalker(const char *path, LoadCommandCallback callback, void *context);
- MachoWalker(void *memory, size_t size, LoadCommandCallback callback,
- void *context);
+ MachoWalker(const char* path, LoadCommandCallback callback, void* context);
+ MachoWalker(void* memory, size_t size, LoadCommandCallback callback,
+ void* context);
~MachoWalker();
// Begin walking the header for |cpu_type| and |cpu_subtype|. If |cpu_type|
@@ -67,17 +67,17 @@ class MachoWalker {
bool WalkHeader(cpu_type_t cpu_type, cpu_subtype_t cpu_subtype);
// Read |size| bytes from the opened file at |offset| into |buffer|
- bool ReadBytes(void *buffer, size_t size, off_t offset);
+ bool ReadBytes(void* buffer, size_t size, off_t offset);
// Return the current header and header offset
- bool CurrentHeader(struct mach_header_64 *header, off_t *offset);
+ bool CurrentHeader(struct mach_header_64* header, off_t* offset);
private:
// Locate (if any) the header offset for |cpu_type| and return in |offset|.
// Return true if found, false otherwise.
bool FindHeader(cpu_type_t cpu_type,
cpu_subtype_t cpu_subtype,
- off_t &offset);
+ off_t& offset);
// Process an individual header starting at |offset| from the start of the
// file. Return true if successful, false otherwise.
@@ -91,27 +91,27 @@ class MachoWalker {
int file_;
// Memory location to read from.
- void *memory_;
+ void* memory_;
// Size of the memory segment we can read from.
size_t memory_size_;
// User specified callback & context
LoadCommandCallback callback_;
- void *callback_context_;
+ void* callback_context_;
// Current header, size, and offset. The mach_header_64 is used for both
// 32-bit and 64-bit headers because they only differ in their last field
// (reserved). By adding the |current_header_size_| and the
// |current_header_offset_|, you can determine the offset in the file just
// after the header.
- struct mach_header_64 *current_header_;
+ struct mach_header_64* current_header_;
unsigned long current_header_size_;
off_t current_header_offset_;
private:
- MachoWalker(const MachoWalker &);
- MachoWalker &operator=(const MachoWalker &);
+ MachoWalker(const MachoWalker&);
+ MachoWalker& operator=(const MachoWalker&);
};
} // namespace MacFileUtilities
diff --git a/src/common/mac/string_utilities.cc b/src/common/mac/string_utilities.cc
index 07c0f426..cb155403 100644
--- a/src/common/mac/string_utilities.cc
+++ b/src/common/mac/string_utilities.cc
@@ -48,12 +48,12 @@ std::string ConvertToString(CFStringRef str) {
CFStringGetBytes(str, CFRangeMake(0, length), kCFStringEncodingUTF8, 0,
false, buffer.get(), maxUTF8Length, &actualUTF8Length);
buffer[actualUTF8Length] = 0;
- result.assign((const char *)buffer.get());
+ result.assign((const char*)buffer.get());
return result;
}
-unsigned int IntegerValueAtIndex(string &str, unsigned int idx) {
+unsigned int IntegerValueAtIndex(string& str, unsigned int idx) {
string digits("0123456789"), temp;
size_t start = 0;
size_t end;
diff --git a/src/common/mac/string_utilities.h b/src/common/mac/string_utilities.h
index 6d89c834..e87304c1 100644
--- a/src/common/mac/string_utilities.h
+++ b/src/common/mac/string_utilities.h
@@ -45,7 +45,7 @@ string ConvertToString(CFStringRef str);
// Return the idx'th decimal integer in str, separated by non-decimal-digits
// E.g., str = 10.4.8, idx = 1 -> 4
-unsigned int IntegerValueAtIndex(string &str, unsigned int idx);
+unsigned int IntegerValueAtIndex(string& str, unsigned int idx);
} // namespace MacStringUtils
diff --git a/src/common/mac/super_fat_arch.h b/src/common/mac/super_fat_arch.h
index 501c8652..d7fa018a 100644
--- a/src/common/mac/super_fat_arch.h
+++ b/src/common/mac/super_fat_arch.h
@@ -57,7 +57,7 @@ class SuperFatArch {
align(0) {
}
- explicit SuperFatArch(const struct fat_arch &arch) :
+ explicit SuperFatArch(const struct fat_arch& arch) :
cputype(arch.cputype),
cpusubtype(arch.cpusubtype),
offset(arch.offset),
diff --git a/src/common/md5.cc b/src/common/md5.cc
index 4f1ac8ca..b6e710da 100644
--- a/src/common/md5.cc
+++ b/src/common/md5.cc
@@ -31,7 +31,7 @@ static void byteReverse(unsigned char *buf, unsigned longs)
do {
t = (u32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
((unsigned) buf[1] << 8 | buf[0]);
- *(u32 *) buf = t;
+ *(u32*) buf = t;
buf += 4;
} while (--longs);
}
@@ -74,7 +74,7 @@ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, size_t len)
/* Handle any leading odd-sized chunks */
if (t) {
- unsigned char *p = (unsigned char *) ctx->in + t;
+ unsigned char *p = (unsigned char*) ctx->in + t;
t = 64 - t;
if (len < t) {
@@ -83,7 +83,7 @@ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, size_t len)
}
memcpy(p, buf, t);
byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (u32 *) ctx->in);
+ MD5Transform(ctx->buf, (u32*) ctx->in);
buf += t;
len -= t;
}
@@ -92,7 +92,7 @@ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, size_t len)
while (len >= 64) {
memcpy(ctx->in, buf, 64);
byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (u32 *) ctx->in);
+ MD5Transform(ctx->buf, (u32*) ctx->in);
buf += 64;
len -= 64;
}
@@ -127,7 +127,7 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
/* Two lots of padding: Pad the first block to 64 bytes */
memset(p, 0, count);
byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (u32 *) ctx->in);
+ MD5Transform(ctx->buf, (u32*) ctx->in);
/* Now fill the next block with 56 bytes */
memset(ctx->in, 0, 56);
@@ -141,8 +141,8 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
memcpy(&ctx->in[14], &ctx->bits[0], sizeof(u32));
memcpy(&ctx->in[15], &ctx->bits[1], sizeof(u32));
- MD5Transform(ctx->buf, (u32 *) ctx->in);
- byteReverse((unsigned char *) ctx->buf, 4);
+ MD5Transform(ctx->buf, (u32*) ctx->in);
+ byteReverse((unsigned char*) ctx->buf, 4);
memcpy(digest, ctx->buf, 16);
memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
}
diff --git a/src/common/memory_allocator.h b/src/common/memory_allocator.h
index a3159ea4..69055a15 100644
--- a/src/common/memory_allocator.h
+++ b/src/common/memory_allocator.h
@@ -71,12 +71,12 @@ class PageAllocator {
FreeAll();
}
- void *Alloc(size_t bytes) {
+ void* Alloc(size_t bytes) {
if (!bytes)
return NULL;
if (current_page_ && page_size_ - page_offset_ >= bytes) {
- uint8_t *const ret = current_page_ + page_offset_;
+ uint8_t* const ret = current_page_ + page_offset_;
page_offset_ += bytes;
if (page_offset_ == page_size_) {
page_offset_ = 0;
@@ -88,7 +88,7 @@ class PageAllocator {
const size_t pages =
(bytes + sizeof(PageHeader) + page_size_ - 1) / page_size_;
- uint8_t *const ret = GetNPages(pages);
+ uint8_t* const ret = GetNPages(pages);
if (!ret)
return NULL;
@@ -115,8 +115,8 @@ class PageAllocator {
unsigned long pages_allocated() { return pages_allocated_; }
private:
- uint8_t *GetNPages(size_t num_pages) {
- void *a = sys_mmap(NULL, page_size_ * num_pages, PROT_READ | PROT_WRITE,
+ uint8_t* GetNPages(size_t num_pages) {
+ void* a = sys_mmap(NULL, page_size_ * num_pages, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (a == MAP_FAILED)
return NULL;
@@ -127,7 +127,7 @@ class PageAllocator {
__msan_unpoison(a, page_size_ * num_pages);
#endif
- struct PageHeader *header = reinterpret_cast<PageHeader*>(a);
+ struct PageHeader* header = reinterpret_cast<PageHeader*>(a);
header->next = last_;
header->num_pages = num_pages;
last_ = header;
@@ -138,22 +138,22 @@ class PageAllocator {
}
void FreeAll() {
- PageHeader *next;
+ PageHeader* next;
- for (PageHeader *cur = last_; cur; cur = next) {
+ for (PageHeader* cur = last_; cur; cur = next) {
next = cur->next;
sys_munmap(cur, cur->num_pages * page_size_);
}
}
struct PageHeader {
- PageHeader *next; // pointer to the start of the next set of pages.
+ PageHeader* next; // pointer to the start of the next set of pages.
size_t num_pages; // the number of pages in this set.
};
const size_t page_size_;
- PageHeader *last_;
- uint8_t *current_page_;
+ PageHeader* last_;
+ uint8_t* current_page_;
size_t page_offset_;
unsigned long pages_allocated_;
};
diff --git a/src/common/memory_allocator_unittest.cc b/src/common/memory_allocator_unittest.cc
index 43c86314..5803b90d 100644
--- a/src/common/memory_allocator_unittest.cc
+++ b/src/common/memory_allocator_unittest.cc
@@ -46,7 +46,7 @@ TEST(PageAllocatorTest, SmallObjects) {
EXPECT_EQ(0U, allocator.pages_allocated());
for (unsigned i = 1; i < 1024; ++i) {
- uint8_t *p = reinterpret_cast<uint8_t*>(allocator.Alloc(i));
+ uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(i));
ASSERT_FALSE(p == NULL);
memset(p, 0, i);
}
@@ -56,11 +56,11 @@ TEST(PageAllocatorTest, LargeObject) {
PageAllocator allocator;
EXPECT_EQ(0U, allocator.pages_allocated());
- uint8_t *p = reinterpret_cast<uint8_t*>(allocator.Alloc(10000));
+ uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(10000));
ASSERT_FALSE(p == NULL);
EXPECT_EQ(3U, allocator.pages_allocated());
for (unsigned i = 1; i < 10; ++i) {
- uint8_t *p = reinterpret_cast<uint8_t*>(allocator.Alloc(i));
+ uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(i));
ASSERT_FALSE(p == NULL);
memset(p, 0, i);
}
diff --git a/src/common/module.cc b/src/common/module.cc
index aff22127..f70ae203 100644
--- a/src/common/module.cc
+++ b/src/common/module.cc
@@ -47,9 +47,9 @@ using std::dec;
using std::hex;
-Module::Module(const string &name, const string &os,
- const string &architecture, const string &id,
- const string &code_id /* = "" */) :
+Module::Module(const string& name, const string& os,
+ const string& architecture, const string& id,
+ const string& code_id /* = "" */) :
name_(name),
os_(os),
architecture_(architecture),
@@ -64,7 +64,7 @@ Module::~Module() {
it != functions_.end(); ++it) {
delete *it;
}
- for (vector<StackFrameEntry *>::iterator it = stack_frame_entries_.begin();
+ for (vector<StackFrameEntry*>::iterator it = stack_frame_entries_.begin();
it != stack_frame_entries_.end(); ++it) {
delete *it;
}
@@ -80,7 +80,7 @@ void Module::SetAddressRanges(const vector<Range>& ranges) {
address_ranges_ = ranges;
}
-void Module::AddFunction(Function *function) {
+void Module::AddFunction(Function* function) {
// FUNC lines must not hold an empty name, so catch the problem early if
// callers try to add one.
assert(!function->name.empty());
@@ -124,13 +124,13 @@ void Module::AddFunction(Function *function) {
}
}
-void Module::AddFunctions(vector<Function *>::iterator begin,
- vector<Function *>::iterator end) {
- for (vector<Function *>::iterator it = begin; it != end; ++it)
+void Module::AddFunctions(vector<Function*>::iterator begin,
+ vector<Function*>::iterator end) {
+ for (vector<Function*>::iterator it = begin; it != end; ++it)
AddFunction(*it);
}
-void Module::AddStackFrameEntry(StackFrameEntry *stack_frame_entry) {
+void Module::AddStackFrameEntry(StackFrameEntry* stack_frame_entry) {
if (!AddressIsInModule(stack_frame_entry->address)) {
return;
}
@@ -138,7 +138,7 @@ void Module::AddStackFrameEntry(StackFrameEntry *stack_frame_entry) {
stack_frame_entries_.push_back(stack_frame_entry);
}
-void Module::AddExtern(Extern *ext) {
+void Module::AddExtern(Extern* ext) {
if (!AddressIsInModule(ext->address)) {
return;
}
@@ -151,17 +151,17 @@ void Module::AddExtern(Extern *ext) {
}
}
-void Module::GetFunctions(vector<Function *> *vec,
- vector<Function *>::iterator i) {
+void Module::GetFunctions(vector<Function*>* vec,
+ vector<Function*>::iterator i) {
vec->insert(i, functions_.begin(), functions_.end());
}
-void Module::GetExterns(vector<Extern *> *vec,
- vector<Extern *>::iterator i) {
+void Module::GetExterns(vector<Extern*>* vec,
+ vector<Extern*>::iterator i) {
vec->insert(i, externs_.begin(), externs_.end());
}
-Module::File *Module::FindFile(const string &name) {
+Module::File* Module::FindFile(const string& name) {
// A tricky bit here. The key of each map entry needs to be a
// pointer to the entry's File's name string. This means that we
// can't do the initial lookup with any operation that would create
@@ -175,7 +175,7 @@ Module::File *Module::FindFile(const string &name) {
FileByNameMap::iterator destiny = files_.lower_bound(&name);
if (destiny == files_.end()
|| *destiny->first != name) { // Repeated string comparison, boo hoo.
- File *file = new File(name);
+ File* file = new File(name);
file->source_id = -1;
destiny = files_.insert(destiny,
FileByNameMap::value_type(&file->name, file));
@@ -183,23 +183,23 @@ Module::File *Module::FindFile(const string &name) {
return destiny->second;
}
-Module::File *Module::FindFile(const char *name) {
+Module::File* Module::FindFile(const char* name) {
string name_string = name;
return FindFile(name_string);
}
-Module::File *Module::FindExistingFile(const string &name) {
+Module::File* Module::FindExistingFile(const string& name) {
FileByNameMap::iterator it = files_.find(&name);
return (it == files_.end()) ? NULL : it->second;
}
-void Module::GetFiles(vector<File *> *vec) {
+void Module::GetFiles(vector<File*>* vec) {
vec->clear();
for (FileByNameMap::iterator it = files_.begin(); it != files_.end(); ++it)
vec->push_back(it->second);
}
-void Module::GetStackFrameEntries(vector<StackFrameEntry *> *vec) const {
+void Module::GetStackFrameEntries(vector<StackFrameEntry*>* vec) const {
*vec = stack_frame_entries_;
}
@@ -214,7 +214,7 @@ void Module::AssignSourceIds() {
// info, by setting each one's source id to zero.
for (FunctionSet::const_iterator func_it = functions_.begin();
func_it != functions_.end(); ++func_it) {
- Function *func = *func_it;
+ Function* func = *func_it;
for (vector<Line>::iterator line_it = func->lines.begin();
line_it != func->lines.end(); ++line_it)
line_it->file->source_id = 0;
@@ -238,7 +238,7 @@ bool Module::ReportError() {
return false;
}
-bool Module::WriteRuleMap(const RuleMap &rule_map, std::ostream &stream) {
+bool Module::WriteRuleMap(const RuleMap& rule_map, std::ostream& stream) {
for (RuleMap::const_iterator it = rule_map.begin();
it != rule_map.end(); ++it) {
if (it != rule_map.begin())
@@ -261,7 +261,7 @@ bool Module::AddressIsInModule(Address address) const {
return false;
}
-bool Module::Write(std::ostream &stream, SymbolData symbol_data) {
+bool Module::Write(std::ostream& stream, SymbolData symbol_data) {
stream << "MODULE " << os_ << " " << architecture_ << " "
<< id_ << " " << name_ << "\n";
if (!stream.good())
@@ -277,7 +277,7 @@ bool Module::Write(std::ostream &stream, SymbolData symbol_data) {
// Write out files.
for (FileByNameMap::iterator file_it = files_.begin();
file_it != files_.end(); ++file_it) {
- File *file = file_it->second;
+ File* file = file_it->second;
if (file->source_id >= 0) {
stream << "FILE " << file->source_id << " " << file->name << "\n";
if (!stream.good())
@@ -288,7 +288,7 @@ bool Module::Write(std::ostream &stream, SymbolData symbol_data) {
// Write out functions and their lines.
for (FunctionSet::const_iterator func_it = functions_.begin();
func_it != functions_.end(); ++func_it) {
- Function *func = *func_it;
+ Function* func = *func_it;
vector<Line>::iterator line_it = func->lines.begin();
for (auto range_it = func->ranges.cbegin();
range_it != func->ranges.cend(); ++range_it) {
@@ -322,7 +322,7 @@ bool Module::Write(std::ostream &stream, SymbolData symbol_data) {
// Write out 'PUBLIC' records.
for (ExternSet::const_iterator extern_it = externs_.begin();
extern_it != externs_.end(); ++extern_it) {
- Extern *ext = *extern_it;
+ Extern* ext = *extern_it;
stream << "PUBLIC " << hex
<< (ext->address - load_address_) << " 0 "
<< ext->name << dec << "\n";
@@ -331,10 +331,10 @@ bool Module::Write(std::ostream &stream, SymbolData symbol_data) {
if (symbol_data != NO_CFI) {
// Write out 'STACK CFI INIT' and 'STACK CFI' records.
- vector<StackFrameEntry *>::const_iterator frame_it;
+ vector<StackFrameEntry*>::const_iterator frame_it;
for (frame_it = stack_frame_entries_.begin();
frame_it != stack_frame_entries_.end(); ++frame_it) {
- StackFrameEntry *entry = *frame_it;
+ StackFrameEntry* entry = *frame_it;
stream << "STACK CFI INIT " << hex
<< (entry->address - load_address_) << " "
<< entry->size << " " << dec;
diff --git a/src/common/module.h b/src/common/module.h
index 7309cedd..60bf709b 100644
--- a/src/common/module.h
+++ b/src/common/module.h
@@ -74,7 +74,7 @@ class Module {
// A source file.
struct File {
- explicit File(const string &name_input) : name(name_input), source_id(0) {}
+ explicit File(const string& name_input) : name(name_input), source_id(0) {}
// The name of the source file.
const string name;
@@ -96,12 +96,12 @@ class Module {
// A function.
struct Function {
- Function(const string &name_input, const Address &address_input) :
+ Function(const string& name_input, const Address& address_input) :
name(name_input), address(address_input), parameter_size(0) {}
// For sorting by address. (Not style-guide compliant, but it's
// stupid not to put this in the struct.)
- static bool CompareByAddress(const Function *x, const Function *y) {
+ static bool CompareByAddress(const Function* x, const Function* y) {
return x->address < y->address;
}
@@ -124,18 +124,18 @@ class Module {
struct Line {
// For sorting by address. (Not style-guide compliant, but it's
// stupid not to put this in the struct.)
- static bool CompareByAddress(const Module::Line &x, const Module::Line &y) {
+ static bool CompareByAddress(const Module::Line& x, const Module::Line& y) {
return x.address < y.address;
}
Address address, size; // The address and size of the line's code.
- File *file; // The source file.
+ File* file; // The source file.
int number; // The source line number.
};
// An exported symbol.
struct Extern {
- explicit Extern(const Address &address_input) : address(address_input) {}
+ explicit Extern(const Address& address_input) : address(address_input) {}
const Address address;
string name;
};
@@ -170,8 +170,7 @@ class Module {
};
struct FunctionCompare {
- bool operator() (const Function *lhs,
- const Function *rhs) const {
+ bool operator() (const Function* lhs, const Function* rhs) const {
if (lhs->address == rhs->address)
return lhs->name < rhs->name;
return lhs->address < rhs->address;
@@ -179,16 +178,15 @@ class Module {
};
struct ExternCompare {
- bool operator() (const Extern *lhs,
- const Extern *rhs) const {
+ bool operator() (const Extern* lhs, const Extern* rhs) const {
return lhs->address < rhs->address;
}
};
// Create a new module with the given name, operating system,
// architecture, and ID string.
- Module(const string &name, const string &os, const string &architecture,
- const string &id, const string &code_id = "");
+ Module(const string& name, const string& os, const string& architecture,
+ const string& id, const string& code_id = "");
~Module();
// Set the module's load address to LOAD_ADDRESS; addresses given
@@ -216,62 +214,62 @@ class Module {
// Add FUNCTION to the module. FUNCTION's name must not be empty.
// This module owns all Function objects added with this function:
// destroying the module destroys them as well.
- void AddFunction(Function *function);
+ void AddFunction(Function* function);
// Add all the functions in [BEGIN,END) to the module.
// This module owns all Function objects added with this function:
// destroying the module destroys them as well.
- void AddFunctions(vector<Function *>::iterator begin,
- vector<Function *>::iterator end);
+ void AddFunctions(vector<Function*>::iterator begin,
+ vector<Function*>::iterator end);
// Add STACK_FRAME_ENTRY to the module.
// This module owns all StackFrameEntry objects added with this
// function: destroying the module destroys them as well.
- void AddStackFrameEntry(StackFrameEntry *stack_frame_entry);
+ void AddStackFrameEntry(StackFrameEntry* stack_frame_entry);
// Add PUBLIC to the module.
// This module owns all Extern objects added with this function:
// destroying the module destroys them as well.
- void AddExtern(Extern *ext);
+ void AddExtern(Extern* ext);
// If this module has a file named NAME, return a pointer to it. If
// it has none, then create one and return a pointer to the new
// file. This module owns all File objects created using these
// functions; destroying the module destroys them as well.
- File *FindFile(const string &name);
- File *FindFile(const char *name);
+ File* FindFile(const string& name);
+ File* FindFile(const char* name);
// If this module has a file named NAME, return a pointer to it.
// Otherwise, return NULL.
- File *FindExistingFile(const string &name);
+ File* FindExistingFile(const string& name);
// Insert pointers to the functions added to this module at I in
// VEC. The pointed-to Functions are still owned by this module.
// (Since this is effectively a copy of the function list, this is
// mostly useful for testing; other uses should probably get a more
// appropriate interface.)
- void GetFunctions(vector<Function *> *vec, vector<Function *>::iterator i);
+ void GetFunctions(vector<Function*>* vec, vector<Function*>::iterator i);
// Insert pointers to the externs added to this module at I in
// VEC. The pointed-to Externs are still owned by this module.
// (Since this is effectively a copy of the extern list, this is
// mostly useful for testing; other uses should probably get a more
// appropriate interface.)
- void GetExterns(vector<Extern *> *vec, vector<Extern *>::iterator i);
+ void GetExterns(vector<Extern*>* vec, vector<Extern*>::iterator i);
// Clear VEC and fill it with pointers to the Files added to this
// module, sorted by name. The pointed-to Files are still owned by
// this module. (Since this is effectively a copy of the file list,
// this is mostly useful for testing; other uses should probably get
// a more appropriate interface.)
- void GetFiles(vector<File *> *vec);
+ void GetFiles(vector<File*>* vec);
// Clear VEC and fill it with pointers to the StackFrameEntry
// objects that have been added to this module. (Since this is
// effectively a copy of the stack frame entry list, this is mostly
// useful for testing; other uses should probably get
// a more appropriate interface.)
- void GetStackFrameEntries(vector<StackFrameEntry *> *vec) const;
+ void GetStackFrameEntries(vector<StackFrameEntry*>* vec) const;
// Find those files in this module that are actually referred to by
// functions' line number data, and assign them source id numbers.
@@ -292,7 +290,7 @@ class Module {
// - all CFI records.
// Addresses in the output are all relative to the load address
// established by SetLoadAddress.
- bool Write(std::ostream &stream, SymbolData symbol_data);
+ bool Write(std::ostream& stream, SymbolData symbol_data);
string name() const { return name_; }
string os() const { return os_; }
@@ -308,7 +306,7 @@ class Module {
// Write RULE_MAP to STREAM, in the form appropriate for 'STACK CFI'
// records, without a final newline. Return true if all goes well;
// if an error occurs, return false, and leave errno set.
- static bool WriteRuleMap(const RuleMap &rule_map, std::ostream &stream);
+ static bool WriteRuleMap(const RuleMap& rule_map, std::ostream& stream);
// Returns true of the specified address resides with an specified address
// range, or if no ranges have been specified.
@@ -329,18 +327,18 @@ class Module {
// Relation for maps whose keys are strings shared with some other
// structure.
struct CompareStringPtrs {
- bool operator()(const string *x, const string *y) const { return *x < *y; }
+ bool operator()(const string* x, const string* y) const { return *x < *y; }
};
// A map from filenames to File structures. The map's keys are
// pointers to the Files' names.
- typedef map<const string *, File *, CompareStringPtrs> FileByNameMap;
+ typedef map<const string*, File*, CompareStringPtrs> FileByNameMap;
// A set containing Function structures, sorted by address.
- typedef set<Function *, FunctionCompare> FunctionSet;
+ typedef set<Function*, FunctionCompare> FunctionSet;
// A set containing Extern structures, sorted by address.
- typedef set<Extern *, ExternCompare> ExternSet;
+ typedef set<Extern*, ExternCompare> ExternSet;
// The module owns all the files and functions that have been added
// to it; destroying the module frees the Files and Functions these
@@ -350,7 +348,7 @@ class Module {
// The module owns all the call frame info entries that have been
// added to it.
- vector<StackFrameEntry *> stack_frame_entries_;
+ vector<StackFrameEntry*> stack_frame_entries_;
// The module owns all the externs that have been added to it;
// destroying the module frees the Externs these point to.
diff --git a/src/common/module_unittest.cc b/src/common/module_unittest.cc
index 37fee5dd..cede09c3 100644
--- a/src/common/module_unittest.cc
+++ b/src/common/module_unittest.cc
@@ -49,7 +49,7 @@ using std::stringstream;
using std::vector;
using testing::ContainerEq;
-static Module::Function* generate_duplicate_function(const string &name) {
+static Module::Function* generate_duplicate_function(const string& name) {
const Module::Address DUP_ADDRESS = 0xd35402aac7a7ad5cULL;
const Module::Address DUP_SIZE = 0x200b26e605f99071ULL;
const Module::Address DUP_PARAMETER_SIZE = 0xf14ac4fed48c4a99ULL;
diff --git a/src/common/solaris/dump_symbols.cc b/src/common/solaris/dump_symbols.cc
index 168d0b28..9524a18b 100644
--- a/src/common/solaris/dump_symbols.cc
+++ b/src/common/solaris/dump_symbols.cc
@@ -97,7 +97,7 @@ struct LineInfo {
// Information of a function.
struct FuncInfo {
// Name of the function.
- const char *name;
+ const char* name;
// Offset from the base of the loading address.
GElf_Off rva_to_base;
// Virtual address of the function.
@@ -115,7 +115,7 @@ struct FuncInfo {
// Information of a source file.
struct SourceFileInfo {
// Name of the source file.
- const char *name;
+ const char* name;
// Starting address of the source file.
GElf_Addr addr;
// Id of the source file.
@@ -125,12 +125,12 @@ struct SourceFileInfo {
};
struct CompareString {
- bool operator()(const char *s1, const char *s2) const {
+ bool operator()(const char* s1, const char* s2) const {
return strcmp(s1, s2) < 0;
}
};
-typedef std::map<const char *, struct SymbolEntry *, CompareString> SymbolMap;
+typedef std::map<const char*, struct SymbolEntry*, CompareString> SymbolMap;
// Information of a symbol table.
// This is the root of all types of symbol.
@@ -141,16 +141,16 @@ struct SymbolInfo {
};
// Stab section name.
-const char *kStabName = ".stab";
+const char* kStabName = ".stab";
// Stab str section name.
-const char *kStabStrName = ".stabstr";
+const char* kStabStrName = ".stabstr";
// Symtab section name.
-const char *kSymtabName = ".symtab";
+const char* kSymtabName = ".symtab";
// Strtab section name.
-const char *kStrtabName = ".strtab";
+const char* kStrtabName = ".strtab";
// Default buffer lenght for demangle.
const int demangleLen = 20000;
@@ -160,11 +160,11 @@ uint64_t stringOffset = 0;
// Update the offset to the start of the string index of the next
// object module for every N_ENDM stabs.
-inline void RecalculateOffset(struct slist* cur_list, char *stabstr) {
+inline void RecalculateOffset(struct slist* cur_list, char* stabstr) {
while ((--cur_list)->n_strx == 0) ;
stringOffset += cur_list->n_strx;
- char *temp = stabstr + stringOffset;
+ char* temp = stabstr + stringOffset;
while (*temp != '\0') {
++stringOffset;
++temp;
@@ -174,10 +174,10 @@ inline void RecalculateOffset(struct slist* cur_list, char *stabstr) {
}
// Demangle using demangle library on Solaris.
-std::string Demangle(const char *mangled) {
+std::string Demangle(const char* mangled) {
int status = 0;
std::string str(mangled);
- char *demangled = (char *)malloc(demangleLen);
+ char* demangled = (char*)malloc(demangleLen);
if (!demangled) {
fprintf(stderr, "no enough memory.\n");
@@ -197,7 +197,7 @@ out:
return str;
}
-bool WriteFormat(int fd, const char *fmt, ...) {
+bool WriteFormat(int fd, const char* fmt, ...) {
va_list list;
char buffer[4096];
ssize_t expected, written;
@@ -209,27 +209,27 @@ bool WriteFormat(int fd, const char *fmt, ...) {
return expected == written;
}
-bool IsValidElf(const GElf_Ehdr *elf_header) {
+bool IsValidElf(const GElf_Ehdr* elf_header) {
return memcmp(elf_header, ELFMAG, SELFMAG) == 0;
}
-static bool FindSectionByName(Elf *elf, const char *name,
+static bool FindSectionByName(Elf* elf, const char* name,
int shstrndx,
- GElf_Shdr *shdr) {
+ GElf_Shdr* shdr) {
assert(name != NULL);
if (strlen(name) == 0)
return false;
- Elf_Scn *scn = NULL;
+ Elf_Scn* scn = NULL;
while ((scn = elf_nextscn(elf, scn)) != NULL) {
- if (gelf_getshdr(scn, shdr) == (GElf_Shdr *)0) {
+ if (gelf_getshdr(scn, shdr) == (GElf_Shdr*)0) {
fprintf(stderr, "failed to read section header: %s\n", elf_errmsg(0));
return false;
}
- const char *section_name = elf_strptr(elf, shstrndx, shdr->sh_name);
+ const char* section_name = elf_strptr(elf, shstrndx, shdr->sh_name);
if (!section_name) {
fprintf(stderr, "Section name error: %s\n", elf_errmsg(-1));
continue;
@@ -245,10 +245,10 @@ static bool FindSectionByName(Elf *elf, const char *name,
// The parameter size is used for FPO-optimized code, and
// this is all tied up with the debugging data for Windows x86.
// Set it to 0 on Solaris.
-int LoadStackParamSize(struct slist *list,
- struct slist *list_end,
- struct FuncInfo *func_info) {
- struct slist *cur_list = list;
+int LoadStackParamSize(struct slist* list,
+ struct slist* list_end,
+ struct FuncInfo* func_info) {
+ struct slist* cur_list = list;
int step = 1;
while (cur_list < list_end && cur_list->n_type == N_PSYM) {
++cur_list;
@@ -259,10 +259,10 @@ int LoadStackParamSize(struct slist *list,
return step;
}
-int LoadLineInfo(struct slist *list,
- struct slist *list_end,
- struct FuncInfo *func_info) {
- struct slist *cur_list = list;
+int LoadLineInfo(struct slist* list,
+ struct slist* list_end,
+ struct FuncInfo* func_info) {
+ struct slist* cur_list = list;
do {
// Skip non line information.
while (cur_list < list_end && cur_list->n_type != N_SLINE) {
@@ -288,12 +288,12 @@ int LoadLineInfo(struct slist *list,
return cur_list - list;
}
-int LoadFuncSymbols(struct slist *list,
- struct slist *list_end,
- char *stabstr,
+int LoadFuncSymbols(struct slist* list,
+ struct slist* list_end,
+ char* stabstr,
GElf_Word base,
- struct SourceFileInfo *source_file_info) {
- struct slist *cur_list = list;
+ struct SourceFileInfo* source_file_info) {
+ struct slist* cur_list = list;
assert(cur_list->n_type == N_SO);
++cur_list;
@@ -342,17 +342,17 @@ int LoadFuncSymbols(struct slist *list,
}
// Compute size and rva information based on symbols loaded from stab section.
-bool ComputeSizeAndRVA(struct SymbolInfo *symbols) {
- std::vector<struct SourceFileInfo> *sorted_files =
+bool ComputeSizeAndRVA(struct SymbolInfo* symbols) {
+ std::vector<struct SourceFileInfo>* sorted_files =
&(symbols->source_file_info);
- SymbolMap *symbol_entries = &(symbols->symbol_entries);
+ SymbolMap* symbol_entries = &(symbols->symbol_entries);
for (size_t i = 0; i < sorted_files->size(); ++i) {
- struct SourceFileInfo &source_file = (*sorted_files)[i];
- std::vector<struct FuncInfo> *sorted_functions = &(source_file.func_info);
+ struct SourceFileInfo& source_file = (*sorted_files)[i];
+ std::vector<struct FuncInfo>* sorted_functions = &(source_file.func_info);
int func_size = sorted_functions->size();
for (size_t j = 0; j < func_size; ++j) {
- struct FuncInfo &func_info = (*sorted_functions)[j];
+ struct FuncInfo& func_info = (*sorted_functions)[j];
int line_count = func_info.line_info.size();
// Discard the ending part of the name.
@@ -373,13 +373,13 @@ bool ComputeSizeAndRVA(struct SymbolInfo *symbols) {
// Compute function and line size.
for (size_t k = 0; k < line_count; ++k) {
- struct LineInfo &line_info = func_info.line_info[k];
+ struct LineInfo& line_info = func_info.line_info[k];
line_info.rva_to_base = line_info.rva_to_func + func_info.rva_to_base;
if (k == line_count - 1) {
line_info.size = func_info.size - line_info.rva_to_func;
} else {
- struct LineInfo &next_line = func_info.line_info[k + 1];
+ struct LineInfo& next_line = func_info.line_info[k + 1];
line_info.size = next_line.rva_to_func - line_info.rva_to_func;
}
} // for each line.
@@ -392,24 +392,23 @@ bool ComputeSizeAndRVA(struct SymbolInfo *symbols) {
return true;
}
-bool LoadAllSymbols(const GElf_Shdr *stab_section,
- const GElf_Shdr *stabstr_section,
+bool LoadAllSymbols(const GElf_Shdr* stab_section,
+ const GElf_Shdr* stabstr_section,
GElf_Word base,
- struct SymbolInfo *symbols) {
+ struct SymbolInfo* symbols) {
if (stab_section == NULL || stabstr_section == NULL)
return false;
- char *stabstr =
- reinterpret_cast<char *>(stabstr_section->sh_offset + base);
- struct slist *lists =
- reinterpret_cast<struct slist *>(stab_section->sh_offset + base);
+ char* stabstr = reinterpret_cast<char*>(stabstr_section->sh_offset + base);
+ struct slist* lists =
+ reinterpret_cast<struct slist*>(stab_section->sh_offset + base);
int nstab = stab_section->sh_size / sizeof(struct slist);
int source_id = 0;
// First pass, load all symbols from the object file.
for (int i = 0; i < nstab; ) {
int step = 1;
- struct slist *cur_list = lists + i;
+ struct slist* cur_list = lists + i;
if (cur_list->n_type == N_SO) {
// FUNC <address> <size> <param_stack_size> <function>
struct SourceFileInfo source_file_info;
@@ -431,12 +430,12 @@ bool LoadAllSymbols(const GElf_Shdr *stab_section,
return ComputeSizeAndRVA(symbols);
}
-bool LoadSymbols(Elf *elf, GElf_Ehdr *elf_header, struct SymbolInfo *symbols,
- void *obj_base) {
+bool LoadSymbols(Elf* elf, GElf_Ehdr* elf_header, struct SymbolInfo* symbols,
+ void* obj_base) {
GElf_Word base = reinterpret_cast<GElf_Word>(obj_base);
- const GElf_Shdr *sections =
- reinterpret_cast<GElf_Shdr *>(elf_header->e_shoff + base);
+ const GElf_Shdr* sections =
+ reinterpret_cast<GElf_Shdr*>(elf_header->e_shoff + base);
GElf_Shdr stab_section;
if (!FindSectionByName(elf, kStabName, elf_header->e_shstrndx,
&stab_section)) {
@@ -462,11 +461,11 @@ bool LoadSymbols(Elf *elf, GElf_Ehdr *elf_header, struct SymbolInfo *symbols,
return false;
}
- Elf_Sym *symbol = (Elf_Sym *)((char *)base + symtab_section.sh_offset);
+ Elf_Sym* symbol = (Elf_Sym*)((char*)base + symtab_section.sh_offset);
for (int i = 0; i < symtab_section.sh_size/symtab_section.sh_entsize; ++i) {
- struct SymbolEntry *symbol_entry =
- (struct SymbolEntry *)malloc(sizeof(struct SymbolEntry));
- const char *name = reinterpret_cast<char *>(
+ struct SymbolEntry* symbol_entry =
+ (struct SymbolEntry*)malloc(sizeof(struct SymbolEntry));
+ const char* name = reinterpret_cast<char*>(
strtab_section.sh_offset + (GElf_Word)base + symbol->st_name);
symbol_entry->offset = symbol->st_value;
symbol_entry->size = symbol->st_size;
@@ -479,8 +478,8 @@ bool LoadSymbols(Elf *elf, GElf_Ehdr *elf_header, struct SymbolInfo *symbols,
return LoadAllSymbols(&stab_section, &stabstr_section, base, symbols);
}
-bool WriteModuleInfo(int fd, GElf_Half arch, const std::string &obj_file) {
- const char *arch_name = NULL;
+bool WriteModuleInfo(int fd, GElf_Half arch, const std::string& obj_file) {
+ const char* arch_name = NULL;
if (arch == EM_386)
arch_name = "x86";
else if (arch == EM_X86_64)
@@ -508,10 +507,10 @@ bool WriteModuleInfo(int fd, GElf_Half arch, const std::string &obj_file) {
return false;
}
-bool WriteSourceFileInfo(int fd, const struct SymbolInfo &symbols) {
+bool WriteSourceFileInfo(int fd, const struct SymbolInfo& symbols) {
for (size_t i = 0; i < symbols.source_file_info.size(); ++i) {
if (symbols.source_file_info[i].source_id != -1) {
- const char *name = symbols.source_file_info[i].name;
+ const char* name = symbols.source_file_info[i].name;
if (!WriteFormat(fd, "FILE %d %s\n",
symbols.source_file_info[i].source_id, name))
return false;
@@ -521,7 +520,7 @@ bool WriteSourceFileInfo(int fd, const struct SymbolInfo &symbols) {
}
bool WriteOneFunction(int fd, int source_id,
- const struct FuncInfo &func_info){
+ const struct FuncInfo& func_info){
// Discard the ending part of the name.
std::string func_name(func_info.name);
std::string::size_type last_colon = func_name.find_last_of(':');
@@ -539,7 +538,7 @@ bool WriteOneFunction(int fd, int source_id,
func_info.stack_param_size,
func_name.c_str())) {
for (size_t i = 0; i < func_info.line_info.size(); ++i) {
- const struct LineInfo &line_info = func_info.line_info[i];
+ const struct LineInfo& line_info = func_info.line_info[i];
if (line_info.line_num == 0)
return true;
if (!WriteFormat(fd, "%llx %x %d %d\n",
@@ -554,11 +553,11 @@ bool WriteOneFunction(int fd, int source_id,
return false;
}
-bool WriteFunctionInfo(int fd, const struct SymbolInfo &symbols) {
+bool WriteFunctionInfo(int fd, const struct SymbolInfo& symbols) {
for (size_t i = 0; i < symbols.source_file_info.size(); ++i) {
- const struct SourceFileInfo &file_info = symbols.source_file_info[i];
+ const struct SourceFileInfo& file_info = symbols.source_file_info[i];
for (size_t j = 0; j < file_info.func_info.size(); ++j) {
- const struct FuncInfo &func_info = file_info.func_info[j];
+ const struct FuncInfo& func_info = file_info.func_info[j];
if (!WriteOneFunction(fd, file_info.source_id, func_info))
return false;
}
@@ -566,7 +565,7 @@ bool WriteFunctionInfo(int fd, const struct SymbolInfo &symbols) {
return true;
}
-bool DumpStabSymbols(int fd, const struct SymbolInfo &symbols) {
+bool DumpStabSymbols(int fd, const struct SymbolInfo& symbols) {
return WriteSourceFileInfo(fd, symbols) &&
WriteFunctionInfo(fd, symbols);
}
@@ -604,13 +603,13 @@ class FDWrapper {
//
class MmapWrapper {
public:
- MmapWrapper(void *mapped_address, size_t mapped_size) :
+ MmapWrapper(void* mapped_address, size_t mapped_size) :
base_(mapped_address), size_(mapped_size) {
}
~MmapWrapper() {
if (base_ != NULL) {
assert(size_ > 0);
- munmap((char *)base_, size_);
+ munmap((char*)base_, size_);
}
}
void release() {
@@ -619,7 +618,7 @@ class MmapWrapper {
}
private:
- void *base_;
+ void* base_;
size_t size_;
};
@@ -629,14 +628,14 @@ namespace google_breakpad {
class AutoElfEnder {
public:
- AutoElfEnder(Elf *elf) : elf_(elf) {}
+ AutoElfEnder(Elf* elf) : elf_(elf) {}
~AutoElfEnder() { if (elf_) elf_end(elf_); }
private:
- Elf *elf_;
+ Elf* elf_;
};
-bool DumpSymbols::WriteSymbolFile(const std::string &obj_file, int sym_fd) {
+bool DumpSymbols::WriteSymbolFile(const std::string& obj_file, int sym_fd) {
if (elf_version(EV_CURRENT) == EV_NONE) {
fprintf(stderr, "elf_version() failed: %s\n", elf_errmsg(0));
return false;
@@ -649,16 +648,16 @@ bool DumpSymbols::WriteSymbolFile(const std::string &obj_file, int sym_fd) {
struct stat st;
if (fstat(obj_fd, &st) != 0 && st.st_size <= 0)
return false;
- void *obj_base = mmap(NULL, st.st_size,
+ void* obj_base = mmap(NULL, st.st_size,
PROT_READ, MAP_PRIVATE, obj_fd, 0);
if (obj_base == MAP_FAILED)
return false;
MmapWrapper map_wrapper(obj_base, st.st_size);
GElf_Ehdr elf_header;
- Elf *elf = elf_begin(obj_fd, ELF_C_READ, NULL);
+ Elf* elf = elf_begin(obj_fd, ELF_C_READ, NULL);
AutoElfEnder elfEnder(elf);
- if (gelf_getehdr(elf, &elf_header) == (GElf_Ehdr *)NULL) {
+ if (gelf_getehdr(elf, &elf_header) == (GElf_Ehdr*)NULL) {
fprintf(stderr, "failed to read elf header: %s\n", elf_errmsg(-1));
return false;
}
diff --git a/src/common/solaris/dump_symbols.h b/src/common/solaris/dump_symbols.h
index 7f4baadc..3bca8a23 100644
--- a/src/common/solaris/dump_symbols.h
+++ b/src/common/solaris/dump_symbols.h
@@ -40,7 +40,7 @@ namespace google_breakpad {
class DumpSymbols {
public:
- bool WriteSymbolFile(const std::string &obj_file,
+ bool WriteSymbolFile(const std::string& obj_file,
int sym_fd);
};
diff --git a/src/common/solaris/file_id.cc b/src/common/solaris/file_id.cc
index 643a1462..c32c73bb 100644
--- a/src/common/solaris/file_id.cc
+++ b/src/common/solaris/file_id.cc
@@ -54,17 +54,17 @@ namespace google_breakpad {
class AutoElfEnder {
public:
- AutoElfEnder(Elf *elf) : elf_(elf) {}
+ AutoElfEnder(Elf* elf) : elf_(elf) {}
~AutoElfEnder() { if (elf_) elf_end(elf_); }
private:
- Elf *elf_;
+ Elf* elf_;
};
// Find the text section in elf object file.
// Return the section start address and the size.
-static bool FindElfTextSection(int fd, const void *elf_base,
- const void **text_start,
- int *text_size) {
+static bool FindElfTextSection(int fd, const void* elf_base,
+ const void** text_start,
+ int* text_size) {
assert(text_start);
assert(text_size);
@@ -78,10 +78,10 @@ static bool FindElfTextSection(int fd, const void *elf_base,
GElf_Ehdr elf_header;
lseek(fd, 0L, 0);
- Elf *elf = elf_begin(fd, ELF_C_READ, NULL);
+ Elf* elf = elf_begin(fd, ELF_C_READ, NULL);
AutoElfEnder elfEnder(elf);
- if (gelf_getehdr(elf, &elf_header) == (GElf_Ehdr *)NULL) {
+ if (gelf_getehdr(elf, &elf_header) == (GElf_Ehdr*)NULL) {
print_message2(2, "failed to read elf header: %s\n", elf_errmsg(-1));
return false;
}
@@ -95,18 +95,18 @@ static bool FindElfTextSection(int fd, const void *elf_base,
}
static const char kTextSectionName[] = ".text";
- const GElf_Shdr *text_section = NULL;
- Elf_Scn *scn = NULL;
+ const GElf_Shdr* text_section = NULL;
+ Elf_Scn* scn = NULL;
GElf_Shdr shdr;
while ((scn = elf_nextscn(elf, scn)) != NULL) {
- if (gelf_getshdr(scn, &shdr) == (GElf_Shdr *)0) {
+ if (gelf_getshdr(scn, &shdr) == (GElf_Shdr*)0) {
print_message2(2, "failed to read section header: %s\n", elf_errmsg(0));
return false;
}
if (shdr.sh_type == SHT_PROGBITS) {
- const char *section_name = elf_strptr(elf, elf_header.e_shstrndx,
+ const char* section_name = elf_strptr(elf, elf_header.e_shstrndx,
shdr.sh_name);
if (!section_name) {
print_message2(2, "Section name error: %s\n", elf_errmsg(-1));
@@ -120,7 +120,7 @@ static bool FindElfTextSection(int fd, const void *elf_base,
}
}
if (text_section != NULL && text_section->sh_size > 0) {
- *text_start = (char *)elf_base + text_section->sh_offset;
+ *text_start = (char*)elf_base + text_section->sh_offset;
*text_size = text_section->sh_size;
return true;
}
@@ -128,7 +128,7 @@ static bool FindElfTextSection(int fd, const void *elf_base,
return false;
}
-FileID::FileID(const char *path) {
+FileID::FileID(const char* path) {
strcpy(path_, path);
}
@@ -150,29 +150,29 @@ bool FileID::ElfFileIdentifier(unsigned char identifier[16]) {
if (fstat(fd, &st) != 0 || st.st_size <= 0)
return false;
- void *base = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
+ void* base = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if (base == MAP_FAILED)
return false;
bool success = false;
- const void *text_section = NULL;
+ const void* text_section = NULL;
int text_size = 0;
if (FindElfTextSection(fd, base, &text_section, &text_size)) {
MD5Context md5;
MD5Init(&md5);
- MD5Update(&md5, (const unsigned char *)text_section, text_size);
+ MD5Update(&md5, (const unsigned char*)text_section, text_size);
MD5Final(identifier, &md5);
success = true;
}
- munmap((char *)base, st.st_size);
+ munmap((char*)base, st.st_size);
return success;
}
// static
bool FileID::ConvertIdentifierToString(const unsigned char identifier[16],
- char *buffer, int buffer_length) {
+ char* buffer, int buffer_length) {
if (buffer_length < 34)
return false;
diff --git a/src/common/solaris/guid_creator.cc b/src/common/solaris/guid_creator.cc
index e9e6c6f5..17d773e7 100644
--- a/src/common/solaris/guid_creator.cc
+++ b/src/common/solaris/guid_creator.cc
@@ -74,8 +74,8 @@ bool GUIDToString(const GUID *guid, char *buf, int buf_len) {
assert(buf_len > kGUIDStringLength);
int num = snprintf(buf, buf_len, kGUIDFormatString,
guid->data1, guid->data2, guid->data3,
- *reinterpret_cast<const uint32_t *>(&(guid->data4[0])),
- *reinterpret_cast<const uint32_t *>(&(guid->data4[4])));
+ *reinterpret_cast<const uint32_t*>(&(guid->data4[0])),
+ *reinterpret_cast<const uint32_t*>(&(guid->data4[4])));
if (num != kGUIDStringLength)
return false;
diff --git a/src/common/stabs_reader.cc b/src/common/stabs_reader.cc
index 6019fc7e..43c40402 100644
--- a/src/common/stabs_reader.cc
+++ b/src/common/stabs_reader.cc
@@ -45,7 +45,7 @@ using std::vector;
namespace google_breakpad {
-StabsReader::EntryIterator::EntryIterator(const ByteBuffer *buffer,
+StabsReader::EntryIterator::EntryIterator(const ByteBuffer* buffer,
bool big_endian, size_t value_size)
: value_size_(value_size), cursor_(buffer, big_endian) {
// Actually, we could handle weird sizes just fine, but they're
@@ -65,10 +65,10 @@ void StabsReader::EntryIterator::Fetch() {
entry_.at_end = !cursor_;
}
-StabsReader::StabsReader(const uint8_t *stab, size_t stab_size,
- const uint8_t *stabstr, size_t stabstr_size,
+StabsReader::StabsReader(const uint8_t* stab, size_t stab_size,
+ const uint8_t* stabstr, size_t stabstr_size,
bool big_endian, size_t value_size, bool unitized,
- StabsHandler *handler)
+ StabsHandler* handler)
: entries_(stab, stab_size),
strings_(stabstr, stabstr_size),
iterator_(&entries_, big_endian, value_size),
@@ -78,7 +78,7 @@ StabsReader::StabsReader(const uint8_t *stab, size_t stab_size,
next_cu_string_offset_(0),
current_source_file_(NULL) { }
-const char *StabsReader::SymbolString() {
+const char* StabsReader::SymbolString() {
ptrdiff_t offset = string_offset_ + iterator_->name_offset;
if (offset < 0 || (size_t) offset >= strings_.Size()) {
handler_->Warning("symbol %d: name offset outside the string section\n",
@@ -87,7 +87,7 @@ const char *StabsReader::SymbolString() {
// taken from the string section.
offset = 0;
}
- return reinterpret_cast<const char *>(strings_.start + offset);
+ return reinterpret_cast<const char*>(strings_.start + offset);
}
bool StabsReader::Process() {
@@ -134,9 +134,9 @@ bool StabsReader::ProcessCompilationUnit() {
// There may be an N_SO entry whose name ends with a slash,
// indicating the directory in which the compilation occurred.
// The build directory defaults to NULL.
- const char *build_directory = NULL;
+ const char* build_directory = NULL;
{
- const char *name = SymbolString();
+ const char* name = SymbolString();
if (name[0] && name[strlen(name) - 1] == '/') {
build_directory = name;
++iterator_;
@@ -148,7 +148,7 @@ bool StabsReader::ProcessCompilationUnit() {
{
if (iterator_->at_end || iterator_->type != N_SO)
return true;
- const char *name = SymbolString();
+ const char* name = SymbolString();
if (name[0] == '\0') {
// This seems to be a stray end-of-compilation-unit marker;
// consume it, but don't report the end, since we didn't see a
@@ -203,7 +203,7 @@ bool StabsReader::ProcessCompilationUnit() {
uint64_t ending_address = 0;
if (!iterator_->at_end) {
assert(iterator_->type == N_SO);
- const char *name = SymbolString();
+ const char* name = SymbolString();
if (name[0] == '\0') {
ending_address = iterator_->value;
++iterator_;
@@ -225,8 +225,8 @@ bool StabsReader::ProcessFunction() {
// The STABS string for an N_FUN entry is the name of the function,
// followed by a colon, followed by type information for the
// function. We want to pass the name alone to StartFunction.
- const char *stab_string = SymbolString();
- const char *name_end = strchr(stab_string, ':');
+ const char* stab_string = SymbolString();
+ const char* name_end = strchr(stab_string, ':');
if (! name_end)
name_end = stab_string + strlen(stab_string);
string name(stab_string, name_end - stab_string);
@@ -270,7 +270,7 @@ bool StabsReader::ProcessFunction() {
if (!iterator_->at_end) {
assert(iterator_->type == N_SO || iterator_->type == N_FUN);
if (iterator_->type == N_FUN) {
- const char *symbol_name = SymbolString();
+ const char* symbol_name = SymbolString();
if (symbol_name[0] == '\0') {
// An N_FUN entry with no name is a terminator for this function;
// its value is the function's size.
diff --git a/src/common/stabs_reader.h b/src/common/stabs_reader.h
index 98ee2dd5..1e773f45 100644
--- a/src/common/stabs_reader.h
+++ b/src/common/stabs_reader.h
@@ -92,10 +92,10 @@ class StabsReader {
//
// Note that, in ELF, the .stabstr section should be found using the
// 'sh_link' field of the .stab section header, not by name.
- StabsReader(const uint8_t *stab, size_t stab_size,
- const uint8_t *stabstr, size_t stabstr_size,
+ StabsReader(const uint8_t* stab, size_t stab_size,
+ const uint8_t* stabstr, size_t stabstr_size,
bool big_endian, size_t value_size, bool unitized,
- StabsHandler *handler);
+ StabsHandler* handler);
// Process the STABS data, calling the handler's member functions to
// report what we find. While the handler functions return true,
@@ -149,17 +149,17 @@ class StabsReader {
// Mac, they are 32 or 64 bits long. Oddly, the section header's entry
// size for a Linux ELF .stab section varies according to the ELF class
// from 12 to 20 even as the actual entries remain unchanged.
- EntryIterator(const ByteBuffer *buffer, bool big_endian, size_t value_size);
+ EntryIterator(const ByteBuffer* buffer, bool big_endian, size_t value_size);
// Move to the next entry. This function's behavior is undefined if
// at_end() is true when it is called.
- EntryIterator &operator++() { Fetch(); entry_.index++; return *this; }
+ EntryIterator& operator++() { Fetch(); entry_.index++; return *this; }
// Dereferencing this iterator produces a reference to an Entry structure
// that holds the current entry's values. The entry is owned by this
// EntryIterator, and will be invalidated at the next call to operator++.
- const Entry &operator*() const { return entry_; }
- const Entry *operator->() const { return &entry_; }
+ const Entry& operator*() const { return entry_; }
+ const Entry* operator->() const { return &entry_; }
private:
// Read the STABS entry at cursor_, and set entry_ appropriately.
@@ -178,12 +178,12 @@ class StabsReader {
// A source line, saved to be reported later.
struct Line {
uint64_t address;
- const char *filename;
+ const char* filename;
int number;
};
// Return the name of the current symbol.
- const char *SymbolString();
+ const char* SymbolString();
// Process a compilation unit starting at symbol_. Return true
// to continue processing, or false to abort.
@@ -210,7 +210,7 @@ class StabsReader {
// StabsReader::StabsReader.
bool unitized_;
- StabsHandler *handler_;
+ StabsHandler* handler_;
// The offset of the current compilation unit's strings within stabstr_.
size_t string_offset_;
@@ -220,7 +220,7 @@ class StabsReader {
size_t next_cu_string_offset_;
// The current source file name.
- const char *current_source_file_;
+ const char* current_source_file_;
// Mac OS X STABS place SLINE records before functions; we accumulate a
// vector of these until we see the FUN record, and then report them
@@ -261,7 +261,7 @@ class StabsHandler {
// FILENAME values are different addresses, they represent different
// file names.
//
- // Thus, it's safe to use (say) std::map<char *, ...>, which does
+ // Thus, it's safe to use (say) std::map<char*, ...>, which does
// string address comparisons, not string content comparisons.
// Since all the strings are in same array of characters --- the
// .stabstr section --- comparing their addresses produces
@@ -271,8 +271,8 @@ class StabsHandler {
// named FILENAME, and whose base address is ADDRESS. If
// BUILD_DIRECTORY is non-NULL, it is the name of the build
// directory in which the compilation occurred.
- virtual bool StartCompilationUnit(const char *filename, uint64_t address,
- const char *build_directory) {
+ virtual bool StartCompilationUnit(const char* filename, uint64_t address,
+ const char* build_directory) {
return true;
}
@@ -292,7 +292,7 @@ class StabsHandler {
// StartFunction is the function name alone.
//
// In languages that use name mangling, like C++, NAME is mangled.
- virtual bool StartFunction(const string &name, uint64_t address) {
+ virtual bool StartFunction(const string& name, uint64_t address) {
return true;
}
@@ -305,19 +305,19 @@ class StabsHandler {
// Report that the code at ADDRESS is attributable to line NUMBER of
// the source file named FILENAME. The caller must infer the ending
// address of the line.
- virtual bool Line(uint64_t address, const char *filename, int number) {
+ virtual bool Line(uint64_t address, const char* filename, int number) {
return true;
}
// Report that an exported function NAME is present at ADDRESS.
// The size of the function is unknown.
- virtual bool Extern(const string &name, uint64_t address) {
+ virtual bool Extern(const string& name, uint64_t address) {
return true;
}
// Report a warning. FORMAT is a printf-like format string,
// specifying how to format the subsequent arguments.
- virtual void Warning(const char *format, ...) = 0;
+ virtual void Warning(const char* format, ...) = 0;
};
} // namespace google_breakpad
diff --git a/src/common/stabs_reader_unittest.cc b/src/common/stabs_reader_unittest.cc
index a84da1c4..24f3e1a5 100644
--- a/src/common/stabs_reader_unittest.cc
+++ b/src/common/stabs_reader_unittest.cc
@@ -75,7 +75,7 @@ class StringAssembler: public Section {
// Add the string S to this StringAssembler, and return the string's
// offset within this compilation unit's strings. If S has been added
// already, this returns the offset of its first instance.
- size_t Add(const string &s) {
+ size_t Add(const string& s) {
map<string, size_t>::iterator it = added_.find(s);
if (it != added_.end())
return it->second;
@@ -127,7 +127,7 @@ class StringAssembler: public Section {
class StabsAssembler: public Section {
public:
// Create a StabsAssembler that uses StringAssembler for its strings.
- StabsAssembler(StringAssembler *string_assembler)
+ StabsAssembler(StringAssembler* string_assembler)
: Section(string_assembler->endianness()),
string_assembler_(string_assembler),
value_size_(0),
@@ -137,7 +137,7 @@ class StabsAssembler: public Section {
// Accessor and setter for value_size_.
size_t value_size() const { return value_size_; }
- StabsAssembler &set_value_size(size_t value_size) {
+ StabsAssembler& set_value_size(size_t value_size) {
value_size_ = value_size;
return *this;
}
@@ -147,7 +147,7 @@ class StabsAssembler: public Section {
// its compilation unit's portion of the .stabstr section; this can be a
// value generated by a StringAssembler. Return a reference to this
// StabsAssembler.
- StabsAssembler &Stab(uint8_t type, uint8_t other, Label descriptor,
+ StabsAssembler& Stab(uint8_t type, uint8_t other, Label descriptor,
Label value, Label name) {
D32(name);
D8(type);
@@ -159,15 +159,15 @@ class StabsAssembler: public Section {
}
// As above, but automatically add NAME to our StringAssembler.
- StabsAssembler &Stab(uint8_t type, uint8_t other, Label descriptor,
- Label value, const string &name) {
+ StabsAssembler& Stab(uint8_t type, uint8_t other, Label descriptor,
+ Label value, const string& name) {
return Stab(type, other, descriptor, value, string_assembler_->Add(name));
}
// Start a compilation unit named NAME, with an N_UNDF symbol to start
// it, and its own portion of the string section. Return a reference to
// this StabsAssembler.
- StabsAssembler &StartCU(const string &name) {
+ StabsAssembler& StartCU(const string& name) {
assert(!cu_header_);
cu_header_ = new CUHeader;
string_assembler_->StartCU();
@@ -180,7 +180,7 @@ class StabsAssembler: public Section {
// Close off the current compilation unit. Return a reference to this
// StabsAssembler.
- StabsAssembler &EndCU() {
+ StabsAssembler& EndCU() {
assert(cu_header_);
cu_header_->final_entry_count = entry_count_;
cu_header_->final_string_size = string_assembler_->EndCU();
@@ -201,7 +201,7 @@ class StabsAssembler: public Section {
};
// The strings for our STABS entries.
- StringAssembler *string_assembler_;
+ StringAssembler* string_assembler_;
// The size of the 'value' field of stabs entries in this section.
size_t value_size_;
@@ -211,20 +211,20 @@ class StabsAssembler: public Section {
// Header labels for this compilation unit, if we've started one but not
// finished it.
- CUHeader *cu_header_;
+ CUHeader* cu_header_;
};
class MockStabsReaderHandler: public StabsHandler {
public:
MOCK_METHOD3(StartCompilationUnit,
- bool(const char *, uint64_t, const char *));
+ bool(const char*, uint64_t, const char*));
MOCK_METHOD1(EndCompilationUnit, bool(uint64_t));
- MOCK_METHOD2(StartFunction, bool(const string &, uint64_t));
+ MOCK_METHOD2(StartFunction, bool(const string&, uint64_t));
MOCK_METHOD1(EndFunction, bool(uint64_t));
- MOCK_METHOD3(Line, bool(uint64_t, const char *, int));
- MOCK_METHOD2(Extern, bool(const string &, uint64_t));
- void Warning(const char *format, ...) { MockWarning(format); }
- MOCK_METHOD1(MockWarning, void(const char *));
+ MOCK_METHOD3(Line, bool(uint64_t, const char*, int));
+ MOCK_METHOD2(Extern, bool(const string&, uint64_t));
+ void Warning(const char* format, ...) { MockWarning(format); }
+ MOCK_METHOD1(MockWarning, void(const char*));
};
struct StabsFixture {
@@ -243,9 +243,9 @@ struct StabsFixture {
// Run the parser on the test input, passing whatever we find to HANDLER.
StabsReader reader(
- reinterpret_cast<const uint8_t *>(stabs_contents.data()),
+ reinterpret_cast<const uint8_t*>(stabs_contents.data()),
stabs_contents.size(),
- reinterpret_cast<const uint8_t *>(stabstr_contents.data()),
+ reinterpret_cast<const uint8_t*>(stabstr_contents.data()),
stabstr_contents.size(),
stabs.endianness() == kBigEndian, stabs.value_size(), unitized,
&mock_handler);
diff --git a/src/common/stabs_to_module.cc b/src/common/stabs_to_module.cc
index 049a6cc6..05b25a74 100644
--- a/src/common/stabs_to_module.cc
+++ b/src/common/stabs_to_module.cc
@@ -45,7 +45,7 @@ namespace google_breakpad {
// Demangle using abi call.
// Older GCC may not support it.
-static string Demangle(const string &mangled) {
+static string Demangle(const string& mangled) {
int status = 0;
char *demangled = abi::__cxa_demangle(mangled.c_str(), NULL, NULL, &status);
if (status == 0 && demangled != NULL) {
@@ -58,7 +58,7 @@ static string Demangle(const string &mangled) {
StabsToModule::~StabsToModule() {
// Free any functions we've accumulated but not added to the module.
- for (vector<Module::Function *>::const_iterator func_it = functions_.begin();
+ for (vector<Module::Function*>::const_iterator func_it = functions_.begin();
func_it != functions_.end(); func_it++)
delete *func_it;
// Free any function that we're currently within.
@@ -87,7 +87,7 @@ bool StabsToModule::EndCompilationUnit(uint64_t address) {
return true;
}
-bool StabsToModule::StartFunction(const string &name,
+bool StabsToModule::StartFunction(const string& name,
uint64_t address) {
assert(!current_function_);
Module::Function *f = new Module::Function(Demangle(name), address);
@@ -131,7 +131,7 @@ bool StabsToModule::Line(uint64_t address, const char *name, int number) {
return true;
}
-bool StabsToModule::Extern(const string &name, uint64_t address) {
+bool StabsToModule::Extern(const string& name, uint64_t address) {
Module::Extern *ext = new Module::Extern(address);
// Older libstdc++ demangle implementations can crash on unexpected
// input, so be careful about what gets passed in.
@@ -160,7 +160,7 @@ void StabsToModule::Finalize() {
sort(functions_.begin(), functions_.end(),
Module::Function::CompareByAddress);
- for (vector<Module::Function *>::const_iterator func_it = functions_.begin();
+ for (vector<Module::Function*>::const_iterator func_it = functions_.begin();
func_it != functions_.end();
func_it++) {
Module::Function *f = *func_it;
diff --git a/src/common/stabs_to_module.h b/src/common/stabs_to_module.h
index 5e04fa79..6f6e0ed7 100644
--- a/src/common/stabs_to_module.h
+++ b/src/common/stabs_to_module.h
@@ -76,10 +76,10 @@ class StabsToModule: public google_breakpad::StabsHandler {
bool StartCompilationUnit(const char *name, uint64_t address,
const char *build_directory);
bool EndCompilationUnit(uint64_t address);
- bool StartFunction(const string &name, uint64_t address);
+ bool StartFunction(const string& name, uint64_t address);
bool EndFunction(uint64_t address);
bool Line(uint64_t address, const char *name, int number);
- bool Extern(const string &name, uint64_t address);
+ bool Extern(const string& name, uint64_t address);
void Warning(const char *format, ...);
// Do any final processing necessary to make module_ contain all the
@@ -107,7 +107,7 @@ class StabsToModule: public google_breakpad::StabsHandler {
// We could just stick them in module_ from the outset, but if
// module_ already contains data gathered from other debugging
// formats, that would complicate the size computation.
- vector<Module::Function *> functions_;
+ vector<Module::Function*> functions_;
// Boundary addresses. STABS doesn't necessarily supply sizes for
// functions and lines, so we need to compute them ourselves by
diff --git a/src/common/stabs_to_module_unittest.cc b/src/common/stabs_to_module_unittest.cc
index aae00476..9c134e73 100644
--- a/src/common/stabs_to_module_unittest.cc
+++ b/src/common/stabs_to_module_unittest.cc
@@ -58,7 +58,7 @@ TEST(StabsToModule, SimpleCU) {
Module::File *file = m.FindExistingFile("source-file-name");
ASSERT_TRUE(file != NULL);
- vector<Module::Function *> functions;
+ vector<Module::Function*> functions;
m.GetFunctions(&functions, functions.end());
ASSERT_EQ((size_t) 1, functions.size());
Module::Function *function = functions[0];
@@ -88,7 +88,7 @@ TEST(StabsToModule, Externs) {
h.Finalize();
// Now check to see what has been added to the Module.
- vector<Module::Extern *> externs;
+ vector<Module::Extern*> externs;
m.GetExterns(&externs, externs.end());
ASSERT_EQ((size_t) 3, externs.size());
Module::Extern *extern1 = externs[0];
@@ -124,7 +124,7 @@ TEST(StabsToModule, DuplicateFunctionNames) {
Module::File *file = m.FindExistingFile("compilation-unit");
ASSERT_TRUE(file != NULL);
- vector<Module::Function *> functions;
+ vector<Module::Function*> functions;
m.GetFunctions(&functions, functions.end());
ASSERT_EQ(1U, functions.size());
@@ -159,7 +159,7 @@ TEST(InferSizes, LineSize) {
Module::File *file2 = m.FindExistingFile("source-file-name-2");
ASSERT_TRUE(file2 != NULL);
- vector<Module::Function *> functions;
+ vector<Module::Function*> functions;
m.GetFunctions(&functions, functions.end());
ASSERT_EQ((size_t) 1, functions.size());
@@ -204,7 +204,7 @@ TEST(FunctionNames, Mangled) {
Module::File *file = m.FindExistingFile("compilation-unit");
ASSERT_TRUE(file != NULL);
- vector<Module::Function *> functions;
+ vector<Module::Function*> functions;
m.GetFunctions(&functions, functions.end());
ASSERT_EQ(1U, functions.size());
diff --git a/src/common/string_conversion.cc b/src/common/string_conversion.cc
index 11d60a36..6a78ed7e 100644
--- a/src/common/string_conversion.cc
+++ b/src/common/string_conversion.cc
@@ -38,15 +38,15 @@ namespace google_breakpad {
using std::vector;
-void UTF8ToUTF16(const char *in, vector<uint16_t> *out) {
+void UTF8ToUTF16(const char* in, vector<uint16_t>* out) {
size_t source_length = strlen(in);
- const UTF8 *source_ptr = reinterpret_cast<const UTF8 *>(in);
- const UTF8 *source_end_ptr = source_ptr + source_length;
+ const UTF8* source_ptr = reinterpret_cast<const UTF8*>(in);
+ const UTF8* source_end_ptr = source_ptr + source_length;
// Erase the contents and zero fill to the expected size
out->clear();
out->insert(out->begin(), source_length, 0);
- uint16_t *target_ptr = &(*out)[0];
- uint16_t *target_end_ptr = target_ptr + out->capacity();
+ uint16_t* target_ptr = &(*out)[0];
+ uint16_t* target_end_ptr = target_ptr + out->capacity();
ConversionResult result = ConvertUTF8toUTF16(&source_ptr, source_end_ptr,
&target_ptr, target_end_ptr,
strictConversion);
@@ -55,11 +55,11 @@ void UTF8ToUTF16(const char *in, vector<uint16_t> *out) {
out->resize(result == conversionOK ? target_ptr - &(*out)[0] + 1: 0);
}
-int UTF8ToUTF16Char(const char *in, int in_length, uint16_t out[2]) {
- const UTF8 *source_ptr = reinterpret_cast<const UTF8 *>(in);
- const UTF8 *source_end_ptr = source_ptr + 1;
- uint16_t *target_ptr = out;
- uint16_t *target_end_ptr = target_ptr + 2;
+int UTF8ToUTF16Char(const char* in, int in_length, uint16_t out[2]) {
+ const UTF8* source_ptr = reinterpret_cast<const UTF8*>(in);
+ const UTF8* source_end_ptr = source_ptr + 1;
+ uint16_t* target_ptr = out;
+ uint16_t* target_end_ptr = target_ptr + 2;
out[0] = out[1] = 0;
// Process one character at a time
@@ -69,28 +69,28 @@ int UTF8ToUTF16Char(const char *in, int in_length, uint16_t out[2]) {
strictConversion);
if (result == conversionOK)
- return static_cast<int>(source_ptr - reinterpret_cast<const UTF8 *>(in));
+ return static_cast<int>(source_ptr - reinterpret_cast<const UTF8*>(in));
// Add another character to the input stream and try again
- source_ptr = reinterpret_cast<const UTF8 *>(in);
+ source_ptr = reinterpret_cast<const UTF8*>(in);
++source_end_ptr;
- if (source_end_ptr > reinterpret_cast<const UTF8 *>(in) + in_length)
+ if (source_end_ptr > reinterpret_cast<const UTF8*>(in) + in_length)
break;
}
return 0;
}
-void UTF32ToUTF16(const wchar_t *in, vector<uint16_t> *out) {
+void UTF32ToUTF16(const wchar_t* in, vector<uint16_t>* out) {
size_t source_length = wcslen(in);
- const UTF32 *source_ptr = reinterpret_cast<const UTF32 *>(in);
- const UTF32 *source_end_ptr = source_ptr + source_length;
+ const UTF32* source_ptr = reinterpret_cast<const UTF32*>(in);
+ const UTF32* source_end_ptr = source_ptr + source_length;
// Erase the contents and zero fill to the expected size
out->clear();
out->insert(out->begin(), source_length, 0);
- uint16_t *target_ptr = &(*out)[0];
- uint16_t *target_end_ptr = target_ptr + out->capacity();
+ uint16_t* target_ptr = &(*out)[0];
+ uint16_t* target_end_ptr = target_ptr + out->capacity();
ConversionResult result = ConvertUTF32toUTF16(&source_ptr, source_end_ptr,
&target_ptr, target_end_ptr,
strictConversion);
@@ -100,10 +100,10 @@ void UTF32ToUTF16(const wchar_t *in, vector<uint16_t> *out) {
}
void UTF32ToUTF16Char(wchar_t in, uint16_t out[2]) {
- const UTF32 *source_ptr = reinterpret_cast<const UTF32 *>(&in);
- const UTF32 *source_end_ptr = source_ptr + 1;
- uint16_t *target_ptr = out;
- uint16_t *target_end_ptr = target_ptr + 2;
+ const UTF32* source_ptr = reinterpret_cast<const UTF32*>(&in);
+ const UTF32* source_end_ptr = source_ptr + 1;
+ uint16_t* target_ptr = out;
+ uint16_t* target_end_ptr = target_ptr + 2;
out[0] = out[1] = 0;
ConversionResult result = ConvertUTF32toUTF16(&source_ptr, source_end_ptr,
&target_ptr, target_end_ptr,
@@ -118,15 +118,15 @@ static inline uint16_t Swap(uint16_t value) {
return (value >> 8) | static_cast<uint16_t>(value << 8);
}
-string UTF16ToUTF8(const vector<uint16_t> &in, bool swap) {
- const UTF16 *source_ptr = &in[0];
+string UTF16ToUTF8(const vector<uint16_t>& in, bool swap) {
+ const UTF16* source_ptr = &in[0];
scoped_array<uint16_t> source_buffer;
// If we're to swap, we need to make a local copy and swap each byte pair
if (swap) {
int idx = 0;
source_buffer.reset(new uint16_t[in.size()]);
- UTF16 *source_buffer_ptr = source_buffer.get();
+ UTF16* source_buffer_ptr = source_buffer.get();
for (vector<uint16_t>::const_iterator it = in.begin();
it != in.end(); ++it, ++idx)
source_buffer_ptr[idx] = Swap(*it);
@@ -135,17 +135,17 @@ string UTF16ToUTF8(const vector<uint16_t> &in, bool swap) {
}
// The maximum expansion would be 4x the size of the input string.
- const UTF16 *source_end_ptr = source_ptr + in.size();
+ const UTF16* source_end_ptr = source_ptr + in.size();
size_t target_capacity = in.size() * 4;
scoped_array<UTF8> target_buffer(new UTF8[target_capacity]);
- UTF8 *target_ptr = target_buffer.get();
- UTF8 *target_end_ptr = target_ptr + target_capacity;
+ UTF8* target_ptr = target_buffer.get();
+ UTF8* target_end_ptr = target_ptr + target_capacity;
ConversionResult result = ConvertUTF16toUTF8(&source_ptr, source_end_ptr,
&target_ptr, target_end_ptr,
strictConversion);
if (result == conversionOK) {
- const char *targetPtr = reinterpret_cast<const char *>(target_buffer.get());
+ const char* targetPtr = reinterpret_cast<const char*>(target_buffer.get());
return targetPtr;
}
diff --git a/src/common/string_conversion.h b/src/common/string_conversion.h
index b9ba96a2..02d1486a 100644
--- a/src/common/string_conversion.h
+++ b/src/common/string_conversion.h
@@ -44,24 +44,24 @@ using std::vector;
// Convert |in| to UTF-16 into |out|. Use platform byte ordering. If the
// conversion failed, |out| will be zero length.
-void UTF8ToUTF16(const char *in, vector<uint16_t> *out);
+void UTF8ToUTF16(const char* in, vector<uint16_t>* out);
// Convert at least one character (up to a maximum of |in_length|) from |in|
// to UTF-16 into |out|. Return the number of characters consumed from |in|.
// Any unused characters in |out| will be initialized to 0. No memory will
// be allocated by this routine.
-int UTF8ToUTF16Char(const char *in, int in_length, uint16_t out[2]);
+int UTF8ToUTF16Char(const char* in, int in_length, uint16_t out[2]);
// Convert |in| to UTF-16 into |out|. Use platform byte ordering. If the
// conversion failed, |out| will be zero length.
-void UTF32ToUTF16(const wchar_t *in, vector<uint16_t> *out);
+void UTF32ToUTF16(const wchar_t* in, vector<uint16_t>* out);
// Convert |in| to UTF-16 into |out|. Any unused characters in |out| will be
// initialized to 0. No memory will be allocated by this routine.
void UTF32ToUTF16Char(wchar_t in, uint16_t out[2]);
// Convert |in| to UTF-8. If |swap| is true, swap bytes before converting.
-string UTF16ToUTF8(const vector<uint16_t> &in, bool swap);
+string UTF16ToUTF8(const vector<uint16_t>& in, bool swap);
} // namespace google_breakpad
diff --git a/src/common/test_assembler.cc b/src/common/test_assembler.cc
index 1e783b45..8a48bfb0 100644
--- a/src/common/test_assembler.cc
+++ b/src/common/test_assembler.cc
@@ -46,7 +46,7 @@ using std::back_insert_iterator;
Label::Label() : value_(new Binding()) { }
Label::Label(uint64_t value) : value_(new Binding(value)) { }
-Label::Label(const Label &label) {
+Label::Label(const Label& label) {
value_ = label.value_;
value_->Acquire();
}
@@ -54,12 +54,12 @@ Label::~Label() {
if (value_->Release()) delete value_;
}
-Label &Label::operator=(uint64_t value) {
+Label& Label::operator=(uint64_t value) {
value_->Set(NULL, value);
return *this;
}
-Label &Label::operator=(const Label &label) {
+Label& Label::operator=(const Label& label) {
value_->Set(label.value_, 0);
return *this;
}
@@ -89,7 +89,7 @@ Label Label::operator-(uint64_t subtrahend) const {
#define ALWAYS_EVALUATE_AND_ASSERT(x) assert(x)
#endif
-uint64_t Label::operator-(const Label &label) const {
+uint64_t Label::operator-(const Label& label) const {
uint64_t offset;
ALWAYS_EVALUATE_AND_ASSERT(IsKnownOffsetFrom(label, &offset));
return offset;
@@ -101,8 +101,8 @@ uint64_t Label::Value() const {
return v;
};
-bool Label::IsKnownConstant(uint64_t *value_p) const {
- Binding *base;
+bool Label::IsKnownConstant(uint64_t* value_p) const {
+ Binding* base;
uint64_t addend;
value_->Get(&base, &addend);
if (base != NULL) return false;
@@ -110,9 +110,9 @@ bool Label::IsKnownConstant(uint64_t *value_p) const {
return true;
}
-bool Label::IsKnownOffsetFrom(const Label &label, uint64_t *offset_p) const
+bool Label::IsKnownOffsetFrom(const Label& label, uint64_t* offset_p) const
{
- Binding *label_base, *this_base;
+ Binding* label_base, *this_base;
uint64_t label_addend, this_addend;
label.value_->Get(&label_base, &label_addend);
value_->Get(&this_base, &this_addend);
@@ -135,7 +135,7 @@ Label::Binding::~Binding() {
delete base_;
}
-void Label::Binding::Set(Binding *binding, uint64_t addend) {
+void Label::Binding::Set(Binding* binding, uint64_t addend) {
if (!base_ && !binding) {
// We're equating two constants. This could be okay.
assert(addend_ == addend);
@@ -183,13 +183,13 @@ void Label::Binding::Set(Binding *binding, uint64_t addend) {
}
}
-void Label::Binding::Get(Binding **base, uint64_t *addend) {
+void Label::Binding::Get(Binding** base, uint64_t* addend) {
if (base_ && base_ != this) {
// Recurse to find the end of our reference chain (the root of our
// tree), and then rewrite every binding along the chain to refer
// to it directly, adjusting addends appropriately. (This is why
// this member function isn't this-const.)
- Binding *final_base;
+ Binding* final_base;
uint64_t final_addend;
base_->Get(&final_base, &final_addend);
if (final_base) final_base->Acquire();
@@ -218,14 +218,14 @@ static inline void InsertEndian(test_assembler::Endianness endianness,
}
}
-Section &Section::Append(Endianness endianness, size_t size, uint64_t number) {
+Section& Section::Append(Endianness endianness, size_t size, uint64_t number) {
InsertEndian(endianness, size, number,
back_insert_iterator<string>(contents_));
return *this;
}
-Section &Section::Append(Endianness endianness, size_t size,
- const Label &label) {
+Section& Section::Append(Endianness endianness, size_t size,
+ const Label& label) {
// If this label's value is known, there's no reason to waste an
// entry in references_ on it.
uint64_t value;
@@ -246,14 +246,14 @@ Section &Section::Append(Endianness endianness, size_t size,
#define ENDIANNESS(e) ENDIANNESS_ ## e
#define DEFINE_SHORT_APPEND_NUMBER_ENDIAN(e, bits) \
- Section &Section::e ## bits(uint ## bits ## _t v) { \
+ Section& Section::e ## bits(uint ## bits ## _t v) { \
InsertEndian(ENDIANNESS(e), bits / 8, v, \
back_insert_iterator<string>(contents_)); \
return *this; \
}
#define DEFINE_SHORT_APPEND_LABEL_ENDIAN(e, bits) \
- Section &Section::e ## bits(const Label &v) { \
+ Section& Section::e ## bits(const Label& v) { \
return Append(ENDIANNESS(e), bits / 8, v); \
}
@@ -272,13 +272,13 @@ DEFINE_SHORT_APPEND_ENDIAN(B, 32);
DEFINE_SHORT_APPEND_ENDIAN(B, 64);
#define DEFINE_SHORT_APPEND_NUMBER_DEFAULT(bits) \
- Section &Section::D ## bits(uint ## bits ## _t v) { \
+ Section& Section::D ## bits(uint ## bits ## _t v) { \
InsertEndian(endianness_, bits / 8, v, \
back_insert_iterator<string>(contents_)); \
return *this; \
}
#define DEFINE_SHORT_APPEND_LABEL_DEFAULT(bits) \
- Section &Section::D ## bits(const Label &v) { \
+ Section& Section::D ## bits(const Label& v) { \
return Append(endianness_, bits / 8, v); \
}
#define DEFINE_SHORT_APPEND_DEFAULT(bits) \
@@ -290,7 +290,7 @@ DEFINE_SHORT_APPEND_DEFAULT(16);
DEFINE_SHORT_APPEND_DEFAULT(32);
DEFINE_SHORT_APPEND_DEFAULT(64);
-Section &Section::Append(const Section &section) {
+Section& Section::Append(const Section& section) {
size_t base = contents_.size();
contents_.append(section.contents_);
for (vector<Reference>::const_iterator it = section.references_.begin();
@@ -300,7 +300,7 @@ Section &Section::Append(const Section &section) {
return *this;
}
-Section &Section::LEB128(long long value) {
+Section& Section::LEB128(long long value) {
while (value < -0x40 || 0x3f < value) {
contents_ += (value & 0x7f) | 0x80;
if (value < 0)
@@ -312,7 +312,7 @@ Section &Section::LEB128(long long value) {
return *this;
}
-Section &Section::ULEB128(uint64_t value) {
+Section& Section::ULEB128(uint64_t value) {
while (value > 0x7f) {
contents_ += (value & 0x7f) | 0x80;
value = (value >> 7);
@@ -321,7 +321,7 @@ Section &Section::ULEB128(uint64_t value) {
return *this;
}
-Section &Section::Align(size_t alignment, uint8_t pad_byte) {
+Section& Section::Align(size_t alignment, uint8_t pad_byte) {
// ALIGNMENT must be a power of two.
assert(((alignment - 1) & alignment) == 0);
size_t new_size = (contents_.size() + alignment - 1) & ~(alignment - 1);
@@ -335,11 +335,11 @@ void Section::Clear() {
references_.clear();
}
-bool Section::GetContents(string *contents) {
+bool Section::GetContents(string* contents) {
// For each label reference, find the label's value, and patch it into
// the section's contents.
for (size_t i = 0; i < references_.size(); i++) {
- Reference &r = references_[i];
+ Reference& r = references_[i];
uint64_t value;
if (!r.label.IsKnownConstant(&value)) {
fprintf(stderr, "Undefined label #%zu at offset 0x%zx\n", i, r.offset);
diff --git a/src/common/test_assembler.h b/src/common/test_assembler.h
index 373dbeba..125ef450 100644
--- a/src/common/test_assembler.h
+++ b/src/common/test_assembler.h
@@ -111,7 +111,7 @@ class Label {
public:
Label(); // An undefined label.
Label(uint64_t value); // A label with a fixed value
- Label(const Label &value); // A label equal to another.
+ Label(const Label& value); // A label equal to another.
~Label();
// Return this label's value; it must be known.
@@ -124,18 +124,18 @@ class Label {
// former could fail if the label is not yet defined and the latter won't.
uint64_t Value() const;
- Label &operator=(uint64_t value);
- Label &operator=(const Label &value);
+ Label& operator=(uint64_t value);
+ Label& operator=(const Label& value);
Label operator+(uint64_t addend) const;
Label operator-(uint64_t subtrahend) const;
- uint64_t operator-(const Label &subtrahend) const;
+ uint64_t operator-(const Label& subtrahend) const;
// We could also provide == and != that work on undefined, but
// related, labels.
// Return true if this label's value is known. If VALUE_P is given,
// set *VALUE_P to the known value if returning true.
- bool IsKnownConstant(uint64_t *value_p = NULL) const;
+ bool IsKnownConstant(uint64_t* value_p = NULL) const;
// Return true if the offset from LABEL to this label is known. If
// OFFSET_P is given, set *OFFSET_P to the offset when returning true.
@@ -155,7 +155,7 @@ class Label {
// l-m // -10
// m-l // 10
// m.Value() // error: m's value is not known
- bool IsKnownOffsetFrom(const Label &label, uint64_t *offset_p = NULL) const;
+ bool IsKnownOffsetFrom(const Label& label, uint64_t* offset_p = NULL) const;
private:
// A label's value, or if that is not yet known, how the value is
@@ -186,7 +186,7 @@ class Label {
// Update every binding on this binding's chain to point directly
// to BINDING, or to be a constant, with addends adjusted
// appropriately.
- void Set(Binding *binding, uint64_t value);
+ void Set(Binding* binding, uint64_t value);
// Return what we know about the value of this binding.
// - If this binding's value is a known constant, set BASE to
@@ -198,7 +198,7 @@ class Label {
// value.
// - If this binding is unconstrained, set BASE to this, and leave
// ADDEND unchanged.
- void Get(Binding **base, uint64_t *addend);
+ void Get(Binding** base, uint64_t* addend);
private:
// There are three cases:
@@ -220,7 +220,7 @@ class Label {
// operations on bindings do path compression: they change every
// binding on the chain to point directly to the final value,
// adjusting addends as appropriate.
- Binding *base_;
+ Binding* base_;
uint64_t addend_;
// The number of Labels and Bindings pointing to this binding.
@@ -230,10 +230,10 @@ class Label {
};
// This label's value.
- Binding *value_;
+ Binding* value_;
};
-inline Label operator+(uint64_t a, const Label &l) { return l + a; }
+inline Label operator+(uint64_t a, const Label& l) { return l + a; }
// Note that int-Label isn't defined, as negating a Label is not an
// operation we support.
@@ -288,18 +288,18 @@ class Section {
// Append the SIZE bytes at DATA or the contents of STRING to the
// end of this section. Return a reference to this section.
- Section &Append(const uint8_t *data, size_t size) {
- contents_.append(reinterpret_cast<const char *>(data), size);
+ Section& Append(const uint8_t* data, size_t size) {
+ contents_.append(reinterpret_cast<const char*>(data), size);
return *this;
};
- Section &Append(const string &data) {
+ Section& Append(const string& data) {
contents_.append(data);
return *this;
};
// Append SIZE copies of BYTE to the end of this section. Return a
// reference to this section.
- Section &Append(size_t size, uint8_t byte) {
+ Section& Append(size_t size, uint8_t byte) {
contents_.append(size, (char) byte);
return *this;
}
@@ -307,8 +307,8 @@ class Section {
// Append NUMBER to this section. ENDIANNESS is the endianness to
// use to write the number. SIZE is the length of the number in
// bytes. Return a reference to this section.
- Section &Append(Endianness endianness, size_t size, uint64_t number);
- Section &Append(Endianness endianness, size_t size, const Label &label);
+ Section& Append(Endianness endianness, size_t size, uint64_t number);
+ Section& Append(Endianness endianness, size_t size, const Label& label);
// Append SECTION to the end of this section. The labels SECTION
// refers to need not be defined yet.
@@ -317,11 +317,11 @@ class Section {
// SECTION. If placing SECTION within 'this' provides new
// constraints on existing labels' values, then it's up to the
// caller to fiddle with those labels as needed.
- Section &Append(const Section &section);
+ Section& Append(const Section& section);
// Append the contents of DATA as a series of bytes terminated by
// a NULL character.
- Section &AppendCString(const string &data) {
+ Section& AppendCString(const string& data) {
Append(data);
contents_ += '\0';
return *this;
@@ -329,7 +329,7 @@ class Section {
// Append at most SIZE bytes from DATA; if DATA is less than SIZE bytes
// long, pad with '\0' characters.
- Section &AppendCString(const string &data, size_t size) {
+ Section& AppendCString(const string& data, size_t size) {
contents_.append(data, 0, size);
if (data.size() < size)
Append(size - data.size(), 0);
@@ -352,18 +352,18 @@ class Section {
// the compiler will properly sign-extend a signed value before
// passing it to the function, at which point the function's
// behavior is the same either way.
- Section &L8(uint8_t value) { contents_ += value; return *this; }
- Section &B8(uint8_t value) { contents_ += value; return *this; }
- Section &D8(uint8_t value) { contents_ += value; return *this; }
+ Section& L8(uint8_t value) { contents_ += value; return *this; }
+ Section& B8(uint8_t value) { contents_ += value; return *this; }
+ Section& D8(uint8_t value) { contents_ += value; return *this; }
Section &L16(uint16_t), &L32(uint32_t), &L64(uint64_t),
&B16(uint16_t), &B32(uint32_t), &B64(uint64_t),
&D16(uint16_t), &D32(uint32_t), &D64(uint64_t);
- Section &L8(const Label &label), &L16(const Label &label),
- &L32(const Label &label), &L64(const Label &label),
- &B8(const Label &label), &B16(const Label &label),
- &B32(const Label &label), &B64(const Label &label),
- &D8(const Label &label), &D16(const Label &label),
- &D32(const Label &label), &D64(const Label &label);
+ Section &L8(const Label& label), &L16(const Label& label),
+ &L32(const Label& label), &L64(const Label& label),
+ &B8(const Label& label), &B16(const Label& label),
+ &B32(const Label& label), &B64(const Label& label),
+ &D8(const Label& label), &D16(const Label& label),
+ &D32(const Label& label), &D64(const Label& label);
// Append VALUE in a signed LEB128 (Little-Endian Base 128) form.
//
@@ -383,7 +383,7 @@ class Section {
//
// Note that VALUE cannot be a Label (we would have to implement
// relaxation).
- Section &LEB128(long long value);
+ Section& LEB128(long long value);
// Append VALUE in unsigned LEB128 (Little-Endian Base 128) form.
//
@@ -399,13 +399,13 @@ class Section {
//
// Note that VALUE cannot be a Label (we would have to implement
// relaxation).
- Section &ULEB128(uint64_t value);
+ Section& ULEB128(uint64_t value);
// Jump to the next location aligned on an ALIGNMENT-byte boundary,
// relative to the start of the section. Fill the gap with PAD_BYTE.
// ALIGNMENT must be a power of two. Return a reference to this
// section.
- Section &Align(size_t alignment, uint8_t pad_byte = 0);
+ Section& Align(size_t alignment, uint8_t pad_byte = 0);
// Clear the contents of this section.
void Clear();
@@ -436,19 +436,19 @@ class Section {
Label Here() const { return start_ + Size(); }
// Set *LABEL to Here, and return a reference to this section.
- Section &Mark(Label *label) { *label = Here(); return *this; }
+ Section& Mark(Label* label) { *label = Here(); return *this; }
// If there are no undefined label references left in this
// section, set CONTENTS to the contents of this section, as a
// string, and clear this section. Return true on success, or false
// if there were still undefined labels.
- bool GetContents(string *contents);
+ bool GetContents(string* contents);
private:
// Used internally. A reference to a label's value.
struct Reference {
Reference(size_t set_offset, Endianness set_endianness, size_t set_size,
- const Label &set_label)
+ const Label& set_label)
: offset(set_offset), endianness(set_endianness), size(set_size),
label(set_label) { }
diff --git a/src/common/test_assembler_unittest.cc b/src/common/test_assembler_unittest.cc
index 94b5a5ce..bda25ebf 100644
--- a/src/common/test_assembler_unittest.cc
+++ b/src/common/test_assembler_unittest.cc
@@ -755,7 +755,7 @@ const uint8_t SectionFixture::data[] = {
{ \
static const uint8_t expected_bytes[] = b; \
ASSERT_EQ(sizeof(expected_bytes), s.size()); \
- ASSERT_TRUE(memcmp(s.data(), (const char *) expected_bytes, \
+ ASSERT_TRUE(memcmp(s.data(), (const char*) expected_bytes, \
sizeof(expected_bytes)) == 0); \
} \
while(0)
@@ -766,7 +766,7 @@ TEST_F(Append, Bytes) {
section.Append(data, sizeof(data));
ASSERT_TRUE(section.GetContents(&contents));
ASSERT_EQ(sizeof(data), contents.size());
- EXPECT_TRUE(0 == memcmp(contents.data(), (const char *) data, sizeof(data)));
+ EXPECT_TRUE(0 == memcmp(contents.data(), (const char*) data, sizeof(data)));
}
TEST_F(Append, BytesTwice) {
@@ -774,9 +774,9 @@ TEST_F(Append, BytesTwice) {
section.Append(data, sizeof(data));
ASSERT_TRUE(section.GetContents(&contents));
ASSERT_EQ(2 * sizeof(data), contents.size());
- ASSERT_TRUE(0 == memcmp(contents.data(), (const char *) data, sizeof(data)));
+ ASSERT_TRUE(0 == memcmp(contents.data(), (const char*) data, sizeof(data)));
ASSERT_TRUE(0 == memcmp(contents.data() + sizeof(data),
- (const char *) data, sizeof(data)));
+ (const char*) data, sizeof(data)));
}
TEST_F(Append, String) {
diff --git a/src/common/windows/http_upload.cc b/src/common/windows/http_upload.cc
index b0cc9078..efee0d58 100644
--- a/src/common/windows/http_upload.cc
+++ b/src/common/windows/http_upload.cc
@@ -65,7 +65,7 @@ namespace {
HINTERNET handle_;
};
- wstring UTF8ToWide(const string &utf8) {
+ wstring UTF8ToWide(const string& utf8) {
if (utf8.length() == 0) {
return wstring();
}
@@ -85,7 +85,7 @@ namespace {
return result;
}
- string WideToMBCP(const wstring &wide, unsigned int cp) {
+ string WideToMBCP(const wstring& wide, unsigned int cp) {
if (wide.length() == 0) {
return string();
}
@@ -107,7 +107,7 @@ namespace {
return result;
}
- bool GetFileContents(const wstring &filename, vector<char> *contents) {
+ bool GetFileContents(const wstring& filename, vector<char>* contents) {
bool rv = false;
// The "open" method on pre-MSVC8 ifstream implementations doesn't accept a
// wchar_t* filename, so use _wfopen directly in that case. For VC8 and
@@ -141,10 +141,10 @@ namespace {
return rv;
}
- bool CheckParameters(const map<wstring, wstring> &parameters) {
+ bool CheckParameters(const map<wstring, wstring>& parameters) {
for (map<wstring, wstring>::const_iterator pos = parameters.begin();
pos != parameters.end(); ++pos) {
- const wstring &str = pos->first;
+ const wstring& str = pos->first;
if (str.size() == 0) {
return false; // disallow empty parameter names
}
@@ -159,7 +159,7 @@ namespace {
}
// Converts a UTF16 string to UTF8.
- string WideToUTF8(const wstring &wide) {
+ string WideToUTF8(const wstring& wide) {
return WideToMBCP(wide, CP_UTF8);
}
@@ -305,7 +305,7 @@ namespace {
}
if (!HttpSendRequest(request.get(), NULL, 0,
- const_cast<char *>(request_body.data()),
+ const_cast<char*>(request_body.data()),
static_cast<DWORD>(request_body.size()))) {
return false;
}
@@ -351,7 +351,7 @@ namespace {
return wstring(temp);
}
- wstring GenerateMultipartPostRequestHeader(const wstring &boundary) {
+ wstring GenerateMultipartPostRequestHeader(const wstring& boundary) {
wstring header = L"Content-Type: multipart/form-data; boundary=";
header += boundary;
return header;
@@ -390,9 +390,9 @@ namespace {
return true;
}
- bool GenerateRequestBody(const map<wstring, wstring> &parameters,
- const map<wstring, wstring> &files,
- const wstring &boundary,
+ bool GenerateRequestBody(const map<wstring, wstring>& parameters,
+ const map<wstring, wstring>& files,
+ const wstring& boundary,
string *request_body) {
string boundary_str = WideToUTF8(boundary);
if (boundary_str.empty()) {
diff --git a/src/common/windows/http_upload.h b/src/common/windows/http_upload.h
index 57e526e3..c7d8c6fe 100644
--- a/src/common/windows/http_upload.h
+++ b/src/common/windows/http_upload.h
@@ -114,8 +114,8 @@ class HTTPUpload {
// No instances of this class should be created.
// Disallow all constructors, destructors, and operator=.
HTTPUpload();
- explicit HTTPUpload(const HTTPUpload &);
- void operator=(const HTTPUpload &);
+ explicit HTTPUpload(const HTTPUpload&);
+ void operator=(const HTTPUpload&);
~HTTPUpload();
};
diff --git a/src/common/windows/omap.cc b/src/common/windows/omap.cc
index ba3ce86b..5a821b64 100644
--- a/src/common/windows/omap.cc
+++ b/src/common/windows/omap.cc
@@ -449,11 +449,11 @@ void BuildEndpointIndexMap(ImageMap* image_map) {
}
}
-void BuildSubsequentRVAMap(const OmapData &omap_data,
- std::map<DWORD, DWORD> *subsequent) {
+void BuildSubsequentRVAMap(const OmapData& omap_data,
+ std::map<DWORD, DWORD>* subsequent) {
assert(subsequent->empty());
- const OmapFromTable &orig2tran =
- reinterpret_cast<const OmapFromTable &>(omap_data.omap_from);
+ const OmapFromTable& orig2tran =
+ reinterpret_cast<const OmapFromTable&>(omap_data.omap_from);
if (orig2tran.empty())
return;
diff --git a/src/common/windows/pdb_source_line_writer.cc b/src/common/windows/pdb_source_line_writer.cc
index 4030a2e9..0eeb30cc 100644
--- a/src/common/windows/pdb_source_line_writer.cc
+++ b/src/common/windows/pdb_source_line_writer.cc
@@ -120,7 +120,7 @@ bool SymbolsMatch(IDiaSymbol* a, IDiaSymbol* b) {
return a_section == b_section && a_offset == b_offset;
}
-bool CreateDiaDataSourceInstance(CComPtr<IDiaDataSource> &data_source) {
+bool CreateDiaDataSourceInstance(CComPtr<IDiaDataSource>& data_source) {
if (SUCCEEDED(data_source.CoCreateInstance(CLSID_DiaSource))) {
return true;
}
@@ -134,7 +134,7 @@ bool CreateDiaDataSourceInstance(CComPtr<IDiaDataSource> &data_source) {
// We can try loading the DLL corresponding to the #included DIA SDK, but
// the DIA headers don't provide a version. Lets try to figure out which DIA
// version we're compiling against by comparing CLSIDs.
- const wchar_t *msdia_dll = nullptr;
+ const wchar_t* msdia_dll = nullptr;
if (CLSID_DiaSource == _uuidof(DiaSource100)) {
msdia_dll = L"msdia100.dll";
} else if (CLSID_DiaSource == _uuidof(DiaSource110)) {
@@ -147,7 +147,7 @@ bool CreateDiaDataSourceInstance(CComPtr<IDiaDataSource> &data_source) {
if (msdia_dll &&
SUCCEEDED(NoRegCoCreate(msdia_dll, CLSID_DiaSource, IID_IDiaDataSource,
- reinterpret_cast<void **>(&data_source)))) {
+ reinterpret_cast<void**>(&data_source)))) {
return true;
}
@@ -163,7 +163,7 @@ PDBSourceLineWriter::~PDBSourceLineWriter() {
Close();
}
-bool PDBSourceLineWriter::SetCodeFile(const wstring &exe_file) {
+bool PDBSourceLineWriter::SetCodeFile(const wstring& exe_file) {
if (code_file_.empty()) {
code_file_ = exe_file;
return true;
@@ -173,7 +173,7 @@ bool PDBSourceLineWriter::SetCodeFile(const wstring &exe_file) {
return exe_file == code_file_;
}
-bool PDBSourceLineWriter::Open(const wstring &file, FileFormat format) {
+bool PDBSourceLineWriter::Open(const wstring& file, FileFormat format) {
Close();
code_file_.clear();
@@ -228,7 +228,7 @@ bool PDBSourceLineWriter::Open(const wstring &file, FileFormat format) {
return true;
}
-bool PDBSourceLineWriter::PrintLines(IDiaEnumLineNumbers *lines) {
+bool PDBSourceLineWriter::PrintLines(IDiaEnumLineNumbers* lines) {
// The line number format is:
// <rva> <line number> <source file id>
CComPtr<IDiaLineNumber> line;
@@ -272,8 +272,8 @@ bool PDBSourceLineWriter::PrintLines(IDiaEnumLineNumbers *lines) {
return true;
}
-bool PDBSourceLineWriter::PrintFunction(IDiaSymbol *function,
- IDiaSymbol *block,
+bool PDBSourceLineWriter::PrintFunction(IDiaSymbol* function,
+ IDiaSymbol* block,
bool has_multiple_symbols) {
// The function format is:
// FUNC <address> <length> <param_stack_size> <function>
@@ -679,7 +679,7 @@ bool PDBSourceLineWriter::PrintFrameData() {
return false;
}
-bool PDBSourceLineWriter::PrintCodePublicSymbol(IDiaSymbol *symbol,
+bool PDBSourceLineWriter::PrintCodePublicSymbol(IDiaSymbol* symbol,
bool has_multiple_symbols) {
BOOL is_code;
if (FAILED(symbol->get_code(&is_code))) {
@@ -781,9 +781,9 @@ bool PDBSourceLineWriter::PrintPEInfo() {
// and scanf families, which are not as strict about input and in some cases
// don't provide a good way for the caller to determine if a conversion was
// successful.
-static bool wcstol_positive_strict(wchar_t *string, int *result) {
+static bool wcstol_positive_strict(wchar_t* string, int* result) {
int value = 0;
- for (wchar_t *c = string; *c != '\0'; ++c) {
+ for (wchar_t* c = string; *c != '\0'; ++c) {
int last_value = value;
value *= 10;
// Detect overflow.
@@ -821,7 +821,7 @@ bool PDBSourceLineWriter::FindPEFile() {
wstring file(symbols_file);
// Look for an EXE or DLL file.
- const wchar_t *extensions[] = { L"exe", L"dll" };
+ const wchar_t* extensions[] = { L"exe", L"dll" };
for (size_t i = 0; i < sizeof(extensions) / sizeof(extensions[0]); i++) {
size_t dot_pos = file.find_last_of(L".");
if (dot_pos != wstring::npos) {
@@ -839,9 +839,9 @@ bool PDBSourceLineWriter::FindPEFile() {
}
// static
-bool PDBSourceLineWriter::GetSymbolFunctionName(IDiaSymbol *function,
- BSTR *name,
- int *stack_param_size) {
+bool PDBSourceLineWriter::GetSymbolFunctionName(IDiaSymbol* function,
+ BSTR* name,
+ int* stack_param_size) {
*stack_param_size = -1;
const DWORD undecorate_options = UNDNAME_NO_MS_KEYWORDS |
UNDNAME_NO_FUNCTION_RETURNS |
@@ -882,12 +882,12 @@ bool PDBSourceLineWriter::GetSymbolFunctionName(IDiaSymbol *function,
// C++ uses a bogus "void" argument for functions and methods that don't
// take any parameters. Take it out of the undecorated name because it's
// ugly and unnecessary.
- const wchar_t *replace_string = L"(void)";
+ const wchar_t* replace_string = L"(void)";
const size_t replace_length = wcslen(replace_string);
- const wchar_t *replacement_string = L"()";
+ const wchar_t* replacement_string = L"()";
size_t length = wcslen(*name);
if (length >= replace_length) {
- wchar_t *name_end = *name + length - replace_length;
+ wchar_t* name_end = *name + length - replace_length;
if (wcscmp(name_end, replace_string) == 0) {
WindowsStringUtils::safe_wcscpy(name_end, replace_length,
replacement_string);
@@ -903,7 +903,7 @@ bool PDBSourceLineWriter::GetSymbolFunctionName(IDiaSymbol *function,
// whether the undecorated name contains any ':' or '(' characters.
if (!wcschr(*name, ':') && !wcschr(*name, '(') &&
(*name[0] == '_' || *name[0] == '@')) {
- wchar_t *last_at = wcsrchr(*name + 1, '@');
+ wchar_t* last_at = wcsrchr(*name + 1, '@');
if (last_at && wcstol_positive_strict(last_at + 1, stack_param_size)) {
// If this function adheres to the fastcall convention, it accepts up
// to the first 8 bytes of parameters in registers (%ecx and %edx).
@@ -935,7 +935,7 @@ bool PDBSourceLineWriter::GetSymbolFunctionName(IDiaSymbol *function,
}
// static
-int PDBSourceLineWriter::GetFunctionStackParamSize(IDiaSymbol *function) {
+int PDBSourceLineWriter::GetFunctionStackParamSize(IDiaSymbol* function) {
// This implementation is highly x86-specific.
// Gather the symbols corresponding to data.
@@ -1050,7 +1050,7 @@ next_child:
return param_size;
}
-bool PDBSourceLineWriter::WriteSymbols(FILE *symbol_file) {
+bool PDBSourceLineWriter::WriteSymbols(FILE* symbol_file) {
output_ = symbol_file;
// Load the OMAP information, and disable auto-translation of addresses in
@@ -1078,7 +1078,7 @@ void PDBSourceLineWriter::Close() {
}
}
-bool PDBSourceLineWriter::GetModuleInfo(PDBModuleInfo *info) {
+bool PDBSourceLineWriter::GetModuleInfo(PDBModuleInfo* info) {
if (!info) {
return false;
}
@@ -1143,7 +1143,7 @@ bool PDBSourceLineWriter::GetModuleInfo(PDBModuleInfo *info) {
return true;
}
-bool PDBSourceLineWriter::GetPEInfo(PEModuleInfo *info) {
+bool PDBSourceLineWriter::GetPEInfo(PEModuleInfo* info) {
if (!info) {
return false;
}
@@ -1156,7 +1156,7 @@ bool PDBSourceLineWriter::GetPEInfo(PEModuleInfo *info) {
return ReadPEInfo(code_file_, info);
}
-bool PDBSourceLineWriter::UsesGUID(bool *uses_guid) {
+bool PDBSourceLineWriter::UsesGUID(bool* uses_guid) {
if (!uses_guid)
return false;
diff --git a/src/common/windows/pdb_source_line_writer.h b/src/common/windows/pdb_source_line_writer.h
index c0adf29f..00f6e592 100644
--- a/src/common/windows/pdb_source_line_writer.h
+++ b/src/common/windows/pdb_source_line_writer.h
@@ -65,7 +65,7 @@ class PDBSourceLineWriter {
// file must be available; Open will be if it is not.
// If there is already a pdb file open, it is automatically closed.
// Returns true on success.
- bool Open(const wstring &file, FileFormat format);
+ bool Open(const wstring& file, FileFormat format);
// Closes the current pdb file and its associated resources.
void Close();
@@ -77,7 +77,7 @@ class PDBSourceLineWriter {
// file and it must be called after Open() and before WriteMap().
// If Open() was called for an executable file, then it is an error to call
// SetCodeFile() with a different file path and it will return false.
- bool SetCodeFile(const wstring &exe_file);
+ bool SetCodeFile(const wstring& exe_file);
// Writes a Breakpad symbol file from the current pdb file to |symbol_file|.
// Returns true on success.
@@ -150,17 +150,17 @@ class PDBSourceLineWriter {
// Returns true if this filename has already been seen,
// and an ID is stored for it, or false if it has not.
- bool FileIDIsCached(const wstring &file) {
+ bool FileIDIsCached(const wstring& file) {
return unique_files_.find(file) != unique_files_.end();
}
// Cache this filename and ID for later reuse.
- void CacheFileID(const wstring &file, DWORD id) {
+ void CacheFileID(const wstring& file, DWORD id) {
unique_files_[file] = id;
}
// Store this ID in the cache as a duplicate for this filename.
- void StoreDuplicateFileID(const wstring &file, DWORD id) {
+ void StoreDuplicateFileID(const wstring& file, DWORD id) {
unordered_map<wstring, DWORD>::iterator iter = unique_files_.find(file);
if (iter != unique_files_.end()) {
// map this id to the previously seen one
diff --git a/src/common/windows/pe_util.cc b/src/common/windows/pe_util.cc
index 6fa63fa3..9c94af05 100644
--- a/src/common/windows/pe_util.cc
+++ b/src/common/windows/pe_util.cc
@@ -285,7 +285,7 @@ bool PrintPEFrameData(const wstring & pe_file, FILE * out_file)
unwind_rva = chained_func->UnwindInfoAddress;
}
- UnwindInfo *unwind_info = static_cast<UnwindInfo *>(
+ UnwindInfo *unwind_info = static_cast<UnwindInfo*>(
ImageRvaToVa(img->FileHeader,
img->MappedAddress,
unwind_rva,
@@ -351,7 +351,7 @@ bool PrintPEFrameData(const wstring & pe_file, FILE * out_file)
(unwind_info->unwind_code +
((unwind_info->count_of_codes + 1) & ~1)));
- unwind_info = static_cast<UnwindInfo *>(
+ unwind_info = static_cast<UnwindInfo*>(
ImageRvaToVa(img->FileHeader,
img->MappedAddress,
chained_func->UnwindInfoAddress,
diff --git a/src/common/windows/string_utils-inl.h b/src/common/windows/string_utils-inl.h
index 9b636072..935e19f5 100644
--- a/src/common/windows/string_utils-inl.h
+++ b/src/common/windows/string_utils-inl.h
@@ -72,26 +72,26 @@ class WindowsStringUtils {
// Roughly equivalent to MSVC8's wcscpy_s, except pre-MSVC8, this does
// not fail if source is longer than destination_size. The destination
// buffer is always 0-terminated.
- static void safe_wcscpy(wchar_t *destination, size_t destination_size,
- const wchar_t *source);
+ static void safe_wcscpy(wchar_t* destination, size_t destination_size,
+ const wchar_t* source);
// Roughly equivalent to MSVC8's wcsncpy_s, except that _TRUNCATE cannot
// be passed directly, and pre-MSVC8, this will not fail if source or count
// are longer than destination_size. The destination buffer is always
// 0-terminated.
- static void safe_wcsncpy(wchar_t *destination, size_t destination_size,
- const wchar_t *source, size_t count);
+ static void safe_wcsncpy(wchar_t* destination, size_t destination_size,
+ const wchar_t* source, size_t count);
// Performs multi-byte to wide character conversion on C++ strings, using
// mbstowcs_s (MSVC8) or mbstowcs (pre-MSVC8). Returns false on failure,
// without setting wcs.
- static bool safe_mbstowcs(const string &mbs, wstring *wcs);
+ static bool safe_mbstowcs(const string& mbs, wstring* wcs);
// The inverse of safe_mbstowcs.
- static bool safe_wcstombs(const wstring &wcs, string *mbs);
+ static bool safe_wcstombs(const wstring& wcs, string* mbs);
// Returns the base name of a file, e.g. strips off the path.
- static wstring GetBaseName(const wstring &filename);
+ static wstring GetBaseName(const wstring& filename);
private:
// Disallow instantiation and other object-based operations.
@@ -102,9 +102,9 @@ class WindowsStringUtils {
};
// static
-inline void WindowsStringUtils::safe_wcscpy(wchar_t *destination,
+inline void WindowsStringUtils::safe_wcscpy(wchar_t* destination,
size_t destination_size,
- const wchar_t *source) {
+ const wchar_t* source) {
#if _MSC_VER >= 1400 // MSVC 2005/8
wcscpy_s(destination, destination_size, source);
#else // _MSC_VER >= 1400
@@ -118,9 +118,9 @@ inline void WindowsStringUtils::safe_wcscpy(wchar_t *destination,
}
// static
-inline void WindowsStringUtils::safe_wcsncpy(wchar_t *destination,
+inline void WindowsStringUtils::safe_wcsncpy(wchar_t* destination,
size_t destination_size,
- const wchar_t *source,
+ const wchar_t* source,
size_t count) {
#if _MSC_VER >= 1400 // MSVC 2005/8
wcsncpy_s(destination, destination_size, source, count);
diff --git a/src/common/windows/string_utils.cc b/src/common/windows/string_utils.cc
index 27280003..90aab038 100644
--- a/src/common/windows/string_utils.cc
+++ b/src/common/windows/string_utils.cc
@@ -35,7 +35,7 @@
namespace google_breakpad {
// static
-wstring WindowsStringUtils::GetBaseName(const wstring &filename) {
+wstring WindowsStringUtils::GetBaseName(const wstring& filename) {
wstring base_name(filename);
size_t slash_pos = base_name.find_last_of(L"/\\");
if (slash_pos != wstring::npos) {
@@ -45,7 +45,7 @@ wstring WindowsStringUtils::GetBaseName(const wstring &filename) {
}
// static
-bool WindowsStringUtils::safe_mbstowcs(const string &mbs, wstring *wcs) {
+bool WindowsStringUtils::safe_mbstowcs(const string& mbs, wstring* wcs) {
assert(wcs);
// First, determine the length of the destination buffer.
@@ -88,7 +88,7 @@ bool WindowsStringUtils::safe_mbstowcs(const string &mbs, wstring *wcs) {
}
// static
-bool WindowsStringUtils::safe_wcstombs(const wstring &wcs, string *mbs) {
+bool WindowsStringUtils::safe_wcstombs(const wstring& wcs, string* mbs) {
assert(mbs);
// First, determine the length of the destination buffer.