2010-04-24 15:12:56 +02:00
|
|
|
/* Handle different target file systems for GDB, the GNU Debugger.
|
|
|
|
|
2013-01-01 07:33:28 +01:00
|
|
|
Copyright (C) 2010-2013 Free Software Foundation, Inc.
|
2010-04-24 15:12:56 +02:00
|
|
|
|
|
|
|
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 "defs.h"
|
|
|
|
#include "filesystem.h"
|
|
|
|
#include "gdbarch.h"
|
|
|
|
#include "gdbcmd.h"
|
|
|
|
|
|
|
|
const char file_system_kind_auto[] = "auto";
|
|
|
|
const char file_system_kind_unix[] = "unix";
|
|
|
|
const char file_system_kind_dos_based[] = "dos-based";
|
2012-01-28 19:08:22 +01:00
|
|
|
const char *const target_file_system_kinds[] =
|
2010-04-24 15:12:56 +02:00
|
|
|
{
|
|
|
|
file_system_kind_auto,
|
|
|
|
file_system_kind_unix,
|
|
|
|
file_system_kind_dos_based,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
const char *target_file_system_kind = file_system_kind_auto;
|
|
|
|
|
|
|
|
const char *
|
|
|
|
effective_target_file_system_kind (void)
|
|
|
|
{
|
|
|
|
if (target_file_system_kind == file_system_kind_auto)
|
|
|
|
{
|
* gdbarch.sh (target_gdbarch): Remove macro.
(get_target_gdbarch): Rename to target_gdbarch.
* gdbarch.c, gdbarch.h: Rebuild.
* ada-tasks.c, aix-thread.c, amd64-linux-nat.c, arch-utils.c,
arm-tdep.c, auxv.c, breakpoint.c, bsd-uthread.c, corefile.c,
darwin-nat-info.c, dcache.c, dsrec.c, exec.c, fbsd-nat.c,
filesystem.c, gcore.c, gnu-nat.c, i386-darwin-nat.c, i386-nat.c,
ia64-vms-tdep.c, inf-ptrace.c, infcmd.c, jit.c, linux-nat.c,
linux-tdep.c, linux-thread-db.c, m32r-rom.c, memattr.c,
mep-tdep.c, microblaze-tdep.c, mips-linux-nat.c,
mips-linux-tdep.c, mips-tdep.c, monitor.c, moxie-tdep.c,
nto-procfs.c, nto-tdep.c, ppc-linux-nat.c, proc-service.c,
procfs.c, progspace.c, ravenscar-thread.c, record.c,
remote-m32r-sdi.c, remote-mips.c, remote-sim.c, remote.c,
rl78-tdep.c, rs6000-nat.c, rx-tdep.c, s390-nat.c, sol-thread.c,
solib-darwin.c, solib-dsbt.c, solib-frv.c, solib-ia64-hpux.c,
solib-irix.c, solib-pa64.c, solib-som.c, solib-spu.c,
solib-sunos.c, solib-svr4.c, solib.c, spu-linux-nat.c,
spu-multiarch.c, spu-tdep.c, symfile-mem.c, symfile.c, symtab.c,
target-descriptions.c, target.c, target.h, tracepoint.c,
windows-nat.c, windows-tdep.c, xcoffsolib.c, cli/cli-dump.c,
common/agent.c, mi/mi-interp.c, python/py-finishbreakpoint.c,
python/py-inferior.c, python/python.c: Update.
2012-11-09 20:58:03 +01:00
|
|
|
if (gdbarch_has_dos_based_file_system (target_gdbarch ()))
|
2010-04-24 15:12:56 +02:00
|
|
|
return file_system_kind_dos_based;
|
|
|
|
else
|
|
|
|
return file_system_kind_unix;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return target_file_system_kind;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
target_lbasename (const char *kind, const char *name)
|
|
|
|
{
|
|
|
|
if (kind == file_system_kind_dos_based)
|
|
|
|
return dos_lbasename (name);
|
|
|
|
else
|
|
|
|
return unix_lbasename (name);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
show_target_file_system_kind_command (struct ui_file *file,
|
|
|
|
int from_tty,
|
|
|
|
struct cmd_list_element *c,
|
|
|
|
const char *value)
|
|
|
|
{
|
|
|
|
if (target_file_system_kind == file_system_kind_auto)
|
|
|
|
fprintf_filtered (file, _("\
|
|
|
|
The assumed file system kind for target reported file names \
|
|
|
|
is \"%s\" (currently \"%s\").\n"),
|
|
|
|
value,
|
|
|
|
effective_target_file_system_kind ());
|
|
|
|
else
|
|
|
|
fprintf_filtered (file, _("\
|
|
|
|
The assumed file system kind for target reported file names \
|
|
|
|
is \"%s\".\n"),
|
|
|
|
value);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Provide a prototype to silence -Wmissing-prototypes. */
|
|
|
|
extern initialize_file_ftype _initialize_filesystem;
|
|
|
|
|
|
|
|
void
|
|
|
|
_initialize_filesystem (void)
|
|
|
|
{
|
|
|
|
add_setshow_enum_cmd ("target-file-system-kind",
|
|
|
|
class_files,
|
|
|
|
target_file_system_kinds,
|
|
|
|
&target_file_system_kind, _("\
|
|
|
|
Set assumed file system kind for target reported file names"), _("\
|
|
|
|
Show assumed file system kind for target reported file names"),
|
|
|
|
_("\
|
2010-07-01 17:36:18 +02:00
|
|
|
If `unix', target file names (e.g., loaded shared library file names)\n\
|
|
|
|
starting the forward slash (`/') character are considered absolute,\n\
|
|
|
|
and the directory separator character is the forward slash (`/'). If\n\
|
|
|
|
`dos-based', target file names starting with a drive letter followed\n\
|
|
|
|
by a colon (e.g., `c:'), are also considered absolute, and the\n\
|
|
|
|
backslash (`\\') is also considered a directory separator. Set to\n\
|
|
|
|
`auto' (which is the default), to let GDB decide, based on its\n\
|
2010-04-24 15:12:56 +02:00
|
|
|
knowledge of the target operating system."),
|
|
|
|
NULL, /* setfunc */
|
|
|
|
show_target_file_system_kind_command,
|
|
|
|
&setlist, &showlist);
|
|
|
|
}
|