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

Side by Side Diff: minidump/minidump_exception_writer_test.cc

Issue 897863004: win: potentially uninitialized locals in minidump_exception_writer_test.cc (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@minidump_test-7
Patch Set: 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 | « no previous file | no next file » | 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 auto context_x86_writer = make_scoped_ptr(new MinidumpContextX86Writer()); 104 auto context_x86_writer = make_scoped_ptr(new MinidumpContextX86Writer());
105 InitializeMinidumpContextX86(context_x86_writer->context(), kSeed); 105 InitializeMinidumpContextX86(context_x86_writer->context(), kSeed);
106 exception_writer->SetContext(context_x86_writer.Pass()); 106 exception_writer->SetContext(context_x86_writer.Pass());
107 107
108 minidump_file_writer.AddStream(exception_writer.Pass()); 108 minidump_file_writer.AddStream(exception_writer.Pass());
109 109
110 StringFileWriter file_writer; 110 StringFileWriter file_writer;
111 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 111 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
112 112
113 const MINIDUMP_EXCEPTION_STREAM* observed_exception_stream; 113 const MINIDUMP_EXCEPTION_STREAM* observed_exception_stream = nullptr;
114 ASSERT_NO_FATAL_FAILURE( 114 ASSERT_NO_FATAL_FAILURE(
115 GetExceptionStream(file_writer.string(), &observed_exception_stream)); 115 GetExceptionStream(file_writer.string(), &observed_exception_stream));
116 116
117 MINIDUMP_EXCEPTION_STREAM expected_exception_stream = {}; 117 MINIDUMP_EXCEPTION_STREAM expected_exception_stream = {};
118 expected_exception_stream.ThreadContext.DataSize = sizeof(MinidumpContextX86); 118 expected_exception_stream.ThreadContext.DataSize = sizeof(MinidumpContextX86);
119 119
120 const MinidumpContextX86* observed_context; 120 const MinidumpContextX86* observed_context = nullptr;
121 ASSERT_NO_FATAL_FAILURE(ExpectExceptionStream(&expected_exception_stream, 121 ASSERT_NO_FATAL_FAILURE(ExpectExceptionStream(&expected_exception_stream,
122 observed_exception_stream, 122 observed_exception_stream,
123 file_writer.string(), 123 file_writer.string(),
124 &observed_context)); 124 &observed_context));
125 125
126 ASSERT_NO_FATAL_FAILURE( 126 ASSERT_NO_FATAL_FAILURE(
127 ExpectMinidumpContextX86(kSeed, observed_context, false)); 127 ExpectMinidumpContextX86(kSeed, observed_context, false));
128 } 128 }
129 129
130 TEST(MinidumpExceptionWriter, Standard) { 130 TEST(MinidumpExceptionWriter, Standard) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 exception_information.push_back(kExceptionInformation0); 162 exception_information.push_back(kExceptionInformation0);
163 exception_information.push_back(kExceptionInformation1); 163 exception_information.push_back(kExceptionInformation1);
164 exception_information.push_back(kExceptionInformation2); 164 exception_information.push_back(kExceptionInformation2);
165 exception_writer->SetExceptionInformation(exception_information); 165 exception_writer->SetExceptionInformation(exception_information);
166 166
167 minidump_file_writer.AddStream(exception_writer.Pass()); 167 minidump_file_writer.AddStream(exception_writer.Pass());
168 168
169 StringFileWriter file_writer; 169 StringFileWriter file_writer;
170 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 170 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
171 171
172 const MINIDUMP_EXCEPTION_STREAM* observed_exception_stream; 172 const MINIDUMP_EXCEPTION_STREAM* observed_exception_stream = nullptr;
173 ASSERT_NO_FATAL_FAILURE( 173 ASSERT_NO_FATAL_FAILURE(
174 GetExceptionStream(file_writer.string(), &observed_exception_stream)); 174 GetExceptionStream(file_writer.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 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; 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 file_writer.string(), 194 file_writer.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) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 234
235 auto exception_writer = make_scoped_ptr(new MinidumpExceptionWriter()); 235 auto exception_writer = make_scoped_ptr(new MinidumpExceptionWriter());
236 exception_writer->InitializeFromSnapshot(&exception_snapshot, thread_id_map); 236 exception_writer->InitializeFromSnapshot(&exception_snapshot, thread_id_map);
237 237
238 MinidumpFileWriter minidump_file_writer; 238 MinidumpFileWriter minidump_file_writer;
239 minidump_file_writer.AddStream(exception_writer.Pass()); 239 minidump_file_writer.AddStream(exception_writer.Pass());
240 240
241 StringFileWriter file_writer; 241 StringFileWriter file_writer;
242 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 242 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
243 243
244 const MINIDUMP_EXCEPTION_STREAM* exception; 244 const MINIDUMP_EXCEPTION_STREAM* exception = nullptr;
245 ASSERT_NO_FATAL_FAILURE(GetExceptionStream(file_writer.string(), &exception)); 245 ASSERT_NO_FATAL_FAILURE(GetExceptionStream(file_writer.string(), &exception));
246 246
247 const MinidumpContextX86* observed_context; 247 const MinidumpContextX86* observed_context = nullptr;
248 ASSERT_NO_FATAL_FAILURE(ExpectExceptionStream(&expect_exception, 248 ASSERT_NO_FATAL_FAILURE(ExpectExceptionStream(&expect_exception,
249 exception, 249 exception,
250 file_writer.string(), 250 file_writer.string(),
251 &observed_context)); 251 &observed_context));
252 252
253 ASSERT_NO_FATAL_FAILURE( 253 ASSERT_NO_FATAL_FAILURE(
254 ExpectMinidumpContextX86(kSeed, observed_context, true)); 254 ExpectMinidumpContextX86(kSeed, observed_context, true));
255 } 255 }
256 256
257 TEST(MinidumpExceptionWriterDeathTest, NoContext) { 257 TEST(MinidumpExceptionWriterDeathTest, NoContext) {
(...skipping 10 matching lines...) Expand all
268 MinidumpExceptionWriter exception_writer; 268 MinidumpExceptionWriter exception_writer;
269 std::vector<uint64_t> exception_information(EXCEPTION_MAXIMUM_PARAMETERS + 1, 269 std::vector<uint64_t> exception_information(EXCEPTION_MAXIMUM_PARAMETERS + 1,
270 0x5a5a5a5a5a5a5a5a); 270 0x5a5a5a5a5a5a5a5a);
271 ASSERT_DEATH(exception_writer.SetExceptionInformation(exception_information), 271 ASSERT_DEATH(exception_writer.SetExceptionInformation(exception_information),
272 "kMaxParameters"); 272 "kMaxParameters");
273 } 273 }
274 274
275 } // namespace 275 } // namespace
276 } // namespace test 276 } // namespace test
277 } // namespace crashpad 277 } // namespace crashpad
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698