summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libguile/gdbint.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/libguile/gdbint.c b/libguile/gdbint.c
index 19d7d145b..59ad14093 100644
--- a/libguile/gdbint.c
+++ b/libguile/gdbint.c
@@ -63,6 +63,7 @@
#include "libguile/ports.h"
#include "libguile/root.h"
#include "libguile/strings.h"
+#include "libguile/init.h"
#include "libguile/gdbint.h"
@@ -105,6 +106,8 @@ do { \
} while (0)
+#define MSG_GUILE_NOT_INITIALIZED "*** Guile not initialized ***"
+
#define RESET_STRING { gdb_output_length = 0; }
#define SEND_STRING(str) \
@@ -264,20 +267,25 @@ gdb_eval (SCM exp)
int
gdb_print (SCM obj)
{
- 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;
+ 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;
+ }
return 0;
}