From 76420d4630b6d072ec8dba3add80c76adfe7bd08 Mon Sep 17 00:00:00 2001 From: Stu Grossman Date: Wed, 17 Jul 1996 06:41:25 +0000 Subject: * 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. --- gdb/command.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'gdb/command.c') diff --git a/gdb/command.c b/gdb/command.c index a5477dd..9afbf82 100644 --- a/gdb/command.c +++ b/gdb/command.c @@ -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: -- cgit v1.1