1996-09-04 23:59:11 +00:00
|
|
|
|
/* GDB interface for Guile
|
2002-12-10 09:35:06 +00:00
|
|
|
|
* Copyright (C) 1996,1997,1999,2000,2001, 2002 Free Software Foundation, Inc.
|
1996-09-04 23:59:11 +00:00
|
|
|
|
*
|
2003-04-05 19:15:35 +00:00
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
1996-09-04 23:59:11 +00:00
|
|
|
|
*
|
2003-04-05 19:15:35 +00:00
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
1996-09-04 23:59:11 +00:00
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2003-04-05 19:15:35 +00:00
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
|
* Lesser General Public License for more details.
|
1996-09-04 23:59:11 +00:00
|
|
|
|
*
|
2003-04-05 19:15:35 +00:00
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
|
*/
|
1996-09-04 23:59:11 +00:00
|
|
|
|
|
2003-03-25 23:55:48 +00:00
|
|
|
|
#if HAVE_CONFIG_H
|
|
|
|
|
|
# include <config.h>
|
|
|
|
|
|
#endif
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
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/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_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; \
|
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;
|
2002-12-10 09:35:06 +00:00
|
|
|
|
static int old_gc;
|
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-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;
|
2002-08-04 00:17:18 +00:00
|
|
|
|
port_mark_p = SCM_GC_MARK_P (port);
|
|
|
|
|
|
SCM_CLEAR_GC_MARK (port);
|
2000-03-31 07:56:40 +00:00
|
|
|
|
stream = SCM_PACK (SCM_STREAM (port));
|
2002-08-04 00:17:18 +00:00
|
|
|
|
stream_mark_p = SCM_GC_MARK_P (stream);
|
|
|
|
|
|
SCM_CLEAR_GC_MARK (stream);
|
1996-09-11 22:04:45 +00:00
|
|
|
|
string = SCM_CDR (stream);
|
2002-08-04 00:17:18 +00:00
|
|
|
|
string_mark_p = SCM_GC_MARK_P (string);
|
|
|
|
|
|
SCM_CLEAR_GC_MARK (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);
|
2002-08-04 00:17:18 +00:00
|
|
|
|
if (string_mark_p)
|
|
|
|
|
|
SCM_SET_GC_MARK (string);
|
|
|
|
|
|
if (stream_mark_p)
|
|
|
|
|
|
SCM_SET_GC_MARK (stream);
|
|
|
|
|
|
if (port_mark_p)
|
|
|
|
|
|
SCM_SET_GC_MARK (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
|
|
|
|
{
|
2002-08-04 00:17:18 +00:00
|
|
|
|
return SCM_IMP (value) || scm_in_heap_p (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 */
|
2002-08-04 00:17:18 +00:00
|
|
|
|
tok_buf_mark_p = SCM_GC_MARK_P (tok_buf);
|
|
|
|
|
|
SCM_CLEAR_GC_MARK (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)
|
2002-08-04 00:17:18 +00:00
|
|
|
|
SCM_SET_GC_MARK (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);
|
|
|
|
|
|
{
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_t_port *pt = SCM_PTAB_ENTRY (gdb_output_port);
|
2000-06-19 00:41:54 +00:00
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
{
|
2001-05-15 14:57:22 +00:00
|
|
|
|
SCM var = scm_sym2var (name, SCM_TOP_LEVEL_LOOKUP_CLOSURE, SCM_BOOL_T);
|
|
|
|
|
|
SCM_VARIABLE_SET (var, value);
|
1996-09-04 23:59:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
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:
|
|
|
|
|
|
*/
|