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

Side by Side Diff: minidump/minidump_exception_writer_test.cc

Issue 983103004: win: fixes for Windows x64 (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: mac Created 5 years, 9 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_exception_writer.cc ('k') | minidump/minidump_file_writer.h » ('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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 GetExceptionStream(string_file.string(), &observed_exception_stream)); 174 GetExceptionStream(string_file.string(), &observed_exception_stream));
175 175
176 MINIDUMP_EXCEPTION_STREAM expected_exception_stream = {}; 176 MINIDUMP_EXCEPTION_STREAM expected_exception_stream = {};
177 expected_exception_stream.ThreadId = kThreadID; 177 expected_exception_stream.ThreadId = kThreadID;
178 expected_exception_stream.ExceptionRecord.ExceptionCode = kExceptionCode; 178 expected_exception_stream.ExceptionRecord.ExceptionCode = kExceptionCode;
179 expected_exception_stream.ExceptionRecord.ExceptionFlags = kExceptionFlags; 179 expected_exception_stream.ExceptionRecord.ExceptionFlags = kExceptionFlags;
180 expected_exception_stream.ExceptionRecord.ExceptionRecord = kExceptionRecord; 180 expected_exception_stream.ExceptionRecord.ExceptionRecord = kExceptionRecord;
181 expected_exception_stream.ExceptionRecord.ExceptionAddress = 181 expected_exception_stream.ExceptionRecord.ExceptionAddress =
182 kExceptionAddress; 182 kExceptionAddress;
183 expected_exception_stream.ExceptionRecord.NumberParameters = 183 expected_exception_stream.ExceptionRecord.NumberParameters =
184 exception_information.size(); 184 static_cast<uint32_t>(exception_information.size());
185 for (size_t index = 0; index < exception_information.size(); ++index) { 185 for (size_t index = 0; index < exception_information.size(); ++index) {
186 expected_exception_stream.ExceptionRecord.ExceptionInformation[index] = 186 expected_exception_stream.ExceptionRecord.ExceptionInformation[index] =
187 exception_information[index]; 187 exception_information[index];
188 } 188 }
189 expected_exception_stream.ThreadContext.DataSize = sizeof(MinidumpContextX86); 189 expected_exception_stream.ThreadContext.DataSize = sizeof(MinidumpContextX86);
190 190
191 const MinidumpContextX86* observed_context = nullptr; 191 const MinidumpContextX86* observed_context = nullptr;
192 ASSERT_NO_FATAL_FAILURE(ExpectExceptionStream(&expected_exception_stream, 192 ASSERT_NO_FATAL_FAILURE(ExpectExceptionStream(&expected_exception_stream,
193 observed_exception_stream, 193 observed_exception_stream,
194 string_file.string(), 194 string_file.string(),
195 &observed_context)); 195 &observed_context));
196 196
197 ASSERT_NO_FATAL_FAILURE( 197 ASSERT_NO_FATAL_FAILURE(
198 ExpectMinidumpContextX86(kSeed, observed_context, false)); 198 ExpectMinidumpContextX86(kSeed, observed_context, false));
199 } 199 }
200 200
201 TEST(MinidumpExceptionWriter, InitializeFromSnapshot) { 201 TEST(MinidumpExceptionWriter, InitializeFromSnapshot) {
202 std::vector<uint64_t> exception_codes; 202 std::vector<uint64_t> exception_codes;
203 exception_codes.push_back(0x1000000000000000); 203 exception_codes.push_back(0x1000000000000000);
204 exception_codes.push_back(0x5555555555555555); 204 exception_codes.push_back(0x5555555555555555);
205 205
206 MINIDUMP_EXCEPTION_STREAM expect_exception = {}; 206 MINIDUMP_EXCEPTION_STREAM expect_exception = {};
207 207
208 expect_exception.ThreadId = 123; 208 expect_exception.ThreadId = 123;
209 expect_exception.ExceptionRecord.ExceptionCode = 100; 209 expect_exception.ExceptionRecord.ExceptionCode = 100;
210 expect_exception.ExceptionRecord.ExceptionFlags = 1; 210 expect_exception.ExceptionRecord.ExceptionFlags = 1;
211 expect_exception.ExceptionRecord.ExceptionAddress = 0xfedcba9876543210; 211 expect_exception.ExceptionRecord.ExceptionAddress = 0xfedcba9876543210;
212 expect_exception.ExceptionRecord.NumberParameters = exception_codes.size(); 212 expect_exception.ExceptionRecord.NumberParameters =
213 static_cast<uint32_t>(exception_codes.size());
213 for (size_t index = 0; index < exception_codes.size(); ++index) { 214 for (size_t index = 0; index < exception_codes.size(); ++index) {
214 expect_exception.ExceptionRecord.ExceptionInformation[index] = 215 expect_exception.ExceptionRecord.ExceptionInformation[index] =
215 exception_codes[index]; 216 exception_codes[index];
216 } 217 }
217 const uint64_t kThreadID = 0xaaaaaaaaaaaaaaaa; 218 const uint64_t kThreadID = 0xaaaaaaaaaaaaaaaa;
218 const uint32_t kSeed = 65; 219 const uint32_t kSeed = 65;
219 220
220 TestExceptionSnapshot exception_snapshot; 221 TestExceptionSnapshot exception_snapshot;
221 exception_snapshot.SetThreadID(kThreadID); 222 exception_snapshot.SetThreadID(kThreadID);
222 exception_snapshot.SetException( 223 exception_snapshot.SetException(
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 MinidumpExceptionWriter exception_writer; 269 MinidumpExceptionWriter exception_writer;
269 std::vector<uint64_t> exception_information(EXCEPTION_MAXIMUM_PARAMETERS + 1, 270 std::vector<uint64_t> exception_information(EXCEPTION_MAXIMUM_PARAMETERS + 1,
270 0x5a5a5a5a5a5a5a5a); 271 0x5a5a5a5a5a5a5a5a);
271 ASSERT_DEATH(exception_writer.SetExceptionInformation(exception_information), 272 ASSERT_DEATH(exception_writer.SetExceptionInformation(exception_information),
272 "kMaxParameters"); 273 "kMaxParameters");
273 } 274 }
274 275
275 } // namespace 276 } // namespace
276 } // namespace test 277 } // namespace test
277 } // namespace crashpad 278 } // namespace crashpad
OLDNEW
« no previous file with comments | « minidump/minidump_exception_writer.cc ('k') | minidump/minidump_file_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698