| <html lang="en"> |
| <head> |
| <title>JIT Interface - Debugging with GDB</title> |
| <meta http-equiv="Content-Type" content="text/html"> |
| <meta name="description" content="Debugging with GDB"> |
| <meta name="generator" content="makeinfo 4.13"> |
| <link title="Top" rel="start" href="index.html#Top"> |
| <link rel="prev" href="Annotations.html#Annotations" title="Annotations"> |
| <link rel="next" href="In_002dProcess-Agent.html#In_002dProcess-Agent" title="In-Process Agent"> |
| <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> |
| <!-- |
| Copyright (C) 1988-2019 Free Software Foundation, Inc. |
| |
| Permission is granted to copy, distribute and/or modify this document |
| under the terms of the GNU Free Documentation License, Version 1.3 or |
| any later version published by the Free Software Foundation; with the |
| Invariant Sections being ``Free Software'' and ``Free Software Needs |
| Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,'' |
| and with the Back-Cover Texts as in (a) below. |
| |
| (a) The FSF's Back-Cover Text is: ``You are free to copy and modify |
| this GNU Manual. Buying copies from GNU Press supports the FSF in |
| developing GNU and promoting software freedom.'' |
| --> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <style type="text/css"><!-- |
| pre.display { font-family:inherit } |
| pre.format { font-family:inherit } |
| pre.smalldisplay { font-family:inherit; font-size:smaller } |
| pre.smallformat { font-family:inherit; font-size:smaller } |
| pre.smallexample { font-size:smaller } |
| pre.smalllisp { font-size:smaller } |
| span.sc { font-variant:small-caps } |
| span.roman { font-family:serif; font-weight:normal; } |
| span.sansserif { font-family:sans-serif; font-weight:normal; } |
| --></style> |
| </head> |
| <body> |
| <div class="node"> |
| <a name="JIT-Interface"></a> |
| <p> |
| Next: <a rel="next" accesskey="n" href="In_002dProcess-Agent.html#In_002dProcess-Agent">In-Process Agent</a>, |
| Previous: <a rel="previous" accesskey="p" href="Annotations.html#Annotations">Annotations</a>, |
| Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a> |
| <hr> |
| </div> |
| |
| <h2 class="chapter">29 JIT Compilation Interface</h2> |
| |
| <p><a name="index-just_002din_002dtime-compilation-3150"></a><a name="index-JIT-compilation-interface-3151"></a> |
| This chapter documents <span class="sc">gdb</span>'s <dfn>just-in-time</dfn> (JIT) compilation |
| interface. A JIT compiler is a program or library that generates native |
| executable code at runtime and executes it, usually in order to achieve good |
| performance while maintaining platform independence. |
| |
| <p>Programs that use JIT compilation are normally difficult to debug because |
| portions of their code are generated at runtime, instead of being loaded from |
| object files, which is where <span class="sc">gdb</span> normally finds the program's symbols |
| and debug information. In order to debug programs that use JIT compilation, |
| <span class="sc">gdb</span> has an interface that allows the program to register in-memory |
| symbol files with <span class="sc">gdb</span> at runtime. |
| |
| <p>If you are using <span class="sc">gdb</span> to debug a program that uses this interface, then |
| it should work transparently so long as you have not stripped the binary. If |
| you are developing a JIT compiler, then the interface is documented in the rest |
| of this chapter. At this time, the only known client of this interface is the |
| LLVM JIT. |
| |
| <p>Broadly speaking, the JIT interface mirrors the dynamic loader interface. The |
| JIT compiler communicates with <span class="sc">gdb</span> by writing data into a global |
| variable and calling a fuction at a well-known symbol. When <span class="sc">gdb</span> |
| attaches, it reads a linked list of symbol files from the global variable to |
| find existing code, and puts a breakpoint in the function so that it can find |
| out about additional code. |
| |
| <ul class="menu"> |
| <li><a accesskey="1" href="Declarations.html#Declarations">Declarations</a>: Relevant C struct declarations |
| <li><a accesskey="2" href="Registering-Code.html#Registering-Code">Registering Code</a>: Steps to register code |
| <li><a accesskey="3" href="Unregistering-Code.html#Unregistering-Code">Unregistering Code</a>: Steps to unregister code |
| <li><a accesskey="4" href="Custom-Debug-Info.html#Custom-Debug-Info">Custom Debug Info</a>: Emit debug information in a custom format |
| </ul> |
| |
| </body></html> |
| |