This is the mail archive of the gdb-patches@sourceware.org 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: RFC: MI - Detecting change of string contents with variable objects


On Thu, Jan 04, 2007 at 07:10:25PM +1300, Nick Roberts wrote:
> + 	      char* print_value = value_get_print_value (value, var->format);

Use "char *print_value", please.

>   	      gdb_assert (!value_lazy (var->value));
>   	      
> ! 	      if (var->print_value)
> ! 		{
> ! 		  if (strcmp (var->print_value, print_value))
> ! 		    {
> ! 		      xfree (var->print_value);
> ! 		      var->print_value = print_value;
> ! 		      changed = 1;
> ! 		    }
> ! 		}
> ! 	      else
> ! 		var->print_value = print_value;

Should we set changed = 1 in the "else"?

Otherwise the patch seems fine, if it tests OK, but I'm still a little
nervous about it.  For example, you'll call val_print on a struct
or array to see if it's changed.  Depending on things like "set print
elements", that might not print out the whole string.  This is
probably a behavior change.  Is it a harmless one?  If it is, then
should we be sharing the code with c_value_of_variable that avoids
printing structs, unions, and arrays, and never mark them as changed
unless their types change?

-- 
Daniel Jacobowitz
CodeSourcery


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