1 /* Functions to deal with the inferior being executed on GDB or
2    GDBserver.
3 
4    Copyright (C) 1986-2021 Free Software Foundation, Inc.
5 
6    This file is part of GDB.
7 
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 3 of the License, or
11    (at your option) any later version.
12 
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17 
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
20 
21 #ifndef COMMON_COMMON_INFERIOR_H
22 #define COMMON_COMMON_INFERIOR_H
23 
24 #include "gdbsupport/array-view.h"
25 
26 /* Return the exec wrapper to be used when starting the inferior, or NULL
27    otherwise.  */
28 extern const char *get_exec_wrapper ();
29 
30 /* Return the name of the executable file as a string.
31    ERR nonzero means get error if there is none specified;
32    otherwise return 0 in that case.  */
33 extern const char *get_exec_file (int err);
34 
35 /* Return the inferior's current working directory.  If nothing has
36    been set, then return NULL.  */
37 extern const char *get_inferior_cwd ();
38 
39 /* Set the inferior current working directory.  If CWD is NULL, unset
40    the directory.  */
41 extern void set_inferior_cwd (const char *cwd);
42 
43 /* Whether to start up the debuggee under a shell.
44 
45    If startup-with-shell is set, GDB's "run" will attempt to start up
46    the debuggee under a shell.  This also happens when using GDBserver
47    under extended remote mode.
48 
49    This is in order for argument-expansion to occur.  E.g.,
50 
51    (gdb) run *
52 
53    The "*" gets expanded by the shell into a list of files.
54 
55    While this is a nice feature, it may be handy to bypass the shell
56    in some cases.  To disable this feature, do "set startup-with-shell
57    false".
58 
59    The catch-exec traps expected during start-up will be one more if
60    the target is started up with a shell.  */
61 extern bool startup_with_shell;
62 
63 /* Compute command-line string given argument vector. This does the
64    same shell processing as fork_inferior.  */
65 extern std::string
66 construct_inferior_arguments (gdb::array_view<char * const>);
67 
68 #endif /* COMMON_COMMON_INFERIOR_H */
69