Index: src/arm/macro-assembler-arm.h |
=================================================================== |
--- src/arm/macro-assembler-arm.h (revision 2877) |
+++ src/arm/macro-assembler-arm.h (working copy) |
@@ -339,6 +339,35 @@ |
}; |
+#ifdef ENABLE_DEBUGGER_SUPPORT |
+// The code patcher is used to patch (typically) small parts of code e.g. for |
+// debugging and other types of instrumentation. When using the code patcher |
+// the exact number of bytes specified must be emitted. It is not legal to emit |
+// relocation information. If any of these constraints are violated it causes |
+// an assertion to fail. |
+class CodePatcher { |
+ public: |
+ CodePatcher(byte* address, int instructions); |
+ virtual ~CodePatcher(); |
+ |
+ // Macro assembler to emit code. |
+ MacroAssembler* masm() { return &masm_; } |
+ |
+ // Emit an instruction directly. |
+ void Emit(Instr x); |
+ |
+ // Emit an address directly. |
+ void Emit(Address addr); |
+ |
+ private: |
+ byte* address_; // The address of the code being patched. |
+ int instructions_; // Number of instructions of the expected patch size. |
+ int size_; // Number of bytes of the expected patch size. |
+ MacroAssembler masm_; // Macro assembler used to generate the code. |
+}; |
+#endif // ENABLE_DEBUGGER_SUPPORT |
+ |
+ |
// ----------------------------------------------------------------------------- |
// Static helper functions. |