]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/serial.c
Change serial "open" functions to throw exception
[thirdparty/binutils-gdb.git] / gdb / serial.c
CommitLineData
c906108c 1/* Generic serial interface routines
4fcf66da 2
213516ef 3 Copyright (C) 1992-2023 Free Software Foundation, Inc.
c906108c 4
c5aa993b 5 This file is part of GDB.
c906108c 6
c5aa993b
JM
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
a9762ec7 9 the Free Software Foundation; either version 3 of the License, or
c5aa993b 10 (at your option) any later version.
c906108c 11
c5aa993b
JM
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
c906108c 16
c5aa993b 17 You should have received a copy of the GNU General Public License
a9762ec7 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
c906108c
SS
19
20#include "defs.h"
21#include <ctype.h>
22#include "serial.h"
c906108c 23#include "gdbcmd.h"
529480d0 24#include "cli/cli-utils.h"
c906108c 25
c378eb4e 26/* Is serial being debugged? */
2acceee2 27
ccce17b0 28static unsigned int global_serial_debug_p;
2acceee2 29
fcd488ca
TT
30/* Serial I/O handlers. */
31
191cca63 32static std::vector<const struct serial_ops *> serial_ops_list;
c906108c 33
5eb3b062
PA
34/* Pointer to list of scb's. */
35
36static struct serial *scb_base;
37
c906108c 38/* Non-NULL gives filename which contains a recording of the remote session,
c378eb4e 39 suitable for playback by gdbserver. */
c906108c 40
e0700ba4 41static std::string serial_logfile;
d9fcf2fb 42static struct ui_file *serial_logfp = NULL;
c906108c 43
fcd488ca 44static const struct serial_ops *serial_interface_lookup (const char *);
3e43a32a
MS
45static void serial_logchar (struct ui_file *stream,
46 int ch_type, int ch, int timeout);
53904c9e
AC
47static const char logbase_hex[] = "hex";
48static const char logbase_octal[] = "octal";
49static const char logbase_ascii[] = "ascii";
40478521 50static const char *const logbase_enums[] =
c5aa993b 51{logbase_hex, logbase_octal, logbase_ascii, NULL};
53904c9e 52static const char *serial_logbase = logbase_ascii;
c906108c 53\f
c5aa993b 54
c906108c
SS
55static int serial_current_type = 0;
56
c378eb4e 57/* Log char CH of type CHTYPE, with TIMEOUT. */
c906108c
SS
58
59/* Define bogus char to represent a BREAK. Should be careful to choose a value
60 that can't be confused with a normal char, or an error code. */
61#define SERIAL_BREAK 1235
62
63static void
d9fcf2fb 64serial_logchar (struct ui_file *stream, int ch_type, int ch, int timeout)
c906108c
SS
65{
66 if (ch_type != serial_current_type)
67 {
6cb06a8c 68 gdb_printf (stream, "\n%c ", ch_type);
c906108c
SS
69 serial_current_type = ch_type;
70 }
71
72 if (serial_logbase != logbase_ascii)
a11ac3b3 73 gdb_putc (' ', stream);
c906108c
SS
74
75 switch (ch)
76 {
77 case SERIAL_TIMEOUT:
6cb06a8c 78 gdb_printf (stream, "<Timeout: %d seconds>", timeout);
c906108c
SS
79 return;
80 case SERIAL_ERROR:
6cb06a8c 81 gdb_printf (stream, "<Error: %s>", safe_strerror (errno));
c906108c
SS
82 return;
83 case SERIAL_EOF:
0426ad51 84 gdb_puts ("<Eof>", stream);
c906108c
SS
85 return;
86 case SERIAL_BREAK:
0426ad51 87 gdb_puts ("<Break>", stream);
c906108c
SS
88 return;
89 default:
90 if (serial_logbase == logbase_hex)
6cb06a8c 91 gdb_printf (stream, "%02x", ch & 0xff);
c906108c 92 else if (serial_logbase == logbase_octal)
6cb06a8c 93 gdb_printf (stream, "%03o", ch & 0xff);
c906108c
SS
94 else
95 switch (ch)
96 {
c5aa993b 97 case '\\':
0426ad51 98 gdb_puts ("\\\\", stream);
c5aa993b
JM
99 break;
100 case '\b':
0426ad51 101 gdb_puts ("\\b", stream);
c5aa993b
JM
102 break;
103 case '\f':
0426ad51 104 gdb_puts ("\\f", stream);
c5aa993b
JM
105 break;
106 case '\n':
0426ad51 107 gdb_puts ("\\n", stream);
c5aa993b
JM
108 break;
109 case '\r':
0426ad51 110 gdb_puts ("\\r", stream);
c5aa993b
JM
111 break;
112 case '\t':
0426ad51 113 gdb_puts ("\\t", stream);
c5aa993b
JM
114 break;
115 case '\v':
0426ad51 116 gdb_puts ("\\v", stream);
c5aa993b
JM
117 break;
118 default:
6cb06a8c
TT
119 gdb_printf (stream,
120 isprint (ch) ? "%c" : "\\x%02x", ch & 0xFF);
c5aa993b 121 break;
c906108c
SS
122 }
123 }
124}
125
126void
4ab76ea3 127serial_log_command (struct target_ops *self, const char *cmd)
c906108c
SS
128{
129 if (!serial_logfp)
130 return;
131
132 serial_current_type = 'c';
133
0426ad51
TT
134 gdb_puts ("\nc ", serial_logfp);
135 gdb_puts (cmd, serial_logfp);
c906108c
SS
136
137 /* Make sure that the log file is as up-to-date as possible,
c378eb4e 138 in case we are getting ready to dump core or something. */
c906108c
SS
139 gdb_flush (serial_logfp);
140}
141
c2c6d25f 142\f
fcd488ca 143static const struct serial_ops *
58f07bae 144serial_interface_lookup (const char *name)
c906108c 145{
71b73764 146 for (const serial_ops *ops : serial_ops_list)
c906108c
SS
147 if (strcmp (name, ops->name) == 0)
148 return ops;
149
150 return NULL;
151}
152
153void
fcd488ca 154serial_add_interface (const struct serial_ops *optable)
c906108c 155{
191cca63 156 serial_ops_list.push_back (optable);
c906108c
SS
157}
158
5eb3b062
PA
159/* Return the open serial device for FD, if found, or NULL if FD is
160 not already opened. */
161
162struct serial *
163serial_for_fd (int fd)
164{
165 struct serial *scb;
166
167 for (scb = scb_base; scb; scb = scb->next)
168 if (scb->fd == fd)
169 return scb;
170
171 return NULL;
172}
173
00340e1b
PA
174/* Create a new serial for OPS. */
175
a2e0acea 176static gdb::unique_xmalloc_ptr<struct serial>
00340e1b
PA
177new_serial (const struct serial_ops *ops)
178{
a2e0acea 179 gdb::unique_xmalloc_ptr<struct serial> scb (XCNEW (struct serial));
00340e1b
PA
180
181 scb->ops = ops;
182
183 scb->bufp = scb->buf;
184 scb->error_fd = -1;
185 scb->refcnt = 1;
186
187 return scb;
188}
189
190static struct serial *serial_open_ops_1 (const struct serial_ops *ops,
191 const char *open_name);
192
c378eb4e 193/* Open up a device or a network socket, depending upon the syntax of NAME. */
c906108c 194
819cc324 195struct serial *
c2c6d25f 196serial_open (const char *name)
c906108c 197{
fcd488ca 198 const struct serial_ops *ops;
c2c6d25f 199 const char *open_name = name;
c906108c 200
ca1ca08b 201 if (startswith (name, "|"))
cced7cac 202 ops = serial_interface_lookup ("pipe");
2821caf1
JB
203 /* Check for a colon, suggesting an IP address/port pair.
204 Do this *after* checking for all the interesting prefixes. We
205 don't want to constrain the syntax of what can follow them. */
431f22cc 206 else if (strchr (name, ':'))
2821caf1 207 ops = serial_interface_lookup ("tcp");
c906108c 208 else
c1168a2f
JD
209 {
210#ifndef USE_WIN32API
211 /* Check to see if name is a socket. If it is, then treat it
dda83cd7 212 as such. Otherwise assume that it's a character device. */
c1168a2f 213 struct stat sb;
431f22cc 214 if (stat (name, &sb) == 0 && (sb.st_mode & S_IFMT) == S_IFSOCK)
c1168a2f
JD
215 ops = serial_interface_lookup ("local");
216 else
217#endif
218 ops = serial_interface_lookup ("hardwire");
219 }
c906108c
SS
220
221 if (!ops)
a2e0acea 222 error (_("could not find serial handler for '%s'"), name);
c906108c 223
00340e1b
PA
224 return serial_open_ops_1 (ops, open_name);
225}
c906108c 226
00340e1b 227/* Open up a serial for OPS, passing OPEN_NAME to the open method. */
c906108c 228
00340e1b
PA
229static struct serial *
230serial_open_ops_1 (const struct serial_ops *ops, const char *open_name)
231{
a2e0acea 232 gdb::unique_xmalloc_ptr<struct serial> scb = new_serial (ops);
c906108c 233
766062f6 234 /* `...->open (...)' would get expanded by the open(2) syscall macro. */
a2e0acea 235 (*scb->ops->open) (scb.get (), open_name);
c906108c 236
4f837581 237 scb->name = open_name != NULL ? xstrdup (open_name) : NULL;
5eb3b062 238 scb->next = scb_base;
a2e0acea 239 scb_base = scb.get ();
c906108c 240
e0700ba4 241 if (!serial_logfile.empty ())
c906108c 242 {
d7e74731
PA
243 stdio_file_up file (new stdio_file ());
244
e0700ba4
SM
245 if (!file->open (serial_logfile.c_str (), "w"))
246 perror_with_name (serial_logfile.c_str ());
d7e74731
PA
247
248 serial_logfp = file.release ();
c906108c
SS
249 }
250
a2e0acea 251 return scb.release ();
c906108c
SS
252}
253
00340e1b
PA
254/* See serial.h. */
255
256struct serial *
257serial_open_ops (const struct serial_ops *ops)
258{
259 return serial_open_ops_1 (ops, NULL);
260}
261
58f07bae
PA
262/* Open a new serial stream using a file handle, using serial
263 interface ops OPS. */
264
265static struct serial *
fcd488ca 266serial_fdopen_ops (const int fd, const struct serial_ops *ops)
c906108c 267{
0ea3f30e 268 if (!ops)
58f07bae
PA
269 {
270 ops = serial_interface_lookup ("terminal");
271 if (!ops)
24b21115 272 ops = serial_interface_lookup ("hardwire");
58f07bae 273 }
c906108c
SS
274
275 if (!ops)
276 return NULL;
277
a2e0acea 278 gdb::unique_xmalloc_ptr<struct serial> scb = new_serial (ops);
c906108c 279
4f837581 280 scb->name = NULL;
5eb3b062 281 scb->next = scb_base;
a2e0acea 282 scb_base = scb.get ();
c906108c 283
58f07bae 284 if ((ops->fdopen) != NULL)
a2e0acea 285 (*ops->fdopen) (scb.get (), fd);
58f07bae
PA
286 else
287 scb->fd = fd;
288
a2e0acea 289 return scb.release ();
c906108c
SS
290}
291
58f07bae
PA
292struct serial *
293serial_fdopen (const int fd)
294{
295 return serial_fdopen_ops (fd, NULL);
296}
297
c2c6d25f 298static void
819cc324 299do_serial_close (struct serial *scb, int really_close)
c906108c 300{
819cc324 301 struct serial *tmp_scb;
c906108c 302
c906108c
SS
303 if (serial_logfp)
304 {
0426ad51 305 gdb_puts ("\nEnd of log\n", serial_logfp);
c906108c
SS
306 serial_current_type = 0;
307
c378eb4e 308 /* XXX - What if serial_logfp == gdb_stdout or gdb_stderr? */
d7e74731 309 delete serial_logfp;
c906108c
SS
310 serial_logfp = NULL;
311 }
312
c378eb4e 313 /* ensure that the FD has been taken out of async mode. */
c2c6d25f
JM
314 if (scb->async_handler != NULL)
315 serial_async (scb, NULL, NULL);
316
c906108c
SS
317 if (really_close)
318 scb->ops->close (scb);
319
4f837581
PA
320 xfree (scb->name);
321
ddefb60f
PA
322 /* For serial_is_open. */
323 scb->bufp = NULL;
324
5eb3b062
PA
325 if (scb_base == scb)
326 scb_base = scb_base->next;
327 else
328 for (tmp_scb = scb_base; tmp_scb; tmp_scb = tmp_scb->next)
329 {
330 if (tmp_scb->next != scb)
331 continue;
332
333 tmp_scb->next = tmp_scb->next->next;
334 break;
335 }
336
ddefb60f 337 serial_unref (scb);
c906108c
SS
338}
339
c2c6d25f 340void
819cc324 341serial_close (struct serial *scb)
c2c6d25f
JM
342{
343 do_serial_close (scb, 1);
344}
345
346void
819cc324 347serial_un_fdopen (struct serial *scb)
c2c6d25f
JM
348{
349 do_serial_close (scb, 0);
350}
351
ddefb60f
PA
352int
353serial_is_open (struct serial *scb)
354{
355 return scb->bufp != NULL;
356}
357
358void
359serial_ref (struct serial *scb)
360{
361 scb->refcnt++;
362}
363
364void
365serial_unref (struct serial *scb)
366{
367 --scb->refcnt;
368 if (scb->refcnt == 0)
369 xfree (scb);
370}
371
c2c6d25f 372int
819cc324 373serial_readchar (struct serial *scb, int timeout)
c2c6d25f
JM
374{
375 int ch;
376
2df3850c 377 /* FIXME: cagney/1999-10-11: Don't enable this check until the ASYNC
c378eb4e 378 code is finished. */
2cd58942 379 if (0 && serial_is_async_p (scb) && timeout < 0)
f34652de 380 internal_error (_("serial_readchar: blocking read in async mode"));
2df3850c 381
c2c6d25f
JM
382 ch = scb->ops->readchar (scb, timeout);
383 if (serial_logfp != NULL)
384 {
2acceee2 385 serial_logchar (serial_logfp, 'r', ch, timeout);
c2c6d25f
JM
386
387 /* Make sure that the log file is as up-to-date as possible,
dda83cd7 388 in case we are getting ready to dump core or something. */
c2c6d25f
JM
389 gdb_flush (serial_logfp);
390 }
2cd58942 391 if (serial_debug_p (scb))
2acceee2 392 {
6cb06a8c 393 gdb_printf (gdb_stdlog, "[");
2acceee2 394 serial_logchar (gdb_stdlog, 'r', ch, timeout);
6cb06a8c 395 gdb_printf (gdb_stdlog, "]");
2acceee2
JM
396 gdb_flush (gdb_stdlog);
397 }
c2c6d25f
JM
398
399 return (ch);
400}
401
402int
c628b528 403serial_write (struct serial *scb, const void *buf, size_t count)
c2c6d25f
JM
404{
405 if (serial_logfp != NULL)
406 {
19ba03f4 407 const char *str = (const char *) buf;
c628b528 408 size_t c;
c2c6d25f 409
c628b528
PA
410 for (c = 0; c < count; c++)
411 serial_logchar (serial_logfp, 'w', str[c] & 0xff, 0);
c2c6d25f
JM
412
413 /* Make sure that the log file is as up-to-date as possible,
dda83cd7 414 in case we are getting ready to dump core or something. */
c2c6d25f
JM
415 gdb_flush (serial_logfp);
416 }
9214d371
DE
417 if (serial_debug_p (scb))
418 {
19ba03f4 419 const char *str = (const char *) buf;
c628b528 420 size_t c;
9214d371 421
c628b528 422 for (c = 0; c < count; c++)
9214d371 423 {
6cb06a8c 424 gdb_printf (gdb_stdlog, "[");
0e58ee40 425 serial_logchar (gdb_stdlog, 'w', str[c] & 0xff, 0);
6cb06a8c 426 gdb_printf (gdb_stdlog, "]");
9214d371
DE
427 }
428 gdb_flush (gdb_stdlog);
429 }
c2c6d25f 430
c628b528 431 return (scb->ops->write (scb, buf, count));
c2c6d25f
JM
432}
433
434void
467dc1e2 435serial_printf (struct serial *desc, const char *format, ...)
c2c6d25f
JM
436{
437 va_list args;
c2c6d25f
JM
438 va_start (args, format);
439
467dc1e2
SM
440 std::string buf = string_vprintf (format, args);
441 serial_write (desc, buf.c_str (), buf.length ());
c2c6d25f 442
c2c6d25f
JM
443 va_end (args);
444}
445
446int
819cc324 447serial_drain_output (struct serial *scb)
c2c6d25f
JM
448{
449 return scb->ops->drain_output (scb);
450}
451
452int
819cc324 453serial_flush_output (struct serial *scb)
c2c6d25f
JM
454{
455 return scb->ops->flush_output (scb);
456}
457
458int
819cc324 459serial_flush_input (struct serial *scb)
c2c6d25f
JM
460{
461 return scb->ops->flush_input (scb);
462}
463
464int
819cc324 465serial_send_break (struct serial *scb)
c2c6d25f
JM
466{
467 if (serial_logfp != NULL)
2acceee2 468 serial_logchar (serial_logfp, 'w', SERIAL_BREAK, 0);
c2c6d25f
JM
469
470 return (scb->ops->send_break (scb));
471}
472
473void
819cc324 474serial_raw (struct serial *scb)
c2c6d25f
JM
475{
476 scb->ops->go_raw (scb);
477}
478
479serial_ttystate
819cc324 480serial_get_tty_state (struct serial *scb)
c2c6d25f
JM
481{
482 return scb->ops->get_tty_state (scb);
483}
484
1e182ce8
UW
485serial_ttystate
486serial_copy_tty_state (struct serial *scb, serial_ttystate ttystate)
487{
488 return scb->ops->copy_tty_state (scb, ttystate);
489}
490
c2c6d25f 491int
819cc324 492serial_set_tty_state (struct serial *scb, serial_ttystate ttystate)
c2c6d25f
JM
493{
494 return scb->ops->set_tty_state (scb, ttystate);
495}
496
497void
819cc324 498serial_print_tty_state (struct serial *scb,
c2c6d25f 499 serial_ttystate ttystate,
d9fcf2fb 500 struct ui_file *stream)
c2c6d25f
JM
501{
502 scb->ops->print_tty_state (scb, ttystate, stream);
503}
504
ad3cf8c6 505void
819cc324 506serial_setbaudrate (struct serial *scb, int rate)
c2c6d25f 507{
ad3cf8c6 508 scb->ops->setbaudrate (scb, rate);
c2c6d25f
JM
509}
510
511int
819cc324 512serial_setstopbits (struct serial *scb, int num)
c2c6d25f
JM
513{
514 return scb->ops->setstopbits (scb, num);
515}
516
236af5e3
YG
517/* See serial.h. */
518
519int
520serial_setparity (struct serial *scb, int parity)
521{
522 return scb->ops->setparity (scb, parity);
523}
524
c2c6d25f 525int
819cc324 526serial_can_async_p (struct serial *scb)
c2c6d25f
JM
527{
528 return (scb->ops->async != NULL);
529}
530
531int
819cc324 532serial_is_async_p (struct serial *scb)
c2c6d25f
JM
533{
534 return (scb->ops->async != NULL) && (scb->async_handler != NULL);
535}
536
537void
819cc324 538serial_async (struct serial *scb,
c2c6d25f
JM
539 serial_event_ftype *handler,
540 void *context)
541{
05ce04a4 542 int changed = ((scb->async_handler == NULL) != (handler == NULL));
433759f7 543
c2c6d25f
JM
544 scb->async_handler = handler;
545 scb->async_context = context;
05ce04a4
VP
546 /* Only change mode if there is a need. */
547 if (changed)
548 scb->ops->async (scb, handler != NULL);
c2c6d25f
JM
549}
550
2acceee2 551void
819cc324 552serial_debug (struct serial *scb, int debug_p)
2acceee2
JM
553{
554 scb->debug_p = debug_p;
555}
556
557int
819cc324 558serial_debug_p (struct serial *scb)
2acceee2
JM
559{
560 return scb->debug_p || global_serial_debug_p;
561}
562
0ea3f30e
DJ
563#ifdef USE_WIN32API
564void
565serial_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except)
566{
567 if (scb->ops->wait_handle)
568 scb->ops->wait_handle (scb, read, except);
569 else
570 {
571 *read = (HANDLE) _get_osfhandle (scb->fd);
572 *except = NULL;
573 }
574}
c3e2b812
DJ
575
576void
577serial_done_wait_handle (struct serial *scb)
578{
579 if (scb->ops->done_wait_handle)
580 scb->ops->done_wait_handle (scb);
581}
0ea3f30e 582#endif
2acceee2 583
58f07bae
PA
584int
585serial_pipe (struct serial *scbs[2])
586{
fcd488ca 587 const struct serial_ops *ops;
58f07bae
PA
588 int fildes[2];
589
590 ops = serial_interface_lookup ("pipe");
591 if (!ops)
592 {
593 errno = ENOSYS;
594 return -1;
595 }
596
597 if (gdb_pipe (fildes) == -1)
598 return -1;
599
600 scbs[0] = serial_fdopen_ops (fildes[0], ops);
601 scbs[1] = serial_fdopen_ops (fildes[1], ops);
602 return 0;
603}
604
e3abfe1d
AC
605/* Serial set/show framework. */
606
607static struct cmd_list_element *serial_set_cmdlist;
608static struct cmd_list_element *serial_show_cmdlist;
609
16e9019e 610/* See serial.h. */
0d12017b
JB
611
612int baud_rate = -1;
613
614static void
615serial_baud_show_cmd (struct ui_file *file, int from_tty,
616 struct cmd_list_element *c, const char *value)
617{
6cb06a8c
TT
618 gdb_printf (file, _("Baud rate for remote serial I/O is %s.\n"),
619 value);
0d12017b 620}
e3abfe1d 621
16e9019e 622/* See serial.h. */
236af5e3
YG
623
624int serial_parity = GDBPARITY_NONE;
625
626static const char parity_none[] = "none";
627static const char parity_odd[] = "odd";
628static const char parity_even[] = "even";
629static const char *const parity_enums[] =
630 {parity_none, parity_odd, parity_even, NULL};
631static const char *parity = parity_none;
632
633/* Set serial_parity value. */
634
635static void
eb4c3f4a 636set_parity (const char *ignore_args, int from_tty, struct cmd_list_element *c)
236af5e3
YG
637{
638 if (parity == parity_odd)
639 serial_parity = GDBPARITY_ODD;
640 else if (parity == parity_even)
641 serial_parity = GDBPARITY_EVEN;
642 else
643 serial_parity = GDBPARITY_NONE;
644}
645
6c265988 646void _initialize_serial ();
c906108c 647void
6c265988 648_initialize_serial ()
c906108c
SS
649{
650#if 0
1bedd215
AC
651 add_com ("connect", class_obscure, connect_command, _("\
652Connect the terminal directly up to the command monitor.\n\
653Use <CR>~. or <CR>~^D to break out."));
c906108c
SS
654#endif /* 0 */
655
f54bdb6d
SM
656 add_setshow_prefix_cmd ("serial", class_maintenance,
657 _("Set default serial/parallel port configuration."),
658 _("Show default serial/parallel port configuration."),
659 &serial_set_cmdlist, &serial_show_cmdlist,
660 &setlist, &showlist);
e3abfe1d 661
0d12017b
JB
662 /* If target is open when baud changes, it doesn't take effect until
663 the next open (I think, not sure). */
664 add_setshow_zinteger_cmd ("baud", no_class, &baud_rate, _("\
665Set baud rate for remote serial I/O."), _("\
666Show baud rate for remote serial I/O."), _("\
667This value is used to set the speed of the serial port when debugging\n\
668using remote targets."),
669 NULL,
670 serial_baud_show_cmd,
671 &serial_set_cmdlist, &serial_show_cmdlist);
672
236af5e3 673 add_setshow_enum_cmd ("parity", no_class, parity_enums,
dda83cd7 674 &parity, _("\
590042fc
PW
675Set parity for remote serial I/O."), _("\
676Show parity for remote serial I/O."), NULL,
dda83cd7
SM
677 set_parity,
678 NULL, /* FIXME: i18n: */
679 &serial_set_cmdlist, &serial_show_cmdlist);
236af5e3 680
f397e303
AC
681 add_setshow_filename_cmd ("remotelogfile", no_class, &serial_logfile, _("\
682Set filename for remote session recording."), _("\
683Show filename for remote session recording."), _("\
c906108c 684This file is used to record the remote session for future playback\n\
f397e303
AC
685by gdbserver."),
686 NULL,
687 NULL, /* FIXME: i18n: */
688 &setlist, &showlist);
c906108c 689
7ab04401
AC
690 add_setshow_enum_cmd ("remotelogbase", no_class, logbase_enums,
691 &serial_logbase, _("\
590042fc
PW
692Set numerical base for remote session logging."), _("\
693Show numerical base for remote session logging."), NULL,
7ab04401
AC
694 NULL,
695 NULL, /* FIXME: i18n: */
696 &setlist, &showlist);
2acceee2 697
ccce17b0
YQ
698 add_setshow_zuinteger_cmd ("serial", class_maintenance,
699 &global_serial_debug_p, _("\
85c07804
AC
700Set serial debugging."), _("\
701Show serial debugging."), _("\
702When non-zero, serial port debugging is enabled."),
ccce17b0
YQ
703 NULL,
704 NULL, /* FIXME: i18n: */
705 &setdebuglist, &showdebuglist);
c906108c 706}