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

Side by Side Diff: snapshot/win/pe_image_reader.h

Issue 1411123011: win: Don't attempt to read a nonexistent IMAGE_DIRECTORY_ENTRY_DEBUG (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 5 years, 1 month 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/win/pe_image_reader.cc » ('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 2015 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 //! \param[out] pdbname Name of the pdb file. 102 //! \param[out] pdbname Name of the pdb file.
103 //! \return `true` on success, or `false` if the module has no debug directory 103 //! \return `true` on success, or `false` if the module has no debug directory
104 //! entry. 104 //! entry.
105 bool DebugDirectoryInformation(UUID* uuid, 105 bool DebugDirectoryInformation(UUID* uuid,
106 DWORD* age, 106 DWORD* age,
107 std::string* pdbname) const; 107 std::string* pdbname) const;
108 108
109 private: 109 private:
110 //! \brief Implementation helper for DebugDirectoryInformation() templated by 110 //! \brief Implementation helper for DebugDirectoryInformation() templated by
111 //! `IMAGE_NT_HEADERS` type for different bitnesses. 111 //! `IMAGE_NT_HEADERS` type for different bitnesses.
112 //!
113 //! \return `true` on success, with the parameters set appropriately. `false`
114 //! on failure. This method may return `false` without logging anything in
115 //! the case of a module that does not contain relevant debugging
116 //! information but is otherwise properly structured.
112 template <class NtHeadersType> 117 template <class NtHeadersType>
113 bool ReadDebugDirectoryInformation(UUID* uuid, 118 bool ReadDebugDirectoryInformation(UUID* uuid,
114 DWORD* age, 119 DWORD* age,
115 std::string* pdbname) const; 120 std::string* pdbname) const;
116 121
117 //! \brief Reads the `IMAGE_NT_HEADERS` from the beginning of the image. 122 //! \brief Reads the `IMAGE_NT_HEADERS` from the beginning of the image.
123 //!
124 //! \param[out] nt_headers The contents of the templated NtHeadersType
125 //! structure read from the remote process.
126 //! \param[out] nt_headers_address The address of the templated NtHeadersType
127 //! structure in the remote process’ address space. If this information is
128 //! not needed, this parameter may be `nullptr`.
129 //!
130 //! \return `true` on success, with \a nt_headers and optionally \a
131 //! nt_headers_address set appropriately. `false` on failure, with a
132 //! message logged.
118 template <class NtHeadersType> 133 template <class NtHeadersType>
119 bool ReadNtHeaders(WinVMAddress* nt_header_address, 134 bool ReadNtHeaders(NtHeadersType* nt_headers,
120 NtHeadersType* nt_headers) const; 135 WinVMAddress* nt_headers_address) const;
121 136
122 //! \brief Finds a given section by name in the image. 137 //! \brief Finds a given section by name in the image.
123 template <class NtHeadersType> 138 template <class NtHeadersType>
124 bool GetSectionByName(const std::string& name, 139 bool GetSectionByName(const std::string& name,
125 IMAGE_SECTION_HEADER* section) const; 140 IMAGE_SECTION_HEADER* section) const;
126 141
127 //! \brief Reads memory from target process, first checking whether the range 142 //! \brief Reads memory from target process, first checking whether the range
128 //! requested falls inside module_range_. 143 //! requested falls inside module_range_.
129 //! 144 //!
130 //! \return `true` on success, with \a into filled out, otherwise `false` and 145 //! \return `true` on success, with \a into filled out, otherwise `false` and
131 //! a message will be logged. 146 //! a message will be logged.
132 bool CheckedReadMemory(WinVMAddress address, 147 bool CheckedReadMemory(WinVMAddress address,
133 WinVMSize size, 148 WinVMSize size,
134 void* into) const; 149 void* into) const;
135 150
136 ProcessReaderWin* process_reader_; // weak 151 ProcessReaderWin* process_reader_; // weak
137 CheckedWinAddressRange module_range_; 152 CheckedWinAddressRange module_range_;
138 std::string module_name_; 153 std::string module_name_;
139 InitializationStateDcheck initialized_; 154 InitializationStateDcheck initialized_;
140 155
141 DISALLOW_COPY_AND_ASSIGN(PEImageReader); 156 DISALLOW_COPY_AND_ASSIGN(PEImageReader);
142 }; 157 };
143 158
144 } // namespace crashpad 159 } // namespace crashpad
145 160
146 #endif // CRASHPAD_SNAPSHOT_WIN_PE_IMAGE_READER_H_ 161 #endif // CRASHPAD_SNAPSHOT_WIN_PE_IMAGE_READER_H_
OLDNEW
« no previous file with comments | « no previous file | snapshot/win/pe_image_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698