1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
From 785102a7d34f2d48f9a1616bf931fea6de2385fb Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Fri, 25 Nov 2016 15:16:13 +0100
Subject: [PATCH 05/65] Hurd, C++: Avoid "const char *" to "char *" casts
... by a bit of code refactoring:
gdb/
* gnu-nat.c (set_task_pause_cmd, set_signals_cmd)
(set_exceptions_cmd): Add variants taking an "int arg" instead of
a "char *". Make the "char *" variants use the former.
(set_noninvasive_cmd): Also use the "int arg" variants.
---
gdb/ChangeLog | 5 +++++
gdb/gnu-nat.c | 39 ++++++++++++++++++++++++++++-----------
2 files changed, 33 insertions(+), 11 deletions(-)
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 34fd6f1ced..29bd9b9039 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2792,12 +2792,12 @@ active_inf (void)
static void
-set_task_pause_cmd (char *args, int from_tty)
+set_task_pause_cmd (int arg, int from_tty)
{
struct inf *inf = cur_inf ();
int old_sc = inf->pause_sc;
- inf->pause_sc = parse_bool_arg (args, "set task pause");
+ inf->pause_sc = arg;
if (old_sc == 0 && inf->pause_sc != 0)
/* If the task is currently unsuspended, immediately suspend it,
@@ -2806,6 +2806,12 @@ set_task_pause_cmd (char *args, int from_tty)
}
static void
+set_task_pause_cmd (char *args, int from_tty)
+{
+ set_task_pause_cmd (parse_bool_arg (args, "set task pause"), from_tty);
+}
+
+static void
show_task_pause_cmd (char *args, int from_tty)
{
struct inf *inf = cur_inf ();
@@ -2991,11 +2997,11 @@ show_sig_thread_cmd (char *args, int from_tty)
static void
-set_signals_cmd (char *args, int from_tty)
+set_signals_cmd (int arg, int from_tty)
{
struct inf *inf = cur_inf ();
- inf->want_signals = parse_bool_arg (args, "set signals");
+ inf->want_signals = arg;
if (inf->task && inf->want_signals != inf->traced)
/* Make this take effect immediately in a running process. */
@@ -3003,6 +3009,12 @@ set_signals_cmd (char *args, int from_tty)
}
static void
+set_signals_cmd (char *args, int from_tty)
+{
+ set_signals_cmd(parse_bool_arg (args, "set signals"), from_tty);
+}
+
+static void
show_signals_cmd (char *args, int from_tty)
{
struct inf *inf = cur_inf ();
@@ -3015,15 +3027,20 @@ show_signals_cmd (char *args, int from_tty)
}
static void
-set_exceptions_cmd (char *args, int from_tty)
+set_exceptions_cmd (int arg, int from_tty)
{
struct inf *inf = cur_inf ();
- int val = parse_bool_arg (args, "set exceptions");
/* Make this take effect immediately in a running process. */
/* XXX */ ;
- inf->want_exceptions = val;
+ inf->want_exceptions = arg;
+}
+
+static void
+set_exceptions_cmd (char *args, int from_tty)
+{
+ set_exceptions_cmd (parse_bool_arg (args, "set exceptions"), from_tty);
}
static void
@@ -3078,11 +3095,11 @@ static void
set_noninvasive_cmd (char *args, int from_tty)
{
/* Invert the sense of the arg for each component. */
- char *inv_args = parse_bool_arg (args, "set noninvasive") ? "off" : "on";
+ int inv_arg = parse_bool_arg (args, "set noninvasive") ? 0 : 1;
- set_task_pause_cmd (inv_args, from_tty);
- set_signals_cmd (inv_args, from_tty);
- set_exceptions_cmd (inv_args, from_tty);
+ set_task_pause_cmd (inv_arg, from_tty);
+ set_signals_cmd (inv_arg, from_tty);
+ set_exceptions_cmd (inv_arg, from_tty);
}
--
2.11.0
|