* gdbint.c (gdb_print): Print warning instead of calling scm_write
if Guile isn't yet initialized.
This commit is contained in:
parent
bf1b9494f7
commit
9293b3c638
1 changed files with 21 additions and 13 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue