diff --git a/src/common/dwarf/bytereader.cc b/src/common/dwarf/bytereader.cc index 8721b7a5..fb0024d3 100644 --- a/src/common/dwarf/bytereader.cc +++ b/src/common/dwarf/bytereader.cc @@ -123,11 +123,11 @@ uint64 ByteReader::ReadEncodedPointer(const char *buffer, // First, find the offset to START from the closest prior aligned // address. - size_t skew = section_base_ & (AddressSize() - 1); + uint64_t skew = section_base_ & (AddressSize() - 1); // Now find the offset from that aligned address to buffer. - off_t offset = skew + (buffer - buffer_base_); + uint64_t offset = skew + (buffer - buffer_base_); // Round up to the next boundary. - size_t aligned = (offset + AddressSize() - 1) & -AddressSize(); + uint64_t aligned = (offset + AddressSize() - 1) & -AddressSize(); // Convert back to a pointer. const char *aligned_buffer = buffer_base_ + (aligned - skew); // Finally, store the length and actually fetch the pointer. @@ -156,7 +156,7 @@ uint64 ByteReader::ReadEncodedPointer(const char *buffer, case DW_EH_PE_uleb128: offset = ReadUnsignedLEB128(buffer, len); break; - + case DW_EH_PE_udata2: offset = ReadTwoBytes(buffer); *len = 2; diff --git a/src/common/dwarf/bytereader.h b/src/common/dwarf/bytereader.h index f01f319d..206b13a5 100644 --- a/src/common/dwarf/bytereader.h +++ b/src/common/dwarf/bytereader.h @@ -85,7 +85,7 @@ class ByteReader { // // - If N is between 0 and 0x7f, then its unsigned LEB128 // representation is a single byte whose value is N. - // + // // - Otherwise, its unsigned LEB128 representation is (N & 0x7f) | // 0x80, followed by the unsigned LEB128 representation of N / // 128, rounded towards negative infinity. @@ -104,7 +104,7 @@ class ByteReader { // - If N is between -0x40 and 0x3f, then its signed LEB128 // representation is a single byte whose value is N in two's // complement. - // + // // - Otherwise, its signed LEB128 representation is (N & 0x7f) | // 0x80, followed by the signed LEB128 representation of N / 128, // rounded towards negative infinity. @@ -301,7 +301,7 @@ class ByteReader { // Base addresses for Linux C++ exception handling data's encoded pointers. bool have_section_base_, have_text_base_, have_data_base_; bool have_function_base_; - size_t section_base_, text_base_, data_base_, function_base_; + uint64_t section_base_, text_base_, data_base_, function_base_; const char *buffer_base_; }; diff --git a/src/tools/mac/crash_report/crash_report.mm b/src/tools/mac/crash_report/crash_report.mm index 2129a411..78eb6f27 100644 --- a/src/tools/mac/crash_report/crash_report.mm +++ b/src/tools/mac/crash_report/crash_report.mm @@ -88,12 +88,12 @@ static int PrintRegister(const char *name, u_int32_t value, int sequence) { //============================================================================= static void PrintStack(const CallStack *stack, const string &cpu) { - int frame_count = stack->frames()->size(); + size_t frame_count = stack->frames()->size(); char buffer[1024]; - for (int frame_index = 0; frame_index < frame_count; ++frame_index) { + for (size_t frame_index = 0; frame_index < frame_count; ++frame_index) { const StackFrame *frame = stack->frames()->at(frame_index); const CodeModule *module = frame->module; - printf("%2d ", frame_index); + printf("%2zu ", frame_index); if (module) { // Module name (20 chars max) @@ -106,7 +106,7 @@ static void PrintStack(const CallStack *stack, const string &cpu) { buffer[maxStr] = 0; printf("%-*s",maxStr, buffer); - + u_int64_t instruction = frame->instruction; // PPC only: Adjust the instruction to match that of Crash reporter. The @@ -195,16 +195,16 @@ static void PrintRegisters(const CallStack *stack, const string &cpu) { static void PrintModules(const CodeModules *modules) { if (!modules) return; - + printf("\n"); printf("Loaded modules:\n"); - + u_int64_t main_address = 0; const CodeModule *main_module = modules->GetMainModule(); if (main_module) { main_address = main_module->base_address(); } - + unsigned int module_count = modules->module_count(); for (unsigned int module_sequence = 0; module_sequence < module_count; @@ -223,7 +223,7 @@ static void PrintModules(const CodeModules *modules) { } static void ProcessSingleReport(Options *options, NSString *file_path) { - string minidump_file([file_path fileSystemRepresentation]); + string minidump_file([file_path fileSystemRepresentation]); BasicSourceLineResolver resolver; string search_dir = options->searchDir ? [options->searchDir fileSystemRepresentation] : ""; @@ -279,7 +279,7 @@ static void ProcessSingleReport(Options *options, NSString *file_path) { } // Print all of the threads in the dump. - int thread_count = process_state.threads()->size(); + int thread_count = static_cast(process_state.threads()->size()); const std::vector *thread_memory_regions = process_state.thread_memory_regions(); @@ -338,15 +338,15 @@ static void Start(Options *options) { static void Usage(int argc, const char *argv[]) { fprintf(stderr, "Convert a minidump to a crash report. Breakpad symbol " "files will be used (or created if missing) in /tmp.\n" - "If a symbol-file-search-dir is specified, any symbol " - "files in it will be used instead of being loaded from " - "modules on disk.\n" + "If a symbol-file-search-dir is specified, any symbol " + "files in it will be used instead of being loaded from " + "modules on disk.\n" "If modules cannot be found at the paths stored in the " - "minidump file, they will be searched for at " + "minidump file, they will be searched for at " "/.\n"); fprintf(stderr, "Usage: %s [-s module-search-dir] [-S symbol-file-search-dir] " "minidump-file\n", argv[0]); - fprintf(stderr, "\t-s: Specify a search directory to use for missing modules\n" + fprintf(stderr, "\t-s: Specify a search directory to use for missing modules\n" "\t-S: Specify a search directory to use for symbol files\n" "\t-t: Print thread stack memory in hex\n" "\t-h: Usage\n" @@ -371,7 +371,7 @@ static void SetupOptions(int argc, const char *argv[], Options *options) { stringWithFileSystemRepresentation:optarg length:strlen(optarg)]; break; - + case 't': options->printThreadMemory = YES; break;