OLD | NEW |
1 // copyright notice, this list of conditions and the following disclaimer | 1 // copyright notice, this list of conditions and the following disclaimer |
2 // in the documentation and/or other materials provided with the | 2 // in the documentation and/or other materials provided with the |
3 // distribution. | 3 // distribution. |
4 // * Neither the name of Google Inc. nor the names of its | 4 // * Neither the name of Google Inc. nor the names of its |
5 // contributors may be used to endorse or promote products derived from | 5 // contributors may be used to endorse or promote products derived from |
6 // this software without specific prior written permission. | 6 // this software without specific prior written permission. |
7 // | 7 // |
8 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 8 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
9 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 9 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
10 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 10 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
11 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 11 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
12 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 12 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
13 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 13 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
14 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 14 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
15 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 15 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
16 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 16 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
17 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 17 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
18 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 18 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
19 | 19 |
20 // disassembler_x86.cc: simple x86 disassembler. | 20 // disassembler_x86.cc: simple x86 disassembler. |
21 // | 21 // |
22 // Provides single step disassembly of x86 bytecode and flags instructions | 22 // Provides single step disassembly of x86 bytecode and flags instructions |
23 // that utilize known bad register values. | 23 // that utilize known bad register values. |
24 // | 24 // |
25 // Author: Cris Neckar | 25 // Author: Cris Neckar |
26 | 26 |
27 #include "processor/disassembler_x86.h" | 27 #include "processor/disassembler_x86.h" |
28 | 28 |
29 #include <string.h> | 29 #include <string.h> |
30 #include <unistd.h> | |
31 | 30 |
32 namespace google_breakpad { | 31 namespace google_breakpad { |
33 | 32 |
34 DisassemblerX86::DisassemblerX86(const uint8_t *bytecode, | 33 DisassemblerX86::DisassemblerX86(const uint8_t *bytecode, |
35 uint32_t size, | 34 uint32_t size, |
36 uint32_t virtual_address) : | 35 uint32_t virtual_address) : |
37 bytecode_(bytecode), | 36 bytecode_(bytecode), |
38 size_(size), | 37 size_(size), |
39 virtual_address_(virtual_address), | 38 virtual_address_(virtual_address), |
40 current_byte_offset_(0), | 39 current_byte_offset_(0), |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 if (!operand || operand->type != libdis::op_expression) | 231 if (!operand || operand->type != libdis::op_expression) |
233 return false; | 232 return false; |
234 | 233 |
235 memcpy(&bad_register_, &operand->data.expression.base, | 234 memcpy(&bad_register_, &operand->data.expression.base, |
236 sizeof(libdis::x86_reg_t)); | 235 sizeof(libdis::x86_reg_t)); |
237 register_valid_ = true; | 236 register_valid_ = true; |
238 return true; | 237 return true; |
239 } | 238 } |
240 | 239 |
241 } // namespace google_breakpad | 240 } // namespace google_breakpad |
OLD | NEW |