Use stdint.h numeric types
Change-Id: Ib815b0757539145c005d828080b92cbfa971a21b Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2141226 Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
This commit is contained in:
parent
5bba75bfd6
commit
86bf444128
27 changed files with 624 additions and 629 deletions
|
@ -36,13 +36,13 @@
|
|||
|
||||
namespace dwarf2reader {
|
||||
|
||||
inline uint8 ByteReader::ReadOneByte(const uint8_t *buffer) const {
|
||||
inline uint8_t ByteReader::ReadOneByte(const uint8_t *buffer) const {
|
||||
return buffer[0];
|
||||
}
|
||||
|
||||
inline uint16 ByteReader::ReadTwoBytes(const uint8_t *buffer) const {
|
||||
const uint16 buffer0 = buffer[0];
|
||||
const uint16 buffer1 = buffer[1];
|
||||
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) {
|
||||
return buffer0 | buffer1 << 8;
|
||||
} else {
|
||||
|
@ -50,11 +50,11 @@ inline uint16 ByteReader::ReadTwoBytes(const uint8_t *buffer) const {
|
|||
}
|
||||
}
|
||||
|
||||
inline uint64 ByteReader::ReadFourBytes(const uint8_t *buffer) const {
|
||||
const uint32 buffer0 = buffer[0];
|
||||
const uint32 buffer1 = buffer[1];
|
||||
const uint32 buffer2 = buffer[2];
|
||||
const uint32 buffer3 = buffer[3];
|
||||
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];
|
||||
const uint32_t buffer3 = buffer[3];
|
||||
if (endian_ == ENDIANNESS_LITTLE) {
|
||||
return buffer0 | buffer1 << 8 | buffer2 << 16 | buffer3 << 24;
|
||||
} else {
|
||||
|
@ -62,15 +62,15 @@ inline uint64 ByteReader::ReadFourBytes(const uint8_t *buffer) const {
|
|||
}
|
||||
}
|
||||
|
||||
inline uint64 ByteReader::ReadEightBytes(const uint8_t *buffer) const {
|
||||
const uint64 buffer0 = buffer[0];
|
||||
const uint64 buffer1 = buffer[1];
|
||||
const uint64 buffer2 = buffer[2];
|
||||
const uint64 buffer3 = buffer[3];
|
||||
const uint64 buffer4 = buffer[4];
|
||||
const uint64 buffer5 = buffer[5];
|
||||
const uint64 buffer6 = buffer[6];
|
||||
const uint64 buffer7 = buffer[7];
|
||||
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];
|
||||
const uint64_t buffer3 = buffer[3];
|
||||
const uint64_t buffer4 = buffer[4];
|
||||
const uint64_t buffer5 = buffer[5];
|
||||
const uint64_t buffer6 = buffer[6];
|
||||
const uint64_t buffer7 = buffer[7];
|
||||
if (endian_ == ENDIANNESS_LITTLE) {
|
||||
return buffer0 | buffer1 << 8 | buffer2 << 16 | buffer3 << 24 |
|
||||
buffer4 << 32 | buffer5 << 40 | buffer6 << 48 | buffer7 << 56;
|
||||
|
@ -84,9 +84,9 @@ inline uint64 ByteReader::ReadEightBytes(const uint8_t *buffer) const {
|
|||
// information, plus one bit saying whether the number continues or
|
||||
// not.
|
||||
|
||||
inline uint64 ByteReader::ReadUnsignedLEB128(const uint8_t *buffer,
|
||||
inline uint64_t ByteReader::ReadUnsignedLEB128(const uint8_t *buffer,
|
||||
size_t* len) const {
|
||||
uint64 result = 0;
|
||||
uint64_t result = 0;
|
||||
size_t num_read = 0;
|
||||
unsigned int shift = 0;
|
||||
uint8_t byte;
|
||||
|
@ -95,7 +95,7 @@ inline uint64 ByteReader::ReadUnsignedLEB128(const uint8_t *buffer,
|
|||
byte = *buffer++;
|
||||
num_read++;
|
||||
|
||||
result |= (static_cast<uint64>(byte & 0x7f)) << shift;
|
||||
result |= (static_cast<uint64_t>(byte & 0x7f)) << shift;
|
||||
|
||||
shift += 7;
|
||||
|
||||
|
@ -109,9 +109,9 @@ inline uint64 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 ByteReader::ReadSignedLEB128(const uint8_t *buffer,
|
||||
inline int64_t ByteReader::ReadSignedLEB128(const uint8_t *buffer,
|
||||
size_t* len) const {
|
||||
int64 result = 0;
|
||||
int64_t result = 0;
|
||||
unsigned int shift = 0;
|
||||
size_t num_read = 0;
|
||||
uint8_t byte;
|
||||
|
@ -119,44 +119,44 @@ inline int64 ByteReader::ReadSignedLEB128(const uint8_t *buffer,
|
|||
do {
|
||||
byte = *buffer++;
|
||||
num_read++;
|
||||
result |= (static_cast<uint64>(byte & 0x7f) << shift);
|
||||
result |= (static_cast<uint64_t>(byte & 0x7f) << shift);
|
||||
shift += 7;
|
||||
} while (byte & 0x80);
|
||||
|
||||
if ((shift < 8 * sizeof (result)) && (byte & 0x40))
|
||||
result |= -((static_cast<int64>(1)) << shift);
|
||||
result |= -((static_cast<int64_t>(1)) << shift);
|
||||
*len = num_read;
|
||||
return result;
|
||||
}
|
||||
|
||||
inline uint64 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 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 section_base,
|
||||
inline void ByteReader::SetCFIDataBase(uint64_t section_base,
|
||||
const uint8_t *buffer_base) {
|
||||
section_base_ = section_base;
|
||||
buffer_base_ = buffer_base;
|
||||
have_section_base_ = true;
|
||||
}
|
||||
|
||||
inline void ByteReader::SetTextBase(uint64 text_base) {
|
||||
inline void ByteReader::SetTextBase(uint64_t text_base) {
|
||||
text_base_ = text_base;
|
||||
have_text_base_ = true;
|
||||
}
|
||||
|
||||
inline void ByteReader::SetDataBase(uint64 data_base) {
|
||||
inline void ByteReader::SetDataBase(uint64_t data_base) {
|
||||
data_base_ = data_base;
|
||||
have_data_base_ = true;
|
||||
}
|
||||
|
||||
inline void ByteReader::SetFunctionBase(uint64 function_base) {
|
||||
inline void ByteReader::SetFunctionBase(uint64_t function_base) {
|
||||
function_base_ = function_base;
|
||||
have_function_base_ = true;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ ByteReader::ByteReader(enum Endianness endian)
|
|||
|
||||
ByteReader::~ByteReader() { }
|
||||
|
||||
void ByteReader::SetOffsetSize(uint8 size) {
|
||||
void ByteReader::SetOffsetSize(uint8_t size) {
|
||||
offset_size_ = size;
|
||||
assert(size == 4 || size == 8);
|
||||
if (size == 4) {
|
||||
|
@ -53,7 +53,7 @@ void ByteReader::SetOffsetSize(uint8 size) {
|
|||
}
|
||||
}
|
||||
|
||||
void ByteReader::SetAddressSize(uint8 size) {
|
||||
void ByteReader::SetAddressSize(uint8_t size) {
|
||||
address_size_ = size;
|
||||
assert(size == 4 || size == 8);
|
||||
if (size == 4) {
|
||||
|
@ -63,8 +63,8 @@ void ByteReader::SetAddressSize(uint8 size) {
|
|||
}
|
||||
}
|
||||
|
||||
uint64 ByteReader::ReadInitialLength(const uint8_t *start, size_t* len) {
|
||||
const uint64 initial_length = ReadFourBytes(start);
|
||||
uint64_t ByteReader::ReadInitialLength(const uint8_t *start, size_t* len) {
|
||||
const uint64_t initial_length = ReadFourBytes(start);
|
||||
start += 4;
|
||||
|
||||
// In DWARF2/3, if the initial length is all 1 bits, then the offset
|
||||
|
@ -101,7 +101,7 @@ bool ByteReader::UsableEncoding(DwarfPointerEncoding encoding) const {
|
|||
}
|
||||
}
|
||||
|
||||
uint64 ByteReader::ReadEncodedPointer(const uint8_t *buffer,
|
||||
uint64_t ByteReader::ReadEncodedPointer(const uint8_t *buffer,
|
||||
DwarfPointerEncoding encoding,
|
||||
size_t *len) const {
|
||||
// UsableEncoding doesn't approve of DW_EH_PE_omit, so we shouldn't
|
||||
|
@ -124,11 +124,11 @@ uint64 ByteReader::ReadEncodedPointer(const uint8_t *buffer,
|
|||
|
||||
// First, find the offset to START from the closest prior aligned
|
||||
// address.
|
||||
uint64 skew = section_base_ & (AddressSize() - 1);
|
||||
uint64_t skew = section_base_ & (AddressSize() - 1);
|
||||
// Now find the offset from that aligned address to buffer.
|
||||
uint64 offset = skew + (buffer - buffer_base_);
|
||||
uint64_t offset = skew + (buffer - buffer_base_);
|
||||
// Round up to the next boundary.
|
||||
uint64 aligned = (offset + AddressSize() - 1) & -AddressSize();
|
||||
uint64_t aligned = (offset + AddressSize() - 1) & -AddressSize();
|
||||
// Convert back to a pointer.
|
||||
const uint8_t *aligned_buffer = buffer_base_ + (aligned - skew);
|
||||
// Finally, store the length and actually fetch the pointer.
|
||||
|
@ -138,7 +138,7 @@ uint64 ByteReader::ReadEncodedPointer(const uint8_t *buffer,
|
|||
|
||||
// Extract the value first, ignoring whether it's a pointer or an
|
||||
// offset relative to some base.
|
||||
uint64 offset;
|
||||
uint64_t offset;
|
||||
switch (encoding & 0x0f) {
|
||||
case DW_EH_PE_absptr:
|
||||
// DW_EH_PE_absptr is weird, as it is used as a meaningful value for
|
||||
|
@ -202,7 +202,7 @@ uint64 ByteReader::ReadEncodedPointer(const uint8_t *buffer,
|
|||
}
|
||||
|
||||
// Find the appropriate base address.
|
||||
uint64 base;
|
||||
uint64_t base;
|
||||
switch (encoding & 0x70) {
|
||||
case DW_EH_PE_absptr:
|
||||
base = 0;
|
||||
|
@ -232,13 +232,13 @@ uint64 ByteReader::ReadEncodedPointer(const uint8_t *buffer,
|
|||
abort();
|
||||
}
|
||||
|
||||
uint64 pointer = base + offset;
|
||||
uint64_t pointer = base + offset;
|
||||
|
||||
// Remove inappropriate upper bits.
|
||||
if (AddressSize() == 4)
|
||||
pointer = pointer & 0xffffffff;
|
||||
else
|
||||
assert(AddressSize() == sizeof(uint64));
|
||||
assert(AddressSize() == sizeof(uint64_t));
|
||||
|
||||
return pointer;
|
||||
}
|
||||
|
|
|
@ -62,22 +62,22 @@ class ByteReader {
|
|||
|
||||
// Read a single byte from BUFFER and return it as an unsigned 8 bit
|
||||
// number.
|
||||
uint8 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 ReadTwoBytes(const uint8_t *buffer) const;
|
||||
uint16_t ReadTwoBytes(const uint8_t *buffer) const;
|
||||
|
||||
// Read four bytes from BUFFER and return them as an unsigned 32 bit
|
||||
// number, using this ByteReader's endianness. This function returns
|
||||
// a uint64 so that it is compatible with ReadAddress and
|
||||
// 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 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 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
|
||||
|
@ -96,7 +96,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 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.
|
||||
|
@ -115,7 +115,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 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
|
||||
|
@ -129,16 +129,16 @@ class ByteReader {
|
|||
// frame information doesn't indicate its address size (a shortcoming of
|
||||
// the spec); you must supply the appropriate size based on the
|
||||
// architecture of the target machine.
|
||||
void SetAddressSize(uint8 size);
|
||||
void SetAddressSize(uint8_t size);
|
||||
|
||||
// Return the current address size, in bytes. This is either 4,
|
||||
// indicating 32-bit addresses, or 8, indicating 64-bit addresses.
|
||||
uint8 AddressSize() const { return address_size_; }
|
||||
uint8_t AddressSize() const { return address_size_; }
|
||||
|
||||
// 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 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
|
||||
|
@ -175,26 +175,26 @@ 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 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 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.
|
||||
// A return value of 8 indicates that we are reading 64-bit DWARF.
|
||||
uint8 OffsetSize() const { return offset_size_; }
|
||||
uint8_t OffsetSize() const { return offset_size_; }
|
||||
|
||||
// Indicate that section offsets and lengths are SIZE bytes long. SIZE
|
||||
// must be either 4 (meaning 32-bit DWARF) or 8 (meaning 64-bit DWARF).
|
||||
// Usually, you should not call this function yourself; instead, let a
|
||||
// call to ReadInitialLength establish the data's offset size
|
||||
// automatically.
|
||||
void SetOffsetSize(uint8 size);
|
||||
void SetOffsetSize(uint8_t size);
|
||||
|
||||
// The Linux C++ ABI uses a variant of DWARF call frame information
|
||||
// for exception handling. This data is included in the program's
|
||||
|
@ -237,24 +237,24 @@ 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 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.
|
||||
void SetTextBase(uint64 text_base);
|
||||
void SetTextBase(uint64_t text_base);
|
||||
|
||||
// Indicate that the base address for DW_EH_PE_datarel pointers is
|
||||
// DATA_BASE. The proper value depends on the ABI; it is usually the
|
||||
// address of the global offset table, held in a designated register in
|
||||
// position-independent code. You will need to look at the startup code
|
||||
// for the target system to be sure. I tried; my eyes bled.
|
||||
void SetDataBase(uint64 data_base);
|
||||
void SetDataBase(uint64_t data_base);
|
||||
|
||||
// Indicate that the base address for the FDE we are processing is
|
||||
// FUNCTION_BASE. This is the start address of DW_EH_PE_funcrel
|
||||
// pointers. (This encoding does not seem to be used by the GNU
|
||||
// toolchain.)
|
||||
void SetFunctionBase(uint64 function_base);
|
||||
void SetFunctionBase(uint64_t function_base);
|
||||
|
||||
// Indicate that we are no longer processing any FDE, so any use of
|
||||
// a DW_EH_PE_funcrel encoding is an error.
|
||||
|
@ -276,7 +276,7 @@ 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 ReadEncodedPointer(const uint8_t *buffer,
|
||||
uint64_t ReadEncodedPointer(const uint8_t *buffer,
|
||||
DwarfPointerEncoding encoding,
|
||||
size_t *len) const;
|
||||
|
||||
|
@ -284,7 +284,7 @@ class ByteReader {
|
|||
private:
|
||||
|
||||
// Function pointer type for our address and offset readers.
|
||||
typedef uint64 (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,
|
||||
|
@ -300,13 +300,13 @@ class ByteReader {
|
|||
AddressReader address_reader_;
|
||||
|
||||
Endianness endian_;
|
||||
uint8 address_size_;
|
||||
uint8 offset_size_;
|
||||
uint8_t address_size_;
|
||||
uint8_t offset_size_;
|
||||
|
||||
// Base addresses for Linux C++ exception handling data's encoded pointers.
|
||||
bool have_section_base_, have_text_base_, have_data_base_;
|
||||
bool have_function_base_;
|
||||
uint64 section_base_, text_base_, data_base_, function_base_;
|
||||
uint64_t section_base_, text_base_, data_base_, function_base_;
|
||||
const uint8_t *buffer_base_;
|
||||
};
|
||||
|
||||
|
|
|
@ -50,15 +50,15 @@ DIEDispatcher::~DIEDispatcher() {
|
|||
}
|
||||
}
|
||||
|
||||
bool DIEDispatcher::StartCompilationUnit(uint64 offset, uint8 address_size,
|
||||
uint8 offset_size, uint64 cu_length,
|
||||
uint8 dwarf_version) {
|
||||
bool DIEDispatcher::StartCompilationUnit(uint64_t offset, uint8_t address_size,
|
||||
uint8_t offset_size, uint64_t cu_length,
|
||||
uint8_t dwarf_version) {
|
||||
return root_handler_->StartCompilationUnit(offset, address_size,
|
||||
offset_size, cu_length,
|
||||
dwarf_version);
|
||||
}
|
||||
|
||||
bool DIEDispatcher::StartDIE(uint64 offset, enum DwarfTag tag) {
|
||||
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();
|
||||
|
||||
|
@ -113,7 +113,7 @@ bool DIEDispatcher::StartDIE(uint64 offset, enum DwarfTag tag) {
|
|||
return handler != NULL;
|
||||
}
|
||||
|
||||
void DIEDispatcher::EndDIE(uint64 offset) {
|
||||
void DIEDispatcher::EndDIE(uint64_t offset) {
|
||||
assert(!die_handlers_.empty());
|
||||
HandlerStack *entry = &die_handlers_.top();
|
||||
if (entry->handler_) {
|
||||
|
@ -135,48 +135,48 @@ void DIEDispatcher::EndDIE(uint64 offset) {
|
|||
die_handlers_.pop();
|
||||
}
|
||||
|
||||
void DIEDispatcher::ProcessAttributeUnsigned(uint64 offset,
|
||||
void DIEDispatcher::ProcessAttributeUnsigned(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data) {
|
||||
uint64_t data) {
|
||||
HandlerStack ¤t = 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);
|
||||
}
|
||||
|
||||
void DIEDispatcher::ProcessAttributeSigned(uint64 offset,
|
||||
void DIEDispatcher::ProcessAttributeSigned(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
int64 data) {
|
||||
int64_t data) {
|
||||
HandlerStack ¤t = 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);
|
||||
}
|
||||
|
||||
void DIEDispatcher::ProcessAttributeReference(uint64 offset,
|
||||
void DIEDispatcher::ProcessAttributeReference(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data) {
|
||||
uint64_t data) {
|
||||
HandlerStack ¤t = 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);
|
||||
}
|
||||
|
||||
void DIEDispatcher::ProcessAttributeBuffer(uint64 offset,
|
||||
void DIEDispatcher::ProcessAttributeBuffer(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
const uint8_t *data,
|
||||
uint64 len) {
|
||||
uint64_t len) {
|
||||
HandlerStack ¤t = 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);
|
||||
}
|
||||
|
||||
void DIEDispatcher::ProcessAttributeString(uint64 offset,
|
||||
void DIEDispatcher::ProcessAttributeString(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
const string& data) {
|
||||
|
@ -186,10 +186,10 @@ void DIEDispatcher::ProcessAttributeString(uint64 offset,
|
|||
current.handler_->ProcessAttributeString(attr, form, data);
|
||||
}
|
||||
|
||||
void DIEDispatcher::ProcessAttributeSignature(uint64 offset,
|
||||
void DIEDispatcher::ProcessAttributeSignature(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 signature) {
|
||||
uint64_t signature) {
|
||||
HandlerStack ¤t = die_handlers_.top();
|
||||
// This had better be an attribute of the DIE we were meant to handle.
|
||||
assert(offset == current.offset_);
|
||||
|
|
|
@ -199,23 +199,23 @@ class DIEHandler {
|
|||
// The default definitions ignore the values they are passed.
|
||||
virtual void ProcessAttributeUnsigned(enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data) { }
|
||||
uint64_t data) { }
|
||||
virtual void ProcessAttributeSigned(enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
int64 data) { }
|
||||
int64_t data) { }
|
||||
virtual void ProcessAttributeReference(enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data) { }
|
||||
uint64_t data) { }
|
||||
virtual void ProcessAttributeBuffer(enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
const uint8_t *data,
|
||||
uint64 len) { }
|
||||
uint64_t len) { }
|
||||
virtual void ProcessAttributeString(enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
const string& data) { }
|
||||
virtual void ProcessAttributeSignature(enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 signture) { }
|
||||
uint64_t signture) { }
|
||||
|
||||
// Once we have reported all the DIE's attributes' values, we call
|
||||
// this member function. If it returns false, we skip all the DIE's
|
||||
|
@ -244,7 +244,7 @@ class DIEHandler {
|
|||
// it is.
|
||||
//
|
||||
// The default definition skips all children.
|
||||
virtual DIEHandler *FindChildHandler(uint64 offset, enum DwarfTag tag) {
|
||||
virtual DIEHandler *FindChildHandler(uint64_t offset, enum DwarfTag tag) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -268,9 +268,9 @@ class RootDIEHandler: public DIEHandler {
|
|||
// returns false. So the root DIE handler is actually also
|
||||
// responsible for handling the compilation unit metadata.
|
||||
// The default definition always visits the compilation unit.
|
||||
virtual bool StartCompilationUnit(uint64 offset, uint8 address_size,
|
||||
uint8 offset_size, uint64 cu_length,
|
||||
uint8 dwarf_version) { return true; }
|
||||
virtual bool StartCompilationUnit(uint64_t offset, uint8_t address_size,
|
||||
uint8_t offset_size, uint64_t cu_length,
|
||||
uint8_t dwarf_version) { return true; }
|
||||
|
||||
// For the root DIE handler only, we pass the offset, tag and
|
||||
// attributes of the compilation unit's root DIE. This is the only
|
||||
|
@ -280,7 +280,7 @@ class RootDIEHandler: public DIEHandler {
|
|||
// unit.
|
||||
//
|
||||
// The default definition elects to visit the root DIE.
|
||||
virtual bool StartRootDIE(uint64 offset, enum DwarfTag tag) { return true; }
|
||||
virtual bool StartRootDIE(uint64_t offset, enum DwarfTag tag) { return true; }
|
||||
};
|
||||
|
||||
class DIEDispatcher: public Dwarf2Handler {
|
||||
|
@ -292,36 +292,36 @@ class DIEDispatcher: public Dwarf2Handler {
|
|||
// Destroying a DIEDispatcher destroys all active handler objects
|
||||
// except the root handler.
|
||||
~DIEDispatcher();
|
||||
bool StartCompilationUnit(uint64 offset, uint8 address_size,
|
||||
uint8 offset_size, uint64 cu_length,
|
||||
uint8 dwarf_version);
|
||||
bool StartDIE(uint64 offset, enum DwarfTag tag);
|
||||
void ProcessAttributeUnsigned(uint64 offset,
|
||||
bool StartCompilationUnit(uint64_t offset, uint8_t address_size,
|
||||
uint8_t offset_size, uint64_t cu_length,
|
||||
uint8_t dwarf_version);
|
||||
bool StartDIE(uint64_t offset, enum DwarfTag tag);
|
||||
void ProcessAttributeUnsigned(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data);
|
||||
void ProcessAttributeSigned(uint64 offset,
|
||||
uint64_t data);
|
||||
void ProcessAttributeSigned(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
int64 data);
|
||||
void ProcessAttributeReference(uint64 offset,
|
||||
int64_t data);
|
||||
void ProcessAttributeReference(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data);
|
||||
void ProcessAttributeBuffer(uint64 offset,
|
||||
uint64_t data);
|
||||
void ProcessAttributeBuffer(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
const uint8_t *data,
|
||||
uint64 len);
|
||||
void ProcessAttributeString(uint64 offset,
|
||||
uint64_t len);
|
||||
void ProcessAttributeString(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
const string &data);
|
||||
void ProcessAttributeSignature(uint64 offset,
|
||||
void ProcessAttributeSignature(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 signature);
|
||||
void EndDIE(uint64 offset);
|
||||
uint64_t signature);
|
||||
void EndDIE(uint64_t offset);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -331,7 +331,7 @@ class DIEDispatcher: public Dwarf2Handler {
|
|||
// makes it easier to see that the code is correct.
|
||||
struct HandlerStack {
|
||||
// The offset of the DIE for this handler stack entry.
|
||||
uint64 offset_;
|
||||
uint64_t offset_;
|
||||
|
||||
// The handler object interested in this DIE's attributes and
|
||||
// children. If NULL, we're not interested in either.
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
namespace dwarf2reader {
|
||||
|
||||
CompilationUnit::CompilationUnit(const string& path,
|
||||
const SectionMap& sections, uint64 offset,
|
||||
const SectionMap& sections, uint64_t offset,
|
||||
ByteReader* reader, Dwarf2Handler* handler)
|
||||
: path_(path), offset_from_section_start_(offset), reader_(reader),
|
||||
sections_(sections), handler_(handler), abbrevs_(),
|
||||
|
@ -74,10 +74,10 @@ CompilationUnit::CompilationUnit(const string& path,
|
|||
// processing the original compilation unit.
|
||||
|
||||
void CompilationUnit::SetSplitDwarf(const uint8_t* addr_buffer,
|
||||
uint64 addr_buffer_length,
|
||||
uint64 addr_base,
|
||||
uint64 ranges_base,
|
||||
uint64 dwo_id) {
|
||||
uint64_t addr_buffer_length,
|
||||
uint64_t addr_base,
|
||||
uint64_t ranges_base,
|
||||
uint64_t dwo_id) {
|
||||
is_split_dwarf_ = true;
|
||||
addr_buffer_ = addr_buffer;
|
||||
addr_buffer_length_ = addr_buffer_length;
|
||||
|
@ -116,13 +116,13 @@ void CompilationUnit::ReadAbbrevs() {
|
|||
header_.abbrev_offset;
|
||||
const uint8_t *abbrevptr = abbrev_start;
|
||||
#ifndef NDEBUG
|
||||
const uint64 abbrev_length = iter->second.second - header_.abbrev_offset;
|
||||
const uint64_t abbrev_length = iter->second.second - header_.abbrev_offset;
|
||||
#endif
|
||||
|
||||
while (1) {
|
||||
CompilationUnit::Abbrev abbrev;
|
||||
size_t len;
|
||||
const uint64 number = reader_->ReadUnsignedLEB128(abbrevptr, &len);
|
||||
const uint64_t number = reader_->ReadUnsignedLEB128(abbrevptr, &len);
|
||||
|
||||
if (number == 0)
|
||||
break;
|
||||
|
@ -130,7 +130,7 @@ void CompilationUnit::ReadAbbrevs() {
|
|||
abbrevptr += len;
|
||||
|
||||
assert(abbrevptr < abbrev_start + abbrev_length);
|
||||
const uint64 tag = reader_->ReadUnsignedLEB128(abbrevptr, &len);
|
||||
const uint64_t tag = reader_->ReadUnsignedLEB128(abbrevptr, &len);
|
||||
abbrevptr += len;
|
||||
abbrev.tag = static_cast<enum DwarfTag>(tag);
|
||||
|
||||
|
@ -141,11 +141,11 @@ void CompilationUnit::ReadAbbrevs() {
|
|||
assert(abbrevptr < abbrev_start + abbrev_length);
|
||||
|
||||
while (1) {
|
||||
const uint64 nametemp = reader_->ReadUnsignedLEB128(abbrevptr, &len);
|
||||
const uint64_t nametemp = reader_->ReadUnsignedLEB128(abbrevptr, &len);
|
||||
abbrevptr += len;
|
||||
|
||||
assert(abbrevptr < abbrev_start + abbrev_length);
|
||||
const uint64 formtemp = reader_->ReadUnsignedLEB128(abbrevptr, &len);
|
||||
const uint64_t formtemp = reader_->ReadUnsignedLEB128(abbrevptr, &len);
|
||||
abbrevptr += len;
|
||||
if (nametemp == 0 && formtemp == 0)
|
||||
break;
|
||||
|
@ -232,7 +232,7 @@ const uint8_t *CompilationUnit::SkipAttribute(const uint8_t *start,
|
|||
return start + 4 + reader_->ReadFourBytes(start);
|
||||
case DW_FORM_block:
|
||||
case DW_FORM_exprloc: {
|
||||
uint64 size = reader_->ReadUnsignedLEB128(start, &len);
|
||||
uint64_t size = reader_->ReadUnsignedLEB128(start, &len);
|
||||
return start + size + len;
|
||||
}
|
||||
case DW_FORM_strp:
|
||||
|
@ -253,7 +253,7 @@ void CompilationUnit::ReadHeader() {
|
|||
size_t initial_length_size;
|
||||
|
||||
assert(headerptr + 4 < buffer_ + buffer_length_);
|
||||
const uint64 initial_length
|
||||
const uint64_t initial_length
|
||||
= reader_->ReadInitialLength(headerptr, &initial_length_size);
|
||||
headerptr += initial_length_size;
|
||||
header_.length = initial_length;
|
||||
|
@ -282,7 +282,7 @@ void CompilationUnit::ReadHeader() {
|
|||
buffer_ + buffer_length_);
|
||||
}
|
||||
|
||||
uint64 CompilationUnit::Start() {
|
||||
uint64_t CompilationUnit::Start() {
|
||||
// First get the debug_info section. ".debug_info" is the name
|
||||
// recommended in the DWARF spec, and used on Linux; "__debug_info"
|
||||
// is the name used in Mac OS X Mach-O files.
|
||||
|
@ -301,7 +301,7 @@ uint64 CompilationUnit::Start() {
|
|||
// Figure out the real length from the end of the initial length to
|
||||
// the end of the compilation unit, since that is the value we
|
||||
// return.
|
||||
uint64 ourlength = header_.length;
|
||||
uint64_t ourlength = header_.length;
|
||||
if (reader_->OffsetSize() == 8)
|
||||
ourlength += 12;
|
||||
else
|
||||
|
@ -361,7 +361,7 @@ uint64 CompilationUnit::Start() {
|
|||
// ProcessAttribute
|
||||
// This is all boring data manipulation and calling of the handler.
|
||||
const uint8_t *CompilationUnit::ProcessAttribute(
|
||||
uint64 dieoffset, const uint8_t *start, enum DwarfAttribute attr,
|
||||
uint64_t dieoffset, const uint8_t *start, enum DwarfAttribute attr,
|
||||
enum DwarfForm form) {
|
||||
size_t len;
|
||||
|
||||
|
@ -463,26 +463,26 @@ const uint8_t *CompilationUnit::ProcessAttribute(
|
|||
return start + 8;
|
||||
|
||||
case DW_FORM_block1: {
|
||||
uint64 datalen = reader_->ReadOneByte(start);
|
||||
uint64_t datalen = reader_->ReadOneByte(start);
|
||||
handler_->ProcessAttributeBuffer(dieoffset, attr, form, start + 1,
|
||||
datalen);
|
||||
return start + 1 + datalen;
|
||||
}
|
||||
case DW_FORM_block2: {
|
||||
uint64 datalen = reader_->ReadTwoBytes(start);
|
||||
uint64_t datalen = reader_->ReadTwoBytes(start);
|
||||
handler_->ProcessAttributeBuffer(dieoffset, attr, form, start + 2,
|
||||
datalen);
|
||||
return start + 2 + datalen;
|
||||
}
|
||||
case DW_FORM_block4: {
|
||||
uint64 datalen = reader_->ReadFourBytes(start);
|
||||
uint64_t datalen = reader_->ReadFourBytes(start);
|
||||
handler_->ProcessAttributeBuffer(dieoffset, attr, form, start + 4,
|
||||
datalen);
|
||||
return start + 4 + datalen;
|
||||
}
|
||||
case DW_FORM_block:
|
||||
case DW_FORM_exprloc: {
|
||||
uint64 datalen = reader_->ReadUnsignedLEB128(start, &len);
|
||||
uint64_t datalen = reader_->ReadUnsignedLEB128(start, &len);
|
||||
handler_->ProcessAttributeBuffer(dieoffset, attr, form, start + len,
|
||||
datalen);
|
||||
return start + datalen + len;
|
||||
|
@ -490,7 +490,7 @@ const uint8_t *CompilationUnit::ProcessAttribute(
|
|||
case DW_FORM_strp: {
|
||||
assert(string_buffer_ != NULL);
|
||||
|
||||
const uint64 offset = reader_->ReadOffset(start);
|
||||
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);
|
||||
|
@ -499,10 +499,10 @@ const uint8_t *CompilationUnit::ProcessAttribute(
|
|||
}
|
||||
|
||||
case DW_FORM_GNU_str_index: {
|
||||
uint64 str_index = reader_->ReadUnsignedLEB128(start, &len);
|
||||
uint64_t str_index = reader_->ReadUnsignedLEB128(start, &len);
|
||||
const uint8_t* offset_ptr =
|
||||
str_offsets_buffer_ + str_index * reader_->OffsetSize();
|
||||
const uint64 offset = reader_->ReadOffset(offset_ptr);
|
||||
const uint64_t offset = reader_->ReadOffset(offset_ptr);
|
||||
if (offset >= string_buffer_length_) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -513,7 +513,7 @@ const uint8_t *CompilationUnit::ProcessAttribute(
|
|||
break;
|
||||
}
|
||||
case DW_FORM_GNU_addr_index: {
|
||||
uint64 addr_index = reader_->ReadUnsignedLEB128(start, &len);
|
||||
uint64_t addr_index = reader_->ReadUnsignedLEB128(start, &len);
|
||||
const uint8_t* addr_ptr =
|
||||
addr_buffer_ + addr_base_ + addr_index * reader_->AddressSize();
|
||||
ProcessAttributeUnsigned(dieoffset, attr, form,
|
||||
|
@ -525,7 +525,7 @@ const uint8_t *CompilationUnit::ProcessAttribute(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const uint8_t *CompilationUnit::ProcessDIE(uint64 dieoffset,
|
||||
const uint8_t *CompilationUnit::ProcessDIE(uint64_t dieoffset,
|
||||
const uint8_t *start,
|
||||
const Abbrev& abbrev) {
|
||||
for (AttributeList::const_iterator i = abbrev.attributes.begin();
|
||||
|
@ -561,14 +561,14 @@ void CompilationUnit::ProcessDIEs() {
|
|||
else
|
||||
lengthstart += 4;
|
||||
|
||||
std::stack<uint64> die_stack;
|
||||
std::stack<uint64_t> die_stack;
|
||||
|
||||
while (dieptr < (lengthstart + header_.length)) {
|
||||
// We give the user the absolute offset from the beginning of
|
||||
// debug_info, since they need it to deal with ref_addr forms.
|
||||
uint64 absolute_offset = (dieptr - buffer_) + offset_from_section_start_;
|
||||
uint64_t absolute_offset = (dieptr - buffer_) + offset_from_section_start_;
|
||||
|
||||
uint64 abbrev_num = reader_->ReadUnsignedLEB128(dieptr, &len);
|
||||
uint64_t abbrev_num = reader_->ReadUnsignedLEB128(dieptr, &len);
|
||||
|
||||
dieptr += len;
|
||||
|
||||
|
@ -578,7 +578,7 @@ void CompilationUnit::ProcessDIEs() {
|
|||
if (die_stack.size() == 0)
|
||||
// If it is padding, then we are done with the compilation unit's DIEs.
|
||||
return;
|
||||
const uint64 offset = die_stack.top();
|
||||
const uint64_t offset = die_stack.top();
|
||||
die_stack.pop();
|
||||
handler_->EndDIE(offset);
|
||||
continue;
|
||||
|
@ -724,24 +724,24 @@ void DwpReader::Initialize() {
|
|||
if (version_ == 1) {
|
||||
nslots_ = byte_reader_.ReadFourBytes(
|
||||
reinterpret_cast<const uint8_t *>(cu_index_)
|
||||
+ 3 * sizeof(uint32));
|
||||
phash_ = cu_index_ + 4 * sizeof(uint32);
|
||||
pindex_ = phash_ + nslots_ * sizeof(uint64);
|
||||
shndx_pool_ = pindex_ + nslots_ * sizeof(uint32);
|
||||
+ 3 * sizeof(uint32_t));
|
||||
phash_ = cu_index_ + 4 * sizeof(uint32_t);
|
||||
pindex_ = phash_ + nslots_ * sizeof(uint64_t);
|
||||
shndx_pool_ = pindex_ + nslots_ * sizeof(uint32_t);
|
||||
if (shndx_pool_ >= cu_index_ + cu_index_size_) {
|
||||
version_ = 0;
|
||||
}
|
||||
} else if (version_ == 2) {
|
||||
ncolumns_ = byte_reader_.ReadFourBytes(
|
||||
reinterpret_cast<const uint8_t *>(cu_index_) + sizeof(uint32));
|
||||
reinterpret_cast<const uint8_t *>(cu_index_) + sizeof(uint32_t));
|
||||
nunits_ = byte_reader_.ReadFourBytes(
|
||||
reinterpret_cast<const uint8_t *>(cu_index_) + 2 * sizeof(uint32));
|
||||
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));
|
||||
phash_ = cu_index_ + 4 * sizeof(uint32);
|
||||
pindex_ = phash_ + nslots_ * sizeof(uint64);
|
||||
offset_table_ = pindex_ + nslots_ * sizeof(uint32);
|
||||
size_table_ = offset_table_ + ncolumns_ * (nunits_ + 1) * sizeof(uint32);
|
||||
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);
|
||||
size_table_ = offset_table_ + ncolumns_ * (nunits_ + 1) * sizeof(uint32_t);
|
||||
abbrev_data_ = elf_reader_->GetSectionByName(".debug_abbrev.dwo",
|
||||
&abbrev_size_);
|
||||
info_data_ = elf_reader_->GetSectionByName(".debug_info.dwo", &info_size_);
|
||||
|
@ -753,7 +753,7 @@ void DwpReader::Initialize() {
|
|||
}
|
||||
}
|
||||
|
||||
void DwpReader::ReadDebugSectionsForCU(uint64 dwo_id,
|
||||
void DwpReader::ReadDebugSectionsForCU(uint64_t dwo_id,
|
||||
SectionMap* sections) {
|
||||
if (version_ == 1) {
|
||||
int slot = LookupCU(dwo_id);
|
||||
|
@ -766,8 +766,8 @@ void DwpReader::ReadDebugSectionsForCU(uint64 dwo_id,
|
|||
// for the CU whose dwo_id we are looking for.
|
||||
int index = byte_reader_.ReadFourBytes(
|
||||
reinterpret_cast<const uint8_t *>(pindex_)
|
||||
+ slot * sizeof(uint32));
|
||||
const char* shndx_list = shndx_pool_ + index * sizeof(uint32);
|
||||
+ slot * sizeof(uint32_t));
|
||||
const char* shndx_list = shndx_pool_ + index * sizeof(uint32_t);
|
||||
for (;;) {
|
||||
if (shndx_list >= cu_index_ + cu_index_size_) {
|
||||
version_ = 0;
|
||||
|
@ -775,7 +775,7 @@ void DwpReader::ReadDebugSectionsForCU(uint64 dwo_id,
|
|||
}
|
||||
unsigned int shndx = byte_reader_.ReadFourBytes(
|
||||
reinterpret_cast<const uint8_t *>(shndx_list));
|
||||
shndx_list += sizeof(uint32);
|
||||
shndx_list += sizeof(uint32_t);
|
||||
if (shndx == 0)
|
||||
break;
|
||||
const char* section_name = elf_reader_->GetSectionName(shndx);
|
||||
|
@ -810,7 +810,7 @@ void DwpReader::ReadDebugSectionsForCU(uint64 dwo_id,
|
|||
std::make_pair(reinterpret_cast<const uint8_t *> (string_buffer_),
|
||||
string_buffer_size_)));
|
||||
} else if (version_ == 2) {
|
||||
uint32 index = LookupCUv2(dwo_id);
|
||||
uint32_t index = LookupCUv2(dwo_id);
|
||||
if (index == 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -823,22 +823,22 @@ void DwpReader::ReadDebugSectionsForCU(uint64 dwo_id,
|
|||
// with row 1.
|
||||
const char* id_row = offset_table_;
|
||||
const char* offset_row = offset_table_
|
||||
+ index * ncolumns_ * sizeof(uint32);
|
||||
+ index * ncolumns_ * sizeof(uint32_t);
|
||||
const char* size_row =
|
||||
size_table_ + (index - 1) * ncolumns_ * sizeof(uint32);
|
||||
if (size_row + ncolumns_ * sizeof(uint32) > cu_index_ + cu_index_size_) {
|
||||
size_table_ + (index - 1) * ncolumns_ * sizeof(uint32_t);
|
||||
if (size_row + ncolumns_ * sizeof(uint32_t) > cu_index_ + cu_index_size_) {
|
||||
version_ = 0;
|
||||
return;
|
||||
}
|
||||
for (unsigned int col = 0u; col < ncolumns_; ++col) {
|
||||
uint32 section_id =
|
||||
uint32_t section_id =
|
||||
byte_reader_.ReadFourBytes(reinterpret_cast<const uint8_t *>(id_row)
|
||||
+ col * sizeof(uint32));
|
||||
uint32 offset = byte_reader_.ReadFourBytes(
|
||||
+ col * sizeof(uint32_t));
|
||||
uint32_t offset = byte_reader_.ReadFourBytes(
|
||||
reinterpret_cast<const uint8_t *>(offset_row)
|
||||
+ col * sizeof(uint32));
|
||||
uint32 size = byte_reader_.ReadFourBytes(
|
||||
reinterpret_cast<const uint8_t *>(size_row) + col * sizeof(uint32));
|
||||
+ col * sizeof(uint32_t));
|
||||
uint32_t size = byte_reader_.ReadFourBytes(
|
||||
reinterpret_cast<const uint8_t *>(size_row) + col * sizeof(uint32_t));
|
||||
if (section_id == DW_SECT_ABBREV) {
|
||||
sections->insert(std::make_pair(
|
||||
".debug_abbrev",
|
||||
|
@ -863,17 +863,17 @@ void DwpReader::ReadDebugSectionsForCU(uint64 dwo_id,
|
|||
}
|
||||
}
|
||||
|
||||
int DwpReader::LookupCU(uint64 dwo_id) {
|
||||
uint32 slot = static_cast<uint32>(dwo_id) & (nslots_ - 1);
|
||||
uint64 probe = byte_reader_.ReadEightBytes(
|
||||
reinterpret_cast<const uint8_t *>(phash_) + slot * sizeof(uint64));
|
||||
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));
|
||||
if (probe != 0 && probe != dwo_id) {
|
||||
uint32 secondary_hash =
|
||||
(static_cast<uint32>(dwo_id >> 32) & (nslots_ - 1)) | 1;
|
||||
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));
|
||||
reinterpret_cast<const uint8_t *>(phash_) + slot * sizeof(uint64_t));
|
||||
} while (probe != 0 && probe != dwo_id);
|
||||
}
|
||||
if (probe == 0)
|
||||
|
@ -881,27 +881,27 @@ int DwpReader::LookupCU(uint64 dwo_id) {
|
|||
return slot;
|
||||
}
|
||||
|
||||
uint32 DwpReader::LookupCUv2(uint64 dwo_id) {
|
||||
uint32 slot = static_cast<uint32>(dwo_id) & (nslots_ - 1);
|
||||
uint64 probe = byte_reader_.ReadEightBytes(
|
||||
reinterpret_cast<const uint8_t *>(phash_) + slot * sizeof(uint64));
|
||||
uint32 index = byte_reader_.ReadFourBytes(
|
||||
reinterpret_cast<const uint8_t *>(pindex_) + slot * sizeof(uint32));
|
||||
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));
|
||||
uint32_t index = byte_reader_.ReadFourBytes(
|
||||
reinterpret_cast<const uint8_t *>(pindex_) + slot * sizeof(uint32_t));
|
||||
if (index != 0 && probe != dwo_id) {
|
||||
uint32 secondary_hash =
|
||||
(static_cast<uint32>(dwo_id >> 32) & (nslots_ - 1)) | 1;
|
||||
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));
|
||||
reinterpret_cast<const uint8_t *>(phash_) + slot * sizeof(uint64_t));
|
||||
index = byte_reader_.ReadFourBytes(
|
||||
reinterpret_cast<const uint8_t *>(pindex_) + slot * sizeof(uint32));
|
||||
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 buffer_length,
|
||||
LineInfo::LineInfo(const uint8_t *buffer, uint64_t buffer_length,
|
||||
ByteReader* reader, LineInfoHandler* handler):
|
||||
handler_(handler), reader_(reader), buffer_(buffer) {
|
||||
#ifndef NDEBUG
|
||||
|
@ -910,7 +910,7 @@ LineInfo::LineInfo(const uint8_t *buffer, uint64 buffer_length,
|
|||
header_.std_opcode_lengths = NULL;
|
||||
}
|
||||
|
||||
uint64 LineInfo::Start() {
|
||||
uint64_t LineInfo::Start() {
|
||||
ReadHeader();
|
||||
ReadLines();
|
||||
return after_header_ - buffer_;
|
||||
|
@ -922,7 +922,7 @@ void LineInfo::ReadHeader() {
|
|||
const uint8_t *lineptr = buffer_;
|
||||
size_t initial_length_size;
|
||||
|
||||
const uint64 initial_length
|
||||
const uint64_t initial_length
|
||||
= reader_->ReadInitialLength(lineptr, &initial_length_size);
|
||||
|
||||
lineptr += initial_length_size;
|
||||
|
@ -943,7 +943,7 @@ void LineInfo::ReadHeader() {
|
|||
lineptr += 1;
|
||||
|
||||
if (header_.version >= 4) {
|
||||
__attribute__((unused)) uint8 max_ops_per_insn =
|
||||
__attribute__((unused)) uint8_t max_ops_per_insn =
|
||||
reader_->ReadOneByte(lineptr);
|
||||
++lineptr;
|
||||
assert(max_ops_per_insn == 1);
|
||||
|
@ -952,7 +952,7 @@ void LineInfo::ReadHeader() {
|
|||
header_.default_is_stmt = reader_->ReadOneByte(lineptr);
|
||||
lineptr += 1;
|
||||
|
||||
header_.line_base = *reinterpret_cast<const int8*>(lineptr);
|
||||
header_.line_base = *reinterpret_cast<const int8_t*>(lineptr);
|
||||
lineptr += 1;
|
||||
|
||||
header_.line_range = reader_->ReadOneByte(lineptr);
|
||||
|
@ -971,7 +971,7 @@ void LineInfo::ReadHeader() {
|
|||
|
||||
// It is legal for the directory entry table to be empty.
|
||||
if (*lineptr) {
|
||||
uint32 dirindex = 1;
|
||||
uint32_t dirindex = 1;
|
||||
while (*lineptr) {
|
||||
const char *dirname = reinterpret_cast<const char *>(lineptr);
|
||||
handler_->DefineDir(dirname, dirindex);
|
||||
|
@ -983,21 +983,21 @@ void LineInfo::ReadHeader() {
|
|||
|
||||
// It is also legal for the file entry table to be empty.
|
||||
if (*lineptr) {
|
||||
uint32 fileindex = 1;
|
||||
uint32_t fileindex = 1;
|
||||
size_t len;
|
||||
while (*lineptr) {
|
||||
const char *filename = reinterpret_cast<const char *>(lineptr);
|
||||
lineptr += strlen(filename) + 1;
|
||||
|
||||
uint64 dirindex = reader_->ReadUnsignedLEB128(lineptr, &len);
|
||||
uint64_t dirindex = reader_->ReadUnsignedLEB128(lineptr, &len);
|
||||
lineptr += len;
|
||||
|
||||
uint64 mod_time = reader_->ReadUnsignedLEB128(lineptr, &len);
|
||||
uint64_t mod_time = reader_->ReadUnsignedLEB128(lineptr, &len);
|
||||
lineptr += len;
|
||||
|
||||
uint64 filelength = reader_->ReadUnsignedLEB128(lineptr, &len);
|
||||
uint64_t filelength = reader_->ReadUnsignedLEB128(lineptr, &len);
|
||||
lineptr += len;
|
||||
handler_->DefineFile(filename, fileindex, static_cast<uint32>(dirindex),
|
||||
handler_->DefineFile(filename, fileindex, static_cast<uint32_t>(dirindex),
|
||||
mod_time, filelength);
|
||||
fileindex++;
|
||||
}
|
||||
|
@ -1018,7 +1018,7 @@ bool LineInfo::ProcessOneOpcode(ByteReader* reader,
|
|||
bool *lsm_passes_pc) {
|
||||
size_t oplen = 0;
|
||||
size_t templen;
|
||||
uint8 opcode = reader->ReadOneByte(start);
|
||||
uint8_t opcode = reader->ReadOneByte(start);
|
||||
oplen++;
|
||||
start++;
|
||||
|
||||
|
@ -1026,9 +1026,9 @@ bool LineInfo::ProcessOneOpcode(ByteReader* reader,
|
|||
// opcode. Most line programs consist mainly of special opcodes.
|
||||
if (opcode >= header.opcode_base) {
|
||||
opcode -= header.opcode_base;
|
||||
const int64 advance_address = (opcode / header.line_range)
|
||||
const int64_t advance_address = (opcode / header.line_range)
|
||||
* header.min_insn_length;
|
||||
const int32 advance_line = (opcode % header.line_range)
|
||||
const int32_t advance_line = (opcode % header.line_range)
|
||||
+ header.line_base;
|
||||
|
||||
// Check if the lsm passes "pc". If so, mark it as passed.
|
||||
|
@ -1053,7 +1053,7 @@ bool LineInfo::ProcessOneOpcode(ByteReader* reader,
|
|||
}
|
||||
|
||||
case DW_LNS_advance_pc: {
|
||||
uint64 advance_address = reader->ReadUnsignedLEB128(start, &templen);
|
||||
uint64_t advance_address = reader->ReadUnsignedLEB128(start, &templen);
|
||||
oplen += templen;
|
||||
|
||||
// Check if the lsm passes "pc". If so, mark it as passed.
|
||||
|
@ -1066,9 +1066,9 @@ bool LineInfo::ProcessOneOpcode(ByteReader* reader,
|
|||
}
|
||||
break;
|
||||
case DW_LNS_advance_line: {
|
||||
const int64 advance_line = reader->ReadSignedLEB128(start, &templen);
|
||||
const int64_t advance_line = reader->ReadSignedLEB128(start, &templen);
|
||||
oplen += templen;
|
||||
lsm->line_num += static_cast<int32>(advance_line);
|
||||
lsm->line_num += static_cast<int32_t>(advance_line);
|
||||
|
||||
// With gcc 4.2.1, we can get the line_no here for the first time
|
||||
// since DW_LNS_advance_line is called after DW_LNE_set_address is
|
||||
|
@ -1080,15 +1080,15 @@ bool LineInfo::ProcessOneOpcode(ByteReader* reader,
|
|||
}
|
||||
break;
|
||||
case DW_LNS_set_file: {
|
||||
const uint64 fileno = reader->ReadUnsignedLEB128(start, &templen);
|
||||
const uint64_t fileno = reader->ReadUnsignedLEB128(start, &templen);
|
||||
oplen += templen;
|
||||
lsm->file_num = static_cast<uint32>(fileno);
|
||||
lsm->file_num = static_cast<uint32_t>(fileno);
|
||||
}
|
||||
break;
|
||||
case DW_LNS_set_column: {
|
||||
const uint64 colno = reader->ReadUnsignedLEB128(start, &templen);
|
||||
const uint64_t colno = reader->ReadUnsignedLEB128(start, &templen);
|
||||
oplen += templen;
|
||||
lsm->column_num = static_cast<uint32>(colno);
|
||||
lsm->column_num = static_cast<uint32_t>(colno);
|
||||
}
|
||||
break;
|
||||
case DW_LNS_negate_stmt: {
|
||||
|
@ -1100,7 +1100,7 @@ bool LineInfo::ProcessOneOpcode(ByteReader* reader,
|
|||
}
|
||||
break;
|
||||
case DW_LNS_fixed_advance_pc: {
|
||||
const uint16 advance_address = reader->ReadTwoBytes(start);
|
||||
const uint16_t advance_address = reader->ReadTwoBytes(start);
|
||||
oplen += 2;
|
||||
|
||||
// Check if the lsm passes "pc". If so, mark it as passed.
|
||||
|
@ -1113,7 +1113,7 @@ bool LineInfo::ProcessOneOpcode(ByteReader* reader,
|
|||
}
|
||||
break;
|
||||
case DW_LNS_const_add_pc: {
|
||||
const int64 advance_address = header.min_insn_length
|
||||
const int64_t advance_address = header.min_insn_length
|
||||
* ((255 - header.opcode_base)
|
||||
/ header.line_range);
|
||||
|
||||
|
@ -1127,12 +1127,12 @@ bool LineInfo::ProcessOneOpcode(ByteReader* reader,
|
|||
}
|
||||
break;
|
||||
case DW_LNS_extended_op: {
|
||||
const uint64 extended_op_len = reader->ReadUnsignedLEB128(start,
|
||||
const uint64_t extended_op_len = reader->ReadUnsignedLEB128(start,
|
||||
&templen);
|
||||
start += templen;
|
||||
oplen += templen + extended_op_len;
|
||||
|
||||
const uint64 extended_op = reader->ReadOneByte(start);
|
||||
const uint64_t extended_op = reader->ReadOneByte(start);
|
||||
start++;
|
||||
|
||||
switch (extended_op) {
|
||||
|
@ -1147,7 +1147,7 @@ bool LineInfo::ProcessOneOpcode(ByteReader* reader,
|
|||
// DW_LNE_set_address is called before DW_LNS_advance_line is
|
||||
// called. So we do not check if the lsm passes "pc" here. See
|
||||
// also the comment in DW_LNS_advance_line.
|
||||
uint64 address = reader->ReadAddress(start);
|
||||
uint64_t address = reader->ReadAddress(start);
|
||||
lsm->address = address;
|
||||
}
|
||||
break;
|
||||
|
@ -1157,19 +1157,19 @@ bool LineInfo::ProcessOneOpcode(ByteReader* reader,
|
|||
templen = strlen(filename) + 1;
|
||||
start += templen;
|
||||
|
||||
uint64 dirindex = reader->ReadUnsignedLEB128(start, &templen);
|
||||
uint64_t dirindex = reader->ReadUnsignedLEB128(start, &templen);
|
||||
oplen += templen;
|
||||
|
||||
const uint64 mod_time = reader->ReadUnsignedLEB128(start,
|
||||
const uint64_t mod_time = reader->ReadUnsignedLEB128(start,
|
||||
&templen);
|
||||
oplen += templen;
|
||||
|
||||
const uint64 filelength = reader->ReadUnsignedLEB128(start,
|
||||
const uint64_t filelength = reader->ReadUnsignedLEB128(start,
|
||||
&templen);
|
||||
oplen += templen;
|
||||
|
||||
if (handler) {
|
||||
handler->DefineFile(filename, -1, static_cast<uint32>(dirindex),
|
||||
handler->DefineFile(filename, -1, static_cast<uint32_t>(dirindex),
|
||||
mod_time, filelength);
|
||||
}
|
||||
}
|
||||
|
@ -1217,8 +1217,8 @@ void LineInfo::ReadLines() {
|
|||
// from the next address. So we report a line only when we get the
|
||||
// next line's address, or the end-of-sequence address.
|
||||
bool have_pending_line = false;
|
||||
uint64 pending_address = 0;
|
||||
uint32 pending_file_num = 0, pending_line_num = 0, pending_column_num = 0;
|
||||
uint64_t pending_address = 0;
|
||||
uint32_t pending_file_num = 0, pending_line_num = 0, pending_column_num = 0;
|
||||
|
||||
while (lineptr < lengthstart + header_.total_length) {
|
||||
size_t oplength;
|
||||
|
@ -1247,15 +1247,15 @@ void LineInfo::ReadLines() {
|
|||
after_header_ = lengthstart + header_.total_length;
|
||||
}
|
||||
|
||||
RangeListReader::RangeListReader(const uint8_t *buffer, uint64 size,
|
||||
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 offset) {
|
||||
const uint64 max_address =
|
||||
bool RangeListReader::ReadRangeList(uint64_t offset) {
|
||||
const uint64_t max_address =
|
||||
(reader_->AddressSize() == 4) ? 0xffffffffUL
|
||||
: 0xffffffffffffffffULL;
|
||||
const uint64 entry_size = reader_->AddressSize() * 2;
|
||||
const uint64_t entry_size = reader_->AddressSize() * 2;
|
||||
bool list_end = false;
|
||||
|
||||
do {
|
||||
|
@ -1263,8 +1263,8 @@ bool RangeListReader::ReadRangeList(uint64 offset) {
|
|||
return false; // Invalid range detected
|
||||
}
|
||||
|
||||
uint64 start_address = reader_->ReadAddress(buffer_ + offset);
|
||||
uint64 end_address =
|
||||
uint64_t start_address = reader_->ReadAddress(buffer_ + offset);
|
||||
uint64_t end_address =
|
||||
reader_->ReadAddress(buffer_ + offset + reader_->AddressSize());
|
||||
|
||||
if (start_address == max_address) { // Base address selection
|
||||
|
@ -1305,7 +1305,7 @@ class CallFrameInfo::Rule {
|
|||
// the canonical frame address. Return what the HANDLER member function
|
||||
// returned.
|
||||
virtual bool Handle(Handler *handler,
|
||||
uint64 address, int reg) const = 0;
|
||||
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.
|
||||
|
@ -1330,7 +1330,7 @@ class CallFrameInfo::UndefinedRule: public CallFrameInfo::Rule {
|
|||
public:
|
||||
UndefinedRule() { }
|
||||
~UndefinedRule() { }
|
||||
bool Handle(Handler *handler, uint64 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 {
|
||||
|
@ -1347,7 +1347,7 @@ class CallFrameInfo::SameValueRule: public CallFrameInfo::Rule {
|
|||
public:
|
||||
SameValueRule() { }
|
||||
~SameValueRule() { }
|
||||
bool Handle(Handler *handler, uint64 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 {
|
||||
|
@ -1366,7 +1366,7 @@ class CallFrameInfo::OffsetRule: public CallFrameInfo::Rule {
|
|||
OffsetRule(int base_register, long offset)
|
||||
: base_register_(base_register), offset_(offset) { }
|
||||
~OffsetRule() { }
|
||||
bool Handle(Handler *handler, uint64 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 {
|
||||
|
@ -1395,7 +1395,7 @@ class CallFrameInfo::ValOffsetRule: public CallFrameInfo::Rule {
|
|||
ValOffsetRule(int base_register, long offset)
|
||||
: base_register_(base_register), offset_(offset) { }
|
||||
~ValOffsetRule() { }
|
||||
bool Handle(Handler *handler, uint64 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 {
|
||||
|
@ -1420,7 +1420,7 @@ class CallFrameInfo::RegisterRule: public CallFrameInfo::Rule {
|
|||
explicit RegisterRule(int register_number)
|
||||
: register_number_(register_number) { }
|
||||
~RegisterRule() { }
|
||||
bool Handle(Handler *handler, uint64 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 {
|
||||
|
@ -1440,7 +1440,7 @@ class CallFrameInfo::ExpressionRule: public CallFrameInfo::Rule {
|
|||
explicit ExpressionRule(const string &expression)
|
||||
: expression_(expression) { }
|
||||
~ExpressionRule() { }
|
||||
bool Handle(Handler *handler, uint64 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 {
|
||||
|
@ -1460,7 +1460,7 @@ class CallFrameInfo::ValExpressionRule: public CallFrameInfo::Rule {
|
|||
explicit ValExpressionRule(const string &expression)
|
||||
: expression_(expression) { }
|
||||
~ValExpressionRule() { }
|
||||
bool Handle(Handler *handler, uint64 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 {
|
||||
|
@ -1504,7 +1504,7 @@ class CallFrameInfo::RuleMap {
|
|||
// 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 address,
|
||||
bool HandleTransitionTo(Handler *handler, uint64_t address,
|
||||
const RuleMap &new_rules) const;
|
||||
|
||||
private:
|
||||
|
@ -1552,7 +1552,7 @@ void CallFrameInfo::RuleMap::SetRegisterRule(int reg, Rule *rule) {
|
|||
|
||||
bool CallFrameInfo::RuleMap::HandleTransitionTo(
|
||||
Handler *handler,
|
||||
uint64 address,
|
||||
uint64_t address,
|
||||
const RuleMap &new_rules) const {
|
||||
// Transition from cfa_rule_ to new_rules.cfa_rule_.
|
||||
if (cfa_rule_ && new_rules.cfa_rule_) {
|
||||
|
@ -1634,7 +1634,7 @@ class CallFrameInfo::State {
|
|||
// 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,
|
||||
uint64 address)
|
||||
uint64_t address)
|
||||
: reader_(reader), handler_(handler), reporter_(reporter),
|
||||
address_(address), entry_(NULL), cursor_(NULL) { }
|
||||
|
||||
|
@ -1651,7 +1651,7 @@ class CallFrameInfo::State {
|
|||
// The operands of a CFI instruction, for ParseOperands.
|
||||
struct Operands {
|
||||
unsigned register_number; // A register number.
|
||||
uint64 offset; // An offset or address.
|
||||
uint64_t offset; // An offset or address.
|
||||
long signed_offset; // A signed offset.
|
||||
string expression; // A DWARF expression.
|
||||
};
|
||||
|
@ -1717,7 +1717,7 @@ class CallFrameInfo::State {
|
|||
|
||||
// Return the section offset of the instruction at cursor. For use
|
||||
// in error messages.
|
||||
uint64 CursorOffset() { return entry_->offset + (cursor_ - entry_->start); }
|
||||
uint64_t CursorOffset() { return entry_->offset + (cursor_ - entry_->start); }
|
||||
|
||||
// Report that entry_ is incomplete, and return false. For brevity.
|
||||
bool ReportIncomplete() {
|
||||
|
@ -1735,7 +1735,7 @@ class CallFrameInfo::State {
|
|||
Reporter *reporter_;
|
||||
|
||||
// The code address to which the next instruction in the stream applies.
|
||||
uint64 address_;
|
||||
uint64_t address_;
|
||||
|
||||
// The entry whose instructions we are currently processing. This is
|
||||
// first a CIE, and then an FDE.
|
||||
|
@ -2205,7 +2205,7 @@ bool CallFrameInfo::ReadEntryPrologue(const uint8_t *cursor, Entry *entry) {
|
|||
|
||||
// Read the initial length. This sets reader_'s offset size.
|
||||
size_t length_size;
|
||||
uint64 length = reader_->ReadInitialLength(cursor, &length_size);
|
||||
uint64_t length = reader_->ReadInitialLength(cursor, &length_size);
|
||||
if (length_size > size_t(buffer_end - cursor))
|
||||
return ReportIncomplete(entry);
|
||||
cursor += length_size;
|
||||
|
@ -2357,7 +2357,7 @@ bool CallFrameInfo::ReadCIEFields(CIE *cie) {
|
|||
// a ULEB128 in version 3.
|
||||
if (cie->version == 1) {
|
||||
if (cursor >= cie->end) return ReportIncomplete(cie);
|
||||
cie->return_address_register = uint8(*cursor++);
|
||||
cie->return_address_register = uint8_t(*cursor++);
|
||||
} else {
|
||||
cie->return_address_register = reader_->ReadUnsignedLEB128(cursor, &len);
|
||||
if (size_t(cie->end - cursor) < len) return ReportIncomplete(cie);
|
||||
|
@ -2683,7 +2683,7 @@ bool CallFrameInfo::ReportIncomplete(Entry *entry) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void CallFrameInfo::Reporter::Incomplete(uint64 offset,
|
||||
void CallFrameInfo::Reporter::Incomplete(uint64_t offset,
|
||||
CallFrameInfo::EntryKind kind) {
|
||||
fprintf(stderr,
|
||||
"%s: CFI %s at offset 0x%llx in '%s': entry ends early\n",
|
||||
|
@ -2691,29 +2691,29 @@ void CallFrameInfo::Reporter::Incomplete(uint64 offset,
|
|||
section_.c_str());
|
||||
}
|
||||
|
||||
void CallFrameInfo::Reporter::EarlyEHTerminator(uint64 offset) {
|
||||
void CallFrameInfo::Reporter::EarlyEHTerminator(uint64_t offset) {
|
||||
fprintf(stderr,
|
||||
"%s: CFI at offset 0x%llx in '%s': saw end-of-data marker"
|
||||
" before end of section contents\n",
|
||||
filename_.c_str(), offset, section_.c_str());
|
||||
}
|
||||
|
||||
void CallFrameInfo::Reporter::CIEPointerOutOfRange(uint64 offset,
|
||||
uint64 cie_offset) {
|
||||
void CallFrameInfo::Reporter::CIEPointerOutOfRange(uint64_t offset,
|
||||
uint64_t cie_offset) {
|
||||
fprintf(stderr,
|
||||
"%s: CFI frame description entry at offset 0x%llx in '%s':"
|
||||
" CIE pointer is out of range: 0x%llx\n",
|
||||
filename_.c_str(), offset, section_.c_str(), cie_offset);
|
||||
}
|
||||
|
||||
void CallFrameInfo::Reporter::BadCIEId(uint64 offset, uint64 cie_offset) {
|
||||
void CallFrameInfo::Reporter::BadCIEId(uint64_t offset, uint64_t cie_offset) {
|
||||
fprintf(stderr,
|
||||
"%s: CFI frame description entry at offset 0x%llx in '%s':"
|
||||
" CIE pointer does not point to a CIE: 0x%llx\n",
|
||||
filename_.c_str(), offset, section_.c_str(), cie_offset);
|
||||
}
|
||||
|
||||
void CallFrameInfo::Reporter::UnexpectedAddressSize(uint64 offset,
|
||||
void CallFrameInfo::Reporter::UnexpectedAddressSize(uint64_t offset,
|
||||
uint8_t address_size) {
|
||||
fprintf(stderr,
|
||||
"%s: CFI frame description entry at offset 0x%llx in '%s':"
|
||||
|
@ -2721,7 +2721,7 @@ void CallFrameInfo::Reporter::UnexpectedAddressSize(uint64 offset,
|
|||
filename_.c_str(), offset, section_.c_str(), address_size);
|
||||
}
|
||||
|
||||
void CallFrameInfo::Reporter::UnexpectedSegmentSize(uint64 offset,
|
||||
void CallFrameInfo::Reporter::UnexpectedSegmentSize(uint64_t offset,
|
||||
uint8_t segment_size) {
|
||||
fprintf(stderr,
|
||||
"%s: CFI frame description entry at offset 0x%llx in '%s':"
|
||||
|
@ -2729,14 +2729,14 @@ void CallFrameInfo::Reporter::UnexpectedSegmentSize(uint64 offset,
|
|||
filename_.c_str(), offset, section_.c_str(), segment_size);
|
||||
}
|
||||
|
||||
void CallFrameInfo::Reporter::UnrecognizedVersion(uint64 offset, int version) {
|
||||
void CallFrameInfo::Reporter::UnrecognizedVersion(uint64_t offset, int version) {
|
||||
fprintf(stderr,
|
||||
"%s: CFI frame description entry at offset 0x%llx in '%s':"
|
||||
" CIE specifies unrecognized version: %d\n",
|
||||
filename_.c_str(), offset, section_.c_str(), version);
|
||||
}
|
||||
|
||||
void CallFrameInfo::Reporter::UnrecognizedAugmentation(uint64 offset,
|
||||
void CallFrameInfo::Reporter::UnrecognizedAugmentation(uint64_t offset,
|
||||
const string &aug) {
|
||||
fprintf(stderr,
|
||||
"%s: CFI frame description entry at offset 0x%llx in '%s':"
|
||||
|
@ -2744,16 +2744,16 @@ void CallFrameInfo::Reporter::UnrecognizedAugmentation(uint64 offset,
|
|||
filename_.c_str(), offset, section_.c_str(), aug.c_str());
|
||||
}
|
||||
|
||||
void CallFrameInfo::Reporter::InvalidPointerEncoding(uint64 offset,
|
||||
uint8 encoding) {
|
||||
void CallFrameInfo::Reporter::InvalidPointerEncoding(uint64_t offset,
|
||||
uint8_t encoding) {
|
||||
fprintf(stderr,
|
||||
"%s: CFI common information entry at offset 0x%llx in '%s':"
|
||||
" 'z' augmentation specifies invalid pointer encoding: 0x%02x\n",
|
||||
filename_.c_str(), offset, section_.c_str(), encoding);
|
||||
}
|
||||
|
||||
void CallFrameInfo::Reporter::UnusablePointerEncoding(uint64 offset,
|
||||
uint8 encoding) {
|
||||
void CallFrameInfo::Reporter::UnusablePointerEncoding(uint64_t offset,
|
||||
uint8_t encoding) {
|
||||
fprintf(stderr,
|
||||
"%s: CFI common information entry at offset 0x%llx in '%s':"
|
||||
" 'z' augmentation specifies a pointer encoding for which"
|
||||
|
@ -2761,7 +2761,7 @@ void CallFrameInfo::Reporter::UnusablePointerEncoding(uint64 offset,
|
|||
filename_.c_str(), offset, section_.c_str(), encoding);
|
||||
}
|
||||
|
||||
void CallFrameInfo::Reporter::RestoreInCIE(uint64 offset, uint64 insn_offset) {
|
||||
void CallFrameInfo::Reporter::RestoreInCIE(uint64_t offset, uint64_t insn_offset) {
|
||||
fprintf(stderr,
|
||||
"%s: CFI common information entry at offset 0x%llx in '%s':"
|
||||
" the DW_CFA_restore instruction at offset 0x%llx"
|
||||
|
@ -2769,9 +2769,9 @@ void CallFrameInfo::Reporter::RestoreInCIE(uint64 offset, uint64 insn_offset) {
|
|||
filename_.c_str(), offset, section_.c_str(), insn_offset);
|
||||
}
|
||||
|
||||
void CallFrameInfo::Reporter::BadInstruction(uint64 offset,
|
||||
void CallFrameInfo::Reporter::BadInstruction(uint64_t offset,
|
||||
CallFrameInfo::EntryKind kind,
|
||||
uint64 insn_offset) {
|
||||
uint64_t insn_offset) {
|
||||
fprintf(stderr,
|
||||
"%s: CFI %s at offset 0x%llx in section '%s':"
|
||||
" the instruction at offset 0x%llx is unrecognized\n",
|
||||
|
@ -2779,9 +2779,9 @@ void CallFrameInfo::Reporter::BadInstruction(uint64 offset,
|
|||
offset, section_.c_str(), insn_offset);
|
||||
}
|
||||
|
||||
void CallFrameInfo::Reporter::NoCFARule(uint64 offset,
|
||||
void CallFrameInfo::Reporter::NoCFARule(uint64_t offset,
|
||||
CallFrameInfo::EntryKind kind,
|
||||
uint64 insn_offset) {
|
||||
uint64_t insn_offset) {
|
||||
fprintf(stderr,
|
||||
"%s: CFI %s at offset 0x%llx in section '%s':"
|
||||
" the instruction at offset 0x%llx assumes that a CFA rule has"
|
||||
|
@ -2790,9 +2790,9 @@ void CallFrameInfo::Reporter::NoCFARule(uint64 offset,
|
|||
section_.c_str(), insn_offset);
|
||||
}
|
||||
|
||||
void CallFrameInfo::Reporter::EmptyStateStack(uint64 offset,
|
||||
void CallFrameInfo::Reporter::EmptyStateStack(uint64_t offset,
|
||||
CallFrameInfo::EntryKind kind,
|
||||
uint64 insn_offset) {
|
||||
uint64_t insn_offset) {
|
||||
fprintf(stderr,
|
||||
"%s: CFI %s at offset 0x%llx in section '%s':"
|
||||
" the DW_CFA_restore_state instruction at offset 0x%llx"
|
||||
|
@ -2801,9 +2801,9 @@ void CallFrameInfo::Reporter::EmptyStateStack(uint64 offset,
|
|||
section_.c_str(), insn_offset);
|
||||
}
|
||||
|
||||
void CallFrameInfo::Reporter::ClearingCFARule(uint64 offset,
|
||||
void CallFrameInfo::Reporter::ClearingCFARule(uint64_t offset,
|
||||
CallFrameInfo::EntryKind kind,
|
||||
uint64 insn_offset) {
|
||||
uint64_t insn_offset) {
|
||||
fprintf(stderr,
|
||||
"%s: CFI %s at offset 0x%llx in section '%s':"
|
||||
" the DW_CFA_restore_state instruction at offset 0x%llx"
|
||||
|
|
|
@ -63,21 +63,21 @@ 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> > SectionMap;
|
||||
typedef std::map<string, std::pair<const uint8_t *, uint64_t> > SectionMap;
|
||||
typedef std::list<std::pair<enum DwarfAttribute, enum DwarfForm> >
|
||||
AttributeList;
|
||||
typedef AttributeList::iterator AttributeIterator;
|
||||
typedef AttributeList::const_iterator ConstAttributeIterator;
|
||||
|
||||
struct LineInfoHeader {
|
||||
uint64 total_length;
|
||||
uint16 version;
|
||||
uint64 prologue_length;
|
||||
uint8 min_insn_length; // insn stands for instructin
|
||||
uint64_t total_length;
|
||||
uint16_t version;
|
||||
uint64_t prologue_length;
|
||||
uint8_t min_insn_length; // insn stands for instructin
|
||||
bool default_is_stmt; // stmt stands for statement
|
||||
int8 line_base;
|
||||
uint8 line_range;
|
||||
uint8 opcode_base;
|
||||
int8_t line_base;
|
||||
uint8_t line_range;
|
||||
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;
|
||||
|
@ -90,7 +90,7 @@ class LineInfo {
|
|||
// to the beginning and length of the line information to read.
|
||||
// Reader is a ByteReader class that has the endianness set
|
||||
// properly.
|
||||
LineInfo(const uint8_t *buffer_, uint64 buffer_length,
|
||||
LineInfo(const uint8_t *buffer_, uint64_t buffer_length,
|
||||
ByteReader* reader, LineInfoHandler* handler);
|
||||
|
||||
virtual ~LineInfo() {
|
||||
|
@ -102,7 +102,7 @@ class LineInfo {
|
|||
// Start processing line info, and calling callbacks in the handler.
|
||||
// Consumes the line number information for a single compilation unit.
|
||||
// Returns the number of bytes processed.
|
||||
uint64 Start();
|
||||
uint64_t Start();
|
||||
|
||||
// Process a single line info opcode at START using the state
|
||||
// machine at LSM. Return true if we should define a line using the
|
||||
|
@ -146,7 +146,7 @@ class LineInfo {
|
|||
// the end of the line information header.
|
||||
const uint8_t *buffer_;
|
||||
#ifndef NDEBUG
|
||||
uint64 buffer_length_;
|
||||
uint64_t buffer_length_;
|
||||
#endif
|
||||
const uint8_t *after_header_;
|
||||
};
|
||||
|
@ -164,7 +164,7 @@ class LineInfoHandler {
|
|||
|
||||
// Called when we define a directory. NAME is the directory name,
|
||||
// DIR_NUM is the directory number
|
||||
virtual void DefineDir(const string& name, uint32 dir_num) { }
|
||||
virtual void DefineDir(const string& name, uint32_t dir_num) { }
|
||||
|
||||
// Called when we define a filename. NAME is the filename, FILE_NUM
|
||||
// is the file number which is -1 if the file index is the next
|
||||
|
@ -173,9 +173,9 @@ class LineInfoHandler {
|
|||
// directory index for the directory name of this file, MOD_TIME is
|
||||
// the modification time of the file, and LENGTH is the length of
|
||||
// the file
|
||||
virtual void DefineFile(const string& name, int32 file_num,
|
||||
uint32 dir_num, uint64 mod_time,
|
||||
uint64 length) { }
|
||||
virtual void DefineFile(const string& name, int32_t file_num,
|
||||
uint32_t dir_num, uint64_t mod_time,
|
||||
uint64_t length) { }
|
||||
|
||||
// Called when the line info reader has a new line, address pair
|
||||
// ready for us. ADDRESS is the address of the code, LENGTH is the
|
||||
|
@ -183,8 +183,8 @@ class LineInfoHandler {
|
|||
// containing the code, LINE_NUM is the line number in that file for
|
||||
// the code, and COLUMN_NUM is the column number the code starts at,
|
||||
// if we know it (0 otherwise).
|
||||
virtual void AddLine(uint64 address, uint64 length,
|
||||
uint32 file_num, uint32 line_num, uint32 column_num) { }
|
||||
virtual void AddLine(uint64_t address, uint64_t length,
|
||||
uint32_t file_num, uint32_t line_num, uint32_t column_num) { }
|
||||
};
|
||||
|
||||
class RangeListHandler {
|
||||
|
@ -194,10 +194,10 @@ class RangeListHandler {
|
|||
virtual ~RangeListHandler() { }
|
||||
|
||||
// Add a range.
|
||||
virtual void AddRange(uint64 begin, uint64 end) { };
|
||||
virtual void AddRange(uint64_t begin, uint64_t end) { };
|
||||
|
||||
// A new base address must be set for computing the ranges' addresses.
|
||||
virtual void SetBaseAddress(uint64 base_address) { };
|
||||
virtual void SetBaseAddress(uint64_t base_address) { };
|
||||
|
||||
// Finish processing the range list.
|
||||
virtual void Finish() { };
|
||||
|
@ -205,14 +205,14 @@ class RangeListHandler {
|
|||
|
||||
class RangeListReader {
|
||||
public:
|
||||
RangeListReader(const uint8_t *buffer, uint64 size, ByteReader *reader,
|
||||
RangeListReader(const uint8_t *buffer, uint64_t size, ByteReader *reader,
|
||||
RangeListHandler *handler);
|
||||
|
||||
bool ReadRangeList(uint64 offset);
|
||||
bool ReadRangeList(uint64_t offset);
|
||||
|
||||
private:
|
||||
const uint8_t *buffer_;
|
||||
uint64 size_;
|
||||
uint64_t size_;
|
||||
ByteReader* reader_;
|
||||
RangeListHandler *handler_;
|
||||
};
|
||||
|
@ -230,9 +230,9 @@ class Dwarf2Handler {
|
|||
// Start to process a compilation unit at OFFSET from the beginning of the
|
||||
// .debug_info section. Return false if you would like to skip this
|
||||
// compilation unit.
|
||||
virtual bool StartCompilationUnit(uint64 offset, uint8 address_size,
|
||||
uint8 offset_size, uint64 cu_length,
|
||||
uint8 dwarf_version) { return false; }
|
||||
virtual bool StartCompilationUnit(uint64_t offset, uint8_t address_size,
|
||||
uint8_t offset_size, uint64_t cu_length,
|
||||
uint8_t dwarf_version) { return false; }
|
||||
|
||||
// When processing a skeleton compilation unit, resulting from a split
|
||||
// DWARF compilation, once the skeleton debug info has been read,
|
||||
|
@ -244,40 +244,40 @@ class Dwarf2Handler {
|
|||
// Start to process a split compilation unit at OFFSET from the beginning of
|
||||
// the debug_info section in the .dwp/.dwo file. Return false if you would
|
||||
// like to skip this compilation unit.
|
||||
virtual bool StartSplitCompilationUnit(uint64 offset,
|
||||
uint64 cu_length) { return false; }
|
||||
virtual bool StartSplitCompilationUnit(uint64_t offset,
|
||||
uint64_t cu_length) { return false; }
|
||||
|
||||
// Start to process a DIE at OFFSET from the beginning of the .debug_info
|
||||
// section. Return false if you would like to skip this DIE.
|
||||
virtual bool StartDIE(uint64 offset, enum DwarfTag tag) { return false; }
|
||||
virtual bool StartDIE(uint64_t offset, enum DwarfTag tag) { return false; }
|
||||
|
||||
// Called when we have an attribute with unsigned data to give to our
|
||||
// handler. The attribute is for the DIE at OFFSET from the beginning of the
|
||||
// .debug_info section. Its name is ATTR, its form is FORM, and its value is
|
||||
// DATA.
|
||||
virtual void ProcessAttributeUnsigned(uint64 offset,
|
||||
virtual void ProcessAttributeUnsigned(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data) { }
|
||||
uint64_t data) { }
|
||||
|
||||
// Called when we have an attribute with signed data to give to our handler.
|
||||
// The attribute is for the DIE at OFFSET from the beginning of the
|
||||
// .debug_info section. Its name is ATTR, its form is FORM, and its value is
|
||||
// DATA.
|
||||
virtual void ProcessAttributeSigned(uint64 offset,
|
||||
virtual void ProcessAttributeSigned(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
int64 data) { }
|
||||
int64_t data) { }
|
||||
|
||||
// Called when we have an attribute whose value is a reference to
|
||||
// another DIE. The attribute belongs to the DIE at OFFSET from the
|
||||
// beginning of the .debug_info section. Its name is ATTR, its form
|
||||
// is FORM, and the offset of the DIE being referred to from the
|
||||
// beginning of the .debug_info section is DATA.
|
||||
virtual void ProcessAttributeReference(uint64 offset,
|
||||
virtual void ProcessAttributeReference(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data) { }
|
||||
uint64_t data) { }
|
||||
|
||||
// Called when we have an attribute with a buffer of data to give to our
|
||||
// handler. The attribute is for the DIE at OFFSET from the beginning of the
|
||||
|
@ -285,17 +285,17 @@ class Dwarf2Handler {
|
|||
// the buffer's contents, and its length in bytes is LENGTH. The buffer is
|
||||
// owned by the caller, not the callee, and may not persist for very long.
|
||||
// If you want the data to be available later, it needs to be copied.
|
||||
virtual void ProcessAttributeBuffer(uint64 offset,
|
||||
virtual void ProcessAttributeBuffer(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
const uint8_t *data,
|
||||
uint64 len) { }
|
||||
uint64_t len) { }
|
||||
|
||||
// Called when we have an attribute with string data to give to our handler.
|
||||
// The attribute is for the DIE at OFFSET from the beginning of the
|
||||
// .debug_info section. Its name is ATTR, its form is FORM, and its value is
|
||||
// DATA.
|
||||
virtual void ProcessAttributeString(uint64 offset,
|
||||
virtual void ProcessAttributeString(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
const string& data) { }
|
||||
|
@ -304,16 +304,16 @@ class Dwarf2Handler {
|
|||
// of a type unit in the .debug_types section. OFFSET is the offset of
|
||||
// the DIE whose attribute we're reporting. ATTR and FORM are the
|
||||
// attribute's name and form. SIGNATURE is the type unit's signature.
|
||||
virtual void ProcessAttributeSignature(uint64 offset,
|
||||
virtual void ProcessAttributeSignature(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 signature) { }
|
||||
uint64_t signature) { }
|
||||
|
||||
// Called when finished processing the DIE at OFFSET.
|
||||
// Because DWARF2/3 specifies a tree of DIEs, you may get starts
|
||||
// before ends of the previous DIE, as we process children before
|
||||
// ending the parent.
|
||||
virtual void EndDIE(uint64 offset) { }
|
||||
virtual void EndDIE(uint64_t offset) { }
|
||||
|
||||
};
|
||||
|
||||
|
@ -358,8 +358,8 @@ class CompilationUnit {
|
|||
// Initialize a compilation unit. This requires a map of sections,
|
||||
// the offset of this compilation unit in the .debug_info section, a
|
||||
// ByteReader, and a Dwarf2Handler class to call callbacks in.
|
||||
CompilationUnit(const string& path, const SectionMap& sections, uint64 offset,
|
||||
ByteReader* reader, Dwarf2Handler* handler);
|
||||
CompilationUnit(const string& path, const SectionMap& sections,
|
||||
uint64_t offset, ByteReader* reader, Dwarf2Handler* handler);
|
||||
virtual ~CompilationUnit() {
|
||||
if (abbrevs_) delete abbrevs_;
|
||||
}
|
||||
|
@ -370,8 +370,8 @@ class CompilationUnit {
|
|||
// compilation unit. We also inherit the Dwarf2Handler from
|
||||
// the executable file, and call it as if we were still
|
||||
// processing the original compilation unit.
|
||||
void SetSplitDwarf(const uint8_t* addr_buffer, uint64 addr_buffer_length,
|
||||
uint64 addr_base, uint64 ranges_base, uint64 dwo_id);
|
||||
void SetSplitDwarf(const uint8_t* addr_buffer, uint64_t addr_buffer_length,
|
||||
uint64_t addr_base, uint64_t ranges_base, uint64_t dwo_id);
|
||||
|
||||
// Begin reading a Dwarf2 compilation unit, and calling the
|
||||
// callbacks in the Dwarf2Handler
|
||||
|
@ -380,7 +380,7 @@ class CompilationUnit {
|
|||
// headers. This plus the starting offset passed to the constructor
|
||||
// is the offset of the end of the compilation unit --- and the
|
||||
// start of the next compilation unit, if there is one.
|
||||
uint64 Start();
|
||||
uint64_t Start();
|
||||
|
||||
private:
|
||||
|
||||
|
@ -388,7 +388,7 @@ class CompilationUnit {
|
|||
// The abbreviation tells how to read a DWARF2/3 DIE, and consist of a
|
||||
// tag and a list of attributes, as well as the data form of each attribute.
|
||||
struct Abbrev {
|
||||
uint64 number;
|
||||
uint64_t number;
|
||||
enum DwarfTag tag;
|
||||
bool has_children;
|
||||
AttributeList attributes;
|
||||
|
@ -398,10 +398,10 @@ class CompilationUnit {
|
|||
// in the actual file, as the one in the file may have a 32 bit or
|
||||
// 64 bit length.
|
||||
struct CompilationUnitHeader {
|
||||
uint64 length;
|
||||
uint16 version;
|
||||
uint64 abbrev_offset;
|
||||
uint8 address_size;
|
||||
uint64_t length;
|
||||
uint16_t version;
|
||||
uint64_t abbrev_offset;
|
||||
uint8_t address_size;
|
||||
} header_;
|
||||
|
||||
// Reads the DWARF2/3 header for this compilation unit.
|
||||
|
@ -412,13 +412,13 @@ 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 dieoffset,
|
||||
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 dieoffset,
|
||||
const uint8_t *ProcessAttribute(uint64_t dieoffset,
|
||||
const uint8_t *start,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form);
|
||||
|
@ -429,10 +429,10 @@ class CompilationUnit {
|
|||
// FORM, and the actual data of the attribute is in DATA.
|
||||
// If we see a DW_AT_GNU_dwo_id attribute, save the value so that
|
||||
// we can find the debug info in a .dwo or .dwp file.
|
||||
void ProcessAttributeUnsigned(uint64 offset,
|
||||
void ProcessAttributeUnsigned(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data) {
|
||||
uint64_t data) {
|
||||
if (attr == DW_AT_GNU_dwo_id) {
|
||||
dwo_id_ = data;
|
||||
}
|
||||
|
@ -455,10 +455,10 @@ class CompilationUnit {
|
|||
// our handler. The attribute is for the DIE at OFFSET from the
|
||||
// beginning of compilation unit, has a name of ATTR, a form of
|
||||
// FORM, and the actual data of the attribute is in DATA.
|
||||
void ProcessAttributeSigned(uint64 offset,
|
||||
void ProcessAttributeSigned(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
int64 data) {
|
||||
int64_t data) {
|
||||
handler_->ProcessAttributeSigned(offset, attr, form, data);
|
||||
}
|
||||
|
||||
|
@ -467,11 +467,11 @@ class CompilationUnit {
|
|||
// beginning of compilation unit, has a name of ATTR, a form of
|
||||
// FORM, and the actual data of the attribute is in DATA, and the
|
||||
// length of the buffer is LENGTH.
|
||||
void ProcessAttributeBuffer(uint64 offset,
|
||||
void ProcessAttributeBuffer(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
const uint8_t* data,
|
||||
uint64 len) {
|
||||
uint64_t len) {
|
||||
handler_->ProcessAttributeBuffer(offset, attr, form, data, len);
|
||||
}
|
||||
|
||||
|
@ -481,7 +481,7 @@ class CompilationUnit {
|
|||
// FORM, and the actual data of the attribute is in DATA.
|
||||
// If we see a DW_AT_GNU_dwo_name attribute, save the value so
|
||||
// that we can find the debug info in a .dwo or .dwp file.
|
||||
void ProcessAttributeString(uint64 offset,
|
||||
void ProcessAttributeString(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
const char* data) {
|
||||
|
@ -513,13 +513,13 @@ class CompilationUnit {
|
|||
|
||||
// Offset from section start is the offset of this compilation unit
|
||||
// from the beginning of the .debug_info section.
|
||||
uint64 offset_from_section_start_;
|
||||
uint64_t offset_from_section_start_;
|
||||
|
||||
// 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_;
|
||||
uint64 buffer_length_;
|
||||
uint64_t buffer_length_;
|
||||
const uint8_t *after_header_;
|
||||
|
||||
// The associated ByteReader that handles endianness issues for us
|
||||
|
@ -540,17 +540,17 @@ class CompilationUnit {
|
|||
// 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_;
|
||||
uint64 string_buffer_length_;
|
||||
uint64_t string_buffer_length_;
|
||||
|
||||
// String offsets section buffer and length, if we have a string offsets
|
||||
// section (.debug_str_offsets or .debug_str_offsets.dwo).
|
||||
const uint8_t* str_offsets_buffer_;
|
||||
uint64 str_offsets_buffer_length_;
|
||||
uint64_t str_offsets_buffer_length_;
|
||||
|
||||
// Address section buffer and length, if we have an address section
|
||||
// (.debug_addr).
|
||||
const uint8_t* addr_buffer_;
|
||||
uint64 addr_buffer_length_;
|
||||
uint64_t addr_buffer_length_;
|
||||
|
||||
// Flag indicating whether this compilation unit is part of a .dwo
|
||||
// or .dwp file. If true, we are reading this unit because a
|
||||
|
@ -562,20 +562,20 @@ class CompilationUnit {
|
|||
bool is_split_dwarf_;
|
||||
|
||||
// The value of the DW_AT_GNU_dwo_id attribute, if any.
|
||||
uint64 dwo_id_;
|
||||
uint64_t dwo_id_;
|
||||
|
||||
// The value of the DW_AT_GNU_dwo_name attribute, if any.
|
||||
const char* dwo_name_;
|
||||
|
||||
// If this is a split DWARF CU, the value of the DW_AT_GNU_dwo_id attribute
|
||||
// from the skeleton CU.
|
||||
uint64 skeleton_dwo_id_;
|
||||
uint64_t skeleton_dwo_id_;
|
||||
|
||||
// The value of the DW_AT_GNU_ranges_base attribute, if any.
|
||||
uint64 ranges_base_;
|
||||
uint64_t ranges_base_;
|
||||
|
||||
// The value of the DW_AT_GNU_addr_base attribute, if any.
|
||||
uint64 addr_base_;
|
||||
uint64_t addr_base_;
|
||||
|
||||
// True if we have already looked for a .dwp file.
|
||||
bool have_checked_for_dwp_;
|
||||
|
@ -613,16 +613,16 @@ class DwpReader {
|
|||
void Initialize();
|
||||
|
||||
// Read the debug sections for the given dwo_id.
|
||||
void ReadDebugSectionsForCU(uint64 dwo_id, SectionMap* sections);
|
||||
void ReadDebugSectionsForCU(uint64_t dwo_id, SectionMap* sections);
|
||||
|
||||
private:
|
||||
// Search a v1 hash table for "dwo_id". Returns the slot index
|
||||
// where the dwo_id was found, or -1 if it was not found.
|
||||
int LookupCU(uint64 dwo_id);
|
||||
int LookupCU(uint64_t dwo_id);
|
||||
|
||||
// Search a v2 hash table for "dwo_id". Returns the row index
|
||||
// in the offsets and sizes tables, or 0 if it was not found.
|
||||
uint32 LookupCUv2(uint64 dwo_id);
|
||||
uint32_t LookupCUv2(uint64_t dwo_id);
|
||||
|
||||
// The ELF reader for the .dwp file.
|
||||
ElfReader* elf_reader_;
|
||||
|
@ -957,7 +957,7 @@ class CallFrameInfo {
|
|||
|
||||
// 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.
|
||||
uint64 id;
|
||||
uint64_t id;
|
||||
|
||||
// The CIE that applies to this entry, if we've parsed it. If this is a
|
||||
// CIE, then this field points to this structure.
|
||||
|
@ -966,9 +966,9 @@ class CallFrameInfo {
|
|||
|
||||
// A common information entry (CIE).
|
||||
struct CIE: public Entry {
|
||||
uint8 version; // CFI data version number
|
||||
uint8_t version; // CFI data version number
|
||||
string augmentation; // vendor format extension markers
|
||||
uint64 code_alignment_factor; // scale for code address adjustments
|
||||
uint64_t code_alignment_factor; // scale for code address adjustments
|
||||
int data_alignment_factor; // scale for stack pointer adjustments
|
||||
unsigned return_address_register; // which register holds the return addr
|
||||
|
||||
|
@ -992,7 +992,7 @@ class CallFrameInfo {
|
|||
// If has_z_personality is true, this is the address of the personality
|
||||
// routine --- or, if personality_encoding & DW_EH_PE_indirect, the
|
||||
// address where the personality routine's address is stored.
|
||||
uint64 personality_address;
|
||||
uint64_t personality_address;
|
||||
|
||||
// This is the encoding used for addresses in the FDE header and
|
||||
// in DW_CFA_set_loc instructions. This is always valid, whether
|
||||
|
@ -1002,19 +1002,19 @@ class CallFrameInfo {
|
|||
|
||||
// These were only introduced in DWARF4, so will not be set in older
|
||||
// versions.
|
||||
uint8 address_size;
|
||||
uint8 segment_size;
|
||||
uint8_t address_size;
|
||||
uint8_t segment_size;
|
||||
};
|
||||
|
||||
// A frame description entry (FDE).
|
||||
struct FDE: public Entry {
|
||||
uint64 address; // start address of described code
|
||||
uint64 size; // size of described code, in bytes
|
||||
uint64_t address; // start address of described code
|
||||
uint64_t size; // size of described code, in bytes
|
||||
|
||||
// If cie->has_z_lsda is true, then this is the language-specific data
|
||||
// area's address --- or its address's address, if cie->lsda_encoding
|
||||
// has the DW_EH_PE_indirect bit set.
|
||||
uint64 lsda_address;
|
||||
uint64_t lsda_address;
|
||||
};
|
||||
|
||||
// Internal use.
|
||||
|
@ -1105,8 +1105,8 @@ class CallFrameInfo::Handler {
|
|||
// to the handler explicitly; instead, if the handler elects to
|
||||
// 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 address, uint64 length,
|
||||
uint8 version, const string &augmentation,
|
||||
virtual bool Entry(size_t offset, uint64_t address, uint64_t length,
|
||||
uint8_t version, const string &augmentation,
|
||||
unsigned return_address) = 0;
|
||||
|
||||
// When the Entry function returns true, the parser calls these
|
||||
|
@ -1128,21 +1128,21 @@ class CallFrameInfo::Handler {
|
|||
// computation. All other REG values will be positive.
|
||||
|
||||
// At ADDRESS, register REG's value is not recoverable.
|
||||
virtual bool UndefinedRule(uint64 address, int reg) = 0;
|
||||
virtual bool UndefinedRule(uint64_t address, int reg) = 0;
|
||||
|
||||
// At ADDRESS, register REG's value is the same as that it had in
|
||||
// the caller.
|
||||
virtual bool SameValueRule(uint64 address, int reg) = 0;
|
||||
virtual bool SameValueRule(uint64_t address, int reg) = 0;
|
||||
|
||||
// At ADDRESS, register REG has been saved at offset OFFSET from
|
||||
// BASE_REGISTER.
|
||||
virtual bool OffsetRule(uint64 address, int reg,
|
||||
virtual bool OffsetRule(uint64_t address, int reg,
|
||||
int base_register, long offset) = 0;
|
||||
|
||||
// At ADDRESS, the caller's value of register REG is the current
|
||||
// value of BASE_REGISTER plus OFFSET. (This rule doesn't provide an
|
||||
// address at which the register's value is saved.)
|
||||
virtual bool ValOffsetRule(uint64 address, int reg,
|
||||
virtual bool ValOffsetRule(uint64_t address, int reg,
|
||||
int base_register, long offset) = 0;
|
||||
|
||||
// At ADDRESS, register REG has been saved in BASE_REGISTER. This differs
|
||||
|
@ -1150,17 +1150,17 @@ class CallFrameInfo::Handler {
|
|||
// BASE_REGISTER is the "home" for REG's saved value: if you want to
|
||||
// assign to a variable whose home is REG in the calling frame, you
|
||||
// should put the value in BASE_REGISTER.
|
||||
virtual bool RegisterRule(uint64 address, int reg, int base_register) = 0;
|
||||
virtual bool RegisterRule(uint64_t address, int reg, int base_register) = 0;
|
||||
|
||||
// At ADDRESS, the DWARF expression EXPRESSION yields the address at
|
||||
// which REG was saved.
|
||||
virtual bool ExpressionRule(uint64 address, int reg,
|
||||
virtual bool ExpressionRule(uint64_t address, int reg,
|
||||
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 address, int reg,
|
||||
virtual bool ValExpressionRule(uint64_t address, int reg,
|
||||
const string &expression) = 0;
|
||||
|
||||
// Indicate that the rules for the address range reported by the
|
||||
|
@ -1201,7 +1201,7 @@ class CallFrameInfo::Handler {
|
|||
// which the routine's address is stored. The default definition for
|
||||
// this handler function simply returns true, allowing parsing of
|
||||
// the entry to continue.
|
||||
virtual bool PersonalityRoutine(uint64 address, bool indirect) {
|
||||
virtual bool PersonalityRoutine(uint64_t address, bool indirect) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1210,7 +1210,7 @@ class CallFrameInfo::Handler {
|
|||
// which the area's address is stored. The default definition for
|
||||
// this handler function simply returns true, allowing parsing of
|
||||
// the entry to continue.
|
||||
virtual bool LanguageSpecificDataArea(uint64 address, bool indirect) {
|
||||
virtual bool LanguageSpecificDataArea(uint64_t address, bool indirect) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1246,77 +1246,77 @@ class CallFrameInfo::Reporter {
|
|||
// The CFI entry at OFFSET ends too early to be well-formed. KIND
|
||||
// indicates what kind of entry it is; KIND can be kUnknown if we
|
||||
// haven't parsed enough of the entry to tell yet.
|
||||
virtual void Incomplete(uint64 offset, CallFrameInfo::EntryKind kind);
|
||||
virtual void Incomplete(uint64_t offset, CallFrameInfo::EntryKind kind);
|
||||
|
||||
// The .eh_frame data has a four-byte zero at OFFSET where the next
|
||||
// entry's length would be; this is a terminator. However, the buffer
|
||||
// length as given to the CallFrameInfo constructor says there should be
|
||||
// more data.
|
||||
virtual void EarlyEHTerminator(uint64 offset);
|
||||
virtual void EarlyEHTerminator(uint64_t offset);
|
||||
|
||||
// The FDE at OFFSET refers to the CIE at CIE_OFFSET, but the
|
||||
// section is not that large.
|
||||
virtual void CIEPointerOutOfRange(uint64 offset, uint64 cie_offset);
|
||||
virtual void CIEPointerOutOfRange(uint64_t offset, uint64_t cie_offset);
|
||||
|
||||
// The FDE at OFFSET refers to the CIE at CIE_OFFSET, but the entry
|
||||
// there is not a CIE.
|
||||
virtual void BadCIEId(uint64 offset, uint64 cie_offset);
|
||||
virtual void BadCIEId(uint64_t offset, uint64_t cie_offset);
|
||||
|
||||
// The FDE at OFFSET refers to a CIE with an address size we don't know how
|
||||
// to handle.
|
||||
virtual void UnexpectedAddressSize(uint64 offset, uint8_t address_size);
|
||||
virtual void UnexpectedAddressSize(uint64_t offset, uint8_t address_size);
|
||||
|
||||
// The FDE at OFFSET refers to a CIE with an segment descriptor size we
|
||||
// don't know how to handle.
|
||||
virtual void UnexpectedSegmentSize(uint64 offset, uint8_t segment_size);
|
||||
virtual void UnexpectedSegmentSize(uint64_t offset, uint8_t segment_size);
|
||||
|
||||
// The FDE at OFFSET refers to a CIE with version number VERSION,
|
||||
// which we don't recognize. We cannot parse DWARF CFI if it uses
|
||||
// a version number we don't recognize.
|
||||
virtual void UnrecognizedVersion(uint64 offset, int version);
|
||||
virtual void UnrecognizedVersion(uint64_t offset, int version);
|
||||
|
||||
// The FDE at OFFSET refers to a CIE with augmentation AUGMENTATION,
|
||||
// which we don't recognize. We cannot parse DWARF CFI if it uses
|
||||
// augmentations we don't recognize.
|
||||
virtual void UnrecognizedAugmentation(uint64 offset,
|
||||
virtual void UnrecognizedAugmentation(uint64_t offset,
|
||||
const string &augmentation);
|
||||
|
||||
// The pointer encoding ENCODING, specified by the CIE at OFFSET, is not
|
||||
// a valid encoding.
|
||||
virtual void InvalidPointerEncoding(uint64 offset, uint8 encoding);
|
||||
virtual void InvalidPointerEncoding(uint64_t offset, uint8_t encoding);
|
||||
|
||||
// The pointer encoding ENCODING, specified by the CIE at OFFSET, depends
|
||||
// on a base address which has not been supplied.
|
||||
virtual void UnusablePointerEncoding(uint64 offset, uint8 encoding);
|
||||
virtual void UnusablePointerEncoding(uint64_t offset, uint8_t encoding);
|
||||
|
||||
// The CIE at OFFSET contains a DW_CFA_restore instruction at
|
||||
// INSN_OFFSET, which may not appear in a CIE.
|
||||
virtual void RestoreInCIE(uint64 offset, uint64 insn_offset);
|
||||
virtual void RestoreInCIE(uint64_t offset, uint64_t insn_offset);
|
||||
|
||||
// The entry at OFFSET, of kind KIND, has an unrecognized
|
||||
// instruction at INSN_OFFSET.
|
||||
virtual void BadInstruction(uint64 offset, CallFrameInfo::EntryKind kind,
|
||||
uint64 insn_offset);
|
||||
virtual void BadInstruction(uint64_t offset, CallFrameInfo::EntryKind kind,
|
||||
uint64_t insn_offset);
|
||||
|
||||
// The instruction at INSN_OFFSET in the entry at OFFSET, of kind
|
||||
// KIND, establishes a rule that cites the CFA, but we have not
|
||||
// established a CFA rule yet.
|
||||
virtual void NoCFARule(uint64 offset, CallFrameInfo::EntryKind kind,
|
||||
uint64 insn_offset);
|
||||
virtual void NoCFARule(uint64_t offset, CallFrameInfo::EntryKind kind,
|
||||
uint64_t insn_offset);
|
||||
|
||||
// The instruction at INSN_OFFSET in the entry at OFFSET, of kind
|
||||
// KIND, is a DW_CFA_restore_state instruction, but the stack of
|
||||
// saved states is empty.
|
||||
virtual void EmptyStateStack(uint64 offset, CallFrameInfo::EntryKind kind,
|
||||
uint64 insn_offset);
|
||||
virtual void EmptyStateStack(uint64_t offset, CallFrameInfo::EntryKind kind,
|
||||
uint64_t insn_offset);
|
||||
|
||||
// The DW_CFA_remember_state instruction at INSN_OFFSET in the entry
|
||||
// at OFFSET, of kind KIND, would restore a state that has no CFA
|
||||
// rule, whereas the current state does have a CFA rule. This is
|
||||
// bogus input, which the CallFrameInfo::Handler interface doesn't
|
||||
// (and shouldn't) have any way to report.
|
||||
virtual void ClearingCFARule(uint64 offset, CallFrameInfo::EntryKind kind,
|
||||
uint64 insn_offset);
|
||||
virtual void ClearingCFARule(uint64_t offset, CallFrameInfo::EntryKind kind,
|
||||
uint64_t insn_offset);
|
||||
|
||||
protected:
|
||||
// The name of the file whose CFI we're reading.
|
||||
|
|
|
@ -99,23 +99,23 @@ void WriteELFFrameSection(const char *filename, const char *section_name,
|
|||
|
||||
class MockCallFrameInfoHandler: public CallFrameInfo::Handler {
|
||||
public:
|
||||
MOCK_METHOD6(Entry, bool(size_t offset, uint64 address, uint64 length,
|
||||
uint8 version, const string &augmentation,
|
||||
MOCK_METHOD6(Entry, bool(size_t offset, uint64_t address, uint64_t length,
|
||||
uint8_t version, const string &augmentation,
|
||||
unsigned return_address));
|
||||
MOCK_METHOD2(UndefinedRule, bool(uint64 address, int reg));
|
||||
MOCK_METHOD2(SameValueRule, bool(uint64 address, int reg));
|
||||
MOCK_METHOD4(OffsetRule, bool(uint64 address, int reg, int base_register,
|
||||
MOCK_METHOD2(UndefinedRule, bool(uint64_t address, int reg));
|
||||
MOCK_METHOD2(SameValueRule, bool(uint64_t address, int reg));
|
||||
MOCK_METHOD4(OffsetRule, bool(uint64_t address, int reg, int base_register,
|
||||
long offset));
|
||||
MOCK_METHOD4(ValOffsetRule, bool(uint64 address, int reg, int base_register,
|
||||
MOCK_METHOD4(ValOffsetRule, bool(uint64_t address, int reg, int base_register,
|
||||
long offset));
|
||||
MOCK_METHOD3(RegisterRule, bool(uint64 address, int reg, int base_register));
|
||||
MOCK_METHOD3(ExpressionRule, bool(uint64 address, int reg,
|
||||
MOCK_METHOD3(RegisterRule, bool(uint64_t address, int reg, int base_register));
|
||||
MOCK_METHOD3(ExpressionRule, bool(uint64_t address, int reg,
|
||||
const string &expression));
|
||||
MOCK_METHOD3(ValExpressionRule, bool(uint64 address, int reg,
|
||||
MOCK_METHOD3(ValExpressionRule, bool(uint64_t address, int reg,
|
||||
const string &expression));
|
||||
MOCK_METHOD0(End, bool());
|
||||
MOCK_METHOD2(PersonalityRoutine, bool(uint64 address, bool indirect));
|
||||
MOCK_METHOD2(LanguageSpecificDataArea, bool(uint64 address, bool indirect));
|
||||
MOCK_METHOD2(PersonalityRoutine, bool(uint64_t address, bool indirect));
|
||||
MOCK_METHOD2(LanguageSpecificDataArea, bool(uint64_t address, bool indirect));
|
||||
MOCK_METHOD0(SignalHandler, bool());
|
||||
};
|
||||
|
||||
|
@ -806,13 +806,13 @@ struct CFIInsnFixture: public CFIFixture {
|
|||
|
||||
Label cie_label;
|
||||
Sequence s;
|
||||
uint64 code_factor;
|
||||
uint64_t code_factor;
|
||||
int data_factor;
|
||||
unsigned return_register;
|
||||
unsigned version;
|
||||
unsigned cfa_base_register;
|
||||
int cfa_offset;
|
||||
uint64 fde_start, fde_size;
|
||||
uint64_t fde_start, fde_size;
|
||||
};
|
||||
|
||||
class CFIInsn: public CFIInsnFixture, public Test { };
|
||||
|
@ -1448,7 +1448,7 @@ TEST_F(CFIInsn, DW_CFA_remember_and_restore_state) {
|
|||
.D8(dwarf2reader::DW_CFA_restore_state)
|
||||
.FinishEntry();
|
||||
|
||||
uint64 addr = fde_start;
|
||||
uint64_t addr = fde_start;
|
||||
|
||||
// Expect the incoming rules to be reported.
|
||||
EXPECT_CALL(handler, OffsetRule(addr, 2, kCFARegister, 0x9806 * data_factor))
|
||||
|
|
|
@ -73,36 +73,37 @@ using testing::_;
|
|||
|
||||
class MockDwarf2Handler: public Dwarf2Handler {
|
||||
public:
|
||||
MOCK_METHOD5(StartCompilationUnit, bool(uint64 offset, uint8 address_size,
|
||||
uint8 offset_size, uint64 cu_length,
|
||||
uint8 dwarf_version));
|
||||
MOCK_METHOD2(StartDIE, bool(uint64 offset, enum DwarfTag tag));
|
||||
MOCK_METHOD4(ProcessAttributeUnsigned, void(uint64 offset,
|
||||
MOCK_METHOD5(StartCompilationUnit, bool(uint64_t offset, uint8_t address_size,
|
||||
uint8_t offset_size,
|
||||
uint64_t cu_length,
|
||||
uint8_t dwarf_version));
|
||||
MOCK_METHOD2(StartDIE, bool(uint64_t offset, enum DwarfTag tag));
|
||||
MOCK_METHOD4(ProcessAttributeUnsigned, void(uint64_t offset,
|
||||
DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data));
|
||||
MOCK_METHOD4(ProcessAttributeSigned, void(uint64 offset,
|
||||
uint64_t data));
|
||||
MOCK_METHOD4(ProcessAttributeSigned, void(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
int64 data));
|
||||
MOCK_METHOD4(ProcessAttributeReference, void(uint64 offset,
|
||||
MOCK_METHOD4(ProcessAttributeReference, void(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data));
|
||||
MOCK_METHOD5(ProcessAttributeBuffer, void(uint64 offset,
|
||||
uint64_t data));
|
||||
MOCK_METHOD5(ProcessAttributeBuffer, void(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
const uint8_t *data,
|
||||
uint64 len));
|
||||
MOCK_METHOD4(ProcessAttributeString, void(uint64 offset,
|
||||
uint64_t len));
|
||||
MOCK_METHOD4(ProcessAttributeString, void(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
const string& data));
|
||||
MOCK_METHOD4(ProcessAttributeSignature, void(uint64 offset,
|
||||
MOCK_METHOD4(ProcessAttributeSignature, void(uint64_t offset,
|
||||
DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 signature));
|
||||
MOCK_METHOD1(EndDIE, void(uint64 offset));
|
||||
uint64_t signature));
|
||||
MOCK_METHOD1(EndDIE, void(uint64_t offset));
|
||||
};
|
||||
|
||||
struct DIEFixture {
|
||||
|
@ -256,7 +257,7 @@ struct DwarfFormsFixture: public DIEFixture {
|
|||
// containing one childless DIE of the given tag, in the sequence s. Stop
|
||||
// just before the expectations.
|
||||
void ExpectBeginCompilationUnit(const DwarfHeaderParams ¶ms,
|
||||
DwarfTag tag, uint64 offset=0) {
|
||||
DwarfTag tag, uint64_t offset=0) {
|
||||
EXPECT_CALL(handler,
|
||||
StartCompilationUnit(offset, params.address_size,
|
||||
params.format_size, _,
|
||||
|
@ -274,7 +275,8 @@ struct DwarfFormsFixture: public DIEFixture {
|
|||
.WillOnce(Return());
|
||||
}
|
||||
|
||||
void ParseCompilationUnit(const DwarfHeaderParams ¶ms, uint64 offset=0) {
|
||||
void ParseCompilationUnit(const DwarfHeaderParams ¶ms,
|
||||
uint64_t offset=0) {
|
||||
ByteReader byte_reader(params.endianness == kLittleEndian ?
|
||||
ENDIANNESS_LITTLE : ENDIANNESS_BIG);
|
||||
CompilationUnit parser("", MakeSectionMap(), offset, &byte_reader, &handler);
|
||||
|
|
|
@ -446,8 +446,8 @@ class ElfReaderImpl {
|
|||
/*
|
||||
void GetSymbolPositions(SymbolMap *symbols,
|
||||
typename ElfArch::Word section_type,
|
||||
uint64 mem_offset,
|
||||
uint64 file_offset) {
|
||||
uint64_t mem_offset,
|
||||
uint64_t file_offset) {
|
||||
// This map is used to filter out "nested" functions.
|
||||
// See comment below.
|
||||
AddrToSymMap addr_to_sym_map;
|
||||
|
@ -472,20 +472,20 @@ class ElfReaderImpl {
|
|||
|
||||
// Adjust for difference between where we expected to mmap
|
||||
// this section, and where it was actually mmapped.
|
||||
const int64 expected_base = hdr.sh_addr - hdr.sh_offset;
|
||||
const int64 real_base = mem_offset - file_offset;
|
||||
const int64 adjust = real_base - expected_base;
|
||||
const int64_t expected_base = hdr.sh_addr - hdr.sh_offset;
|
||||
const int64_t real_base = mem_offset - file_offset;
|
||||
const int64_t adjust = real_base - expected_base;
|
||||
|
||||
uint64 start = sym->st_value + adjust;
|
||||
uint64_t start = sym->st_value + adjust;
|
||||
|
||||
// Adjust function symbols for PowerPC64 by dereferencing and adjusting
|
||||
// the function descriptor to get the function address.
|
||||
if (header_.e_machine == EM_PPC64 && ElfArch::Type(sym) == STT_FUNC) {
|
||||
const uint64 opd_addr =
|
||||
const uint64_t opd_addr =
|
||||
AdjustPPC64FunctionDescriptorSymbolValue(sym->st_value);
|
||||
// Only adjust the returned value if the function address was found.
|
||||
if (opd_addr != sym->st_value) {
|
||||
const int64 adjust_function_symbols =
|
||||
const int64_t adjust_function_symbols =
|
||||
real_base - base_for_text_;
|
||||
start = opd_addr + adjust_function_symbols;
|
||||
}
|
||||
|
@ -530,8 +530,8 @@ class ElfReaderImpl {
|
|||
curr->first, curr->second->st_size);
|
||||
typename AddrToSymMap::iterator prev = curr++;
|
||||
for (; curr != addr_to_sym_map.end(); ++curr) {
|
||||
const uint64 prev_addr = prev->first;
|
||||
const uint64 curr_addr = curr->first;
|
||||
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;
|
||||
if (prev_addr + prev_sym->st_size <= curr_addr ||
|
||||
|
@ -777,7 +777,7 @@ class ElfReaderImpl {
|
|||
// segments are present. This is the address an ELF image was linked
|
||||
// (by static linker) to be loaded at. Usually (but not always) 0 for
|
||||
// shared libraries and position-independent executables.
|
||||
uint64 VaddrOfFirstLoadSegment() const {
|
||||
uint64_t VaddrOfFirstLoadSegment() const {
|
||||
// Relocatable objects (of type ET_REL) do not have LOAD segments.
|
||||
if (header_.e_type == ET_REL) {
|
||||
return 0;
|
||||
|
@ -816,7 +816,7 @@ class ElfReaderImpl {
|
|||
}
|
||||
|
||||
private:
|
||||
typedef vector<pair<uint64, 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) {
|
||||
|
@ -935,12 +935,12 @@ class ElfReaderImpl {
|
|||
|
||||
// Given the "value" of a function descriptor return the address of the
|
||||
// function (i.e. the dereferenced value). Otherwise return "value".
|
||||
uint64 AdjustPPC64FunctionDescriptorSymbolValue(uint64 value) {
|
||||
uint64_t AdjustPPC64FunctionDescriptorSymbolValue(uint64_t value) {
|
||||
if (opd_section_ != NULL &&
|
||||
opd_info_.addr <= value &&
|
||||
value < opd_info_.addr + opd_info_.size) {
|
||||
uint64 offset = value - opd_info_.addr;
|
||||
return (*reinterpret_cast<const uint64*>(opd_section_ + offset));
|
||||
uint64_t offset = value - opd_info_.addr;
|
||||
return (*reinterpret_cast<const uint64_t*>(opd_section_ + offset));
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -1001,7 +1001,7 @@ class ElfReaderImpl {
|
|||
// .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.
|
||||
int64 base_for_text_;
|
||||
int64_t base_for_text_;
|
||||
|
||||
// Read PLT-related sections for the current architecture.
|
||||
bool plts_supported_;
|
||||
|
@ -1014,7 +1014,7 @@ class ElfReaderImpl {
|
|||
|
||||
// Maps a dynamic symbol index to a PLT offset.
|
||||
// The vector entry index is the dynamic symbol index.
|
||||
std::vector<uint64> symbols_plt_offsets_;
|
||||
std::vector<uint64_t> symbols_plt_offsets_;
|
||||
|
||||
// Container for PLT function name strings. These strings are passed by
|
||||
// reference to SymbolSink::AddSymbol() so they need to be stored somewhere.
|
||||
|
@ -1087,8 +1087,8 @@ bool ElfReader::IsElf64File() const {
|
|||
|
||||
/*
|
||||
void ElfReader::AddSymbols(SymbolMap *symbols,
|
||||
uint64 mem_offset, uint64 file_offset,
|
||||
uint64 length) {
|
||||
uint64_t mem_offset, uint64_t file_offset,
|
||||
uint64_t length) {
|
||||
if (fd_ < 0)
|
||||
return;
|
||||
// TODO(chatham): Actually use the information about file offset and
|
||||
|
@ -1138,7 +1138,7 @@ void ElfReader::VisitSymbols(ElfReader::SymbolSink *sink,
|
|||
}
|
||||
}
|
||||
|
||||
uint64 ElfReader::VaddrOfFirstLoadSegment() {
|
||||
uint64_t ElfReader::VaddrOfFirstLoadSegment() {
|
||||
if (IsElf32File()) {
|
||||
return GetImpl32()->VaddrOfFirstLoadSegment();
|
||||
} else if (IsElf64File()) {
|
||||
|
@ -1159,7 +1159,7 @@ const char *ElfReader::GetSectionName(int shndx) {
|
|||
}
|
||||
}
|
||||
|
||||
uint64 ElfReader::GetNumSections() {
|
||||
uint64_t ElfReader::GetNumSections() {
|
||||
if (IsElf32File()) {
|
||||
return GetImpl32()->GetNumSections();
|
||||
} else if (IsElf64File()) {
|
||||
|
|
|
@ -63,13 +63,14 @@ class ElfReader {
|
|||
// file_offset - offset in the file where the mapping begins
|
||||
// length - length of the mapped segment
|
||||
void AddSymbols(SymbolMap *symbols,
|
||||
uint64 mem_offset, uint64 file_offset,
|
||||
uint64 length);
|
||||
uint64_t mem_offset, uint64_t file_offset,
|
||||
uint64_t length);
|
||||
|
||||
class SymbolSink {
|
||||
public:
|
||||
virtual ~SymbolSink() {}
|
||||
virtual void AddSymbol(const char *name, uint64 address, uint64 size) = 0;
|
||||
virtual void AddSymbol(const char *name, uint64_t address,
|
||||
uint64_t size) = 0;
|
||||
};
|
||||
|
||||
// Like AddSymbols above, but with no address correction.
|
||||
|
@ -90,14 +91,14 @@ class ElfReader {
|
|||
// segments are present. This is the address an ELF image was linked
|
||||
// (by static linker) to be loaded at. Usually (but not always) 0 for
|
||||
// shared libraries and position-independent executables.
|
||||
uint64 VaddrOfFirstLoadSegment();
|
||||
uint64_t VaddrOfFirstLoadSegment();
|
||||
|
||||
// Return the name of section "shndx". Returns NULL if the section
|
||||
// is not found.
|
||||
const char *GetSectionName(int shndx);
|
||||
|
||||
// Return the number of sections in the given ELF file.
|
||||
uint64 GetNumSections();
|
||||
uint64_t GetNumSections();
|
||||
|
||||
// Get section "shndx" from the given ELF file. On success, return
|
||||
// the pointer to the section and store the size in "size".
|
||||
|
@ -118,15 +119,15 @@ class ElfReader {
|
|||
// here so that the many short macro names in <elf.h> don't have to be
|
||||
// added to our already cluttered namespace.
|
||||
struct SectionInfo {
|
||||
uint32 type; // Section type (SHT_xxx constant from elf.h).
|
||||
uint64 flags; // Section flags (SHF_xxx constants from elf.h).
|
||||
uint64 addr; // Section virtual address at execution.
|
||||
uint64 offset; // Section file offset.
|
||||
uint64 size; // Section size in bytes.
|
||||
uint32 link; // Link to another section.
|
||||
uint32 info; // Additional section information.
|
||||
uint64 addralign; // Section alignment.
|
||||
uint64 entsize; // Entry size if section holds a table.
|
||||
uint32_t type; // Section type (SHT_xxx constant from elf.h).
|
||||
uint64_t flags; // Section flags (SHF_xxx constants from elf.h).
|
||||
uint64_t addr; // Section virtual address at execution.
|
||||
uint64_t offset; // Section file offset.
|
||||
uint64_t size; // Section size in bytes.
|
||||
uint32_t link; // Link to another section.
|
||||
uint32_t info; // Additional section information.
|
||||
uint64_t addralign; // Section alignment.
|
||||
uint64_t entsize; // Entry size if section holds a table.
|
||||
};
|
||||
const char *GetSectionInfoByName(const string §ion_name,
|
||||
SectionInfo *info);
|
||||
|
|
|
@ -62,15 +62,15 @@ CULineInfoHandler::CULineInfoHandler(std::vector<SourceFileInfo>* files,
|
|||
files->push_back(s);
|
||||
}
|
||||
|
||||
void CULineInfoHandler::DefineDir(const string& name, uint32 dir_num) {
|
||||
void CULineInfoHandler::DefineDir(const string& name, uint32_t dir_num) {
|
||||
// These should never come out of order, actually
|
||||
assert(dir_num == dirs_->size());
|
||||
dirs_->push_back(name);
|
||||
}
|
||||
|
||||
void CULineInfoHandler::DefineFile(const string& name,
|
||||
int32 file_num, uint32 dir_num,
|
||||
uint64 mod_time, uint64 length) {
|
||||
int32 file_num, uint32_t dir_num,
|
||||
uint64_t mod_time, uint64_t length) {
|
||||
assert(dir_num >= 0);
|
||||
assert(dir_num < dirs_->size());
|
||||
|
||||
|
@ -93,8 +93,9 @@ void CULineInfoHandler::DefineFile(const string& name,
|
|||
}
|
||||
}
|
||||
|
||||
void CULineInfoHandler::AddLine(uint64 address, uint64 length, uint32 file_num,
|
||||
uint32 line_num, uint32 column_num) {
|
||||
void CULineInfoHandler::AddLine(uint64_t address, uint64_t length,
|
||||
uint32_t file_num, uint32_t line_num,
|
||||
uint32_t column_num) {
|
||||
if (file_num < files_->size()) {
|
||||
linemap_->insert(
|
||||
std::make_pair(address,
|
||||
|
@ -109,11 +110,11 @@ void CULineInfoHandler::AddLine(uint64 address, uint64 length, uint32 file_num,
|
|||
}
|
||||
}
|
||||
|
||||
bool CUFunctionInfoHandler::StartCompilationUnit(uint64 offset,
|
||||
uint8 address_size,
|
||||
uint8 offset_size,
|
||||
uint64 cu_length,
|
||||
uint8 dwarf_version) {
|
||||
bool CUFunctionInfoHandler::StartCompilationUnit(uint64_t offset,
|
||||
uint8_t address_size,
|
||||
uint8_t offset_size,
|
||||
uint64_t cu_length,
|
||||
uint8_t dwarf_version) {
|
||||
current_compilation_unit_offset_ = offset;
|
||||
return true;
|
||||
}
|
||||
|
@ -123,7 +124,7 @@ bool CUFunctionInfoHandler::StartCompilationUnit(uint64 offset,
|
|||
// subroutines. For line info, the DW_AT_stmt_list lives in the
|
||||
// compile unit tag.
|
||||
|
||||
bool CUFunctionInfoHandler::StartDIE(uint64 offset, enum DwarfTag tag) {
|
||||
bool CUFunctionInfoHandler::StartDIE(uint64_t offset, enum DwarfTag tag) {
|
||||
switch (tag) {
|
||||
case DW_TAG_subprogram:
|
||||
case DW_TAG_inlined_subroutine: {
|
||||
|
@ -146,7 +147,7 @@ bool CUFunctionInfoHandler::StartDIE(uint64 offset, enum DwarfTag tag) {
|
|||
|
||||
// Only care about the name attribute for functions
|
||||
|
||||
void CUFunctionInfoHandler::ProcessAttributeString(uint64 offset,
|
||||
void CUFunctionInfoHandler::ProcessAttributeString(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
const string &data) {
|
||||
|
@ -158,10 +159,10 @@ void CUFunctionInfoHandler::ProcessAttributeString(uint64 offset,
|
|||
}
|
||||
}
|
||||
|
||||
void CUFunctionInfoHandler::ProcessAttributeUnsigned(uint64 offset,
|
||||
void CUFunctionInfoHandler::ProcessAttributeUnsigned(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data) {
|
||||
uint64_t data) {
|
||||
if (attr == DW_AT_stmt_list) {
|
||||
SectionMap::const_iterator iter = sections_.find("__debug_line");
|
||||
assert(iter != sections_.end());
|
||||
|
@ -193,10 +194,10 @@ void CUFunctionInfoHandler::ProcessAttributeUnsigned(uint64 offset,
|
|||
}
|
||||
}
|
||||
|
||||
void CUFunctionInfoHandler::ProcessAttributeReference(uint64 offset,
|
||||
void CUFunctionInfoHandler::ProcessAttributeReference(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data) {
|
||||
uint64_t data) {
|
||||
if (current_function_info_) {
|
||||
switch (attr) {
|
||||
case DW_AT_specification: {
|
||||
|
@ -225,7 +226,7 @@ void CUFunctionInfoHandler::ProcessAttributeReference(uint64 offset,
|
|||
}
|
||||
}
|
||||
|
||||
void CUFunctionInfoHandler::EndDIE(uint64 offset) {
|
||||
void CUFunctionInfoHandler::EndDIE(uint64_t offset) {
|
||||
if (current_function_info_ && current_function_info_->lowpc)
|
||||
address_to_funcinfo_->insert(std::make_pair(current_function_info_->lowpc,
|
||||
current_function_info_));
|
||||
|
|
|
@ -53,20 +53,20 @@ struct FunctionInfo {
|
|||
// File containing this function
|
||||
string file;
|
||||
// Line number for start of function.
|
||||
uint32 line;
|
||||
uint32_t line;
|
||||
// Beginning address for this function
|
||||
uint64 lowpc;
|
||||
uint64_t lowpc;
|
||||
// End address for this function.
|
||||
uint64 highpc;
|
||||
uint64_t highpc;
|
||||
// Ranges offset
|
||||
uint64 ranges;
|
||||
uint64_t ranges;
|
||||
};
|
||||
|
||||
struct SourceFileInfo {
|
||||
// Name of the source file name
|
||||
string name;
|
||||
// Low address of source file name
|
||||
uint64 lowpc;
|
||||
uint64_t lowpc;
|
||||
};
|
||||
|
||||
typedef std::map<uint64, FunctionInfo*> FunctionMap;
|
||||
|
@ -86,12 +86,12 @@ class CULineInfoHandler: public LineInfoHandler {
|
|||
|
||||
// Called when we define a directory. We just place NAME into dirs_
|
||||
// at position DIR_NUM.
|
||||
virtual void DefineDir(const string& name, uint32 dir_num);
|
||||
virtual void DefineDir(const string& name, uint32_t dir_num);
|
||||
|
||||
// Called when we define a filename. We just place
|
||||
// concat(dirs_[DIR_NUM], NAME) into files_ at position FILE_NUM.
|
||||
virtual void DefineFile(const string& name, int32 file_num,
|
||||
uint32 dir_num, uint64 mod_time, uint64 length);
|
||||
uint32_t dir_num, uint64_t mod_time, uint64_t length);
|
||||
|
||||
|
||||
// Called when the line info reader has a new line, address pair
|
||||
|
@ -100,8 +100,9 @@ class CULineInfoHandler: public LineInfoHandler {
|
|||
// containing the code, LINE_NUM is the line number in that file for
|
||||
// the code, and COLUMN_NUM is the column number the code starts at,
|
||||
// if we know it (0 otherwise).
|
||||
virtual void AddLine(uint64 address, uint64 length,
|
||||
uint32 file_num, uint32 line_num, uint32 column_num);
|
||||
virtual void AddLine(uint64_t address, uint64_t length,
|
||||
uint32_t file_num, uint32_t line_num,
|
||||
uint32_t column_num);
|
||||
|
||||
private:
|
||||
LineMap* linemap_;
|
||||
|
@ -131,38 +132,38 @@ class CUFunctionInfoHandler: public Dwarf2Handler {
|
|||
// .debug_info section. We want to see all compilation units, so we
|
||||
// always return true.
|
||||
|
||||
virtual bool StartCompilationUnit(uint64 offset, uint8 address_size,
|
||||
uint8 offset_size, uint64 cu_length,
|
||||
uint8 dwarf_version);
|
||||
virtual bool StartCompilationUnit(uint64_t offset, uint8_t address_size,
|
||||
uint8_t offset_size, uint64_t cu_length,
|
||||
uint8_t dwarf_version);
|
||||
|
||||
// Start to process a DIE at OFFSET from the beginning of the
|
||||
// .debug_info section. We only care about function related DIE's.
|
||||
virtual bool StartDIE(uint64 offset, enum DwarfTag tag);
|
||||
virtual bool StartDIE(uint64_t offset, enum DwarfTag tag);
|
||||
|
||||
// Called when we have an attribute with unsigned data to give to
|
||||
// our handler. The attribute is for the DIE at OFFSET from the
|
||||
// beginning of the .debug_info section, has a name of ATTR, a form of
|
||||
// FORM, and the actual data of the attribute is in DATA.
|
||||
virtual void ProcessAttributeUnsigned(uint64 offset,
|
||||
virtual void ProcessAttributeUnsigned(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data);
|
||||
uint64_t data);
|
||||
|
||||
// Called when we have an attribute with a DIE reference to give to
|
||||
// our handler. The attribute is for the DIE at OFFSET from the
|
||||
// beginning of the .debug_info section, has a name of ATTR, a form of
|
||||
// FORM, and the offset of the referenced DIE from the start of the
|
||||
// .debug_info section is in DATA.
|
||||
virtual void ProcessAttributeReference(uint64 offset,
|
||||
virtual void ProcessAttributeReference(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data);
|
||||
uint64_t data);
|
||||
|
||||
// Called when we have an attribute with string data to give to
|
||||
// our handler. The attribute is for the DIE at OFFSET from the
|
||||
// beginning of the .debug_info section, has a name of ATTR, a form of
|
||||
// FORM, and the actual data of the attribute is in DATA.
|
||||
virtual void ProcessAttributeString(uint64 offset,
|
||||
virtual void ProcessAttributeString(uint64_t offset,
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
const string& data);
|
||||
|
@ -171,7 +172,7 @@ class CUFunctionInfoHandler: public Dwarf2Handler {
|
|||
// Because DWARF2/3 specifies a tree of DIEs, you may get starts
|
||||
// before ends of the previous DIE, as we process children before
|
||||
// ending the parent.
|
||||
virtual void EndDIE(uint64 offset);
|
||||
virtual void EndDIE(uint64_t offset);
|
||||
|
||||
private:
|
||||
std::vector<SourceFileInfo>* files_;
|
||||
|
@ -183,7 +184,7 @@ class CUFunctionInfoHandler: public Dwarf2Handler {
|
|||
const SectionMap& sections_;
|
||||
ByteReader* reader_;
|
||||
FunctionInfo* current_function_info_;
|
||||
uint64 current_compilation_unit_offset_;
|
||||
uint64_t current_compilation_unit_offset_;
|
||||
};
|
||||
|
||||
} // namespace dwarf2reader
|
||||
|
|
|
@ -46,10 +46,10 @@ struct LineStateMachine {
|
|||
end_sequence = false;
|
||||
}
|
||||
|
||||
uint32 file_num;
|
||||
uint64 address;
|
||||
uint32 line_num;
|
||||
uint32 column_num;
|
||||
uint32_t file_num;
|
||||
uint64_t address;
|
||||
uint32_t line_num;
|
||||
uint32_t column_num;
|
||||
bool is_stmt; // stmt means statement.
|
||||
bool basic_block;
|
||||
bool end_sequence;
|
||||
|
|
|
@ -35,16 +35,6 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef signed char int8;
|
||||
typedef short int16;
|
||||
typedef int int32;
|
||||
typedef long long int64;
|
||||
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned int uint32;
|
||||
typedef unsigned long long uint64;
|
||||
|
||||
typedef intptr_t intptr;
|
||||
typedef uintptr_t uintptr;
|
||||
|
||||
|
|
|
@ -142,8 +142,8 @@ vector<string> DwarfCFIToModule::RegisterNames::MIPS() {
|
|||
sizeof(kRegisterNames) / sizeof(kRegisterNames[0]));
|
||||
}
|
||||
|
||||
bool DwarfCFIToModule::Entry(size_t offset, uint64 address, uint64 length,
|
||||
uint8 version, const string &augmentation,
|
||||
bool DwarfCFIToModule::Entry(size_t offset, uint64_t address, uint64_t length,
|
||||
uint8_t version, const string &augmentation,
|
||||
unsigned return_address) {
|
||||
assert(!entry_);
|
||||
|
||||
|
@ -209,20 +209,20 @@ void DwarfCFIToModule::Record(Module::Address address, int reg,
|
|||
entry_->rule_changes[address][RegisterName(reg)] = shared_rule;
|
||||
}
|
||||
|
||||
bool DwarfCFIToModule::UndefinedRule(uint64 address, int reg) {
|
||||
bool DwarfCFIToModule::UndefinedRule(uint64_t address, int reg) {
|
||||
reporter_->UndefinedNotSupported(entry_offset_, RegisterName(reg));
|
||||
// Treat this as a non-fatal error.
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DwarfCFIToModule::SameValueRule(uint64 address, int reg) {
|
||||
bool DwarfCFIToModule::SameValueRule(uint64_t address, int reg) {
|
||||
ostringstream s;
|
||||
s << RegisterName(reg);
|
||||
Record(address, reg, s.str());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DwarfCFIToModule::OffsetRule(uint64 address, int reg,
|
||||
bool DwarfCFIToModule::OffsetRule(uint64_t address, int reg,
|
||||
int base_register, long offset) {
|
||||
ostringstream s;
|
||||
s << RegisterName(base_register) << " " << offset << " + ^";
|
||||
|
@ -230,7 +230,7 @@ bool DwarfCFIToModule::OffsetRule(uint64 address, int reg,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool DwarfCFIToModule::ValOffsetRule(uint64 address, int reg,
|
||||
bool DwarfCFIToModule::ValOffsetRule(uint64_t address, int reg,
|
||||
int base_register, long offset) {
|
||||
ostringstream s;
|
||||
s << RegisterName(base_register) << " " << offset << " +";
|
||||
|
@ -238,7 +238,7 @@ bool DwarfCFIToModule::ValOffsetRule(uint64 address, int reg,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool DwarfCFIToModule::RegisterRule(uint64 address, int reg,
|
||||
bool DwarfCFIToModule::RegisterRule(uint64_t address, int reg,
|
||||
int base_register) {
|
||||
ostringstream s;
|
||||
s << RegisterName(base_register);
|
||||
|
@ -246,14 +246,14 @@ bool DwarfCFIToModule::RegisterRule(uint64 address, int reg,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool DwarfCFIToModule::ExpressionRule(uint64 address, int reg,
|
||||
bool DwarfCFIToModule::ExpressionRule(uint64_t address, int reg,
|
||||
const string &expression) {
|
||||
reporter_->ExpressionsNotSupported(entry_offset_, RegisterName(reg));
|
||||
// Treat this as a non-fatal error.
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DwarfCFIToModule::ValExpressionRule(uint64 address, int reg,
|
||||
bool DwarfCFIToModule::ValExpressionRule(uint64_t address, int reg,
|
||||
const string &expression) {
|
||||
reporter_->ExpressionsNotSupported(entry_offset_, RegisterName(reg));
|
||||
// Treat this as a non-fatal error.
|
||||
|
|
|
@ -137,19 +137,19 @@ class DwarfCFIToModule: public CallFrameInfo::Handler {
|
|||
}
|
||||
virtual ~DwarfCFIToModule() { delete entry_; }
|
||||
|
||||
virtual bool Entry(size_t offset, uint64 address, uint64 length,
|
||||
uint8 version, const string &augmentation,
|
||||
virtual bool Entry(size_t offset, uint64_t address, uint64_t length,
|
||||
uint8_t version, const string &augmentation,
|
||||
unsigned return_address);
|
||||
virtual bool UndefinedRule(uint64 address, int reg);
|
||||
virtual bool SameValueRule(uint64 address, int reg);
|
||||
virtual bool OffsetRule(uint64 address, int reg,
|
||||
virtual bool UndefinedRule(uint64_t address, int reg);
|
||||
virtual bool SameValueRule(uint64_t address, int reg);
|
||||
virtual bool OffsetRule(uint64_t address, int reg,
|
||||
int base_register, long offset);
|
||||
virtual bool ValOffsetRule(uint64 address, int reg,
|
||||
virtual bool ValOffsetRule(uint64_t address, int reg,
|
||||
int base_register, long offset);
|
||||
virtual bool RegisterRule(uint64 address, int reg, int base_register);
|
||||
virtual bool ExpressionRule(uint64 address, int reg,
|
||||
virtual bool RegisterRule(uint64_t address, int reg, int base_register);
|
||||
virtual bool ExpressionRule(uint64_t address, int reg,
|
||||
const string &expression);
|
||||
virtual bool ValExpressionRule(uint64 address, int reg,
|
||||
virtual bool ValExpressionRule(uint64_t address, int reg,
|
||||
const string &expression);
|
||||
virtual bool End();
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ struct RuleFixture: public DwarfCFIToModuleFixture {
|
|||
EXPECT_EQ(entry_address, entries[0]->address);
|
||||
EXPECT_EQ(entry_size, entries[0]->size);
|
||||
}
|
||||
uint64 entry_address, entry_size;
|
||||
uint64_t entry_address, entry_size;
|
||||
unsigned return_reg;
|
||||
};
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ struct AbstractOrigin {
|
|||
string name;
|
||||
};
|
||||
|
||||
typedef map<uint64, AbstractOrigin> AbstractOriginByOffset;
|
||||
typedef map<uint64_t, AbstractOrigin> AbstractOriginByOffset;
|
||||
|
||||
// Data global to the DWARF-bearing file that is private to the
|
||||
// DWARF-to-Module process.
|
||||
|
@ -140,7 +140,7 @@ DwarfCUToModule::FileContext::~FileContext() {
|
|||
}
|
||||
|
||||
void DwarfCUToModule::FileContext::AddSectionToSectionMap(
|
||||
const string& name, const uint8_t *contents, uint64 length) {
|
||||
const string& name, const uint8_t *contents, uint64_t length) {
|
||||
section_map_[name] = std::make_pair(contents, length);
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ void DwarfCUToModule::FileContext::ClearSpecifications() {
|
|||
}
|
||||
|
||||
bool DwarfCUToModule::FileContext::IsUnhandledInterCUReference(
|
||||
uint64 offset, uint64 compilation_unit_start) const {
|
||||
uint64_t offset, uint64_t compilation_unit_start) const {
|
||||
if (handle_inter_cu_refs_)
|
||||
return false;
|
||||
return offset < compilation_unit_start;
|
||||
|
@ -201,9 +201,9 @@ struct DwarfCUToModule::CUContext {
|
|||
// 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
|
||||
// the base address of the ranges covered by the CU.
|
||||
uint64 low_pc;
|
||||
uint64 high_pc;
|
||||
uint64 ranges;
|
||||
uint64_t low_pc;
|
||||
uint64_t high_pc;
|
||||
uint64_t ranges;
|
||||
|
||||
// The functions defined in this compilation unit. We accumulate
|
||||
// them here during parsing. Then, in DwarfCUToModule::Finish, we
|
||||
|
@ -241,7 +241,7 @@ class DwarfCUToModule::GenericDIEHandler: public dwarf2reader::DIEHandler {
|
|||
// described by CU_CONTEXT, and whose immediate context is described
|
||||
// by PARENT_CONTEXT.
|
||||
GenericDIEHandler(CUContext *cu_context, DIEContext *parent_context,
|
||||
uint64 offset)
|
||||
uint64_t offset)
|
||||
: cu_context_(cu_context),
|
||||
parent_context_(parent_context),
|
||||
offset_(offset),
|
||||
|
@ -253,13 +253,13 @@ class DwarfCUToModule::GenericDIEHandler: public dwarf2reader::DIEHandler {
|
|||
// handle DW_AT_declaration, or simply not override it.
|
||||
void ProcessAttributeUnsigned(enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data);
|
||||
uint64_t data);
|
||||
|
||||
// Derived classes' ProcessAttributeReference can defer to this to
|
||||
// handle DW_AT_specification, or simply not override it.
|
||||
void ProcessAttributeReference(enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data);
|
||||
uint64_t data);
|
||||
|
||||
// Derived classes' ProcessAttributeReference can defer to this to
|
||||
// handle DW_AT_specification, or simply not override it.
|
||||
|
@ -280,7 +280,7 @@ class DwarfCUToModule::GenericDIEHandler: public dwarf2reader::DIEHandler {
|
|||
|
||||
CUContext *cu_context_;
|
||||
DIEContext *parent_context_;
|
||||
uint64 offset_;
|
||||
uint64_t offset_;
|
||||
|
||||
// Place the name in the global set of strings. Even though this looks
|
||||
// like a copy, all the major string implementations use reference
|
||||
|
@ -321,7 +321,7 @@ class DwarfCUToModule::GenericDIEHandler: public dwarf2reader::DIEHandler {
|
|||
void DwarfCUToModule::GenericDIEHandler::ProcessAttributeUnsigned(
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data) {
|
||||
uint64_t data) {
|
||||
switch (attr) {
|
||||
case dwarf2reader::DW_AT_declaration: declaration_ = (data != 0); break;
|
||||
default: break;
|
||||
|
@ -331,7 +331,7 @@ void DwarfCUToModule::GenericDIEHandler::ProcessAttributeUnsigned(
|
|||
void DwarfCUToModule::GenericDIEHandler::ProcessAttributeReference(
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data) {
|
||||
uint64_t data) {
|
||||
switch (attr) {
|
||||
case dwarf2reader::DW_AT_specification: {
|
||||
FileContext *file_context = cu_context_->file_context;
|
||||
|
@ -466,19 +466,19 @@ string DwarfCUToModule::GenericDIEHandler::ComputeQualifiedName() {
|
|||
class DwarfCUToModule::FuncHandler: public GenericDIEHandler {
|
||||
public:
|
||||
FuncHandler(CUContext *cu_context, DIEContext *parent_context,
|
||||
uint64 offset)
|
||||
uint64_t offset)
|
||||
: GenericDIEHandler(cu_context, parent_context, offset),
|
||||
low_pc_(0), high_pc_(0), high_pc_form_(dwarf2reader::DW_FORM_addr),
|
||||
ranges_(0), abstract_origin_(NULL), inline_(false) { }
|
||||
void ProcessAttributeUnsigned(enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data);
|
||||
uint64_t data);
|
||||
void ProcessAttributeSigned(enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
int64 data);
|
||||
int64_t data);
|
||||
void ProcessAttributeReference(enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data);
|
||||
uint64_t data);
|
||||
|
||||
bool EndAttributes();
|
||||
void Finish();
|
||||
|
@ -487,9 +487,9 @@ class DwarfCUToModule::FuncHandler: public GenericDIEHandler {
|
|||
// The fully-qualified name, as derived from name_attribute_,
|
||||
// specification_, parent_context_. Computed in EndAttributes.
|
||||
string name_;
|
||||
uint64 low_pc_, high_pc_; // DW_AT_low_pc, DW_AT_high_pc
|
||||
uint64_t low_pc_, high_pc_; // DW_AT_low_pc, DW_AT_high_pc
|
||||
DwarfForm high_pc_form_; // DW_AT_high_pc can be length or address.
|
||||
uint64 ranges_; // DW_AT_ranges
|
||||
uint64_t ranges_; // DW_AT_ranges
|
||||
const AbstractOrigin* abstract_origin_;
|
||||
bool inline_;
|
||||
};
|
||||
|
@ -497,7 +497,7 @@ class DwarfCUToModule::FuncHandler: public GenericDIEHandler {
|
|||
void DwarfCUToModule::FuncHandler::ProcessAttributeUnsigned(
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data) {
|
||||
uint64_t data) {
|
||||
switch (attr) {
|
||||
// If this attribute is present at all --- even if its value is
|
||||
// DW_INL_not_inlined --- then GCC may cite it as someone else's
|
||||
|
@ -522,7 +522,7 @@ void DwarfCUToModule::FuncHandler::ProcessAttributeUnsigned(
|
|||
void DwarfCUToModule::FuncHandler::ProcessAttributeSigned(
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
int64 data) {
|
||||
int64_t data) {
|
||||
switch (attr) {
|
||||
// If this attribute is present at all --- even if its value is
|
||||
// DW_INL_not_inlined --- then GCC may cite it as someone else's
|
||||
|
@ -537,7 +537,7 @@ void DwarfCUToModule::FuncHandler::ProcessAttributeSigned(
|
|||
void DwarfCUToModule::FuncHandler::ProcessAttributeReference(
|
||||
enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data) {
|
||||
uint64_t data) {
|
||||
switch (attr) {
|
||||
case dwarf2reader::DW_AT_abstract_origin: {
|
||||
const AbstractOriginByOffset& origins =
|
||||
|
@ -568,8 +568,8 @@ bool DwarfCUToModule::FuncHandler::EndAttributes() {
|
|||
}
|
||||
|
||||
static bool IsEmptyRange(const vector<Module::Range>& ranges) {
|
||||
uint64 size = accumulate(ranges.cbegin(), ranges.cend(), 0,
|
||||
[](uint64 total, Module::Range entry) {
|
||||
uint64_t size = accumulate(ranges.cbegin(), ranges.cend(), 0,
|
||||
[](uint64_t total, Module::Range entry) {
|
||||
return total + entry.size;
|
||||
}
|
||||
);
|
||||
|
@ -663,10 +663,10 @@ void DwarfCUToModule::FuncHandler::Finish() {
|
|||
class DwarfCUToModule::NamedScopeHandler: public GenericDIEHandler {
|
||||
public:
|
||||
NamedScopeHandler(CUContext *cu_context, DIEContext *parent_context,
|
||||
uint64 offset)
|
||||
uint64_t offset)
|
||||
: GenericDIEHandler(cu_context, parent_context, offset) { }
|
||||
bool EndAttributes();
|
||||
DIEHandler *FindChildHandler(uint64 offset, enum DwarfTag tag);
|
||||
DIEHandler *FindChildHandler(uint64_t offset, enum DwarfTag tag);
|
||||
|
||||
private:
|
||||
DIEContext child_context_; // A context for our children.
|
||||
|
@ -678,7 +678,7 @@ bool DwarfCUToModule::NamedScopeHandler::EndAttributes() {
|
|||
}
|
||||
|
||||
dwarf2reader::DIEHandler *DwarfCUToModule::NamedScopeHandler::FindChildHandler(
|
||||
uint64 offset,
|
||||
uint64_t offset,
|
||||
enum DwarfTag tag) {
|
||||
switch (tag) {
|
||||
case dwarf2reader::DW_TAG_subprogram:
|
||||
|
@ -701,8 +701,8 @@ void DwarfCUToModule::WarningReporter::CUHeading() {
|
|||
printed_cu_header_ = true;
|
||||
}
|
||||
|
||||
void DwarfCUToModule::WarningReporter::UnknownSpecification(uint64 offset,
|
||||
uint64 target) {
|
||||
void DwarfCUToModule::WarningReporter::UnknownSpecification(uint64_t offset,
|
||||
uint64_t target) {
|
||||
CUHeading();
|
||||
fprintf(stderr, "%s: the DIE at offset 0x%llx has a DW_AT_specification"
|
||||
" attribute referring to the DIE at offset 0x%llx, which was not"
|
||||
|
@ -710,8 +710,8 @@ void DwarfCUToModule::WarningReporter::UnknownSpecification(uint64 offset,
|
|||
filename_.c_str(), offset, target);
|
||||
}
|
||||
|
||||
void DwarfCUToModule::WarningReporter::UnknownAbstractOrigin(uint64 offset,
|
||||
uint64 target) {
|
||||
void DwarfCUToModule::WarningReporter::UnknownAbstractOrigin(uint64_t offset,
|
||||
uint64_t target) {
|
||||
CUHeading();
|
||||
fprintf(stderr, "%s: the DIE at offset 0x%llx has a DW_AT_abstract_origin"
|
||||
" attribute referring to the DIE at offset 0x%llx, which was not"
|
||||
|
@ -725,7 +725,7 @@ void DwarfCUToModule::WarningReporter::MissingSection(const string &name) {
|
|||
filename_.c_str(), name.c_str());
|
||||
}
|
||||
|
||||
void DwarfCUToModule::WarningReporter::BadLineInfoOffset(uint64 offset) {
|
||||
void DwarfCUToModule::WarningReporter::BadLineInfoOffset(uint64_t offset) {
|
||||
CUHeading();
|
||||
fprintf(stderr, "%s: warning: line number data offset beyond end"
|
||||
" of '.debug_line' section\n",
|
||||
|
@ -760,7 +760,7 @@ void DwarfCUToModule::WarningReporter::UncoveredLine(const Module::Line &line) {
|
|||
line.file->name.c_str(), line.number, line.address);
|
||||
}
|
||||
|
||||
void DwarfCUToModule::WarningReporter::UnnamedFunction(uint64 offset) {
|
||||
void DwarfCUToModule::WarningReporter::UnnamedFunction(uint64_t offset) {
|
||||
CUHeading();
|
||||
fprintf(stderr, "%s: warning: function at offset 0x%llx has no name\n",
|
||||
filename_.c_str(), offset);
|
||||
|
@ -773,7 +773,7 @@ void DwarfCUToModule::WarningReporter::DemangleError(const string &input) {
|
|||
}
|
||||
|
||||
void DwarfCUToModule::WarningReporter::UnhandledInterCUReference(
|
||||
uint64 offset, uint64 target) {
|
||||
uint64_t offset, uint64_t target) {
|
||||
CUHeading();
|
||||
fprintf(stderr, "%s: warning: the DIE at offset 0x%llx has a "
|
||||
"DW_FORM_ref_addr attribute with an inter-CU reference to "
|
||||
|
@ -781,7 +781,7 @@ void DwarfCUToModule::WarningReporter::UnhandledInterCUReference(
|
|||
filename_.c_str(), offset, target);
|
||||
}
|
||||
|
||||
void DwarfCUToModule::WarningReporter::MalformedRangeList(uint64 offset) {
|
||||
void DwarfCUToModule::WarningReporter::MalformedRangeList(uint64_t offset) {
|
||||
CUHeading();
|
||||
fprintf(stderr, "%s: warning: the range list at offset 0x%llx falls out of "
|
||||
"the .debug_ranges section.\n",
|
||||
|
@ -809,7 +809,7 @@ DwarfCUToModule::~DwarfCUToModule() {
|
|||
|
||||
void DwarfCUToModule::ProcessAttributeSigned(enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
int64 data) {
|
||||
int64_t data) {
|
||||
switch (attr) {
|
||||
case dwarf2reader::DW_AT_language: // source language of this CU
|
||||
SetLanguage(static_cast<DwarfLanguage>(data));
|
||||
|
@ -821,7 +821,7 @@ void DwarfCUToModule::ProcessAttributeSigned(enum DwarfAttribute attr,
|
|||
|
||||
void DwarfCUToModule::ProcessAttributeUnsigned(enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data) {
|
||||
uint64_t data) {
|
||||
switch (attr) {
|
||||
case dwarf2reader::DW_AT_stmt_list: // Line number information.
|
||||
has_source_line_info_ = true;
|
||||
|
@ -865,7 +865,7 @@ bool DwarfCUToModule::EndAttributes() {
|
|||
}
|
||||
|
||||
dwarf2reader::DIEHandler *DwarfCUToModule::FindChildHandler(
|
||||
uint64 offset,
|
||||
uint64_t offset,
|
||||
enum DwarfTag tag) {
|
||||
switch (tag) {
|
||||
case dwarf2reader::DW_TAG_subprogram:
|
||||
|
@ -925,7 +925,7 @@ void DwarfCUToModule::SetLanguage(DwarfLanguage language) {
|
|||
}
|
||||
}
|
||||
|
||||
void DwarfCUToModule::ReadSourceLines(uint64 offset) {
|
||||
void DwarfCUToModule::ReadSourceLines(uint64_t offset) {
|
||||
const dwarf2reader::SectionMap §ion_map
|
||||
= cu_context_->file_context->section_map();
|
||||
dwarf2reader::SectionMap::const_iterator map_entry
|
||||
|
@ -939,7 +939,7 @@ void DwarfCUToModule::ReadSourceLines(uint64 offset) {
|
|||
return;
|
||||
}
|
||||
const uint8_t *section_start = map_entry->second.first;
|
||||
uint64 section_length = map_entry->second.second;
|
||||
uint64_t section_length = map_entry->second.second;
|
||||
if (offset >= section_length) {
|
||||
cu_context_->reporter->BadLineInfoOffset(offset);
|
||||
return;
|
||||
|
@ -1226,15 +1226,15 @@ void DwarfCUToModule::Finish() {
|
|||
cu_context_->file_context->ClearSpecifications();
|
||||
}
|
||||
|
||||
bool DwarfCUToModule::StartCompilationUnit(uint64 offset,
|
||||
uint8 address_size,
|
||||
uint8 offset_size,
|
||||
uint64 cu_length,
|
||||
uint8 dwarf_version) {
|
||||
bool DwarfCUToModule::StartCompilationUnit(uint64_t offset,
|
||||
uint8_t address_size,
|
||||
uint8_t offset_size,
|
||||
uint64_t cu_length,
|
||||
uint8_t dwarf_version) {
|
||||
return dwarf_version >= 2;
|
||||
}
|
||||
|
||||
bool DwarfCUToModule::StartRootDIE(uint64 offset, enum DwarfTag tag) {
|
||||
bool DwarfCUToModule::StartRootDIE(uint64_t offset, enum DwarfTag tag) {
|
||||
// We don't deal with partial compilation units (the only other tag
|
||||
// likely to be used for root DIE).
|
||||
return tag == dwarf2reader::DW_TAG_compile_unit;
|
||||
|
|
|
@ -87,7 +87,7 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
|
|||
// Add CONTENTS of size LENGTH to the section map as NAME.
|
||||
void AddSectionToSectionMap(const string& name,
|
||||
const uint8_t *contents,
|
||||
uint64 length);
|
||||
uint64_t length);
|
||||
|
||||
// Clear the section map for testing.
|
||||
void ClearSectionMapForTest();
|
||||
|
@ -103,8 +103,8 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
|
|||
// Given an OFFSET and a CU that starts at COMPILATION_UNIT_START, returns
|
||||
// true if this is an inter-compilation unit reference that is not being
|
||||
// handled.
|
||||
bool IsUnhandledInterCUReference(uint64 offset,
|
||||
uint64 compilation_unit_start) const;
|
||||
bool IsUnhandledInterCUReference(uint64_t offset,
|
||||
uint64_t compilation_unit_start) const;
|
||||
|
||||
// The name of this file, for use in error messages.
|
||||
const string filename_;
|
||||
|
@ -135,7 +135,7 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
|
|||
// section, base_address holds the base PC the range list values are
|
||||
// offsets off. Return false if the rangelist falls out of the
|
||||
// .debug_ranges section.
|
||||
virtual bool ReadRanges(uint64 offset, Module::Address base_address,
|
||||
virtual bool ReadRanges(uint64_t offset, Module::Address base_address,
|
||||
vector<Module::Range>* ranges) = 0;
|
||||
};
|
||||
|
||||
|
@ -158,7 +158,7 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
|
|||
// mappings, given a pointer to some DWARF line number data
|
||||
// PROGRAM, and an overestimate of its size. Add no zero-length
|
||||
// lines to LINES.
|
||||
virtual void ReadProgram(const uint8_t *program, uint64 length,
|
||||
virtual void ReadProgram(const uint8_t *program, uint64_t length,
|
||||
Module *module, vector<Module::Line> *lines) = 0;
|
||||
};
|
||||
|
||||
|
@ -170,7 +170,7 @@ 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 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) { }
|
||||
|
@ -193,17 +193,17 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
|
|||
// A DW_AT_specification in the DIE at OFFSET refers to a DIE we
|
||||
// haven't processed yet, or that wasn't marked as a declaration,
|
||||
// at TARGET.
|
||||
virtual void UnknownSpecification(uint64 offset, uint64 target);
|
||||
virtual void UnknownSpecification(uint64_t offset, uint64_t target);
|
||||
|
||||
// A DW_AT_abstract_origin in the DIE at OFFSET refers to a DIE we
|
||||
// haven't processed yet, or that wasn't marked as inline, at TARGET.
|
||||
virtual void UnknownAbstractOrigin(uint64 offset, uint64 target);
|
||||
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 §ion_name);
|
||||
|
||||
// The CU's DW_AT_stmt_list offset OFFSET is bogus.
|
||||
virtual void BadLineInfoOffset(uint64 offset);
|
||||
virtual void BadLineInfoOffset(uint64_t offset);
|
||||
|
||||
// FUNCTION includes code covered by no line number data.
|
||||
virtual void UncoveredFunction(const Module::Function &function);
|
||||
|
@ -215,30 +215,30 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
|
|||
// 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
|
||||
// link.
|
||||
virtual void UnnamedFunction(uint64 offset);
|
||||
virtual void UnnamedFunction(uint64_t offset);
|
||||
|
||||
// __cxa_demangle() failed to demangle 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.
|
||||
virtual void UnhandledInterCUReference(uint64 offset, uint64 target);
|
||||
virtual void UnhandledInterCUReference(uint64_t offset, uint64_t target);
|
||||
|
||||
// The DW_AT_ranges at offset is malformed (truncated or outside of the
|
||||
// .debug_ranges section's bound).
|
||||
virtual void MalformedRangeList(uint64 offset);
|
||||
virtual void MalformedRangeList(uint64_t offset);
|
||||
|
||||
// A DW_AT_ranges attribute was encountered but the no .debug_ranges
|
||||
// section was found.
|
||||
virtual void MissingRanges();
|
||||
|
||||
uint64 cu_offset() const {
|
||||
uint64_t cu_offset() const {
|
||||
return cu_offset_;
|
||||
}
|
||||
|
||||
protected:
|
||||
const string filename_;
|
||||
const uint64 cu_offset_;
|
||||
const uint64_t cu_offset_;
|
||||
string cu_name_;
|
||||
bool printed_cu_header_;
|
||||
bool printed_unpaired_header_;
|
||||
|
@ -265,24 +265,24 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
|
|||
|
||||
void ProcessAttributeSigned(enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
int64 data);
|
||||
int64_t data);
|
||||
void ProcessAttributeUnsigned(enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
uint64 data);
|
||||
uint64_t data);
|
||||
void ProcessAttributeString(enum DwarfAttribute attr,
|
||||
enum DwarfForm form,
|
||||
const string &data);
|
||||
bool EndAttributes();
|
||||
DIEHandler *FindChildHandler(uint64 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_.
|
||||
void Finish();
|
||||
|
||||
bool StartCompilationUnit(uint64 offset, uint8 address_size,
|
||||
uint8 offset_size, uint64 cu_length,
|
||||
uint8 dwarf_version);
|
||||
bool StartRootDIE(uint64 offset, enum DwarfTag tag);
|
||||
bool StartCompilationUnit(uint64_t offset, uint8_t address_size,
|
||||
uint8_t offset_size, uint64_t cu_length,
|
||||
uint8_t dwarf_version);
|
||||
bool StartRootDIE(uint64_t offset, enum DwarfTag tag);
|
||||
|
||||
private:
|
||||
// Used internally by the handler. Full definitions are in
|
||||
|
@ -295,7 +295,7 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
|
|||
class NamedScopeHandler;
|
||||
|
||||
// A map from section offsets to specifications.
|
||||
typedef map<uint64, Specification> SpecificationByOffset;
|
||||
typedef map<uint64_t, Specification> SpecificationByOffset;
|
||||
|
||||
// Set this compilation unit's source language to LANGUAGE.
|
||||
void SetLanguage(DwarfLanguage language);
|
||||
|
@ -304,7 +304,7 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
|
|||
// section. Record source files in module_, but record source lines
|
||||
// in lines_; we apportion them to functions in
|
||||
// AssignLinesToFunctions.
|
||||
void ReadSourceLines(uint64 offset);
|
||||
void ReadSourceLines(uint64_t offset);
|
||||
|
||||
// Assign the lines in lines_ to the individual line lists of the
|
||||
// functions in functions_. (DWARF line information maps an entire
|
||||
|
@ -332,7 +332,7 @@ class DwarfCUToModule: public dwarf2reader::RootDIEHandler {
|
|||
|
||||
// The offset of this compilation unit's line number information in
|
||||
// the .debug_line section.
|
||||
uint64 source_line_offset_;
|
||||
uint64_t source_line_offset_;
|
||||
|
||||
// The line numbers we have seen thus far. We accumulate these here
|
||||
// during parsing. Then, in Finish, we call AssignLinesToFunctions
|
||||
|
|
|
@ -67,24 +67,24 @@ using ::testing::ValuesIn;
|
|||
class MockLineToModuleHandler: public DwarfCUToModule::LineToModuleHandler {
|
||||
public:
|
||||
MOCK_METHOD1(StartCompilationUnit, void(const string& compilation_dir));
|
||||
MOCK_METHOD4(ReadProgram, void(const uint8_t *program, uint64 length,
|
||||
MOCK_METHOD4(ReadProgram, void(const uint8_t *program, uint64_t length,
|
||||
Module *module, vector<Module::Line> *lines));
|
||||
};
|
||||
|
||||
class MockWarningReporter: public DwarfCUToModule::WarningReporter {
|
||||
public:
|
||||
MockWarningReporter(const string &filename, uint64 cu_offset)
|
||||
MockWarningReporter(const string &filename, uint64_t cu_offset)
|
||||
: DwarfCUToModule::WarningReporter(filename, cu_offset) { }
|
||||
MOCK_METHOD1(SetCUName, void(const string &name));
|
||||
MOCK_METHOD2(UnknownSpecification, void(uint64 offset, uint64 target));
|
||||
MOCK_METHOD2(UnknownAbstractOrigin, void(uint64 offset, uint64 target));
|
||||
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 §ion_name));
|
||||
MOCK_METHOD1(BadLineInfoOffset, void(uint64 offset));
|
||||
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(UnnamedFunction, void(uint64 offset));
|
||||
MOCK_METHOD1(UnnamedFunction, void(uint64_t offset));
|
||||
MOCK_METHOD1(DemangleError, void(const string &input));
|
||||
MOCK_METHOD2(UnhandledInterCUReference, void(uint64 offset, uint64 target));
|
||||
MOCK_METHOD2(UnhandledInterCUReference, void(uint64_t offset, uint64_t target));
|
||||
};
|
||||
|
||||
// A fixture class including all the objects needed to handle a
|
||||
|
@ -113,7 +113,7 @@ class CUFixtureBase {
|
|||
public:
|
||||
explicit AppendLinesFunctor(
|
||||
const vector<Module::Line> *lines) : lines_(lines) { }
|
||||
void operator()(const uint8_t *program, uint64 length,
|
||||
void operator()(const uint8_t *program, uint64_t length,
|
||||
Module *module, vector<Module::Line> *lines) {
|
||||
lines->insert(lines->end(), lines_->begin(), lines_->end());
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ class CUFixtureBase {
|
|||
// not Finish. If NAME is non-zero, use it as the DW_AT_name
|
||||
// attribute.
|
||||
DIEHandler *StartSpecifiedDIE(DIEHandler *parent, DwarfTag tag,
|
||||
uint64 specification, const char *name = NULL);
|
||||
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
|
||||
|
@ -211,7 +211,7 @@ 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 offset,
|
||||
void DeclarationDIE(DIEHandler *parent, uint64_t offset,
|
||||
DwarfTag tag, const string &name,
|
||||
const string &mangled_name);
|
||||
|
||||
|
@ -221,15 +221,15 @@ class CUFixtureBase {
|
|||
// attribute. If SIZE is non-zero, record ADDRESS and SIZE as
|
||||
// low_pc/high_pc attributes.
|
||||
void DefinitionDIE(DIEHandler *parent, DwarfTag tag,
|
||||
uint64 specification, const string &name,
|
||||
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 offset,
|
||||
DwarfInline type, uint64 specification,
|
||||
void AbstractInstanceDIE(DIEHandler *parent, uint64_t offset,
|
||||
DwarfInline type, uint64_t specification,
|
||||
const string &name,
|
||||
DwarfForm form = dwarf2reader::DW_FORM_data1);
|
||||
|
||||
|
@ -237,7 +237,7 @@ class CUFixtureBase {
|
|||
// 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,
|
||||
uint64 origin, Module::Address address,
|
||||
uint64_t origin, Module::Address address,
|
||||
Module::Address size);
|
||||
|
||||
// The following Test* functions should be called after calling
|
||||
|
@ -409,7 +409,7 @@ DIEHandler *CUFixtureBase::StartNamedDIE(DIEHandler *parent,
|
|||
|
||||
DIEHandler *CUFixtureBase::StartSpecifiedDIE(DIEHandler *parent,
|
||||
DwarfTag tag,
|
||||
uint64 specification,
|
||||
uint64_t specification,
|
||||
const char *name) {
|
||||
dwarf2reader::DIEHandler *handler
|
||||
= parent->FindChildHandler(0x8f4c783c0467c989ULL, tag);
|
||||
|
@ -466,7 +466,7 @@ void CUFixtureBase::DefineFunction(dwarf2reader::DIEHandler *parent,
|
|||
delete func;
|
||||
}
|
||||
|
||||
void CUFixtureBase::DeclarationDIE(DIEHandler *parent, uint64 offset,
|
||||
void CUFixtureBase::DeclarationDIE(DIEHandler *parent, uint64_t offset,
|
||||
DwarfTag tag,
|
||||
const string &name,
|
||||
const string &mangled_name) {
|
||||
|
@ -491,7 +491,7 @@ void CUFixtureBase::DeclarationDIE(DIEHandler *parent, uint64 offset,
|
|||
|
||||
void CUFixtureBase::DefinitionDIE(DIEHandler *parent,
|
||||
DwarfTag tag,
|
||||
uint64 specification,
|
||||
uint64_t specification,
|
||||
const string &name,
|
||||
Module::Address address,
|
||||
Module::Address size) {
|
||||
|
@ -519,9 +519,9 @@ void CUFixtureBase::DefinitionDIE(DIEHandler *parent,
|
|||
}
|
||||
|
||||
void CUFixtureBase::AbstractInstanceDIE(DIEHandler *parent,
|
||||
uint64 offset,
|
||||
uint64_t offset,
|
||||
DwarfInline type,
|
||||
uint64 specification,
|
||||
uint64_t specification,
|
||||
const string &name,
|
||||
DwarfForm form) {
|
||||
dwarf2reader::DIEHandler *die
|
||||
|
@ -548,7 +548,7 @@ void CUFixtureBase::AbstractInstanceDIE(DIEHandler *parent,
|
|||
|
||||
void CUFixtureBase::DefineInlineInstanceDIE(DIEHandler *parent,
|
||||
const string &name,
|
||||
uint64 origin,
|
||||
uint64_t origin,
|
||||
Module::Address address,
|
||||
Module::Address size) {
|
||||
dwarf2reader::DIEHandler *func
|
||||
|
|
|
@ -63,16 +63,16 @@ static string ExpandPath(const string &path,
|
|||
|
||||
namespace google_breakpad {
|
||||
|
||||
void DwarfLineToModule::DefineDir(const string &name, uint32 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 file_num,
|
||||
uint32 dir_num, uint64 mod_time,
|
||||
uint64 length) {
|
||||
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)
|
||||
file_num = ++highest_file_number_;
|
||||
else if (file_num > highest_file_number_)
|
||||
|
@ -103,9 +103,9 @@ void DwarfLineToModule::DefineFile(const string &name, int32 file_num,
|
|||
files_[file_num] = module_->FindFile(full_name);
|
||||
}
|
||||
|
||||
void DwarfLineToModule::AddLine(uint64 address, uint64 length,
|
||||
uint32 file_num, uint32 line_num,
|
||||
uint32 column_num) {
|
||||
void DwarfLineToModule::AddLine(uint64_t address, uint64_t length,
|
||||
uint32_t file_num, uint32_t line_num,
|
||||
uint32_t column_num) {
|
||||
if (length == 0)
|
||||
return;
|
||||
|
||||
|
|
|
@ -132,17 +132,17 @@ class DwarfLineToModule: public dwarf2reader::LineInfoHandler {
|
|||
|
||||
~DwarfLineToModule() { }
|
||||
|
||||
void DefineDir(const string &name, uint32 dir_num);
|
||||
void DefineFile(const string &name, int32 file_num,
|
||||
uint32 dir_num, uint64 mod_time,
|
||||
uint64 length);
|
||||
void AddLine(uint64 address, uint64 length,
|
||||
uint32 file_num, uint32 line_num, uint32 column_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,
|
||||
uint32_t file_num, uint32_t line_num, uint32_t column_num);
|
||||
|
||||
private:
|
||||
|
||||
typedef std::map<uint32, string> DirectoryTable;
|
||||
typedef std::map<uint32, Module::File *> FileTable;
|
||||
typedef std::map<uint32_t, string> DirectoryTable;
|
||||
typedef std::map<uint32_t, Module::File *> FileTable;
|
||||
|
||||
// The module we're contributing debugging info to. Owned by our
|
||||
// client.
|
||||
|
@ -171,12 +171,12 @@ class DwarfLineToModule: public dwarf2reader::LineInfoHandler {
|
|||
|
||||
// The highest file number we've seen so far, or -1 if we've seen
|
||||
// none. Used for dynamically defined file numbers.
|
||||
int32 highest_file_number_;
|
||||
int32_t highest_file_number_;
|
||||
|
||||
// This is the ending address of the last line we omitted, or zero if we
|
||||
// didn't omit the previous line. It is zero before we have received any
|
||||
// AddLine calls.
|
||||
uint64 omitted_line_end_;
|
||||
uint64_t omitted_line_end_;
|
||||
|
||||
// True if we've warned about:
|
||||
bool warned_bad_file_number_; // bad file numbers
|
||||
|
|
|
@ -39,13 +39,13 @@
|
|||
|
||||
namespace google_breakpad {
|
||||
|
||||
void DwarfRangeListHandler::AddRange(uint64 begin, uint64 end) {
|
||||
void DwarfRangeListHandler::AddRange(uint64_t begin, uint64_t end) {
|
||||
Module::Range r(begin + base_address_, end - begin);
|
||||
|
||||
ranges_->push_back(r);
|
||||
}
|
||||
|
||||
void DwarfRangeListHandler::SetBaseAddress(uint64 base_address) {
|
||||
void DwarfRangeListHandler::SetBaseAddress(uint64_t base_address) {
|
||||
base_address_ = base_address;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,16 +51,16 @@ namespace google_breakpad {
|
|||
|
||||
class DwarfRangeListHandler: public dwarf2reader::RangeListHandler {
|
||||
public:
|
||||
DwarfRangeListHandler(uint64 base_address, vector<Module::Range> *ranges)
|
||||
DwarfRangeListHandler(uint64_t base_address, vector<Module::Range> *ranges)
|
||||
: base_address_(base_address), ranges_(ranges) { }
|
||||
|
||||
~DwarfRangeListHandler() { }
|
||||
|
||||
// Add a range to the list
|
||||
void AddRange(uint64 begin, uint64 end);
|
||||
void AddRange(uint64_t begin, uint64_t end);
|
||||
|
||||
// Record the new base address and use it for the following entries
|
||||
void SetBaseAddress(uint64 base_address);
|
||||
void SetBaseAddress(uint64_t base_address);
|
||||
|
||||
// Sort the ranges so that they are in ascending order of starting address
|
||||
void Finish();
|
||||
|
@ -68,7 +68,7 @@ class DwarfRangeListHandler: public dwarf2reader::RangeListHandler {
|
|||
private:
|
||||
// The current PC to add to every entry, this can be overridden by a special
|
||||
// list entry
|
||||
uint64 base_address_;
|
||||
uint64_t base_address_;
|
||||
|
||||
// The list of ranges to be populated
|
||||
vector<Module::Range> *ranges_;
|
||||
|
|
|
@ -232,11 +232,11 @@ 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 size,
|
||||
DumperRangesHandler(const uint8_t *buffer, uint64_t size,
|
||||
dwarf2reader::ByteReader* reader)
|
||||
: buffer_(buffer), size_(size), reader_(reader) { }
|
||||
|
||||
bool ReadRanges(uint64 offset, Module::Address base_address,
|
||||
bool ReadRanges(uint64_t offset, Module::Address base_address,
|
||||
vector<Module::Range>* ranges) {
|
||||
DwarfRangeListHandler handler(base_address, ranges);
|
||||
dwarf2reader::RangeListReader rangelist_reader(buffer_, size_, reader_,
|
||||
|
@ -247,7 +247,7 @@ class DumperRangesHandler : public DwarfCUToModule::RangesHandler {
|
|||
|
||||
private:
|
||||
const uint8_t *buffer_;
|
||||
uint64 size_;
|
||||
uint64_t size_;
|
||||
dwarf2reader::ByteReader* reader_;
|
||||
};
|
||||
|
||||
|
@ -262,7 +262,7 @@ class DumperLineToModule: public DwarfCUToModule::LineToModuleHandler {
|
|||
void StartCompilationUnit(const string& compilation_dir) {
|
||||
compilation_dir_ = compilation_dir;
|
||||
}
|
||||
void ReadProgram(const uint8_t *program, uint64 length,
|
||||
void ReadProgram(const uint8_t *program, uint64_t length,
|
||||
Module* module, std::vector<Module::Line>* lines) {
|
||||
DwarfLineToModule handler(module, compilation_dir_, lines);
|
||||
dwarf2reader::LineInfo parser(program, length, byte_reader_, &handler);
|
||||
|
@ -310,7 +310,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>& 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,
|
||||
|
@ -322,13 +322,13 @@ 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>& 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.
|
||||
assert(debug_info_section.first);
|
||||
uint64 debug_info_length = debug_info_section.second;
|
||||
for (uint64 offset = 0; offset < debug_info_length;) {
|
||||
uint64_t debug_info_length = debug_info_section.second;
|
||||
for (uint64_t offset = 0; offset < debug_info_length;) {
|
||||
// Make a handler for the root DIE that populates MODULE with the
|
||||
// data that was found.
|
||||
DwarfCUToModule::WarningReporter reporter(dwarf_filename, offset);
|
||||
|
|
|
@ -311,11 +311,11 @@ string DumpSymbols::Identifier() {
|
|||
class DumpSymbols::DumperRangesHandler:
|
||||
public DwarfCUToModule::RangesHandler {
|
||||
public:
|
||||
DumperRangesHandler(const uint8_t *buffer, uint64 size,
|
||||
DumperRangesHandler(const uint8_t *buffer, uint64_t size,
|
||||
dwarf2reader::ByteReader* reader)
|
||||
: buffer_(buffer), size_(size), reader_(reader) { }
|
||||
|
||||
bool ReadRanges(uint64 offset, Module::Address base_address,
|
||||
bool ReadRanges(uint64_t offset, Module::Address base_address,
|
||||
vector<Module::Range>* ranges) {
|
||||
DwarfRangeListHandler handler(base_address, ranges);
|
||||
dwarf2reader::RangeListReader rangelist_reader(buffer_, size_, reader_,
|
||||
|
@ -326,7 +326,7 @@ class DumpSymbols::DumperRangesHandler:
|
|||
|
||||
private:
|
||||
const uint8_t *buffer_;
|
||||
uint64 size_;
|
||||
uint64_t size_;
|
||||
dwarf2reader::ByteReader* reader_;
|
||||
};
|
||||
|
||||
|
@ -344,7 +344,7 @@ class DumpSymbols::DumperLineToModule:
|
|||
compilation_dir_ = compilation_dir;
|
||||
}
|
||||
|
||||
void ReadProgram(const uint8_t *program, uint64 length,
|
||||
void ReadProgram(const uint8_t *program, uint64_t length,
|
||||
Module *module, vector<Module::Line> *lines) {
|
||||
DwarfLineToModule handler(module, compilation_dir_, lines);
|
||||
dwarf2reader::LineInfo parser(program, length, byte_reader_, &handler);
|
||||
|
@ -445,7 +445,7 @@ void DumpSymbols::ReadDwarf(google_breakpad::Module *module,
|
|||
selected_object_name_.c_str());
|
||||
return;
|
||||
}
|
||||
const std::pair<const uint8_t*, uint64>& debug_info_section =
|
||||
const std::pair<const uint8_t*, uint64_t>& debug_info_section =
|
||||
debug_info_entry->second;
|
||||
|
||||
// Build a line-to-module loader for the root handler to use.
|
||||
|
@ -456,7 +456,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>& 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,
|
||||
|
@ -464,8 +464,8 @@ void DumpSymbols::ReadDwarf(google_breakpad::Module *module,
|
|||
}
|
||||
|
||||
// Walk the __debug_info section, one compilation unit at a time.
|
||||
uint64 debug_info_length = debug_info_section.second;
|
||||
for (uint64 offset = 0; offset < debug_info_length;) {
|
||||
uint64_t debug_info_length = debug_info_section.second;
|
||||
for (uint64_t offset = 0; offset < debug_info_length;) {
|
||||
// Make a handler for the root DIE that populates MODULE with the
|
||||
// debug info.
|
||||
DwarfCUToModule::WarningReporter reporter(selected_object_name_,
|
||||
|
|
Loading…
Reference in a new issue