projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
x86: consistently convert to byte registers for TEST w/ imm optimization
[deliverable/binutils-gdb.git]
/
gdb
/
ser-mingw.c
diff --git
a/gdb/ser-mingw.c
b/gdb/ser-mingw.c
index 96ebd0eb7269d9e300fe0549498a8e624a7fe742..e6363a1053d93e6522a4119f4a5d0a13b9977eb4 100644
(file)
--- a/
gdb/ser-mingw.c
+++ b/
gdb/ser-mingw.c
@@
-1,6
+1,6
@@
/* Serial interface for local (hardwired) serial ports on Windows systems
/* Serial interface for local (hardwired) serial ports on Windows systems
- Copyright (C) 2006-20
16
Free Software Foundation, Inc.
+ Copyright (C) 2006-20
20
Free Software Foundation, Inc.
This file is part of GDB.
This file is part of GDB.
@@
-31,8
+31,6
@@
#include "command.h"
#include "command.h"
-void _initialize_ser_windows (void);
-
struct ser_windows_state
{
int in_progress;
struct ser_windows_state
{
int in_progress;
@@
-163,8
+161,6
@@
ser_windows_raw (struct serial *scb)
state.fAbortOnError = FALSE;
state.ByteSize = 8;
state.fAbortOnError = FALSE;
state.ByteSize = 8;
- scb->current_timeout = 0;
-
if (SetCommState (h, &state) == 0)
warning (_("SetCommState failed"));
}
if (SetCommState (h, &state) == 0)
warning (_("SetCommState failed"));
}
@@
-325,9
+321,8
@@
ser_windows_read_prim (struct serial *scb, size_t count)
{
struct ser_windows_state *state;
OVERLAPPED ov;
{
struct ser_windows_state *state;
OVERLAPPED ov;
- DWORD bytes_read
, bytes_read_tmp
;
+ DWORD bytes_read;
HANDLE h;
HANDLE h;
- gdb_byte *p;
state = (struct ser_windows_state *) scb->state;
if (state->in_progress)
state = (struct ser_windows_state *) scb->state;
if (state->in_progress)
@@
-355,7
+350,6
@@
ser_windows_read_prim (struct serial *scb, size_t count)
static int
ser_windows_write_prim (struct serial *scb, const void *buf, size_t len)
{
static int
ser_windows_write_prim (struct serial *scb, const void *buf, size_t len)
{
- struct ser_windows_state *state;
OVERLAPPED ov;
DWORD bytes_written;
HANDLE h;
OVERLAPPED ov;
DWORD bytes_written;
HANDLE h;
@@
-638,7
+632,6
@@
pipe_select_thread (void *arg)
{
struct serial *scb = (struct serial *) arg;
struct ser_console_state *state;
{
struct serial *scb = (struct serial *) arg;
struct ser_console_state *state;
- int event_index;
HANDLE h;
state = (struct ser_console_state *) scb->state;
HANDLE h;
state = (struct ser_console_state *) scb->state;
@@
-681,7
+674,6
@@
file_select_thread (void *arg)
{
struct serial *scb = (struct serial *) arg;
struct ser_console_state *state;
{
struct serial *scb = (struct serial *) arg;
struct ser_console_state *state;
- int event_index;
HANDLE h;
state = (struct ser_console_state *) scb->state;
HANDLE h;
state = (struct ser_console_state *) scb->state;
@@
-852,47
+844,44
@@
free_pipe_state (struct pipe_state *ps)
errno = saved_errno;
}
errno = saved_errno;
}
-static void
-cleanup_pipe_state (void *untyped)
+struct pipe_state_destroyer
{
{
- struct pipe_state *ps = (struct pipe_state *) untyped;
+ void operator() (pipe_state *ps) const
+ {
+ free_pipe_state (ps);
+ }
+};
- free_pipe_state (ps);
-}
+typedef std::unique_ptr<pipe_state, pipe_state_destroyer> pipe_state_up;
static int
pipe_windows_open (struct serial *scb, const char *name)
{
static int
pipe_windows_open (struct serial *scb, const char *name)
{
- struct pipe_state *ps;
FILE *pex_stderr;
FILE *pex_stderr;
- char **argv;
- struct cleanup *back_to;
if (name == NULL)
error_no_arg (_("child command"));
if (name == NULL)
error_no_arg (_("child command"));
- argv = gdb_buildargv (name);
- back_to = make_cleanup_freeargv (argv);
+ gdb_argv argv (name);
if (! argv[0] || argv[0][0] == '\0')
error (_("missing child command"));
if (! argv[0] || argv[0][0] == '\0')
error (_("missing child command"));
- ps = make_pipe_state ();
- make_cleanup (cleanup_pipe_state, ps);
+ pipe_state_up ps (make_pipe_state ());
ps->pex = pex_init (PEX_USE_PIPES, "target remote pipe", NULL);
if (! ps->pex)
ps->pex = pex_init (PEX_USE_PIPES, "target remote pipe", NULL);
if (! ps->pex)
-
goto fail
;
+
return -1
;
ps->input = pex_input_pipe (ps->pex, 1);
if (! ps->input)
ps->input = pex_input_pipe (ps->pex, 1);
if (! ps->input)
-
goto fail
;
+
return -1
;
{
int err;
const char *err_msg
= pex_run (ps->pex, PEX_SEARCH | PEX_BINARY_INPUT | PEX_BINARY_OUTPUT
| PEX_STDERR_TO_PIPE,
{
int err;
const char *err_msg
= pex_run (ps->pex, PEX_SEARCH | PEX_BINARY_INPUT | PEX_BINARY_OUTPUT
| PEX_STDERR_TO_PIPE,
- argv[0], argv, NULL, NULL,
+ argv[0], argv
.get ()
, NULL, NULL,
&err);
if (err_msg)
&err);
if (err_msg)
@@
-912,22
+901,17
@@
pipe_windows_open (struct serial *scb, const char *name)
ps->output = pex_read_output (ps->pex, 1);
if (! ps->output)
ps->output = pex_read_output (ps->pex, 1);
if (! ps->output)
-
goto fail
;
+
return -1
;
scb->fd = fileno (ps->output);
pex_stderr = pex_read_err (ps->pex, 1);
if (! pex_stderr)
scb->fd = fileno (ps->output);
pex_stderr = pex_read_err (ps->pex, 1);
if (! pex_stderr)
-
goto fail
;
+
return -1
;
scb->error_fd = fileno (pex_stderr);
scb->error_fd = fileno (pex_stderr);
- scb->state =
(void *) ps
;
+ scb->state =
ps.release ()
;
- discard_cleanups (back_to);
return 0;
return 0;
-
- fail:
- do_cleanups (back_to);
- return -1;
}
static int
}
static int
@@
-1200,7
+1184,6
@@
net_windows_open (struct serial *scb, const char *name)
{
struct net_windows_state *state;
int ret;
{
struct net_windows_state *state;
int ret;
- DWORD threadId;
ret = net_open (scb, name);
if (ret != 0)
ret = net_open (scb, name);
if (ret != 0)
@@
-1253,7
+1236,6
@@
static const struct serial_ops hardwire_ops =
ser_base_copy_tty_state,
ser_base_set_tty_state,
ser_base_print_tty_state,
ser_base_copy_tty_state,
ser_base_set_tty_state,
ser_base_print_tty_state,
- ser_base_noflush_set_tty_state,
ser_windows_setbaudrate,
ser_windows_setstopbits,
ser_windows_setparity,
ser_windows_setbaudrate,
ser_windows_setstopbits,
ser_windows_setparity,
@@
-1284,7
+1266,6
@@
static const struct serial_ops tty_ops =
ser_base_copy_tty_state,
ser_base_set_tty_state,
ser_base_print_tty_state,
ser_base_copy_tty_state,
ser_base_set_tty_state,
ser_base_print_tty_state,
- ser_base_noflush_set_tty_state,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
@@
-1315,7
+1296,6
@@
static const struct serial_ops pipe_ops =
ser_base_copy_tty_state,
ser_base_set_tty_state,
ser_base_print_tty_state,
ser_base_copy_tty_state,
ser_base_set_tty_state,
ser_base_print_tty_state,
- ser_base_noflush_set_tty_state,
ser_base_setbaudrate,
ser_base_setstopbits,
ser_base_setparity,
ser_base_setbaudrate,
ser_base_setstopbits,
ser_base_setparity,
@@
-1346,7
+1326,6
@@
static const struct serial_ops tcp_ops =
ser_base_copy_tty_state,
ser_base_set_tty_state,
ser_base_print_tty_state,
ser_base_copy_tty_state,
ser_base_set_tty_state,
ser_base_print_tty_state,
- ser_base_noflush_set_tty_state,
ser_base_setbaudrate,
ser_base_setstopbits,
ser_base_setparity,
ser_base_setbaudrate,
ser_base_setstopbits,
ser_base_setparity,
@@
-1363,7
+1342,6
@@
void
_initialize_ser_windows (void)
{
WSADATA wsa_data;
_initialize_ser_windows (void)
{
WSADATA wsa_data;
- struct serial_ops *ops;
HMODULE hm = NULL;
HMODULE hm = NULL;
This page took
0.032441 seconds
and
4
git commands to generate.