/* Support for connecting Guile's stdio to GDB's.
as well as r/w memory via ports.
- Copyright (C) 2014-2015 Free Software Foundation, Inc.
+ Copyright (C) 2014-2016 Free Software Foundation, Inc.
This file is part of GDB.
#include "defs.h"
#include "gdb_select.h"
-#include "interps.h"
+#include "top.h"
#include "target.h"
#include "guile-internal.h"
FD_ZERO (&input_fds);
FD_SET (fdes, &input_fds);
- num_found = gdb_select (num_fds, &input_fds, NULL, NULL, &timeout);
+ num_found = interruptible_select (num_fds,
+ &input_fds, NULL, NULL,
+ &timeout);
if (num_found < 0)
{
/* Guile doesn't export SIGINT hooks like Python does.
{
int is_a_tty = isatty (fd);
const char *name;
+ const char *mode_str;
long mode_bits;
SCM port;
{
case 0:
name = input_port_name;
- mode_bits = scm_mode_bits (is_a_tty ? "r0" : "r");
+ mode_str = is_a_tty ? "r0" : "r";
break;
case 1:
name = output_port_name;
- mode_bits = scm_mode_bits (is_a_tty ? "w0" : "w");
+ mode_str = is_a_tty ? "w0" : "w";
break;
case 2:
name = error_port_name;
- mode_bits = scm_mode_bits (is_a_tty ? "w0" : "w");
+ mode_str = is_a_tty ? "w0" : "w";
break;
default:
gdb_assert_not_reached ("bad stdio file descriptor");
}
+ mode_bits = scm_mode_bits ((char *) mode_str);
port = ioscm_open_port (stdio_port_desc, mode_bits);
scm_set_port_filename_x (port, gdbscm_scm_from_c_string (name));
cleanups = set_batch_flag_and_make_cleanup_restore_page_info ();
- make_cleanup_restore_integer (&interpreter_async);
- interpreter_async = 0;
+ make_cleanup_restore_integer (¤t_ui->async);
+ current_ui->async = 0;
port_file = ioscm_file_port_new (port);
make_cleanup_ui_file_delete (port_file);
+ scoped_restore save_file = make_scoped_restore (oport == GDB_STDERR
+ ? &gdb_stderr : &gdb_stdout);
+
if (oport == GDB_STDERR)
- {
- make_cleanup_restore_ui_file (&gdb_stderr);
- gdb_stderr = port_file;
- }
+ gdb_stderr = port_file;
else
{
- make_cleanup_restore_ui_file (&gdb_stdout);
-
- if (ui_out_redirect (current_uiout, port_file) < 0)
+ if (current_uiout->redirect (port_file) < 0)
warning (_("Current output protocol does not support redirection"));
else
make_cleanup_ui_out_redirect_pop (current_uiout);
&start_arg_pos, &start,
&size_arg_pos, &size);
- scm_dynwind_begin (0);
+ scm_dynwind_begin ((scm_t_dynwind_flags) 0);
if (mode == NULL)
mode = xstrdup ("r");