Daniel Malea | 094881f | 2011-12-14 17:39:16 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2012, The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | // This file contains portions derived from LLVM, with the original copyright |
| 18 | // header below: |
| 19 | //===-------------- GDBJIT.h - Register debug symbols for JIT -------------===// |
| 20 | // |
| 21 | // The LLVM Compiler Infrastructure |
| 22 | // |
| 23 | // This file is distributed under the University of Illinois Open Source |
| 24 | // License. See LICENSE.TXT for details. |
| 25 | // |
| 26 | //===----------------------------------------------------------------------===// |
| 27 | // |
| 28 | // This file defines the data structures used by JIT engines to register object |
| 29 | // files (ideally containing debug info) with GDB. |
| 30 | // |
| 31 | //===----------------------------------------------------------------------===// |
| 32 | |
| 33 | #ifndef BCC_EXECUTION_ENGINE_GDB_JIT_H |
| 34 | #define BCC_EXECUTION_ENGINE_GDB_JIT_H |
| 35 | |
Stephen Hines | 2f6a493 | 2012-05-03 12:27:13 -0700 | [diff] [blame] | 36 | #include "llvm/Support/DataTypes.h" |
| 37 | #include "llvm/Support/Compiler.h" |
Daniel Malea | 094881f | 2011-12-14 17:39:16 -0500 | [diff] [blame] | 38 | |
| 39 | // This must be kept in sync with gdb/gdb/jit.h . |
| 40 | extern "C" { |
| 41 | |
| 42 | typedef enum { |
| 43 | JIT_NOACTION = 0, |
| 44 | JIT_REGISTER_FN, |
| 45 | JIT_UNREGISTER_FN |
| 46 | } jit_actions_t; |
| 47 | |
| 48 | struct jit_code_entry { |
| 49 | struct jit_code_entry *next_entry; |
| 50 | struct jit_code_entry *prev_entry; |
| 51 | const char *symfile_addr; |
| 52 | uint64_t symfile_size; |
| 53 | }; |
| 54 | |
| 55 | struct jit_descriptor { |
| 56 | uint32_t version; |
| 57 | // This should be jit_actions_t, but we want to be specific about the |
| 58 | // bit-width. |
| 59 | uint32_t action_flag; |
| 60 | struct jit_code_entry *relevant_entry; |
| 61 | struct jit_code_entry *first_entry; |
| 62 | }; |
| 63 | |
| 64 | // GDB 7.0+ puts a (silent) breakpoint in this function. |
| 65 | LLVM_ATTRIBUTE_NOINLINE void __jit_debug_register_code(); |
| 66 | |
| 67 | } |
| 68 | |
| 69 | #endif // BCC_EXECUTION_ENGINE_GDB_JIT_H |