@@ -162,8 +162,10 @@ TEST(MinidumpYAML, ExceptionStream) {
162
162
163
163
ASSERT_EQ (1u , File.streams ().size ());
164
164
165
- Expected<const minidump::ExceptionStream &> ExpectedStream =
166
- File.getExceptionStream ();
165
+ auto ExceptionIterator =
166
+ File.getExceptionStreams ().begin ();
167
+
168
+ Expected<const ExceptionStream &> ExpectedStream = *ExceptionIterator;
167
169
168
170
ASSERT_THAT_EXPECTED (ExpectedStream, Succeeded ());
169
171
@@ -205,9 +207,10 @@ TEST(MinidumpYAML, ExceptionStream_NoParameters) {
205
207
206
208
ASSERT_EQ (1u , File.streams ().size ());
207
209
208
- Expected< const minidump::ExceptionStream &> ExpectedStream =
209
- File.getExceptionStream ();
210
+ auto ExceptionIterator =
211
+ File.getExceptionStreams (). begin ();
210
212
213
+ Expected<const ExceptionStream &> ExpectedStream = *ExceptionIterator;
211
214
ASSERT_THAT_EXPECTED (ExpectedStream, Succeeded ());
212
215
213
216
const minidump::ExceptionStream &Stream = *ExpectedStream;
@@ -261,8 +264,10 @@ TEST(MinidumpYAML, ExceptionStream_TooManyParameters) {
261
264
262
265
ASSERT_EQ (1u , File.streams ().size ());
263
266
264
- Expected<const minidump::ExceptionStream &> ExpectedStream =
265
- File.getExceptionStream ();
267
+ auto ExceptionIterator =
268
+ File.getExceptionStreams ().begin ();
269
+
270
+ Expected<const ExceptionStream &> ExpectedStream = *ExceptionIterator;
266
271
267
272
ASSERT_THAT_EXPECTED (ExpectedStream, Succeeded ());
268
273
@@ -312,8 +317,10 @@ TEST(MinidumpYAML, ExceptionStream_ExtraParameter) {
312
317
313
318
ASSERT_EQ (1u , File.streams ().size ());
314
319
315
- Expected<const minidump::ExceptionStream &> ExpectedStream =
316
- File.getExceptionStream ();
320
+ auto ExceptionIterator =
321
+ File.getExceptionStreams ().begin ();
322
+
323
+ Expected<const ExceptionStream &> ExpectedStream = *ExceptionIterator;
317
324
318
325
ASSERT_THAT_EXPECTED (ExpectedStream, Succeeded ());
319
326
@@ -398,4 +405,47 @@ TEST(MinidumpYAML, MemoryRegion_64bit) {
398
405
ASSERT_THAT (*DescTwoExpectedContentSlice, arrayRefFromStringRef (" world" ));
399
406
400
407
ASSERT_EQ (Iterator, MemoryList.end ());
408
+
409
+ }
410
+
411
+ // Test that we can parse multiple exception streams.
412
+ TEST (MinidumpYAML, ExceptionStream_MultipleExceptions) {
413
+ SmallString<0 > Storage;
414
+ auto ExpectedFile = toBinary (Storage, R"(
415
+ --- !minidump
416
+ Streams:
417
+ - Type: Exception
418
+ Thread ID: 0x7
419
+ Exception Record:
420
+ Exception Code: 0x23
421
+ Exception Flags: 0x5
422
+ Exception Record: 0x0102030405060708
423
+ Exception Address: 0x0a0b0c0d0e0f1011
424
+ Number of Parameters: 2
425
+ Parameter 0: 0x99
426
+ Parameter 1: 0x23
427
+ Parameter 2: 0x42
428
+ Thread Context: 3DeadBeefDefacedABadCafe
429
+ - Type: Exception
430
+ Thread ID: 0x5
431
+ Exception Record:
432
+ Exception Code: 0x23
433
+ Exception Flags: 0x5
434
+ Exception Record: 0x0102030405060708
435
+ Exception Address: 0x0a0b0c0d0e0f1011
436
+ Thread Context: 3DeadBeefDefacedABadCafe)" );
437
+
438
+ ASSERT_THAT_EXPECTED (ExpectedFile, Succeeded ());
439
+ object::MinidumpFile &File = **ExpectedFile;
440
+
441
+ ASSERT_EQ (2u , File.streams ().size ());
442
+
443
+ size_t count = 0 ;
444
+ for (auto exception_stream : File.getExceptionStreams ()) {
445
+ count++;
446
+ ASSERT_THAT_EXPECTED (exception_stream, Succeeded ());
447
+ ASSERT_THAT (0x23u , exception_stream->ExceptionRecord .ExceptionCode );
448
+ }
449
+
450
+ ASSERT_THAT (2u , count);
401
451
}
0 commit comments