Use stdint types everywhere

R=mark at https://breakpad.appspot.com/535002/

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1121 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
ted.mielczarek@gmail.com 2013-03-06 14:04:42 +00:00
parent c02002a581
commit aeffe1056f
117 changed files with 1385 additions and 1379 deletions

View file

@ -90,7 +90,7 @@ GetInodeForProcPath(ino_t* inode_out, const char* path)
}
char* endptr;
const u_int64_t inode_ul =
const uint64_t inode_ul =
strtoull(buf + sizeof(kSocketLinkPrefix) - 1, &endptr, 10);
if (*endptr != ']')
return false;

View file

@ -597,7 +597,7 @@ bool ExceptionHandler::WriteMinidump() {
}
void ExceptionHandler::AddMappingInfo(const string& name,
const u_int8_t identifier[sizeof(MDGUID)],
const uint8_t identifier[sizeof(MDGUID)],
uintptr_t start_address,
size_t mapping_size,
size_t file_offset) {

View file

@ -205,7 +205,7 @@ class ExceptionHandler {
// a custom library loader is used that maps things in a way
// that the linux dumper can't handle by reading the maps file.
void AddMappingInfo(const string& name,
const u_int8_t identifier[sizeof(MDGUID)],
const uint8_t identifier[sizeof(MDGUID)],
uintptr_t start_address,
size_t mapping_size,
size_t file_offset);

View file

@ -423,7 +423,7 @@ TEST(ExceptionHandlerTest, InstructionPointerMemory) {
// These are defined here so the parent can use them to check the
// data from the minidump afterwards.
const u_int32_t kMemorySize = 256; // bytes
const uint32_t kMemorySize = 256; // bytes
const int kOffset = kMemorySize / 2;
// This crashes with SIGILL on x86/x86-64/arm.
const unsigned char instructions[] = { 0xff, 0xff, 0xff, 0xff };
@ -483,7 +483,7 @@ TEST(ExceptionHandlerTest, InstructionPointerMemory) {
MinidumpContext* context = exception->GetContext();
ASSERT_TRUE(context);
u_int64_t instruction_pointer;
uint64_t instruction_pointer;
ASSERT_TRUE(context->GetInstructionPointer(&instruction_pointer));
MinidumpMemoryRegion* region =
@ -491,11 +491,11 @@ TEST(ExceptionHandlerTest, InstructionPointerMemory) {
ASSERT_TRUE(region);
EXPECT_EQ(kMemorySize, region->GetSize());
const u_int8_t* bytes = region->GetMemory();
const uint8_t* bytes = region->GetMemory();
ASSERT_TRUE(bytes);
u_int8_t prefix_bytes[kOffset];
u_int8_t suffix_bytes[kMemorySize - kOffset - sizeof(instructions)];
uint8_t prefix_bytes[kOffset];
uint8_t suffix_bytes[kMemorySize - kOffset - sizeof(instructions)];
memset(prefix_bytes, 0, sizeof(prefix_bytes));
memset(suffix_bytes, 0, sizeof(suffix_bytes));
EXPECT_TRUE(memcmp(bytes, prefix_bytes, sizeof(prefix_bytes)) == 0);
@ -515,7 +515,7 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMinBound) {
// These are defined here so the parent can use them to check the
// data from the minidump afterwards.
const u_int32_t kMemorySize = 256; // bytes
const uint32_t kMemorySize = 256; // bytes
const int kOffset = 0;
// This crashes with SIGILL on x86/x86-64/arm.
const unsigned char instructions[] = { 0xff, 0xff, 0xff, 0xff };
@ -575,7 +575,7 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMinBound) {
MinidumpContext* context = exception->GetContext();
ASSERT_TRUE(context);
u_int64_t instruction_pointer;
uint64_t instruction_pointer;
ASSERT_TRUE(context->GetInstructionPointer(&instruction_pointer));
MinidumpMemoryRegion* region =
@ -583,10 +583,10 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMinBound) {
ASSERT_TRUE(region);
EXPECT_EQ(kMemorySize / 2, region->GetSize());
const u_int8_t* bytes = region->GetMemory();
const uint8_t* bytes = region->GetMemory();
ASSERT_TRUE(bytes);
u_int8_t suffix_bytes[kMemorySize / 2 - sizeof(instructions)];
uint8_t suffix_bytes[kMemorySize / 2 - sizeof(instructions)];
memset(suffix_bytes, 0, sizeof(suffix_bytes));
EXPECT_TRUE(memcmp(bytes + kOffset, instructions, sizeof(instructions)) == 0);
EXPECT_TRUE(memcmp(bytes + kOffset + sizeof(instructions),
@ -606,7 +606,7 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMaxBound) {
// Use 4k here because the OS will hand out a single page even
// if a smaller size is requested, and this test wants to
// test the upper bound of the memory range.
const u_int32_t kMemorySize = 4096; // bytes
const uint32_t kMemorySize = 4096; // bytes
// This crashes with SIGILL on x86/x86-64/arm.
const unsigned char instructions[] = { 0xff, 0xff, 0xff, 0xff };
const int kOffset = kMemorySize - sizeof(instructions);
@ -665,7 +665,7 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMaxBound) {
MinidumpContext* context = exception->GetContext();
ASSERT_TRUE(context);
u_int64_t instruction_pointer;
uint64_t instruction_pointer;
ASSERT_TRUE(context->GetInstructionPointer(&instruction_pointer));
MinidumpMemoryRegion* region =
@ -674,10 +674,10 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMaxBound) {
const size_t kPrefixSize = 128; // bytes
EXPECT_EQ(kPrefixSize + sizeof(instructions), region->GetSize());
const u_int8_t* bytes = region->GetMemory();
const uint8_t* bytes = region->GetMemory();
ASSERT_TRUE(bytes);
u_int8_t prefix_bytes[kPrefixSize];
uint8_t prefix_bytes[kPrefixSize];
memset(prefix_bytes, 0, sizeof(prefix_bytes));
EXPECT_TRUE(memcmp(bytes, prefix_bytes, sizeof(prefix_bytes)) == 0);
EXPECT_TRUE(memcmp(bytes + kPrefixSize,
@ -742,9 +742,9 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryNullPointer) {
TEST(ExceptionHandlerTest, ModuleInfo) {
// These are defined here so the parent can use them to check the
// data from the minidump afterwards.
const u_int32_t kMemorySize = sysconf(_SC_PAGESIZE);
const uint32_t kMemorySize = sysconf(_SC_PAGESIZE);
const char* kMemoryName = "a fake module";
const u_int8_t kModuleGUID[sizeof(MDGUID)] = {
const uint8_t kModuleGUID[sizeof(MDGUID)] = {
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
};
@ -998,15 +998,15 @@ TEST(ExceptionHandlerTest, GenerateMultipleDumpsWithPath) {
// Test that an additional memory region can be added to the minidump.
TEST(ExceptionHandlerTest, AdditionalMemory) {
const u_int32_t kMemorySize = sysconf(_SC_PAGESIZE);
const uint32_t kMemorySize = sysconf(_SC_PAGESIZE);
// Get some heap memory.
u_int8_t* memory = new u_int8_t[kMemorySize];
uint8_t* memory = new uint8_t[kMemorySize];
const uintptr_t kMemoryAddress = reinterpret_cast<uintptr_t>(memory);
ASSERT_TRUE(memory);
// Stick some data into the memory so the contents can be verified.
for (u_int32_t i = 0; i < kMemorySize; ++i) {
for (uint32_t i = 0; i < kMemorySize; ++i) {
memory[i] = i % 255;
}
@ -1042,10 +1042,10 @@ TEST(ExceptionHandlerTest, AdditionalMemory) {
// Test that a memory region that was previously registered
// can be unregistered.
TEST(ExceptionHandlerTest, AdditionalMemoryRemove) {
const u_int32_t kMemorySize = sysconf(_SC_PAGESIZE);
const uint32_t kMemorySize = sysconf(_SC_PAGESIZE);
// Get some heap memory.
u_int8_t* memory = new u_int8_t[kMemorySize];
uint8_t* memory = new uint8_t[kMemorySize];
const uintptr_t kMemoryAddress = reinterpret_cast<uintptr_t>(memory);
ASSERT_TRUE(memory);
@ -1109,7 +1109,7 @@ TEST(ExceptionHandlerTest, WriteMinidumpForChild) {
// Check that the crashing thread is the main thread of |child|
MinidumpException* exception = minidump.GetException();
ASSERT_TRUE(exception);
u_int32_t thread_id;
uint32_t thread_id;
ASSERT_TRUE(exception->GetThreadID(&thread_id));
EXPECT_EQ(child, static_cast<int32_t>(thread_id));

View file

@ -333,7 +333,7 @@ void CPUFillFromThreadInfo(MDRawContextARM* out,
out->cpsr = 0;
#if !defined(__ANDROID__)
out->float_save.fpscr = info.fpregs.fpsr |
(static_cast<u_int64_t>(info.fpregs.fpcr) << 32);
(static_cast<uint64_t>(info.fpregs.fpcr) << 32);
// TODO: sort this out, actually collect floating point registers
my_memset(&out->float_save.regs, 0, sizeof(out->float_save.regs));
my_memset(&out->float_save.extra, 0, sizeof(out->float_save.extra));
@ -535,8 +535,8 @@ class MinidumpWriter {
void PopSeccompStackFrame(RawContextCPU* cpu, const MDRawThread& thread,
uint8_t* stack_copy) {
#if defined(__x86_64)
u_int64_t bp = cpu->rbp;
u_int64_t top = thread.stack.start_of_memory_range;
uint64_t bp = cpu->rbp;
uint64_t top = thread.stack.start_of_memory_range;
for (int i = 4; i--; ) {
if (bp < top ||
bp + sizeof(bp) > thread.stack.start_of_memory_range +
@ -546,7 +546,7 @@ class MinidumpWriter {
}
uint64_t old_top = top;
top = bp;
u_int8_t* bp_addr = stack_copy + bp - thread.stack.start_of_memory_range;
uint8_t* bp_addr = stack_copy + bp - thread.stack.start_of_memory_range;
my_memcpy(&bp, bp_addr, sizeof(bp));
if (bp == 0xDEADBEEFDEADBEEFull) {
struct {
@ -598,8 +598,8 @@ class MinidumpWriter {
}
}
#elif defined(__i386)
u_int32_t bp = cpu->ebp;
u_int32_t top = thread.stack.start_of_memory_range;
uint32_t bp = cpu->ebp;
uint32_t top = thread.stack.start_of_memory_range;
for (int i = 4; i--; ) {
if (bp < top ||
bp + sizeof(bp) > thread.stack.start_of_memory_range +
@ -609,7 +609,7 @@ class MinidumpWriter {
}
uint32_t old_top = top;
top = bp;
u_int8_t* bp_addr = stack_copy + bp - thread.stack.start_of_memory_range;
uint8_t* bp_addr = stack_copy + bp - thread.stack.start_of_memory_range;
my_memcpy(&bp, bp_addr, sizeof(bp));
if (bp == 0xDEADBEEFu) {
struct {
@ -721,7 +721,7 @@ class MinidumpWriter {
// Copy 256 bytes around crashing instruction pointer to minidump.
const size_t kIPMemorySize = 256;
u_int64_t ip = GetInstructionPointer();
uint64_t ip = GetInstructionPointer();
// Bound it to the upper and lower bounds of the memory map
// it's contained within. If it's not in mapped memory,
// don't bother trying to write it.
@ -921,7 +921,7 @@ class MinidumpWriter {
bool member,
unsigned int mapping_id,
MDRawModule& mod,
const u_int8_t* identifier) {
const uint8_t* identifier) {
my_memset(&mod, 0, MD_MODULE_SIZE);
mod.base_of_image = mapping.start_addr;

View file

@ -46,7 +46,7 @@ class ExceptionHandler;
struct MappingEntry {
MappingInfo first;
u_int8_t second[sizeof(MDGUID)];
uint8_t second[sizeof(MDGUID)];
};
// A list of <MappingInfo, GUID>

View file

@ -131,9 +131,9 @@ TEST(MinidumpWriterTest, MappingInfo) {
// These are defined here so the parent can use them to check the
// data from the minidump afterwards.
const u_int32_t memory_size = sysconf(_SC_PAGESIZE);
const uint32_t memory_size = sysconf(_SC_PAGESIZE);
const char* kMemoryName = "a fake module";
const u_int8_t kModuleGUID[sizeof(MDGUID)] = {
const uint8_t kModuleGUID[sizeof(MDGUID)] = {
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
};
@ -213,7 +213,7 @@ TEST(MinidumpWriterTest, MappingInfo) {
EXPECT_EQ(kMemoryName, module->code_file());
EXPECT_EQ(module_identifier, module->debug_identifier());
u_int32_t len;
uint32_t len;
// These streams are expected to be there
EXPECT_TRUE(minidump.SeekToStreamType(MD_THREAD_LIST_STREAM, &len));
EXPECT_TRUE(minidump.SeekToStreamType(MD_MEMORY_LIST_STREAM, &len));
@ -241,7 +241,7 @@ TEST(MinidumpWriterTest, MappingInfoContained) {
// data from the minidump afterwards.
const int32_t memory_size = sysconf(_SC_PAGESIZE);
const char* kMemoryName = "a fake module";
const u_int8_t kModuleGUID[sizeof(MDGUID)] = {
const uint8_t kModuleGUID[sizeof(MDGUID)] = {
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
};
@ -435,15 +435,15 @@ TEST(MinidumpWriterTest, AdditionalMemory) {
// These are defined here so the parent can use them to check the
// data from the minidump afterwards.
const u_int32_t kMemorySize = sysconf(_SC_PAGESIZE);
const uint32_t kMemorySize = sysconf(_SC_PAGESIZE);
// Get some heap memory.
u_int8_t* memory = new u_int8_t[kMemorySize];
uint8_t* memory = new uint8_t[kMemorySize];
const uintptr_t kMemoryAddress = reinterpret_cast<uintptr_t>(memory);
ASSERT_TRUE(memory);
// Stick some data into the memory so the contents can be verified.
for (u_int32_t i = 0; i < kMemorySize; ++i) {
for (uint32_t i = 0; i < kMemorySize; ++i) {
memory[i] = i % 255;
}

View file

@ -410,7 +410,7 @@ bool MinidumpGenerator::WriteContext(breakpad_thread_state_data_t state,
}
}
u_int64_t MinidumpGenerator::CurrentPCForStack(
uint64_t MinidumpGenerator::CurrentPCForStack(
breakpad_thread_state_data_t state) {
switch (cpu_type_) {
#ifdef HAS_ARM_SUPPORT
@ -444,7 +444,7 @@ bool MinidumpGenerator::WriteStackARM(breakpad_thread_state_data_t state,
return WriteStackFromStartAddress(start_addr, stack_location);
}
u_int64_t
uint64_t
MinidumpGenerator::CurrentPCForStackARM(breakpad_thread_state_data_t state) {
arm_thread_state_t *machine_state =
reinterpret_cast<arm_thread_state_t *>(state);
@ -510,7 +510,7 @@ bool MinidumpGenerator::WriteStackPPC64(breakpad_thread_state_data_t state,
return WriteStackFromStartAddress(start_addr, stack_location);
}
u_int64_t
uint64_t
MinidumpGenerator::CurrentPCForStackPPC(breakpad_thread_state_data_t state) {
ppc_thread_state_t *machine_state =
reinterpret_cast<ppc_thread_state_t *>(state);
@ -518,7 +518,7 @@ MinidumpGenerator::CurrentPCForStackPPC(breakpad_thread_state_data_t state) {
return REGISTER_FROM_THREADSTATE(machine_state, srr0);
}
u_int64_t
uint64_t
MinidumpGenerator::CurrentPCForStackPPC64(breakpad_thread_state_data_t state) {
ppc_thread_state64_t *machine_state =
reinterpret_cast<ppc_thread_state64_t *>(state);
@ -672,7 +672,7 @@ bool MinidumpGenerator::WriteStackX86_64(breakpad_thread_state_data_t state,
return WriteStackFromStartAddress(start_addr, stack_location);
}
u_int64_t
uint64_t
MinidumpGenerator::CurrentPCForStackX86(breakpad_thread_state_data_t state) {
i386_thread_state_t *machine_state =
reinterpret_cast<i386_thread_state_t *>(state);
@ -680,7 +680,7 @@ MinidumpGenerator::CurrentPCForStackX86(breakpad_thread_state_data_t state) {
return REGISTER_FROM_THREADSTATE(machine_state, eip);
}
u_int64_t
uint64_t
MinidumpGenerator::CurrentPCForStackX86_64(breakpad_thread_state_data_t state) {
x86_thread_state64_t *machine_state =
reinterpret_cast<x86_thread_state64_t *>(state);
@ -764,7 +764,7 @@ bool MinidumpGenerator::WriteContextX86_64(
// not used in the flags register. Since the minidump format
// specifies 32 bits for the flags register, we can truncate safely
// with no loss.
context_ptr->eflags = static_cast<u_int32_t>(REGISTER_FROM_THREADSTATE(machine_state, rflags));
context_ptr->eflags = static_cast<uint32_t>(REGISTER_FROM_THREADSTATE(machine_state, rflags));
AddReg(cs);
AddReg(fs);
AddReg(gs);
@ -899,7 +899,7 @@ bool MinidumpGenerator::WriteMemoryListStream(
= static_cast<mach_msg_type_number_t>(sizeof(state));
if (GetThreadState(exception_thread_, state, &stateCount)) {
u_int64_t ip = CurrentPCForStack(state);
uint64_t ip = CurrentPCForStack(state);
// Bound it to the upper and lower bounds of the region
// it's contained within. If it's not in a known memory region,
// don't bother trying to write it.
@ -1162,7 +1162,7 @@ bool MinidumpGenerator::WriteModuleStream(unsigned int index,
return false;
module->base_of_image = image->GetVMAddr() + image->GetVMAddrSlide();
module->size_of_image = static_cast<u_int32_t>(image->GetVMSize());
module->size_of_image = static_cast<uint32_t>(image->GetVMSize());
module->module_name_rva = string_location.rva;
// We'll skip the executable module, because they don't have
@ -1228,7 +1228,7 @@ bool MinidumpGenerator::WriteModuleStream(unsigned int index,
return false;
module->base_of_image = seg->vmaddr + slide;
module->size_of_image = static_cast<u_int32_t>(seg->vmsize);
module->size_of_image = static_cast<uint32_t>(seg->vmsize);
module->module_name_rva = string_location.rva;
bool in_memory = false;
@ -1287,7 +1287,7 @@ bool MinidumpGenerator::WriteCVRecord(MDRawModule *module, int cpu_type,
size_t module_name_length = strlen(module_name);
if (!cv.AllocateObjectAndArray(module_name_length + 1, sizeof(u_int8_t)))
if (!cv.AllocateObjectAndArray(module_name_length + 1, sizeof(uint8_t)))
return false;
if (!cv.CopyIndexAfterObject(0, module_name, module_name_length))
@ -1388,7 +1388,7 @@ bool MinidumpGenerator::WriteMiscInfoStream(MDRawDirectory *misc_info_stream) {
misc_info_stream->location = info.location();
MDRawMiscInfo *info_ptr = info.get();
info_ptr->size_of_info = static_cast<u_int32_t>(sizeof(MDRawMiscInfo));
info_ptr->size_of_info = static_cast<uint32_t>(sizeof(MDRawMiscInfo));
info_ptr->flags1 = MD_MISCINFO_FLAGS1_PROCESS_ID |
MD_MISCINFO_FLAGS1_PROCESS_TIMES |
MD_MISCINFO_FLAGS1_PROCESSOR_POWER_INFO;
@ -1401,18 +1401,18 @@ bool MinidumpGenerator::WriteMiscInfoStream(MDRawDirectory *misc_info_stream) {
if (getrusage(RUSAGE_SELF, &usage) != -1) {
// Omit the fractional time since the MDRawMiscInfo only wants seconds
info_ptr->process_user_time =
static_cast<u_int32_t>(usage.ru_utime.tv_sec);
static_cast<uint32_t>(usage.ru_utime.tv_sec);
info_ptr->process_kernel_time =
static_cast<u_int32_t>(usage.ru_stime.tv_sec);
static_cast<uint32_t>(usage.ru_stime.tv_sec);
}
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID,
static_cast<int>(info_ptr->process_id) };
u_int mibsize = static_cast<u_int>(sizeof(mib) / sizeof(mib[0]));
uint mibsize = static_cast<uint>(sizeof(mib) / sizeof(mib[0]));
struct kinfo_proc proc;
size_t size = sizeof(proc);
if (sysctl(mib, mibsize, &proc, &size, NULL, 0) == 0) {
info_ptr->process_create_time =
static_cast<u_int32_t>(proc.kp_proc.p_starttime.tv_sec);
static_cast<uint32_t>(proc.kp_proc.p_starttime.tv_sec);
}
// Speed
@ -1420,11 +1420,11 @@ bool MinidumpGenerator::WriteMiscInfoStream(MDRawDirectory *misc_info_stream) {
const uint64_t kOneMillion = 1000 * 1000;
size = sizeof(speed);
sysctlbyname("hw.cpufrequency_max", &speed, &size, NULL, 0);
info_ptr->processor_max_mhz = static_cast<u_int32_t>(speed / kOneMillion);
info_ptr->processor_mhz_limit = static_cast<u_int32_t>(speed / kOneMillion);
info_ptr->processor_max_mhz = static_cast<uint32_t>(speed / kOneMillion);
info_ptr->processor_mhz_limit = static_cast<uint32_t>(speed / kOneMillion);
size = sizeof(speed);
sysctlbyname("hw.cpufrequency", &speed, &size, NULL, 0);
info_ptr->processor_current_mhz = static_cast<u_int32_t>(speed / kOneMillion);
info_ptr->processor_current_mhz = static_cast<uint32_t>(speed / kOneMillion);
return true;
}

View file

@ -130,7 +130,7 @@ class MinidumpGenerator {
bool WriteBreakpadInfoStream(MDRawDirectory *breakpad_info_stream);
// Helpers
u_int64_t CurrentPCForStack(breakpad_thread_state_data_t state);
uint64_t CurrentPCForStack(breakpad_thread_state_data_t state);
bool GetThreadState(thread_act_t target_thread, thread_state_t state,
mach_msg_type_number_t *count);
bool WriteStackFromStartAddress(mach_vm_address_t start_addr,
@ -151,31 +151,31 @@ class MinidumpGenerator {
MDMemoryDescriptor *stack_location);
bool WriteContextARM(breakpad_thread_state_data_t state,
MDLocationDescriptor *register_location);
u_int64_t CurrentPCForStackARM(breakpad_thread_state_data_t state);
uint64_t CurrentPCForStackARM(breakpad_thread_state_data_t state);
#endif
#ifdef HAS_PPC_SUPPORT
bool WriteStackPPC(breakpad_thread_state_data_t state,
MDMemoryDescriptor *stack_location);
bool WriteContextPPC(breakpad_thread_state_data_t state,
MDLocationDescriptor *register_location);
u_int64_t CurrentPCForStackPPC(breakpad_thread_state_data_t state);
uint64_t CurrentPCForStackPPC(breakpad_thread_state_data_t state);
bool WriteStackPPC64(breakpad_thread_state_data_t state,
MDMemoryDescriptor *stack_location);
bool WriteContextPPC64(breakpad_thread_state_data_t state,
MDLocationDescriptor *register_location);
u_int64_t CurrentPCForStackPPC64(breakpad_thread_state_data_t state);
uint64_t CurrentPCForStackPPC64(breakpad_thread_state_data_t state);
#endif
#ifdef HAS_X86_SUPPORT
bool WriteStackX86(breakpad_thread_state_data_t state,
MDMemoryDescriptor *stack_location);
bool WriteContextX86(breakpad_thread_state_data_t state,
MDLocationDescriptor *register_location);
u_int64_t CurrentPCForStackX86(breakpad_thread_state_data_t state);
uint64_t CurrentPCForStackX86(breakpad_thread_state_data_t state);
bool WriteStackX86_64(breakpad_thread_state_data_t state,
MDMemoryDescriptor *stack_location);
bool WriteContextX86_64(breakpad_thread_state_data_t state,
MDLocationDescriptor *register_location);
u_int64_t CurrentPCForStackX86_64(breakpad_thread_state_data_t state);
uint64_t CurrentPCForStackX86_64(breakpad_thread_state_data_t state);
#endif
// disallow copy ctor and operator=

View file

@ -318,7 +318,7 @@ const MDCPUArchitecture kExpectedArchitecture =
MD_CPU_ARCHITECTURE_AMD64
#endif
;
const u_int32_t kExpectedContext =
const uint32_t kExpectedContext =
#if defined(__i386__)
MD_CONTEXT_AMD64
#elif defined(__x86_64__)

View file

@ -277,7 +277,7 @@ TEST_F(ExceptionHandlerTest, InstructionPointerMemory) {
// These are defined here so the parent can use them to check the
// data from the minidump afterwards.
const u_int32_t kMemorySize = 256; // bytes
const uint32_t kMemorySize = 256; // bytes
const int kOffset = kMemorySize / 2;
// This crashes with SIGILL on x86/x86-64/arm.
const unsigned char instructions[] = { 0xff, 0xff, 0xff, 0xff };
@ -346,7 +346,7 @@ TEST_F(ExceptionHandlerTest, InstructionPointerMemory) {
MinidumpContext* context = exception->GetContext();
ASSERT_TRUE(context);
u_int64_t instruction_pointer;
uint64_t instruction_pointer;
ASSERT_TRUE(context->GetInstructionPointer(&instruction_pointer));
MinidumpMemoryRegion* region =
@ -354,11 +354,11 @@ TEST_F(ExceptionHandlerTest, InstructionPointerMemory) {
EXPECT_TRUE(region);
EXPECT_EQ(kMemorySize, region->GetSize());
const u_int8_t* bytes = region->GetMemory();
const uint8_t* bytes = region->GetMemory();
ASSERT_TRUE(bytes);
u_int8_t prefix_bytes[kOffset];
u_int8_t suffix_bytes[kMemorySize - kOffset - sizeof(instructions)];
uint8_t prefix_bytes[kOffset];
uint8_t suffix_bytes[kMemorySize - kOffset - sizeof(instructions)];
memset(prefix_bytes, 0, sizeof(prefix_bytes));
memset(suffix_bytes, 0, sizeof(suffix_bytes));
EXPECT_TRUE(memcmp(bytes, prefix_bytes, sizeof(prefix_bytes)) == 0);
@ -376,7 +376,7 @@ TEST_F(ExceptionHandlerTest, InstructionPointerMemoryMinBound) {
// These are defined here so the parent can use them to check the
// data from the minidump afterwards.
const u_int32_t kMemorySize = 256; // bytes
const uint32_t kMemorySize = 256; // bytes
const int kOffset = 0;
// This crashes with SIGILL on x86/x86-64/arm.
const unsigned char instructions[] = { 0xff, 0xff, 0xff, 0xff };
@ -445,7 +445,7 @@ TEST_F(ExceptionHandlerTest, InstructionPointerMemoryMinBound) {
MinidumpContext* context = exception->GetContext();
ASSERT_TRUE(context);
u_int64_t instruction_pointer;
uint64_t instruction_pointer;
ASSERT_TRUE(context->GetInstructionPointer(&instruction_pointer));
MinidumpMemoryRegion* region =
@ -453,10 +453,10 @@ TEST_F(ExceptionHandlerTest, InstructionPointerMemoryMinBound) {
EXPECT_TRUE(region);
EXPECT_EQ(kMemorySize / 2, region->GetSize());
const u_int8_t* bytes = region->GetMemory();
const uint8_t* bytes = region->GetMemory();
ASSERT_TRUE(bytes);
u_int8_t suffix_bytes[kMemorySize / 2 - sizeof(instructions)];
uint8_t suffix_bytes[kMemorySize / 2 - sizeof(instructions)];
memset(suffix_bytes, 0, sizeof(suffix_bytes));
EXPECT_TRUE(memcmp(bytes + kOffset, instructions, sizeof(instructions)) == 0);
EXPECT_TRUE(memcmp(bytes + kOffset + sizeof(instructions),
@ -475,7 +475,7 @@ TEST_F(ExceptionHandlerTest, InstructionPointerMemoryMaxBound) {
// Use 4k here because the OS will hand out a single page even
// if a smaller size is requested, and this test wants to
// test the upper bound of the memory range.
const u_int32_t kMemorySize = 4096; // bytes
const uint32_t kMemorySize = 4096; // bytes
// This crashes with SIGILL on x86/x86-64/arm.
const unsigned char instructions[] = { 0xff, 0xff, 0xff, 0xff };
const int kOffset = kMemorySize - sizeof(instructions);
@ -544,7 +544,7 @@ TEST_F(ExceptionHandlerTest, InstructionPointerMemoryMaxBound) {
MinidumpContext* context = exception->GetContext();
ASSERT_TRUE(context);
u_int64_t instruction_pointer;
uint64_t instruction_pointer;
ASSERT_TRUE(context->GetInstructionPointer(&instruction_pointer));
MinidumpMemoryRegion* region =
@ -553,10 +553,10 @@ TEST_F(ExceptionHandlerTest, InstructionPointerMemoryMaxBound) {
const size_t kPrefixSize = 128; // bytes
EXPECT_EQ(kPrefixSize + sizeof(instructions), region->GetSize());
const u_int8_t* bytes = region->GetMemory();
const uint8_t* bytes = region->GetMemory();
ASSERT_TRUE(bytes);
u_int8_t prefix_bytes[kPrefixSize];
uint8_t prefix_bytes[kPrefixSize];
memset(prefix_bytes, 0, sizeof(prefix_bytes));
EXPECT_TRUE(memcmp(bytes, prefix_bytes, sizeof(prefix_bytes)) == 0);
EXPECT_TRUE(memcmp(bytes + kPrefixSize,

View file

@ -280,7 +280,7 @@ const MDCPUArchitecture kExpectedArchitecture =
MD_CPU_ARCHITECTURE_AMD64
#endif
;
const u_int32_t kExpectedContext =
const uint32_t kExpectedContext =
#if defined(__i386__)
MD_CONTEXT_AMD64
#elif defined(__x86_64__)

View file

@ -65,7 +65,7 @@ const MDCPUArchitecture kNativeArchitecture =
#endif
;
const u_int32_t kNativeContext =
const uint32_t kNativeContext =
#if defined(__i386__)
MD_CONTEXT_X86
#elif defined(__x86_64__)

View file

@ -99,11 +99,11 @@ bool MinidumpFileWriter::CopyStringToMDString(const wchar_t *str,
unsigned int length,
TypedMDRVA<MDString> *mdstring) {
bool result = true;
if (sizeof(wchar_t) == sizeof(u_int16_t)) {
if (sizeof(wchar_t) == sizeof(uint16_t)) {
// Shortcut if wchar_t is the same size as MDString's buffer
result = mdstring->Copy(str, mdstring->get()->length);
} else {
u_int16_t out[2];
uint16_t out[2];
int out_idx = 0;
// Copy the string character by character
@ -120,7 +120,7 @@ bool MinidumpFileWriter::CopyStringToMDString(const wchar_t *str,
// zero, but the second one may be zero, depending on the conversion from
// UTF-32.
int out_count = out[1] ? 2 : 1;
size_t out_size = sizeof(u_int16_t) * out_count;
size_t out_size = sizeof(uint16_t) * out_count;
result = mdstring->CopyIndexAfterObject(out_idx, out, out_size);
out_idx += out_count;
}
@ -132,7 +132,7 @@ bool MinidumpFileWriter::CopyStringToMDString(const char *str,
unsigned int length,
TypedMDRVA<MDString> *mdstring) {
bool result = true;
u_int16_t out[2];
uint16_t out[2];
int out_idx = 0;
// Copy the string character by character
@ -147,7 +147,7 @@ bool MinidumpFileWriter::CopyStringToMDString(const char *str,
// Append the one or two UTF-16 characters
int out_count = out[1] ? 2 : 1;
size_t out_size = sizeof(u_int16_t) * out_count;
size_t out_size = sizeof(uint16_t) * out_count;
result = mdstring->CopyIndexAfterObject(out_idx, out, out_size);
out_idx += out_count;
}
@ -170,17 +170,17 @@ bool MinidumpFileWriter::WriteStringCore(const CharType *str,
// Allocate the string buffer
TypedMDRVA<MDString> mdstring(this);
if (!mdstring.AllocateObjectAndArray(mdstring_length + 1, sizeof(u_int16_t)))
if (!mdstring.AllocateObjectAndArray(mdstring_length + 1, sizeof(uint16_t)))
return false;
// Set length excluding the NULL and copy the string
mdstring.get()->length =
static_cast<u_int32_t>(mdstring_length * sizeof(u_int16_t));
static_cast<uint32_t>(mdstring_length * sizeof(uint16_t));
bool result = CopyStringToMDString(str, mdstring_length, &mdstring);
// NULL terminate
if (result) {
u_int16_t ch = 0;
uint16_t ch = 0;
result = mdstring.CopyIndexAfterObject(mdstring_length, &ch, sizeof(ch));
if (result)
@ -211,7 +211,7 @@ bool MinidumpFileWriter::WriteMemory(const void *src, size_t size,
if (!mem.Copy(src, mem.size()))
return false;
output->start_of_memory_range = reinterpret_cast<u_int64_t>(src);
output->start_of_memory_range = reinterpret_cast<uint64_t>(src);
output->memory = mem.location();
return true;

View file

@ -172,7 +172,7 @@ class UntypedMDRVA {
// Return size and position
inline MDLocationDescriptor location() const {
MDLocationDescriptor location = { static_cast<u_int32_t>(size_),
MDLocationDescriptor location = { static_cast<uint32_t>(size_),
position_ };
return location;
}

View file

@ -455,7 +455,7 @@ bool WriteCVRecord(MinidumpFileWriter *minidump_writer,
snprintf(path, sizeof(path), "/proc/self/object/%s", module_name);
size_t module_name_length = strlen(realname);
if (!cv.AllocateObjectAndArray(module_name_length + 1, sizeof(u_int8_t)))
if (!cv.AllocateObjectAndArray(module_name_length + 1, sizeof(uint8_t)))
return false;
if (!cv.CopyIndexAfterObject(0, realname, module_name_length))
return false;
@ -522,7 +522,7 @@ bool ModuleInfoCallback(const ModuleInfo &module_info, void *context) {
if (!callback_context->minidump_writer->WriteString(realname, 0, &loc))
return false;
module.base_of_image = (u_int64_t)module_info.start_addr;
module.base_of_image = (uint64_t)module_info.start_addr;
module.size_of_image = module_info.size;
module.module_name_rva = loc.rva;

View file

@ -32,6 +32,7 @@
#include <windows.h>
#include <dbghelp.h>
#include <rpc.h>
#include <list>
#include "google_breakpad/common/minidump_format.h"

View file

@ -265,7 +265,7 @@ TEST_F(ExceptionHandlerDeathTest, InstructionPointerMemory) {
testing::DisableExceptionHandlerInScope disable_exception_handler;
// Get some executable memory.
const u_int32_t kMemorySize = 256; // bytes
const uint32_t kMemorySize = 256; // bytes
const int kOffset = kMemorySize / 2;
// This crashes with SIGILL on x86/x86-64/arm.
const unsigned char instructions[] = { 0xff, 0xff, 0xff, 0xff };
@ -314,7 +314,7 @@ TEST_F(ExceptionHandlerDeathTest, InstructionPointerMemory) {
MinidumpContext* context = exception->GetContext();
ASSERT_TRUE(context);
u_int64_t instruction_pointer;
uint64_t instruction_pointer;
ASSERT_TRUE(context->GetInstructionPointer(&instruction_pointer));
MinidumpMemoryRegion* region =
@ -322,11 +322,11 @@ TEST_F(ExceptionHandlerDeathTest, InstructionPointerMemory) {
ASSERT_TRUE(region);
EXPECT_EQ(kMemorySize, region->GetSize());
const u_int8_t* bytes = region->GetMemory();
const uint8_t* bytes = region->GetMemory();
ASSERT_TRUE(bytes);
u_int8_t prefix_bytes[kOffset];
u_int8_t suffix_bytes[kMemorySize - kOffset - sizeof(instructions)];
uint8_t prefix_bytes[kOffset];
uint8_t suffix_bytes[kMemorySize - kOffset - sizeof(instructions)];
memset(prefix_bytes, 0, sizeof(prefix_bytes));
memset(suffix_bytes, 0, sizeof(suffix_bytes));
EXPECT_TRUE(memcmp(bytes, prefix_bytes, sizeof(prefix_bytes)) == 0);
@ -352,7 +352,7 @@ TEST_F(ExceptionHandlerDeathTest, InstructionPointerMemoryMinBound) {
SYSTEM_INFO sSysInfo; // Useful information about the system
GetSystemInfo(&sSysInfo); // Initialize the structure.
const u_int32_t kMemorySize = 256; // bytes
const uint32_t kMemorySize = 256; // bytes
const DWORD kPageSize = sSysInfo.dwPageSize;
const int kOffset = 0;
// This crashes with SIGILL on x86/x86-64/arm.
@ -407,7 +407,7 @@ TEST_F(ExceptionHandlerDeathTest, InstructionPointerMemoryMinBound) {
MinidumpContext* context = exception->GetContext();
ASSERT_TRUE(context);
u_int64_t instruction_pointer;
uint64_t instruction_pointer;
ASSERT_TRUE(context->GetInstructionPointer(&instruction_pointer));
MinidumpMemoryRegion* region =
@ -415,10 +415,10 @@ TEST_F(ExceptionHandlerDeathTest, InstructionPointerMemoryMinBound) {
ASSERT_TRUE(region);
EXPECT_EQ(kMemorySize / 2, region->GetSize());
const u_int8_t* bytes = region->GetMemory();
const uint8_t* bytes = region->GetMemory();
ASSERT_TRUE(bytes);
u_int8_t suffix_bytes[kMemorySize / 2 - sizeof(instructions)];
uint8_t suffix_bytes[kMemorySize / 2 - sizeof(instructions)];
memset(suffix_bytes, 0, sizeof(suffix_bytes));
EXPECT_TRUE(memcmp(bytes + kOffset,
instructions, sizeof(instructions)) == 0);
@ -492,7 +492,7 @@ TEST_F(ExceptionHandlerDeathTest, InstructionPointerMemoryMaxBound) {
MinidumpContext* context = exception->GetContext();
ASSERT_TRUE(context);
u_int64_t instruction_pointer;
uint64_t instruction_pointer;
ASSERT_TRUE(context->GetInstructionPointer(&instruction_pointer));
MinidumpMemoryRegion* region =
@ -501,10 +501,10 @@ TEST_F(ExceptionHandlerDeathTest, InstructionPointerMemoryMaxBound) {
const size_t kPrefixSize = 128; // bytes
EXPECT_EQ(kPrefixSize + sizeof(instructions), region->GetSize());
const u_int8_t* bytes = region->GetMemory();
const uint8_t* bytes = region->GetMemory();
ASSERT_TRUE(bytes);
u_int8_t prefix_bytes[kPrefixSize];
uint8_t prefix_bytes[kPrefixSize];
memset(prefix_bytes, 0, sizeof(prefix_bytes));
EXPECT_TRUE(memcmp(bytes, prefix_bytes, sizeof(prefix_bytes)) == 0);
EXPECT_TRUE(memcmp(bytes + kPrefixSize,

View file

@ -397,15 +397,15 @@ TEST_F(ExceptionHandlerTest, WriteMinidumpTest) {
TEST_F(ExceptionHandlerTest, AdditionalMemory) {
SYSTEM_INFO si;
GetSystemInfo(&si);
const u_int32_t kMemorySize = si.dwPageSize;
const uint32_t kMemorySize = si.dwPageSize;
// Get some heap memory.
u_int8_t* memory = new u_int8_t[kMemorySize];
uint8_t* memory = new uint8_t[kMemorySize];
const uintptr_t kMemoryAddress = reinterpret_cast<uintptr_t>(memory);
ASSERT_TRUE(memory);
// Stick some data into the memory so the contents can be verified.
for (u_int32_t i = 0; i < kMemorySize; ++i) {
for (uint32_t i = 0; i < kMemorySize; ++i) {
memory[i] = i % 255;
}
@ -451,15 +451,15 @@ TEST_F(ExceptionHandlerTest, AdditionalMemory) {
TEST_F(ExceptionHandlerTest, AdditionalMemoryRemove) {
SYSTEM_INFO si;
GetSystemInfo(&si);
const u_int32_t kMemorySize = si.dwPageSize;
const uint32_t kMemorySize = si.dwPageSize;
// Get some heap memory.
u_int8_t* memory = new u_int8_t[kMemorySize];
uint8_t* memory = new uint8_t[kMemorySize];
const uintptr_t kMemoryAddress = reinterpret_cast<uintptr_t>(memory);
ASSERT_TRUE(memory);
// Stick some data into the memory so the contents can be verified.
for (u_int32_t i = 0; i < kMemorySize; ++i) {
for (uint32_t i = 0; i < kMemorySize; ++i) {
memory[i] = i % 255;
}

View file

@ -41,10 +41,10 @@ namespace google_breakpad {
using dwarf2reader::DwarfPointerEncoding;
CFISection &CFISection::CIEHeader(u_int64_t code_alignment_factor,
CFISection &CFISection::CIEHeader(uint64_t code_alignment_factor,
int data_alignment_factor,
unsigned return_address_register,
u_int8_t version,
uint8_t version,
const string &augmentation,
bool dwarf64) {
assert(!entry_length_);
@ -73,8 +73,8 @@ CFISection &CFISection::CIEHeader(u_int64_t code_alignment_factor,
}
CFISection &CFISection::FDEHeader(Label cie_pointer,
u_int64_t initial_location,
u_int64_t address_range,
uint64_t initial_location,
uint64_t address_range,
bool dwarf64) {
assert(!entry_length_);
entry_length_ = new PendingLength();
@ -117,7 +117,7 @@ CFISection &CFISection::FinishEntry() {
return *this;
}
CFISection &CFISection::EncodedPointer(u_int64_t address,
CFISection &CFISection::EncodedPointer(uint64_t address,
DwarfPointerEncoding encoding,
const EncodedPointerBases &bases) {
// Omitted data is extremely easy to emit.
@ -131,7 +131,7 @@ CFISection &CFISection::EncodedPointer(u_int64_t address,
// Find the base address to which this pointer is relative. The upper
// nybble of the encoding specifies this.
u_int64_t base;
uint64_t base;
switch (encoding & 0xf0) {
case dwarf2reader::DW_EH_PE_absptr: base = 0; break;
case dwarf2reader::DW_EH_PE_pcrel: base = bases.cfi + Size(); break;
@ -189,10 +189,10 @@ CFISection &CFISection::EncodedPointer(u_int64_t address,
return *this;
};
const u_int32_t CFISection::kDwarf64InitialLengthMarker;
const u_int32_t CFISection::kDwarf32CIEIdentifier;
const u_int64_t CFISection::kDwarf64CIEIdentifier;
const u_int32_t CFISection::kEHFrame32CIEIdentifier;
const u_int64_t CFISection::kEHFrame64CIEIdentifier;
const uint32_t CFISection::kDwarf64InitialLengthMarker;
const uint32_t CFISection::kDwarf32CIEIdentifier;
const uint64_t CFISection::kDwarf64CIEIdentifier;
const uint32_t CFISection::kEHFrame32CIEIdentifier;
const uint64_t CFISection::kEHFrame64CIEIdentifier;
} // namespace google_breakpad

View file

@ -80,14 +80,14 @@ class CFISection: public Section {
// The starting address of this CFI section in memory, for
// DW_EH_PE_pcrel. DW_EH_PE_pcrel pointers may only be used in data
// that has is loaded into the program's address space.
u_int64_t cfi;
uint64_t cfi;
// The starting address of this file's .text section, for DW_EH_PE_textrel.
u_int64_t text;
uint64_t text;
// The starting address of this file's .got or .eh_frame_hdr section,
// for DW_EH_PE_datarel.
u_int64_t data;
uint64_t data;
};
// Create a CFISection whose endianness is ENDIANNESS, and where
@ -133,10 +133,10 @@ class CFISection: public Section {
// Before calling this function, you will typically want to use Mark
// or Here to make a label to pass to FDEHeader that refers to this
// CIE's position in the section.
CFISection &CIEHeader(u_int64_t code_alignment_factor,
CFISection &CIEHeader(uint64_t code_alignment_factor,
int data_alignment_factor,
unsigned return_address_register,
u_int8_t version = 3,
uint8_t version = 3,
const string &augmentation = "",
bool dwarf64 = false);
@ -151,8 +151,8 @@ class CFISection: public Section {
// value.) Nor does it support .debug_frame sections longer than
// 0xffffff00 bytes.
CFISection &FDEHeader(Label cie_pointer,
u_int64_t initial_location,
u_int64_t address_range,
uint64_t initial_location,
uint64_t address_range,
bool dwarf64 = false);
// Note the current position as the end of the last CIE or FDE we
@ -171,7 +171,7 @@ class CFISection: public Section {
// Append ADDRESS to this section, in the appropriate size and
// endianness. Return a reference to this section.
CFISection &Address(u_int64_t address) {
CFISection &Address(uint64_t address) {
Section::Append(endianness(), address_size_, address);
return *this;
}
@ -189,26 +189,26 @@ class CFISection: public Section {
//
// (C++ doesn't let me use default arguments here, because I want to
// refer to members of *this in the default argument expression.)
CFISection &EncodedPointer(u_int64_t address) {
CFISection &EncodedPointer(uint64_t address) {
return EncodedPointer(address, pointer_encoding_, encoded_pointer_bases_);
}
CFISection &EncodedPointer(u_int64_t address, DwarfPointerEncoding encoding) {
CFISection &EncodedPointer(uint64_t address, DwarfPointerEncoding encoding) {
return EncodedPointer(address, encoding, encoded_pointer_bases_);
}
CFISection &EncodedPointer(u_int64_t address, DwarfPointerEncoding encoding,
CFISection &EncodedPointer(uint64_t address, DwarfPointerEncoding encoding,
const EncodedPointerBases &bases);
// Restate some member functions, to keep chaining working nicely.
CFISection &Mark(Label *label) { Section::Mark(label); return *this; }
CFISection &D8(u_int8_t v) { Section::D8(v); return *this; }
CFISection &D16(u_int16_t v) { Section::D16(v); return *this; }
CFISection &D8(uint8_t v) { Section::D8(v); return *this; }
CFISection &D16(uint16_t v) { Section::D16(v); return *this; }
CFISection &D16(Label v) { Section::D16(v); return *this; }
CFISection &D32(u_int32_t v) { Section::D32(v); return *this; }
CFISection &D32(uint32_t v) { Section::D32(v); return *this; }
CFISection &D32(const Label &v) { Section::D32(v); return *this; }
CFISection &D64(u_int64_t v) { Section::D64(v); return *this; }
CFISection &D64(uint64_t v) { Section::D64(v); return *this; }
CFISection &D64(const Label &v) { Section::D64(v); return *this; }
CFISection &LEB128(long long v) { Section::LEB128(v); return *this; }
CFISection &ULEB128(u_int64_t v) { Section::ULEB128(v); return *this; }
CFISection &ULEB128(uint64_t v) { Section::ULEB128(v); return *this; }
private:
// A length value that we've appended to the section, but is not yet
@ -224,13 +224,13 @@ class CFISection: public Section {
// If the first four bytes of an "initial length" are this constant, then
// the data uses the 64-bit DWARF format, and the length itself is the
// subsequent eight bytes.
static const u_int32_t kDwarf64InitialLengthMarker = 0xffffffffU;
static const uint32_t kDwarf64InitialLengthMarker = 0xffffffffU;
// The CIE identifier for 32- and 64-bit DWARF CFI and .eh_frame data.
static const u_int32_t kDwarf32CIEIdentifier = ~(u_int32_t)0;
static const u_int64_t kDwarf64CIEIdentifier = ~(u_int64_t)0;
static const u_int32_t kEHFrame32CIEIdentifier = 0;
static const u_int64_t kEHFrame64CIEIdentifier = 0;
static const uint32_t kDwarf32CIEIdentifier = ~(uint32_t)0;
static const uint64_t kDwarf64CIEIdentifier = ~(uint64_t)0;
static const uint32_t kEHFrame32CIEIdentifier = 0;
static const uint64_t kEHFrame64CIEIdentifier = 0;
// The size of a machine address for the data in this section.
size_t address_size_;
@ -261,7 +261,7 @@ class CFISection: public Section {
// If in_fde_ is true, this is its starting address. We use this for
// emitting DW_EH_PE_funcrel pointers.
u_int64_t fde_start_address_;
uint64_t fde_start_address_;
};
} // namespace google_breakpad

View file

@ -2326,14 +2326,14 @@ struct ELFSectionHeader {
alignment(1), entry_size(0) { }
Label name;
unsigned int type;
u_int64_t flags;
u_int64_t address;
uint64_t flags;
uint64_t address;
Label file_offset;
Label file_size;
unsigned int link;
unsigned int info;
u_int64_t alignment;
u_int64_t entry_size;
uint64_t alignment;
uint64_t entry_size;
};
void AppendSectionHeader(CFISection *table, const ELFSectionHeader &header) {

View file

@ -289,7 +289,7 @@ TEST_P(DwarfForms, addr) {
StartSingleAttributeDIE(GetParam(), dwarf2reader::DW_TAG_compile_unit,
dwarf2reader::DW_AT_low_pc,
dwarf2reader::DW_FORM_addr);
u_int64_t value;
uint64_t value;
if (GetParam().address_size == 4) {
value = 0xc8e9ffcc;
info.D32(value);
@ -372,7 +372,7 @@ TEST_P(DwarfForms, sec_offset) {
StartSingleAttributeDIE(GetParam(), (DwarfTag) 0x1d971689,
(DwarfAttribute) 0xa060bfd1,
dwarf2reader::DW_FORM_sec_offset);
u_int64_t value;
uint64_t value;
if (GetParam().format_size == 4) {
value = 0xacc9c388;
info.D32(value);

View file

@ -97,7 +97,7 @@ class TestCompilationUnit: public google_breakpad::test_assembler::Section {
// The offset of the point in the compilation unit header immediately
// after the initial length field.
u_int64_t post_length_offset_;
uint64_t post_length_offset_;
// The length of the compilation unit, not including the initial length field.
Label length_;

View file

@ -46,14 +46,14 @@
//
class GUIDGenerator {
public:
static u_int32_t BytesToUInt32(const u_int8_t bytes[]) {
return ((u_int32_t) bytes[0]
| ((u_int32_t) bytes[1] << 8)
| ((u_int32_t) bytes[2] << 16)
| ((u_int32_t) bytes[3] << 24));
static uint32_t BytesToUInt32(const uint8_t bytes[]) {
return ((uint32_t) bytes[0]
| ((uint32_t) bytes[1] << 8)
| ((uint32_t) bytes[2] << 16)
| ((uint32_t) bytes[3] << 24));
}
static void UInt32ToBytes(u_int8_t bytes[], u_int32_t n) {
static void UInt32ToBytes(uint8_t bytes[], uint32_t n) {
bytes[0] = n & 0xff;
bytes[1] = (n >> 8) & 0xff;
bytes[2] = (n >> 16) & 0xff;
@ -63,8 +63,8 @@ class GUIDGenerator {
static bool CreateGUID(GUID *guid) {
InitOnce();
guid->data1 = random();
guid->data2 = (u_int16_t)(random());
guid->data3 = (u_int16_t)(random());
guid->data2 = (uint16_t)(random());
guid->data3 = (uint16_t)(random());
UInt32ToBytes(&guid->data4[0], random());
UInt32ToBytes(&guid->data4[4], random());
return true;

View file

@ -97,7 +97,7 @@ bool MemoryMappedFile::Map(const char* path) {
void MemoryMappedFile::Unmap() {
if (content_.data()) {
sys_munmap(const_cast<u_int8_t*>(content_.data()), content_.length());
sys_munmap(const_cast<uint8_t*>(content_.data()), content_.length());
content_.Set(NULL, 0);
}
}

View file

@ -164,11 +164,11 @@ class MachMessage {
public:
// The receiver of the message can retrieve the raw data this way
u_int8_t *GetData() {
uint8_t *GetData() {
return GetDataLength() > 0 ? GetDataPacket()->data : NULL;
}
u_int32_t GetDataLength() {
uint32_t GetDataLength() {
return EndianU32_LtoN(GetDataPacket()->data_length);
}
@ -210,7 +210,7 @@ class MachMessage {
struct MessageDataPacket {
int32_t id; // little-endian
int32_t data_length; // little-endian
u_int8_t data[1]; // actual size limited by sizeof(MachMessage)
uint8_t data[1]; // actual size limited by sizeof(MachMessage)
};
MessageDataPacket* GetDataPacket();
@ -223,7 +223,7 @@ class MachMessage {
mach_msg_header_t head;
mach_msg_body_t body;
u_int8_t padding[1024]; // descriptors and data may be embedded here
uint8_t padding[1024]; // descriptors and data may be embedded here
};
//==============================================================================

View file

@ -67,7 +67,7 @@ class MemoryRange {
// Sets this memory range to point to |data| and its length to |length|.
void Set(const void* data, size_t length) {
data_ = reinterpret_cast<const u_int8_t*>(data);
data_ = reinterpret_cast<const uint8_t*>(data);
// Always set |length_| to zero if |data_| is NULL.
length_ = data ? length : 0;
}
@ -127,14 +127,14 @@ class MemoryRange {
}
// Returns a pointer to the beginning of this memory range.
const u_int8_t* data() const { return data_; }
const uint8_t* data() const { return data_; }
// Returns the length, in bytes, of this memory range.
size_t length() const { return length_; }
private:
// Pointer to the beginning of this memory range.
const u_int8_t* data_;
const uint8_t* data_;
// Length, in bytes, of this memory range.
size_t length_;

View file

@ -37,9 +37,9 @@ using testing::Message;
namespace {
const u_int32_t kBuffer[10] = { 0 };
const uint32_t kBuffer[10] = { 0 };
const size_t kBufferSize = sizeof(kBuffer);
const u_int8_t* kBufferPointer = reinterpret_cast<const u_int8_t*>(kBuffer);
const uint8_t* kBufferPointer = reinterpret_cast<const uint8_t*>(kBuffer);
// Test vectors for verifying Covers, GetData, and Subrange.
const struct {

View file

@ -60,7 +60,7 @@ using std::map;
class Module {
public:
// The type of addresses and sizes in a symbol table.
typedef u_int64_t Address;
typedef uint64_t Address;
struct File;
struct Function;
struct Line;

View file

@ -156,7 +156,7 @@ const char *kStrtabName = ".strtab";
const int demangleLen = 20000;
// Offset to the string table.
u_int64_t stringOffset = 0;
uint64_t stringOffset = 0;
// Update the offset to the start of the string index of the next
// object module for every N_ENDM stabs.

View file

@ -53,10 +53,10 @@ class GUIDGenerator {
bool CreateGUID(GUID *guid) const {
guid->data1 = random();
guid->data2 = (u_int16_t)(random());
guid->data3 = (u_int16_t)(random());
*reinterpret_cast<u_int32_t*>(&guid->data4[0]) = random();
*reinterpret_cast<u_int32_t*>(&guid->data4[4]) = random();
guid->data2 = (uint16_t)(random());
guid->data3 = (uint16_t)(random());
*reinterpret_cast<uint32_t*>(&guid->data4[0]) = random();
*reinterpret_cast<uint32_t*>(&guid->data4[4]) = random();
return true;
}
};
@ -74,8 +74,8 @@ bool GUIDToString(const GUID *guid, char *buf, int buf_len) {
assert(buf_len > kGUIDStringLength);
int num = snprintf(buf, buf_len, kGUIDFormatString,
guid->data1, guid->data2, guid->data3,
*reinterpret_cast<const u_int32_t *>(&(guid->data4[0])),
*reinterpret_cast<const u_int32_t *>(&(guid->data4[4])));
*reinterpret_cast<const uint32_t *>(&(guid->data4[0])),
*reinterpret_cast<const uint32_t *>(&(guid->data4[4])));
if (num != kGUIDStringLength)
return false;

View file

@ -565,7 +565,7 @@ TEST_F(Stabs, OnePublicSymbol) {
stabs.set_endianness(kLittleEndian);
stabs.set_value_size(4);
const u_int32_t kExpectedAddress = 0x9000;
const uint32_t kExpectedAddress = 0x9000;
const string kExpectedFunctionName("public_function");
stabs
.Stab(N_SECT, 1, 0, kExpectedAddress, kExpectedFunctionName);
@ -584,9 +584,9 @@ TEST_F(Stabs, TwoPublicSymbols) {
stabs.set_endianness(kLittleEndian);
stabs.set_value_size(4);
const u_int32_t kExpectedAddress1 = 0xB0B0B0B0;
const uint32_t kExpectedAddress1 = 0xB0B0B0B0;
const string kExpectedFunctionName1("public_function");
const u_int32_t kExpectedAddress2 = 0xF0F0F0F0;
const uint32_t kExpectedAddress2 = 0xF0F0F0F0;
const string kExpectedFunctionName2("something else");
stabs
.Stab(N_SECT, 1, 0, kExpectedAddress1, kExpectedFunctionName1)

View file

@ -38,15 +38,15 @@ namespace google_breakpad {
using std::vector;
void UTF8ToUTF16(const char *in, vector<u_int16_t> *out) {
void UTF8ToUTF16(const char *in, vector<uint16_t> *out) {
size_t source_length = strlen(in);
const UTF8 *source_ptr = reinterpret_cast<const UTF8 *>(in);
const UTF8 *source_end_ptr = source_ptr + source_length;
// Erase the contents and zero fill to the expected size
out->clear();
out->insert(out->begin(), source_length, 0);
u_int16_t *target_ptr = &(*out)[0];
u_int16_t *target_end_ptr = target_ptr + out->capacity() * sizeof(u_int16_t);
uint16_t *target_ptr = &(*out)[0];
uint16_t *target_end_ptr = target_ptr + out->capacity() * sizeof(uint16_t);
ConversionResult result = ConvertUTF8toUTF16(&source_ptr, source_end_ptr,
&target_ptr, target_end_ptr,
strictConversion);
@ -55,11 +55,11 @@ void UTF8ToUTF16(const char *in, vector<u_int16_t> *out) {
out->resize(result == conversionOK ? target_ptr - &(*out)[0] + 1: 0);
}
int UTF8ToUTF16Char(const char *in, int in_length, u_int16_t out[2]) {
int UTF8ToUTF16Char(const char *in, int in_length, uint16_t out[2]) {
const UTF8 *source_ptr = reinterpret_cast<const UTF8 *>(in);
const UTF8 *source_end_ptr = source_ptr + sizeof(char);
u_int16_t *target_ptr = out;
u_int16_t *target_end_ptr = target_ptr + 2 * sizeof(u_int16_t);
uint16_t *target_ptr = out;
uint16_t *target_end_ptr = target_ptr + 2 * sizeof(uint16_t);
out[0] = out[1] = 0;
// Process one character at a time
@ -82,15 +82,15 @@ int UTF8ToUTF16Char(const char *in, int in_length, u_int16_t out[2]) {
return 0;
}
void UTF32ToUTF16(const wchar_t *in, vector<u_int16_t> *out) {
void UTF32ToUTF16(const wchar_t *in, vector<uint16_t> *out) {
size_t source_length = wcslen(in);
const UTF32 *source_ptr = reinterpret_cast<const UTF32 *>(in);
const UTF32 *source_end_ptr = source_ptr + source_length;
// Erase the contents and zero fill to the expected size
out->clear();
out->insert(out->begin(), source_length, 0);
u_int16_t *target_ptr = &(*out)[0];
u_int16_t *target_end_ptr = target_ptr + out->capacity() * sizeof(u_int16_t);
uint16_t *target_ptr = &(*out)[0];
uint16_t *target_end_ptr = target_ptr + out->capacity() * sizeof(uint16_t);
ConversionResult result = ConvertUTF32toUTF16(&source_ptr, source_end_ptr,
&target_ptr, target_end_ptr,
strictConversion);
@ -99,11 +99,11 @@ void UTF32ToUTF16(const wchar_t *in, vector<u_int16_t> *out) {
out->resize(result == conversionOK ? target_ptr - &(*out)[0] + 1: 0);
}
void UTF32ToUTF16Char(wchar_t in, u_int16_t out[2]) {
void UTF32ToUTF16Char(wchar_t in, uint16_t out[2]) {
const UTF32 *source_ptr = reinterpret_cast<const UTF32 *>(&in);
const UTF32 *source_end_ptr = source_ptr + 1;
u_int16_t *target_ptr = out;
u_int16_t *target_end_ptr = target_ptr + 2 * sizeof(u_int16_t);
uint16_t *target_ptr = out;
uint16_t *target_end_ptr = target_ptr + 2 * sizeof(uint16_t);
out[0] = out[1] = 0;
ConversionResult result = ConvertUTF32toUTF16(&source_ptr, source_end_ptr,
&target_ptr, target_end_ptr,
@ -114,20 +114,20 @@ void UTF32ToUTF16Char(wchar_t in, u_int16_t out[2]) {
}
}
static inline u_int16_t Swap(u_int16_t value) {
return (value >> 8) | static_cast<u_int16_t>(value << 8);
static inline uint16_t Swap(uint16_t value) {
return (value >> 8) | static_cast<uint16_t>(value << 8);
}
string UTF16ToUTF8(const vector<u_int16_t> &in, bool swap) {
string UTF16ToUTF8(const vector<uint16_t> &in, bool swap) {
const UTF16 *source_ptr = &in[0];
scoped_ptr<u_int16_t> source_buffer;
scoped_ptr<uint16_t> source_buffer;
// If we're to swap, we need to make a local copy and swap each byte pair
if (swap) {
int idx = 0;
source_buffer.reset(new u_int16_t[in.size()]);
source_buffer.reset(new uint16_t[in.size()]);
UTF16 *source_buffer_ptr = source_buffer.get();
for (vector<u_int16_t>::const_iterator it = in.begin();
for (vector<uint16_t>::const_iterator it = in.begin();
it != in.end(); ++it, ++idx)
source_buffer_ptr[idx] = Swap(*it);

View file

@ -44,24 +44,24 @@ using std::vector;
// Convert |in| to UTF-16 into |out|. Use platform byte ordering. If the
// conversion failed, |out| will be zero length.
void UTF8ToUTF16(const char *in, vector<u_int16_t> *out);
void UTF8ToUTF16(const char *in, vector<uint16_t> *out);
// Convert at least one character (up to a maximum of |in_length|) from |in|
// to UTF-16 into |out|. Return the number of characters consumed from |in|.
// Any unused characters in |out| will be initialized to 0. No memory will
// be allocated by this routine.
int UTF8ToUTF16Char(const char *in, int in_length, u_int16_t out[2]);
int UTF8ToUTF16Char(const char *in, int in_length, uint16_t out[2]);
// Convert |in| to UTF-16 into |out|. Use platform byte ordering. If the
// conversion failed, |out| will be zero length.
void UTF32ToUTF16(const wchar_t *in, vector<u_int16_t> *out);
void UTF32ToUTF16(const wchar_t *in, vector<uint16_t> *out);
// Convert |in| to UTF-16 into |out|. Any unused characters in |out| will be
// initialized to 0. No memory will be allocated by this routine.
void UTF32ToUTF16Char(wchar_t in, u_int16_t out[2]);
void UTF32ToUTF16Char(wchar_t in, uint16_t out[2]);
// Convert |in| to UTF-8. If |swap| is true, swap bytes before converting.
string UTF16ToUTF8(const vector<u_int16_t> &in, bool swap);
string UTF16ToUTF8(const vector<uint16_t> &in, bool swap);
} // namespace google_breakpad

View file

@ -45,7 +45,7 @@ namespace test_assembler {
using std::back_insert_iterator;
Label::Label() : value_(new Binding()) { }
Label::Label(u_int64_t value) : value_(new Binding(value)) { }
Label::Label(uint64_t value) : value_(new Binding(value)) { }
Label::Label(const Label &label) {
value_ = label.value_;
value_->Acquire();
@ -54,7 +54,7 @@ Label::~Label() {
if (value_->Release()) delete value_;
}
Label &Label::operator=(u_int64_t value) {
Label &Label::operator=(uint64_t value) {
value_->Set(NULL, value);
return *this;
}
@ -64,13 +64,13 @@ Label &Label::operator=(const Label &label) {
return *this;
}
Label Label::operator+(u_int64_t addend) const {
Label Label::operator+(uint64_t addend) const {
Label l;
l.value_->Set(this->value_, addend);
return l;
}
Label Label::operator-(u_int64_t subtrahend) const {
Label Label::operator-(uint64_t subtrahend) const {
Label l;
l.value_->Set(this->value_, -subtrahend);
return l;
@ -89,31 +89,31 @@ Label Label::operator-(u_int64_t subtrahend) const {
#define ALWAYS_EVALUATE_AND_ASSERT(x) assert(x)
#endif
u_int64_t Label::operator-(const Label &label) const {
u_int64_t offset;
uint64_t Label::operator-(const Label &label) const {
uint64_t offset;
ALWAYS_EVALUATE_AND_ASSERT(IsKnownOffsetFrom(label, &offset));
return offset;
}
u_int64_t Label::Value() const {
u_int64_t v = 0;
uint64_t Label::Value() const {
uint64_t v = 0;
ALWAYS_EVALUATE_AND_ASSERT(IsKnownConstant(&v));
return v;
};
bool Label::IsKnownConstant(u_int64_t *value_p) const {
bool Label::IsKnownConstant(uint64_t *value_p) const {
Binding *base;
u_int64_t addend;
uint64_t addend;
value_->Get(&base, &addend);
if (base != NULL) return false;
if (value_p) *value_p = addend;
return true;
}
bool Label::IsKnownOffsetFrom(const Label &label, u_int64_t *offset_p) const
bool Label::IsKnownOffsetFrom(const Label &label, uint64_t *offset_p) const
{
Binding *label_base, *this_base;
u_int64_t label_addend, this_addend;
uint64_t label_addend, this_addend;
label.value_->Get(&label_base, &label_addend);
value_->Get(&this_base, &this_addend);
// If this and label are related, Get will find their final
@ -126,7 +126,7 @@ bool Label::IsKnownOffsetFrom(const Label &label, u_int64_t *offset_p) const
Label::Binding::Binding() : base_(this), addend_(), reference_count_(1) { }
Label::Binding::Binding(u_int64_t addend)
Label::Binding::Binding(uint64_t addend)
: base_(NULL), addend_(addend), reference_count_(1) { }
Label::Binding::~Binding() {
@ -135,7 +135,7 @@ Label::Binding::~Binding() {
delete base_;
}
void Label::Binding::Set(Binding *binding, u_int64_t addend) {
void Label::Binding::Set(Binding *binding, uint64_t addend) {
if (!base_ && !binding) {
// We're equating two constants. This could be okay.
assert(addend_ == addend);
@ -150,7 +150,7 @@ void Label::Binding::Set(Binding *binding, u_int64_t addend) {
// another variable (otherwise, it wouldn't be final), this
// guarantees we won't create cycles here, even for code like this:
// l = m, m = n, n = l;
u_int64_t binding_addend;
uint64_t binding_addend;
binding->Get(&binding, &binding_addend);
addend += binding_addend;
}
@ -183,14 +183,14 @@ void Label::Binding::Set(Binding *binding, u_int64_t addend) {
}
}
void Label::Binding::Get(Binding **base, u_int64_t *addend) {
void Label::Binding::Get(Binding **base, uint64_t *addend) {
if (base_ && base_ != this) {
// Recurse to find the end of our reference chain (the root of our
// tree), and then rewrite every binding along the chain to refer
// to it directly, adjusting addends appropriately. (This is why
// this member function isn't this-const.)
Binding *final_base;
u_int64_t final_addend;
uint64_t final_addend;
base_->Get(&final_base, &final_addend);
if (final_base) final_base->Acquire();
if (base_->Release()) delete base_;
@ -203,7 +203,7 @@ void Label::Binding::Get(Binding **base, u_int64_t *addend) {
template<typename Inserter>
static inline void InsertEndian(test_assembler::Endianness endianness,
size_t size, u_int64_t number, Inserter dest) {
size_t size, uint64_t number, Inserter dest) {
assert(size > 0);
if (endianness == kLittleEndian) {
for (size_t i = 0; i < size; i++) {
@ -218,7 +218,7 @@ static inline void InsertEndian(test_assembler::Endianness endianness,
}
}
Section &Section::Append(Endianness endianness, size_t size, u_int64_t number) {
Section &Section::Append(Endianness endianness, size_t size, uint64_t number) {
InsertEndian(endianness, size, number,
back_insert_iterator<string>(contents_));
return *this;
@ -228,7 +228,7 @@ Section &Section::Append(Endianness endianness, size_t size,
const Label &label) {
// If this label's value is known, there's no reason to waste an
// entry in references_ on it.
u_int64_t value;
uint64_t value;
if (label.IsKnownConstant(&value))
return Append(endianness, size, value);
@ -246,7 +246,7 @@ Section &Section::Append(Endianness endianness, size_t size,
#define ENDIANNESS(e) ENDIANNESS_ ## e
#define DEFINE_SHORT_APPEND_NUMBER_ENDIAN(e, bits) \
Section &Section::e ## bits(u_int ## bits ## _t v) { \
Section &Section::e ## bits(uint ## bits ## _t v) { \
InsertEndian(ENDIANNESS(e), bits / 8, v, \
back_insert_iterator<string>(contents_)); \
return *this; \
@ -272,7 +272,7 @@ DEFINE_SHORT_APPEND_ENDIAN(B, 32);
DEFINE_SHORT_APPEND_ENDIAN(B, 64);
#define DEFINE_SHORT_APPEND_NUMBER_DEFAULT(bits) \
Section &Section::D ## bits(u_int ## bits ## _t v) { \
Section &Section::D ## bits(uint ## bits ## _t v) { \
InsertEndian(endianness_, bits / 8, v, \
back_insert_iterator<string>(contents_)); \
return *this; \
@ -312,7 +312,7 @@ Section &Section::LEB128(long long value) {
return *this;
}
Section &Section::ULEB128(u_int64_t value) {
Section &Section::ULEB128(uint64_t value) {
while (value > 0x7f) {
contents_ += (value & 0x7f) | 0x80;
value = (value >> 7);
@ -321,7 +321,7 @@ Section &Section::ULEB128(u_int64_t value) {
return *this;
}
Section &Section::Align(size_t alignment, u_int8_t pad_byte) {
Section &Section::Align(size_t alignment, uint8_t pad_byte) {
// ALIGNMENT must be a power of two.
assert(((alignment - 1) & alignment) == 0);
size_t new_size = (contents_.size() + alignment - 1) & ~(alignment - 1);
@ -340,7 +340,7 @@ bool Section::GetContents(string *contents) {
// the section's contents.
for (size_t i = 0; i < references_.size(); i++) {
Reference &r = references_[i];
u_int64_t value;
uint64_t value;
if (!r.label.IsKnownConstant(&value)) {
fprintf(stderr, "Undefined label #%zu at offset 0x%zx\n", i, r.offset);
return false;

View file

@ -110,7 +110,7 @@ namespace test_assembler {
class Label {
public:
Label(); // An undefined label.
Label(u_int64_t value); // A label with a fixed value
Label(uint64_t value); // A label with a fixed value
Label(const Label &value); // A label equal to another.
~Label();
@ -119,23 +119,23 @@ class Label {
// Providing this as a cast operator is nifty, but the conversions
// happen in unexpected places. In particular, ISO C++ says that
// Label + size_t becomes ambigious, because it can't decide whether
// to convert the Label to a u_int64_t and then to a size_t, or use
// to convert the Label to a uint64_t and then to a size_t, or use
// the overloaded operator that returns a new label, even though the
// former could fail if the label is not yet defined and the latter won't.
u_int64_t Value() const;
uint64_t Value() const;
Label &operator=(u_int64_t value);
Label &operator=(uint64_t value);
Label &operator=(const Label &value);
Label operator+(u_int64_t addend) const;
Label operator-(u_int64_t subtrahend) const;
u_int64_t operator-(const Label &subtrahend) const;
Label operator+(uint64_t addend) const;
Label operator-(uint64_t subtrahend) const;
uint64_t operator-(const Label &subtrahend) const;
// We could also provide == and != that work on undefined, but
// related, labels.
// Return true if this label's value is known. If VALUE_P is given,
// set *VALUE_P to the known value if returning true.
bool IsKnownConstant(u_int64_t *value_p = NULL) const;
bool IsKnownConstant(uint64_t *value_p = NULL) const;
// Return true if the offset from LABEL to this label is known. If
// OFFSET_P is given, set *OFFSET_P to the offset when returning true.
@ -150,12 +150,12 @@ class Label {
// m = l + 10;
// l.IsKnownConstant(); // false
// m.IsKnownConstant(); // false
// u_int64_t d;
// uint64_t d;
// l.IsKnownOffsetFrom(m, &d); // true, and sets d to -10.
// l-m // -10
// m-l // 10
// m.Value() // error: m's value is not known
bool IsKnownOffsetFrom(const Label &label, u_int64_t *offset_p = NULL) const;
bool IsKnownOffsetFrom(const Label &label, uint64_t *offset_p = NULL) const;
private:
// A label's value, or if that is not yet known, how the value is
@ -173,7 +173,7 @@ class Label {
class Binding {
public:
Binding();
Binding(u_int64_t addend);
Binding(uint64_t addend);
~Binding();
// Increment our reference count.
@ -186,7 +186,7 @@ class Label {
// Update every binding on this binding's chain to point directly
// to BINDING, or to be a constant, with addends adjusted
// appropriately.
void Set(Binding *binding, u_int64_t value);
void Set(Binding *binding, uint64_t value);
// Return what we know about the value of this binding.
// - If this binding's value is a known constant, set BASE to
@ -198,7 +198,7 @@ class Label {
// value.
// - If this binding is unconstrained, set BASE to this, and leave
// ADDEND unchanged.
void Get(Binding **base, u_int64_t *addend);
void Get(Binding **base, uint64_t *addend);
private:
// There are three cases:
@ -221,7 +221,7 @@ class Label {
// binding on the chain to point directly to the final value,
// adjusting addends as appropriate.
Binding *base_;
u_int64_t addend_;
uint64_t addend_;
// The number of Labels and Bindings pointing to this binding.
// (When a binding points to itself, indicating a completely
@ -233,7 +233,7 @@ class Label {
Binding *value_;
};
inline Label operator+(u_int64_t a, const Label &l) { return l + a; }
inline Label operator+(uint64_t a, const Label &l) { return l + a; }
// Note that int-Label isn't defined, as negating a Label is not an
// operation we support.
@ -288,7 +288,7 @@ class Section {
// Append the SIZE bytes at DATA or the contents of STRING to the
// end of this section. Return a reference to this section.
Section &Append(const u_int8_t *data, size_t size) {
Section &Append(const uint8_t *data, size_t size) {
contents_.append(reinterpret_cast<const char *>(data), size);
return *this;
};
@ -299,7 +299,7 @@ class Section {
// Append SIZE copies of BYTE to the end of this section. Return a
// reference to this section.
Section &Append(size_t size, u_int8_t byte) {
Section &Append(size_t size, uint8_t byte) {
contents_.append(size, (char) byte);
return *this;
}
@ -307,7 +307,7 @@ class Section {
// Append NUMBER to this section. ENDIANNESS is the endianness to
// use to write the number. SIZE is the length of the number in
// bytes. Return a reference to this section.
Section &Append(Endianness endianness, size_t size, u_int64_t number);
Section &Append(Endianness endianness, size_t size, uint64_t number);
Section &Append(Endianness endianness, size_t size, const Label &label);
// Append SECTION to the end of this section. The labels SECTION
@ -352,12 +352,12 @@ class Section {
// the compiler will properly sign-extend a signed value before
// passing it to the function, at which point the function's
// behavior is the same either way.
Section &L8(u_int8_t value) { contents_ += value; return *this; }
Section &B8(u_int8_t value) { contents_ += value; return *this; }
Section &D8(u_int8_t value) { contents_ += value; return *this; }
Section &L16(u_int16_t), &L32(u_int32_t), &L64(u_int64_t),
&B16(u_int16_t), &B32(u_int32_t), &B64(u_int64_t),
&D16(u_int16_t), &D32(u_int32_t), &D64(u_int64_t);
Section &L8(uint8_t value) { contents_ += value; return *this; }
Section &B8(uint8_t value) { contents_ += value; return *this; }
Section &D8(uint8_t value) { contents_ += value; return *this; }
Section &L16(uint16_t), &L32(uint32_t), &L64(uint64_t),
&B16(uint16_t), &B32(uint32_t), &B64(uint64_t),
&D16(uint16_t), &D32(uint32_t), &D64(uint64_t);
Section &L8(const Label &label), &L16(const Label &label),
&L32(const Label &label), &L64(const Label &label),
&B8(const Label &label), &B16(const Label &label),
@ -399,13 +399,13 @@ class Section {
//
// Note that VALUE cannot be a Label (we would have to implement
// relaxation).
Section &ULEB128(u_int64_t value);
Section &ULEB128(uint64_t value);
// Jump to the next location aligned on an ALIGNMENT-byte boundary,
// relative to the start of the section. Fill the gap with PAD_BYTE.
// ALIGNMENT must be a power of two. Return a reference to this
// section.
Section &Align(size_t alignment, u_int8_t pad_byte = 0);
Section &Align(size_t alignment, uint8_t pad_byte = 0);
// Clear the contents of this section.
void Clear();

View file

@ -60,7 +60,7 @@ TEST(ConstructLabelDeathTest, Undefined) {
TEST(ConstructLabel, Constant) {
Label l(0x060b9f974eaf301eULL);
u_int64_t v;
uint64_t v;
EXPECT_TRUE(l.IsKnownConstant(&v));
EXPECT_EQ(v, 0x060b9f974eaf301eULL);
EXPECT_EQ(l.Value(), 0x060b9f974eaf301eULL);
@ -69,7 +69,7 @@ TEST(ConstructLabel, Constant) {
TEST(ConstructLabel, Copy) {
Label l;
Label m(l);
u_int64_t v;
uint64_t v;
EXPECT_TRUE(l.IsKnownOffsetFrom(m, &v));
EXPECT_EQ(0U, v);
}
@ -82,7 +82,7 @@ TEST(Assignment, UnconstrainedToUnconstrained) {
l = m;
EXPECT_EQ(0U, l-m);
EXPECT_TRUE(l.IsKnownOffsetFrom(m));
u_int64_t d;
uint64_t d;
EXPECT_TRUE(l.IsKnownOffsetFrom(m, &d));
EXPECT_EQ(0U, d);
EXPECT_FALSE(l.IsKnownConstant());
@ -94,7 +94,7 @@ TEST(Assignment, UnconstrainedToRelated) {
l = m;
EXPECT_EQ(0U, l-m);
EXPECT_TRUE(l.IsKnownOffsetFrom(m));
u_int64_t d;
uint64_t d;
EXPECT_TRUE(l.IsKnownOffsetFrom(m, &d));
EXPECT_EQ(0U, d);
EXPECT_FALSE(l.IsKnownConstant());
@ -106,7 +106,7 @@ TEST(Assignment, UnconstrainedToKnown) {
l = m;
EXPECT_EQ(0U, l-m);
EXPECT_TRUE(l.IsKnownOffsetFrom(m));
u_int64_t d;
uint64_t d;
EXPECT_TRUE(l.IsKnownOffsetFrom(m, &d));
EXPECT_EQ(0U, d);
EXPECT_TRUE(m.IsKnownConstant());
@ -119,7 +119,7 @@ TEST(Assignment, RelatedToUnconstrained) {
l = m;
EXPECT_EQ(0U, l-n);
EXPECT_TRUE(l.IsKnownOffsetFrom(n));
u_int64_t d;
uint64_t d;
EXPECT_TRUE(l.IsKnownOffsetFrom(n, &d));
EXPECT_EQ(0U, d);
EXPECT_FALSE(l.IsKnownConstant());
@ -132,7 +132,7 @@ TEST(Assignment, RelatedToRelated) {
l = m;
EXPECT_EQ(0U, n-o);
EXPECT_TRUE(n.IsKnownOffsetFrom(o));
u_int64_t d;
uint64_t d;
EXPECT_TRUE(n.IsKnownOffsetFrom(o, &d));
EXPECT_EQ(0U, d);
EXPECT_FALSE(l.IsKnownConstant());
@ -234,7 +234,7 @@ TEST(Addition, LabelConstant) {
Label l, m;
m = l + 0x5248d93e8bbe9497ULL;
EXPECT_TRUE(m.IsKnownOffsetFrom(l));
u_int64_t d;
uint64_t d;
EXPECT_TRUE(m.IsKnownOffsetFrom(l, &d));
EXPECT_EQ(0x5248d93e8bbe9497ULL, d);
EXPECT_FALSE(m.IsKnownConstant());
@ -244,7 +244,7 @@ TEST(Addition, ConstantLabel) {
Label l, m;
m = 0xf51e94e00d6e3c84ULL + l;
EXPECT_TRUE(m.IsKnownOffsetFrom(l));
u_int64_t d;
uint64_t d;
EXPECT_TRUE(m.IsKnownOffsetFrom(l, &d));
EXPECT_EQ(0xf51e94e00d6e3c84ULL, d);
EXPECT_FALSE(m.IsKnownConstant());
@ -255,7 +255,7 @@ TEST(Addition, KnownLabelConstant) {
l = 0x16286307042ce0d8ULL;
m = l + 0x3fdddd91306719d7ULL;
EXPECT_TRUE(m.IsKnownOffsetFrom(l));
u_int64_t d;
uint64_t d;
EXPECT_TRUE(m.IsKnownOffsetFrom(l, &d));
EXPECT_EQ(0x3fdddd91306719d7ULL, d);
EXPECT_TRUE(m.IsKnownConstant());
@ -267,7 +267,7 @@ TEST(Addition, ConstantKnownLabel) {
l = 0x50f62d0cdd1031deULL;
m = 0x1b13462d8577c538ULL + l;
EXPECT_TRUE(m.IsKnownOffsetFrom(l));
u_int64_t d;
uint64_t d;
EXPECT_TRUE(m.IsKnownOffsetFrom(l, &d));
EXPECT_EQ(0x1b13462d8577c538ULL, d);
EXPECT_TRUE(m.IsKnownConstant());
@ -278,7 +278,7 @@ TEST(Subtraction, LabelConstant) {
Label l, m;
m = l - 0x0620884d21d3138eULL;
EXPECT_TRUE(m.IsKnownOffsetFrom(l));
u_int64_t d;
uint64_t d;
EXPECT_TRUE(m.IsKnownOffsetFrom(l, &d));
EXPECT_EQ(-0x0620884d21d3138eULL, d);
EXPECT_FALSE(m.IsKnownConstant());
@ -289,7 +289,7 @@ TEST(Subtraction, KnownLabelConstant) {
l = 0x6237fbaf9ef7929eULL;
m = l - 0x317730995d2ab6eeULL;
EXPECT_TRUE(m.IsKnownOffsetFrom(l));
u_int64_t d;
uint64_t d;
EXPECT_TRUE(m.IsKnownOffsetFrom(l, &d));
EXPECT_EQ(-0x317730995d2ab6eeULL, d);
EXPECT_TRUE(m.IsKnownConstant());
@ -475,10 +475,10 @@ TEST(LabelChain, AssignEndRelationBeforeForward) {
b = a + 0x1;
c = b + 0x10;
d = c + 0x100;
EXPECT_EQ(-(u_int64_t)0x111U, a-x);
EXPECT_EQ(-(u_int64_t)0x110U, b-x);
EXPECT_EQ(-(u_int64_t)0x100U, c-x);
EXPECT_EQ(-(u_int64_t)0U, d-x);
EXPECT_EQ(-(uint64_t)0x111U, a-x);
EXPECT_EQ(-(uint64_t)0x110U, b-x);
EXPECT_EQ(-(uint64_t)0x100U, c-x);
EXPECT_EQ(-(uint64_t)0U, d-x);
}
TEST(LabelChain, AssignEndRelationBeforeBackward) {
@ -488,10 +488,10 @@ TEST(LabelChain, AssignEndRelationBeforeBackward) {
d = c + 0x100;
c = b + 0x10;
b = a + 0x1;
EXPECT_EQ(-(u_int64_t)0x111U, a-x);
EXPECT_EQ(-(u_int64_t)0x110U, b-x);
EXPECT_EQ(-(u_int64_t)0x100U, c-x);
EXPECT_EQ(-(u_int64_t)0U, d-x);
EXPECT_EQ(-(uint64_t)0x111U, a-x);
EXPECT_EQ(-(uint64_t)0x110U, b-x);
EXPECT_EQ(-(uint64_t)0x100U, c-x);
EXPECT_EQ(-(uint64_t)0U, d-x);
}
TEST(LabelChain, AssignEndRelationAfterForward) {
@ -501,10 +501,10 @@ TEST(LabelChain, AssignEndRelationAfterForward) {
c = b + 0x10;
d = c + 0x100;
x = d;
EXPECT_EQ(-(u_int64_t)0x111U, a-x);
EXPECT_EQ(-(u_int64_t)0x110U, b-x);
EXPECT_EQ(-(u_int64_t)0x100U, c-x);
EXPECT_EQ(-(u_int64_t)0x000U, d-x);
EXPECT_EQ(-(uint64_t)0x111U, a-x);
EXPECT_EQ(-(uint64_t)0x110U, b-x);
EXPECT_EQ(-(uint64_t)0x100U, c-x);
EXPECT_EQ(-(uint64_t)0x000U, d-x);
}
TEST(LabelChain, AssignEndRelationAfterBackward) {
@ -514,10 +514,10 @@ TEST(LabelChain, AssignEndRelationAfterBackward) {
c = b + 0x10;
b = a + 0x1;
x = d;
EXPECT_EQ(-(u_int64_t)0x111U, a-x);
EXPECT_EQ(-(u_int64_t)0x110U, b-x);
EXPECT_EQ(-(u_int64_t)0x100U, c-x);
EXPECT_EQ(-(u_int64_t)0x000U, d-x);
EXPECT_EQ(-(uint64_t)0x111U, a-x);
EXPECT_EQ(-(uint64_t)0x110U, b-x);
EXPECT_EQ(-(uint64_t)0x100U, c-x);
EXPECT_EQ(-(uint64_t)0x000U, d-x);
}
TEST(LabelChain, AssignEndValueBeforeForward) {
@ -623,10 +623,10 @@ TEST(LabelChain, ConstructEndRelationAfterForward) {
Label c(b + 0x10);
Label d(c + 0x100);
x = d;
EXPECT_EQ(-(u_int64_t)0x111U, a-x);
EXPECT_EQ(-(u_int64_t)0x110U, b-x);
EXPECT_EQ(-(u_int64_t)0x100U, c-x);
EXPECT_EQ(-(u_int64_t)0x000U, d-x);
EXPECT_EQ(-(uint64_t)0x111U, a-x);
EXPECT_EQ(-(uint64_t)0x110U, b-x);
EXPECT_EQ(-(uint64_t)0x100U, c-x);
EXPECT_EQ(-(uint64_t)0x000U, d-x);
}
TEST(LabelChain, ConstructEndValueAfterForward) {
@ -732,11 +732,11 @@ class SectionFixture {
public:
Section section;
string contents;
static const u_int8_t data[];
static const uint8_t data[];
static const size_t data_size;
};
const u_int8_t SectionFixture::data[] = {
const uint8_t SectionFixture::data[] = {
0x87, 0x4f, 0x43, 0x67, 0x30, 0xd0, 0xd4, 0x0e
};
@ -753,7 +753,7 @@ const u_int8_t SectionFixture::data[] = {
#define ASSERT_BYTES(s, b) \
do \
{ \
static const u_int8_t expected_bytes[] = b; \
static const uint8_t expected_bytes[] = b; \
ASSERT_EQ(sizeof(expected_bytes), s.size()); \
ASSERT_TRUE(memcmp(s.data(), (const char *) expected_bytes, \
sizeof(expected_bytes)) == 0); \
@ -1361,7 +1361,7 @@ TEST_F(Append, Variety) {
ASSERT_EQ(8 * 18U, section.Size());
ASSERT_TRUE(section.GetContents(&contents));
static const u_int8_t expected[] = {
static const uint8_t expected[] = {
0x35, 0xa6, 0x6b, 0x28, 0xf7, 0xa8, 0x99, 0xa1, 0x61,
0x8b, 0x39, 0x44, 0x8f, 0x44, 0x40, 0x65, 0xa5, 0x0e,
0xc9, 0x1c, 0x5e, 0x87, 0xbf, 0xa4, 0x28, 0xb9, 0xf4,

View file

@ -31,7 +31,7 @@
*
* (This is C99 source, please don't corrupt it with C++.)
*
* This file ensures that types u_intN_t are defined for N = 8, 16, 32, and
* This file ensures that types uintN_t are defined for N = 8, 16, 32, and
* 64. Types of precise widths are crucial to the task of writing data
* structures on one platform and reading them on another.
*
@ -42,36 +42,38 @@
#ifndef _WIN32
#include <sys/types.h>
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif /* __STDC_FORMAT_MACROS */
#include <inttypes.h>
#if defined(__SUNPRO_CC) || (defined(__GNUC__) && defined(__sun__))
typedef uint8_t u_int8_t;
typedef uint16_t u_int16_t;
typedef uint32_t u_int32_t;
typedef uint64_t u_int64_t;
#endif
#else /* !_WIN32 */
#if _MSC_VER >= 1600
#include <stdint.h>
#elif defined(BREAKPAD_CUSTOM_STDINT_H)
/* Visual C++ Pre-2010 did not ship a stdint.h, so allow
* consumers of this library to provide their own because
* there are often subtle type incompatibilities.
*/
#include BREAKPAD_CUSTOM_STDINT_H
#else
#include <WTypes.h>
typedef unsigned __int8 u_int8_t;
typedef unsigned __int16 u_int16_t;
typedef unsigned __int32 u_int32_t;
typedef unsigned __int64 u_int64_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
#endif
#endif /* !_WIN32 */
typedef struct {
u_int64_t high;
u_int64_t low;
} u_int128_t;
uint64_t high;
uint64_t low;
} uint128_struct;
typedef u_int64_t breakpad_time_t;
typedef uint64_t breakpad_time_t;
/* Try to get PRIx64 from inttypes.h, but if it's not defined, fall back to
* llx, which is the format string for "long long" - this is a 64-bit

View file

@ -67,7 +67,7 @@
* equivalent types and values in the Windows Platform SDK are given in
* comments.
*
* Author: Mark Mentovai
* Author: Mark Mentovai
* Change to split into its own file: Neal Sidhwaney */
#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_AMD64_H__
@ -79,22 +79,22 @@
*/
typedef struct {
u_int16_t control_word;
u_int16_t status_word;
u_int8_t tag_word;
u_int8_t reserved1;
u_int16_t error_opcode;
u_int32_t error_offset;
u_int16_t error_selector;
u_int16_t reserved2;
u_int32_t data_offset;
u_int16_t data_selector;
u_int16_t reserved3;
u_int32_t mx_csr;
u_int32_t mx_csr_mask;
u_int128_t float_registers[8];
u_int128_t xmm_registers[16];
u_int8_t reserved4[96];
uint16_t control_word;
uint16_t status_word;
uint8_t tag_word;
uint8_t reserved1;
uint16_t error_opcode;
uint32_t error_offset;
uint16_t error_selector;
uint16_t reserved2;
uint32_t data_offset;
uint16_t data_selector;
uint16_t reserved3;
uint32_t mx_csr;
uint32_t mx_csr_mask;
uint128_struct float_registers[8];
uint128_struct xmm_registers[16];
uint8_t reserved4[96];
} MDXmmSaveArea32AMD64; /* XMM_SAVE_AREA32 */
#define MD_CONTEXT_AMD64_VR_COUNT 26
@ -103,63 +103,63 @@ typedef struct {
/*
* Register parameter home addresses.
*/
u_int64_t p1_home;
u_int64_t p2_home;
u_int64_t p3_home;
u_int64_t p4_home;
u_int64_t p5_home;
u_int64_t p6_home;
uint64_t p1_home;
uint64_t p2_home;
uint64_t p3_home;
uint64_t p4_home;
uint64_t p5_home;
uint64_t p6_home;
/* The next field determines the layout of the structure, and which parts
* of it are populated */
u_int32_t context_flags;
u_int32_t mx_csr;
uint32_t context_flags;
uint32_t mx_csr;
/* The next register is included with MD_CONTEXT_AMD64_CONTROL */
u_int16_t cs;
uint16_t cs;
/* The next 4 registers are included with MD_CONTEXT_AMD64_SEGMENTS */
u_int16_t ds;
u_int16_t es;
u_int16_t fs;
u_int16_t gs;
uint16_t ds;
uint16_t es;
uint16_t fs;
uint16_t gs;
/* The next 2 registers are included with MD_CONTEXT_AMD64_CONTROL */
u_int16_t ss;
u_int32_t eflags;
uint16_t ss;
uint32_t eflags;
/* The next 6 registers are included with MD_CONTEXT_AMD64_DEBUG_REGISTERS */
u_int64_t dr0;
u_int64_t dr1;
u_int64_t dr2;
u_int64_t dr3;
u_int64_t dr6;
u_int64_t dr7;
uint64_t dr0;
uint64_t dr1;
uint64_t dr2;
uint64_t dr3;
uint64_t dr6;
uint64_t dr7;
/* The next 4 registers are included with MD_CONTEXT_AMD64_INTEGER */
u_int64_t rax;
u_int64_t rcx;
u_int64_t rdx;
u_int64_t rbx;
uint64_t rax;
uint64_t rcx;
uint64_t rdx;
uint64_t rbx;
/* The next register is included with MD_CONTEXT_AMD64_CONTROL */
u_int64_t rsp;
uint64_t rsp;
/* The next 11 registers are included with MD_CONTEXT_AMD64_INTEGER */
u_int64_t rbp;
u_int64_t rsi;
u_int64_t rdi;
u_int64_t r8;
u_int64_t r9;
u_int64_t r10;
u_int64_t r11;
u_int64_t r12;
u_int64_t r13;
u_int64_t r14;
u_int64_t r15;
uint64_t rbp;
uint64_t rsi;
uint64_t rdi;
uint64_t r8;
uint64_t r9;
uint64_t r10;
uint64_t r11;
uint64_t r12;
uint64_t r13;
uint64_t r14;
uint64_t r15;
/* The next register is included with MD_CONTEXT_AMD64_CONTROL */
u_int64_t rip;
uint64_t rip;
/* The next set of registers are included with
* MD_CONTEXT_AMD64_FLOATING_POINT
@ -167,37 +167,37 @@ typedef struct {
union {
MDXmmSaveArea32AMD64 flt_save;
struct {
u_int128_t header[2];
u_int128_t legacy[8];
u_int128_t xmm0;
u_int128_t xmm1;
u_int128_t xmm2;
u_int128_t xmm3;
u_int128_t xmm4;
u_int128_t xmm5;
u_int128_t xmm6;
u_int128_t xmm7;
u_int128_t xmm8;
u_int128_t xmm9;
u_int128_t xmm10;
u_int128_t xmm11;
u_int128_t xmm12;
u_int128_t xmm13;
u_int128_t xmm14;
u_int128_t xmm15;
uint128_struct header[2];
uint128_struct legacy[8];
uint128_struct xmm0;
uint128_struct xmm1;
uint128_struct xmm2;
uint128_struct xmm3;
uint128_struct xmm4;
uint128_struct xmm5;
uint128_struct xmm6;
uint128_struct xmm7;
uint128_struct xmm8;
uint128_struct xmm9;
uint128_struct xmm10;
uint128_struct xmm11;
uint128_struct xmm12;
uint128_struct xmm13;
uint128_struct xmm14;
uint128_struct xmm15;
} sse_registers;
};
u_int128_t vector_register[MD_CONTEXT_AMD64_VR_COUNT];
u_int64_t vector_control;
uint128_struct vector_register[MD_CONTEXT_AMD64_VR_COUNT];
uint64_t vector_control;
/* The next 5 registers are included with MD_CONTEXT_AMD64_DEBUG_REGISTERS */
u_int64_t debug_control;
u_int64_t last_branch_to_rip;
u_int64_t last_branch_from_rip;
u_int64_t last_exception_to_rip;
u_int64_t last_exception_from_rip;
uint64_t debug_control;
uint64_t last_branch_to_rip;
uint64_t last_branch_from_rip;
uint64_t last_exception_to_rip;
uint64_t last_exception_from_rip;
} MDRawContextAMD64; /* CONTEXT */
/* For (MDRawContextAMD64).context_flags. These values indicate the type of

View file

@ -77,13 +77,13 @@
* are not exactly minidumps.
*/
typedef struct {
u_int64_t fpscr; /* FPU status register */
uint64_t fpscr; /* FPU status register */
/* 32 64-bit floating point registers, d0 .. d31. */
u_int64_t regs[MD_FLOATINGSAVEAREA_ARM_FPR_COUNT];
uint64_t regs[MD_FLOATINGSAVEAREA_ARM_FPR_COUNT];
/* Miscellaneous control words */
u_int32_t extra[MD_FLOATINGSAVEAREA_ARM_FPEXTRA_COUNT];
uint32_t extra[MD_FLOATINGSAVEAREA_ARM_FPEXTRA_COUNT];
} MDFloatingSaveAreaARM;
#define MD_CONTEXT_ARM_GPR_COUNT 16
@ -92,7 +92,7 @@ typedef struct {
/* The next field determines the layout of the structure, and which parts
* of it are populated
*/
u_int32_t context_flags;
uint32_t context_flags;
/* 16 32-bit integer registers, r0 .. r15
* Note the following fixed uses:
@ -100,7 +100,7 @@ typedef struct {
* r14 is the link register
* r15 is the program counter
*/
u_int32_t iregs[MD_CONTEXT_ARM_GPR_COUNT];
uint32_t iregs[MD_CONTEXT_ARM_GPR_COUNT];
/* CPSR (flags, basically): 32 bits:
bit 31 - N (negative)
@ -109,14 +109,14 @@ typedef struct {
bit 28 - V (overflow)
bit 27 - Q (saturation flag, sticky)
All other fields -- ignore */
u_int32_t cpsr;
uint32_t cpsr;
/* The next field is included with MD_CONTEXT_ARM_FLOATING_POINT */
MDFloatingSaveAreaARM float_save;
} MDRawContextARM;
/* Indices into iregs for registers with a dedicated or conventional
/* Indices into iregs for registers with a dedicated or conventional
* purpose.
*/
enum MDARMRegisterNumbers {

View file

@ -81,11 +81,11 @@
#define MD_FLOATINGSAVEAREA_PPC_FPR_COUNT 32
typedef struct {
/* fpregs is a double[32] in mach/ppc/_types.h, but a u_int64_t is used
/* fpregs is a double[32] in mach/ppc/_types.h, but a uint64_t is used
* here for precise sizing. */
u_int64_t fpregs[MD_FLOATINGSAVEAREA_PPC_FPR_COUNT];
u_int32_t fpscr_pad;
u_int32_t fpscr; /* Status/control */
uint64_t fpregs[MD_FLOATINGSAVEAREA_PPC_FPR_COUNT];
uint32_t fpscr_pad;
uint32_t fpscr; /* Status/control */
} MDFloatingSaveAreaPPC; /* Based on ppc_float_state */
@ -94,11 +94,11 @@ typedef struct {
typedef struct {
/* Vector registers (including vscr) are 128 bits, but mach/ppc/_types.h
* exposes them as four 32-bit quantities. */
u_int128_t save_vr[MD_VECTORSAVEAREA_PPC_VR_COUNT];
u_int128_t save_vscr; /* Status/control */
u_int32_t save_pad5[4];
u_int32_t save_vrvalid; /* Identifies which vector registers are saved */
u_int32_t save_pad6[7];
uint128_struct save_vr[MD_VECTORSAVEAREA_PPC_VR_COUNT];
uint128_struct save_vscr; /* Status/control */
uint32_t save_pad5[4];
uint32_t save_vrvalid; /* Indicates which vector registers are saved */
uint32_t save_pad6[7];
} MDVectorSaveAreaPPC; /* ppc_vector_state */
@ -117,21 +117,21 @@ typedef struct {
/* context_flags is not present in ppc_thread_state, but it aids
* identification of MDRawContextPPC among other raw context types,
* and it guarantees alignment when we get to float_save. */
u_int32_t context_flags;
uint32_t context_flags;
u_int32_t srr0; /* Machine status save/restore: stores pc
uint32_t srr0; /* Machine status save/restore: stores pc
* (instruction) */
u_int32_t srr1; /* Machine status save/restore: stores msr
uint32_t srr1; /* Machine status save/restore: stores msr
* (ps, program/machine state) */
/* ppc_thread_state contains 32 fields, r0 .. r31. Here, an array is
* used for brevity. */
u_int32_t gpr[MD_CONTEXT_PPC_GPR_COUNT];
u_int32_t cr; /* Condition */
u_int32_t xer; /* Integer (fiXed-point) exception */
u_int32_t lr; /* Link */
u_int32_t ctr; /* Count */
u_int32_t mq; /* Multiply/Quotient (PPC 601, POWER only) */
u_int32_t vrsave; /* Vector save */
uint32_t gpr[MD_CONTEXT_PPC_GPR_COUNT];
uint32_t cr; /* Condition */
uint32_t xer; /* Integer (fiXed-point) exception */
uint32_t lr; /* Link */
uint32_t ctr; /* Count */
uint32_t mq; /* Multiply/Quotient (PPC 601, POWER only) */
uint32_t vrsave; /* Vector save */
/* float_save and vector_save aren't present in ppc_thread_state, but
* are represented in separate structures that still define a thread's

View file

@ -90,20 +90,20 @@ typedef struct {
/* context_flags is not present in ppc_thread_state, but it aids
* identification of MDRawContextPPC among other raw context types,
* and it guarantees alignment when we get to float_save. */
u_int64_t context_flags;
uint64_t context_flags;
u_int64_t srr0; /* Machine status save/restore: stores pc
uint64_t srr0; /* Machine status save/restore: stores pc
* (instruction) */
u_int64_t srr1; /* Machine status save/restore: stores msr
uint64_t srr1; /* Machine status save/restore: stores msr
* (ps, program/machine state) */
/* ppc_thread_state contains 32 fields, r0 .. r31. Here, an array is
* used for brevity. */
u_int64_t gpr[MD_CONTEXT_PPC64_GPR_COUNT];
u_int64_t cr; /* Condition */
u_int64_t xer; /* Integer (fiXed-point) exception */
u_int64_t lr; /* Link */
u_int64_t ctr; /* Count */
u_int64_t vrsave; /* Vector save */
uint64_t gpr[MD_CONTEXT_PPC64_GPR_COUNT];
uint64_t cr; /* Condition */
uint64_t xer; /* Integer (fiXed-point) exception */
uint64_t lr; /* Link */
uint64_t ctr; /* Count */
uint64_t vrsave; /* Vector save */
/* float_save and vector_save aren't present in ppc_thread_state, but
* are represented in separate structures that still define a thread's

View file

@ -82,10 +82,10 @@
typedef struct {
/* FPU floating point regs */
u_int64_t regs[MD_FLOATINGSAVEAREA_SPARC_FPR_COUNT];
uint64_t regs[MD_FLOATINGSAVEAREA_SPARC_FPR_COUNT];
u_int64_t filler;
u_int64_t fsr; /* FPU status register */
uint64_t filler;
uint64_t fsr; /* FPU status register */
} MDFloatingSaveAreaSPARC; /* FLOATING_SAVE_AREA */
#define MD_CONTEXT_SPARC_GPR_COUNT 32
@ -94,8 +94,8 @@ typedef struct {
/* The next field determines the layout of the structure, and which parts
* of it are populated
*/
u_int32_t context_flags;
u_int32_t flag_pad;
uint32_t context_flags;
uint32_t flag_pad;
/*
* General register access (SPARC).
* Don't confuse definitions here with definitions in <sys/regset.h>.
@ -110,28 +110,28 @@ typedef struct {
* g_r[16-23] local registers(l0-l7)
* g_r[24-31] in registers(i0-i7)
*/
u_int64_t g_r[MD_CONTEXT_SPARC_GPR_COUNT];
uint64_t g_r[MD_CONTEXT_SPARC_GPR_COUNT];
/* several control registers */
/* Processor State register(PSR) for SPARC V7/V8
* Condition Code register (CCR) for SPARC V9
*/
u_int64_t ccr;
uint64_t ccr;
u_int64_t pc; /* Program Counter register (PC) */
u_int64_t npc; /* Next Program Counter register (nPC) */
u_int64_t y; /* Y register (Y) */
uint64_t pc; /* Program Counter register (PC) */
uint64_t npc; /* Next Program Counter register (nPC) */
uint64_t y; /* Y register (Y) */
/* Address Space Identifier register (ASI) for SPARC V9
* WIM for SPARC V7/V8
*/
u_int64_t asi;
uint64_t asi;
/* Floating-Point Registers State register (FPRS) for SPARC V9
* TBR for for SPARC V7/V8
*/
u_int64_t fprs;
uint64_t fprs;
/* The next field is included with MD_CONTEXT_SPARC_FLOATING_POINT */
MDFloatingSaveAreaSPARC float_save;

View file

@ -76,18 +76,18 @@
/* SIZE_OF_80387_REGISTERS */
typedef struct {
u_int32_t control_word;
u_int32_t status_word;
u_int32_t tag_word;
u_int32_t error_offset;
u_int32_t error_selector;
u_int32_t data_offset;
u_int32_t data_selector;
uint32_t control_word;
uint32_t status_word;
uint32_t tag_word;
uint32_t error_offset;
uint32_t error_selector;
uint32_t data_offset;
uint32_t data_selector;
/* register_area contains eight 80-bit (x87 "long double") quantities for
* floating-point registers %st0 (%mm0) through %st7 (%mm7). */
u_int8_t register_area[MD_FLOATINGSAVEAREA_X86_REGISTERAREA_SIZE];
u_int32_t cr0_npx_state;
uint8_t register_area[MD_FLOATINGSAVEAREA_X86_REGISTERAREA_SIZE];
uint32_t cr0_npx_state;
} MDFloatingSaveAreaX86; /* FLOATING_SAVE_AREA */
@ -97,46 +97,46 @@ typedef struct {
typedef struct {
/* The next field determines the layout of the structure, and which parts
* of it are populated */
u_int32_t context_flags;
uint32_t context_flags;
/* The next 6 registers are included with MD_CONTEXT_X86_DEBUG_REGISTERS */
u_int32_t dr0;
u_int32_t dr1;
u_int32_t dr2;
u_int32_t dr3;
u_int32_t dr6;
u_int32_t dr7;
uint32_t dr0;
uint32_t dr1;
uint32_t dr2;
uint32_t dr3;
uint32_t dr6;
uint32_t dr7;
/* The next field is included with MD_CONTEXT_X86_FLOATING_POINT */
MDFloatingSaveAreaX86 float_save;
/* The next 4 registers are included with MD_CONTEXT_X86_SEGMENTS */
u_int32_t gs;
u_int32_t fs;
u_int32_t es;
u_int32_t ds;
uint32_t gs;
uint32_t fs;
uint32_t es;
uint32_t ds;
/* The next 6 registers are included with MD_CONTEXT_X86_INTEGER */
u_int32_t edi;
u_int32_t esi;
u_int32_t ebx;
u_int32_t edx;
u_int32_t ecx;
u_int32_t eax;
uint32_t edi;
uint32_t esi;
uint32_t ebx;
uint32_t edx;
uint32_t ecx;
uint32_t eax;
/* The next 6 registers are included with MD_CONTEXT_X86_CONTROL */
u_int32_t ebp;
u_int32_t eip;
u_int32_t cs; /* WinNT.h says "must be sanitized" */
u_int32_t eflags; /* WinNT.h says "must be sanitized" */
u_int32_t esp;
u_int32_t ss;
uint32_t ebp;
uint32_t eip;
uint32_t cs; /* WinNT.h says "must be sanitized" */
uint32_t eflags; /* WinNT.h says "must be sanitized" */
uint32_t esp;
uint32_t ss;
/* The next field is included with MD_CONTEXT_X86_EXTENDED_REGISTERS.
* It contains vector (MMX/SSE) registers. It it laid out in the
* format used by the fxsave and fsrstor instructions, so it includes
* a copy of the x87 floating-point registers as well. See FXSAVE in
* "Intel Architecture Software Developer's Manual, Volume 2." */
u_int8_t extended_registers[
uint8_t extended_registers[
MD_CONTEXT_X86_EXTENDED_REGISTERS_SIZE];
} MDRawContextX86; /* CONTEXT */

View file

@ -79,10 +79,10 @@
*/
typedef struct {
u_int32_t data1;
u_int16_t data2;
u_int16_t data3;
u_int8_t data4[8];
uint32_t data1;
uint16_t data2;
uint16_t data3;
uint8_t data4[8];
} MDGUID; /* GUID */
@ -110,7 +110,7 @@ typedef struct {
* structure should never be allocated directly. The actual structure type
* can be determined by examining the context_flags field. */
typedef struct {
u_int32_t context_flags;
uint32_t context_flags;
} MDRawContextBase;
#include "minidump_cpu_amd64.h"
@ -126,19 +126,19 @@ typedef struct {
typedef struct {
u_int32_t signature;
u_int32_t struct_version;
u_int32_t file_version_hi;
u_int32_t file_version_lo;
u_int32_t product_version_hi;
u_int32_t product_version_lo;
u_int32_t file_flags_mask; /* Identifies valid bits in fileFlags */
u_int32_t file_flags;
u_int32_t file_os;
u_int32_t file_type;
u_int32_t file_subtype;
u_int32_t file_date_hi;
u_int32_t file_date_lo;
uint32_t signature;
uint32_t struct_version;
uint32_t file_version_hi;
uint32_t file_version_lo;
uint32_t product_version_hi;
uint32_t product_version_lo;
uint32_t file_flags_mask; /* Identifies valid bits in fileFlags */
uint32_t file_flags;
uint32_t file_os;
uint32_t file_type;
uint32_t file_subtype;
uint32_t file_date_hi;
uint32_t file_date_lo;
} MDVSFixedFileInfo; /* VS_FIXEDFILEINFO */
/* For (MDVSFixedFileInfo).signature */
@ -231,10 +231,10 @@ typedef struct {
/* An MDRVA is an offset into the minidump file. The beginning of the
* MDRawHeader is at offset 0. */
typedef u_int32_t MDRVA; /* RVA */
typedef uint32_t MDRVA; /* RVA */
typedef struct {
u_int32_t data_size;
uint32_t data_size;
MDRVA rva;
} MDLocationDescriptor; /* MINIDUMP_LOCATION_DESCRIPTOR */
@ -242,22 +242,22 @@ typedef struct {
typedef struct {
/* The base address of the memory range on the host that produced the
* minidump. */
u_int64_t start_of_memory_range;
uint64_t start_of_memory_range;
MDLocationDescriptor memory;
} MDMemoryDescriptor; /* MINIDUMP_MEMORY_DESCRIPTOR */
typedef struct {
u_int32_t signature;
u_int32_t version;
u_int32_t stream_count;
uint32_t signature;
uint32_t version;
uint32_t stream_count;
MDRVA stream_directory_rva; /* A |stream_count|-sized array of
* MDRawDirectory structures. */
u_int32_t checksum; /* Can be 0. In fact, that's all that's
uint32_t checksum; /* Can be 0. In fact, that's all that's
* been found in minidump files. */
u_int32_t time_date_stamp; /* time_t */
u_int64_t flags;
uint32_t time_date_stamp; /* time_t */
uint64_t flags;
} MDRawHeader; /* MINIDUMP_HEADER */
/* For (MDRawHeader).signature and (MDRawHeader).version. Note that only the
@ -302,7 +302,7 @@ typedef enum {
typedef struct {
u_int32_t stream_type;
uint32_t stream_type;
MDLocationDescriptor location;
} MDRawDirectory; /* MINIDUMP_DIRECTORY */
@ -346,27 +346,27 @@ typedef enum {
typedef struct {
u_int32_t length; /* Length of buffer in bytes (not characters),
uint32_t length; /* Length of buffer in bytes (not characters),
* excluding 0-terminator */
u_int16_t buffer[1]; /* UTF-16-encoded, 0-terminated */
uint16_t buffer[1]; /* UTF-16-encoded, 0-terminated */
} MDString; /* MINIDUMP_STRING */
static const size_t MDString_minsize = offsetof(MDString, buffer[0]);
typedef struct {
u_int32_t thread_id;
u_int32_t suspend_count;
u_int32_t priority_class;
u_int32_t priority;
u_int64_t teb; /* Thread environment block */
uint32_t thread_id;
uint32_t suspend_count;
uint32_t priority_class;
uint32_t priority;
uint64_t teb; /* Thread environment block */
MDMemoryDescriptor stack;
MDLocationDescriptor thread_context; /* MDRawContext[CPU] */
} MDRawThread; /* MINIDUMP_THREAD */
typedef struct {
u_int32_t number_of_threads;
uint32_t number_of_threads;
MDRawThread threads[1];
} MDRawThreadList; /* MINIDUMP_THREAD_LIST */
@ -375,10 +375,10 @@ static const size_t MDRawThreadList_minsize = offsetof(MDRawThreadList,
typedef struct {
u_int64_t base_of_image;
u_int32_t size_of_image;
u_int32_t checksum; /* 0 if unknown */
u_int32_t time_date_stamp; /* time_t */
uint64_t base_of_image;
uint32_t size_of_image;
uint32_t checksum; /* 0 if unknown */
uint32_t time_date_stamp; /* time_t */
MDRVA module_name_rva; /* MDString, pathname or filename */
MDVSFixedFileInfo version_info;
@ -402,8 +402,8 @@ typedef struct {
* As a workaround, reserved0 and reserved1 are instead defined here as
* four 32-bit quantities. This should be harmless, as there are
* currently no known uses for these fields. */
u_int32_t reserved0[2];
u_int32_t reserved1[2];
uint32_t reserved0[2];
uint32_t reserved1[2];
} MDRawModule; /* MINIDUMP_MODULE */
/* The inclusion of a 64-bit type in MINIDUMP_MODULE forces the struct to
@ -419,15 +419,15 @@ typedef struct {
* MDCVInfoPDB70 is the expected structure type with recent toolchains. */
typedef struct {
u_int32_t signature;
u_int32_t offset; /* Offset to debug data (expect 0 in minidump) */
uint32_t signature;
uint32_t offset; /* Offset to debug data (expect 0 in minidump) */
} MDCVHeader;
typedef struct {
MDCVHeader cv_header;
u_int32_t signature; /* time_t debug information created */
u_int32_t age; /* revision of PDB file */
u_int8_t pdb_file_name[1]; /* Pathname or filename of PDB file */
uint32_t signature; /* time_t debug information created */
uint32_t age; /* revision of PDB file */
uint8_t pdb_file_name[1]; /* Pathname or filename of PDB file */
} MDCVInfoPDB20;
static const size_t MDCVInfoPDB20_minsize = offsetof(MDCVInfoPDB20,
@ -436,10 +436,10 @@ static const size_t MDCVInfoPDB20_minsize = offsetof(MDCVInfoPDB20,
#define MD_CVINFOPDB20_SIGNATURE 0x3031424e /* cvHeader.signature = '01BN' */
typedef struct {
u_int32_t cv_signature;
uint32_t cv_signature;
MDGUID signature; /* GUID, identifies PDB file */
u_int32_t age; /* Identifies incremental changes to PDB file */
u_int8_t pdb_file_name[1]; /* Pathname or filename of PDB file,
uint32_t age; /* Identifies incremental changes to PDB file */
uint8_t pdb_file_name[1]; /* Pathname or filename of PDB file,
* 0-terminated 8-bit character data (UTF-8?) */
} MDCVInfoPDB70;
@ -449,12 +449,12 @@ static const size_t MDCVInfoPDB70_minsize = offsetof(MDCVInfoPDB70,
#define MD_CVINFOPDB70_SIGNATURE 0x53445352 /* cvSignature = 'SDSR' */
typedef struct {
u_int32_t data1[2];
u_int32_t data2;
u_int32_t data3;
u_int32_t data4;
u_int32_t data5[3];
u_int8_t extra[2];
uint32_t data1[2];
uint32_t data2;
uint32_t data3;
uint32_t data4;
uint32_t data5[3];
uint8_t extra[2];
} MDCVInfoELF;
/* In addition to the two CodeView record formats above, used for linking
@ -479,12 +479,12 @@ typedef struct {
* obsolete with modules built by recent toolchains. */
typedef struct {
u_int32_t data_type; /* IMAGE_DEBUG_TYPE_*, not defined here because
uint32_t data_type; /* IMAGE_DEBUG_TYPE_*, not defined here because
* this debug record type is mostly obsolete. */
u_int32_t length; /* Length of entire MDImageDebugMisc structure */
u_int8_t unicode; /* True if data is multibyte */
u_int8_t reserved[3];
u_int8_t data[1];
uint32_t length; /* Length of entire MDImageDebugMisc structure */
uint8_t unicode; /* True if data is multibyte */
uint8_t reserved[3];
uint8_t data[1];
} MDImageDebugMisc; /* IMAGE_DEBUG_MISC */
static const size_t MDImageDebugMisc_minsize = offsetof(MDImageDebugMisc,
@ -492,7 +492,7 @@ static const size_t MDImageDebugMisc_minsize = offsetof(MDImageDebugMisc,
typedef struct {
u_int32_t number_of_modules;
uint32_t number_of_modules;
MDRawModule modules[1];
} MDRawModuleList; /* MINIDUMP_MODULE_LIST */
@ -501,7 +501,7 @@ static const size_t MDRawModuleList_minsize = offsetof(MDRawModuleList,
typedef struct {
u_int32_t number_of_memory_ranges;
uint32_t number_of_memory_ranges;
MDMemoryDescriptor memory_ranges[1];
} MDRawMemoryList; /* MINIDUMP_MEMORY_LIST */
@ -512,21 +512,21 @@ static const size_t MDRawMemoryList_minsize = offsetof(MDRawMemoryList,
#define MD_EXCEPTION_MAXIMUM_PARAMETERS 15
typedef struct {
u_int32_t exception_code; /* Windows: MDExceptionCodeWin,
uint32_t exception_code; /* Windows: MDExceptionCodeWin,
* Mac OS X: MDExceptionMac,
* Linux: MDExceptionCodeLinux. */
u_int32_t exception_flags; /* Windows: 1 if noncontinuable,
uint32_t exception_flags; /* Windows: 1 if noncontinuable,
Mac OS X: MDExceptionCodeMac. */
u_int64_t exception_record; /* Address (in the minidump-producing host's
uint64_t exception_record; /* Address (in the minidump-producing host's
* memory) of another MDException, for
* nested exceptions. */
u_int64_t exception_address; /* The address that caused the exception.
uint64_t exception_address; /* The address that caused the exception.
* Mac OS X: exception subcode (which is
* typically the address). */
u_int32_t number_parameters; /* Number of valid elements in
uint32_t number_parameters; /* Number of valid elements in
* exception_information. */
u_int32_t __align;
u_int64_t exception_information[MD_EXCEPTION_MAXIMUM_PARAMETERS];
uint32_t __align;
uint64_t exception_information[MD_EXCEPTION_MAXIMUM_PARAMETERS];
} MDException; /* MINIDUMP_EXCEPTION */
#include "minidump_exception_win32.h"
@ -535,10 +535,10 @@ typedef struct {
#include "minidump_exception_solaris.h"
typedef struct {
u_int32_t thread_id; /* Thread in which the exception
uint32_t thread_id; /* Thread in which the exception
* occurred. Corresponds to
* (MDRawThread).thread_id. */
u_int32_t __align;
uint32_t __align;
MDException exception_record;
MDLocationDescriptor thread_context; /* MDRawContext[CPU] */
} MDRawExceptionStream; /* MINIDUMP_EXCEPTION_STREAM */
@ -546,13 +546,13 @@ typedef struct {
typedef union {
struct {
u_int32_t vendor_id[3]; /* cpuid 0: ebx, edx, ecx */
u_int32_t version_information; /* cpuid 1: eax */
u_int32_t feature_information; /* cpuid 1: edx */
u_int32_t amd_extended_cpu_features; /* cpuid 0x80000001, ebx */
uint32_t vendor_id[3]; /* cpuid 0: ebx, edx, ecx */
uint32_t version_information; /* cpuid 1: eax */
uint32_t feature_information; /* cpuid 1: edx */
uint32_t amd_extended_cpu_features; /* cpuid 0x80000001, ebx */
} x86_cpu_info;
struct {
u_int64_t processor_features[2];
uint64_t processor_features[2];
} other_cpu_info;
} MDCPUInformation; /* CPU_INFORMATION */
@ -560,20 +560,20 @@ typedef union {
typedef struct {
/* The next 3 fields and numberOfProcessors are from the SYSTEM_INFO
* structure as returned by GetSystemInfo */
u_int16_t processor_architecture;
u_int16_t processor_level; /* x86: 5 = 586, 6 = 686, ... */
u_int16_t processor_revision; /* x86: 0xMMSS, where MM=model,
uint16_t processor_architecture;
uint16_t processor_level; /* x86: 5 = 586, 6 = 686, ... */
uint16_t processor_revision; /* x86: 0xMMSS, where MM=model,
* SS=stepping */
u_int8_t number_of_processors;
u_int8_t product_type; /* Windows: VER_NT_* from WinNT.h */
uint8_t number_of_processors;
uint8_t product_type; /* Windows: VER_NT_* from WinNT.h */
/* The next 5 fields are from the OSVERSIONINFO structure as returned
* by GetVersionEx */
u_int32_t major_version;
u_int32_t minor_version;
u_int32_t build_number;
u_int32_t platform_id;
uint32_t major_version;
uint32_t minor_version;
uint32_t build_number;
uint32_t platform_id;
MDRVA csd_version_rva; /* MDString further identifying the
* host OS.
* Windows: name of the installed OS
@ -582,8 +582,8 @@ typedef struct {
* (sw_vers -buildVersion).
* Linux: uname -srvmo */
u_int16_t suite_mask; /* Windows: VER_SUITE_* from WinNT.h */
u_int16_t reserved2;
uint16_t suite_mask; /* Windows: VER_SUITE_* from WinNT.h */
uint16_t reserved2;
MDCPUInformation cpu;
} MDRawSystemInfo; /* MINIDUMP_SYSTEM_INFO */
@ -627,29 +627,29 @@ typedef enum {
typedef struct {
u_int32_t size_of_info; /* Length of entire MDRawMiscInfo structure. */
u_int32_t flags1;
uint32_t size_of_info; /* Length of entire MDRawMiscInfo structure. */
uint32_t flags1;
/* The next field is only valid if flags1 contains
* MD_MISCINFO_FLAGS1_PROCESS_ID. */
u_int32_t process_id;
uint32_t process_id;
/* The next 3 fields are only valid if flags1 contains
* MD_MISCINFO_FLAGS1_PROCESS_TIMES. */
u_int32_t process_create_time; /* time_t process started */
u_int32_t process_user_time; /* seconds of user CPU time */
u_int32_t process_kernel_time; /* seconds of kernel CPU time */
uint32_t process_create_time; /* time_t process started */
uint32_t process_user_time; /* seconds of user CPU time */
uint32_t process_kernel_time; /* seconds of kernel CPU time */
/* The following fields are not present in MINIDUMP_MISC_INFO but are
* in MINIDUMP_MISC_INFO_2. When this struct is populated, these values
* may not be set. Use flags1 or sizeOfInfo to determine whether these
* values are present. These are only valid when flags1 contains
* MD_MISCINFO_FLAGS1_PROCESSOR_POWER_INFO. */
u_int32_t processor_max_mhz;
u_int32_t processor_current_mhz;
u_int32_t processor_mhz_limit;
u_int32_t processor_max_idle_state;
u_int32_t processor_current_idle_state;
uint32_t processor_max_mhz;
uint32_t processor_current_mhz;
uint32_t processor_mhz_limit;
uint32_t processor_max_idle_state;
uint32_t processor_current_idle_state;
} MDRawMiscInfo; /* MINIDUMP_MISC_INFO, MINIDUMP_MISC_INFO2 */
#define MD_MISCINFO_SIZE 24
@ -666,7 +666,7 @@ typedef enum {
/* MINIDUMP_MISC1_PROCESSOR_POWER_INFO */
} MDMiscInfoFlags1;
/*
/*
* Around DbgHelp version 6.0, the style of new LIST structures changed
* from including an array of length 1 at the end of the struct to
* represent the variable-length data to including explicit
@ -677,24 +677,24 @@ typedef enum {
*/
typedef struct {
u_int32_t size_of_header; /* sizeof(MDRawMemoryInfoList) */
u_int32_t size_of_entry; /* sizeof(MDRawMemoryInfo) */
u_int64_t number_of_entries;
uint32_t size_of_header; /* sizeof(MDRawMemoryInfoList) */
uint32_t size_of_entry; /* sizeof(MDRawMemoryInfo) */
uint64_t number_of_entries;
} MDRawMemoryInfoList; /* MINIDUMP_MEMORY_INFO_LIST */
typedef struct {
u_int64_t base_address; /* Base address of a region of pages */
u_int64_t allocation_base; /* Base address of a range of pages
uint64_t base_address; /* Base address of a region of pages */
uint64_t allocation_base; /* Base address of a range of pages
* within this region. */
u_int32_t allocation_protection; /* Memory protection when this region
uint32_t allocation_protection; /* Memory protection when this region
* was originally allocated:
* MDMemoryProtection */
u_int32_t __alignment1;
u_int64_t region_size;
u_int32_t state; /* MDMemoryState */
u_int32_t protection; /* MDMemoryProtection */
u_int32_t type; /* MDMemoryType */
u_int32_t __alignment2;
uint32_t __alignment1;
uint64_t region_size;
uint32_t state; /* MDMemoryState */
uint32_t protection; /* MDMemoryProtection */
uint32_t type; /* MDMemoryType */
uint32_t __alignment2;
} MDRawMemoryInfo; /* MINIDUMP_MEMORY_INFO */
/* For (MDRawMemoryInfo).state */
@ -721,7 +721,7 @@ typedef enum {
} MDMemoryProtection;
/* Used to mask the mutually exclusive options from the combinable flags. */
const u_int32_t MD_MEMORY_PROTECTION_ACCESS_MASK = 0xFF;
const uint32_t MD_MEMORY_PROTECTION_ACCESS_MASK = 0xFF;
/* For (MDRawMemoryInfo).type */
typedef enum {
@ -738,7 +738,7 @@ typedef enum {
typedef struct {
/* validity is a bitmask with values from MDBreakpadInfoValidity, indicating
* which of the other fields in the structure are valid. */
u_int32_t validity;
uint32_t validity;
/* Thread ID of the handler thread. dump_thread_id should correspond to
* the thread_id of an MDRawThread in the minidump's MDRawThreadList if
@ -746,7 +746,7 @@ typedef struct {
* the MDRawThreadList does not contain a dedicated thread used to produce
* the minidump, this field should be set to 0 and the validity field
* must not contain MD_BREAKPAD_INFO_VALID_DUMP_THREAD_ID. */
u_int32_t dump_thread_id;
uint32_t dump_thread_id;
/* Thread ID of the thread that requested the minidump be produced. As
* with dump_thread_id, requesting_thread_id should correspond to the
@ -759,7 +759,7 @@ typedef struct {
* other than a thread in the MDRawThreadList, this field should be set
* to 0 and the validity field must not contain
* MD_BREAKPAD_INFO_VALID_REQUESTING_THREAD_ID. */
u_int32_t requesting_thread_id;
uint32_t requesting_thread_id;
} MDRawBreakpadInfo;
/* For (MDRawBreakpadInfo).validity: */
@ -777,11 +777,11 @@ typedef struct {
* written to a file.
* Fixed-length strings are used because MiniDumpWriteDump doesn't offer
* a way for user streams to point to arbitrary RVAs for strings. */
u_int16_t expression[128]; /* Assertion that failed... */
u_int16_t function[128]; /* ...within this function... */
u_int16_t file[128]; /* ...in this file... */
u_int32_t line; /* ...at this line. */
u_int32_t type;
uint16_t expression[128]; /* Assertion that failed... */
uint16_t function[128]; /* ...within this function... */
uint16_t file[128]; /* ...in this file... */
uint32_t line; /* ...at this line. */
uint32_t type;
} MDRawAssertionInfo;
/* For (MDRawAssertionInfo).type: */
@ -806,9 +806,9 @@ typedef struct {
} MDRawLinkMap;
typedef struct {
u_int32_t version;
uint32_t version;
MDRVA map;
u_int32_t dso_count;
uint32_t dso_count;
void* brk;
void* ldbase;
void* dynamic;

View file

@ -47,11 +47,11 @@ class CodeModule {
virtual ~CodeModule() {}
// The base address of this code module as it was loaded by the process.
// (u_int64_t)-1 on error.
virtual u_int64_t base_address() const = 0;
// (uint64_t)-1 on error.
virtual uint64_t base_address() const = 0;
// The size of the code module. 0 on error.
virtual u_int64_t size() const = 0;
virtual uint64_t size() const = 0;
// The path or file name that the code module was loaded from. Empty on
// error.

View file

@ -53,7 +53,7 @@ class CodeModules {
// address, returns NULL. Ownership of the returned CodeModule is retained
// by the CodeModules object; pointers returned by this method are valid for
// comparison with pointers returned by the other Get methods.
virtual const CodeModule* GetModuleForAddress(u_int64_t address) const = 0;
virtual const CodeModule* GetModuleForAddress(uint64_t address) const = 0;
// Returns the module corresponding to the main executable. If there is
// no main executable, returns NULL. Ownership of the returned CodeModule

View file

@ -54,7 +54,7 @@ class Exploitability {
ProcessState *process_state);
ExploitabilityRating CheckExploitability();
bool AddressIsAscii(u_int64_t);
bool AddressIsAscii(uint64_t);
protected:
Exploitability(Minidump *dump,

View file

@ -50,10 +50,10 @@ class MemoryRegion {
virtual ~MemoryRegion() {}
// The base address of this memory region.
virtual u_int64_t GetBase() const = 0;
virtual uint64_t GetBase() const = 0;
// The size of this memory region.
virtual u_int32_t GetSize() const = 0;
virtual uint32_t GetSize() const = 0;
// Access to data of various sizes within the memory region. address
// is a pointer to read, and it must lie within the memory region as
@ -63,10 +63,10 @@ class MemoryRegion {
// program. Returns true on success. Fails and returns false if address
// is out of the region's bounds (after considering the width of value),
// or for other types of errors.
virtual bool GetMemoryAtAddress(u_int64_t address, u_int8_t* value) const =0;
virtual bool GetMemoryAtAddress(u_int64_t address, u_int16_t* value) const =0;
virtual bool GetMemoryAtAddress(u_int64_t address, u_int32_t* value) const =0;
virtual bool GetMemoryAtAddress(u_int64_t address, u_int64_t* value) const =0;
virtual bool GetMemoryAtAddress(uint64_t address, uint8_t* value) const = 0;
virtual bool GetMemoryAtAddress(uint64_t address, uint16_t* value) const = 0;
virtual bool GetMemoryAtAddress(uint64_t address, uint32_t* value) const = 0;
virtual bool GetMemoryAtAddress(uint64_t address, uint64_t* value) const = 0;
};

View file

@ -154,7 +154,7 @@ class MinidumpStream : public MinidumpObject {
// the MDRawDirectory record or other identifying record. A class
// that implements MinidumpStream can compare expected_size to a
// known size as an integrity check.
virtual bool Read(u_int32_t expected_size) = 0;
virtual bool Read(uint32_t expected_size) = 0;
};
@ -176,11 +176,11 @@ class MinidumpContext : public MinidumpStream {
// identifying the CPU type that the context was collected from. The
// returned value will identify the CPU only, and will have any other
// MD_CONTEXT_* bits masked out. Returns 0 on failure.
u_int32_t GetContextCPU() const;
uint32_t GetContextCPU() const;
// A convenience method to get the instruction pointer out of the
// MDRawContext, since it varies per-CPU architecture.
bool GetInstructionPointer(u_int64_t* ip) const;
bool GetInstructionPointer(uint64_t* ip) const;
// Returns raw CPU-specific context data for the named CPU type. If the
// context data does not match the CPU type or does not exist, returns
@ -210,13 +210,13 @@ class MinidumpContext : public MinidumpStream {
} context_;
// Store this separately because of the weirdo AMD64 context
u_int32_t context_flags_;
uint32_t context_flags_;
private:
friend class MinidumpThread;
friend class MinidumpException;
bool Read(u_int32_t expected_size);
bool Read(uint32_t expected_size);
// Free the CPU-specific context structure.
void FreeContext();
@ -226,7 +226,7 @@ class MinidumpContext : public MinidumpStream {
// CPU type in context_cpu_type. Returns false if the CPU type does not
// match. Returns true if the CPU type matches or if the minidump does
// not contain a system info stream.
bool CheckAgainstSystemInfo(u_int32_t context_cpu_type);
bool CheckAgainstSystemInfo(uint32_t context_cpu_type);
};
@ -243,28 +243,28 @@ class MinidumpMemoryRegion : public MinidumpObject,
public:
virtual ~MinidumpMemoryRegion();
static void set_max_bytes(u_int32_t max_bytes) { max_bytes_ = max_bytes; }
static u_int32_t max_bytes() { return max_bytes_; }
static void set_max_bytes(uint32_t max_bytes) { max_bytes_ = max_bytes; }
static uint32_t max_bytes() { return max_bytes_; }
// Returns a pointer to the base of the memory region. Returns the
// cached value if available, otherwise, reads the minidump file and
// caches the memory region.
const u_int8_t* GetMemory() const;
const uint8_t* GetMemory() const;
// The address of the base of the memory region.
u_int64_t GetBase() const;
uint64_t GetBase() const;
// The size, in bytes, of the memory region.
u_int32_t GetSize() const;
uint32_t GetSize() const;
// Frees the cached memory region, if cached.
void FreeMemory();
// Obtains the value of memory at the pointer specified by address.
bool GetMemoryAtAddress(u_int64_t address, u_int8_t* value) const;
bool GetMemoryAtAddress(u_int64_t address, u_int16_t* value) const;
bool GetMemoryAtAddress(u_int64_t address, u_int32_t* value) const;
bool GetMemoryAtAddress(u_int64_t address, u_int64_t* value) const;
bool GetMemoryAtAddress(uint64_t address, uint8_t* value) const;
bool GetMemoryAtAddress(uint64_t address, uint16_t* value) const;
bool GetMemoryAtAddress(uint64_t address, uint32_t* value) const;
bool GetMemoryAtAddress(uint64_t address, uint64_t* value) const;
// Print a human-readable representation of the object to stdout.
void Print();
@ -281,19 +281,19 @@ class MinidumpMemoryRegion : public MinidumpObject,
void SetDescriptor(MDMemoryDescriptor* descriptor);
// Implementation for GetMemoryAtAddress
template<typename T> bool GetMemoryAtAddressInternal(u_int64_t address,
template<typename T> bool GetMemoryAtAddressInternal(uint64_t address,
T* value) const;
// The largest memory region that will be read from a minidump. The
// default is 1MB.
static u_int32_t max_bytes_;
static uint32_t max_bytes_;
// Base address and size of the memory region, and its position in the
// minidump file.
MDMemoryDescriptor* descriptor_;
// Cached memory.
mutable vector<u_int8_t>* memory_;
mutable vector<uint8_t>* memory_;
};
@ -319,7 +319,7 @@ class MinidumpThread : public MinidumpObject {
// so a special getter is provided to retrieve this data from the
// MDRawThread structure. Returns false if the thread ID cannot be
// determined.
virtual bool GetThreadID(u_int32_t *thread_id) const;
virtual bool GetThreadID(uint32_t *thread_id) const;
// Print a human-readable representation of the object to stdout.
void Print();
@ -348,10 +348,10 @@ class MinidumpThreadList : public MinidumpStream {
public:
virtual ~MinidumpThreadList();
static void set_max_threads(u_int32_t max_threads) {
static void set_max_threads(uint32_t max_threads) {
max_threads_ = max_threads;
}
static u_int32_t max_threads() { return max_threads_; }
static uint32_t max_threads() { return max_threads_; }
virtual unsigned int thread_count() const {
return valid_ ? thread_count_ : 0;
@ -361,7 +361,7 @@ class MinidumpThreadList : public MinidumpStream {
virtual MinidumpThread* GetThreadAtIndex(unsigned int index) const;
// Random access to threads.
MinidumpThread* GetThreadByID(u_int32_t thread_id);
MinidumpThread* GetThreadByID(uint32_t thread_id);
// Print a human-readable representation of the object to stdout.
void Print();
@ -372,23 +372,23 @@ class MinidumpThreadList : public MinidumpStream {
private:
friend class Minidump;
typedef map<u_int32_t, MinidumpThread*> IDToThreadMap;
typedef map<uint32_t, MinidumpThread*> IDToThreadMap;
typedef vector<MinidumpThread> MinidumpThreads;
static const u_int32_t kStreamType = MD_THREAD_LIST_STREAM;
static const uint32_t kStreamType = MD_THREAD_LIST_STREAM;
bool Read(u_int32_t aExpectedSize);
bool Read(uint32_t aExpectedSize);
// The largest number of threads that will be read from a minidump. The
// default is 256.
static u_int32_t max_threads_;
static uint32_t max_threads_;
// Access to threads using the thread ID as the key.
IDToThreadMap id_to_thread_map_;
// The list of threads.
MinidumpThreads* threads_;
u_int32_t thread_count_;
uint32_t thread_count_;
};
@ -401,23 +401,23 @@ class MinidumpModule : public MinidumpObject,
public:
virtual ~MinidumpModule();
static void set_max_cv_bytes(u_int32_t max_cv_bytes) {
static void set_max_cv_bytes(uint32_t max_cv_bytes) {
max_cv_bytes_ = max_cv_bytes;
}
static u_int32_t max_cv_bytes() { return max_cv_bytes_; }
static uint32_t max_cv_bytes() { return max_cv_bytes_; }
static void set_max_misc_bytes(u_int32_t max_misc_bytes) {
static void set_max_misc_bytes(uint32_t max_misc_bytes) {
max_misc_bytes_ = max_misc_bytes;
}
static u_int32_t max_misc_bytes() { return max_misc_bytes_; }
static uint32_t max_misc_bytes() { return max_misc_bytes_; }
const MDRawModule* module() const { return valid_ ? &module_ : NULL; }
// CodeModule implementation
virtual u_int64_t base_address() const {
return valid_ ? module_.base_of_image : static_cast<u_int64_t>(-1);
virtual uint64_t base_address() const {
return valid_ ? module_.base_of_image : static_cast<uint64_t>(-1);
}
virtual u_int64_t size() const { return valid_ ? module_.size_of_image : 0; }
virtual uint64_t size() const { return valid_ ? module_.size_of_image : 0; }
virtual string code_file() const;
virtual string code_identifier() const;
virtual string debug_file() const;
@ -426,7 +426,7 @@ class MinidumpModule : public MinidumpObject,
virtual const CodeModule* Copy() const;
// The CodeView record, which contains information to locate the module's
// debugging information (pdb). This is returned as u_int8_t* because
// debugging information (pdb). This is returned as uint8_t* because
// the data can be of types MDCVInfoPDB20* or MDCVInfoPDB70*, or it may be
// of a type unknown to Breakpad, in which case the raw data will still be
// returned but no byte-swapping will have been performed. Check the
@ -435,14 +435,14 @@ class MinidumpModule : public MinidumpObject,
// MDCVInfoPDB70 by default. Returns a pointer to the CodeView record on
// success, and NULL on failure. On success, the optional |size| argument
// is set to the size of the CodeView record.
const u_int8_t* GetCVRecord(u_int32_t* size);
const uint8_t* GetCVRecord(uint32_t* size);
// The miscellaneous debug record, which is obsolete. Current toolchains
// do not generate this type of debugging information (dbg), and this
// field is not expected to be present. Returns a pointer to the debugging
// record on success, and NULL on failure. On success, the optional |size|
// argument is set to the size of the debugging record.
const MDImageDebugMisc* GetMiscRecord(u_int32_t* size);
const MDImageDebugMisc* GetMiscRecord(uint32_t* size);
// Print a human-readable representation of the object to stdout.
void Print();
@ -469,8 +469,8 @@ class MinidumpModule : public MinidumpObject,
// The largest number of bytes that will be read from a minidump for a
// CodeView record or miscellaneous debugging record, respectively. The
// default for each is 1024.
static u_int32_t max_cv_bytes_;
static u_int32_t max_misc_bytes_;
static uint32_t max_cv_bytes_;
static uint32_t max_misc_bytes_;
// True after a successful Read. This is different from valid_, which is
// not set true until ReadAuxiliaryData also completes successfully.
@ -490,20 +490,20 @@ class MinidumpModule : public MinidumpObject,
const string* name_;
// Cached CodeView record - this is MDCVInfoPDB20 or (likely)
// MDCVInfoPDB70, or possibly something else entirely. Stored as a u_int8_t
// MDCVInfoPDB70, or possibly something else entirely. Stored as a uint8_t
// because the structure contains a variable-sized string and its exact
// size cannot be known until it is processed.
vector<u_int8_t>* cv_record_;
vector<uint8_t>* cv_record_;
// If cv_record_ is present, cv_record_signature_ contains a copy of the
// CodeView record's first four bytes, for ease of determinining the
// type of structure that cv_record_ contains.
u_int32_t cv_record_signature_;
uint32_t cv_record_signature_;
// Cached MDImageDebugMisc (usually not present), stored as u_int8_t
// Cached MDImageDebugMisc (usually not present), stored as uint8_t
// because the structure contains a variable-sized string and its exact
// size cannot be known until it is processed.
vector<u_int8_t>* misc_record_;
vector<uint8_t>* misc_record_;
};
@ -516,16 +516,16 @@ class MinidumpModuleList : public MinidumpStream,
public:
virtual ~MinidumpModuleList();
static void set_max_modules(u_int32_t max_modules) {
static void set_max_modules(uint32_t max_modules) {
max_modules_ = max_modules;
}
static u_int32_t max_modules() { return max_modules_; }
static uint32_t max_modules() { return max_modules_; }
// CodeModules implementation.
virtual unsigned int module_count() const {
return valid_ ? module_count_ : 0;
}
virtual const MinidumpModule* GetModuleForAddress(u_int64_t address) const;
virtual const MinidumpModule* GetModuleForAddress(uint64_t address) const;
virtual const MinidumpModule* GetMainModule() const;
virtual const MinidumpModule* GetModuleAtSequence(
unsigned int sequence) const;
@ -543,19 +543,19 @@ class MinidumpModuleList : public MinidumpStream,
typedef vector<MinidumpModule> MinidumpModules;
static const u_int32_t kStreamType = MD_MODULE_LIST_STREAM;
static const uint32_t kStreamType = MD_MODULE_LIST_STREAM;
bool Read(u_int32_t expected_size);
bool Read(uint32_t expected_size);
// The largest number of modules that will be read from a minidump. The
// default is 1024.
static u_int32_t max_modules_;
static uint32_t max_modules_;
// Access to modules using addresses as the key.
RangeMap<u_int64_t, unsigned int> *range_map_;
RangeMap<uint64_t, unsigned int> *range_map_;
MinidumpModules *modules_;
u_int32_t module_count_;
uint32_t module_count_;
};
@ -572,10 +572,10 @@ class MinidumpMemoryList : public MinidumpStream {
public:
virtual ~MinidumpMemoryList();
static void set_max_regions(u_int32_t max_regions) {
static void set_max_regions(uint32_t max_regions) {
max_regions_ = max_regions;
}
static u_int32_t max_regions() { return max_regions_; }
static uint32_t max_regions() { return max_regions_; }
unsigned int region_count() const { return valid_ ? region_count_ : 0; }
@ -584,7 +584,7 @@ class MinidumpMemoryList : public MinidumpStream {
// Random access to memory regions. Returns the region encompassing
// the address identified by address.
MinidumpMemoryRegion* GetMemoryRegionForAddress(u_int64_t address);
MinidumpMemoryRegion* GetMemoryRegionForAddress(uint64_t address);
// Print a human-readable representation of the object to stdout.
void Print();
@ -595,18 +595,18 @@ class MinidumpMemoryList : public MinidumpStream {
typedef vector<MDMemoryDescriptor> MemoryDescriptors;
typedef vector<MinidumpMemoryRegion> MemoryRegions;
static const u_int32_t kStreamType = MD_MEMORY_LIST_STREAM;
static const uint32_t kStreamType = MD_MEMORY_LIST_STREAM;
explicit MinidumpMemoryList(Minidump* minidump);
bool Read(u_int32_t expected_size);
bool Read(uint32_t expected_size);
// The largest number of memory regions that will be read from a minidump.
// The default is 256.
static u_int32_t max_regions_;
static uint32_t max_regions_;
// Access to memory regions using addresses as the key.
RangeMap<u_int64_t, unsigned int> *range_map_;
RangeMap<uint64_t, unsigned int> *range_map_;
// The list of descriptors. This is maintained separately from the list
// of regions, because MemoryRegion doesn't own its MemoryDescriptor, it
@ -616,7 +616,7 @@ class MinidumpMemoryList : public MinidumpStream {
// The list of regions.
MemoryRegions *regions_;
u_int32_t region_count_;
uint32_t region_count_;
};
@ -638,7 +638,7 @@ class MinidumpException : public MinidumpStream {
// so a special getter is provided to retrieve this data from the
// MDRawExceptionStream structure. Returns false if the thread ID cannot
// be determined.
bool GetThreadID(u_int32_t *thread_id) const;
bool GetThreadID(uint32_t *thread_id) const;
MinidumpContext* GetContext();
@ -648,11 +648,11 @@ class MinidumpException : public MinidumpStream {
private:
friend class Minidump;
static const u_int32_t kStreamType = MD_EXCEPTION_STREAM;
static const uint32_t kStreamType = MD_EXCEPTION_STREAM;
explicit MinidumpException(Minidump* minidump);
bool Read(u_int32_t expected_size);
bool Read(uint32_t expected_size);
MDRawExceptionStream exception_;
MinidumpContext* context_;
@ -686,11 +686,11 @@ class MinidumpAssertion : public MinidumpStream {
private:
friend class Minidump;
static const u_int32_t kStreamType = MD_ASSERTION_INFO_STREAM;
static const uint32_t kStreamType = MD_ASSERTION_INFO_STREAM;
explicit MinidumpAssertion(Minidump* minidump);
bool Read(u_int32_t expected_size);
bool Read(uint32_t expected_size);
MDRawAssertionInfo assertion_;
string expression_;
@ -743,9 +743,9 @@ class MinidumpSystemInfo : public MinidumpStream {
private:
friend class Minidump;
static const u_int32_t kStreamType = MD_SYSTEM_INFO_STREAM;
static const uint32_t kStreamType = MD_SYSTEM_INFO_STREAM;
bool Read(u_int32_t expected_size);
bool Read(uint32_t expected_size);
// A string identifying the CPU vendor, if known.
const string* cpu_vendor_;
@ -767,11 +767,11 @@ class MinidumpMiscInfo : public MinidumpStream {
private:
friend class Minidump;
static const u_int32_t kStreamType = MD_MISC_INFO_STREAM;
static const uint32_t kStreamType = MD_MISC_INFO_STREAM;
explicit MinidumpMiscInfo(Minidump* minidump_);
bool Read(u_int32_t expected_size_);
bool Read(uint32_t expected_size_);
MDRawMiscInfo misc_info_;
};
@ -790,8 +790,8 @@ class MinidumpBreakpadInfo : public MinidumpStream {
// treatment, so special getters are provided to retrieve this data from
// the MDRawBreakpadInfo structure. The getters return false if the thread
// IDs cannot be determined.
bool GetDumpThreadID(u_int32_t *thread_id) const;
bool GetRequestingThreadID(u_int32_t *thread_id) const;
bool GetDumpThreadID(uint32_t *thread_id) const;
bool GetRequestingThreadID(uint32_t *thread_id) const;
// Print a human-readable representation of the object to stdout.
void Print();
@ -799,11 +799,11 @@ class MinidumpBreakpadInfo : public MinidumpStream {
private:
friend class Minidump;
static const u_int32_t kStreamType = MD_BREAKPAD_INFO_STREAM;
static const uint32_t kStreamType = MD_BREAKPAD_INFO_STREAM;
explicit MinidumpBreakpadInfo(Minidump* minidump_);
bool Read(u_int32_t expected_size_);
bool Read(uint32_t expected_size_);
MDRawBreakpadInfo breakpad_info_;
};
@ -816,10 +816,10 @@ class MinidumpMemoryInfo : public MinidumpObject {
const MDRawMemoryInfo* info() const { return valid_ ? &memory_info_ : NULL; }
// The address of the base of the memory region.
u_int64_t GetBase() const { return valid_ ? memory_info_.base_address : 0; }
uint64_t GetBase() const { return valid_ ? memory_info_.base_address : 0; }
// The size, in bytes, of the memory region.
u_int32_t GetSize() const { return valid_ ? memory_info_.region_size : 0; }
uint32_t GetSize() const { return valid_ ? memory_info_.region_size : 0; }
// Return true if the memory protection allows execution.
bool IsExecutable() const;
@ -854,7 +854,7 @@ class MinidumpMemoryInfoList : public MinidumpStream {
unsigned int info_count() const { return valid_ ? info_count_ : 0; }
const MinidumpMemoryInfo* GetMemoryInfoForAddress(u_int64_t address) const;
const MinidumpMemoryInfo* GetMemoryInfoForAddress(uint64_t address) const;
const MinidumpMemoryInfo* GetMemoryInfoAtIndex(unsigned int index) const;
// Print a human-readable representation of the object to stdout.
@ -865,17 +865,17 @@ class MinidumpMemoryInfoList : public MinidumpStream {
typedef vector<MinidumpMemoryInfo> MinidumpMemoryInfos;
static const u_int32_t kStreamType = MD_MEMORY_INFO_LIST_STREAM;
static const uint32_t kStreamType = MD_MEMORY_INFO_LIST_STREAM;
explicit MinidumpMemoryInfoList(Minidump* minidump);
bool Read(u_int32_t expected_size);
bool Read(uint32_t expected_size);
// Access to memory info using addresses as the key.
RangeMap<u_int64_t, unsigned int> *range_map_;
RangeMap<uint64_t, unsigned int> *range_map_;
MinidumpMemoryInfos* infos_;
u_int32_t info_count_;
uint32_t info_count_;
};
@ -896,15 +896,15 @@ class Minidump {
virtual string path() const {
return path_;
}
static void set_max_streams(u_int32_t max_streams) {
static void set_max_streams(uint32_t max_streams) {
max_streams_ = max_streams;
}
static u_int32_t max_streams() { return max_streams_; }
static uint32_t max_streams() { return max_streams_; }
static void set_max_string_length(u_int32_t max_string_length) {
static void set_max_string_length(uint32_t max_string_length) {
max_string_length_ = max_string_length;
}
static u_int32_t max_string_length() { return max_string_length_; }
static uint32_t max_string_length() { return max_string_length_; }
virtual const MDRawHeader* header() const { return valid_ ? &header_ : NULL; }
@ -916,7 +916,7 @@ class Minidump {
// Returns true if the current position in the stream was not changed.
// Returns false when the current location in the stream was changed and the
// attempt to restore the original position failed.
bool GetContextCPUFlagsFromSystemInfo(u_int32_t* context_cpu_flags);
bool GetContextCPUFlagsFromSystemInfo(uint32_t* context_cpu_flags);
// Reads the minidump file's header and top-level stream directory.
// The minidump is expected to be positioned at the beginning of the
@ -980,7 +980,7 @@ class Minidump {
// possibility, and consider using GetDirectoryEntryAtIndex (possibly
// with GetDirectoryEntryCount) if expecting multiple streams of the same
// type in a single minidump file.
bool SeekToStreamType(u_int32_t stream_type, u_int32_t* stream_length);
bool SeekToStreamType(uint32_t stream_type, uint32_t* stream_length);
bool swap() const { return valid_ ? swap_ : false; }
@ -1003,7 +1003,7 @@ class Minidump {
};
typedef vector<MDRawDirectory> MinidumpDirectoryEntries;
typedef map<u_int32_t, MinidumpStreamInfo> MinidumpStreamMap;
typedef map<uint32_t, MinidumpStreamInfo> MinidumpStreamMap;
template<typename T> T* GetStream(T** stream);
@ -1013,7 +1013,7 @@ class Minidump {
// The largest number of top-level streams that will be read from a minidump.
// Note that streams are only read (and only consume memory) as needed,
// when directed by the caller. The default is 128.
static u_int32_t max_streams_;
static uint32_t max_streams_;
// The maximum length of a UTF-16 string that will be read from a minidump
// in 16-bit words. The default is 1024. UTF-16 strings are converted

View file

@ -131,7 +131,7 @@ class MinidumpProcessor {
// address when the crash was caused by problems such as illegal
// instructions or divisions by zero, or a data address when the crash
// was caused by a memory access violation.
static string GetCrashReason(Minidump* dump, u_int64_t* address);
static string GetCrashReason(Minidump* dump, uint64_t* address);
// This function returns true if the passed-in error code is
// something unrecoverable(i.e. retry should not happen). For

View file

@ -94,10 +94,10 @@ class ProcessState {
void Clear();
// Accessors. See the data declarations below.
u_int32_t time_date_stamp() const { return time_date_stamp_; }
uint32_t time_date_stamp() const { return time_date_stamp_; }
bool crashed() const { return crashed_; }
string crash_reason() const { return crash_reason_; }
u_int64_t crash_address() const { return crash_address_; }
uint64_t crash_address() const { return crash_address_; }
string assertion() const { return assertion_; }
int requesting_thread() const { return requesting_thread_; }
const vector<CallStack*>* threads() const { return &threads_; }
@ -113,7 +113,7 @@ class ProcessState {
friend class MinidumpProcessor;
// The time-date stamp of the minidump (time_t format)
u_int32_t time_date_stamp_;
uint32_t time_date_stamp_;
// True if the process crashed, false if the dump was produced outside
// of an exception handler.
@ -129,7 +129,7 @@ class ProcessState {
// the memory address that caused the crash. For data access errors,
// this will be the data address that caused the fault. For code errors,
// this will be the address of the instruction that caused the fault.
u_int64_t crash_address_;
uint64_t crash_address_;
// If there was an assertion that was hit, a textual representation
// of that assertion, possibly including the file and line at which

View file

@ -48,7 +48,7 @@ class CFIFrameInfo;
class SourceLineResolverInterface {
public:
typedef u_int64_t MemAddr;
typedef uint64_t MemAddr;
virtual ~SourceLineResolverInterface() {}

View file

@ -85,7 +85,7 @@ struct StackFrame {
// Return the actual return address, as saved on the stack or in a
// register. See the comments for 'instruction', below, for details.
virtual u_int64_t ReturnAddress() const { return instruction; }
virtual uint64_t ReturnAddress() const { return instruction; }
// The program counter location as an absolute virtual address.
//
@ -108,7 +108,7 @@ struct StackFrame {
// a register is fine for looking up the point of the call. On others, it
// requires adjustment. ReturnAddress returns the address as saved by the
// machine.
u_int64_t instruction;
uint64_t instruction;
// The module in which the instruction resides.
const CodeModule *module;
@ -118,7 +118,7 @@ struct StackFrame {
// The start address of the function, may be omitted if debug symbols
// are not available.
u_int64_t function_base;
uint64_t function_base;
// The source file name, may be omitted if debug symbols are not available.
string source_file_name;
@ -129,7 +129,7 @@ struct StackFrame {
// The start address of the source line, may be omitted if debug symbols
// are not available.
u_int64_t source_line_base;
uint64_t source_line_base;
// Amount of trust the stack walker has in the instruction pointer
// of this frame.

View file

@ -78,7 +78,7 @@ struct StackFrameX86 : public StackFrame {
~StackFrameX86();
// Overriden to return the return address as saved on the stack.
virtual u_int64_t ReturnAddress() const;
virtual uint64_t ReturnAddress() const;
// Register state. This is only fully valid for the topmost frame in a
// stack. In other frames, the values of nonvolatile registers may be
@ -151,7 +151,7 @@ struct StackFrameAMD64 : public StackFrame {
StackFrameAMD64() : context(), context_validity(CONTEXT_VALID_NONE) {}
// Overriden to return the return address as saved on the stack.
virtual u_int64_t ReturnAddress() const;
virtual uint64_t ReturnAddress() const;
// Register state. This is only fully valid for the topmost frame in a
// stack. In other frames, which registers are present depends on what

View file

@ -78,8 +78,8 @@ class Stackwalker {
const CodeModules* modules,
StackFrameSymbolizer* resolver_helper);
static void set_max_frames(u_int32_t max_frames) { max_frames_ = max_frames; }
static u_int32_t max_frames() { return max_frames_; }
static void set_max_frames(uint32_t max_frames) { max_frames_ = max_frames; }
static uint32_t max_frames() { return max_frames_; }
protected:
// system_info identifies the operating system, NULL or empty if unknown.
@ -104,7 +104,7 @@ class Stackwalker {
// * This address is within a loaded module for which we have symbols,
// and falls inside a function in that module.
// Returns false otherwise.
bool InstructionAddressSeemsValid(u_int64_t address);
bool InstructionAddressSeemsValid(uint64_t address);
// The default number of words to search through on the stack
// for a return address.
@ -185,7 +185,7 @@ class Stackwalker {
// The maximum number of frames Stackwalker will walk through.
// This defaults to 1024 to prevent infinite loops.
static u_int32_t max_frames_;
static uint32_t max_frames_;
};
} // namespace google_breakpad

View file

@ -63,7 +63,7 @@ class BasicCodeModule : public CodeModule {
debug_identifier_(that->debug_identifier()),
version_(that->version()) {}
BasicCodeModule(u_int64_t base_address, u_int64_t size,
BasicCodeModule(uint64_t base_address, uint64_t size,
const string &code_file,
const string &code_identifier,
const string &debug_file,
@ -81,8 +81,8 @@ class BasicCodeModule : public CodeModule {
// See code_module.h for descriptions of these methods and the associated
// members.
virtual u_int64_t base_address() const { return base_address_; }
virtual u_int64_t size() const { return size_; }
virtual uint64_t base_address() const { return base_address_; }
virtual uint64_t size() const { return size_; }
virtual string code_file() const { return code_file_; }
virtual string code_identifier() const { return code_identifier_; }
virtual string debug_file() const { return debug_file_; }
@ -91,8 +91,8 @@ class BasicCodeModule : public CodeModule {
virtual const CodeModule* Copy() const { return new BasicCodeModule(this); }
private:
u_int64_t base_address_;
u_int64_t size_;
uint64_t base_address_;
uint64_t size_;
string code_file_;
string code_identifier_;
string debug_file_;

View file

@ -47,7 +47,7 @@ namespace google_breakpad {
BasicCodeModules::BasicCodeModules(const CodeModules *that)
: main_address_(0),
map_(new RangeMap<u_int64_t, linked_ptr<const CodeModule> >()) {
map_(new RangeMap<uint64_t, linked_ptr<const CodeModule> >()) {
BPLOG_IF(ERROR, !that) << "BasicCodeModules::BasicCodeModules requires "
"|that|";
assert(that);
@ -82,7 +82,7 @@ unsigned int BasicCodeModules::module_count() const {
}
const CodeModule* BasicCodeModules::GetModuleForAddress(
u_int64_t address) const {
uint64_t address) const {
linked_ptr<const CodeModule> module;
if (!map_->RetrieveRange(address, &module, NULL, NULL)) {
BPLOG(INFO) << "No module at " << HexString(address);

View file

@ -61,7 +61,7 @@ class BasicCodeModules : public CodeModules {
// See code_modules.h for descriptions of these methods.
virtual unsigned int module_count() const;
virtual const CodeModule* GetModuleForAddress(u_int64_t address) const;
virtual const CodeModule* GetModuleForAddress(uint64_t address) const;
virtual const CodeModule* GetMainModule() const;
virtual const CodeModule* GetModuleAtSequence(unsigned int sequence) const;
virtual const CodeModule* GetModuleAtIndex(unsigned int index) const;
@ -69,11 +69,11 @@ class BasicCodeModules : public CodeModules {
private:
// The base address of the main module.
u_int64_t main_address_;
uint64_t main_address_;
// The map used to contain each CodeModule, keyed by each CodeModule's
// address range.
RangeMap<u_int64_t, linked_ptr<const CodeModule> > *map_;
RangeMap<uint64_t, linked_ptr<const CodeModule> > *map_;
// Disallow copy constructor and assignment operator.
BasicCodeModules(const BasicCodeModules &that);

View file

@ -299,8 +299,8 @@ BasicSourceLineResolver::Module::ParseFunction(char *function_line) {
return NULL;
}
u_int64_t address = strtoull(tokens[0], NULL, 16);
u_int64_t size = strtoull(tokens[1], NULL, 16);
uint64_t address = strtoull(tokens[0], NULL, 16);
uint64_t size = strtoull(tokens[1], NULL, 16);
int stack_param_size = strtoull(tokens[2], NULL, 16);
char *name = tokens[3];
@ -315,8 +315,8 @@ BasicSourceLineResolver::Line* BasicSourceLineResolver::Module::ParseLine(
return NULL;
}
u_int64_t address = strtoull(tokens[0], NULL, 16);
u_int64_t size = strtoull(tokens[1], NULL, 16);
uint64_t address = strtoull(tokens[0], NULL, 16);
uint64_t size = strtoull(tokens[1], NULL, 16);
int line_number = atoi(tokens[2]);
int source_file = atoi(tokens[3]);
if (line_number <= 0) {
@ -337,7 +337,7 @@ bool BasicSourceLineResolver::Module::ParsePublicSymbol(char *public_line) {
return false;
}
u_int64_t address = strtoull(tokens[0], NULL, 16);
uint64_t address = strtoull(tokens[0], NULL, 16);
int stack_param_size = strtoull(tokens[1], NULL, 16);
char *name = tokens[2];
@ -372,7 +372,7 @@ bool BasicSourceLineResolver::Module::ParseStackInfo(char *stack_info_line) {
// MSVC stack frame info.
if (strcmp(platform, "WIN") == 0) {
int type = 0;
u_int64_t rva, code_size;
uint64_t rva, code_size;
linked_ptr<WindowsFrameInfo>
stack_frame_info(WindowsFrameInfo::ParseFromString(stack_info_line,
type,

View file

@ -59,8 +59,8 @@ class TestCodeModule : public CodeModule {
TestCodeModule(string code_file) : code_file_(code_file) {}
virtual ~TestCodeModule() {}
virtual u_int64_t base_address() const { return 0; }
virtual u_int64_t size() const { return 0xb000; }
virtual uint64_t base_address() const { return 0; }
virtual uint64_t size() const { return 0xb000; }
virtual string code_file() const { return code_file_; }
virtual string code_identifier() const { return ""; }
virtual string debug_file() const { return ""; }
@ -76,17 +76,17 @@ class TestCodeModule : public CodeModule {
// A mock memory region object, for use by the STACK CFI tests.
class MockMemoryRegion: public MemoryRegion {
u_int64_t GetBase() const { return 0x10000; }
u_int32_t GetSize() const { return 0x01000; }
bool GetMemoryAtAddress(u_int64_t address, u_int8_t *value) const {
uint64_t GetBase() const { return 0x10000; }
uint32_t GetSize() const { return 0x01000; }
bool GetMemoryAtAddress(uint64_t address, uint8_t *value) const {
*value = address & 0xff;
return true;
}
bool GetMemoryAtAddress(u_int64_t address, u_int16_t *value) const {
bool GetMemoryAtAddress(uint64_t address, uint16_t *value) const {
*value = address & 0xffff;
return true;
}
bool GetMemoryAtAddress(u_int64_t address, u_int32_t *value) const {
bool GetMemoryAtAddress(uint64_t address, uint32_t *value) const {
switch (address) {
case 0x10008: *value = 0x98ecadc3; break; // saved %ebx
case 0x1000c: *value = 0x878f7524; break; // saved %esi
@ -97,7 +97,7 @@ class MockMemoryRegion: public MemoryRegion {
}
return true;
}
bool GetMemoryAtAddress(u_int64_t address, u_int64_t *value) const {
bool GetMemoryAtAddress(uint64_t address, uint64_t *value) const {
*value = address;
return true;
}
@ -109,9 +109,9 @@ class MockMemoryRegion: public MemoryRegion {
// ".cfa".
static bool VerifyRegisters(
const char *file, int line,
const CFIFrameInfo::RegisterValueMap<u_int32_t> &expected,
const CFIFrameInfo::RegisterValueMap<u_int32_t> &actual) {
CFIFrameInfo::RegisterValueMap<u_int32_t>::const_iterator a;
const CFIFrameInfo::RegisterValueMap<uint32_t> &expected,
const CFIFrameInfo::RegisterValueMap<uint32_t> &actual) {
CFIFrameInfo::RegisterValueMap<uint32_t>::const_iterator a;
a = actual.find(".cfa");
if (a == actual.end())
return false;
@ -119,7 +119,7 @@ static bool VerifyRegisters(
if (a == actual.end())
return false;
for (a = actual.begin(); a != actual.end(); a++) {
CFIFrameInfo::RegisterValueMap<u_int32_t>::const_iterator e =
CFIFrameInfo::RegisterValueMap<uint32_t>::const_iterator e =
expected.find(a->first);
if (e == expected.end()) {
fprintf(stderr, "%s:%d: unexpected register '%s' recovered, value 0x%x\n",
@ -252,9 +252,9 @@ TEST_F(TestBasicSourceLineResolver, TestLoadAndResolve)
cfi_frame_info.reset(resolver.FindCFIFrameInfo(&frame));
ASSERT_FALSE(cfi_frame_info.get());
CFIFrameInfo::RegisterValueMap<u_int32_t> current_registers;
CFIFrameInfo::RegisterValueMap<u_int32_t> caller_registers;
CFIFrameInfo::RegisterValueMap<u_int32_t> expected_caller_registers;
CFIFrameInfo::RegisterValueMap<uint32_t> current_registers;
CFIFrameInfo::RegisterValueMap<uint32_t> caller_registers;
CFIFrameInfo::RegisterValueMap<uint32_t> expected_caller_registers;
MockMemoryRegion memory;
// Regardless of which instruction evaluation takes place at, it
@ -277,7 +277,7 @@ TEST_F(TestBasicSourceLineResolver, TestLoadAndResolve)
cfi_frame_info.reset(resolver.FindCFIFrameInfo(&frame));
ASSERT_TRUE(cfi_frame_info.get());
ASSERT_TRUE(cfi_frame_info.get()
->FindCallerRegs<u_int32_t>(current_registers, memory,
->FindCallerRegs<uint32_t>(current_registers, memory,
&caller_registers));
ASSERT_TRUE(VerifyRegisters(__FILE__, __LINE__,
expected_caller_registers, caller_registers));
@ -287,7 +287,7 @@ TEST_F(TestBasicSourceLineResolver, TestLoadAndResolve)
cfi_frame_info.reset(resolver.FindCFIFrameInfo(&frame));
ASSERT_TRUE(cfi_frame_info.get());
ASSERT_TRUE(cfi_frame_info.get()
->FindCallerRegs<u_int32_t>(current_registers, memory,
->FindCallerRegs<uint32_t>(current_registers, memory,
&caller_registers));
ASSERT_TRUE(VerifyRegisters(__FILE__, __LINE__,
expected_caller_registers, caller_registers));
@ -297,7 +297,7 @@ TEST_F(TestBasicSourceLineResolver, TestLoadAndResolve)
cfi_frame_info.reset(resolver.FindCFIFrameInfo(&frame));
ASSERT_TRUE(cfi_frame_info.get());
ASSERT_TRUE(cfi_frame_info.get()
->FindCallerRegs<u_int32_t>(current_registers, memory,
->FindCallerRegs<uint32_t>(current_registers, memory,
&caller_registers));
VerifyRegisters(__FILE__, __LINE__,
expected_caller_registers, caller_registers);
@ -307,7 +307,7 @@ TEST_F(TestBasicSourceLineResolver, TestLoadAndResolve)
cfi_frame_info.reset(resolver.FindCFIFrameInfo(&frame));
ASSERT_TRUE(cfi_frame_info.get());
ASSERT_TRUE(cfi_frame_info.get()
->FindCallerRegs<u_int32_t>(current_registers, memory,
->FindCallerRegs<uint32_t>(current_registers, memory,
&caller_registers));
VerifyRegisters(__FILE__, __LINE__,
expected_caller_registers, caller_registers);
@ -317,7 +317,7 @@ TEST_F(TestBasicSourceLineResolver, TestLoadAndResolve)
cfi_frame_info.reset(resolver.FindCFIFrameInfo(&frame));
ASSERT_TRUE(cfi_frame_info.get());
ASSERT_TRUE(cfi_frame_info.get()
->FindCallerRegs<u_int32_t>(current_registers, memory,
->FindCallerRegs<uint32_t>(current_registers, memory,
&caller_registers));
VerifyRegisters(__FILE__, __LINE__,
expected_caller_registers, caller_registers);
@ -327,7 +327,7 @@ TEST_F(TestBasicSourceLineResolver, TestLoadAndResolve)
cfi_frame_info.reset(resolver.FindCFIFrameInfo(&frame));
ASSERT_TRUE(cfi_frame_info.get());
ASSERT_TRUE(cfi_frame_info.get()
->FindCallerRegs<u_int32_t>(current_registers, memory,
->FindCallerRegs<uint32_t>(current_registers, memory,
&caller_registers));
VerifyRegisters(__FILE__, __LINE__,
expected_caller_registers, caller_registers);

View file

@ -40,7 +40,7 @@ namespace google_breakpad {
using std::vector;
binarystream &binarystream::operator>>(string &str) {
u_int16_t length;
uint16_t length;
*this >> length;
if (eof())
return *this;
@ -55,68 +55,68 @@ binarystream &binarystream::operator>>(string &str) {
return *this;
}
binarystream &binarystream::operator>>(u_int8_t &u8) {
binarystream &binarystream::operator>>(uint8_t &u8) {
stream_.read((char *)&u8, 1);
return *this;
}
binarystream &binarystream::operator>>(u_int16_t &u16) {
u_int16_t temp;
binarystream &binarystream::operator>>(uint16_t &u16) {
uint16_t temp;
stream_.read((char *)&temp, 2);
if (!eof())
u16 = ntohs(temp);
return *this;
}
binarystream &binarystream::operator>>(u_int32_t &u32) {
u_int32_t temp;
binarystream &binarystream::operator>>(uint32_t &u32) {
uint32_t temp;
stream_.read((char *)&temp, 4);
if (!eof())
u32 = ntohl(temp);
return *this;
}
binarystream &binarystream::operator>>(u_int64_t &u64) {
u_int32_t lower, upper;
binarystream &binarystream::operator>>(uint64_t &u64) {
uint32_t lower, upper;
*this >> lower >> upper;
if (!eof())
u64 = static_cast<u_int64_t>(lower) | (static_cast<u_int64_t>(upper) << 32);
u64 = static_cast<uint64_t>(lower) | (static_cast<uint64_t>(upper) << 32);
return *this;
}
binarystream &binarystream::operator<<(const string &str) {
if (str.length() > USHRT_MAX) {
// truncate to 16-bit length
*this << static_cast<u_int16_t>(USHRT_MAX);
*this << static_cast<uint16_t>(USHRT_MAX);
stream_.write(str.c_str(), USHRT_MAX);
} else {
*this << (u_int16_t)(str.length() & 0xFFFF);
*this << (uint16_t)(str.length() & 0xFFFF);
stream_.write(str.c_str(), str.length());
}
return *this;
}
binarystream &binarystream::operator<<(u_int8_t u8) {
binarystream &binarystream::operator<<(uint8_t u8) {
stream_.write((const char*)&u8, 1);
return *this;
}
binarystream &binarystream::operator<<(u_int16_t u16) {
binarystream &binarystream::operator<<(uint16_t u16) {
u16 = htons(u16);
stream_.write((const char*)&u16, 2);
return *this;
}
binarystream &binarystream::operator<<(u_int32_t u32) {
binarystream &binarystream::operator<<(uint32_t u32) {
u32 = htonl(u32);
stream_.write((const char*)&u32, 4);
return *this;
}
binarystream &binarystream::operator<<(u_int64_t u64) {
binarystream &binarystream::operator<<(uint64_t u64) {
// write 64-bit ints as two 32-bit ints, so we can byte-swap them easily
u_int32_t lower = static_cast<u_int32_t>(u64 & 0xFFFFFFFF);
u_int32_t upper = static_cast<u_int32_t>(u64 >> 32);
uint32_t lower = static_cast<uint32_t>(u64 & 0xFFFFFFFF);
uint32_t upper = static_cast<uint32_t>(u64 >> 32);
*this << lower << upper;
return *this;
}

View file

@ -56,17 +56,17 @@ class binarystream {
: stream_(string(str, size), which) {}
binarystream &operator>>(string &str);
binarystream &operator>>(u_int8_t &u8);
binarystream &operator>>(u_int16_t &u16);
binarystream &operator>>(u_int32_t &u32);
binarystream &operator>>(u_int64_t &u64);
binarystream &operator>>(uint8_t &u8);
binarystream &operator>>(uint16_t &u16);
binarystream &operator>>(uint32_t &u32);
binarystream &operator>>(uint64_t &u64);
// Note: strings are truncated at 65535 characters
binarystream &operator<<(const string &str);
binarystream &operator<<(u_int8_t u8);
binarystream &operator<<(u_int16_t u16);
binarystream &operator<<(u_int32_t u32);
binarystream &operator<<(u_int64_t u64);
binarystream &operator<<(uint8_t u8);
binarystream &operator<<(uint16_t u16);
binarystream &operator<<(uint32_t u32);
binarystream &operator<<(uint64_t u64);
// Forward a few methods directly from the stream object
bool eof() const { return stream_.eof(); }

View file

@ -47,14 +47,14 @@ protected:
};
TEST_F(BinaryStreamBasicTest, ReadU8) {
u_int8_t u8 = 0;
uint8_t u8 = 0;
ASSERT_FALSE(stream.eof());
stream >> u8;
ASSERT_TRUE(stream.eof());
EXPECT_EQ(0U, u8);
stream.rewind();
stream.clear();
stream << (u_int8_t)1;
stream << (uint8_t)1;
ASSERT_FALSE(stream.eof());
stream >> u8;
EXPECT_EQ(1, u8);
@ -62,14 +62,14 @@ TEST_F(BinaryStreamBasicTest, ReadU8) {
}
TEST_F(BinaryStreamBasicTest, ReadU16) {
u_int16_t u16 = 0;
uint16_t u16 = 0;
ASSERT_FALSE(stream.eof());
stream >> u16;
ASSERT_TRUE(stream.eof());
EXPECT_EQ(0U, u16);
stream.rewind();
stream.clear();
stream << (u_int16_t)1;
stream << (uint16_t)1;
ASSERT_FALSE(stream.eof());
stream >> u16;
EXPECT_EQ(1, u16);
@ -77,14 +77,14 @@ TEST_F(BinaryStreamBasicTest, ReadU16) {
}
TEST_F(BinaryStreamBasicTest, ReadU32) {
u_int32_t u32 = 0;
uint32_t u32 = 0;
ASSERT_FALSE(stream.eof());
stream >> u32;
ASSERT_TRUE(stream.eof());
EXPECT_EQ(0U, u32);
stream.rewind();
stream.clear();
stream << (u_int32_t)1;
stream << (uint32_t)1;
ASSERT_FALSE(stream.eof());
stream >> u32;
EXPECT_EQ(1U, u32);
@ -92,14 +92,14 @@ TEST_F(BinaryStreamBasicTest, ReadU32) {
}
TEST_F(BinaryStreamBasicTest, ReadU64) {
u_int64_t u64 = 0;
uint64_t u64 = 0;
ASSERT_FALSE(stream.eof());
stream >> u64;
ASSERT_TRUE(stream.eof());
EXPECT_EQ(0U, u64);
stream.rewind();
stream.clear();
stream << (u_int64_t)1;
stream << (uint64_t)1;
ASSERT_FALSE(stream.eof());
stream >> u64;
EXPECT_EQ(1U, u64);
@ -137,8 +137,8 @@ TEST_F(BinaryStreamBasicTest, ReadEmptyString) {
}
TEST_F(BinaryStreamBasicTest, ReadMultiU8) {
const u_int8_t ea = 0, eb = 100, ec = 200, ed = 0xFF;
u_int8_t a, b, c, d, e;
const uint8_t ea = 0, eb = 100, ec = 200, ed = 0xFF;
uint8_t a, b, c, d, e;
stream << ea << eb << ec << ed;
stream >> a >> b >> c >> d;
ASSERT_FALSE(stream.eof());
@ -167,8 +167,8 @@ TEST_F(BinaryStreamBasicTest, ReadMultiU8) {
}
TEST_F(BinaryStreamBasicTest, ReadMultiU16) {
const u_int16_t ea = 0, eb = 0x100, ec = 0x8000, ed = 0xFFFF;
u_int16_t a, b, c, d, e;
const uint16_t ea = 0, eb = 0x100, ec = 0x8000, ed = 0xFFFF;
uint16_t a, b, c, d, e;
stream << ea << eb << ec << ed;
stream >> a >> b >> c >> d;
ASSERT_FALSE(stream.eof());
@ -197,8 +197,8 @@ TEST_F(BinaryStreamBasicTest, ReadMultiU16) {
}
TEST_F(BinaryStreamBasicTest, ReadMultiU32) {
const u_int32_t ea = 0, eb = 0x10000, ec = 0x8000000, ed = 0xFFFFFFFF;
u_int32_t a, b, c, d, e;
const uint32_t ea = 0, eb = 0x10000, ec = 0x8000000, ed = 0xFFFFFFFF;
uint32_t a, b, c, d, e;
stream << ea << eb << ec << ed;
stream >> a >> b >> c >> d;
ASSERT_FALSE(stream.eof());
@ -227,9 +227,9 @@ TEST_F(BinaryStreamBasicTest, ReadMultiU32) {
}
TEST_F(BinaryStreamBasicTest, ReadMultiU64) {
const u_int64_t ea = 0, eb = 0x10000, ec = 0x100000000ULL,
const uint64_t ea = 0, eb = 0x10000, ec = 0x100000000ULL,
ed = 0xFFFFFFFFFFFFFFFFULL;
u_int64_t a, b, c, d, e;
uint64_t a, b, c, d, e;
stream << ea << eb << ec << ed;
stream >> a >> b >> c >> d;
ASSERT_FALSE(stream.eof());
@ -258,15 +258,15 @@ TEST_F(BinaryStreamBasicTest, ReadMultiU64) {
}
TEST_F(BinaryStreamBasicTest, ReadMixed) {
const u_int8_t e8 = 0x10;
const u_int16_t e16 = 0x2020;
const u_int32_t e32 = 0x30303030;
const u_int64_t e64 = 0x4040404040404040ULL;
const uint8_t e8 = 0x10;
const uint16_t e16 = 0x2020;
const uint32_t e32 = 0x30303030;
const uint64_t e64 = 0x4040404040404040ULL;
const string es = "test";
u_int8_t u8 = 0;
u_int16_t u16 = 0;
u_int32_t u32 = 0;
u_int64_t u64 = 0;
uint8_t u8 = 0;
uint16_t u16 = 0;
uint32_t u32 = 0;
uint64_t u64 = 0;
string s("test");
stream << e8 << e16 << e32 << e64 << es;
stream >> u8 >> u16 >> u32 >> u64 >> s;
@ -280,7 +280,7 @@ TEST_F(BinaryStreamBasicTest, ReadMixed) {
TEST_F(BinaryStreamBasicTest, ReadStringMissing) {
// ensure that reading a string where only the length is present fails
u_int16_t u16 = 8;
uint16_t u16 = 8;
stream << u16;
stream.rewind();
string s("");
@ -291,9 +291,9 @@ TEST_F(BinaryStreamBasicTest, ReadStringMissing) {
TEST_F(BinaryStreamBasicTest, ReadStringTruncated) {
// ensure that reading a string where not all the data is present fails
u_int16_t u16 = 8;
uint16_t u16 = 8;
stream << u16;
stream << (u_int8_t)'t' << (u_int8_t)'e' << (u_int8_t)'s' << (u_int8_t)'t';
stream << (uint8_t)'t' << (uint8_t)'e' << (uint8_t)'s' << (uint8_t)'t';
stream.rewind();
string s("");
stream >> s;
@ -303,7 +303,7 @@ TEST_F(BinaryStreamBasicTest, ReadStringTruncated) {
TEST_F(BinaryStreamBasicTest, StreamByteLength) {
// Test that the stream buffer contains the right amount of data
stream << (u_int8_t)0 << (u_int16_t)1 << (u_int32_t)2 << (u_int64_t)3
stream << (uint8_t)0 << (uint16_t)1 << (uint32_t)2 << (uint64_t)3
<< string("test");
string s = stream.str();
EXPECT_EQ(21U, s.length());
@ -313,8 +313,8 @@ TEST_F(BinaryStreamBasicTest, AppendStreamResultsByteLength) {
// Test that appending the str() results from two streams
// gives the right byte length
binarystream stream2;
stream << (u_int8_t)0 << (u_int16_t)1;
stream2 << (u_int32_t)0 << (u_int64_t)2
stream << (uint8_t)0 << (uint16_t)1;
stream2 << (uint32_t)0 << (uint64_t)2
<< string("test");
string s = stream.str();
string s2 = stream2.str();
@ -344,12 +344,12 @@ protected:
binarystream stream;
void SetUp() {
stream << (u_int8_t)1;
stream << (uint8_t)1;
}
};
TEST_F(BinaryStreamU8Test, ReadU16) {
u_int16_t u16 = 0;
uint16_t u16 = 0;
ASSERT_FALSE(stream.eof());
stream >> u16;
ASSERT_TRUE(stream.eof());
@ -357,7 +357,7 @@ TEST_F(BinaryStreamU8Test, ReadU16) {
}
TEST_F(BinaryStreamU8Test, ReadU32) {
u_int32_t u32 = 0;
uint32_t u32 = 0;
ASSERT_FALSE(stream.eof());
stream >> u32;
ASSERT_TRUE(stream.eof());
@ -365,7 +365,7 @@ TEST_F(BinaryStreamU8Test, ReadU32) {
}
TEST_F(BinaryStreamU8Test, ReadU64) {
u_int64_t u64 = 0;
uint64_t u64 = 0;
ASSERT_FALSE(stream.eof());
stream >> u64;
ASSERT_TRUE(stream.eof());
@ -384,7 +384,7 @@ TEST_F(BinaryStreamU8Test, ReadString) {
TEST(BinaryStreamTest, InitWithData) {
const char *data = "abcd";
binarystream stream(data);
u_int8_t a, b, c, d;
uint8_t a, b, c, d;
stream >> a >> b >> c >> d;
ASSERT_FALSE(stream.eof());
EXPECT_EQ('a', a);
@ -396,7 +396,7 @@ TEST(BinaryStreamTest, InitWithData) {
TEST(BinaryStreamTest, InitWithDataLeadingNull) {
const char *data = "\0abcd";
binarystream stream(data, 5);
u_int8_t z, a, b, c, d;
uint8_t z, a, b, c, d;
stream >> z >> a >> b >> c >> d;
ASSERT_FALSE(stream.eof());
EXPECT_EQ(0U, z);
@ -415,7 +415,7 @@ TEST(BinaryStreamTest, InitWithDataVector) {
data.push_back('e');
data.resize(4);
binarystream stream(&data[0], data.size());
u_int8_t a, b, c, d;
uint8_t a, b, c, d;
stream >> a >> b >> c >> d;
ASSERT_FALSE(stream.eof());
EXPECT_EQ('a', a);

View file

@ -88,14 +88,14 @@ bool CFIFrameInfo::FindCallerRegs(const RegisterValueMap<V> &registers,
}
// Explicit instantiations for 32-bit and 64-bit architectures.
template bool CFIFrameInfo::FindCallerRegs<u_int32_t>(
const RegisterValueMap<u_int32_t> &registers,
template bool CFIFrameInfo::FindCallerRegs<uint32_t>(
const RegisterValueMap<uint32_t> &registers,
const MemoryRegion &memory,
RegisterValueMap<u_int32_t> *caller_registers) const;
template bool CFIFrameInfo::FindCallerRegs<u_int64_t>(
const RegisterValueMap<u_int64_t> &registers,
RegisterValueMap<uint32_t> *caller_registers) const;
template bool CFIFrameInfo::FindCallerRegs<uint64_t>(
const RegisterValueMap<uint64_t> &registers,
const MemoryRegion &memory,
RegisterValueMap<u_int64_t> *caller_registers) const;
RegisterValueMap<uint64_t> *caller_registers) const;
string CFIFrameInfo::Serialize() const {
std::ostringstream stream;

View file

@ -80,8 +80,8 @@ class CFIFrameInfo {
// Compute the values of the calling frame's registers, according to
// this rule set. Use ValueType in expression evaluation; this
// should be u_int32_t on machines with 32-bit addresses, or
// u_int64_t on machines with 64-bit addresses.
// should be uint32_t on machines with 32-bit addresses, or
// uint64_t on machines with 64-bit addresses.
//
// Return true on success, false otherwise.
//
@ -204,7 +204,7 @@ class CFIFrameInfoParseHandler: public CFIRuleParser::Handler {
// up in a class should allow the walkers to share code.
//
// RegisterType should be the type of this architecture's registers, either
// u_int32_t or u_int64_t. RawContextType should be the raw context
// uint32_t or uint64_t. RawContextType should be the raw context
// structure type for this architecture.
template <typename RegisterType, class RawContextType>
class SimpleCFIWalker {

View file

@ -54,12 +54,12 @@ using testing::Test;
class MockMemoryRegion: public MemoryRegion {
public:
MOCK_CONST_METHOD0(GetBase, u_int64_t());
MOCK_CONST_METHOD0(GetSize, u_int32_t());
MOCK_CONST_METHOD2(GetMemoryAtAddress, bool(u_int64_t, u_int8_t *));
MOCK_CONST_METHOD2(GetMemoryAtAddress, bool(u_int64_t, u_int16_t *));
MOCK_CONST_METHOD2(GetMemoryAtAddress, bool(u_int64_t, u_int32_t *));
MOCK_CONST_METHOD2(GetMemoryAtAddress, bool(u_int64_t, u_int64_t *));
MOCK_CONST_METHOD0(GetBase, uint64_t());
MOCK_CONST_METHOD0(GetSize, uint32_t());
MOCK_CONST_METHOD2(GetMemoryAtAddress, bool(uint64_t, uint8_t *));
MOCK_CONST_METHOD2(GetMemoryAtAddress, bool(uint64_t, uint16_t *));
MOCK_CONST_METHOD2(GetMemoryAtAddress, bool(uint64_t, uint32_t *));
MOCK_CONST_METHOD2(GetMemoryAtAddress, bool(uint64_t, uint64_t *));
};
// Handy definitions for all tests.
@ -69,15 +69,15 @@ struct CFIFixture {
void ExpectNoMemoryReferences() {
EXPECT_CALL(memory, GetBase()).Times(0);
EXPECT_CALL(memory, GetSize()).Times(0);
EXPECT_CALL(memory, GetMemoryAtAddress(_, A<u_int8_t *>())).Times(0);
EXPECT_CALL(memory, GetMemoryAtAddress(_, A<u_int16_t *>())).Times(0);
EXPECT_CALL(memory, GetMemoryAtAddress(_, A<u_int32_t *>())).Times(0);
EXPECT_CALL(memory, GetMemoryAtAddress(_, A<u_int64_t *>())).Times(0);
EXPECT_CALL(memory, GetMemoryAtAddress(_, A<uint8_t *>())).Times(0);
EXPECT_CALL(memory, GetMemoryAtAddress(_, A<uint16_t *>())).Times(0);
EXPECT_CALL(memory, GetMemoryAtAddress(_, A<uint32_t *>())).Times(0);
EXPECT_CALL(memory, GetMemoryAtAddress(_, A<uint64_t *>())).Times(0);
}
CFIFrameInfo cfi;
MockMemoryRegion memory;
CFIFrameInfo::RegisterValueMap<u_int64_t> registers, caller_registers;
CFIFrameInfo::RegisterValueMap<uint64_t> registers, caller_registers;
};
class Simple: public CFIFixture, public Test { };
@ -87,7 +87,7 @@ TEST_F(Simple, NoCFA) {
ExpectNoMemoryReferences();
cfi.SetRARule("0");
ASSERT_FALSE(cfi.FindCallerRegs<u_int64_t>(registers, memory,
ASSERT_FALSE(cfi.FindCallerRegs<uint64_t>(registers, memory,
&caller_registers));
ASSERT_EQ(".ra: 0", cfi.Serialize());
}
@ -97,7 +97,7 @@ TEST_F(Simple, NoRA) {
ExpectNoMemoryReferences();
cfi.SetCFARule("0");
ASSERT_FALSE(cfi.FindCallerRegs<u_int64_t>(registers, memory,
ASSERT_FALSE(cfi.FindCallerRegs<uint64_t>(registers, memory,
&caller_registers));
ASSERT_EQ(".cfa: 0", cfi.Serialize());
}
@ -107,7 +107,7 @@ TEST_F(Simple, SetCFAAndRARule) {
cfi.SetCFARule("330903416631436410");
cfi.SetRARule("5870666104170902211");
ASSERT_TRUE(cfi.FindCallerRegs<u_int64_t>(registers, memory,
ASSERT_TRUE(cfi.FindCallerRegs<uint64_t>(registers, memory,
&caller_registers));
ASSERT_EQ(2U, caller_registers.size());
ASSERT_EQ(330903416631436410ULL, caller_registers[".cfa"]);
@ -126,7 +126,7 @@ TEST_F(Simple, SetManyRules) {
cfi.SetRegisterRule("vodkathumbscrewingly", "24076308 .cfa +");
cfi.SetRegisterRule("pubvexingfjordschmaltzy", ".cfa 29801007 -");
cfi.SetRegisterRule("uncopyrightables", "92642917 .cfa /");
ASSERT_TRUE(cfi.FindCallerRegs<u_int64_t>(registers, memory,
ASSERT_TRUE(cfi.FindCallerRegs<uint64_t>(registers, memory,
&caller_registers));
ASSERT_EQ(6U, caller_registers.size());
ASSERT_EQ(7664691U, caller_registers[".cfa"]);
@ -150,7 +150,7 @@ TEST_F(Simple, RulesOverride) {
cfi.SetCFARule("330903416631436410");
cfi.SetRARule("5870666104170902211");
cfi.SetCFARule("2828089117179001");
ASSERT_TRUE(cfi.FindCallerRegs<u_int64_t>(registers, memory,
ASSERT_TRUE(cfi.FindCallerRegs<uint64_t>(registers, memory,
&caller_registers));
ASSERT_EQ(2U, caller_registers.size());
ASSERT_EQ(2828089117179001ULL, caller_registers[".cfa"]);
@ -167,7 +167,7 @@ TEST_F(Scope, CFALacksCFA) {
cfi.SetCFARule(".cfa");
cfi.SetRARule("0");
ASSERT_FALSE(cfi.FindCallerRegs<u_int64_t>(registers, memory,
ASSERT_FALSE(cfi.FindCallerRegs<uint64_t>(registers, memory,
&caller_registers));
}
@ -177,7 +177,7 @@ TEST_F(Scope, CFALacksRA) {
cfi.SetCFARule(".ra");
cfi.SetRARule("0");
ASSERT_FALSE(cfi.FindCallerRegs<u_int64_t>(registers, memory,
ASSERT_FALSE(cfi.FindCallerRegs<uint64_t>(registers, memory,
&caller_registers));
}
@ -190,7 +190,7 @@ TEST_F(Scope, CFASeesCurrentRegs) {
registers[".ornithorhynchus"] = 0x5e0bf850bafce9d2ULL;
cfi.SetCFARule(".baraminology .ornithorhynchus +");
cfi.SetRARule("0");
ASSERT_TRUE(cfi.FindCallerRegs<u_int64_t>(registers, memory,
ASSERT_TRUE(cfi.FindCallerRegs<uint64_t>(registers, memory,
&caller_registers));
ASSERT_EQ(2U, caller_registers.size());
ASSERT_EQ(0x06a7bc63e4f13893ULL + 0x5e0bf850bafce9d2ULL,
@ -203,7 +203,7 @@ TEST_F(Scope, RASeesCFA) {
cfi.SetCFARule("48364076");
cfi.SetRARule(".cfa");
ASSERT_TRUE(cfi.FindCallerRegs<u_int64_t>(registers, memory,
ASSERT_TRUE(cfi.FindCallerRegs<uint64_t>(registers, memory,
&caller_registers));
ASSERT_EQ(2U, caller_registers.size());
ASSERT_EQ(48364076U, caller_registers[".ra"]);
@ -215,7 +215,7 @@ TEST_F(Scope, RALacksRA) {
cfi.SetCFARule("0");
cfi.SetRARule(".ra");
ASSERT_FALSE(cfi.FindCallerRegs<u_int64_t>(registers, memory,
ASSERT_FALSE(cfi.FindCallerRegs<uint64_t>(registers, memory,
&caller_registers));
}
@ -227,7 +227,7 @@ TEST_F(Scope, RASeesCurrentRegs) {
registers["noachian"] = 0x54dc4a5d8e5eb503ULL;
cfi.SetCFARule("10359370");
cfi.SetRARule("noachian");
ASSERT_TRUE(cfi.FindCallerRegs<u_int64_t>(registers, memory,
ASSERT_TRUE(cfi.FindCallerRegs<uint64_t>(registers, memory,
&caller_registers));
ASSERT_EQ(2U, caller_registers.size());
ASSERT_EQ(0x54dc4a5d8e5eb503ULL, caller_registers[".ra"]);
@ -240,7 +240,7 @@ TEST_F(Scope, RegistersSeeCFA) {
cfi.SetCFARule("6515179");
cfi.SetRARule(".cfa");
cfi.SetRegisterRule("rogerian", ".cfa");
ASSERT_TRUE(cfi.FindCallerRegs<u_int64_t>(registers, memory,
ASSERT_TRUE(cfi.FindCallerRegs<uint64_t>(registers, memory,
&caller_registers));
ASSERT_EQ(3U, caller_registers.size());
ASSERT_EQ(6515179U, caller_registers["rogerian"]);
@ -253,7 +253,7 @@ TEST_F(Scope, RegsLackRA) {
cfi.SetCFARule("42740329");
cfi.SetRARule("27045204");
cfi.SetRegisterRule("$r1", ".ra");
ASSERT_FALSE(cfi.FindCallerRegs<u_int64_t>(registers, memory,
ASSERT_FALSE(cfi.FindCallerRegs<uint64_t>(registers, memory,
&caller_registers));
}
@ -267,7 +267,7 @@ TEST_F(Scope, RegsSeeRegs) {
cfi.SetRARule("30503835");
cfi.SetRegisterRule("$r1", "$r1 42175211 = $r2");
cfi.SetRegisterRule("$r2", "$r2 21357221 = $r1");
ASSERT_TRUE(cfi.FindCallerRegs<u_int64_t>(registers, memory,
ASSERT_TRUE(cfi.FindCallerRegs<uint64_t>(registers, memory,
&caller_registers));
ASSERT_EQ(4U, caller_registers.size());
ASSERT_EQ(0xd27d9e742b8df6d0ULL, caller_registers["$r1"]);
@ -280,12 +280,12 @@ TEST_F(Scope, SeparateTempsRA) {
cfi.SetCFARule("$temp1 76569129 = $temp1");
cfi.SetRARule("0");
ASSERT_TRUE(cfi.FindCallerRegs<u_int64_t>(registers, memory,
ASSERT_TRUE(cfi.FindCallerRegs<uint64_t>(registers, memory,
&caller_registers));
cfi.SetCFARule("$temp1 76569129 = $temp1");
cfi.SetRARule("$temp1");
ASSERT_FALSE(cfi.FindCallerRegs<u_int64_t>(registers, memory,
ASSERT_FALSE(cfi.FindCallerRegs<uint64_t>(registers, memory,
&caller_registers));
}
@ -427,7 +427,7 @@ TEST_F(ParseHandler, CFARARule) {
handler.RARule("reg-for-ra");
registers["reg-for-cfa"] = 0x268a9a4a3821a797ULL;
registers["reg-for-ra"] = 0x6301b475b8b91c02ULL;
ASSERT_TRUE(cfi.FindCallerRegs<u_int64_t>(registers, memory,
ASSERT_TRUE(cfi.FindCallerRegs<uint64_t>(registers, memory,
&caller_registers));
ASSERT_EQ(0x268a9a4a3821a797ULL, caller_registers[".cfa"]);
ASSERT_EQ(0x6301b475b8b91c02ULL, caller_registers[".ra"]);
@ -442,7 +442,7 @@ TEST_F(ParseHandler, RegisterRules) {
registers["reg-for-ra"] = 0x6301b475b8b91c02ULL;
registers["reg-for-reg1"] = 0x06cde8e2ff062481ULL;
registers["reg-for-reg2"] = 0xff0c4f76403173e2ULL;
ASSERT_TRUE(cfi.FindCallerRegs<u_int64_t>(registers, memory,
ASSERT_TRUE(cfi.FindCallerRegs<uint64_t>(registers, memory,
&caller_registers));
ASSERT_EQ(0x268a9a4a3821a797ULL, caller_registers[".cfa"]);
ASSERT_EQ(0x6301b475b8b91c02ULL, caller_registers[".ra"]);
@ -452,7 +452,7 @@ TEST_F(ParseHandler, RegisterRules) {
struct SimpleCFIWalkerFixture {
struct RawContext {
u_int64_t r0, r1, r2, r3, r4, sp, pc;
uint64_t r0, r1, r2, r3, r4, sp, pc;
};
enum Validity {
R0_VALID = 0x01,
@ -463,7 +463,7 @@ struct SimpleCFIWalkerFixture {
SP_VALID = 0x20,
PC_VALID = 0x40
};
typedef SimpleCFIWalker<u_int64_t, RawContext> CFIWalker;
typedef SimpleCFIWalker<uint64_t, RawContext> CFIWalker;
SimpleCFIWalkerFixture()
: walker(register_map,
@ -504,16 +504,16 @@ TEST_F(SimpleWalker, Walk) {
// r4 is not recoverable, even though it is a callee-saves register.
// Some earlier frame's unwinder must have failed to recover it.
u_int64_t stack_top = 0x83254944b20d5512ULL;
uint64_t stack_top = 0x83254944b20d5512ULL;
// Saved r0.
EXPECT_CALL(memory,
GetMemoryAtAddress(stack_top, A<u_int64_t *>()))
GetMemoryAtAddress(stack_top, A<uint64_t *>()))
.WillRepeatedly(DoAll(SetArgumentPointee<1>(0xdc1975eba8602302ULL),
Return(true)));
// Saved return address.
EXPECT_CALL(memory,
GetMemoryAtAddress(stack_top + 16, A<u_int64_t *>()))
GetMemoryAtAddress(stack_top + 16, A<uint64_t *>()))
.WillRepeatedly(DoAll(SetArgumentPointee<1>(0xba5ad6d9acce28deULL),
Return(true)));

View file

@ -31,9 +31,9 @@
namespace google_breakpad {
DisassemblerX86::DisassemblerX86(const u_int8_t *bytecode,
u_int32_t size,
u_int32_t virtual_address) :
DisassemblerX86::DisassemblerX86(const uint8_t *bytecode,
uint32_t size,
uint32_t virtual_address) :
bytecode_(bytecode),
size_(size),
virtual_address_(virtual_address),
@ -54,7 +54,7 @@ DisassemblerX86::~DisassemblerX86() {
libdis::x86_cleanup();
}
u_int32_t DisassemblerX86::NextInstruction() {
uint32_t DisassemblerX86::NextInstruction() {
if (instr_valid_)
libdis::x86_oplist_free(&current_instr_);
@ -62,7 +62,7 @@ u_int32_t DisassemblerX86::NextInstruction() {
instr_valid_ = false;
return 0;
}
u_int32_t instr_size = 0;
uint32_t instr_size = 0;
instr_size = libdis::x86_disasm((unsigned char *)bytecode_, size_,
virtual_address_, current_byte_offset_,
&current_instr_);

View file

@ -37,6 +37,7 @@
#define GOOGLE_BREAKPAD_PROCESSOR_DISASSEMBLER_X86_H_
#include <stddef.h>
#include <sys/types.h>
#include "google_breakpad/common/breakpad_types.h"
@ -62,7 +63,7 @@ class DisassemblerX86 {
// TODO(cdn): Modify this class to take a MemoryRegion instead of just
// a raw buffer. This will make it easier to use this on arbitrary
// minidumps without first copying out the code segment.
DisassemblerX86(const u_int8_t *bytecode, u_int32_t, u_int32_t);
DisassemblerX86(const uint8_t *bytecode, uint32_t, uint32_t);
~DisassemblerX86();
// This walks to the next instruction in the memory region and
@ -70,7 +71,7 @@ class DisassemblerX86 {
// including any registers marked as bad through setBadRead()
// or setBadWrite(). This method can be called in a loop to
// disassemble until the end of a region.
u_int32_t NextInstruction();
uint32_t NextInstruction();
// Indicates whether the current disassembled instruction was valid.
bool currentInstructionValid() { return instr_valid_; }
@ -90,7 +91,7 @@ class DisassemblerX86 {
bool endOfBlock() { return end_of_block_; }
// The flags set so far for the disassembly.
u_int16_t flags() { return flags_; }
uint16_t flags() { return flags_; }
// This sets an indicator that the register used to determine
// src or dest for the current instruction is tainted. These can
@ -101,11 +102,11 @@ class DisassemblerX86 {
bool setBadWrite();
protected:
const u_int8_t *bytecode_;
u_int32_t size_;
u_int32_t virtual_address_;
u_int32_t current_byte_offset_;
u_int32_t current_inst_offset_;
const uint8_t *bytecode_;
uint32_t size_;
uint32_t virtual_address_;
uint32_t current_byte_offset_;
uint32_t current_inst_offset_;
bool instr_valid_;
libdis::x86_insn_t current_instr_;
@ -118,7 +119,7 @@ class DisassemblerX86 {
bool pushed_bad_value_;
bool end_of_block_;
u_int16_t flags_;
uint16_t flags_;
};
} // namespace google_breakpad

View file

@ -92,9 +92,9 @@ Exploitability *Exploitability::ExploitabilityForPlatform(
return platform_exploitability;
}
bool Exploitability::AddressIsAscii(u_int64_t address) {
bool Exploitability::AddressIsAscii(uint64_t address) {
for (int i = 0; i < 8; i++) {
u_int8_t byte = (address >> (8*i)) & 0xff;
uint8_t byte = (address >> (8*i)) & 0xff;
if ((byte >= ' ' && byte <= '~') || byte == 0)
continue;
return false;

View file

@ -50,8 +50,8 @@ namespace google_breakpad {
// The cutoff that we use to judge if and address is likely an offset
// from various interesting addresses.
static const u_int64_t kProbableNullOffset = 4096;
static const u_int64_t kProbableStackOffset = 8192;
static const uint64_t kProbableNullOffset = 4096;
static const uint64_t kProbableStackOffset = 8192;
// The various cutoffs for the different ratings.
static const size_t kHighCutoff = 100;
@ -98,14 +98,14 @@ ExploitabilityRating ExploitabilityWin::CheckPlatformExploitability() {
BPLOG(INFO) << "Minidump memory segments not available.";
memory_available = false;
}
u_int64_t address = process_state_->crash_address();
u_int32_t exception_code = raw_exception->exception_record.exception_code;
uint64_t address = process_state_->crash_address();
uint32_t exception_code = raw_exception->exception_record.exception_code;
u_int32_t exploitability_weight = 0;
uint32_t exploitability_weight = 0;
u_int64_t stack_ptr = 0;
u_int64_t instruction_ptr = 0;
u_int64_t this_ptr = 0;
uint64_t stack_ptr = 0;
uint64_t instruction_ptr = 0;
uint64_t this_ptr = 0;
switch (context->GetContextCPU()) {
case MD_CONTEXT_X86:
@ -211,14 +211,14 @@ ExploitabilityRating ExploitabilityWin::CheckPlatformExploitability() {
context->GetContextCPU() == MD_CONTEXT_X86 &&
(bad_read || bad_write)) {
// Perform checks related to memory around instruction pointer.
u_int32_t memory_offset =
uint32_t memory_offset =
instruction_ptr - instruction_region->GetBase();
u_int32_t available_memory =
uint32_t available_memory =
instruction_region->GetSize() - memory_offset;
available_memory = available_memory > kDisassembleBytesBeyondPC ?
kDisassembleBytesBeyondPC : available_memory;
if (available_memory) {
const u_int8_t *raw_memory =
const uint8_t *raw_memory =
instruction_region->GetMemory() + memory_offset;
DisassemblerX86 disassembler(raw_memory,
available_memory,

View file

@ -116,15 +116,15 @@ WindowsFrameInfo FastSourceLineResolver::CopyWFI(const char *raw) {
// The first 8 bytes of int data are unused.
// They correspond to "StackInfoTypes type_;" and "int valid;"
// data member of WFI.
const u_int32_t *para_uint32 = reinterpret_cast<const u_int32_t*>(
const uint32_t *para_uint32 = reinterpret_cast<const uint32_t*>(
raw + 2 * sizeof(int32_t));
u_int32_t prolog_size = para_uint32[0];;
u_int32_t epilog_size = para_uint32[1];
u_int32_t parameter_size = para_uint32[2];
u_int32_t saved_register_size = para_uint32[3];
u_int32_t local_size = para_uint32[4];
u_int32_t max_stack_size = para_uint32[5];
uint32_t prolog_size = para_uint32[0];;
uint32_t epilog_size = para_uint32[1];
uint32_t parameter_size = para_uint32[2];
uint32_t saved_register_size = para_uint32[3];
uint32_t local_size = para_uint32[4];
uint32_t max_stack_size = para_uint32[5];
const char *boolean = reinterpret_cast<const char*>(para_uint32 + 6);
bool allocates_base_pointer = (*boolean != 0);
string program_string = boolean + 1;
@ -146,7 +146,7 @@ WindowsFrameInfo FastSourceLineResolver::CopyWFI(const char *raw) {
bool FastSourceLineResolver::Module::LoadMapFromMemory(char *mem_buffer) {
if (!mem_buffer) return false;
const u_int32_t *map_sizes = reinterpret_cast<const u_int32_t*>(mem_buffer);
const uint32_t *map_sizes = reinterpret_cast<const uint32_t*>(mem_buffer);
unsigned int header_size = kNumberMaps_ * sizeof(unsigned int);

View file

@ -71,8 +71,8 @@ class TestCodeModule : public CodeModule {
explicit TestCodeModule(string code_file) : code_file_(code_file) {}
virtual ~TestCodeModule() {}
virtual u_int64_t base_address() const { return 0; }
virtual u_int64_t size() const { return 0xb000; }
virtual uint64_t base_address() const { return 0; }
virtual uint64_t size() const { return 0xb000; }
virtual string code_file() const { return code_file_; }
virtual string code_identifier() const { return ""; }
virtual string debug_file() const { return ""; }
@ -88,17 +88,17 @@ class TestCodeModule : public CodeModule {
// A mock memory region object, for use by the STACK CFI tests.
class MockMemoryRegion: public MemoryRegion {
u_int64_t GetBase() const { return 0x10000; }
u_int32_t GetSize() const { return 0x01000; }
bool GetMemoryAtAddress(u_int64_t address, u_int8_t *value) const {
uint64_t GetBase() const { return 0x10000; }
uint32_t GetSize() const { return 0x01000; }
bool GetMemoryAtAddress(uint64_t address, uint8_t *value) const {
*value = address & 0xff;
return true;
}
bool GetMemoryAtAddress(u_int64_t address, u_int16_t *value) const {
bool GetMemoryAtAddress(uint64_t address, uint16_t *value) const {
*value = address & 0xffff;
return true;
}
bool GetMemoryAtAddress(u_int64_t address, u_int32_t *value) const {
bool GetMemoryAtAddress(uint64_t address, uint32_t *value) const {
switch (address) {
case 0x10008: *value = 0x98ecadc3; break; // saved %ebx
case 0x1000c: *value = 0x878f7524; break; // saved %esi
@ -109,7 +109,7 @@ class MockMemoryRegion: public MemoryRegion {
}
return true;
}
bool GetMemoryAtAddress(u_int64_t address, u_int64_t *value) const {
bool GetMemoryAtAddress(uint64_t address, uint64_t *value) const {
*value = address;
return true;
}
@ -121,9 +121,9 @@ class MockMemoryRegion: public MemoryRegion {
// ".cfa".
static bool VerifyRegisters(
const char *file, int line,
const CFIFrameInfo::RegisterValueMap<u_int32_t> &expected,
const CFIFrameInfo::RegisterValueMap<u_int32_t> &actual) {
CFIFrameInfo::RegisterValueMap<u_int32_t>::const_iterator a;
const CFIFrameInfo::RegisterValueMap<uint32_t> &expected,
const CFIFrameInfo::RegisterValueMap<uint32_t> &actual) {
CFIFrameInfo::RegisterValueMap<uint32_t>::const_iterator a;
a = actual.find(".cfa");
if (a == actual.end())
return false;
@ -131,7 +131,7 @@ static bool VerifyRegisters(
if (a == actual.end())
return false;
for (a = actual.begin(); a != actual.end(); a++) {
CFIFrameInfo::RegisterValueMap<u_int32_t>::const_iterator e =
CFIFrameInfo::RegisterValueMap<uint32_t>::const_iterator e =
expected.find(a->first);
if (e == expected.end()) {
fprintf(stderr, "%s:%d: unexpected register '%s' recovered, value 0x%x\n",
@ -280,9 +280,9 @@ TEST_F(TestFastSourceLineResolver, TestLoadAndResolve) {
cfi_frame_info.reset(fast_resolver.FindCFIFrameInfo(&frame));
ASSERT_FALSE(cfi_frame_info.get());
CFIFrameInfo::RegisterValueMap<u_int32_t> current_registers;
CFIFrameInfo::RegisterValueMap<u_int32_t> caller_registers;
CFIFrameInfo::RegisterValueMap<u_int32_t> expected_caller_registers;
CFIFrameInfo::RegisterValueMap<uint32_t> current_registers;
CFIFrameInfo::RegisterValueMap<uint32_t> caller_registers;
CFIFrameInfo::RegisterValueMap<uint32_t> expected_caller_registers;
MockMemoryRegion memory;
// Regardless of which instruction evaluation takes place at, it
@ -305,7 +305,7 @@ TEST_F(TestFastSourceLineResolver, TestLoadAndResolve) {
cfi_frame_info.reset(fast_resolver.FindCFIFrameInfo(&frame));
ASSERT_TRUE(cfi_frame_info.get());
ASSERT_TRUE(cfi_frame_info.get()
->FindCallerRegs<u_int32_t>(current_registers, memory,
->FindCallerRegs<uint32_t>(current_registers, memory,
&caller_registers));
ASSERT_TRUE(VerifyRegisters(__FILE__, __LINE__,
expected_caller_registers, caller_registers));
@ -315,7 +315,7 @@ TEST_F(TestFastSourceLineResolver, TestLoadAndResolve) {
cfi_frame_info.reset(fast_resolver.FindCFIFrameInfo(&frame));
ASSERT_TRUE(cfi_frame_info.get());
ASSERT_TRUE(cfi_frame_info.get()
->FindCallerRegs<u_int32_t>(current_registers, memory,
->FindCallerRegs<uint32_t>(current_registers, memory,
&caller_registers));
ASSERT_TRUE(VerifyRegisters(__FILE__, __LINE__,
expected_caller_registers, caller_registers));
@ -325,7 +325,7 @@ TEST_F(TestFastSourceLineResolver, TestLoadAndResolve) {
cfi_frame_info.reset(fast_resolver.FindCFIFrameInfo(&frame));
ASSERT_TRUE(cfi_frame_info.get());
ASSERT_TRUE(cfi_frame_info.get()
->FindCallerRegs<u_int32_t>(current_registers, memory,
->FindCallerRegs<uint32_t>(current_registers, memory,
&caller_registers));
VerifyRegisters(__FILE__, __LINE__,
expected_caller_registers, caller_registers);
@ -335,7 +335,7 @@ TEST_F(TestFastSourceLineResolver, TestLoadAndResolve) {
cfi_frame_info.reset(fast_resolver.FindCFIFrameInfo(&frame));
ASSERT_TRUE(cfi_frame_info.get());
ASSERT_TRUE(cfi_frame_info.get()
->FindCallerRegs<u_int32_t>(current_registers, memory,
->FindCallerRegs<uint32_t>(current_registers, memory,
&caller_registers));
VerifyRegisters(__FILE__, __LINE__,
expected_caller_registers, caller_registers);
@ -345,7 +345,7 @@ TEST_F(TestFastSourceLineResolver, TestLoadAndResolve) {
cfi_frame_info.reset(fast_resolver.FindCFIFrameInfo(&frame));
ASSERT_TRUE(cfi_frame_info.get());
ASSERT_TRUE(cfi_frame_info.get()
->FindCallerRegs<u_int32_t>(current_registers, memory,
->FindCallerRegs<uint32_t>(current_registers, memory,
&caller_registers));
VerifyRegisters(__FILE__, __LINE__,
expected_caller_registers, caller_registers);
@ -355,7 +355,7 @@ TEST_F(TestFastSourceLineResolver, TestLoadAndResolve) {
cfi_frame_info.reset(fast_resolver.FindCFIFrameInfo(&frame));
ASSERT_TRUE(cfi_frame_info.get());
ASSERT_TRUE(cfi_frame_info.get()
->FindCallerRegs<u_int32_t>(current_registers, memory,
->FindCallerRegs<uint32_t>(current_registers, memory,
&caller_registers));
VerifyRegisters(__FILE__, __LINE__,
expected_caller_registers, caller_registers);

View file

@ -83,13 +83,13 @@ LogStream::~LogStream() {
stream_ << std::endl;
}
string HexString(u_int32_t number) {
string HexString(uint32_t number) {
char buffer[11];
snprintf(buffer, sizeof(buffer), "0x%x", number);
return string(buffer);
}
string HexString(u_int64_t number) {
string HexString(uint64_t number) {
char buffer[19];
snprintf(buffer, sizeof(buffer), "0x%" PRIx64, number);
return string(buffer);

View file

@ -119,8 +119,8 @@ class LogMessageVoidify {
};
// Returns number formatted as a hexadecimal string, such as "0x7b".
string HexString(u_int32_t number);
string HexString(u_int64_t number);
string HexString(uint32_t number);
string HexString(uint64_t number);
string HexString(int number);
// Returns the error code as set in the global errno variable, and sets

View file

@ -55,7 +55,7 @@ template<typename Key, typename Value>
size_t StdMapSerializer<Key, Value>::SizeOf(
const std::map<Key, Value> &m) const {
size_t size = 0;
size_t header_size = (1 + m.size()) * sizeof(u_int32_t);
size_t header_size = (1 + m.size()) * sizeof(uint32_t);
size += header_size;
typename std::map<Key, Value>::const_iterator iter;
@ -77,10 +77,10 @@ char *StdMapSerializer<Key, Value>::Write(const std::map<Key, Value> &m,
// Write header:
// Number of nodes.
dest = SimpleSerializer<u_int32_t>::Write(m.size(), dest);
dest = SimpleSerializer<uint32_t>::Write(m.size(), dest);
// Nodes offsets.
u_int32_t *offsets = reinterpret_cast<u_int32_t*>(dest);
dest += sizeof(u_int32_t) * m.size();
uint32_t *offsets = reinterpret_cast<uint32_t*>(dest);
dest += sizeof(uint32_t) * m.size();
char *key_address = dest;
dest += sizeof(Key) * m.size();
@ -89,7 +89,7 @@ char *StdMapSerializer<Key, Value>::Write(const std::map<Key, Value> &m,
typename std::map<Key, Value>::const_iterator iter;
int index = 0;
for (iter = m.begin(); iter != m.end(); ++iter, ++index) {
offsets[index] = static_cast<u_int32_t>(dest - start_address);
offsets[index] = static_cast<uint32_t>(dest - start_address);
key_address = key_serializer_.Write(iter->first, key_address);
dest = value_serializer_.Write(iter->second, dest);
}
@ -119,7 +119,7 @@ template<typename Address, typename Entry>
size_t RangeMapSerializer<Address, Entry>::SizeOf(
const RangeMap<Address, Entry> &m) const {
size_t size = 0;
size_t header_size = (1 + m.map_.size()) * sizeof(u_int32_t);
size_t header_size = (1 + m.map_.size()) * sizeof(uint32_t);
size += header_size;
typename std::map<Address, Range>::const_iterator iter;
@ -145,10 +145,10 @@ char *RangeMapSerializer<Address, Entry>::Write(
// Write header:
// Number of nodes.
dest = SimpleSerializer<u_int32_t>::Write(m.map_.size(), dest);
dest = SimpleSerializer<uint32_t>::Write(m.map_.size(), dest);
// Nodes offsets.
u_int32_t *offsets = reinterpret_cast<u_int32_t*>(dest);
dest += sizeof(u_int32_t) * m.map_.size();
uint32_t *offsets = reinterpret_cast<uint32_t*>(dest);
dest += sizeof(uint32_t) * m.map_.size();
char *key_address = dest;
dest += sizeof(Address) * m.map_.size();
@ -157,7 +157,7 @@ char *RangeMapSerializer<Address, Entry>::Write(
typename std::map<Address, Range>::const_iterator iter;
int index = 0;
for (iter = m.map_.begin(); iter != m.map_.end(); ++iter, ++index) {
offsets[index] = static_cast<u_int32_t>(dest - start_address);
offsets[index] = static_cast<uint32_t>(dest - start_address);
key_address = address_serializer_.Write(iter->first, key_address);
dest = address_serializer_.Write(iter->second.base(), dest);
dest = entry_serializer_.Write(iter->second.entry(), dest);
@ -192,12 +192,12 @@ size_t ContainedRangeMapSerializer<AddrType, EntryType>::SizeOf(
size_t size = 0;
size_t header_size = addr_serializer_.SizeOf(m->base_)
+ entry_serializer_.SizeOf(m->entry_)
+ sizeof(u_int32_t);
+ sizeof(uint32_t);
size += header_size;
// In case m.map_ == NULL, we treat it as an empty map:
size += sizeof(u_int32_t);
size += sizeof(uint32_t);
if (m->map_) {
size += m->map_->size() * sizeof(u_int32_t);
size += m->map_->size() * sizeof(uint32_t);
typename Map::const_iterator iter;
for (iter = m->map_->begin(); iter != m->map_->end(); ++iter) {
size += addr_serializer_.SizeOf(iter->first);
@ -216,18 +216,18 @@ char *ContainedRangeMapSerializer<AddrType, EntryType>::Write(
return NULL;
}
dest = addr_serializer_.Write(m->base_, dest);
dest = SimpleSerializer<u_int32_t>::Write(entry_serializer_.SizeOf(m->entry_),
dest = SimpleSerializer<uint32_t>::Write(entry_serializer_.SizeOf(m->entry_),
dest);
dest = entry_serializer_.Write(m->entry_, dest);
// Write map<<AddrType, ContainedRangeMap*>:
char *map_address = dest;
if (m->map_ == NULL) {
dest = SimpleSerializer<u_int32_t>::Write(0, dest);
dest = SimpleSerializer<uint32_t>::Write(0, dest);
} else {
dest = SimpleSerializer<u_int32_t>::Write(m->map_->size(), dest);
u_int32_t *offsets = reinterpret_cast<u_int32_t*>(dest);
dest += sizeof(u_int32_t) * m->map_->size();
dest = SimpleSerializer<uint32_t>::Write(m->map_->size(), dest);
uint32_t *offsets = reinterpret_cast<uint32_t*>(dest);
dest += sizeof(uint32_t) * m->map_->size();
char *key_address = dest;
dest += sizeof(AddrType) * m->map_->size();
@ -236,7 +236,7 @@ char *ContainedRangeMapSerializer<AddrType, EntryType>::Write(
typename Map::const_iterator iter;
int index = 0;
for (iter = m->map_->begin(); iter != m->map_->end(); ++iter, ++index) {
offsets[index] = static_cast<u_int32_t>(dest - map_address);
offsets[index] = static_cast<uint32_t>(dest - map_address);
key_address = addr_serializer_.Write(iter->first, key_address);
// Recursively write.
dest = Write(iter->second, dest);

View file

@ -64,13 +64,13 @@ class TestStdMapSerializer : public ::testing::Test {
std::map<AddrType, EntryType> std_map_;
google_breakpad::StdMapSerializer<AddrType, EntryType> serializer_;
u_int32_t serialized_size_;
uint32_t serialized_size_;
char *serialized_data_;
};
TEST_F(TestStdMapSerializer, EmptyMapTestCase) {
const int32_t correct_data[] = { 0 };
u_int32_t correct_size = sizeof(correct_data);
uint32_t correct_size = sizeof(correct_data);
// std_map_ is empty.
serialized_data_ = serializer_.Serialize(std_map_, &serialized_size_);
@ -90,7 +90,7 @@ TEST_F(TestStdMapSerializer, MapWithTwoElementsTestCase) {
// Values
2, 6
};
u_int32_t correct_size = sizeof(correct_data);
uint32_t correct_size = sizeof(correct_data);
std_map_.insert(std::make_pair(1, 2));
std_map_.insert(std::make_pair(3, 6));
@ -112,7 +112,7 @@ TEST_F(TestStdMapSerializer, MapWithFiveElementsTestCase) {
// Values
11, 12, 13, 14, 15
};
u_int32_t correct_size = sizeof(correct_data);
uint32_t correct_size = sizeof(correct_data);
for (int i = 1; i < 6; ++i)
std_map_.insert(std::make_pair(i, 10 + i));
@ -136,13 +136,13 @@ class TestAddressMapSerializer : public ::testing::Test {
google_breakpad::AddressMap<AddrType, EntryType> address_map_;
google_breakpad::AddressMapSerializer<AddrType, EntryType> serializer_;
u_int32_t serialized_size_;
uint32_t serialized_size_;
char *serialized_data_;
};
TEST_F(TestAddressMapSerializer, EmptyMapTestCase) {
const int32_t correct_data[] = { 0 };
u_int32_t correct_size = sizeof(correct_data);
uint32_t correct_size = sizeof(correct_data);
// std_map_ is empty.
serialized_data_ = serializer_.Serialize(address_map_, &serialized_size_);
@ -162,7 +162,7 @@ TEST_F(TestAddressMapSerializer, MapWithTwoElementsTestCase) {
// Values
2, 6
};
u_int32_t correct_size = sizeof(correct_data);
uint32_t correct_size = sizeof(correct_data);
address_map_.Store(1, 2);
address_map_.Store(3, 6);
@ -184,7 +184,7 @@ TEST_F(TestAddressMapSerializer, MapWithFourElementsTestCase) {
// Values
2, 3, 5, 8
};
u_int32_t correct_size = sizeof(correct_data);
uint32_t correct_size = sizeof(correct_data);
address_map_.Store(-6, 2);
address_map_.Store(-4, 3);
@ -211,13 +211,13 @@ class TestRangeMapSerializer : public ::testing::Test {
google_breakpad::RangeMap<AddrType, EntryType> range_map_;
google_breakpad::RangeMapSerializer<AddrType, EntryType> serializer_;
u_int32_t serialized_size_;
uint32_t serialized_size_;
char *serialized_data_;
};
TEST_F(TestRangeMapSerializer, EmptyMapTestCase) {
const int32_t correct_data[] = { 0 };
u_int32_t correct_size = sizeof(correct_data);
uint32_t correct_size = sizeof(correct_data);
// range_map_ is empty.
serialized_data_ = serializer_.Serialize(range_map_, &serialized_size_);
@ -237,7 +237,7 @@ TEST_F(TestRangeMapSerializer, MapWithOneRangeTestCase) {
// Values: (low address, entry) pairs
1, 6
};
u_int32_t correct_size = sizeof(correct_data);
uint32_t correct_size = sizeof(correct_data);
range_map_.StoreRange(1, 10, 6);
@ -258,7 +258,7 @@ TEST_F(TestRangeMapSerializer, MapWithThreeRangesTestCase) {
// Values: (low address, entry) pairs
2, 1, 6, 2, 10, 3
};
u_int32_t correct_size = sizeof(correct_data);
uint32_t correct_size = sizeof(correct_data);
ASSERT_TRUE(range_map_.StoreRange(2, 4, 1));
ASSERT_TRUE(range_map_.StoreRange(6, 4, 2));
@ -284,7 +284,7 @@ class TestContainedRangeMapSerializer : public ::testing::Test {
google_breakpad::ContainedRangeMap<AddrType, EntryType> crm_map_;
google_breakpad::ContainedRangeMapSerializer<AddrType, EntryType> serializer_;
u_int32_t serialized_size_;
uint32_t serialized_size_;
char *serialized_data_;
};
@ -295,7 +295,7 @@ TEST_F(TestContainedRangeMapSerializer, EmptyMapTestCase) {
0, // entry stored at root
0 // empty map stored at root
};
u_int32_t correct_size = sizeof(correct_data);
uint32_t correct_size = sizeof(correct_data);
// crm_map_ is empty.
serialized_data_ = serializer_.Serialize(&crm_map_, &serialized_size_);
@ -319,7 +319,7 @@ TEST_F(TestContainedRangeMapSerializer, MapWithOneRangeTestCase) {
-1, // entry stored in child CRM
0 // empty sub-map stored in child CRM
};
u_int32_t correct_size = sizeof(correct_data);
uint32_t correct_size = sizeof(correct_data);
crm_map_.StoreRange(3, 7, -1);
@ -361,7 +361,7 @@ TEST_F(TestContainedRangeMapSerializer, MapWithTwoLevelsTestCase) {
// grandchild3: base, entry_size, entry, empty_map
16, 4, -1, 0
};
u_int32_t correct_size = sizeof(correct_data);
uint32_t correct_size = sizeof(correct_data);
// Store child1.
ASSERT_TRUE(crm_map_.StoreRange(2, 7, -1));

266
src/processor/minidump.cc Normal file → Executable file
View file

@ -43,7 +43,9 @@
#ifdef _WIN32
#include <io.h>
#if _MSC_VER < 1600
typedef SSIZE_T ssize_t;
#endif
#define PRIx64 "llx"
#define PRIx32 "lx"
#define snprintf _snprintf
@ -86,9 +88,9 @@ using std::vector;
// Swapping an 8-bit quantity is a no-op. This function is only provided
// to account for certain templatized operations that require swapping for
// wider types but handle u_int8_t too
// wider types but handle uint8_t too
// (MinidumpMemoryRegion::GetMemoryAtAddressInternal).
static inline void Swap(u_int8_t* value) {
static inline void Swap(uint8_t* value) {
}
@ -99,13 +101,13 @@ static inline void Swap(u_int8_t* value) {
// The furthest left shift never needs to be ANDed bitmask.
static inline void Swap(u_int16_t* value) {
static inline void Swap(uint16_t* value) {
*value = (*value >> 8) |
(*value << 8);
}
static inline void Swap(u_int32_t* value) {
static inline void Swap(uint32_t* value) {
*value = (*value >> 24) |
((*value >> 8) & 0x0000ff00) |
((*value << 8) & 0x00ff0000) |
@ -113,11 +115,11 @@ static inline void Swap(u_int32_t* value) {
}
static inline void Swap(u_int64_t* value) {
u_int32_t* value32 = reinterpret_cast<u_int32_t*>(value);
static inline void Swap(uint64_t* value) {
uint32_t* value32 = reinterpret_cast<uint32_t*>(value);
Swap(&value32[0]);
Swap(&value32[1]);
u_int32_t temp = value32[0];
uint32_t temp = value32[0];
value32[0] = value32[1];
value32[1] = temp;
}
@ -125,11 +127,11 @@ static inline void Swap(u_int64_t* value) {
// Given a pointer to a 128-bit int in the minidump data, set the "low"
// and "high" fields appropriately.
static void Normalize128(u_int128_t* value, bool is_big_endian) {
static void Normalize128(uint128_struct* value, bool is_big_endian) {
// The struct format is [high, low], so if the format is big-endian,
// the most significant bytes will already be in the high field.
if (!is_big_endian) {
u_int64_t temp = value->low;
uint64_t temp = value->low;
value->low = value->high;
value->high = temp;
}
@ -137,7 +139,7 @@ static void Normalize128(u_int128_t* value, bool is_big_endian) {
// This just swaps each int64 half of the 128-bit value.
// The value should also be normalized by calling Normalize128().
static void Swap(u_int128_t* value) {
static void Swap(uint128_struct* value) {
Swap(&value->low);
Swap(&value->high);
}
@ -177,7 +179,7 @@ static inline void Swap(MDGUID* guid) {
// parameter, a converter that uses iconv would also need to take the host
// CPU's endianness into consideration. It doesn't seems worth the trouble
// of making it a dependency when we don't care about anything but UTF-16.
static string* UTF16ToUTF8(const vector<u_int16_t>& in,
static string* UTF16ToUTF8(const vector<uint16_t>& in,
bool swap) {
scoped_ptr<string> out(new string());
@ -186,16 +188,16 @@ static string* UTF16ToUTF8(const vector<u_int16_t>& in,
// If the UTF-8 representation is longer, the string will grow dynamically.
out->reserve(in.size());
for (vector<u_int16_t>::const_iterator iterator = in.begin();
for (vector<uint16_t>::const_iterator iterator = in.begin();
iterator != in.end();
++iterator) {
// Get a 16-bit value from the input
u_int16_t in_word = *iterator;
uint16_t in_word = *iterator;
if (swap)
Swap(&in_word);
// Convert the input value (in_word) into a Unicode code point (unichar).
u_int32_t unichar;
uint32_t unichar;
if (in_word >= 0xdc00 && in_word <= 0xdcff) {
BPLOG(ERROR) << "UTF16ToUTF8 found low surrogate " <<
HexString(in_word) << " without high";
@ -208,7 +210,7 @@ static string* UTF16ToUTF8(const vector<u_int16_t>& in,
HexString(in_word) << " at end of string";
return NULL;
}
u_int32_t high_word = in_word;
uint32_t high_word = in_word;
in_word = *iterator;
if (in_word < 0xdc00 || in_word > 0xdcff) {
BPLOG(ERROR) << "UTF16ToUTF8 found high surrogate " <<
@ -251,7 +253,7 @@ static string* UTF16ToUTF8(const vector<u_int16_t>& in,
// Return the smaller of the number of code units in the UTF-16 string,
// not including the terminating null word, or maxlen.
static size_t UTF16codeunits(const u_int16_t *string, size_t maxlen) {
static size_t UTF16codeunits(const uint16_t *string, size_t maxlen) {
size_t count = 0;
while (count < maxlen && string[count] != 0)
count++;
@ -297,7 +299,7 @@ MinidumpContext::~MinidumpContext() {
}
bool MinidumpContext::Read(u_int32_t expected_size) {
bool MinidumpContext::Read(uint32_t expected_size) {
valid_ = false;
FreeContext();
@ -318,7 +320,7 @@ bool MinidumpContext::Read(u_int32_t expected_size) {
if (minidump_->swap())
Swap(&context_amd64->context_flags);
u_int32_t cpu_type = context_amd64->context_flags & MD_CONTEXT_CPU_MASK;
uint32_t cpu_type = context_amd64->context_flags & MD_CONTEXT_CPU_MASK;
if (cpu_type == 0) {
if (minidump_->GetContextCPUFlagsFromSystemInfo(&cpu_type)) {
context_amd64->context_flags |= cpu_type;
@ -410,7 +412,7 @@ bool MinidumpContext::Read(u_int32_t expected_size) {
context_.amd64 = context_amd64.release();
}
else {
u_int32_t context_flags;
uint32_t context_flags;
if (!minidump_->ReadBytes(&context_flags, sizeof(context_flags))) {
BPLOG(ERROR) << "MinidumpContext could not read context flags";
return false;
@ -418,7 +420,7 @@ bool MinidumpContext::Read(u_int32_t expected_size) {
if (minidump_->swap())
Swap(&context_flags);
u_int32_t cpu_type = context_flags & MD_CONTEXT_CPU_MASK;
uint32_t cpu_type = context_flags & MD_CONTEXT_CPU_MASK;
if (cpu_type == 0) {
// Unfortunately the flag for MD_CONTEXT_ARM that was taken
// from a Windows CE SDK header conflicts in practice with
@ -460,8 +462,8 @@ bool MinidumpContext::Read(u_int32_t expected_size) {
context_x86->context_flags = context_flags;
size_t flags_size = sizeof(context_x86->context_flags);
u_int8_t* context_after_flags =
reinterpret_cast<u_int8_t*>(context_x86.get()) + flags_size;
uint8_t* context_after_flags =
reinterpret_cast<uint8_t*>(context_x86.get()) + flags_size;
if (!minidump_->ReadBytes(context_after_flags,
sizeof(MDRawContextX86) - flags_size)) {
BPLOG(ERROR) << "MinidumpContext could not read x86 context";
@ -533,8 +535,8 @@ bool MinidumpContext::Read(u_int32_t expected_size) {
context_ppc->context_flags = context_flags;
size_t flags_size = sizeof(context_ppc->context_flags);
u_int8_t* context_after_flags =
reinterpret_cast<u_int8_t*>(context_ppc.get()) + flags_size;
uint8_t* context_after_flags =
reinterpret_cast<uint8_t*>(context_ppc.get()) + flags_size;
if (!minidump_->ReadBytes(context_after_flags,
sizeof(MDRawContextPPC) - flags_size)) {
BPLOG(ERROR) << "MinidumpContext could not read ppc context";
@ -609,8 +611,8 @@ bool MinidumpContext::Read(u_int32_t expected_size) {
context_sparc->context_flags = context_flags;
size_t flags_size = sizeof(context_sparc->context_flags);
u_int8_t* context_after_flags =
reinterpret_cast<u_int8_t*>(context_sparc.get()) + flags_size;
uint8_t* context_after_flags =
reinterpret_cast<uint8_t*>(context_sparc.get()) + flags_size;
if (!minidump_->ReadBytes(context_after_flags,
sizeof(MDRawContextSPARC) - flags_size)) {
BPLOG(ERROR) << "MinidumpContext could not read sparc context";
@ -665,8 +667,8 @@ bool MinidumpContext::Read(u_int32_t expected_size) {
context_arm->context_flags = context_flags;
size_t flags_size = sizeof(context_arm->context_flags);
u_int8_t* context_after_flags =
reinterpret_cast<u_int8_t*>(context_arm.get()) + flags_size;
uint8_t* context_after_flags =
reinterpret_cast<uint8_t*>(context_arm.get()) + flags_size;
if (!minidump_->ReadBytes(context_after_flags,
sizeof(MDRawContextARM) - flags_size)) {
BPLOG(ERROR) << "MinidumpContext could not read arm context";
@ -722,7 +724,7 @@ bool MinidumpContext::Read(u_int32_t expected_size) {
}
u_int32_t MinidumpContext::GetContextCPU() const {
uint32_t MinidumpContext::GetContextCPU() const {
if (!valid_) {
// Don't log a message, GetContextCPU can be legitimately called with
// valid_ false by FreeContext, which is called by Read.
@ -732,7 +734,7 @@ u_int32_t MinidumpContext::GetContextCPU() const {
return context_flags_ & MD_CONTEXT_CPU_MASK;
}
bool MinidumpContext::GetInstructionPointer(u_int64_t* ip) const {
bool MinidumpContext::GetInstructionPointer(uint64_t* ip) const {
BPLOG_IF(ERROR, !ip) << "MinidumpContext::GetInstructionPointer "
"requires |ip|";
assert(ip);
@ -848,7 +850,7 @@ void MinidumpContext::FreeContext() {
}
bool MinidumpContext::CheckAgainstSystemInfo(u_int32_t context_cpu_type) {
bool MinidumpContext::CheckAgainstSystemInfo(uint32_t context_cpu_type) {
// It's OK if the minidump doesn't contain an MD_SYSTEM_INFO_STREAM,
// as this function just implements a sanity check.
MinidumpSystemInfo* system_info = minidump_->GetSystemInfo();
@ -1147,7 +1149,7 @@ void MinidumpContext::Print() {
//
u_int32_t MinidumpMemoryRegion::max_bytes_ = 1024 * 1024; // 1MB
uint32_t MinidumpMemoryRegion::max_bytes_ = 1024 * 1024; // 1MB
MinidumpMemoryRegion::MinidumpMemoryRegion(Minidump* minidump)
@ -1166,12 +1168,12 @@ void MinidumpMemoryRegion::SetDescriptor(MDMemoryDescriptor* descriptor) {
descriptor_ = descriptor;
valid_ = descriptor &&
descriptor_->memory.data_size <=
numeric_limits<u_int64_t>::max() -
numeric_limits<uint64_t>::max() -
descriptor_->start_of_memory_range;
}
const u_int8_t* MinidumpMemoryRegion::GetMemory() const {
const uint8_t* MinidumpMemoryRegion::GetMemory() const {
if (!valid_) {
BPLOG(ERROR) << "Invalid MinidumpMemoryRegion for GetMemory";
return NULL;
@ -1195,8 +1197,8 @@ const u_int8_t* MinidumpMemoryRegion::GetMemory() const {
return NULL;
}
scoped_ptr< vector<u_int8_t> > memory(
new vector<u_int8_t>(descriptor_->memory.data_size));
scoped_ptr< vector<uint8_t> > memory(
new vector<uint8_t>(descriptor_->memory.data_size));
if (!minidump_->ReadBytes(&(*memory)[0], descriptor_->memory.data_size)) {
BPLOG(ERROR) << "MinidumpMemoryRegion could not read memory region";
@ -1210,17 +1212,17 @@ const u_int8_t* MinidumpMemoryRegion::GetMemory() const {
}
u_int64_t MinidumpMemoryRegion::GetBase() const {
uint64_t MinidumpMemoryRegion::GetBase() const {
if (!valid_) {
BPLOG(ERROR) << "Invalid MinidumpMemoryRegion for GetBase";
return static_cast<u_int64_t>(-1);
return static_cast<uint64_t>(-1);
}
return descriptor_->start_of_memory_range;
}
u_int32_t MinidumpMemoryRegion::GetSize() const {
uint32_t MinidumpMemoryRegion::GetSize() const {
if (!valid_) {
BPLOG(ERROR) << "Invalid MinidumpMemoryRegion for GetSize";
return 0;
@ -1237,7 +1239,7 @@ void MinidumpMemoryRegion::FreeMemory() {
template<typename T>
bool MinidumpMemoryRegion::GetMemoryAtAddressInternal(u_int64_t address,
bool MinidumpMemoryRegion::GetMemoryAtAddressInternal(uint64_t address,
T* value) const {
BPLOG_IF(ERROR, !value) << "MinidumpMemoryRegion::GetMemoryAtAddressInternal "
"requires |value|";
@ -1252,7 +1254,7 @@ bool MinidumpMemoryRegion::GetMemoryAtAddressInternal(u_int64_t address,
// Common failure case
if (address < descriptor_->start_of_memory_range ||
sizeof(T) > numeric_limits<u_int64_t>::max() - address ||
sizeof(T) > numeric_limits<uint64_t>::max() - address ||
address + sizeof(T) > descriptor_->start_of_memory_range +
descriptor_->memory.data_size) {
BPLOG(INFO) << "MinidumpMemoryRegion request out of range: " <<
@ -1262,7 +1264,7 @@ bool MinidumpMemoryRegion::GetMemoryAtAddressInternal(u_int64_t address,
return false;
}
const u_int8_t* memory = GetMemory();
const uint8_t* memory = GetMemory();
if (!memory) {
// GetMemory already logged a perfectly good message.
return false;
@ -1280,26 +1282,26 @@ bool MinidumpMemoryRegion::GetMemoryAtAddressInternal(u_int64_t address,
}
bool MinidumpMemoryRegion::GetMemoryAtAddress(u_int64_t address,
u_int8_t* value) const {
bool MinidumpMemoryRegion::GetMemoryAtAddress(uint64_t address,
uint8_t* value) const {
return GetMemoryAtAddressInternal(address, value);
}
bool MinidumpMemoryRegion::GetMemoryAtAddress(u_int64_t address,
u_int16_t* value) const {
bool MinidumpMemoryRegion::GetMemoryAtAddress(uint64_t address,
uint16_t* value) const {
return GetMemoryAtAddressInternal(address, value);
}
bool MinidumpMemoryRegion::GetMemoryAtAddress(u_int64_t address,
u_int32_t* value) const {
bool MinidumpMemoryRegion::GetMemoryAtAddress(uint64_t address,
uint32_t* value) const {
return GetMemoryAtAddressInternal(address, value);
}
bool MinidumpMemoryRegion::GetMemoryAtAddress(u_int64_t address,
u_int64_t* value) const {
bool MinidumpMemoryRegion::GetMemoryAtAddress(uint64_t address,
uint64_t* value) const {
return GetMemoryAtAddressInternal(address, value);
}
@ -1310,7 +1312,7 @@ void MinidumpMemoryRegion::Print() {
return;
}
const u_int8_t* memory = GetMemory();
const uint8_t* memory = GetMemory();
if (memory) {
printf("0x");
for (unsigned int byte_index = 0;
@ -1370,7 +1372,7 @@ bool MinidumpThread::Read() {
// Check for base + size overflow or undersize.
if (thread_.stack.memory.data_size == 0 ||
thread_.stack.memory.data_size > numeric_limits<u_int64_t>::max() -
thread_.stack.memory.data_size > numeric_limits<uint64_t>::max() -
thread_.stack.start_of_memory_range) {
// This is ok, but log an error anyway.
BPLOG(ERROR) << "MinidumpThread has a memory region problem, " <<
@ -1422,7 +1424,7 @@ MinidumpContext* MinidumpThread::GetContext() {
}
bool MinidumpThread::GetThreadID(u_int32_t *thread_id) const {
bool MinidumpThread::GetThreadID(uint32_t *thread_id) const {
BPLOG_IF(ERROR, !thread_id) << "MinidumpThread::GetThreadID requires "
"|thread_id|";
assert(thread_id);
@ -1485,7 +1487,7 @@ void MinidumpThread::Print() {
//
u_int32_t MinidumpThreadList::max_threads_ = 4096;
uint32_t MinidumpThreadList::max_threads_ = 4096;
MinidumpThreadList::MinidumpThreadList(Minidump* minidump)
@ -1501,7 +1503,7 @@ MinidumpThreadList::~MinidumpThreadList() {
}
bool MinidumpThreadList::Read(u_int32_t expected_size) {
bool MinidumpThreadList::Read(uint32_t expected_size) {
// Invalidate cached data.
id_to_thread_map_.clear();
delete threads_;
@ -1510,7 +1512,7 @@ bool MinidumpThreadList::Read(u_int32_t expected_size) {
valid_ = false;
u_int32_t thread_count;
uint32_t thread_count;
if (expected_size < sizeof(thread_count)) {
BPLOG(ERROR) << "MinidumpThreadList count size mismatch, " <<
expected_size << " < " << sizeof(thread_count);
@ -1524,7 +1526,7 @@ bool MinidumpThreadList::Read(u_int32_t expected_size) {
if (minidump_->swap())
Swap(&thread_count);
if (thread_count > numeric_limits<u_int32_t>::max() / sizeof(MDRawThread)) {
if (thread_count > numeric_limits<uint32_t>::max() / sizeof(MDRawThread)) {
BPLOG(ERROR) << "MinidumpThreadList thread count " << thread_count <<
" would cause multiplication overflow";
return false;
@ -1535,7 +1537,7 @@ bool MinidumpThreadList::Read(u_int32_t expected_size) {
// may be padded with 4 bytes on 64bit ABIs for alignment
if (expected_size == sizeof(thread_count) + 4 +
thread_count * sizeof(MDRawThread)) {
u_int32_t useless;
uint32_t useless;
if (!minidump_->ReadBytes(&useless, 4)) {
BPLOG(ERROR) << "MinidumpThreadList cannot read threadlist padded bytes";
return false;
@ -1571,7 +1573,7 @@ bool MinidumpThreadList::Read(u_int32_t expected_size) {
return false;
}
u_int32_t thread_id;
uint32_t thread_id;
if (!thread->GetThreadID(&thread_id)) {
BPLOG(ERROR) << "MinidumpThreadList cannot get thread ID for thread " <<
thread_index << "/" << thread_count;
@ -1615,7 +1617,7 @@ MinidumpThread* MinidumpThreadList::GetThreadAtIndex(unsigned int index)
}
MinidumpThread* MinidumpThreadList::GetThreadByID(u_int32_t thread_id) {
MinidumpThread* MinidumpThreadList::GetThreadByID(uint32_t thread_id) {
// Don't check valid_. Read calls this method before everything is
// validated. It is safe to not check valid_ here.
return id_to_thread_map_[thread_id];
@ -1647,8 +1649,8 @@ void MinidumpThreadList::Print() {
//
u_int32_t MinidumpModule::max_cv_bytes_ = 32768;
u_int32_t MinidumpModule::max_misc_bytes_ = 32768;
uint32_t MinidumpModule::max_cv_bytes_ = 32768;
uint32_t MinidumpModule::max_misc_bytes_ = 32768;
MinidumpModule::MinidumpModule(Minidump* minidump)
@ -1717,7 +1719,7 @@ bool MinidumpModule::Read() {
// Check for base + size overflow or undersize.
if (module_.size_of_image == 0 ||
module_.size_of_image >
numeric_limits<u_int64_t>::max() - module_.base_of_image) {
numeric_limits<uint64_t>::max() - module_.base_of_image) {
BPLOG(ERROR) << "MinidumpModule has a module problem, " <<
HexString(module_.base_of_image) << "+" <<
HexString(module_.size_of_image);
@ -1892,9 +1894,9 @@ string MinidumpModule::debug_file() const {
if (bytes % 2 == 0) {
unsigned int utf16_words = bytes / 2;
// UTF16ToUTF8 expects a vector<u_int16_t>, so create a temporary one
// UTF16ToUTF8 expects a vector<uint16_t>, so create a temporary one
// and copy the UTF-16 data into it.
vector<u_int16_t> string_utf16(utf16_words);
vector<uint16_t> string_utf16(utf16_words);
if (utf16_words)
memcpy(&string_utf16[0], &misc_record->data, bytes);
@ -2021,7 +2023,7 @@ const CodeModule* MinidumpModule::Copy() const {
}
const u_int8_t* MinidumpModule::GetCVRecord(u_int32_t* size) {
const uint8_t* MinidumpModule::GetCVRecord(uint32_t* size) {
if (!module_valid_) {
BPLOG(ERROR) << "Invalid MinidumpModule for GetCVRecord";
return NULL;
@ -2047,21 +2049,21 @@ const u_int8_t* MinidumpModule::GetCVRecord(u_int32_t* size) {
}
// Allocating something that will be accessed as MDCVInfoPDB70 or
// MDCVInfoPDB20 but is allocated as u_int8_t[] can cause alignment
// MDCVInfoPDB20 but is allocated as uint8_t[] can cause alignment
// problems. x86 and ppc are able to cope, though. This allocation
// style is needed because the MDCVInfoPDB70 or MDCVInfoPDB20 are
// variable-sized due to their pdb_file_name fields; these structures
// are not MDCVInfoPDB70_minsize or MDCVInfoPDB20_minsize and treating
// them as such would result in incomplete structures or overruns.
scoped_ptr< vector<u_int8_t> > cv_record(
new vector<u_int8_t>(module_.cv_record.data_size));
scoped_ptr< vector<uint8_t> > cv_record(
new vector<uint8_t>(module_.cv_record.data_size));
if (!minidump_->ReadBytes(&(*cv_record)[0], module_.cv_record.data_size)) {
BPLOG(ERROR) << "MinidumpModule could not read CodeView record";
return NULL;
}
u_int32_t signature = MD_CVINFOUNKNOWN_SIGNATURE;
uint32_t signature = MD_CVINFOUNKNOWN_SIGNATURE;
if (module_.cv_record.data_size > sizeof(signature)) {
MDCVInfoPDB70* cv_record_signature =
reinterpret_cast<MDCVInfoPDB70*>(&(*cv_record)[0]);
@ -2131,7 +2133,7 @@ const u_int8_t* MinidumpModule::GetCVRecord(u_int32_t* size) {
// although byte-swapping can't be done.
// Store the vector type because that's how storage was allocated, but
// return it casted to u_int8_t*.
// return it casted to uint8_t*.
cv_record_ = cv_record.release();
cv_record_signature_ = signature;
}
@ -2143,7 +2145,7 @@ const u_int8_t* MinidumpModule::GetCVRecord(u_int32_t* size) {
}
const MDImageDebugMisc* MinidumpModule::GetMiscRecord(u_int32_t* size) {
const MDImageDebugMisc* MinidumpModule::GetMiscRecord(uint32_t* size) {
if (!module_valid_) {
BPLOG(ERROR) << "Invalid MinidumpModule for GetMiscRecord";
return NULL;
@ -2175,13 +2177,13 @@ const MDImageDebugMisc* MinidumpModule::GetMiscRecord(u_int32_t* size) {
}
// Allocating something that will be accessed as MDImageDebugMisc but
// is allocated as u_int8_t[] can cause alignment problems. x86 and
// is allocated as uint8_t[] can cause alignment problems. x86 and
// ppc are able to cope, though. This allocation style is needed
// because the MDImageDebugMisc is variable-sized due to its data field;
// this structure is not MDImageDebugMisc_minsize and treating it as such
// would result in an incomplete structure or an overrun.
scoped_ptr< vector<u_int8_t> > misc_record_mem(
new vector<u_int8_t>(module_.misc_record.data_size));
scoped_ptr< vector<uint8_t> > misc_record_mem(
new vector<uint8_t>(module_.misc_record.data_size));
MDImageDebugMisc* misc_record =
reinterpret_cast<MDImageDebugMisc*>(&(*misc_record_mem)[0]);
@ -2200,7 +2202,7 @@ const MDImageDebugMisc* MinidumpModule::GetMiscRecord(u_int32_t* size) {
if (misc_record->unicode) {
// There is a potential alignment problem, but shouldn't be a problem
// in practice due to the layout of MDImageDebugMisc.
u_int16_t* data16 = reinterpret_cast<u_int16_t*>(&(misc_record->data));
uint16_t* data16 = reinterpret_cast<uint16_t*>(&(misc_record->data));
unsigned int dataBytes = module_.misc_record.data_size -
MDImageDebugMisc_minsize;
unsigned int dataLength = dataBytes / 2;
@ -2284,8 +2286,8 @@ void MinidumpModule::Print() {
printf(" (code_identifier) = \"%s\"\n",
code_identifier().c_str());
u_int32_t cv_record_size;
const u_int8_t *cv_record = GetCVRecord(&cv_record_size);
uint32_t cv_record_size;
const uint8_t *cv_record = GetCVRecord(&cv_record_size);
if (cv_record) {
if (cv_record_signature_ == MD_CVINFOPDB70_SIGNATURE) {
const MDCVInfoPDB70* cv_record_70 =
@ -2370,12 +2372,12 @@ void MinidumpModule::Print() {
//
u_int32_t MinidumpModuleList::max_modules_ = 1024;
uint32_t MinidumpModuleList::max_modules_ = 1024;
MinidumpModuleList::MinidumpModuleList(Minidump* minidump)
: MinidumpStream(minidump),
range_map_(new RangeMap<u_int64_t, unsigned int>()),
range_map_(new RangeMap<uint64_t, unsigned int>()),
modules_(NULL),
module_count_(0) {
}
@ -2387,7 +2389,7 @@ MinidumpModuleList::~MinidumpModuleList() {
}
bool MinidumpModuleList::Read(u_int32_t expected_size) {
bool MinidumpModuleList::Read(uint32_t expected_size) {
// Invalidate cached data.
range_map_->Clear();
delete modules_;
@ -2396,7 +2398,7 @@ bool MinidumpModuleList::Read(u_int32_t expected_size) {
valid_ = false;
u_int32_t module_count;
uint32_t module_count;
if (expected_size < sizeof(module_count)) {
BPLOG(ERROR) << "MinidumpModuleList count size mismatch, " <<
expected_size << " < " << sizeof(module_count);
@ -2410,7 +2412,7 @@ bool MinidumpModuleList::Read(u_int32_t expected_size) {
if (minidump_->swap())
Swap(&module_count);
if (module_count > numeric_limits<u_int32_t>::max() / MD_MODULE_SIZE) {
if (module_count > numeric_limits<uint32_t>::max() / MD_MODULE_SIZE) {
BPLOG(ERROR) << "MinidumpModuleList module count " << module_count <<
" would cause multiplication overflow";
return false;
@ -2421,7 +2423,7 @@ bool MinidumpModuleList::Read(u_int32_t expected_size) {
// may be padded with 4 bytes on 64bit ABIs for alignment
if (expected_size == sizeof(module_count) + 4 +
module_count * MD_MODULE_SIZE) {
u_int32_t useless;
uint32_t useless;
if (!minidump_->ReadBytes(&useless, 4)) {
BPLOG(ERROR) << "MinidumpModuleList cannot read modulelist padded bytes";
return false;
@ -2482,9 +2484,9 @@ bool MinidumpModuleList::Read(u_int32_t expected_size) {
// It is safe to use module->code_file() after successfully calling
// module->ReadAuxiliaryData or noting that the module is valid.
u_int64_t base_address = module->base_address();
u_int64_t module_size = module->size();
if (base_address == static_cast<u_int64_t>(-1)) {
uint64_t base_address = module->base_address();
uint64_t module_size = module->size();
if (base_address == static_cast<uint64_t>(-1)) {
BPLOG(ERROR) << "MinidumpModuleList found bad base address "
"for module " << module_index << "/" << module_count <<
", " << module->code_file();
@ -2512,7 +2514,7 @@ bool MinidumpModuleList::Read(u_int32_t expected_size) {
const MinidumpModule* MinidumpModuleList::GetModuleForAddress(
u_int64_t address) const {
uint64_t address) const {
if (!valid_) {
BPLOG(ERROR) << "Invalid MinidumpModuleList for GetModuleForAddress";
return NULL;
@ -2611,12 +2613,12 @@ void MinidumpModuleList::Print() {
//
u_int32_t MinidumpMemoryList::max_regions_ = 4096;
uint32_t MinidumpMemoryList::max_regions_ = 4096;
MinidumpMemoryList::MinidumpMemoryList(Minidump* minidump)
: MinidumpStream(minidump),
range_map_(new RangeMap<u_int64_t, unsigned int>()),
range_map_(new RangeMap<uint64_t, unsigned int>()),
descriptors_(NULL),
regions_(NULL),
region_count_(0) {
@ -2630,7 +2632,7 @@ MinidumpMemoryList::~MinidumpMemoryList() {
}
bool MinidumpMemoryList::Read(u_int32_t expected_size) {
bool MinidumpMemoryList::Read(uint32_t expected_size) {
// Invalidate cached data.
delete descriptors_;
descriptors_ = NULL;
@ -2641,7 +2643,7 @@ bool MinidumpMemoryList::Read(u_int32_t expected_size) {
valid_ = false;
u_int32_t region_count;
uint32_t region_count;
if (expected_size < sizeof(region_count)) {
BPLOG(ERROR) << "MinidumpMemoryList count size mismatch, " <<
expected_size << " < " << sizeof(region_count);
@ -2656,7 +2658,7 @@ bool MinidumpMemoryList::Read(u_int32_t expected_size) {
Swap(&region_count);
if (region_count >
numeric_limits<u_int32_t>::max() / sizeof(MDMemoryDescriptor)) {
numeric_limits<uint32_t>::max() / sizeof(MDMemoryDescriptor)) {
BPLOG(ERROR) << "MinidumpMemoryList region count " << region_count <<
" would cause multiplication overflow";
return false;
@ -2667,7 +2669,7 @@ bool MinidumpMemoryList::Read(u_int32_t expected_size) {
// may be padded with 4 bytes on 64bit ABIs for alignment
if (expected_size == sizeof(region_count) + 4 +
region_count * sizeof(MDMemoryDescriptor)) {
u_int32_t useless;
uint32_t useless;
if (!minidump_->ReadBytes(&useless, 4)) {
BPLOG(ERROR) << "MinidumpMemoryList cannot read memorylist padded bytes";
return false;
@ -2709,12 +2711,12 @@ bool MinidumpMemoryList::Read(u_int32_t expected_size) {
if (minidump_->swap())
Swap(descriptor);
u_int64_t base_address = descriptor->start_of_memory_range;
u_int32_t region_size = descriptor->memory.data_size;
uint64_t base_address = descriptor->start_of_memory_range;
uint32_t region_size = descriptor->memory.data_size;
// Check for base + size overflow or undersize.
if (region_size == 0 ||
region_size > numeric_limits<u_int64_t>::max() - base_address) {
region_size > numeric_limits<uint64_t>::max() - base_address) {
BPLOG(ERROR) << "MinidumpMemoryList has a memory region problem, " <<
" region " << region_index << "/" << region_count <<
", " << HexString(base_address) << "+" <<
@ -2762,7 +2764,7 @@ MinidumpMemoryRegion* MinidumpMemoryList::GetMemoryRegionAtIndex(
MinidumpMemoryRegion* MinidumpMemoryList::GetMemoryRegionForAddress(
u_int64_t address) {
uint64_t address) {
if (!valid_) {
BPLOG(ERROR) << "Invalid MinidumpMemoryList for GetMemoryRegionForAddress";
return NULL;
@ -2828,7 +2830,7 @@ MinidumpException::~MinidumpException() {
}
bool MinidumpException::Read(u_int32_t expected_size) {
bool MinidumpException::Read(uint32_t expected_size) {
// Invalidate cached data.
delete context_;
context_ = NULL;
@ -2870,7 +2872,7 @@ bool MinidumpException::Read(u_int32_t expected_size) {
}
bool MinidumpException::GetThreadID(u_int32_t *thread_id) const {
bool MinidumpException::GetThreadID(uint32_t *thread_id) const {
BPLOG_IF(ERROR, !thread_id) << "MinidumpException::GetThreadID requires "
"|thread_id|";
assert(thread_id);
@ -2972,7 +2974,7 @@ MinidumpAssertion::~MinidumpAssertion() {
}
bool MinidumpAssertion::Read(u_int32_t expected_size) {
bool MinidumpAssertion::Read(uint32_t expected_size) {
// Invalidate cached data.
valid_ = false;
@ -2993,11 +2995,11 @@ bool MinidumpAssertion::Read(u_int32_t expected_size) {
// Since we don't have an explicit byte length for each string,
// we use UTF16codeunits to calculate word length, then derive byte
// length from that.
u_int32_t word_length = UTF16codeunits(assertion_.expression,
uint32_t word_length = UTF16codeunits(assertion_.expression,
sizeof(assertion_.expression));
if (word_length > 0) {
u_int32_t byte_length = word_length * 2;
vector<u_int16_t> expression_utf16(word_length);
uint32_t byte_length = word_length * 2;
vector<uint16_t> expression_utf16(word_length);
memcpy(&expression_utf16[0], &assertion_.expression[0], byte_length);
scoped_ptr<string> new_expression(UTF16ToUTF8(expression_utf16,
@ -3010,8 +3012,8 @@ bool MinidumpAssertion::Read(u_int32_t expected_size) {
word_length = UTF16codeunits(assertion_.function,
sizeof(assertion_.function));
if (word_length) {
u_int32_t byte_length = word_length * 2;
vector<u_int16_t> function_utf16(word_length);
uint32_t byte_length = word_length * 2;
vector<uint16_t> function_utf16(word_length);
memcpy(&function_utf16[0], &assertion_.function[0], byte_length);
scoped_ptr<string> new_function(UTF16ToUTF8(function_utf16,
minidump_->swap()));
@ -3023,8 +3025,8 @@ bool MinidumpAssertion::Read(u_int32_t expected_size) {
word_length = UTF16codeunits(assertion_.file,
sizeof(assertion_.file));
if (word_length > 0) {
u_int32_t byte_length = word_length * 2;
vector<u_int16_t> file_utf16(word_length);
uint32_t byte_length = word_length * 2;
vector<uint16_t> file_utf16(word_length);
memcpy(&file_utf16[0], &assertion_.file[0], byte_length);
scoped_ptr<string> new_file(UTF16ToUTF8(file_utf16,
minidump_->swap()));
@ -3080,7 +3082,7 @@ MinidumpSystemInfo::~MinidumpSystemInfo() {
}
bool MinidumpSystemInfo::Read(u_int32_t expected_size) {
bool MinidumpSystemInfo::Read(uint32_t expected_size) {
// Invalidate cached data.
delete csd_version_;
csd_version_ = NULL;
@ -3332,7 +3334,7 @@ MinidumpMiscInfo::MinidumpMiscInfo(Minidump* minidump)
}
bool MinidumpMiscInfo::Read(u_int32_t expected_size) {
bool MinidumpMiscInfo::Read(uint32_t expected_size) {
valid_ = false;
if (expected_size != MD_MISCINFO_SIZE &&
@ -3418,7 +3420,7 @@ MinidumpBreakpadInfo::MinidumpBreakpadInfo(Minidump* minidump)
}
bool MinidumpBreakpadInfo::Read(u_int32_t expected_size) {
bool MinidumpBreakpadInfo::Read(uint32_t expected_size) {
valid_ = false;
if (expected_size != sizeof(breakpad_info_)) {
@ -3443,7 +3445,7 @@ bool MinidumpBreakpadInfo::Read(u_int32_t expected_size) {
}
bool MinidumpBreakpadInfo::GetDumpThreadID(u_int32_t *thread_id) const {
bool MinidumpBreakpadInfo::GetDumpThreadID(uint32_t *thread_id) const {
BPLOG_IF(ERROR, !thread_id) << "MinidumpBreakpadInfo::GetDumpThreadID "
"requires |thread_id|";
assert(thread_id);
@ -3464,7 +3466,7 @@ bool MinidumpBreakpadInfo::GetDumpThreadID(u_int32_t *thread_id) const {
}
bool MinidumpBreakpadInfo::GetRequestingThreadID(u_int32_t *thread_id)
bool MinidumpBreakpadInfo::GetRequestingThreadID(uint32_t *thread_id)
const {
BPLOG_IF(ERROR, !thread_id) << "MinidumpBreakpadInfo::GetRequestingThreadID "
"requires |thread_id|";
@ -3525,7 +3527,7 @@ MinidumpMemoryInfo::MinidumpMemoryInfo(Minidump* minidump)
bool MinidumpMemoryInfo::IsExecutable() const {
u_int32_t protection =
uint32_t protection =
memory_info_.protection & MD_MEMORY_PROTECTION_ACCESS_MASK;
return protection == MD_MEMORY_PROTECT_EXECUTE ||
protection == MD_MEMORY_PROTECT_EXECUTE_READ ||
@ -3534,7 +3536,7 @@ bool MinidumpMemoryInfo::IsExecutable() const {
bool MinidumpMemoryInfo::IsWritable() const {
u_int32_t protection =
uint32_t protection =
memory_info_.protection & MD_MEMORY_PROTECTION_ACCESS_MASK;
return protection == MD_MEMORY_PROTECT_READWRITE ||
protection == MD_MEMORY_PROTECT_WRITECOPY ||
@ -3563,7 +3565,7 @@ bool MinidumpMemoryInfo::Read() {
// Check for base + size overflow or undersize.
if (memory_info_.region_size == 0 ||
memory_info_.region_size > numeric_limits<u_int64_t>::max() -
memory_info_.region_size > numeric_limits<uint64_t>::max() -
memory_info_.base_address) {
BPLOG(ERROR) << "MinidumpMemoryInfo has a memory region problem, " <<
HexString(memory_info_.base_address) << "+" <<
@ -3603,7 +3605,7 @@ void MinidumpMemoryInfo::Print() {
MinidumpMemoryInfoList::MinidumpMemoryInfoList(Minidump* minidump)
: MinidumpStream(minidump),
range_map_(new RangeMap<u_int64_t, unsigned int>()),
range_map_(new RangeMap<uint64_t, unsigned int>()),
infos_(NULL),
info_count_(0) {
}
@ -3615,7 +3617,7 @@ MinidumpMemoryInfoList::~MinidumpMemoryInfoList() {
}
bool MinidumpMemoryInfoList::Read(u_int32_t expected_size) {
bool MinidumpMemoryInfoList::Read(uint32_t expected_size) {
// Invalidate cached data.
delete infos_;
infos_ = NULL;
@ -3660,7 +3662,7 @@ bool MinidumpMemoryInfoList::Read(u_int32_t expected_size) {
}
if (header.number_of_entries >
numeric_limits<u_int32_t>::max() / sizeof(MDRawMemoryInfo)) {
numeric_limits<uint32_t>::max() / sizeof(MDRawMemoryInfo)) {
BPLOG(ERROR) << "MinidumpMemoryInfoList info count " <<
header.number_of_entries <<
" would cause multiplication overflow";
@ -3692,8 +3694,8 @@ bool MinidumpMemoryInfoList::Read(u_int32_t expected_size) {
return false;
}
u_int64_t base_address = info->GetBase();
u_int32_t region_size = info->GetSize();
uint64_t base_address = info->GetBase();
uint32_t region_size = info->GetSize();
if (!range_map_->StoreRange(base_address, region_size, index)) {
BPLOG(ERROR) << "MinidumpMemoryInfoList could not store"
@ -3733,7 +3735,7 @@ const MinidumpMemoryInfo* MinidumpMemoryInfoList::GetMemoryInfoAtIndex(
const MinidumpMemoryInfo* MinidumpMemoryInfoList::GetMemoryInfoForAddress(
u_int64_t address) const {
uint64_t address) const {
if (!valid_) {
BPLOG(ERROR) << "Invalid MinidumpMemoryInfoList for"
" GetMemoryInfoForAddress";
@ -3776,7 +3778,7 @@ void MinidumpMemoryInfoList::Print() {
//
u_int32_t Minidump::max_streams_ = 128;
uint32_t Minidump::max_streams_ = 128;
unsigned int Minidump::max_string_length_ = 1024;
@ -3834,7 +3836,7 @@ bool Minidump::Open() {
return true;
}
bool Minidump::GetContextCPUFlagsFromSystemInfo(u_int32_t *context_cpu_flags) {
bool Minidump::GetContextCPUFlagsFromSystemInfo(uint32_t *context_cpu_flags) {
// Initialize output parameters
*context_cpu_flags = 0;
@ -3924,7 +3926,7 @@ bool Minidump::Read() {
// classes don't know or need to know what CPU (or endianness) the
// minidump was produced on in order to parse it. Use the signature as
// a byte order marker.
u_int32_t signature_swapped = header_.signature;
uint32_t signature_swapped = header_.signature;
Swap(&signature_swapped);
if (signature_swapped != MD_HEADER_SIGNATURE) {
// This isn't a minidump or a byte-swapped minidump.
@ -4128,7 +4130,7 @@ void Minidump::Print() {
for (MinidumpStreamMap::const_iterator iterator = stream_map_->begin();
iterator != stream_map_->end();
++iterator) {
u_int32_t stream_type = iterator->first;
uint32_t stream_type = iterator->first;
MinidumpStreamInfo info = iterator->second;
printf(" stream type 0x%x at index %d\n", stream_type, info.stream_index);
}
@ -4210,7 +4212,7 @@ string* Minidump::ReadString(off_t offset) {
return NULL;
}
u_int32_t bytes;
uint32_t bytes;
if (!ReadBytes(&bytes, sizeof(bytes))) {
BPLOG(ERROR) << "ReadString could not read string size at offset " <<
offset;
@ -4233,7 +4235,7 @@ string* Minidump::ReadString(off_t offset) {
return NULL;
}
vector<u_int16_t> string_utf16(utf16_words);
vector<uint16_t> string_utf16(utf16_words);
if (utf16_words) {
if (!ReadBytes(&string_utf16[0], bytes)) {
@ -4247,8 +4249,8 @@ string* Minidump::ReadString(off_t offset) {
}
bool Minidump::SeekToStreamType(u_int32_t stream_type,
u_int32_t* stream_length) {
bool Minidump::SeekToStreamType(uint32_t stream_type,
uint32_t* stream_length) {
BPLOG_IF(ERROR, !stream_length) << "Minidump::SeekToStreamType requires "
"|stream_length|";
assert(stream_length);
@ -4292,7 +4294,7 @@ T* Minidump::GetStream(T** stream) {
// stream is a garbage parameter that's present only to account for C++'s
// inability to overload a method based solely on its return type.
const u_int32_t stream_type = T::kStreamType;
const uint32_t stream_type = T::kStreamType;
BPLOG_IF(ERROR, !stream) << "Minidump::GetStream type " << stream_type <<
" requires |stream|";
@ -4321,7 +4323,7 @@ T* Minidump::GetStream(T** stream) {
return *stream;
}
u_int32_t stream_length;
uint32_t stream_length;
if (!SeekToStreamType(stream_type, &stream_length)) {
BPLOG(ERROR) << "GetStream could not seek to stream type " << stream_type;
return NULL;

View file

@ -53,10 +53,10 @@ using google_breakpad::MinidumpMiscInfo;
using google_breakpad::MinidumpBreakpadInfo;
static void DumpRawStream(Minidump *minidump,
u_int32_t stream_type,
uint32_t stream_type,
const char *stream_name,
int *errors) {
u_int32_t length = 0;
uint32_t length = 0;
if (!minidump->SeekToStreamType(stream_type, &length)) {
return;
}
@ -78,7 +78,7 @@ static void DumpRawStream(Minidump *minidump,
size_t remaining = length - current_offset;
// Printf requires an int and direct casting from size_t results
// in compatibility warnings.
u_int32_t int_remaining = remaining;
uint32_t int_remaining = remaining;
printf("%.*s", int_remaining, &contents[current_offset]);
char *next_null = reinterpret_cast<char *>(
memchr(&contents[current_offset], 0, remaining));

View file

@ -87,9 +87,9 @@ ProcessResult MinidumpProcessor::Process(
bool has_cpu_info = GetCPUInfo(dump, &process_state->system_info_);
bool has_os_info = GetOSInfo(dump, &process_state->system_info_);
u_int32_t dump_thread_id = 0;
uint32_t dump_thread_id = 0;
bool has_dump_thread = false;
u_int32_t requesting_thread_id = 0;
uint32_t requesting_thread_id = 0;
bool has_requesting_thread = false;
MinidumpBreakpadInfo *breakpad_info = dump->GetBreakpadInfo();
@ -156,7 +156,7 @@ ProcessResult MinidumpProcessor::Process(
return PROCESS_ERROR_GETTING_THREAD;
}
u_int32_t thread_id;
uint32_t thread_id;
if (!thread->GetThreadID(&thread_id)) {
BPLOG(ERROR) << "Could not get thread ID for " << thread_string;
return PROCESS_ERROR_GETTING_THREAD_ID;
@ -450,7 +450,7 @@ bool MinidumpProcessor::GetOSInfo(Minidump *dump, SystemInfo *info) {
}
// static
string MinidumpProcessor::GetCrashReason(Minidump *dump, u_int64_t *address) {
string MinidumpProcessor::GetCrashReason(Minidump *dump, uint64_t *address) {
MinidumpException *exception = dump->GetException();
if (!exception)
return "";
@ -467,8 +467,8 @@ string MinidumpProcessor::GetCrashReason(Minidump *dump, u_int64_t *address) {
// map the codes to a string (because there's no system info, or because
// it's an unrecognized platform, or because it's an unrecognized code.)
char reason_string[24];
u_int32_t exception_code = raw_exception->exception_record.exception_code;
u_int32_t exception_flags = raw_exception->exception_record.exception_flags;
uint32_t exception_code = raw_exception->exception_record.exception_code;
uint32_t exception_flags = raw_exception->exception_record.exception_flags;
snprintf(reason_string, sizeof(reason_string), "0x%08x / 0x%08x",
exception_code, exception_flags);
string reason = reason_string;

View file

@ -84,7 +84,7 @@ class MockMinidumpThread : public MinidumpThread {
public:
MockMinidumpThread() : MinidumpThread(NULL) {}
MOCK_CONST_METHOD1(GetThreadID, bool(u_int32_t*));
MOCK_CONST_METHOD1(GetThreadID, bool(uint32_t*));
MOCK_METHOD0(GetContext, MinidumpContext*());
MOCK_METHOD0(GetMemory, MinidumpMemoryRegion*());
};
@ -93,24 +93,24 @@ class MockMinidumpThread : public MinidumpThread {
// MinidumpMemoryRegion.
class MockMinidumpMemoryRegion : public MinidumpMemoryRegion {
public:
MockMinidumpMemoryRegion(u_int64_t base, const string& contents) :
MockMinidumpMemoryRegion(uint64_t base, const string& contents) :
MinidumpMemoryRegion(NULL) {
region_.Init(base, contents);
}
u_int64_t GetBase() const { return region_.GetBase(); }
u_int32_t GetSize() const { return region_.GetSize(); }
uint64_t GetBase() const { return region_.GetBase(); }
uint32_t GetSize() const { return region_.GetSize(); }
bool GetMemoryAtAddress(u_int64_t address, u_int8_t *value) const {
bool GetMemoryAtAddress(uint64_t address, uint8_t *value) const {
return region_.GetMemoryAtAddress(address, value);
}
bool GetMemoryAtAddress(u_int64_t address, u_int16_t *value) const {
bool GetMemoryAtAddress(uint64_t address, uint16_t *value) const {
return region_.GetMemoryAtAddress(address, value);
}
bool GetMemoryAtAddress(u_int64_t address, u_int32_t *value) const {
bool GetMemoryAtAddress(uint64_t address, uint32_t *value) const {
return region_.GetMemoryAtAddress(address, value);
}
bool GetMemoryAtAddress(u_int64_t address, u_int64_t *value) const {
bool GetMemoryAtAddress(uint64_t address, uint64_t *value) const {
return region_.GetMemoryAtAddress(address, value);
}
@ -475,7 +475,7 @@ TEST_F(MinidumpProcessorTest, TestThreadMissingMemory) {
memset(&no_memory_thread_raw_context, 0,
sizeof(no_memory_thread_raw_context));
no_memory_thread_raw_context.context_flags = MD_CONTEXT_X86_FULL;
const u_int32_t kExpectedEIP = 0xabcd1234;
const uint32_t kExpectedEIP = 0xabcd1234;
no_memory_thread_raw_context.eip = kExpectedEIP;
TestMinidumpContext no_memory_thread_context(no_memory_thread_raw_context);
EXPECT_CALL(no_memory_thread, GetContext()).

View file

@ -84,7 +84,7 @@ static const char kOutputSeparator = '|';
// of registers is completely printed, regardless of the number of calls
// to PrintRegister.
static const int kMaxWidth = 80; // optimize for an 80-column terminal
static int PrintRegister(const char *name, u_int32_t value, int start_col) {
static int PrintRegister(const char *name, uint32_t value, int start_col) {
char buffer[64];
snprintf(buffer, sizeof(buffer), " %5s = 0x%08x", name, value);
@ -98,7 +98,7 @@ static int PrintRegister(const char *name, u_int32_t value, int start_col) {
}
// PrintRegister64 does the same thing, but for 64-bit registers.
static int PrintRegister64(const char *name, u_int64_t value, int start_col) {
static int PrintRegister64(const char *name, uint64_t value, int start_col) {
char buffer[64];
snprintf(buffer, sizeof(buffer), " %5s = 0x%016" PRIx64 , name, value);
@ -144,7 +144,7 @@ static void PrintStack(const CallStack *stack, const string &cpu) {
const StackFrame *frame = stack->frames()->at(frame_index);
printf("%2d ", frame_index);
u_int64_t instruction_address = frame->ReturnAddress();
uint64_t instruction_address = frame->ReturnAddress();
if (frame->module) {
printf("%s", PathnameStripper::File(frame->module->code_file()).c_str());
@ -288,7 +288,7 @@ static void PrintStackMachineReadable(int thread_num, const CallStack *stack) {
printf("%d%c%d%c", thread_num, kOutputSeparator, frame_index,
kOutputSeparator);
u_int64_t instruction_address = frame->ReturnAddress();
uint64_t instruction_address = frame->ReturnAddress();
if (frame->module) {
assert(!frame->module->code_file().empty());
@ -340,7 +340,7 @@ static void PrintModules(const CodeModules *modules) {
printf("\n");
printf("Loaded modules:\n");
u_int64_t main_address = 0;
uint64_t main_address = 0;
const CodeModule *main_module = modules->GetMainModule();
if (main_module) {
main_address = main_module->base_address();
@ -351,7 +351,7 @@ static void PrintModules(const CodeModules *modules) {
module_sequence < module_count;
++module_sequence) {
const CodeModule *module = modules->GetModuleAtSequence(module_sequence);
u_int64_t base_address = module->base_address();
uint64_t base_address = module->base_address();
printf("0x%08" PRIx64 " - 0x%08" PRIx64 " %s %s%s\n",
base_address, base_address + module->size() - 1,
PathnameStripper::File(module->code_file()).c_str(),
@ -370,7 +370,7 @@ static void PrintModulesMachineReadable(const CodeModules *modules) {
if (!modules)
return;
u_int64_t main_address = 0;
uint64_t main_address = 0;
const CodeModule *main_module = modules->GetMainModule();
if (main_module) {
main_address = main_module->base_address();
@ -381,7 +381,7 @@ static void PrintModulesMachineReadable(const CodeModules *modules) {
module_sequence < module_count;
++module_sequence) {
const CodeModule *module = modules->GetModuleAtSequence(module_sequence);
u_int64_t base_address = module->base_address();
uint64_t base_address = module->base_address();
printf("Module%c%s%c%s%c%s%c%s%c0x%08" PRIx64 "%c0x%08" PRIx64 "%c%d\n",
kOutputSeparator,
StripSeparator(PathnameStripper::File(module->code_file())).c_str(),

View file

@ -89,7 +89,7 @@ TEST_F(MinidumpTest, TestMinidumpFromFile) {
ASSERT_TRUE(minidump.Read());
const MDRawHeader* header = minidump.header();
ASSERT_NE(header, (MDRawHeader*)NULL);
ASSERT_EQ(header->signature, u_int32_t(MD_HEADER_SIGNATURE));
ASSERT_EQ(header->signature, uint32_t(MD_HEADER_SIGNATURE));
//TODO: add more checks here
}
@ -115,7 +115,7 @@ TEST_F(MinidumpTest, TestMinidumpFromStream) {
ASSERT_TRUE(minidump.Read());
const MDRawHeader* header = minidump.header();
ASSERT_NE(header, (MDRawHeader*)NULL);
ASSERT_EQ(header->signature, u_int32_t(MD_HEADER_SIGNATURE));
ASSERT_EQ(header->signature, uint32_t(MD_HEADER_SIGNATURE));
//TODO: add more checks here
}
@ -159,7 +159,7 @@ TEST(Dump, OneStream) {
ASSERT_TRUE(dir != NULL);
EXPECT_EQ(0xfbb7fa2bU, dir->stream_type);
u_int32_t stream_length;
uint32_t stream_length;
ASSERT_TRUE(minidump.SeekToStreamType(0xfbb7fa2bU, &stream_length));
ASSERT_EQ(15U, stream_length);
char stream_contents[15];
@ -193,7 +193,7 @@ TEST(Dump, OneMemory) {
const MDRawDirectory *dir = minidump.GetDirectoryEntryAtIndex(0);
ASSERT_TRUE(dir != NULL);
EXPECT_EQ((u_int32_t) MD_MEMORY_LIST_STREAM, dir->stream_type);
EXPECT_EQ((uint32_t) MD_MEMORY_LIST_STREAM, dir->stream_type);
MinidumpMemoryList *memory_list = minidump.GetMemoryList();
ASSERT_TRUE(memory_list != NULL);
@ -202,7 +202,7 @@ TEST(Dump, OneMemory) {
MinidumpMemoryRegion *region1 = memory_list->GetMemoryRegionAtIndex(0);
ASSERT_EQ(0x309d68010bd21b2cULL, region1->GetBase());
ASSERT_EQ(15U, region1->GetSize());
const u_int8_t *region1_bytes = region1->GetMemory();
const uint8_t *region1_bytes = region1->GetMemory();
ASSERT_TRUE(memcmp("memory contents", region1_bytes, 15) == 0);
}
@ -213,7 +213,7 @@ TEST(Dump, OneThread) {
stack.Append("stack for thread");
MDRawContextX86 raw_context;
const u_int32_t kExpectedEIP = 0x6913f540;
const uint32_t kExpectedEIP = 0x6913f540;
raw_context.context_flags = MD_CONTEXT_X86_INTEGER | MD_CONTEXT_X86_CONTROL;
raw_context.edi = 0x3ecba80d;
raw_context.esi = 0x382583b9;
@ -252,7 +252,7 @@ TEST(Dump, OneThread) {
MinidumpMemoryRegion *md_region = md_memory_list->GetMemoryRegionAtIndex(0);
ASSERT_EQ(0x2326a0faU, md_region->GetBase());
ASSERT_EQ(16U, md_region->GetSize());
const u_int8_t *region_bytes = md_region->GetMemory();
const uint8_t *region_bytes = md_region->GetMemory();
ASSERT_TRUE(memcmp("stack for thread", region_bytes, 16) == 0);
MinidumpThreadList *thread_list = minidump.GetThreadList();
@ -261,27 +261,27 @@ TEST(Dump, OneThread) {
MinidumpThread *md_thread = thread_list->GetThreadAtIndex(0);
ASSERT_TRUE(md_thread != NULL);
u_int32_t thread_id;
uint32_t thread_id;
ASSERT_TRUE(md_thread->GetThreadID(&thread_id));
ASSERT_EQ(0xa898f11bU, thread_id);
MinidumpMemoryRegion *md_stack = md_thread->GetMemory();
ASSERT_TRUE(md_stack != NULL);
ASSERT_EQ(0x2326a0faU, md_stack->GetBase());
ASSERT_EQ(16U, md_stack->GetSize());
const u_int8_t *md_stack_bytes = md_stack->GetMemory();
const uint8_t *md_stack_bytes = md_stack->GetMemory();
ASSERT_TRUE(memcmp("stack for thread", md_stack_bytes, 16) == 0);
MinidumpContext *md_context = md_thread->GetContext();
ASSERT_TRUE(md_context != NULL);
ASSERT_EQ((u_int32_t) MD_CONTEXT_X86, md_context->GetContextCPU());
ASSERT_EQ((uint32_t) MD_CONTEXT_X86, md_context->GetContextCPU());
u_int64_t eip;
uint64_t eip;
ASSERT_TRUE(md_context->GetInstructionPointer(&eip));
EXPECT_EQ(kExpectedEIP, eip);
const MDRawContextX86 *md_raw_context = md_context->GetContextX86();
ASSERT_TRUE(md_raw_context != NULL);
ASSERT_EQ((u_int32_t) (MD_CONTEXT_X86_INTEGER | MD_CONTEXT_X86_CONTROL),
ASSERT_EQ((uint32_t) (MD_CONTEXT_X86_INTEGER | MD_CONTEXT_X86_CONTROL),
(md_raw_context->context_flags
& (MD_CONTEXT_X86_INTEGER | MD_CONTEXT_X86_CONTROL)));
EXPECT_EQ(0x3ecba80dU, raw_context.edi);
@ -332,7 +332,7 @@ TEST(Dump, ThreadMissingMemory) {
MinidumpThread* md_thread = thread_list->GetThreadAtIndex(0);
ASSERT_TRUE(md_thread != NULL);
u_int32_t thread_id;
uint32_t thread_id;
ASSERT_TRUE(md_thread->GetThreadID(&thread_id));
ASSERT_EQ(0xa898f11bU, thread_id);
@ -375,7 +375,7 @@ TEST(Dump, ThreadMissingContext) {
MinidumpThread* md_thread = thread_list->GetThreadAtIndex(0);
ASSERT_TRUE(md_thread != NULL);
u_int32_t thread_id;
uint32_t thread_id;
ASSERT_TRUE(md_thread->GetThreadID(&thread_id));
ASSERT_EQ(0xa898f11bU, thread_id);
MinidumpMemoryRegion* md_stack = md_thread->GetMemory();
@ -424,7 +424,7 @@ TEST(Dump, OneModule) {
const MDRawDirectory *dir = minidump.GetDirectoryEntryAtIndex(0);
ASSERT_TRUE(dir != NULL);
EXPECT_EQ((u_int32_t) MD_MODULE_LIST_STREAM, dir->stream_type);
EXPECT_EQ((uint32_t) MD_MODULE_LIST_STREAM, dir->stream_type);
MinidumpModuleList *md_module_list = minidump.GetModuleList();
ASSERT_TRUE(md_module_list != NULL);
@ -462,7 +462,7 @@ TEST(Dump, OneSystemInfo) {
const MDRawDirectory *dir = minidump.GetDirectoryEntryAtIndex(0);
ASSERT_TRUE(dir != NULL);
EXPECT_EQ((u_int32_t) MD_SYSTEM_INFO_STREAM, dir->stream_type);
EXPECT_EQ((uint32_t) MD_SYSTEM_INFO_STREAM, dir->stream_type);
MinidumpSystemInfo *md_system_info = minidump.GetSystemInfo();
ASSERT_TRUE(md_system_info != NULL);
@ -576,7 +576,7 @@ TEST(Dump, BigDump) {
MinidumpThreadList *thread_list = minidump.GetThreadList();
ASSERT_TRUE(thread_list != NULL);
ASSERT_EQ(5U, thread_list->thread_count());
u_int32_t thread_id;
uint32_t thread_id;
ASSERT_TRUE(thread_list->GetThreadAtIndex(0)->GetThreadID(&thread_id));
ASSERT_EQ(0xbbef4432U, thread_id);
ASSERT_EQ(0x70b9ebfcU,
@ -634,15 +634,15 @@ TEST(Dump, OneMemoryInfo) {
Stream stream(dump, MD_MEMORY_INFO_LIST_STREAM);
// Add the MDRawMemoryInfoList header.
const u_int64_t kNumberOfEntries = 1;
const uint64_t kNumberOfEntries = 1;
stream.D32(sizeof(MDRawMemoryInfoList)) // size_of_header
.D32(sizeof(MDRawMemoryInfo)) // size_of_entry
.D64(kNumberOfEntries); // number_of_entries
// Now add a MDRawMemoryInfo entry.
const u_int64_t kBaseAddress = 0x1000;
const u_int64_t kRegionSize = 0x2000;
const uint64_t kBaseAddress = 0x1000;
const uint64_t kRegionSize = 0x2000;
stream.D64(kBaseAddress) // base_address
.D64(kBaseAddress) // allocation_base
.D32(MD_MEMORY_PROTECT_EXECUTE_READWRITE) // allocation_protection
@ -665,7 +665,7 @@ TEST(Dump, OneMemoryInfo) {
const MDRawDirectory *dir = minidump.GetDirectoryEntryAtIndex(0);
ASSERT_TRUE(dir != NULL);
EXPECT_EQ((u_int32_t) MD_MEMORY_INFO_LIST_STREAM, dir->stream_type);
EXPECT_EQ((uint32_t) MD_MEMORY_INFO_LIST_STREAM, dir->stream_type);
MinidumpMemoryInfoList *info_list = minidump.GetMemoryInfoList();
ASSERT_TRUE(info_list != NULL);
@ -724,7 +724,7 @@ TEST(Dump, OneExceptionX86) {
MinidumpException *md_exception = minidump.GetException();
ASSERT_TRUE(md_exception != NULL);
u_int32_t thread_id;
uint32_t thread_id;
ASSERT_TRUE(md_exception->GetThreadID(&thread_id));
ASSERT_EQ(0x1234abcdU, thread_id);
@ -737,10 +737,10 @@ TEST(Dump, OneExceptionX86) {
MinidumpContext *md_context = md_exception->GetContext();
ASSERT_TRUE(md_context != NULL);
ASSERT_EQ((u_int32_t) MD_CONTEXT_X86, md_context->GetContextCPU());
ASSERT_EQ((uint32_t) MD_CONTEXT_X86, md_context->GetContextCPU());
const MDRawContextX86 *md_raw_context = md_context->GetContextX86();
ASSERT_TRUE(md_raw_context != NULL);
ASSERT_EQ((u_int32_t) (MD_CONTEXT_X86_INTEGER | MD_CONTEXT_X86_CONTROL),
ASSERT_EQ((uint32_t) (MD_CONTEXT_X86_INTEGER | MD_CONTEXT_X86_CONTROL),
(md_raw_context->context_flags
& (MD_CONTEXT_X86_INTEGER | MD_CONTEXT_X86_CONTROL)));
EXPECT_EQ(0x3ecba80dU, raw_context.edi);
@ -798,7 +798,7 @@ TEST(Dump, OneExceptionX86XState) {
MinidumpException *md_exception = minidump.GetException();
ASSERT_TRUE(md_exception != NULL);
u_int32_t thread_id;
uint32_t thread_id;
ASSERT_TRUE(md_exception->GetThreadID(&thread_id));
ASSERT_EQ(0x1234abcdU, thread_id);
@ -811,10 +811,10 @@ TEST(Dump, OneExceptionX86XState) {
MinidumpContext *md_context = md_exception->GetContext();
ASSERT_TRUE(md_context != NULL);
ASSERT_EQ((u_int32_t) MD_CONTEXT_X86, md_context->GetContextCPU());
ASSERT_EQ((uint32_t) MD_CONTEXT_X86, md_context->GetContextCPU());
const MDRawContextX86 *md_raw_context = md_context->GetContextX86();
ASSERT_TRUE(md_raw_context != NULL);
ASSERT_EQ((u_int32_t) (MD_CONTEXT_X86_INTEGER | MD_CONTEXT_X86_CONTROL),
ASSERT_EQ((uint32_t) (MD_CONTEXT_X86_INTEGER | MD_CONTEXT_X86_CONTROL),
(md_raw_context->context_flags
& (MD_CONTEXT_X86_INTEGER | MD_CONTEXT_X86_CONTROL)));
EXPECT_EQ(0x3ecba80dU, raw_context.edi);
@ -883,7 +883,7 @@ TEST(Dump, OneExceptionX86NoCPUFlags) {
MinidumpException *md_exception = minidump.GetException();
ASSERT_TRUE(md_exception != NULL);
u_int32_t thread_id;
uint32_t thread_id;
ASSERT_TRUE(md_exception->GetThreadID(&thread_id));
ASSERT_EQ(0x1234abcdU, thread_id);
@ -897,14 +897,14 @@ TEST(Dump, OneExceptionX86NoCPUFlags) {
MinidumpContext *md_context = md_exception->GetContext();
ASSERT_TRUE(md_context != NULL);
ASSERT_EQ((u_int32_t) MD_CONTEXT_X86, md_context->GetContextCPU());
ASSERT_EQ((uint32_t) MD_CONTEXT_X86, md_context->GetContextCPU());
const MDRawContextX86 *md_raw_context = md_context->GetContextX86();
ASSERT_TRUE(md_raw_context != NULL);
// Even though the CPU flags were missing from the context_flags, the
// GetContext call above is expected to load the missing CPU flags from the
// system info stream and set the CPU type bits in context_flags.
ASSERT_EQ((u_int32_t) (MD_CONTEXT_X86), md_raw_context->context_flags);
ASSERT_EQ((uint32_t) (MD_CONTEXT_X86), md_raw_context->context_flags);
EXPECT_EQ(0x3ecba80dU, raw_context.edi);
EXPECT_EQ(0x382583b9U, raw_context.esi);
@ -965,7 +965,7 @@ TEST(Dump, OneExceptionX86NoCPUFlagsNoSystemInfo) {
MinidumpException *md_exception = minidump.GetException();
ASSERT_TRUE(md_exception != NULL);
u_int32_t thread_id;
uint32_t thread_id;
ASSERT_TRUE(md_exception->GetThreadID(&thread_id));
ASSERT_EQ(0x1234abcdU, thread_id);
@ -1028,7 +1028,7 @@ TEST(Dump, OneExceptionARM) {
MinidumpException *md_exception = minidump.GetException();
ASSERT_TRUE(md_exception != NULL);
u_int32_t thread_id;
uint32_t thread_id;
ASSERT_TRUE(md_exception->GetThreadID(&thread_id));
ASSERT_EQ(0x1234abcdU, thread_id);
@ -1041,10 +1041,10 @@ TEST(Dump, OneExceptionARM) {
MinidumpContext *md_context = md_exception->GetContext();
ASSERT_TRUE(md_context != NULL);
ASSERT_EQ((u_int32_t) MD_CONTEXT_ARM, md_context->GetContextCPU());
ASSERT_EQ((uint32_t) MD_CONTEXT_ARM, md_context->GetContextCPU());
const MDRawContextARM *md_raw_context = md_context->GetContextARM();
ASSERT_TRUE(md_raw_context != NULL);
ASSERT_EQ((u_int32_t) MD_CONTEXT_ARM_INTEGER,
ASSERT_EQ((uint32_t) MD_CONTEXT_ARM_INTEGER,
(md_raw_context->context_flags
& MD_CONTEXT_ARM_INTEGER));
EXPECT_EQ(0x3ecba80dU, raw_context.iregs[0]);
@ -1112,7 +1112,7 @@ TEST(Dump, OneExceptionARMOldFlags) {
MinidumpException *md_exception = minidump.GetException();
ASSERT_TRUE(md_exception != NULL);
u_int32_t thread_id;
uint32_t thread_id;
ASSERT_TRUE(md_exception->GetThreadID(&thread_id));
ASSERT_EQ(0x1234abcdU, thread_id);
@ -1125,10 +1125,10 @@ TEST(Dump, OneExceptionARMOldFlags) {
MinidumpContext *md_context = md_exception->GetContext();
ASSERT_TRUE(md_context != NULL);
ASSERT_EQ((u_int32_t) MD_CONTEXT_ARM, md_context->GetContextCPU());
ASSERT_EQ((uint32_t) MD_CONTEXT_ARM, md_context->GetContextCPU());
const MDRawContextARM *md_raw_context = md_context->GetContextARM();
ASSERT_TRUE(md_raw_context != NULL);
ASSERT_EQ((u_int32_t) MD_CONTEXT_ARM_INTEGER,
ASSERT_EQ((uint32_t) MD_CONTEXT_ARM_INTEGER,
(md_raw_context->context_flags
& MD_CONTEXT_ARM_INTEGER));
EXPECT_EQ(0x3ecba80dU, raw_context.iregs[0]);

View file

@ -65,7 +65,7 @@ size_t ModuleSerializer::SizeOf(const BasicSourceLineResolver::Module &module) {
module.cfi_delta_rules_);
// Header size.
total_size_alloc_ = kNumberMaps_ * sizeof(u_int32_t);
total_size_alloc_ = kNumberMaps_ * sizeof(uint32_t);
for (int i = 0; i < kNumberMaps_; ++i)
total_size_alloc_ += map_sizes_[i];
@ -79,8 +79,8 @@ size_t ModuleSerializer::SizeOf(const BasicSourceLineResolver::Module &module) {
char *ModuleSerializer::Write(const BasicSourceLineResolver::Module &module,
char *dest) {
// Write header.
memcpy(dest, map_sizes_, kNumberMaps_ * sizeof(u_int32_t));
dest += kNumberMaps_ * sizeof(u_int32_t);
memcpy(dest, map_sizes_, kNumberMaps_ * sizeof(uint32_t));
dest += kNumberMaps_ * sizeof(uint32_t);
// Write each map.
dest = files_serializer_.Write(module.files_, dest);
dest = functions_serializer_.Write(module.functions_, dest);

View file

@ -110,7 +110,7 @@ class ModuleSerializer {
FastSourceLineResolver::Module::kNumberMaps_;
// Memory sizes required to serialize map components in Module.
u_int32_t map_sizes_[kNumberMaps_];
uint32_t map_sizes_[kNumberMaps_];
// Serializers for each individual map component in Module class.
StdMapSerializer<int, string> files_serializer_;

View file

@ -57,21 +57,21 @@ using google_breakpad::PostfixEvaluator;
// the value.
class FakeMemoryRegion : public MemoryRegion {
public:
virtual u_int64_t GetBase() const { return 0; }
virtual u_int32_t GetSize() const { return 0; }
virtual bool GetMemoryAtAddress(u_int64_t address, u_int8_t *value) const {
virtual uint64_t GetBase() const { return 0; }
virtual uint32_t GetSize() const { return 0; }
virtual bool GetMemoryAtAddress(uint64_t address, uint8_t *value) const {
*value = address + 1;
return true;
}
virtual bool GetMemoryAtAddress(u_int64_t address, u_int16_t *value) const {
virtual bool GetMemoryAtAddress(uint64_t address, uint16_t *value) const {
*value = address + 1;
return true;
}
virtual bool GetMemoryAtAddress(u_int64_t address, u_int32_t *value) const {
virtual bool GetMemoryAtAddress(uint64_t address, uint32_t *value) const {
*value = address + 1;
return true;
}
virtual bool GetMemoryAtAddress(u_int64_t address, u_int64_t *value) const {
virtual bool GetMemoryAtAddress(uint64_t address, uint64_t *value) const {
*value = address + 1;
return true;
}

View file

@ -134,12 +134,12 @@ class SimpleSerializer<WindowsFrameInfo> {
unsigned int size = 0;
size += sizeof(int32_t); // wfi.type_
size += SimpleSerializer<int32_t>::SizeOf(wfi.valid);
size += SimpleSerializer<u_int32_t>::SizeOf(wfi.prolog_size);
size += SimpleSerializer<u_int32_t>::SizeOf(wfi.epilog_size);
size += SimpleSerializer<u_int32_t>::SizeOf(wfi.parameter_size);
size += SimpleSerializer<u_int32_t>::SizeOf(wfi.saved_register_size);
size += SimpleSerializer<u_int32_t>::SizeOf(wfi.local_size);
size += SimpleSerializer<u_int32_t>::SizeOf(wfi.max_stack_size);
size += SimpleSerializer<uint32_t>::SizeOf(wfi.prolog_size);
size += SimpleSerializer<uint32_t>::SizeOf(wfi.epilog_size);
size += SimpleSerializer<uint32_t>::SizeOf(wfi.parameter_size);
size += SimpleSerializer<uint32_t>::SizeOf(wfi.saved_register_size);
size += SimpleSerializer<uint32_t>::SizeOf(wfi.local_size);
size += SimpleSerializer<uint32_t>::SizeOf(wfi.max_stack_size);
size += SimpleSerializer<bool>::SizeOf(wfi.allocates_base_pointer);
size += SimpleSerializer<string>::SizeOf(wfi.program_string);
return size;
@ -148,12 +148,12 @@ class SimpleSerializer<WindowsFrameInfo> {
dest = SimpleSerializer<int32_t>::Write(
static_cast<const int32_t>(wfi.type_), dest);
dest = SimpleSerializer<int32_t>::Write(wfi.valid, dest);
dest = SimpleSerializer<u_int32_t>::Write(wfi.prolog_size, dest);
dest = SimpleSerializer<u_int32_t>::Write(wfi.epilog_size, dest);
dest = SimpleSerializer<u_int32_t>::Write(wfi.parameter_size, dest);
dest = SimpleSerializer<u_int32_t>::Write(wfi.saved_register_size, dest);
dest = SimpleSerializer<u_int32_t>::Write(wfi.local_size, dest);
dest = SimpleSerializer<u_int32_t>::Write(wfi.max_stack_size, dest);
dest = SimpleSerializer<uint32_t>::Write(wfi.prolog_size, dest);
dest = SimpleSerializer<uint32_t>::Write(wfi.epilog_size, dest);
dest = SimpleSerializer<uint32_t>::Write(wfi.parameter_size, dest);
dest = SimpleSerializer<uint32_t>::Write(wfi.saved_register_size, dest);
dest = SimpleSerializer<uint32_t>::Write(wfi.local_size, dest);
dest = SimpleSerializer<uint32_t>::Write(wfi.max_stack_size, dest);
dest = SimpleSerializer<bool>::Write(wfi.allocates_base_pointer, dest);
return SimpleSerializer<string>::Write(wfi.program_string, dest);
}

View file

@ -38,11 +38,11 @@
#ifndef PROCESSOR_SIMPLE_SERIALIZER_H__
#define PROCESSOR_SIMPLE_SERIALIZER_H__
#include <sys/types.h>
#include "google_breakpad/common/breakpad_types.h"
namespace google_breakpad {
typedef u_int64_t MemAddr;
typedef uint64_t MemAddr;
// Default implementation of SimpleSerializer template.
// Specializations are defined in "simple_serializer-inl.h".

View file

@ -56,7 +56,7 @@
namespace google_breakpad {
const int Stackwalker::kRASearchWords = 30;
u_int32_t Stackwalker::max_frames_ = 1024;
uint32_t Stackwalker::max_frames_ = 1024;
Stackwalker::Stackwalker(const SystemInfo* system_info,
MemoryRegion* memory,
@ -125,7 +125,7 @@ Stackwalker* Stackwalker::StackwalkerForCPU(
Stackwalker* cpu_stackwalker = NULL;
u_int32_t cpu = context->GetContextCPU();
uint32_t cpu = context->GetContextCPU();
switch (cpu) {
case MD_CONTEXT_X86:
cpu_stackwalker = new StackwalkerX86(system_info,
@ -168,7 +168,7 @@ Stackwalker* Stackwalker::StackwalkerForCPU(
return cpu_stackwalker;
}
bool Stackwalker::InstructionAddressSeemsValid(u_int64_t address) {
bool Stackwalker::InstructionAddressSeemsValid(uint64_t address) {
StackFrame frame;
frame.instruction = address;
StackFrameSymbolizer::SymbolizerResult symbolizer_result =

View file

@ -101,7 +101,7 @@ StackwalkerAMD64::StackwalkerAMD64(const SystemInfo* system_info,
(sizeof(cfi_register_map_) / sizeof(cfi_register_map_[0]))) {
}
u_int64_t StackFrameAMD64::ReturnAddress() const
uint64_t StackFrameAMD64::ReturnAddress() const
{
assert(context_validity & StackFrameAMD64::CONTEXT_VALID_RIP);
return context.rip;
@ -150,8 +150,8 @@ StackFrameAMD64* StackwalkerAMD64::GetCallerByCFIFrameInfo(
StackFrameAMD64* StackwalkerAMD64::GetCallerByStackScan(
const vector<StackFrame*> &frames) {
StackFrameAMD64* last_frame = static_cast<StackFrameAMD64*>(frames.back());
u_int64_t last_rsp = last_frame->context.rsp;
u_int64_t caller_rip_address, caller_rip;
uint64_t last_rsp = last_frame->context.rsp;
uint64_t caller_rip_address, caller_rip;
if (!ScanForReturnAddress(last_rsp, &caller_rip_address, &caller_rip)) {
// No plausible return address was found.
@ -179,7 +179,7 @@ StackFrameAMD64* StackwalkerAMD64::GetCallerByStackScan(
// pointing to the first word below the alleged return address, presume
// that the caller's %rbp is saved there.
if (caller_rip_address - 8 == last_frame->context.rbp) {
u_int64_t caller_rbp = 0;
uint64_t caller_rbp = 0;
if (memory_->GetMemoryAtAddress(last_frame->context.rbp, &caller_rbp) &&
caller_rbp > caller_rip_address) {
frame->context.rbp = caller_rbp;

View file

@ -64,7 +64,7 @@ class StackwalkerAMD64 : public Stackwalker {
private:
// A STACK CFI-driven frame walker for the AMD64
typedef SimpleCFIWalker<u_int64_t, MDRawContextAMD64> CFIWalker;
typedef SimpleCFIWalker<uint64_t, MDRawContextAMD64> CFIWalker;
// Implementation of Stackwalker, using amd64 context (stack pointer in %rsp,
// stack base in %rbp) and stack conventions (saved stack pointer at 0(%rbp))

View file

@ -109,9 +109,9 @@ class StackwalkerAMD64Fixture {
// Fill RAW_CONTEXT with pseudo-random data, for round-trip checking.
void BrandContext(MDRawContextAMD64 *raw_context) {
u_int8_t x = 173;
uint8_t x = 173;
for (size_t i = 0; i < sizeof(*raw_context); i++)
reinterpret_cast<u_int8_t *>(raw_context)[i] = (x += 17);
reinterpret_cast<uint8_t *>(raw_context)[i] = (x += 17);
}
SystemInfo system_info;
@ -199,8 +199,8 @@ TEST_F(GetCallerFrame, ScanWithoutSymbols) {
// Force scanning through three frames to ensure that the
// stack pointer is set properly in scan-recovered frames.
stack_section.start() = 0x8000000080000000ULL;
u_int64_t return_address1 = 0x50000000b0000100ULL;
u_int64_t return_address2 = 0x50000000b0000900ULL;
uint64_t return_address1 = 0x50000000b0000100ULL;
uint64_t return_address2 = 0x50000000b0000900ULL;
Label frame1_sp, frame2_sp, frame1_rbp;
stack_section
// frame 0
@ -270,7 +270,7 @@ TEST_F(GetCallerFrame, ScanWithFunctionSymbols) {
// it is only considered a valid return address if it
// lies within a function's bounds.
stack_section.start() = 0x8000000080000000ULL;
u_int64_t return_address = 0x50000000b0000110ULL;
uint64_t return_address = 0x50000000b0000110ULL;
Label frame1_sp, frame1_rbp;
stack_section
@ -333,7 +333,7 @@ TEST_F(GetCallerFrame, CallerPushedRBP) {
// %rbp directly below the return address, assume that it is indeed the
// next frame's %rbp.
stack_section.start() = 0x8000000080000000ULL;
u_int64_t return_address = 0x50000000b0000110ULL;
uint64_t return_address = 0x50000000b0000110ULL;
Label frame0_rbp, frame1_sp, frame1_rbp;
stack_section

View file

@ -90,13 +90,13 @@ StackFrameARM* StackwalkerARM::GetCallerByCFIFrameInfo(
};
// Populate a dictionary with the valid register values in last_frame.
CFIFrameInfo::RegisterValueMap<u_int32_t> callee_registers;
CFIFrameInfo::RegisterValueMap<uint32_t> callee_registers;
for (int i = 0; register_names[i]; i++)
if (last_frame->context_validity & StackFrameARM::RegisterValidFlag(i))
callee_registers[register_names[i]] = last_frame->context.iregs[i];
// Use the STACK CFI data to recover the caller's register values.
CFIFrameInfo::RegisterValueMap<u_int32_t> caller_registers;
CFIFrameInfo::RegisterValueMap<uint32_t> caller_registers;
if (!cfi_frame_info->FindCallerRegs(callee_registers, *memory_,
&caller_registers))
return NULL;
@ -104,7 +104,7 @@ StackFrameARM* StackwalkerARM::GetCallerByCFIFrameInfo(
// Construct a new stack frame given the values the CFI recovered.
scoped_ptr<StackFrameARM> frame(new StackFrameARM());
for (int i = 0; register_names[i]; i++) {
CFIFrameInfo::RegisterValueMap<u_int32_t>::iterator entry =
CFIFrameInfo::RegisterValueMap<uint32_t>::iterator entry =
caller_registers.find(register_names[i]);
if (entry != caller_registers.end()) {
// We recovered the value of this register; fill the context with the
@ -123,7 +123,7 @@ StackFrameARM* StackwalkerARM::GetCallerByCFIFrameInfo(
}
// If the CFI doesn't recover the PC explicitly, then use .ra.
if (!(frame->context_validity & StackFrameARM::CONTEXT_VALID_PC)) {
CFIFrameInfo::RegisterValueMap<u_int32_t>::iterator entry =
CFIFrameInfo::RegisterValueMap<uint32_t>::iterator entry =
caller_registers.find(".ra");
if (entry != caller_registers.end()) {
if (fp_register_ == -1) {
@ -142,7 +142,7 @@ StackFrameARM* StackwalkerARM::GetCallerByCFIFrameInfo(
}
// If the CFI doesn't recover the SP explicitly, then use .cfa.
if (!(frame->context_validity & StackFrameARM::CONTEXT_VALID_SP)) {
CFIFrameInfo::RegisterValueMap<u_int32_t>::iterator entry =
CFIFrameInfo::RegisterValueMap<uint32_t>::iterator entry =
caller_registers.find(".cfa");
if (entry != caller_registers.end()) {
frame->context_validity |= StackFrameARM::CONTEXT_VALID_SP;
@ -163,8 +163,8 @@ StackFrameARM* StackwalkerARM::GetCallerByCFIFrameInfo(
StackFrameARM* StackwalkerARM::GetCallerByStackScan(
const vector<StackFrame*> &frames) {
StackFrameARM* last_frame = static_cast<StackFrameARM*>(frames.back());
u_int32_t last_sp = last_frame->context.iregs[MD_CONTEXT_ARM_REG_SP];
u_int32_t caller_sp, caller_pc;
uint32_t last_sp = last_frame->context.iregs[MD_CONTEXT_ARM_REG_SP];
uint32_t caller_sp, caller_pc;
// When searching for the caller of the context frame,
// allow the scanner to look farther down the stack.
@ -206,23 +206,23 @@ StackFrameARM* StackwalkerARM::GetCallerByFramePointer(
return NULL;
}
u_int32_t last_fp = last_frame->context.iregs[fp_register_];
uint32_t last_fp = last_frame->context.iregs[fp_register_];
u_int32_t caller_fp = 0;
uint32_t caller_fp = 0;
if (last_fp && !memory_->GetMemoryAtAddress(last_fp, &caller_fp)) {
BPLOG(ERROR) << "Unable to read caller_fp from last_fp: 0x"
<< std::hex << last_fp;
return NULL;
}
u_int32_t caller_lr = 0;
uint32_t caller_lr = 0;
if (last_fp && !memory_->GetMemoryAtAddress(last_fp + 4, &caller_lr)) {
BPLOG(ERROR) << "Unable to read caller_lr from last_fp + 4: 0x"
<< std::hex << (last_fp + 4);
return NULL;
}
u_int32_t caller_sp = last_fp ? last_fp + 8 :
uint32_t caller_sp = last_fp ? last_fp + 8 :
last_frame->context.iregs[MD_CONTEXT_ARM_REG_SP];
// Create a new stack frame (ownership will be transferred to the caller)

View file

@ -111,9 +111,9 @@ class StackwalkerARMFixture {
// Fill RAW_CONTEXT with pseudo-random data, for round-trip checking.
void BrandContext(MDRawContextARM *raw_context) {
u_int8_t x = 173;
uint8_t x = 173;
for (size_t i = 0; i < sizeof(*raw_context); i++)
reinterpret_cast<u_int8_t *>(raw_context)[i] = (x += 17);
reinterpret_cast<uint8_t *>(raw_context)[i] = (x += 17);
}
SystemInfo system_info;
@ -190,8 +190,8 @@ TEST_F(GetCallerFrame, ScanWithoutSymbols) {
// Force scanning through three frames to ensure that the
// stack pointer is set properly in scan-recovered frames.
stack_section.start() = 0x80000000;
u_int32_t return_address1 = 0x50000100;
u_int32_t return_address2 = 0x50000900;
uint32_t return_address1 = 0x50000100;
uint32_t return_address2 = 0x50000900;
Label frame1_sp, frame2_sp;
stack_section
// frame 0
@ -252,7 +252,7 @@ TEST_F(GetCallerFrame, ScanWithFunctionSymbols) {
// it is only considered a valid return address if it
// lies within a function's bounds.
stack_section.start() = 0x80000000;
u_int32_t return_address = 0x50000200;
uint32_t return_address = 0x50000200;
Label frame1_sp;
stack_section
@ -310,8 +310,8 @@ TEST_F(GetCallerFrame, ScanFirstFrame) {
// If the stackwalker resorts to stack scanning, it will scan much
// farther to find the caller of the context frame.
stack_section.start() = 0x80000000;
u_int32_t return_address1 = 0x50000100;
u_int32_t return_address2 = 0x50000900;
uint32_t return_address1 = 0x50000100;
uint32_t return_address2 = 0x50000900;
Label frame1_sp, frame2_sp;
stack_section
// frame 0
@ -674,8 +674,8 @@ class GetFramesByFramePointer: public StackwalkerARMFixtureIOS, public Test { };
TEST_F(GetFramesByFramePointer, OnlyFramePointer) {
stack_section.start() = 0x80000000;
u_int32_t return_address1 = 0x50000100;
u_int32_t return_address2 = 0x50000900;
uint32_t return_address1 = 0x50000100;
uint32_t return_address2 = 0x50000900;
Label frame1_sp, frame2_sp;
Label frame1_fp, frame2_fp;
stack_section
@ -764,8 +764,8 @@ TEST_F(GetFramesByFramePointer, FramePointerAndCFI) {
);
stack_section.start() = 0x80000000;
u_int32_t return_address1 = 0x40004010;
u_int32_t return_address2 = 0x50000900;
uint32_t return_address1 = 0x40004010;
uint32_t return_address2 = 0x50000900;
Label frame1_sp, frame2_sp;
Label frame1_fp, frame2_fp;
stack_section

View file

@ -102,7 +102,7 @@ StackFrame* StackwalkerPPC::GetCallerFrame(const CallStack* stack) {
// A caller frame must reside higher in memory than its callee frames.
// Anything else is an error, or an indication that we've reached the
// end of the stack.
u_int32_t stack_pointer;
uint32_t stack_pointer;
if (!memory_->GetMemoryAtAddress(last_frame->context.gpr[1],
&stack_pointer) ||
stack_pointer <= last_frame->context.gpr[1]) {
@ -114,7 +114,7 @@ StackFrame* StackwalkerPPC::GetCallerFrame(const CallStack* stack) {
// documentation on this, but 0 or 1 would be bogus return addresses,
// so check for them here and return false (end of stack) when they're
// hit to avoid having a phantom frame.
u_int32_t instruction;
uint32_t instruction;
if (!memory_->GetMemoryAtAddress(stack_pointer + 8, &instruction) ||
instruction <= 1) {
return NULL;

View file

@ -100,20 +100,20 @@ using google_breakpad::StackwalkerSPARC;
// process' memory space by pointer.
class SelfMemoryRegion : public MemoryRegion {
public:
virtual u_int64_t GetBase() { return 0; }
virtual u_int32_t GetSize() { return 0xffffffff; }
virtual uint64_t GetBase() { return 0; }
virtual uint32_t GetSize() { return 0xffffffff; }
bool GetMemoryAtAddress(u_int64_t address, u_int8_t* value) {
bool GetMemoryAtAddress(uint64_t address, uint8_t* value) {
return GetMemoryAtAddressInternal(address, value); }
bool GetMemoryAtAddress(u_int64_t address, u_int16_t* value) {
bool GetMemoryAtAddress(uint64_t address, uint16_t* value) {
return GetMemoryAtAddressInternal(address, value); }
bool GetMemoryAtAddress(u_int64_t address, u_int32_t* value) {
bool GetMemoryAtAddress(uint64_t address, uint32_t* value) {
return GetMemoryAtAddressInternal(address, value); }
bool GetMemoryAtAddress(u_int64_t address, u_int64_t* value) {
bool GetMemoryAtAddress(uint64_t address, uint64_t* value) {
return GetMemoryAtAddressInternal(address, value); }
private:
template<typename T> bool GetMemoryAtAddressInternal(u_int64_t address,
template<typename T> bool GetMemoryAtAddressInternal(uint64_t address,
T* value) {
// Without knowing what addresses are actually mapped, just assume that
// everything low is not mapped. This helps the stackwalker catch the
@ -123,7 +123,7 @@ class SelfMemoryRegion : public MemoryRegion {
if (address < 0x100)
return false;
u_int8_t* memory = 0;
uint8_t* memory = 0;
*value = *reinterpret_cast<const T*>(&memory[address]);
return true;
}
@ -142,9 +142,9 @@ class SelfMemoryRegion : public MemoryRegion {
// on the stack (provided frame pointers are not being omitted.) Because
// this function depends on the compiler-generated preamble, inlining is
// disabled.
static u_int32_t GetEBP() __attribute__((noinline));
static u_int32_t GetEBP() {
u_int32_t ebp;
static uint32_t GetEBP() __attribute__((noinline));
static uint32_t GetEBP() {
uint32_t ebp;
__asm__ __volatile__(
"movl (%%ebp), %0"
: "=a" (ebp)
@ -158,9 +158,9 @@ static u_int32_t GetEBP() {
// The CALL instruction places a 4-byte return address on the stack above
// the caller's %esp, and this function's prolog will save the caller's %ebp
// on the stack as well, for another 4 bytes, before storing %esp in %ebp.
static u_int32_t GetESP() __attribute__((noinline));
static u_int32_t GetESP() {
u_int32_t ebp;
static uint32_t GetESP() __attribute__((noinline));
static uint32_t GetESP() {
uint32_t ebp;
__asm__ __volatile__(
"movl %%ebp, %0"
: "=a" (ebp)
@ -179,9 +179,9 @@ static u_int32_t GetESP() {
// because GetEBP and stackwalking necessarily depends on access to frame
// pointers. Because this function depends on a call instruction and the
// compiler-generated preamble, inlining is disabled.
static u_int32_t GetEIP() __attribute__((noinline));
static u_int32_t GetEIP() {
u_int32_t eip;
static uint32_t GetEIP() __attribute__((noinline));
static uint32_t GetEIP() {
uint32_t eip;
__asm__ __volatile__(
"movl 4(%%ebp), %0"
: "=a" (eip)
@ -199,9 +199,9 @@ static u_int32_t GetEIP() {
// pointer. Dereference %r1 to obtain the caller's stack pointer, which the
// compiler-generated prolog stored on the stack. Because this function
// depends on the compiler-generated prolog, inlining is disabled.
static u_int32_t GetSP() __attribute__((noinline));
static u_int32_t GetSP() {
u_int32_t sp;
static uint32_t GetSP() __attribute__((noinline));
static uint32_t GetSP() {
uint32_t sp;
__asm__ __volatile__(
"lwz %0, 0(r1)"
: "=r" (sp)
@ -215,9 +215,9 @@ static u_int32_t GetSP() {
// link register, where it was placed by the branch instruction that called
// GetPC. Because this function depends on the caller's use of a branch
// instruction, inlining is disabled.
static u_int32_t GetPC() __attribute__((noinline));
static u_int32_t GetPC() {
u_int32_t lr;
static uint32_t GetPC() __attribute__((noinline));
static uint32_t GetPC() {
uint32_t lr;
__asm__ __volatile__(
"mflr %0"
: "=r" (lr)
@ -236,9 +236,9 @@ static u_int32_t GetPC() {
// pointer, which the compiler-generated prolog stored on the stack.
// Because this function depends on the compiler-generated prolog, inlining
// is disabled.
static u_int32_t GetSP() __attribute__((noinline));
static u_int32_t GetSP() {
u_int32_t sp;
static uint32_t GetSP() __attribute__((noinline));
static uint32_t GetSP() {
uint32_t sp;
__asm__ __volatile__(
"mov %%fp, %0"
: "=r" (sp)
@ -253,9 +253,9 @@ static u_int32_t GetSP() {
// on the stack (provided frame pointers are not being omitted.) Because
// this function depends on the compiler-generated preamble, inlining is
// disabled.
static u_int32_t GetFP() __attribute__((noinline));
static u_int32_t GetFP() {
u_int32_t fp;
static uint32_t GetFP() __attribute__((noinline));
static uint32_t GetFP() {
uint32_t fp;
__asm__ __volatile__(
"ld [%%fp+56], %0"
: "=r" (fp)
@ -268,9 +268,9 @@ static u_int32_t GetFP() {
// link register, where it was placed by the branch instruction that called
// GetPC. Because this function depends on the caller's use of a branch
// instruction, inlining is disabled.
static u_int32_t GetPC() __attribute__((noinline));
static u_int32_t GetPC() {
u_int32_t pc;
static uint32_t GetPC() __attribute__((noinline));
static uint32_t GetPC() {
uint32_t pc;
__asm__ __volatile__(
"mov %%i7, %0"
: "=r" (pc)
@ -284,15 +284,15 @@ static u_int32_t GetPC() {
#if defined(__i386__)
extern "C" {
extern u_int32_t GetEIP();
extern u_int32_t GetEBP();
extern u_int32_t GetESP();
extern uint32_t GetEIP();
extern uint32_t GetEBP();
extern uint32_t GetESP();
}
#elif defined(__sparc__)
extern "C" {
extern u_int32_t GetPC();
extern u_int32_t GetFP();
extern u_int32_t GetSP();
extern uint32_t GetPC();
extern uint32_t GetFP();
extern uint32_t GetSP();
}
#endif // __i386__ || __sparc__

View file

@ -93,18 +93,18 @@ StackFrame* StackwalkerSPARC::GetCallerFrame(const CallStack* stack) {
// A caller frame must reside higher in memory than its callee frames.
// Anything else is an error, or an indication that we've reached the
// end of the stack.
u_int64_t stack_pointer = last_frame->context.g_r[30];
uint64_t stack_pointer = last_frame->context.g_r[30];
if (stack_pointer <= last_frame->context.g_r[14]) {
return NULL;
}
u_int32_t instruction;
uint32_t instruction;
if (!memory_->GetMemoryAtAddress(stack_pointer + 60,
&instruction) || instruction <= 1) {
return NULL;
}
u_int32_t stack_base;
uint32_t stack_base;
if (!memory_->GetMemoryAtAddress(stack_pointer + 56,
&stack_base) || stack_base <= 1) {
return NULL;

View file

@ -55,24 +55,24 @@ class MockMemoryRegion: public google_breakpad::MemoryRegion {
// Set this region's address and contents. If we have placed an
// instance of this class in a test fixture class, individual tests
// can use this to provide the region's contents.
void Init(u_int64_t base_address, const string &contents) {
void Init(uint64_t base_address, const string &contents) {
base_address_ = base_address;
contents_ = contents;
}
u_int64_t GetBase() const { return base_address_; }
u_int32_t GetSize() const { return contents_.size(); }
uint64_t GetBase() const { return base_address_; }
uint32_t GetSize() const { return contents_.size(); }
bool GetMemoryAtAddress(u_int64_t address, u_int8_t *value) const {
bool GetMemoryAtAddress(uint64_t address, uint8_t *value) const {
return GetMemoryLittleEndian(address, value);
}
bool GetMemoryAtAddress(u_int64_t address, u_int16_t *value) const {
bool GetMemoryAtAddress(uint64_t address, uint16_t *value) const {
return GetMemoryLittleEndian(address, value);
}
bool GetMemoryAtAddress(u_int64_t address, u_int32_t *value) const {
bool GetMemoryAtAddress(uint64_t address, uint32_t *value) const {
return GetMemoryLittleEndian(address, value);
}
bool GetMemoryAtAddress(u_int64_t address, u_int64_t *value) const {
bool GetMemoryAtAddress(uint64_t address, uint64_t *value) const {
return GetMemoryLittleEndian(address, value);
}
@ -80,7 +80,7 @@ class MockMemoryRegion: public google_breakpad::MemoryRegion {
// Fetch a little-endian value from ADDRESS in contents_ whose size
// is BYTES, and store it in *VALUE. Return true on success.
template<typename ValueType>
bool GetMemoryLittleEndian(u_int64_t address, ValueType *value) const {
bool GetMemoryLittleEndian(uint64_t address, ValueType *value) const {
if (address < base_address_ ||
address - base_address_ + sizeof(ValueType) > contents_.size())
return false;
@ -93,18 +93,18 @@ class MockMemoryRegion: public google_breakpad::MemoryRegion {
return true;
}
u_int64_t base_address_;
uint64_t base_address_;
string contents_;
};
class MockCodeModule: public google_breakpad::CodeModule {
public:
MockCodeModule(u_int64_t base_address, u_int64_t size,
MockCodeModule(uint64_t base_address, uint64_t size,
const string &code_file, const string &version)
: base_address_(base_address), size_(size), code_file_(code_file) { }
u_int64_t base_address() const { return base_address_; }
u_int64_t size() const { return size_; }
uint64_t base_address() const { return base_address_; }
uint64_t size() const { return size_; }
string code_file() const { return code_file_; }
string code_identifier() const { return code_file_; }
string debug_file() const { return code_file_; }
@ -115,8 +115,8 @@ class MockCodeModule: public google_breakpad::CodeModule {
}
private:
u_int64_t base_address_;
u_int64_t size_;
uint64_t base_address_;
uint64_t size_;
string code_file_;
string version_;
};
@ -132,7 +132,7 @@ class MockCodeModules: public google_breakpad::CodeModules {
unsigned int module_count() const { return modules_.size(); }
const CodeModule *GetModuleForAddress(u_int64_t address) const {
const CodeModule *GetModuleForAddress(uint64_t address) const {
for (ModuleVector::const_iterator i = modules_.begin();
i != modules_.end(); i++) {
const MockCodeModule *module = *i;

View file

@ -106,7 +106,7 @@ StackFrameX86::~StackFrameX86() {
cfi_frame_info = NULL;
}
u_int64_t StackFrameX86::ReturnAddress() const
uint64_t StackFrameX86::ReturnAddress() const
{
assert(context_validity & StackFrameX86::CONTEXT_VALID_EIP);
return context.eip;
@ -179,7 +179,7 @@ StackFrameX86* StackwalkerX86::GetCallerByWindowsFrameInfo(
// are unknown, 0 is also used in that case. When that happens, it should
// be possible to walk to the next frame without reference to %esp.
u_int32_t last_frame_callee_parameter_size = 0;
uint32_t last_frame_callee_parameter_size = 0;
int frames_already_walked = frames.size();
if (frames_already_walked >= 2) {
const StackFrameX86* last_frame_callee
@ -197,7 +197,7 @@ StackFrameX86* StackwalkerX86::GetCallerByWindowsFrameInfo(
// Set up the dictionary for the PostfixEvaluator. %ebp and %esp are used
// in each program string, and their previous values are known, so set them
// here.
PostfixEvaluator<u_int32_t>::DictionaryType dictionary;
PostfixEvaluator<uint32_t>::DictionaryType dictionary;
// Provide the current register values.
dictionary["$ebp"] = last_frame->context.ebp;
dictionary["$esp"] = last_frame->context.esp;
@ -210,13 +210,13 @@ StackFrameX86* StackwalkerX86::GetCallerByWindowsFrameInfo(
dictionary[".cbSavedRegs"] = last_frame_info->saved_register_size;
dictionary[".cbLocals"] = last_frame_info->local_size;
u_int32_t raSearchStart = last_frame->context.esp +
uint32_t raSearchStart = last_frame->context.esp +
last_frame_callee_parameter_size +
last_frame_info->local_size +
last_frame_info->saved_register_size;
u_int32_t raSearchStartOld = raSearchStart;
u_int32_t found = 0; // dummy value
uint32_t raSearchStartOld = raSearchStart;
uint32_t found = 0; // dummy value
// Scan up to three words above the calculated search value, in case
// the stack was aligned to a quadword boundary.
if (ScanForReturnAddress(raSearchStart, &raSearchStart, &found, 3) &&
@ -326,9 +326,9 @@ StackFrameX86* StackwalkerX86::GetCallerByWindowsFrameInfo(
// Now crank it out, making sure that the program string set at least the
// two required variables.
PostfixEvaluator<u_int32_t> evaluator =
PostfixEvaluator<u_int32_t>(&dictionary, memory_);
PostfixEvaluator<u_int32_t>::DictionaryValidityType dictionary_validity;
PostfixEvaluator<uint32_t> evaluator =
PostfixEvaluator<uint32_t>(&dictionary, memory_);
PostfixEvaluator<uint32_t>::DictionaryValidityType dictionary_validity;
if (!evaluator.Evaluate(program_string, &dictionary_validity) ||
dictionary_validity.find("$eip") == dictionary_validity.end() ||
dictionary_validity.find("$esp") == dictionary_validity.end()) {
@ -338,8 +338,8 @@ StackFrameX86* StackwalkerX86::GetCallerByWindowsFrameInfo(
// address. This can happen if the stack is in a module for which
// we don't have symbols, and that module is compiled without a
// frame pointer.
u_int32_t location_start = last_frame->context.esp;
u_int32_t location, eip;
uint32_t location_start = last_frame->context.esp;
uint32_t location, eip;
if (!ScanForReturnAddress(location_start, &location, &eip)) {
// if we can't find an instruction pointer even with stack scanning,
// give up.
@ -376,12 +376,12 @@ StackFrameX86* StackwalkerX86::GetCallerByWindowsFrameInfo(
// ability, older OSes (pre-XP SP2) and CPUs (pre-P4) don't enforce
// an independent execute privilege on memory pages.
u_int32_t eip = dictionary["$eip"];
uint32_t eip = dictionary["$eip"];
if (modules_ && !modules_->GetModuleForAddress(eip)) {
// The instruction pointer at .raSearchStart was invalid, so start
// looking one 32-bit word above that location.
u_int32_t location_start = dictionary[".raSearchStart"] + 4;
u_int32_t location;
uint32_t location_start = dictionary[".raSearchStart"] + 4;
uint32_t location;
if (ScanForReturnAddress(location_start, &location, &eip)) {
// This is a better return address that what program string
// evaluation found. Use it, and set %esp to the location above the
@ -401,7 +401,7 @@ StackFrameX86* StackwalkerX86::GetCallerByWindowsFrameInfo(
// stack. The scan is performed from the highest possible address to
// the lowest, because the expectation is that the function's prolog
// would have saved %ebp early.
u_int32_t ebp = dictionary["$ebp"];
uint32_t ebp = dictionary["$ebp"];
// When a scan for return address is used, it is possible to skip one or
// more frames (when return address is not in a known module). One
@ -410,13 +410,13 @@ StackFrameX86* StackwalkerX86::GetCallerByWindowsFrameInfo(
bool has_skipped_frames =
(trust != StackFrame::FRAME_TRUST_CFI && ebp <= raSearchStart + offset);
u_int32_t value; // throwaway variable to check pointer validity
uint32_t value; // throwaway variable to check pointer validity
if (has_skipped_frames || !memory_->GetMemoryAtAddress(ebp, &value)) {
int fp_search_bytes = last_frame_info->saved_register_size + offset;
u_int32_t location_end = last_frame->context.esp +
uint32_t location_end = last_frame->context.esp +
last_frame_callee_parameter_size;
for (u_int32_t location = location_end + fp_search_bytes;
for (uint32_t location = location_end + fp_search_bytes;
location >= location_end;
location -= 4) {
if (!memory_->GetMemoryAtAddress(location, &ebp))
@ -493,8 +493,8 @@ StackFrameX86* StackwalkerX86::GetCallerByEBPAtBase(
const vector<StackFrame*> &frames) {
StackFrame::FrameTrust trust;
StackFrameX86* last_frame = static_cast<StackFrameX86*>(frames.back());
u_int32_t last_esp = last_frame->context.esp;
u_int32_t last_ebp = last_frame->context.ebp;
uint32_t last_esp = last_frame->context.esp;
uint32_t last_ebp = last_frame->context.ebp;
// Assume that the standard %ebp-using x86 calling convention is in
// use.
@ -519,7 +519,7 @@ StackFrameX86* StackwalkerX86::GetCallerByEBPAtBase(
// %esp_new = %ebp_old + 8
// %ebp_new = *(%ebp_old)
u_int32_t caller_eip, caller_esp, caller_ebp;
uint32_t caller_eip, caller_esp, caller_ebp;
if (memory_->GetMemoryAtAddress(last_ebp + 4, &caller_eip) &&
memory_->GetMemoryAtAddress(last_ebp, &caller_ebp)) {

Some files were not shown because too many files have changed in this diff Show more