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

Side by Side Diff: snapshot/mac/mach_o_image_annotations_reader_test.cc

Issue 989713002: snapshot/mac: MachOImageAnnotationsReader test shouldn’t crash with a nullptr ProcessReader::Module (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: 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 | « no previous file | snapshot/mac/process_reader.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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 ProcessReader process_reader; 92 ProcessReader process_reader;
93 bool rv = process_reader.Initialize(task); 93 bool rv = process_reader.Initialize(task);
94 if (!rv) { 94 if (!rv) {
95 ADD_FAILURE(); 95 ADD_FAILURE();
96 } else { 96 } else {
97 const std::vector<ProcessReader::Module>& modules = 97 const std::vector<ProcessReader::Module>& modules =
98 process_reader.Modules(); 98 process_reader.Modules();
99 std::vector<std::string> all_annotations_vector; 99 std::vector<std::string> all_annotations_vector;
100 for (const ProcessReader::Module& module : modules) { 100 for (const ProcessReader::Module& module : modules) {
101 MachOImageAnnotationsReader module_annotations_reader( 101 if (module.reader) {
102 &process_reader, module.reader, module.name); 102 MachOImageAnnotationsReader module_annotations_reader(
103 std::vector<std::string> module_annotations_vector = 103 &process_reader, module.reader, module.name);
104 module_annotations_reader.Vector(); 104 std::vector<std::string> module_annotations_vector =
105 all_annotations_vector.insert(all_annotations_vector.end(), 105 module_annotations_reader.Vector();
106 module_annotations_vector.begin(), 106 all_annotations_vector.insert(all_annotations_vector.end(),
107 module_annotations_vector.end()); 107 module_annotations_vector.begin(),
108 module_annotations_vector.end());
109 } else {
110 EXPECT_TRUE(module.reader);
111 }
108 } 112 }
109 113
110 // Mac OS X 10.6 doesn’t have support for CrashReporter annotations 114 // Mac OS X 10.6 doesn’t have support for CrashReporter annotations
111 // (CrashReporterClient.h), so don’t look for any special annotations in 115 // (CrashReporterClient.h), so don’t look for any special annotations in
112 // that version. 116 // that version.
113 int mac_os_x_minor_version = MacOSXMinorVersion(); 117 int mac_os_x_minor_version = MacOSXMinorVersion();
114 if (mac_os_x_minor_version > 7) { 118 if (mac_os_x_minor_version > 7) {
115 EXPECT_GE(all_annotations_vector.size(), 1u); 119 EXPECT_GE(all_annotations_vector.size(), 1u);
116 120
117 const char* expected_annotation = nullptr; 121 const char* expected_annotation = nullptr;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 334
331 TEST(MachOImageAnnotationsReader, CrashDyld) { 335 TEST(MachOImageAnnotationsReader, CrashDyld) {
332 TestMachOImageAnnotationsReader test_mach_o_image_annotations_reader( 336 TestMachOImageAnnotationsReader test_mach_o_image_annotations_reader(
333 TestMachOImageAnnotationsReader::kCrashDyld); 337 TestMachOImageAnnotationsReader::kCrashDyld);
334 test_mach_o_image_annotations_reader.Run(); 338 test_mach_o_image_annotations_reader.Run();
335 } 339 }
336 340
337 } // namespace 341 } // namespace
338 } // namespace test 342 } // namespace test
339 } // namespace crashpad 343 } // namespace crashpad
OLDNEW
« no previous file with comments | « no previous file | snapshot/mac/process_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698