xref: /netbsd-src/external/gpl3/gdb/dist/gdbsupport/common-inferior.h (revision d16b7486a53dcb8072b60ec6fcb4373a2d0c27b7)
1 /* Functions to deal with the inferior being executed on GDB or
2    GDBserver.
3 
4    Copyright (C) 1986-2023 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.
36 
37    If it is not set, the string is empty.  */
38 extern const std::string &get_inferior_cwd ();
39 
40 /* Whether to start up the debuggee under a shell.
41 
42    If startup-with-shell is set, GDB's "run" will attempt to start up
43    the debuggee under a shell.  This also happens when using GDBserver
44    under extended remote mode.
45 
46    This is in order for argument-expansion to occur.  E.g.,
47 
48    (gdb) run *
49 
50    The "*" gets expanded by the shell into a list of files.
51 
52    While this is a nice feature, it may be handy to bypass the shell
53    in some cases.  To disable this feature, do "set startup-with-shell
54    false".
55 
56    The catch-exec traps expected during start-up will be one more if
57    the target is started up with a shell.  */
58 extern bool startup_with_shell;
59 
60 /* Compute command-line string given argument vector. This does the
61    same shell processing as fork_inferior.  */
62 extern std::string
63 construct_inferior_arguments (gdb::array_view<char * const>);
64 
65 #endif /* COMMON_COMMON_INFERIOR_H */
66