* command.c (do_setshow_command): Don't segfault when showing

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.
This commit is contained in:
Stu Grossman 1996-07-17 06:41:25 +00:00
parent 647e52ea3a
commit 76420d4630
3 changed files with 72 additions and 6 deletions

View 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>

View 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:

View 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 */
}