This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Remove redundant check of type==cmd_set


> Hello,
> 
> As far as I can tell this check is unnecessary.  Committed.

Famous last words, I've reverted it, added a comment and fixed a bug. 
Either something weird is going or many other set commands are broken :-/

Andrew

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.

Index: kod.c
===================================================================
RCS file: /cvs/src/src/gdb/kod.c,v
retrieving revision 1.6
diff -u -r1.6 kod.c
--- kod.c	2002/03/17 16:25:09	1.6
+++ kod.c	2002/03/17 19:25:19
@@ -132,6 +132,15 @@
 {
   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 @@
       delete_cmd (old_operating_system, &infolist);
       xfree (old_operating_system);
     }
-  old_operating_system = xstrdup (operating_system);
 
   if (! operating_system || ! *operating_system)
     {
@@ -156,6 +164,8 @@
   else
     {
       char *kodlib;
+
+      old_operating_system = xstrdup (operating_system);
 
       load_kod_library (operating_system);
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]