| OLD | NEW |
| 1 // Copyright (c) 2013 Google Inc. | 1 // Copyright (c) 2013 Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 #ifndef _WIN32 | 79 #ifndef _WIN32 |
| 80 // Disassembles raw bytes via objdump and pipes the output into the provided | 80 // Disassembles raw bytes via objdump and pipes the output into the provided |
| 81 // buffer, given the desired architecture, the file from which objdump will | 81 // buffer, given the desired architecture, the file from which objdump will |
| 82 // read, and the buffer length. The method returns whether the disassembly | 82 // read, and the buffer length. The method returns whether the disassembly |
| 83 // was a success, and the caller owns all pointers. | 83 // was a success, and the caller owns all pointers. |
| 84 static bool DisassembleBytes(const string &architecture, | 84 static bool DisassembleBytes(const string &architecture, |
| 85 const uint8_t *raw_bytes, | 85 const uint8_t *raw_bytes, |
| 86 const unsigned int MAX_OBJDUMP_BUFFER_LEN, | 86 const unsigned int MAX_OBJDUMP_BUFFER_LEN, |
| 87 char *objdump_output_buffer); | 87 char *objdump_output_buffer); |
| 88 | 88 |
| 89 // Parses the objdump output given in |objdump_output_buffer| and extracts |
| 90 // the line of the first instruction into |instruction_line|. Returns true |
| 91 // when the instruction line is successfully extracted. |
| 92 static bool GetObjdumpInstructionLine( |
| 93 const char *objdump_output_buffer, |
| 94 string *instruction_line); |
| 95 |
| 89 // Tokenizes out the operation and operands from a line of instruction | 96 // Tokenizes out the operation and operands from a line of instruction |
| 90 // disassembled by objdump. This method modifies the pointers to match the | 97 // disassembled by objdump. This method modifies the pointers to match the |
| 91 // tokens of the instruction, and returns if the tokenizing was a success. | 98 // tokens of the instruction, and returns if the tokenizing was a success. |
| 92 // The caller owns all pointers. | 99 // The caller owns all pointers. |
| 93 static bool TokenizeObjdumpInstruction(const string &line, | 100 static bool TokenizeObjdumpInstruction(const string &line, |
| 94 string *operation, | 101 string *operation, |
| 95 string *dest, | 102 string *dest, |
| 96 string *src); | 103 string *src); |
| 97 | 104 |
| 98 // Calculates the effective address of an expression in the form reg+a or | 105 // Calculates the effective address of an expression in the form reg+a or |
| (...skipping 14 matching lines...) Expand all Loading... |
| 113 bool ExecutableStackOrHeap(); | 120 bool ExecutableStackOrHeap(); |
| 114 | 121 |
| 115 // Whether this exploitability engine is permitted to shell out to objdump | 122 // Whether this exploitability engine is permitted to shell out to objdump |
| 116 // to disassemble raw bytes. | 123 // to disassemble raw bytes. |
| 117 bool enable_objdump_; | 124 bool enable_objdump_; |
| 118 }; | 125 }; |
| 119 | 126 |
| 120 } // namespace google_breakpad | 127 } // namespace google_breakpad |
| 121 | 128 |
| 122 #endif // GOOGLE_BREAKPAD_PROCESSOR_EXPLOITABILITY_LINUX_H_ | 129 #endif // GOOGLE_BREAKPAD_PROCESSOR_EXPLOITABILITY_LINUX_H_ |
| OLD | NEW |