1996-09-04 23:59:11 +00:00
|
|
|
|
/* GDB interface for Guile
|
2001-03-22 12:52:03 +00:00
|
|
|
|
* Copyright (C) 1996,1997,1999,2000,2001 Free Software Foundation, Inc.
|
1996-09-04 23:59:11 +00:00
|
|
|
|
*
|
|
|
|
|
|
* 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 2, 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 software; see the file COPYING. If not, write to
|
1997-05-26 22:34:48 +00:00
|
|
|
|
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
|
|
|
|
|
* Boston, MA 02111-1307 USA
|
1996-09-04 23:59:11 +00:00
|
|
|
|
*
|
|
|
|
|
|
* As a special exception, the Free Software Foundation gives permission
|
|
|
|
|
|
* for additional uses of the text contained in its release of GUILE.
|
|
|
|
|
|
*
|
|
|
|
|
|
* The exception is that, if you link the GUILE library with other files
|
|
|
|
|
|
* to produce an executable, this does not by itself cause the
|
|
|
|
|
|
* resulting executable to be covered by the GNU General Public License.
|
|
|
|
|
|
* Your use of that executable is in no way restricted on account of
|
|
|
|
|
|
* linking the GUILE library code into it.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This exception does not however invalidate any other reasons why
|
|
|
|
|
|
* the executable file might be covered by the GNU General Public License.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This exception applies only to the code released by the
|
|
|
|
|
|
* Free Software Foundation under the name GUILE. If you copy
|
|
|
|
|
|
* code from other Free Software Foundation releases into a copy of
|
|
|
|
|
|
* GUILE, as the General Public License permits, the exception does
|
|
|
|
|
|
* not apply to the code that you add in this way. To avoid misleading
|
|
|
|
|
|
* anyone as to the status of such modified files, you must delete
|
|
|
|
|
|
* this exception notice from them.
|
|
|
|
|
|
*
|
|
|
|
|
|
* If you write modifications of your own for GUILE, it is your choice
|
|
|
|
|
|
* whether to permit this exception to apply to your modifications.
|
|
|
|
|
|
* If you do not wish that, delete this exception notice.
|
|
|
|
|
|
*
|
|
|
|
|
|
* The author can be reached at djurfeldt@nada.kth.se
|
1997-05-26 22:34:48 +00:00
|
|
|
|
* Mikael Djurfeldt, SANS/NADA KTH, 10044 STOCKHOLM, SWEDEN */
|
1996-09-04 23:59:11 +00:00
|
|
|
|
|
1999-12-12 02:36:16 +00:00
|
|
|
|
/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
|
|
|
|
|
|
gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/_scm.h"
|
1999-08-30 02:14:36 +00:00
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2001-03-09 23:33:41 +00:00
|
|
|
|
#include <string.h>
|
1999-08-30 02:14:36 +00:00
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/tag.h"
|
|
|
|
|
|
#include "libguile/strports.h"
|
|
|
|
|
|
#include "libguile/read.h"
|
|
|
|
|
|
#include "libguile/eval.h"
|
|
|
|
|
|
#include "libguile/chars.h"
|
|
|
|
|
|
#include "libguile/modules.h"
|
|
|
|
|
|
#include "libguile/ports.h"
|
2000-06-21 02:46:01 +00:00
|
|
|
|
#include "libguile/fluids.h"
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/strings.h"
|
2000-06-19 00:41:54 +00:00
|
|
|
|
#include "libguile/init.h"
|
1996-09-04 23:59:11 +00:00
|
|
|
|
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/gdbint.h"
|
1996-09-04 23:59:11 +00:00
|
|
|
|
|
|
|
|
|
|
/* {Support for debugging with gdb}
|
|
|
|
|
|
*
|
|
|
|
|
|
* TODO:
|
|
|
|
|
|
*
|
|
|
|
|
|
* 1. Redirect outputs
|
|
|
|
|
|
* 2. Catch errors
|
|
|
|
|
|
* 3. Prevent print from causing segmentation fault when given broken pairs
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#define GDB_TYPE SCM
|
|
|
|
|
|
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/gdb_interface.h"
|
1996-09-04 23:59:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Be carefull when this macro is true.
|
2000-07-13 15:00:58 +00:00
|
|
|
|
scm_gc_running_p is set during gc.
|
1996-09-04 23:59:11 +00:00
|
|
|
|
*/
|
2000-07-13 15:00:58 +00:00
|
|
|
|
#define SCM_GC_P (scm_gc_running_p)
|
1996-09-04 23:59:11 +00:00
|
|
|
|
|
|
|
|
|
|
/* Macros that encapsulate blocks of code which can be called by the
|
|
|
|
|
|
* debugger.
|
|
|
|
|
|
*/
|
|
|
|
|
|
#define SCM_BEGIN_FOREIGN_BLOCK \
|
1999-12-16 03:46:42 +00:00
|
|
|
|
do { \
|
1996-09-04 23:59:11 +00:00
|
|
|
|
old_ints = scm_ints_disabled; scm_ints_disabled = 1; \
|
|
|
|
|
|
old_gc = scm_block_gc; scm_block_gc = 1; \
|
|
|
|
|
|
scm_print_carefully_p = 1; \
|
1999-12-16 03:46:42 +00:00
|
|
|
|
} while (0)
|
1996-09-04 23:59:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define SCM_END_FOREIGN_BLOCK \
|
1999-12-16 03:46:42 +00:00
|
|
|
|
do { \
|
1996-09-04 23:59:11 +00:00
|
|
|
|
scm_print_carefully_p = 0; \
|
|
|
|
|
|
scm_block_gc = old_gc; \
|
|
|
|
|
|
scm_ints_disabled = old_ints; \
|
1999-12-16 03:46:42 +00:00
|
|
|
|
} while (0)
|
1996-09-04 23:59:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define RESET_STRING { gdb_output_length = 0; }
|
|
|
|
|
|
|
|
|
|
|
|
#define SEND_STRING(str) \
|
1999-12-16 03:46:42 +00:00
|
|
|
|
do { \
|
2000-06-12 18:13:38 +00:00
|
|
|
|
gdb_output = (char *) (str); \
|
|
|
|
|
|
gdb_output_length = strlen ((const char *) (str)); \
|
1999-12-16 03:46:42 +00:00
|
|
|
|
} while (0)
|
1996-09-11 22:04:45 +00:00
|
|
|
|
|
1996-09-04 23:59:11 +00:00
|
|
|
|
|
|
|
|
|
|
/* {Gdb interface}
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
unsigned short gdb_options = GDB_HAVE_BINDINGS;
|
|
|
|
|
|
|
|
|
|
|
|
char *gdb_language = "lisp/c";
|
|
|
|
|
|
|
|
|
|
|
|
SCM gdb_result;
|
|
|
|
|
|
|
|
|
|
|
|
char *gdb_output;
|
|
|
|
|
|
|
|
|
|
|
|
int gdb_output_length;
|
|
|
|
|
|
|
|
|
|
|
|
int scm_print_carefully_p;
|
|
|
|
|
|
|
|
|
|
|
|
static SCM gdb_input_port;
|
1996-09-11 22:04:45 +00:00
|
|
|
|
static int port_mark_p, stream_mark_p, string_mark_p;
|
|
|
|
|
|
|
|
|
|
|
|
static SCM tok_buf;
|
|
|
|
|
|
static int tok_buf_mark_p;
|
|
|
|
|
|
|
1996-09-04 23:59:11 +00:00
|
|
|
|
static SCM gdb_output_port;
|
|
|
|
|
|
static int old_ints, old_gc;
|
|
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-09-11 22:04:45 +00:00
|
|
|
|
static void
|
1999-12-12 02:36:16 +00:00
|
|
|
|
unmark_port (SCM port)
|
1996-09-11 22:04:45 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM stream, string;
|
2000-12-06 15:16:59 +00:00
|
|
|
|
port_mark_p = SCM_GCMARKP (port);
|
|
|
|
|
|
SCM_CLRGCMARK (port);
|
2000-03-31 07:56:40 +00:00
|
|
|
|
stream = SCM_PACK (SCM_STREAM (port));
|
1996-09-11 22:04:45 +00:00
|
|
|
|
stream_mark_p = SCM_GCMARKP (stream);
|
|
|
|
|
|
SCM_CLRGCMARK (stream);
|
|
|
|
|
|
string = SCM_CDR (stream);
|
2000-12-06 15:16:59 +00:00
|
|
|
|
string_mark_p = SCM_GCMARKP (string);
|
|
|
|
|
|
SCM_CLRGCMARK (string);
|
1996-09-11 22:04:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-09-11 22:04:45 +00:00
|
|
|
|
static void
|
1999-12-12 02:36:16 +00:00
|
|
|
|
remark_port (SCM port)
|
1996-09-11 22:04:45 +00:00
|
|
|
|
{
|
2000-03-31 07:56:40 +00:00
|
|
|
|
SCM stream = SCM_PACK (SCM_STREAM (port));
|
1996-09-11 22:04:45 +00:00
|
|
|
|
SCM string = SCM_CDR (stream);
|
2000-12-06 15:16:59 +00:00
|
|
|
|
if (string_mark_p) SCM_SETGCMARK (string);
|
1996-09-11 22:04:45 +00:00
|
|
|
|
if (stream_mark_p) SCM_SETGCMARK (stream);
|
2000-12-06 15:16:59 +00:00
|
|
|
|
if (port_mark_p) SCM_SETGCMARK (port);
|
1996-09-11 22:04:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-09-04 23:59:11 +00:00
|
|
|
|
int
|
1999-12-12 20:35:02 +00:00
|
|
|
|
gdb_maybe_valid_type_p (SCM value)
|
1996-09-04 23:59:11 +00:00
|
|
|
|
{
|
2000-05-16 12:11:08 +00:00
|
|
|
|
return SCM_IMP (value) || scm_cellp (value);
|
1996-09-04 23:59:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-09-04 23:59:11 +00:00
|
|
|
|
int
|
1999-12-12 20:35:02 +00:00
|
|
|
|
gdb_read (char *str)
|
1996-09-04 23:59:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM ans;
|
|
|
|
|
|
int status = 0;
|
|
|
|
|
|
RESET_STRING;
|
|
|
|
|
|
/* Need to be restrictive about what to read? */
|
|
|
|
|
|
if (SCM_GC_P)
|
|
|
|
|
|
{
|
|
|
|
|
|
char *p;
|
|
|
|
|
|
for (p = str; *p != '\0'; ++p)
|
|
|
|
|
|
switch (*p)
|
|
|
|
|
|
{
|
|
|
|
|
|
case '(':
|
|
|
|
|
|
case '\'':
|
|
|
|
|
|
case '"':
|
|
|
|
|
|
SEND_STRING ("Can't read this kind of expressions during gc");
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
case '#':
|
|
|
|
|
|
if (*++p == '\0')
|
|
|
|
|
|
goto premature;
|
|
|
|
|
|
if (*p == '\\')
|
|
|
|
|
|
{
|
|
|
|
|
|
if (*++p != '\0')
|
|
|
|
|
|
continue;
|
|
|
|
|
|
premature:
|
|
|
|
|
|
SEND_STRING ("Premature end of lisp expression");
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
}
|
|
|
|
|
|
default:
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
SCM_BEGIN_FOREIGN_BLOCK;
|
1996-09-11 22:04:45 +00:00
|
|
|
|
unmark_port (gdb_input_port);
|
1999-08-12 18:58:55 +00:00
|
|
|
|
scm_seek (gdb_input_port, SCM_INUM0, SCM_MAKINUM (SEEK_SET));
|
1999-06-12 17:26:22 +00:00
|
|
|
|
scm_puts (str, gdb_input_port);
|
1999-07-24 19:52:13 +00:00
|
|
|
|
scm_truncate_file (gdb_input_port, SCM_UNDEFINED);
|
1999-08-12 18:58:55 +00:00
|
|
|
|
scm_seek (gdb_input_port, SCM_INUM0, SCM_MAKINUM (SEEK_SET));
|
1996-09-04 23:59:11 +00:00
|
|
|
|
/* Read one object */
|
2000-12-06 15:16:59 +00:00
|
|
|
|
tok_buf_mark_p = SCM_GCMARKP (tok_buf);
|
|
|
|
|
|
SCM_CLRGCMARK (tok_buf);
|
* strports.c (scm_read_0str, scm_eval_0str): update scm_read usage.
* gdbint.c (gdb_read): update scm_lreadr usage.
* load.h: update prototypes.
* load.c (scm_primitive_load, scm_read_and_eval_x,
scm_primitive_load_path): remove case_insensitive_p, sharp arguments.
* read.h: add prototype for scm_read_hash_extend. Change args for
other prototypes.
* read.c (scm_read_hash_procedures): new variable.
(scm_read_hash_extend): new procedure.
(scm_get_hash_procedure): new procedure.
* (scm_lreadr): use scm_get_hash_procedure instead of an argument
for extended # processing.
(scm_read, scm_lreadr, scm_lreadrecparen, scm_lreadparen,
scm_read_token): remove case_i, sharp arguments. Change callers.
* read.h (SCM_N_READ_OPTIONS): increase to 3.
(SCM_CASE_INSENSITIVE_P): define.
* read.c: add case-insensitive option to scm_read_opts.
* (scm_read_token): use SCM_CASE_INSENSITIVE_P instead of an argument
to determine whether to convert symbol case.
(default_case_i): definition removed.
* read.c (scm_read_token): if case_i, downcase ic before doing
anything with it.
1997-03-08 18:58:24 +00:00
|
|
|
|
ans = scm_lreadr (&tok_buf, gdb_input_port, &ans);
|
1996-09-04 23:59:11 +00:00
|
|
|
|
if (SCM_GC_P)
|
|
|
|
|
|
{
|
1996-09-11 22:04:45 +00:00
|
|
|
|
if (SCM_NIMP (ans))
|
1996-09-04 23:59:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
SEND_STRING ("Non-immediate created during gc. Memory may be trashed.");
|
|
|
|
|
|
status = -1;
|
|
|
|
|
|
goto exit;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
1996-09-11 22:04:45 +00:00
|
|
|
|
gdb_result = ans;
|
1996-09-04 23:59:11 +00:00
|
|
|
|
/* Protect answer from future GC */
|
1996-09-11 22:04:45 +00:00
|
|
|
|
if (SCM_NIMP (ans))
|
|
|
|
|
|
scm_permanent_object (ans);
|
1996-09-04 23:59:11 +00:00
|
|
|
|
exit:
|
1996-09-11 22:04:45 +00:00
|
|
|
|
if (tok_buf_mark_p)
|
2000-12-06 15:16:59 +00:00
|
|
|
|
SCM_SETGCMARK (tok_buf);
|
1996-09-11 22:04:45 +00:00
|
|
|
|
remark_port (gdb_input_port);
|
1996-09-04 23:59:11 +00:00
|
|
|
|
SCM_END_FOREIGN_BLOCK;
|
|
|
|
|
|
return status;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-09-04 23:59:11 +00:00
|
|
|
|
int
|
1999-12-12 20:35:02 +00:00
|
|
|
|
gdb_eval (SCM exp)
|
1996-09-04 23:59:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
RESET_STRING;
|
|
|
|
|
|
if (SCM_IMP (exp))
|
|
|
|
|
|
{
|
|
|
|
|
|
gdb_result = exp;
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (SCM_GC_P)
|
|
|
|
|
|
{
|
|
|
|
|
|
SEND_STRING ("Can't evaluate lisp expressions during gc");
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
}
|
|
|
|
|
|
SCM_BEGIN_FOREIGN_BLOCK;
|
|
|
|
|
|
{
|
2000-06-21 02:46:01 +00:00
|
|
|
|
SCM env = scm_top_level_env (SCM_TOP_LEVEL_LOOKUP_CLOSURE);
|
1996-09-04 23:59:11 +00:00
|
|
|
|
gdb_result = scm_permanent_object (scm_ceval (exp, env));
|
|
|
|
|
|
}
|
|
|
|
|
|
SCM_END_FOREIGN_BLOCK;
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-09-04 23:59:11 +00:00
|
|
|
|
int
|
1999-12-12 20:35:02 +00:00
|
|
|
|
gdb_print (SCM obj)
|
1996-09-04 23:59:11 +00:00
|
|
|
|
{
|
2000-06-19 00:41:54 +00:00
|
|
|
|
if (!scm_initialized_p)
|
|
|
|
|
|
SEND_STRING ("*** Guile not initialized ***");
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
RESET_STRING;
|
|
|
|
|
|
SCM_BEGIN_FOREIGN_BLOCK;
|
|
|
|
|
|
/* Reset stream */
|
|
|
|
|
|
scm_seek (gdb_output_port, SCM_INUM0, SCM_MAKINUM (SEEK_SET));
|
|
|
|
|
|
scm_write (obj, gdb_output_port);
|
|
|
|
|
|
scm_truncate_file (gdb_output_port, SCM_UNDEFINED);
|
|
|
|
|
|
{
|
|
|
|
|
|
scm_port *pt = SCM_PTAB_ENTRY (gdb_output_port);
|
|
|
|
|
|
|
|
|
|
|
|
scm_flush (gdb_output_port);
|
|
|
|
|
|
*(pt->write_buf + pt->read_buf_size) = 0;
|
|
|
|
|
|
SEND_STRING (pt->read_buf);
|
|
|
|
|
|
}
|
|
|
|
|
|
SCM_END_FOREIGN_BLOCK;
|
|
|
|
|
|
}
|
1996-09-04 23:59:11 +00:00
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-09-04 23:59:11 +00:00
|
|
|
|
int
|
1999-12-12 20:35:02 +00:00
|
|
|
|
gdb_binding (SCM name, SCM value)
|
1996-09-04 23:59:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
RESET_STRING;
|
|
|
|
|
|
if (SCM_GC_P)
|
|
|
|
|
|
{
|
|
|
|
|
|
SEND_STRING ("Can't create new bindings during gc");
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
}
|
|
|
|
|
|
SCM_BEGIN_FOREIGN_BLOCK;
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM vcell = scm_sym2vcell (name,
|
2000-06-21 02:46:01 +00:00
|
|
|
|
SCM_TOP_LEVEL_LOOKUP_CLOSURE,
|
1996-09-04 23:59:11 +00:00
|
|
|
|
SCM_BOOL_T);
|
|
|
|
|
|
SCM_SETCDR (vcell, value);
|
|
|
|
|
|
}
|
|
|
|
|
|
SCM_END_FOREIGN_BLOCK;
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
scm_init_gdbint ()
|
|
|
|
|
|
{
|
|
|
|
|
|
static char *s = "scm_init_gdb_interface";
|
|
|
|
|
|
SCM port;
|
|
|
|
|
|
|
|
|
|
|
|
scm_print_carefully_p = 0;
|
|
|
|
|
|
|
|
|
|
|
|
port = scm_mkstrport (SCM_INUM0,
|
1999-06-12 17:26:22 +00:00
|
|
|
|
scm_make_string (SCM_MAKINUM (0), SCM_UNDEFINED),
|
1996-09-04 23:59:11 +00:00
|
|
|
|
SCM_OPN | SCM_WRTNG,
|
|
|
|
|
|
s);
|
|
|
|
|
|
gdb_output_port = scm_permanent_object (port);
|
|
|
|
|
|
|
|
|
|
|
|
port = scm_mkstrport (SCM_INUM0,
|
|
|
|
|
|
scm_make_string (SCM_MAKINUM (0), SCM_UNDEFINED),
|
1999-06-12 17:26:22 +00:00
|
|
|
|
SCM_OPN | SCM_RDNG | SCM_WRTNG,
|
1996-09-04 23:59:11 +00:00
|
|
|
|
s);
|
|
|
|
|
|
gdb_input_port = scm_permanent_object (port);
|
1996-09-11 22:04:45 +00:00
|
|
|
|
|
2001-03-22 12:52:03 +00:00
|
|
|
|
tok_buf = scm_permanent_object (scm_allocate_string (30));
|
1996-09-04 23:59:11 +00:00
|
|
|
|
}
|
2000-03-19 19:01:16 +00:00
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
Local Variables:
|
|
|
|
|
|
c-file-style: "gnu"
|
|
|
|
|
|
End:
|
|
|
|
|
|
*/
|