Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: minidump/minidump_misc_info_writer.cc

Issue 883773005: win: Work towards getting 'minidump' to compile (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@crash-report-db-win
Patch Set: more mucking around Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « minidump/minidump_misc_info_writer.h ('k') | minidump/minidump_misc_info_writer_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 21 matching lines...) Expand all
32 #if defined(OS_MACOSX) 32 #if defined(OS_MACOSX)
33 #include <AvailabilityMacros.h> 33 #include <AvailabilityMacros.h>
34 #endif 34 #endif
35 35
36 namespace crashpad { 36 namespace crashpad {
37 namespace { 37 namespace {
38 38
39 uint32_t TimevalToRoundedSeconds(const timeval& tv) { 39 uint32_t TimevalToRoundedSeconds(const timeval& tv) {
40 uint32_t seconds = 40 uint32_t seconds =
41 InRangeCast<uint32_t>(tv.tv_sec, std::numeric_limits<uint32_t>::max()); 41 InRangeCast<uint32_t>(tv.tv_sec, std::numeric_limits<uint32_t>::max());
42 const int kMicrosecondsPerSecond = 1E6; 42 const int kMicrosecondsPerSecond = static_cast<int>(1E6);
43 if (tv.tv_usec >= kMicrosecondsPerSecond / 2 && 43 if (tv.tv_usec >= kMicrosecondsPerSecond / 2 &&
44 seconds != std::numeric_limits<uint32_t>::max()) { 44 seconds != std::numeric_limits<uint32_t>::max()) {
45 ++seconds; 45 ++seconds;
46 } 46 }
47 return seconds; 47 return seconds;
48 } 48 }
49 49
50 // For MINIDUMP_MISC_INFO_4::BuildString. dbghelp only places OS version 50 // For MINIDUMP_MISC_INFO_4::BuildString. dbghelp only places OS version
51 // information here, but if a machine description is also available, this is the 51 // information here, but if a machine description is also available, this is the
52 // only reasonable place in a minidump file to put it. 52 // only reasonable place in a minidump file to put it.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // format, and add the OS that wrote the minidump along with any relevant 94 // format, and add the OS that wrote the minidump along with any relevant
95 // platform-specific data describing the compilation environment. 95 // platform-specific data describing the compilation environment.
96 std::string MinidumpMiscInfoDebugBuildString() { 96 std::string MinidumpMiscInfoDebugBuildString() {
97 // Caution: the minidump file format only has room for 39 UTF-16 code units 97 // Caution: the minidump file format only has room for 39 UTF-16 code units
98 // plus a UTF-16 NUL terminator. Don’t let strings get longer than this, or 98 // plus a UTF-16 NUL terminator. Don’t let strings get longer than this, or
99 // they will be truncated and a message will be logged. 99 // they will be truncated and a message will be logged.
100 #if defined(OS_MACOSX) 100 #if defined(OS_MACOSX)
101 const char kOS[] = "mac"; 101 const char kOS[] = "mac";
102 #elif defined(OS_LINUX) 102 #elif defined(OS_LINUX)
103 const char kOS[] = "linux"; 103 const char kOS[] = "linux";
104 #elif defined(OS_WIN)
105 const char kOS[] = "win";
104 #else 106 #else
105 #error define kOS for this operating system 107 #error define kOS for this operating system
106 #endif 108 #endif
107 109
108 #if defined(ARCH_CPU_X86) 110 #if defined(ARCH_CPU_X86)
109 const char kCPU[] = "i386"; 111 const char kCPU[] = "i386";
110 #elif defined(ARCH_CPU_X86_64) 112 #elif defined(ARCH_CPU_X86_64)
111 const char kCPU[] = "amd64"; 113 const char kCPU[] = "amd64";
112 #else 114 #else
113 #error define kCPU for this CPU 115 #error define kCPU for this CPU
(...skipping 29 matching lines...) Expand all
143 DCHECK_EQ(state(), kStateMutable); 145 DCHECK_EQ(state(), kStateMutable);
144 DCHECK_EQ(misc_info_.Flags1, 0u); 146 DCHECK_EQ(misc_info_.Flags1, 0u);
145 147
146 SetProcessID(InRangeCast<uint32_t>(process_snapshot->ProcessID(), 0)); 148 SetProcessID(InRangeCast<uint32_t>(process_snapshot->ProcessID(), 0));
147 149
148 const SystemSnapshot* system_snapshot = process_snapshot->System(); 150 const SystemSnapshot* system_snapshot = process_snapshot->System();
149 151
150 uint64_t current_mhz; 152 uint64_t current_mhz;
151 uint64_t max_mhz; 153 uint64_t max_mhz;
152 system_snapshot->CPUFrequency(&current_mhz, &max_mhz); 154 system_snapshot->CPUFrequency(&current_mhz, &max_mhz);
153 const uint32_t kHzPerMHz = 1E6; 155 const uint32_t kHzPerMHz = static_cast<const uint32_t>(1E6);
154 SetProcessorPowerInfo( 156 SetProcessorPowerInfo(
155 InRangeCast<uint32_t>(current_mhz / kHzPerMHz, 157 InRangeCast<uint32_t>(current_mhz / kHzPerMHz,
156 std::numeric_limits<uint32_t>::max()), 158 std::numeric_limits<uint32_t>::max()),
157 InRangeCast<uint32_t>(max_mhz / kHzPerMHz, 159 InRangeCast<uint32_t>(max_mhz / kHzPerMHz,
158 std::numeric_limits<uint32_t>::max()), 160 std::numeric_limits<uint32_t>::max()),
159 0, 161 0,
160 0, 162 0,
161 0); 163 0);
162 164
163 timeval start_time; 165 timeval start_time;
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 MINIDUMP_MISC3_TIMEZONE | MINIDUMP_MISC3_PROTECTED_PROCESS)) { 360 MINIDUMP_MISC3_TIMEZONE | MINIDUMP_MISC3_PROTECTED_PROCESS)) {
359 return sizeof(MINIDUMP_MISC_INFO_3); 361 return sizeof(MINIDUMP_MISC_INFO_3);
360 } 362 }
361 if (misc_info_.Flags1 & MINIDUMP_MISC1_PROCESSOR_POWER_INFO) { 363 if (misc_info_.Flags1 & MINIDUMP_MISC1_PROCESSOR_POWER_INFO) {
362 return sizeof(MINIDUMP_MISC_INFO_2); 364 return sizeof(MINIDUMP_MISC_INFO_2);
363 } 365 }
364 return sizeof(MINIDUMP_MISC_INFO); 366 return sizeof(MINIDUMP_MISC_INFO);
365 } 367 }
366 368
367 } // namespace crashpad 369 } // namespace crashpad
OLDNEW
« no previous file with comments | « minidump/minidump_misc_info_writer.h ('k') | minidump/minidump_misc_info_writer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698