Home | History | Annotate | Download | only in src
      1 // Copyright 2010 the V8 project authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef V8_GDB_JIT_H_
      6 #define V8_GDB_JIT_H_
      7 
      8 #include "src/allocation.h"
      9 
     10 //
     11 // Basic implementation of GDB JIT Interface client.
     12 // GBD JIT Interface is supported in GDB 7.0 and above.
     13 // Currently on x64 and ia32 architectures and Linux OS are supported.
     14 //
     15 
     16 #ifdef ENABLE_GDB_JIT_INTERFACE
     17 #include "src/v8.h"
     18 
     19 #include "src/factory.h"
     20 
     21 namespace v8 {
     22 namespace internal {
     23 
     24 class CompilationInfo;
     25 
     26 class GDBJITInterface: public AllStatic {
     27  public:
     28   enum CodeTag { NON_FUNCTION, FUNCTION };
     29 
     30   // Main entry point into GDB JIT realized as a JitCodeEventHandler.
     31   static void EventHandler(const v8::JitCodeEvent* event);
     32 
     33   static void AddCode(Handle<Name> name,
     34                       Handle<Script> script,
     35                       Handle<Code> code,
     36                       CompilationInfo* info);
     37 
     38   static void RemoveCodeRange(Address start, Address end);
     39 
     40  private:
     41   static void AddCode(const char* name, Code* code, CodeTag tag, Script* script,
     42                       CompilationInfo* info);
     43 
     44   static void RemoveCode(Code* code);
     45 };
     46 
     47 #define GDBJIT(action) GDBJITInterface::action
     48 
     49 } }   // namespace v8::internal
     50 #else
     51 #define GDBJIT(action) ((void) 0)
     52 #endif
     53 
     54 #endif
     55