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

Side by Side Diff: minidump/test/minidump_writable_test_util.cc

Issue 1379873005: win: Write memory map info as MINIDUMP_MEMORY_INFO[_LIST] (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@save-peb-more-2
Patch Set: fixes Created 5 years, 2 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
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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 }; 174 };
175 175
176 struct MinidumpThreadListTraits { 176 struct MinidumpThreadListTraits {
177 using ListType = MINIDUMP_THREAD_LIST; 177 using ListType = MINIDUMP_THREAD_LIST;
178 enum : size_t { kElementSize = sizeof(MINIDUMP_THREAD) }; 178 enum : size_t { kElementSize = sizeof(MINIDUMP_THREAD) };
179 static size_t ElementCount(const ListType* list) { 179 static size_t ElementCount(const ListType* list) {
180 return list->NumberOfThreads; 180 return list->NumberOfThreads;
181 } 181 }
182 }; 182 };
183 183
184 struct MinidumpMemoryInfoListTraits {
185 using ListType = MINIDUMP_MEMORY_INFO_LIST;
186 enum : size_t { kElementSize = sizeof(MINIDUMP_MEMORY_INFO) };
187 static size_t ElementCount(const ListType* list) {
188 return static_cast<size_t>(list->NumberOfEntries);
189 }
190 };
191
184 struct MinidumpModuleCrashpadInfoListTraits { 192 struct MinidumpModuleCrashpadInfoListTraits {
185 using ListType = MinidumpModuleCrashpadInfoList; 193 using ListType = MinidumpModuleCrashpadInfoList;
186 enum : size_t { kElementSize = sizeof(MinidumpModuleCrashpadInfoLink) }; 194 enum : size_t { kElementSize = sizeof(MinidumpModuleCrashpadInfoLink) };
187 static size_t ElementCount(const ListType* list) { 195 static size_t ElementCount(const ListType* list) {
188 return list->count; 196 return list->count;
189 } 197 }
190 }; 198 };
191 199
192 struct MinidumpSimpleStringDictionaryListTraits { 200 struct MinidumpSimpleStringDictionaryListTraits {
193 using ListType = MinidumpSimpleStringDictionary; 201 using ListType = MinidumpSimpleStringDictionary;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 246
239 template <> 247 template <>
240 const MINIDUMP_THREAD_LIST* MinidumpWritableAtLocationDescriptor< 248 const MINIDUMP_THREAD_LIST* MinidumpWritableAtLocationDescriptor<
241 MINIDUMP_THREAD_LIST>(const std::string& file_contents, 249 MINIDUMP_THREAD_LIST>(const std::string& file_contents,
242 const MINIDUMP_LOCATION_DESCRIPTOR& location) { 250 const MINIDUMP_LOCATION_DESCRIPTOR& location) {
243 return MinidumpListAtLocationDescriptor<MinidumpThreadListTraits>( 251 return MinidumpListAtLocationDescriptor<MinidumpThreadListTraits>(
244 file_contents, location); 252 file_contents, location);
245 } 253 }
246 254
247 template <> 255 template <>
256 const MINIDUMP_MEMORY_INFO_LIST* MinidumpWritableAtLocationDescriptor<
257 MINIDUMP_MEMORY_INFO_LIST>(const std::string& file_contents,
258 const MINIDUMP_LOCATION_DESCRIPTOR& location) {
259 return MinidumpListAtLocationDescriptor<MinidumpMemoryInfoListTraits>(
260 file_contents, location);
261 }
262
263 template <>
248 const MinidumpModuleCrashpadInfoList* 264 const MinidumpModuleCrashpadInfoList*
249 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfoList>( 265 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfoList>(
250 const std::string& file_contents, 266 const std::string& file_contents,
251 const MINIDUMP_LOCATION_DESCRIPTOR& location) { 267 const MINIDUMP_LOCATION_DESCRIPTOR& location) {
252 return MinidumpListAtLocationDescriptor<MinidumpModuleCrashpadInfoListTraits>( 268 return MinidumpListAtLocationDescriptor<MinidumpModuleCrashpadInfoListTraits>(
253 file_contents, location); 269 file_contents, location);
254 } 270 }
255 271
256 template <> 272 template <>
257 const MinidumpSimpleStringDictionary* 273 const MinidumpSimpleStringDictionary*
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 size_t TestUInt32MinidumpWritable::SizeOfObject() { 333 size_t TestUInt32MinidumpWritable::SizeOfObject() {
318 return sizeof(value_); 334 return sizeof(value_);
319 } 335 }
320 336
321 bool TestUInt32MinidumpWritable::WriteObject(FileWriterInterface* file_writer) { 337 bool TestUInt32MinidumpWritable::WriteObject(FileWriterInterface* file_writer) {
322 return file_writer->Write(&value_, sizeof(value_)); 338 return file_writer->Write(&value_, sizeof(value_));
323 } 339 }
324 340
325 } // namespace test 341 } // namespace test
326 } // namespace crashpad 342 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698