source: trunk/libs/newlib/src/include/gcc-interface.h @ 514

Last change on this file since 514 was 444, checked in by satin@…, 7 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 3.8 KB
Line 
1/* Generic interface between GCC and GDB
2
3   Copyright (C) 2014-2015 Free Software Foundation, Inc.
4
5   This file is part of GCC.
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#ifndef GCC_INTERFACE_H
21#define GCC_INTERFACE_H
22
23/* This header defines the interface to the GCC API.  It must be both
24   valid C and valid C++, because it is included by both programs.  */
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30/* Opaque typedefs for objects passed through the interface.  */
31
32typedef unsigned long long gcc_type;
33typedef unsigned long long gcc_decl;
34
35/* An address in the inferior.  */
36
37typedef unsigned long long gcc_address;
38
39/* Forward declaration.  */
40
41struct gcc_base_context;
42
43/* Defined versions of the generic API.  */
44
45enum gcc_base_api_version
46{
47  GCC_FE_VERSION_0 = 0
48};
49
50/* The operations defined by the GCC base API.  This is the vtable for
51   the real context structure which is passed around.
52
53   The "base" API is concerned with basics shared by all compiler
54   front ends: setting command-line arguments, the file names, etc.
55
56   Front-end-specific interfaces inherit from this one.  */
57
58struct gcc_base_vtable
59{
60  /* The actual version implemented in this interface.  This field can
61     be relied on not to move, so users can always check it if they
62     desire.  The value is one of the gcc_base_api_version constants.
63  */
64
65  unsigned int version;
66
67  /* Set the compiler's command-line options for the next compilation.
68     TRIPLET_REGEXP is a regular expression that is used to match the
69     configury triplet prefix to the compiler.
70     The arguments are copied by GCC.  ARGV need not be
71     NULL-terminated.  The arguments must be set separately for each
72     compilation; that is, after a compile is requested, the
73     previously-set arguments cannot be reused.
74
75     This returns NULL on success.  On failure, returns a malloc()d
76     error message.  The caller is responsible for freeing it.  */
77
78  char *(*set_arguments) (struct gcc_base_context *self,
79                          const char *triplet_regexp,
80                          int argc, char **argv);
81
82  /* Set the file name of the program to compile.  The string is
83     copied by the method implementation, but the caller must
84     guarantee that the file exists through the compilation.  */
85
86  void (*set_source_file) (struct gcc_base_context *self, const char *file);
87
88  /* Set a callback to use for printing error messages.  DATUM is
89     passed through to the callback unchanged.  */
90
91  void (*set_print_callback) (struct gcc_base_context *self,
92                              void (*print_function) (void *datum,
93                                                      const char *message),
94                              void *datum);
95
96  /* Perform the compilation.  FILENAME is the name of the resulting
97     object file.  VERBOSE can be set to cause GCC to print some
98     information as it works.  Returns true on success, false on
99     error.  */
100
101  int /* bool */ (*compile) (struct gcc_base_context *self,
102                             const char *filename,
103                             int /* bool */ verbose);
104
105  /* Destroy this object.  */
106
107  void (*destroy) (struct gcc_base_context *self);
108};
109
110/* The GCC object.  */
111
112struct gcc_base_context
113{
114  /* The virtual table.  */
115
116  const struct gcc_base_vtable *ops;
117};
118
119/* The name of the dummy wrapper function generated by gdb.  */
120
121#define GCC_FE_WRAPPER_FUNCTION "_gdb_expr"
122
123#ifdef __cplusplus
124}
125#endif
126
127#endif /* GCC_INTERFACE_H */
Note: See TracBrowser for help on using the repository browser.