Ben Murdoch | b8e0da2 | 2011-05-16 14:20:40 +0100 | [diff] [blame] | 1 | // Copyright 2010 the V8 project authors. All rights reserved. |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Ben Murdoch | b8e0da2 | 2011-05-16 14:20:40 +0100 | [diff] [blame] | 4 | |
| 5 | #ifndef V8_GDB_JIT_H_ |
| 6 | #define V8_GDB_JIT_H_ |
| 7 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 8 | #include "include/v8.h" |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 9 | |
Ben Murdoch | b8e0da2 | 2011-05-16 14:20:40 +0100 | [diff] [blame] | 10 | // |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 11 | // GDB has two ways of interacting with JIT code. With the "JIT compilation |
| 12 | // interface", V8 can tell GDB when it emits JIT code. Unfortunately to do so, |
| 13 | // it has to create platform-native object files, possibly with platform-native |
| 14 | // debugging information. Currently only ELF and Mach-O are supported, which |
| 15 | // limits this interface to Linux and Mac OS. This JIT compilation interface |
| 16 | // was introduced in GDB 7.0. V8 support can be enabled with the --gdbjit flag. |
Ben Murdoch | b8e0da2 | 2011-05-16 14:20:40 +0100 | [diff] [blame] | 17 | // |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 18 | // The other way that GDB can know about V8 code is via the "custom JIT reader" |
| 19 | // interface, in which a GDB extension parses V8's private data to determine the |
| 20 | // function, file, and line of a JIT frame, and how to unwind those frames. |
| 21 | // This interface was introduced in GDB 7.6. This interface still relies on V8 |
| 22 | // to register its code via the JIT compilation interface, but doesn't require |
| 23 | // that V8 create ELF images. Support will be added for this interface in the |
| 24 | // future. |
| 25 | // |
Ben Murdoch | b8e0da2 | 2011-05-16 14:20:40 +0100 | [diff] [blame] | 26 | |
| 27 | namespace v8 { |
| 28 | namespace internal { |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 29 | namespace GDBJITInterface { |
| 30 | #ifdef ENABLE_GDB_JIT_INTERFACE |
| 31 | // JitCodeEventHandler that creates ELF/Mach-O objects and registers them with |
| 32 | // GDB. |
| 33 | void EventHandler(const v8::JitCodeEvent* event); |
Ben Murdoch | b8e0da2 | 2011-05-16 14:20:40 +0100 | [diff] [blame] | 34 | #endif |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 35 | } // namespace GDBJITInterface |
| 36 | } // namespace internal |
| 37 | } // namespace v8 |
Ben Murdoch | b8e0da2 | 2011-05-16 14:20:40 +0100 | [diff] [blame] | 38 | |
| 39 | #endif |