* gdbint.c (gdb_print): Print warning instead of calling scm_write

if Guile isn't yet initialized.
This commit is contained in:
Mikael Djurfeldt 2000-06-19 00:41:54 +00:00
commit 9293b3c638

View file

@ -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);
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;
scm_flush (gdb_output_port);
*(pt->write_buf + pt->read_buf_size) = 0;
SEND_STRING (pt->read_buf);
}
SCM_END_FOREIGN_BLOCK;
}
return 0;
}