mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-21 04:42:53 +08:00
80fd282641
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.
87 lines
3.4 KiB
C++
87 lines
3.4 KiB
C++
/* Functions and data responsible for forking the inferior process.
|
|
|
|
Copyright (C) 1986-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/>. */
|
|
|
|
#ifndef NAT_FORK_INFERIOR_H
|
|
#define NAT_FORK_INFERIOR_H
|
|
|
|
#include <string>
|
|
|
|
/* Number of traps that happen between exec'ing the shell to run an
|
|
inferior and when we finally get to the inferior code, not counting
|
|
the exec for the shell. This is 1 on all supported
|
|
implementations. */
|
|
#define START_INFERIOR_TRAPS_EXPECTED 1
|
|
|
|
/* Start an inferior Unix child process and sets inferior_ptid to its
|
|
pid. EXEC_FILE is the file to run. ALLARGS is a string containing
|
|
the arguments to the program. ENV is the environment vector to
|
|
pass. SHELL_FILE is the shell file, or NULL if we should pick
|
|
one. EXEC_FUN is the exec(2) function to use, or NULL for the default
|
|
one. */
|
|
|
|
/* This function is NOT reentrant. Some of the variables have been
|
|
made static to ensure that they survive the vfork call. */
|
|
extern pid_t fork_inferior (const char *exec_file_arg,
|
|
const std::string &allargs,
|
|
char **env, void (*traceme_fun) (),
|
|
void (*init_trace_fun) (int),
|
|
void (*pre_trace_fun) (),
|
|
const char *shell_file_arg,
|
|
void (*exec_fun) (const char *file,
|
|
char * const *argv,
|
|
char * const *env));
|
|
|
|
/* Accept NTRAPS traps from the inferior.
|
|
|
|
Return the ptid of the inferior being started. */
|
|
extern ptid_t startup_inferior (pid_t pid, int ntraps,
|
|
struct target_waitstatus *mystatus,
|
|
ptid_t *myptid);
|
|
|
|
/* 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. */
|
|
extern void prefork_hook (const char *args);
|
|
|
|
/* Perform any necessary tasks after a fork/vfork takes place. This
|
|
function is mainly used by fork_inferior. */
|
|
extern void postfork_hook (pid_t pid);
|
|
|
|
/* Perform any necessary tasks *on the child* after a fork/vfork takes
|
|
place. This function is mainly used by fork_inferior. */
|
|
extern void postfork_child_hook ();
|
|
|
|
/* Flush both stdout and stderr. This function needs to be
|
|
implemented differently on GDB and GDBserver. */
|
|
extern void gdb_flush_out_err ();
|
|
|
|
/* Report an error that happened when starting to trace the inferior
|
|
(i.e., when the "traceme_fun" callback is called on fork_inferior)
|
|
and bail out. This function does not return. */
|
|
extern void trace_start_error (const char *fmt, ...)
|
|
ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 2);
|
|
|
|
/* Like "trace_start_error", but the error message is constructed by
|
|
combining STRING with the system error message for errno. This
|
|
function does not return. */
|
|
extern void trace_start_error_with_name (const char *string)
|
|
ATTRIBUTE_NORETURN;
|
|
|
|
#endif /* NAT_FORK_INFERIOR_H */
|