* command.c (do_setshow_command): Don't segfault when showing
authorStu Grossman <grossman@cygnus>
Wed, 17 Jul 1996 06:41:25 +0000 (06:41 +0000)
committerStu Grossman <grossman@cygnus>
Wed, 17 Jul 1996 06:41:25 +0000 (06:41 +0000)
var_string and var_string_noescape vars that are NULL.

From the fsf:
* solib.c (solib_absolute_prefix, solib_search_path): New variables.
(_initialize_solib): Add set/show commands for those variables.
(solib_map_sections): Implement searching using them.

gdb/ChangeLog
gdb/command.c
gdb/solib.c

index 3f744e97ae904e0a642470c273189a18ee9d5ab2..05f9e81dff3c3fa0d443204f115963e7713dc479 100644 (file)
@@ -1,3 +1,8 @@
+Tue Jul 16 23:37:25 1996  Stu Grossman  (grossman@critters.cygnus.com)
+
+       * command.c (do_setshow_command):  Don't segfault when showing
+       var_string and var_string_noescape vars that are NULL.
+
 Mon Jul 15 16:55:48 1996  Doug Evans  <dje@canuck.cygnus.com>
 
        * win32-nat.c (handle_load_dll): dos_path_to_unix_path renamed to
@@ -421,6 +426,12 @@ Tue May 28 11:14:58 1996  Tom Tromey  <tromey@creche.cygnus.com>
        * aclocal.m4 (CY_AC_PATH_TCLH): Don't use AC_TRY_RUN.
        (CY_AC_PATH_TKH): Don't use AC_TRY_RUN.
 
+Sun May 26 16:56:35 1996  Miles Bader  <miles@gnu.ai.mit.edu>
+
+       * solib.c (solib_absolute_prefix, solib_search_path): New variables.
+       (_initialize_solib): Add set/show commands for those variables.
+       (solib_map_sections): Implement searching using them.
+
 Sun May 26 14:14:49 1996  Fred Fish  <fnf@cygnus.com>
 
        Changes from: David Mosberger-Tang  <davidm@azstarnet.com>
index a5477ddd32739b9be9d42e859ad820b2f83b1235..9afbf82e59a5920c5b20c60f3f37a58f1e2563cf 100644 (file)
@@ -1273,9 +1273,11 @@ do_setshow_command (arg, from_tty, c)
       case var_string:
        {
          unsigned char *p;
+
          fputs_filtered ("\"", gdb_stdout);
-         for (p = *(unsigned char **) c->var; *p != '\0'; p++)
-           gdb_printchar (*p, gdb_stdout, '"');
+         if (*(unsigned char **)c->var)
+           for (p = *(unsigned char **) c->var; *p != '\0'; p++)
+             gdb_printchar (*p, gdb_stdout, '"');
          fputs_filtered ("\"", gdb_stdout);
        }
        break;
@@ -1283,7 +1285,8 @@ do_setshow_command (arg, from_tty, c)
       case var_filename:
       case var_enum:
        fputs_filtered ("\"", gdb_stdout);
-       fputs_filtered (*(char **) c->var, gdb_stdout);
+       if (*(char **)c->var)
+         fputs_filtered (*(char **) c->var, gdb_stdout);
        fputs_filtered ("\"", gdb_stdout);
        break;
       case var_boolean:
index 9e50c1666b44ceba1e9c9699580f6b13498e1c6c..b8fffd75d43c6cb0df037090974a566a52bac2fd 100644 (file)
@@ -198,6 +198,15 @@ solib_add_common_symbols PARAMS ((struct rtc_symb *));
 
 #endif
 
+/* If non-zero, this is a prefix that will be added to the front of the name
+   shared libraries with an absolute filename for loading.  */
+static char *solib_absolute_prefix = NULL;
+
+/* If non-empty, this is a search path for loading non-absolute shared library
+   symbol files.  This takes precedence over the environment variables PATH
+   and LD_LIBRARY_PATH.  */
+static char *solib_search_path = NULL;
+
 /*
 
 LOCAL FUNCTION
@@ -237,10 +246,38 @@ solib_map_sections (so)
   bfd *abfd;
   
   filename = tilde_expand (so -> so_name);
-  old_chain = make_cleanup (free, filename);
   
-  scratch_chan = openp (get_in_environ (inferior_environ, "PATH"), 
-                       1, filename, O_RDONLY, 0, &scratch_pathname);
+  if (solib_absolute_prefix && ROOTED_P (filename))
+    /* Prefix shared libraries with absolute filenames with
+       SOLIB_ABSOLUTE_PREFIX.  */
+    {
+      char *pfxed_fn;
+      int pfx_len;
+
+      pfx_len = strlen (solib_absolute_prefix);
+
+      /* Remove trailing slashes.  */
+      while (pfx_len > 0 && SLASH_P (solib_absolute_prefix[pfx_len - 1]))
+       pfx_len--;
+
+      pfxed_fn = xmalloc (pfx_len + strlen (filename) + 1);
+      strcpy (pfxed_fn, solib_absolute_prefix);
+      strcat (pfxed_fn, filename);
+      free (filename);
+
+      filename = pfxed_fn;
+    }
+
+  old_chain = make_cleanup (free, filename);
+
+  scratch_chan = -1;
+
+  if (solib_search_path)
+    scratch_chan = openp (solib_search_path,
+                         1, filename, O_RDONLY, 0, &scratch_pathname);
+  if (scratch_chan < 0)
+    scratch_chan = openp (get_in_environ (inferior_environ, "PATH"), 
+                         1, filename, O_RDONLY, 0, &scratch_pathname);
   if (scratch_chan < 0)
     {
       scratch_chan = openp (get_in_environ 
@@ -1707,5 +1744,20 @@ must be loaded manually, using `sharedlibrary'.",
                  &setlist),
      &showlist);
 
+  add_show_from_set
+    (add_set_cmd ("solib-absolute-prefix", class_support, var_filename,
+                 (char *) &solib_absolute_prefix,
+                 "Set prefix for loading absolute shared library symbol files.\n
+For other (relative) files, you can add values using `set solib-search-path'.",
+                 &setlist),
+     &showlist);
+  add_show_from_set
+    (add_set_cmd ("solib-search-path", class_support, var_string,
+                 (char *) &solib_search_path,
+                 "Set the search path for loading non-absolute shared library symbol files.\n
+This takes precedence over the environment variables PATH and LD_LIBRARY_PATH.",
+                 &setlist),
+     &showlist);
+
 #endif /* HAVE_LINK_H */
 }
This page took 0.027924 seconds and 4 git commands to generate.