| 1 | /* GCC C plug-in wrapper for GDB. |
| 2 | |
| 3 | Copyright (C) 2018-2019 Free Software Foundation, Inc. |
| 4 | |
| 5 | This file is part of GDB. |
| 6 | |
| 7 | This program is free software; you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation; either version 3 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | This program is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 19 | |
| 20 | /* A class representing the C plug-in. */ |
| 21 | |
| 22 | class gcc_c_plugin |
| 23 | { |
| 24 | public: |
| 25 | |
| 26 | explicit gcc_c_plugin (struct gcc_c_context *gcc_c) |
| 27 | : m_context (gcc_c) |
| 28 | { |
| 29 | } |
| 30 | |
| 31 | /* Set the oracle callbacks to be used by the compiler plug-in. */ |
| 32 | void set_callbacks (gcc_c_oracle_function *binding_oracle, |
| 33 | gcc_c_symbol_address_function *address_oracle, |
| 34 | void *datum) |
| 35 | { |
| 36 | m_context->c_ops->set_callbacks (m_context, binding_oracle, |
| 37 | address_oracle, datum); |
| 38 | } |
| 39 | |
| 40 | /* Returns the interface version of the compiler plug-in. */ |
| 41 | int version () const { return m_context->c_ops->c_version; } |
| 42 | |
| 43 | #define GCC_METHOD0(R, N) R N () const; |
| 44 | #define GCC_METHOD1(R, N, A) R N (A) const; |
| 45 | #define GCC_METHOD2(R, N, A, B) R N (A, B) const; |
| 46 | #define GCC_METHOD3(R, N, A, B, C) R N (A, B, C) const; |
| 47 | #define GCC_METHOD4(R, N, A, B, C, D) R N (A, B, C, D) const; |
| 48 | #define GCC_METHOD5(R, N, A, B, C, D, E) R N (A, B, C, D, E) const; |
| 49 | #define GCC_METHOD7(R, N, A, B, C, D, E, F, G) R N (A, B, C, D, E, F, G) const; |
| 50 | |
| 51 | #include "gcc-c-fe.def" |
| 52 | |
| 53 | #undef GCC_METHOD0 |
| 54 | #undef GCC_METHOD1 |
| 55 | #undef GCC_METHOD2 |
| 56 | #undef GCC_METHOD3 |
| 57 | #undef GCC_METHOD4 |
| 58 | #undef GCC_METHOD5 |
| 59 | #undef GCC_METHOD7 |
| 60 | |
| 61 | private: |
| 62 | /* The GCC C context. */ |
| 63 | struct gcc_c_context *m_context; |
| 64 | }; |