OLD | NEW |
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 SegmentAndSectionNameString(section.segname, section.sectname); | 114 SegmentAndSectionNameString(section.segname, section.sectname); |
115 | 115 |
116 std::string section_info = base::StringPrintf(", section %s %zu/%zu%s", | 116 std::string section_info = base::StringPrintf(", section %s %zu/%zu%s", |
117 section_full_name.c_str(), | 117 section_full_name.c_str(), |
118 section_index, | 118 section_index, |
119 sections_.size(), | 119 sections_.size(), |
120 load_command_info.c_str()); | 120 load_command_info.c_str()); |
121 | 121 |
122 if (section_segment_name != segment_name) { | 122 if (section_segment_name != segment_name) { |
123 // cl_kernels modules (for OpenCL) aren’t ld output, and they’re formatted | 123 // cl_kernels modules (for OpenCL) aren’t ld output, and they’re formatted |
124 // incorrectly on Mac OS X 10.10. They have a single __TEXT segment, but | 124 // incorrectly on OS X 10.10 and 10.11. They have a single __TEXT segment, |
125 // one of the sections within it claims to belong to the __LD segment. | 125 // but one of the sections within it claims to belong to the __LD segment. |
126 // This mismatch shouldn’t happen. This errant section also has the | 126 // This mismatch shouldn’t happen. This errant section also has the |
127 // S_ATTR_DEBUG flag set, which shouldn’t happen unless all of the other | 127 // S_ATTR_DEBUG flag set, which shouldn’t happen unless all of the other |
128 // sections in the segment also have this bit set (they don’t). These odd | 128 // sections in the segment also have this bit set (they don’t). These odd |
129 // sections are reminiscent of unwind information stored in MH_OBJECT | 129 // sections are reminiscent of unwind information stored in MH_OBJECT |
130 // images, although cl_kernels images claim to be MH_BUNDLE. Because at | 130 // images, although cl_kernels images claim to be MH_BUNDLE. Because at |
131 // least one cl_kernels module will commonly be found in a process, and | 131 // least one cl_kernels module will commonly be found in a process, and |
132 // sometimes more will be, tolerate this quirk. | 132 // sometimes more will be, tolerate this quirk. |
133 // | 133 // |
134 // https://openradar.appspot.com/20239912 | 134 // https://openradar.appspot.com/20239912 |
135 if (!(file_type == MH_BUNDLE && | 135 bool ok = false; |
136 module_name == "cl_kernels" && | 136 if (file_type == MH_BUNDLE && module_name == "cl_kernels") { |
137 MacOSXMinorVersion() == 10 && | 137 int mac_os_x_minor_version = MacOSXMinorVersion(); |
| 138 if ((mac_os_x_minor_version == 10 || mac_os_x_minor_version == 11) && |
138 segment_name == SEG_TEXT && | 139 segment_name == SEG_TEXT && |
139 section_segment_name == "__LD" && | 140 section_segment_name == "__LD" && |
140 section_name == "__compact_unwind" && | 141 section_name == "__compact_unwind" && |
141 (section.flags & S_ATTR_DEBUG))) { | 142 (section.flags & S_ATTR_DEBUG)) { |
| 143 ok = true; |
| 144 } |
| 145 } |
| 146 |
| 147 if (!ok) { |
142 LOG(WARNING) << "section.segname incorrect in segment " << segment_name | 148 LOG(WARNING) << "section.segname incorrect in segment " << segment_name |
143 << section_info; | 149 << section_info; |
144 return false; | 150 return false; |
145 } | 151 } |
146 } | 152 } |
147 | 153 |
148 CheckedMachAddressRange section_range( | 154 CheckedMachAddressRange section_range( |
149 process_reader->Is64Bit(), section.addr, section.size); | 155 process_reader->Is64Bit(), section.addr, section.size); |
150 if (!section_range.IsValid()) { | 156 if (!section_range.IsValid()) { |
151 LOG(WARNING) << base::StringPrintf( | 157 LOG(WARNING) << base::StringPrintf( |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 } | 298 } |
293 | 299 |
294 void MachOImageSegmentReader::SetSlide(mach_vm_size_t slide) { | 300 void MachOImageSegmentReader::SetSlide(mach_vm_size_t slide) { |
295 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 301 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
296 INITIALIZATION_STATE_SET_INITIALIZING(initialized_slide_); | 302 INITIALIZATION_STATE_SET_INITIALIZING(initialized_slide_); |
297 slide_ = slide; | 303 slide_ = slide; |
298 INITIALIZATION_STATE_SET_VALID(initialized_slide_); | 304 INITIALIZATION_STATE_SET_VALID(initialized_slide_); |
299 } | 305 } |
300 | 306 |
301 } // namespace crashpad | 307 } // namespace crashpad |
OLD | NEW |