GDB (API)
/home/stan/gdb/src/gdb/jit.h
Go to the documentation of this file.
00001 /* JIT declarations for GDB, the GNU Debugger.
00002 
00003    Copyright (C) 2009-2013 Free Software Foundation, Inc.
00004 
00005    This file is part of GDB.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 3 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00019 
00020 #ifndef JIT_H
00021 #define JIT_H
00022 
00023 /* When the JIT breakpoint fires, the inferior wants us to take one of
00024    these actions.  These values are used by the inferior, so the
00025    values of these enums cannot be changed.  */
00026 
00027 typedef enum
00028 {
00029   JIT_NOACTION = 0,
00030   JIT_REGISTER,
00031   JIT_UNREGISTER
00032 } jit_actions_t;
00033 
00034 /* This struct describes a single symbol file in a linked list of
00035    symbol files describing generated code.  As the inferior generates
00036    code, it adds these entries to the list, and when we attach to the
00037    inferior, we read them all.  For the first element prev_entry
00038    should be NULL, and for the last element next_entry should be
00039    NULL.  */
00040 
00041 struct jit_code_entry
00042 {
00043   CORE_ADDR next_entry;
00044   CORE_ADDR prev_entry;
00045   CORE_ADDR symfile_addr;
00046   ULONGEST symfile_size;
00047 };
00048 
00049 /* This is the global descriptor that the inferior uses to communicate
00050    information to the debugger.  To alert the debugger to take an
00051    action, the inferior sets the action_flag to the appropriate enum
00052    value, updates relevant_entry to point to the relevant code entry,
00053    and calls the function at the well-known symbol with our
00054    breakpoint.  We then read this descriptor from another global
00055    well-known symbol.  */
00056 
00057 struct jit_descriptor
00058 {
00059   uint32_t version;
00060   /* This should be jit_actions_t, but we want to be specific about the
00061      bit-width.  */
00062   uint32_t action_flag;
00063   CORE_ADDR relevant_entry;
00064   CORE_ADDR first_entry;
00065 };
00066 
00067 /* Looks for the descriptor and registration symbols and breakpoints
00068    the registration function.  If it finds both, it registers all the
00069    already JITed code.  If it has already found the symbols, then it
00070    doesn't try again.  */
00071 
00072 extern void jit_inferior_created_hook (void);
00073 
00074 /* Re-establish the jit breakpoint(s).  */
00075 
00076 extern void jit_breakpoint_re_set (void);
00077 
00078 /* This function is called by handle_inferior_event when it decides
00079    that the JIT event breakpoint has fired.  */
00080 
00081 extern void jit_event_handler (struct gdbarch *gdbarch);
00082 
00083 #endif /* JIT_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines