This is the mail archive of the insight@sources.redhat.com mailing list for the Insight project.


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

[PATCH] varobj API update and gdbtk-varobj.c


Hi,

I notitced a fair amount of crashing going on when running the
c_variable.exp and cpp_variable.exp tests.

Turns out to be issues with varobj_update deleting variables. I've changed
varobj.c/h in gdb to accept a pointer to struct varobj*, so that when it
does delete our varobj, it also gives us a pointer to the newly allocated
one, too.

To avoid confusion, I have also removed the ClientData associated with
variable objects, since these are not used at all anymore.

Keith

ChangeLog
2001-08-17  Keith Seitz  <keiths@redhat.com>

	* generic/gdbtk-varobj.c (variable_obj_command): Pass pointer
	to varobj* when calling variable_update (API changed).
	(variable_create): Don't pass varobj* to install_variable. It's
	not used.
	(variable_children): Likewise.
	(variable_update): Change parameters to accept pointer to
	varobj*. Matches API change in varobj_update.
	(install_variable): Remove unused "var" parameter.

Patch
Index: generic/gdbtk-varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-varobj.c,v
retrieving revision 1.7
diff -u -p -r1.7 gdbtk-varobj.c
--- gdbtk-varobj.c	2001/05/10 18:04:23	1.7
+++ gdbtk-varobj.c	2001/08/17 19:02:44
@@ -61,11 +61,11 @@ static int variable_type (Tcl_Interp *,
 static int variable_value (Tcl_Interp *, int, Tcl_Obj * CONST[],
 			   struct varobj *);

-static Tcl_Obj *variable_update (Tcl_Interp * interp, struct varobj *var);
+static Tcl_Obj *variable_update (Tcl_Interp * interp, struct varobj **var);

 /* Helper functions for the above subcommands. */

-static void install_variable (Tcl_Interp *, char *, struct varobj *);
+static void install_variable (Tcl_Interp *, char *);

 static void uninstall_variable (Tcl_Interp *, char *);

@@ -278,7 +278,7 @@ variable_obj_command (clientData, interp
     case VARIABLE_UPDATE:
       /* Only root variables can be updated */
       {
-	Tcl_Obj *obj = variable_update (interp, var);
+	Tcl_Obj *obj = variable_update (interp, &var);
 	Tcl_SetObjResult (interp, obj);
       }
       break;
@@ -386,7 +386,7 @@ variable_create (interp, objc, objv)
     {
       /* Install a command into the interpreter that represents this
          object */
-      install_variable (interp, obj_name, var);
+      install_variable (interp, obj_name);
       Tcl_SetObjResult (interp, Tcl_NewStringObj (obj_name, -1));
       result_ptr->flags |= GDBTK_IN_TCL_RESULT;

@@ -444,7 +444,7 @@ variable_children (interp, var)
       /* Add child to result list and install the Tcl command for it. */
       Tcl_ListObjAppendElement (NULL, list,
 				Tcl_NewStringObj (childname, -1));
-      install_variable (interp, childname, *vc);
+      install_variable (interp, childname);
       vc++;
     }

@@ -458,7 +458,7 @@ variable_children (interp, var)
 static Tcl_Obj *
 variable_update (interp, var)
      Tcl_Interp *interp;
-     struct varobj *var;
+     struct varobj **var;
 {
   Tcl_Obj *changed;
   struct varobj **changelist;
@@ -625,13 +625,12 @@ variable_value (interp, objc, objv, var)
 /* Install the given variable VAR into the tcl interpreter with
    the object name NAME. */
 static void
-install_variable (interp, name, var)
+install_variable (interp, name)
      Tcl_Interp *interp;
      char *name;
-     struct varobj *var;
 {
   Tcl_CreateObjCommand (interp, name, variable_obj_command,
-			(ClientData) var, NULL);
+			NULL, NULL);
 }

 /* Unistall the object VAR in the tcl interpreter. */


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