Fix type of startup_with_shell in gdbserver
authorTom Tromey <tromey@adacore.com>
Tue, 1 Oct 2019 12:52:44 +0000 (06:52 -0600)
committerTom Tromey <tromey@adacore.com>
Wed, 2 Oct 2019 19:43:41 +0000 (13:43 -0600)
startup_with_shell was changed to be of "bool" type, but I noticed
that the definition in gdbserver disagreed.  This disagreement caused
some regressions on a big-endian machine.

This patch removes the redundant declaration and definition of
startup_with_shell and ensures that such clashes will be diagnosed.

This moves the declaration to common-inferior.h, and introduces a new
common-inferior.c, as suggested by Pedro.

gdb/ChangeLog
2019-10-02  Tom Tromey  <tromey@adacore.com>

* Makefile.in (COMMON_SFILES): Add common-inferior.c.
* gdbsupport/common-inferior.c: New file.
* infcmd.c (startup_with_shell): Don't define.
* nat/fork-inferior.h (startup_with_shell): Don't declare.
* gdbsupport/common-inferior.h (startup_with_shell): Declare.
* inferior.h (startup_with_shell): Don't declare.

gdb/gdbserver/ChangeLog
2019-10-02  Tom Tromey  <tromey@adacore.com>

* Makefile.in (SFILES): Add common-inferior.c.
(OBS): Add common-inferior.o.
* server.c (startup_with_shell): Don't define.

gdb/ChangeLog
gdb/Makefile.in
gdb/gdbserver/ChangeLog
gdb/gdbserver/Makefile.in
gdb/gdbserver/server.c
gdb/gdbsupport/common-inferior.c [new file with mode: 0644]
gdb/gdbsupport/common-inferior.h
gdb/infcmd.c
gdb/inferior.h
gdb/nat/fork-inferior.h

index 03c249815e6bf9f92a101d52af403760e5b4038b..13a1e46ca251c722190011513d705fcba15829bd 100644 (file)
@@ -1,3 +1,12 @@
+2019-10-02  Tom Tromey  <tromey@adacore.com>
+
+       * Makefile.in (COMMON_SFILES): Add common-inferior.c.
+       * gdbsupport/common-inferior.c: New file.
+       * infcmd.c (startup_with_shell): Don't define.
+       * nat/fork-inferior.h (startup_with_shell): Don't declare.
+       * gdbsupport/common-inferior.h (startup_with_shell): Declare.
+       * inferior.h (startup_with_shell): Don't declare.
+
 2019-10-02  Christian Biesinger  <cbiesinger@google.com>
 
        * gdbsupport/gdb_assert.h: Include errors.h.
index d6282636752525c1b7276548ac480c2e46f15663..81bed9085ac32e833256df6921957466ced053fe 100644 (file)
@@ -953,6 +953,7 @@ COMMON_SFILES = \
        gdbsupport/cleanups.c \
        gdbsupport/common-debug.c \
        gdbsupport/common-exceptions.c \
+       gdbsupport/common-inferior.c \
        gdbsupport/common-regcache.c \
        gdbsupport/common-utils.c \
        gdbsupport/errors.c \
index 7eef2c54cba73cd64e1977f42cdbfd7bae2b7a72..0108d6d152fc92ed5c1873f8c111a5485a3b7794 100644 (file)
@@ -1,3 +1,9 @@
+2019-10-02  Tom Tromey  <tromey@adacore.com>
+
+       * Makefile.in (SFILES): Add common-inferior.c.
+       (OBS): Add common-inferior.o.
+       * server.c (startup_with_shell): Don't define.
+
 2019-10-02  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * linux-low.c (linux_low_read_btrace): Update for change to
index ca0a4cbd10f5f3c465774474f9f28a7774e32ab8..d79424b5ac32ac9bf7932dc7c152afa0a1063a68 100644 (file)
@@ -203,6 +203,7 @@ SFILES = \
        $(srcdir)/gdbsupport/cleanups.c \
        $(srcdir)/gdbsupport/common-debug.c \
        $(srcdir)/gdbsupport/common-exceptions.c \
+       $(srcdir)/gdbsupport/common-inferior.c \
        $(srcdir)/gdbsupport/common-regcache.c \
        $(srcdir)/gdbsupport/common-utils.c \
        $(srcdir)/gdbsupport/errors.c \
@@ -248,6 +249,7 @@ OBS = \
        gdbsupport/cleanups.o \
        gdbsupport/common-debug.o \
        gdbsupport/common-exceptions.o \
+       gdbsupport/common-inferior.o \
        gdbsupport/job-control.o \
        gdbsupport/common-regcache.o \
        gdbsupport/common-utils.o \
index 67e8e3e54de363ffa77547b79d9ed01f0a4981df..8ee551828dcee51909cef5e13ae3a35f552d31b6 100644 (file)
@@ -67,12 +67,6 @@ char *current_directory;
 
 static gdb_environ our_environ;
 
-/* Start the inferior using a shell.  */
-
-/* We always try to start the inferior using a shell.  */
-
-int startup_with_shell = 1;
-
 int server_waiting;
 
 static int extended_protocol;
diff --git a/gdb/gdbsupport/common-inferior.c b/gdb/gdbsupport/common-inferior.c
new file mode 100644 (file)
index 0000000..3a7c873
--- /dev/null
@@ -0,0 +1,26 @@
+/* Functions to deal with the inferior being executed on GDB or
+   GDBserver.
+
+   Copyright (C) 2019 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include "gdbsupport/common-defs.h"
+#include "gdbsupport/common-inferior.h"
+
+/* See common-inferior.h.  */
+
+bool startup_with_shell = true;
index 72e4bd9eac37e4dbbb5fb74eca3b0b89c483db82..77d4ad93d3569197b621fa9533039947cc10b8c7 100644 (file)
@@ -38,4 +38,24 @@ extern const char *get_inferior_cwd ();
    the directory.  */
 extern void set_inferior_cwd (const char *cwd);
 
+/* Whether to start up the debuggee under a shell.
+
+   If startup-with-shell is set, GDB's "run" will attempt to start up
+   the debuggee under a shell.  This also happens when using GDBserver
+   under extended remote mode.
+
+   This is in order for argument-expansion to occur.  E.g.,
+
+   (gdb) run *
+
+   The "*" gets expanded by the shell into a list of files.
+
+   While this is a nice feature, it may be handy to bypass the shell
+   in some cases.  To disable this feature, do "set startup-with-shell
+   false".
+
+   The catch-exec traps expected during start-up will be one more if
+   the target is started up with a shell.  */
+extern bool startup_with_shell;
+
 #endif /* COMMON_COMMON_INFERIOR_H */
index 20523fed534ab4451fb5b21ac438107944b210f1..71057748fd12df0dc4948e659c42ca7f3d0134da 100644 (file)
@@ -104,10 +104,6 @@ enum stop_stack_kind stop_stack_dummy;
 
 int stopped_by_random_signal;
 
-/* See inferior.h.  */
-
-bool startup_with_shell = true;
-
 \f
 /* Accessor routines.  */
 
index 3a64a7cfeaeaba36d66332cfd421bed657d376b2..43f0417e62961b12bd4a3208a0a578c27f1ede90 100644 (file)
@@ -227,25 +227,6 @@ extern struct value *get_return_value (struct value *function,
 extern void prepare_execution_command (struct target_ops *target,
                                       int background);
 
-/* Whether to start up the debuggee under a shell.
-
-   If startup-with-shell is set, GDB's "run" will attempt to start up
-   the debuggee under a shell.
-
-   This is in order for argument-expansion to occur.  E.g.,
-
-   (gdb) run *
-
-   The "*" gets expanded by the shell into a list of files.
-
-   While this is a nice feature, it may be handy to bypass the shell
-   in some cases.  To disable this feature, do "set startup-with-shell
-   false".
-
-   The catch-exec traps expected during start-up will be one more if
-   the target is started up with a shell.  */
-extern bool startup_with_shell;
-
 /* Nonzero if stopped due to completion of a stack dummy routine.  */
 
 extern enum stop_stack_kind stop_stack_dummy;
index 065496c38279105e101c781c6db893a13d8cea7c..0a76ff82d31d05e8461f919fc342f80c6baf5929 100644 (file)
@@ -54,26 +54,6 @@ extern ptid_t startup_inferior (pid_t pid, int ntraps,
                                struct target_waitstatus *mystatus,
                                ptid_t *myptid);
 
-/* Whether to start up the debuggee under a shell.
-
-   If startup-with-shell is set, GDB's "run" will attempt to start up
-   the debuggee under a shell.  This also happens when using GDBserver
-   under extended remote mode.
-
-   This is in order for argument-expansion to occur.  E.g.,
-
-   (gdb) run *
-
-   The "*" gets expanded by the shell into a list of files.
-
-   While this is a nice feature, it may be handy to bypass the shell
-   in some cases.  To disable this feature, do "set startup-with-shell
-   false".
-
-   The catch-exec traps expected during start-up will be one more if
-   the target is started up with a shell.  */
-extern bool startup_with_shell;
-
 /* Perform any necessary tasks before a fork/vfork takes place.  ARGS
    is a string containing all the arguments received by the inferior.
    This function is mainly used by fork_inferior.  */
This page took 0.040427 seconds and 4 git commands to generate.