aboutsummaryrefslogtreecommitdiff
path: root/sim/common/sim-options.c
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2004-12-08 00:40:30 +0000
committerHans-Peter Nilsson <hp@axis.com>2004-12-08 00:40:30 +0000
commit027e2a04f1bb48ef6839b4cdb83f11164db4c42d (patch)
treee8ddde668df755ea4511f8cad9718f1e5885b8f3 /sim/common/sim-options.c
parent9888440ad603c44db4908229b7ce827ca7a16eb4 (diff)
downloadgdb-027e2a04f1bb48ef6839b4cdb83f11164db4c42d.zip
gdb-027e2a04f1bb48ef6839b4cdb83f11164db4c42d.tar.gz
gdb-027e2a04f1bb48ef6839b4cdb83f11164db4c42d.tar.bz2
* run.1: Document --sysroot=filepath.
* sim-options.c (STANDARD_OPTIONS): New member OPTION_SYSROOT. (standard_options): Support --sysroot=<path>. (standard_option_handler): Handle OPTION_SYSROOT. * syscall.c (simulator_sysroot): Define, initialized empty. (get_path): Prepend simulator_sysroot to absolute file path. [HAVE_STRING_H]: Include string.h. [!HAVE_STRING_H && HAVE_STRINGS_H]: Include strings.h. * nrun.c [HAVE_UNISTD_H]: Include unistd.h. (main): If simulator_sysroot is not empty, chdir there. * sim-config.h (simulator_sysroot): Declare.
Diffstat (limited to 'sim/common/sim-options.c')
-rw-r--r--sim/common/sim-options.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
index 789ec2a..397652c 100644
--- a/sim/common/sim-options.c
+++ b/sim/common/sim-options.c
@@ -1,5 +1,5 @@
/* Simulator option handling.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 2004 Free Software Foundation, Inc.
Contributed by Cygnus Support.
This file is part of GDB, the GNU debugger.
@@ -115,6 +115,7 @@ typedef enum {
#endif
OPTION_LOAD_LMA,
OPTION_LOAD_VMA,
+ OPTION_SYSROOT
} STANDARD_OPTIONS;
static const OPTION standard_options[] =
@@ -205,6 +206,11 @@ static const OPTION standard_options[] =
'\0', NULL, "", standard_option_handler, "" },
#endif
+ { {"sysroot", required_argument, NULL, OPTION_SYSROOT},
+ '\0', "SYSROOT",
+ "Root for system calls with absolute file-names and cwd at start",
+ standard_option_handler },
+
{ {NULL, no_argument, NULL, 0}, '\0', NULL, NULL, NULL }
};
@@ -441,6 +447,14 @@ standard_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt,
exit (0);
/* FIXME: 'twould be nice to do something similar if gdb. */
break;
+
+ case OPTION_SYSROOT:
+ /* Don't leak memory in the odd event that there's lots of
+ --sysroot=... options. */
+ if (simulator_sysroot[0] != '\0' && arg[0] != '\0')
+ free (simulator_sysroot);
+ simulator_sysroot = xstrdup (arg);
+ break;
}
return SIM_RC_OK;