aboutsummaryrefslogtreecommitdiff
path: root/include/gcc-interface.h
diff options
context:
space:
mode:
authorPhil Muldoon <pmuldoon@gcc.gnu.org>2014-10-27 17:21:42 +0000
committerPhil Muldoon <pmuldoon@gcc.gnu.org>2014-10-27 17:21:42 +0000
commitddc8de034a1f79861fed57b231813a5c5c48a130 (patch)
tree93d1166de8622ded3678c7599baa864b75cb5e25 /include/gcc-interface.h
parent50a504654d2c54b270615541ab66af7c4f3d664f (diff)
Let GDB reuse GCC's parser.
2014-10-27 Phil Muldoon <pmuldoon@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> Tom Tromey <tromey@redhat.com> * aclocal.m4: New file. * callbacks.cc: New file. * callbacks.hh: New file. * cc1plugin-config.h.in: New file. * configure: New file. * configure.ac: New file. * connection.cc: New file. * connection.hh: New file. * findcomp.cc: New file. * findcomp.hh: New file. * libcc1.cc: New file. * libcc1plugin.sym: New file. * libcc1.sym: New file. * Makefile.am: New file. * Makefile.in: New file. * marshall.cc: New file. * marshall.hh: New file. * names.cc: New file. * names.hh: New file. * plugin.cc: New file. * rpc.hh: New file. * status.hh: New file. 2014-10-27 Phil Muldoon <pmuldoon@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> Tom Tromey <tromey@redhat.com> * gcc-c-fe.def: New file. * gcc-c-interface.h: New file. * gcc-interface.h: New file. 2014-10-27 Phil Muldoon <pmuldoon@redhat.com> Tom Tromey <tromey@redhat.com> * c-tree.h (enum c_oracle_request): New. (c_binding_oracle_function): New typedef. (c_binding_oracle, c_pushtag, c_bind): Declare. * c-decl.c (c_binding_oracle): New global. (I_SYMBOL_CHECKED): New macro. (i_symbol_binding): New function. (I_SYMBOL_BINDING, I_SYMBOL_DECL): Redefine. (I_TAG_CHECKED): New macro. (i_tag_binding): New function. (I_TAG_BINDING, I_TAG_DECL): Redefine. (I_LABEL_CHECKED): New macro. (i_label_binding): New function. (I_LABEL_BINDING, I_LABEL_DECL): Redefine. (c_print_identifier): Save and restore c_binding_oracle. (c_pushtag, c_bind): New functions. 2014-10-27 Phil Muldoon <pmuldoon@redhat.com> Tom Tromey <tromey@redhat.com> * aclocal.m4, configure: Rebuild. * Makefile.in (aclocal_deps): Add gcc-plugin.m4. * configure.ac: Use GCC_ENABLE_PLUGINS. * stor-layout.c (finish_bitfield_layout): Now public. Change argument type to 'tree'. (finish_record_layout): Update. * stor-layout.h (finish_bitfield_layout): Declare. 2014-10-27 Tom Tromey <tromey@redhat.com> * gcc-plugin.m4: New file. 2014-10-27 Phil Muldoon <pmuldoon@redhat.com> Tom Tromey <tromey@redhat.com> * Makefile.def: Add libcc1 to host_modules. * configure.ac (host_tools): Add libcc1. * Makefile.in, configure: Rebuild. From-SVN: r216748
Diffstat (limited to 'include/gcc-interface.h')
-rw-r--r--include/gcc-interface.h127
1 files changed, 127 insertions, 0 deletions
diff --git a/include/gcc-interface.h b/include/gcc-interface.h
new file mode 100644
index 00000000000..34010f24704
--- /dev/null
+++ b/include/gcc-interface.h
@@ -0,0 +1,127 @@
+/* Generic interface between GCC and GDB
+
+ Copyright (C) 2014 Free Software Foundation, Inc.
+
+ This file is part of GCC.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_INTERFACE_H
+#define GCC_INTERFACE_H
+
+/* This header defines the interface to the GCC API. It must be both
+ valid C and valid C++, because it is included by both programs. */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Opaque typedefs for objects passed through the interface. */
+
+typedef unsigned long long gcc_type;
+typedef unsigned long long gcc_decl;
+
+/* An address in the inferior. */
+
+typedef unsigned long long gcc_address;
+
+/* Forward declaration. */
+
+struct gcc_base_context;
+
+/* Defined versions of the generic API. */
+
+enum gcc_base_api_version
+{
+ GCC_FE_VERSION_0 = 0
+};
+
+/* The operations defined by the GCC base API. This is the vtable for
+ the real context structure which is passed around.
+
+ The "base" API is concerned with basics shared by all compiler
+ front ends: setting command-line arguments, the file names, etc.
+
+ Front-end-specific interfaces inherit from this one. */
+
+struct gcc_base_vtable
+{
+ /* The actual version implemented in this interface. This field can
+ be relied on not to move, so users can always check it if they
+ desire. The value is one of the gcc_base_api_version constants.
+ */
+
+ unsigned int version;
+
+ /* Set the compiler's command-line options for the next compilation.
+ TRIPLET_REGEXP is a regular expression that is used to match the
+ configury triplet prefix to the compiler.
+ The arguments are copied by GCC. ARGV need not be
+ NULL-terminated. The arguments must be set separately for each
+ compilation; that is, after a compile is requested, the
+ previously-set arguments cannot be reused.
+
+ This returns NULL on success. On failure, returns a malloc()d
+ error message. The caller is responsible for freeing it. */
+
+ char *(*set_arguments) (struct gcc_base_context *self,
+ const char *triplet_regexp,
+ int argc, char **argv);
+
+ /* Set the file name of the program to compile. The string is
+ copied by the method implementation, but the caller must
+ guarantee that the file exists through the compilation. */
+
+ void (*set_source_file) (struct gcc_base_context *self, const char *file);
+
+ /* Set a callback to use for printing error messages. DATUM is
+ passed through to the callback unchanged. */
+
+ void (*set_print_callback) (struct gcc_base_context *self,
+ void (*print_function) (void *datum,
+ const char *message),
+ void *datum);
+
+ /* Perform the compilation. FILENAME is the name of the resulting
+ object file. VERBOSE can be set to cause GCC to print some
+ information as it works. Returns true on success, false on
+ error. */
+
+ int /* bool */ (*compile) (struct gcc_base_context *self,
+ const char *filename,
+ int /* bool */ verbose);
+
+ /* Destroy this object. */
+
+ void (*destroy) (struct gcc_base_context *self);
+};
+
+/* The GCC object. */
+
+struct gcc_base_context
+{
+ /* The virtual table. */
+
+ const struct gcc_base_vtable *ops;
+};
+
+/* The name of the dummy wrapper function generated by gdb. */
+
+#define GCC_FE_WRAPPER_FUNCTION "_gdb_expr"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GCC_INTERFACE_H */