mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2026-01-06 22:48:30 +01:00
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:
parent
c02002a581
commit
aeffe1056f
117 changed files with 1385 additions and 1379 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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=
|
||||
|
|
|
|||
|
|
@ -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__)
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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__)
|
||||
|
|
|
|||
|
|
@ -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__)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue