Doc fix.
[bpt/guile.git] / libguile / gdb_interface.h
CommitLineData
504388eb 1/* Simple interpreter interface for GDB, the GNU debugger.
1e598865 2 Copyright (C) 1996 Free Software Foundation
504388eb
MD
3
4This file is part of GDB.
5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
18Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20The author can be reached at djurfeldt@nada.kth.se
21Mikael Djurfeldt, SANS/NADA KTH, 10044 STOCKHOLM, SWEDEN */
22
1717856b
JB
23#ifndef GDB_INTERFACE_H
24#define GDB_INTERFACE_H
25
504388eb
MD
26/* This is the header file for GDB's interpreter interface. The
27 interpreter must supply definitions of all symbols declared in this
28 file.
29
30 Before including this file, you must #define GDB_TYPE to be the
31 data type used for communication with the interpreter. */
32
33/* The following macro can be used to anchor the symbols of the
34 interface in your main program. This is necessary if the interface
35 is defined in a library, such as Guile. */
36
37#define GDB_INTERFACE \
38void *gdb_interface[] = { \
39 &gdb_options, \
40 &gdb_language, \
41 &gdb_result, \
42 &gdb_output, \
43 &gdb_output_length, \
01c77a0a
MD
44 (void *) gdb_maybe_valid_type_p, \
45 (void *) gdb_read, \
46 (void *) gdb_eval, \
47 (void *) gdb_print, \
48 (void *) gdb_binding \
504388eb
MD
49}; \
50
51
52/* GDB_OPTIONS is a set of flags informing gdb what features are present
53 in the interface. Currently only one option is supported: */
54
55/* GDB_HAVE_BINDINGS: Set this bit if your interpreter can create new
56 top level bindings on demand (through gdb_top_level_binding) */
57
58#define GDB_HAVE_BINDINGS 1
59
60extern unsigned short gdb_options;
61
62/* GDB_LANGUAGE holds the name of the preferred language mode for this
63 interpreter. For lisp interpreters, the suggested mode is "lisp/c". */
64
65extern char *gdb_language;
66
67/* GDB_RESULT is used for passing results from the interpreter to GDB */
68
69extern GDB_TYPE gdb_result;
70
71/* The interpreter passes strings to GDB in GDB_OUTPUT and
72 GDB_OUTPUT_LENGTH. GDB_OUTPUT should hold the pointer to the
73 string. GDB_OUTPUT_LENGTH should hold its length. The string
74 doesn't need to be terminated by '\0'. */
75
76extern char *gdb_output;
77
78extern int gdb_output_length;
79
504388eb
MD
80/* Return TRUE if the interpreter regards VALUE's type as valid. A
81 lazy implementation is allowed to pass TRUE always. FALSE should
82 only be returned when it is certain that VALUE is not valid.
83
84 In the "lisp/c" language mode, this is used to heuristically
85 discriminate lisp values from C values during printing. */
86
1717856b 87extern int gdb_maybe_valid_type_p SCM_P ((GDB_TYPE value));
504388eb
MD
88
89/* Parse expression in string STR. Store result in GDB_RESULT, then
90 return 0 to indicate success. On error, return -1 to indicate
91 failure. An error string can be passed in GDB_OUTPUT and
92 GDB_OUTPUT_LENGTH. Be careful to set GDB_OUTPUT_LENGTH to zero if
93 no message is passed. Please note that the resulting value should
94 be protected against garbage collection. */
95
1717856b 96extern int gdb_read SCM_P ((char *str));
504388eb
MD
97
98/* Evaluate expression EXP. Store result in GDB_RESULT, then return 0
99 to indicate success. On error, return -1 to indicate failure. Any
100 output (both on success and failure) can be passed in GDB_OUTPUT
101 and GDB_OUTPUT_LENGTH. Be careful to set GDB_OUTPUT_LENGTH to zero
102 if no output is passed. Please note that the resulting lisp object
103 should be protected against garbage collection. */
104
1717856b 105extern int gdb_eval SCM_P ((GDB_TYPE exp));
504388eb
MD
106
107/* Print VALUE. Store output in GDB_OUTPUT and GDB_OUTPUT_LENGTH.
108 Return 0 to indicate success. On error, return -1 to indicate
109 failure. GDB will not look at GDB_OUTPUT or GDB_OUTPUT_LENGTH on
110 failure. Note that this function should be robust against strange
111 values. It could in fact be passed any kind of value. */
112
1717856b 113extern int gdb_print SCM_P ((GDB_TYPE value));
504388eb
MD
114
115/* Bind NAME to VALUE in interpreter. (GDB has previously obtained
116 NAME by passing a string to gdb_read.) Return 0 to indicate
117 success or -1 to indicate failure. This feature is optional. GDB
118 will only call this function if the GDB_HAVE_BINDINGS flag is set
119 in gdb_options. Note that GDB may call this function many times
120 for the same name.
121
122 For scheme interpreters, this function should introduce top-level
123 bindings. */
124
1717856b 125extern int gdb_binding SCM_P ((GDB_TYPE name, GDB_TYPE value));
504388eb 126
1717856b 127#endif /* GDB_INTERFACE_H */