* kod.c (kod_set_os): Revert previous change. Is called by ``info
authorAndrew Cagney <cagney@redhat.com>
Sun, 17 Mar 2002 19:29:37 +0000 (19:29 +0000)
committerAndrew Cagney <cagney@redhat.com>
Sun, 17 Mar 2002 19:29:37 +0000 (19:29 +0000)
set'' and this leads to a core dump.  Move xstrdup of
operating_system to after check that it is not NULL.

gdb/ChangeLog
gdb/kod.c

index c5d649179a22add339467d70e0a1b009ab0c2dbf..5332ca337294bf91a7202248899a2c3212409696 100644 (file)
@@ -1,3 +1,9 @@
+2002-03-17  Andrew Cagney  <ac131313@redhat.com>
+
+       * kod.c (kod_set_os): Revert previous change.  Is called by ``info
+       set'' and this leads to a core dump.  Move xstrdup of
+       operating_system to after check that it is not NULL.
+
 2002-03-17  Andrew Cagney  <ac131313@redhat.com>
 
        * kod.c (kod_set_os): Remove unnecessary check that
index 68ce18c715a27449a0887f6b53581b4fcaadadac..8e8a716914d447305f1120beeb95cfa139e63286 100644 (file)
--- a/gdb/kod.c
+++ b/gdb/kod.c
@@ -132,6 +132,15 @@ kod_set_os (char *arg, int from_tty, struct cmd_list_element *command)
 {
   char *p;
 
+  /* NOTE: cagney/2002-03-17: This function gets called by the command
+     ``info set'' with COMMAND pointing to a show_cmd rather than a
+     set command.  This the test below is removed, a core dump results
+     (think about what happens when OPERATING_SYSTEM is NULL).  The
+     wiered thing is that all other ``set'' handlers don't need this
+     test.  */
+  if (command->type != set_cmd)
+    return;
+
   /* If we had already had an open OS, close it.  */
   if (gdb_kod_close)
     (*gdb_kod_close) ();
@@ -142,7 +151,6 @@ kod_set_os (char *arg, int from_tty, struct cmd_list_element *command)
       delete_cmd (old_operating_system, &infolist);
       xfree (old_operating_system);
     }
-  old_operating_system = xstrdup (operating_system);
 
   if (! operating_system || ! *operating_system)
     {
@@ -157,6 +165,8 @@ kod_set_os (char *arg, int from_tty, struct cmd_list_element *command)
     {
       char *kodlib;
 
+      old_operating_system = xstrdup (operating_system);
+
       load_kod_library (operating_system);
 
       kodlib = (*gdb_kod_open) (gdb_kod_display, gdb_kod_query);
This page took 0.033107 seconds and 4 git commands to generate.