opjitconv.h

Go to the documentation of this file.
00001 
00017 #ifndef OPJITCONV_H
00018 #define OPJITCONV_H
00019 
00020 #define OP_JIT_CONV_OK 0
00021 #define OP_JIT_CONV_FAIL -1
00022 #define OP_JIT_CONV_NO_DUMPFILE 1
00023 #define OP_JIT_CONV_NO_ANON_SAMPLES 2
00024 #define OP_JIT_CONV_NO_MATCHING_ANON_SAMPLES 3
00025 #define OP_JIT_CONV_NO_JIT_RECS_IN_DUMPFILE 4
00026 #define OP_JIT_CONV_ALREADY_DONE 5
00027 #define OP_JIT_CONV_TMPDIR_NOT_REMOVED 6
00028 
00029 #include "config.h"
00030 #include <stddef.h>
00031 #include <bfd.h>
00032 #include <sys/stat.h>
00033 
00034 #include "op_list.h"
00035 #include "op_types.h"
00036 
00037 /* Structure that contains all information
00038  * for one function entry in the jit dump file.
00039  * the jit dump file gets mmapped and code and
00040  * symbol_name point directly into the file */
00041 struct jitentry {
00042     /* linked list. see jitentry_list */
00043     struct jitentry * next;
00044     /* vma */
00045     unsigned long long vma;
00046     /* point to code in the memory mapped file */
00047     void const * code;
00048     /* size of the jitted code */
00049     int code_size;
00050     /* point to the name in memory mapped jitdump file, or
00051      * to a malloced string, if we have a disambiguation replacement */
00052     char * symbol_name;
00053     /* sym_name_malloced ==1 means we need to free the memory when done. */
00054     int sym_name_malloced;
00055     /* seconds since epoch when the code was created */
00056     unsigned long long life_start;
00057     /* seconds since epoch when the code was overwritten */
00058     unsigned long long life_end;
00059     /* after ordering and partitioning this is the ELF
00060      * section we put this code to */
00061     asection * section;
00062 };
00063 
00064 struct jitentry_debug_line {
00065     struct jitentry_debug_line * next;
00066     struct jr_code_debug_info const * data;
00067     /* seconds since epoch when the code was created */
00068     unsigned long long life_start;
00069     /* seconds since epoch when the code was overwritten */
00070     unsigned long long life_end;
00071     void const * end;
00072 };
00073 
00074 struct op_jitdump_info
00075 {
00076     void * dmp_file;
00077     struct stat dmp_file_stat;
00078 };
00079 
00080 struct pathname
00081 {
00082     char * name;
00083     struct list_head neighbor;
00084 };
00085 
00086 struct jitdump_deletion_candidate
00087 {
00088     char * name;
00089     struct list_head neighbor;
00090 };
00091 
00092 /* jitsymbol.c */
00093 void create_arrays(void);
00094 int resolve_overlaps(unsigned long long start_time);
00095 void disambiguate_symbol_names(void);
00096 
00097 /* parse_dump.c */
00098 int parse_all(void const * start, void const * end,
00099           unsigned long long end_time);
00100 
00101 /* conversion.c */
00102 int op_jit_convert(struct op_jitdump_info file_info, char const * elffile,
00103                    unsigned long long start_time, unsigned long long end_time);
00104 
00105 /* create_bfd.c */
00106 bfd * open_elf(char const * filename);
00107 int partition_sections(void);
00108 int fill_sections(void);
00109 asection * create_section(bfd * abfd, char const * section_name,
00110               size_t size, bfd_vma vma, flagword flags);
00111 int fill_section_content(bfd * abfd, asection * section,
00112              void const * b, file_ptr offset, size_t sz);
00113 
00114 /* debug_line.c */
00115 int init_debug_line_info(bfd * abfd);
00116 int finalize_debug_line_info(bfd * abfd);
00117 
00118 /* jit dump header information */
00119 extern enum bfd_architecture dump_bfd_arch;
00120 extern int dump_bfd_mach;
00121 extern char const * dump_bfd_target_name;
00122 /*
00123  * list head.  The linked list is used during parsing (parse_all) to
00124  * hold all jitentry elements. After parsing, the program works on the
00125  * array structures (entries_symbols_ascending, entries_address_ascending)
00126  * and the linked list is not used any more.
00127  */
00128 extern struct jitentry * jitentry_list;
00129 /* count of jitentries in the list */
00130 extern u32 entry_count;
00131 /* list head for debug line information */
00132 extern struct jitentry_debug_line * jitentry_debug_line_list;
00133 /* maximum space in the entry arrays, needed to add entries */
00134 extern u32 max_entry_count;
00135 /* array pointing to all jit entries, sorted by symbol names */
00136 extern struct jitentry ** entries_symbols_ascending;
00137 /* array pointing to all jit entries sorted by address */
00138 extern struct jitentry ** entries_address_ascending;
00139 /* Global variable for asymbols so we can free the storage later. */
00140 extern asymbol ** syms;
00141 /* the bfd handle of the ELF file we write */
00142 extern bfd * cur_bfd;
00143 /* debug flag, print some information */
00144 extern int debug;
00145 
00146 
00147 #endif /* OPJITCONV_H */

Generated on 8 Nov 2012 for Oprofile by  doxygen 1.6.1