* run.1: Document --sysroot=filepath.
[deliverable/binutils-gdb.git] / sim / common / sim-options.c
index 789ec2a6b326e3bf9fcd689ac33f2e8d3a3fa742..397652cf53d3449415d5361782d63240eef56faa 100644 (file)
@@ -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;
This page took 0.042325 seconds and 4 git commands to generate.