Chromium Code Reviews| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 //! This value comes from the `filetype` field of the `mach_header` or | 69 //! This value comes from the `filetype` field of the `mach_header` or |
| 70 //! `mach_header_64`. Common values include `MH_EXECUTE`, `MH_DYLIB`, | 70 //! `mach_header_64`. Common values include `MH_EXECUTE`, `MH_DYLIB`, |
| 71 //! `MH_DYLINKER`, and `MH_BUNDLE`. | 71 //! `MH_DYLINKER`, and `MH_BUNDLE`. |
| 72 uint32_t FileType() const { return file_type_; } | 72 uint32_t FileType() const { return file_type_; } |
| 73 | 73 |
| 74 //! \brief Returns the Mach-O image’s load address. | 74 //! \brief Returns the Mach-O image’s load address. |
| 75 //! | 75 //! |
| 76 //! This is the value passed as \a address to Initialize(). | 76 //! This is the value passed as \a address to Initialize(). |
| 77 mach_vm_address_t Address() const { return address_; } | 77 mach_vm_address_t Address() const { return address_; } |
| 78 | 78 |
| 79 //! \brief Returns the mapped size of the Mach-O image’s __TEXT segment. | 79 //! \brief Returns the mapped size of the Mach-O image’s `__TEXT` segment. |
| 80 //! | 80 //! |
| 81 //! Note that this is returns only the size of the __TEXT segment, not of any | 81 //! Note that this is returns only the size of the `__TEXT` segment, not of |
| 82 //! other segment. This is because the interface only allows one load address | 82 //! any other segment. This is because the interface only allows one load |
| 83 //! and size to be reported, but Mach-O image files may consist of multiple | 83 //! address and size to be reported, but Mach-O image files may consist of |
| 84 //! discontiguous segments. By convention, the __TEXT segment is always mapped | 84 //! multiple discontiguous segments. By convention, the `__TEXT` segment is |
| 85 //! at the beginning of a Mach-O image file, and it is the most useful for the | 85 //! always mapped at the beginning of a Mach-O image file, and it is the most |
| 86 //! expected intended purpose of collecting data to obtain stack backtraces. | 86 //! useful for the expected intended purpose of collecting data to obtain |
| 87 //! The implementation insists during initialization that the __TEXT segment | 87 //! stack backtraces. The implementation insists during initialization that |
| 88 //! be mapped at the beginning of the file. | 88 //! the `__TEXT` segment be mapped at the beginning of the file. |
| 89 //! | 89 //! |
| 90 //! In practice, discontiguous segments are only found for images that have | 90 //! In practice, discontiguous segments are only found for images that have |
| 91 //! loaded out of the dyld shared cache, but the __TEXT segment’s size is | 91 //! loaded out of the dyld shared cache, but the `__TEXT` segment’s size is |
| 92 //! returned for modules that loaded with contiguous segments as well for | 92 //! returned for modules that loaded with contiguous segments as well for |
| 93 //! consistency. | 93 //! consistency. |
| 94 mach_vm_size_t Size() const { return size_; } | 94 mach_vm_size_t Size() const { return size_; } |
| 95 | 95 |
| 96 //! \brief Returns the Mach-O image’s “slide,” the difference between its | 96 //! \brief Returns the Mach-O image’s “slide,” the difference between its |
| 97 //! actual load address and its preferred load address. | 97 //! actual load address and its preferred load address. |
| 98 //! | 98 //! |
| 99 //! “Slide” is computed by subtracting the __TEXT segment’s preferred load | 99 //! “Slide” is computed by subtracting the `__TEXT` segment’s preferred load |
| 100 //! address from its actual load address. It will be reported as a positive | 100 //! address from its actual load address. It will be reported as a positive |
| 101 //! offset when the actual load address is greater than the preferred load | 101 //! offset when the actual load address is greater than the preferred load |
| 102 //! address. The preferred load address is taken to be the segment’s reported | 102 //! address. The preferred load address is taken to be the segment’s reported |
| 103 //! `vmaddr` value. | 103 //! `vmaddr` value. |
| 104 mach_vm_size_t Slide() const { return slide_; } | 104 mach_vm_size_t Slide() const { return slide_; } |
| 105 | 105 |
| 106 //! \brief Obtain segment information by segment name. | 106 //! \brief Obtain segment information by segment name. |
| 107 //! | 107 //! |
| 108 //! \param[in] segment_name The name of the segment to search for, for | 108 //! \param[in] segment_name The name of the segment to search for, for |
| 109 //! example, `"__TEXT"`. | 109 //! example, `"__TEXT"`. |
|
Robert Sesek
2014/09/16 21:19:37
You have "" here and a few other places.
Mark Mentovai
2014/09/16 21:29:56
Where they’re string names, I used "quotes".
| |
| 110 //! | 110 //! |
| 111 //! \return A pointer to the segment information if it was found, or `NULL` if | 111 //! \return A pointer to the segment information if it was found, or `NULL` if |
| 112 //! it was not found. The caller does not take ownership; the lifetime of | 112 //! it was not found. The caller does not take ownership; the lifetime of |
| 113 //! the returned object is scoped to the lifetime of this MachOImageReader | 113 //! the returned object is scoped to the lifetime of this MachOImageReader |
| 114 //! object. | 114 //! object. |
| 115 const MachOImageSegmentReader* GetSegmentByName( | 115 const MachOImageSegmentReader* GetSegmentByName( |
| 116 const std::string& segment_name) const; | 116 const std::string& segment_name) const; |
| 117 | 117 |
| 118 //! \brief Obtain section information by segment and section name. | 118 //! \brief Obtain section information by segment and section name. |
| 119 //! | 119 //! |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 333 // set. symbol_table_initialized_ will be valid without symbol_table_ being | 333 // set. symbol_table_initialized_ will be valid without symbol_table_ being |
| 334 // set in modules that have no symbol table. | 334 // set in modules that have no symbol table. |
| 335 mutable InitializationState symbol_table_initialized_; | 335 mutable InitializationState symbol_table_initialized_; |
| 336 | 336 |
| 337 DISALLOW_COPY_AND_ASSIGN(MachOImageReader); | 337 DISALLOW_COPY_AND_ASSIGN(MachOImageReader); |
| 338 }; | 338 }; |
| 339 | 339 |
| 340 } // namespace crashpad | 340 } // namespace crashpad |
| 341 | 341 |
| 342 #endif // CRASHPAD_UTIL_MAC_MACH_O_IMAGE_READER_H_ | 342 #endif // CRASHPAD_UTIL_MAC_MACH_O_IMAGE_READER_H_ |
| OLD | NEW |