]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/filesystem.c
gdb: add back declarations for _initialize functions
[thirdparty/binutils-gdb.git] / gdb / filesystem.c
CommitLineData
ab38a727
PA
1/* Handle different target file systems for GDB, the GNU Debugger.
2
b811d2c2 3 Copyright (C) 2010-2020 Free Software Foundation, Inc.
ab38a727
PA
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20#include "defs.h"
21#include "filesystem.h"
22#include "gdbarch.h"
23#include "gdbcmd.h"
24
25const char file_system_kind_auto[] = "auto";
26const char file_system_kind_unix[] = "unix";
27const char file_system_kind_dos_based[] = "dos-based";
40478521 28const char *const target_file_system_kinds[] =
ab38a727
PA
29{
30 file_system_kind_auto,
31 file_system_kind_unix,
32 file_system_kind_dos_based,
33 NULL
34};
35const char *target_file_system_kind = file_system_kind_auto;
36
37const char *
38effective_target_file_system_kind (void)
39{
40 if (target_file_system_kind == file_system_kind_auto)
41 {
f5656ead 42 if (gdbarch_has_dos_based_file_system (target_gdbarch ()))
ab38a727
PA
43 return file_system_kind_dos_based;
44 else
45 return file_system_kind_unix;
46 }
47 else
48 return target_file_system_kind;
49}
50
51const char *
52target_lbasename (const char *kind, const char *name)
53{
54 if (kind == file_system_kind_dos_based)
55 return dos_lbasename (name);
56 else
57 return unix_lbasename (name);
58}
59
60static void
61show_target_file_system_kind_command (struct ui_file *file,
62 int from_tty,
63 struct cmd_list_element *c,
64 const char *value)
65{
66 if (target_file_system_kind == file_system_kind_auto)
67 fprintf_filtered (file, _("\
68The assumed file system kind for target reported file names \
69is \"%s\" (currently \"%s\").\n"),
70 value,
71 effective_target_file_system_kind ());
72 else
73 fprintf_filtered (file, _("\
74The assumed file system kind for target reported file names \
75is \"%s\".\n"),
76 value);
77}
78
6c265988 79void _initialize_filesystem ();
ab38a727 80void
6c265988 81_initialize_filesystem ()
ab38a727
PA
82{
83 add_setshow_enum_cmd ("target-file-system-kind",
84 class_files,
85 target_file_system_kinds,
86 &target_file_system_kind, _("\
590042fc
PW
87Set assumed file system kind for target reported file names."), _("\
88Show assumed file system kind for target reported file names."),
ab38a727 89 _("\
cce7e648
PA
90If `unix', target file names (e.g., loaded shared library file names)\n\
91starting the forward slash (`/') character are considered absolute,\n\
92and the directory separator character is the forward slash (`/'). If\n\
93`dos-based', target file names starting with a drive letter followed\n\
94by a colon (e.g., `c:'), are also considered absolute, and the\n\
95backslash (`\\') is also considered a directory separator. Set to\n\
96`auto' (which is the default), to let GDB decide, based on its\n\
ab38a727
PA
97knowledge of the target operating system."),
98 NULL, /* setfunc */
99 show_target_file_system_kind_command,
100 &setlist, &showlist);
101}