aboutsummaryrefslogtreecommitdiff
path: root/gdb/compile/compile-c.h
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2018-08-10 10:45:36 -0700
committerKeith Seitz <keiths@redhat.com>2018-08-10 11:14:25 -0700
commit18cdc6d8f8e8b55e84783e0a2b5a80b41a0e917b (patch)
tree4cb360c4b831deaaa79333ebc6b3a28a634465bc /gdb/compile/compile-c.h
parentb7dc48b4a8006abb552c5e7d22f9841c86f2537d (diff)
downloadgdb-18cdc6d8f8e8b55e84783e0a2b5a80b41a0e917b.zip
gdb-18cdc6d8f8e8b55e84783e0a2b5a80b41a0e917b.tar.gz
gdb-18cdc6d8f8e8b55e84783e0a2b5a80b41a0e917b.tar.bz2
Add a C++ wrapper for GCC C plug-in
This patch introduces a new class which wraps the GCC C compile plug-in. It is a little unfortunate that this all happened in between the time that GCC moved to C++ and GDB moved to C++, leaving us with an ABI promise to support a C-like interface. The hope is to isolate GDB from some of this should it change in the future. Broadly, what this does is replace calls like: C_CTX (context)->c_ops->operation (C_CTX (context), ...); with calls that now look like: context->c_plugin->operation (...); This API will be further refined in following patches when struct compile_instance/compile_c_instance are changed into classes. gdb/ChangeLog: * Makefile.in (HFILES_NO_SRCDIR): Add compile/gcc-c-plugin.h. * compile/compile-c-types.c: Define GCC_METHODN macros and include gcc-c-fe.def to define C plugin. (delete_instance): Delete `c_plugin'. (new_compile_instance): Initialize `c_plugin'. * compile/compile-c.h: Include gcc_c_plugin.h. (struct compile_c_instance) <c_plugin>: New member. * gcc-c-plugin.h: New file. Update all callers with API change.
Diffstat (limited to 'gdb/compile/compile-c.h')
-rw-r--r--gdb/compile/compile-c.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/gdb/compile/compile-c.h b/gdb/compile/compile-c.h
index cff2aef..ffa5802 100644
--- a/gdb/compile/compile-c.h
+++ b/gdb/compile/compile-c.h
@@ -18,6 +18,7 @@
#define GDB_COMPILE_C_H
#include "common/enum-flags.h"
+#include "gcc-c-plugin.h"
#include "hashtab.h"
/* enum-flags wrapper. */
@@ -46,12 +47,10 @@ struct compile_c_instance
/* Map from gdb symbols to gcc error messages to emit. */
htab_t symbol_err_map;
-};
-
-/* A helper macro that takes a compile_c_instance and returns its
- corresponding gcc_c_context. */
-#define C_CTX(I) ((struct gcc_c_context *) ((I)->base.fe))
+ /* GCC C plugin. */
+ gcc_c_plugin *c_plugin;
+};
/* Emit code to compute the address for all the local variables in
scope at PC in BLOCK. Returns a malloc'd vector, indexed by gdb