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: [MI non-stop 10/11] Skip varobj in running threads.


On Saturday 28 June 2008 18:00:06, Vladimir Prus wrote:

>
>  const char mi_no_values[] = "--no-values";
>  const char mi_simple_values[] = "--simple-values";
> @@ -610,8 +611,19 @@ mi_cmd_var_update (char *command, char **argv, int
> argc) cr = rootlist;
>        while (*cr != NULL)
>  	{
> -	  if (*name == '*' || varobj_floating_p (*cr))
> -	    varobj_update_one (*cr, print_values, 0 /* implicit */);
> +	  int thread_id = varobj_get_thread_id (*cr);
> +	  int thread_running = 0;
> +	  if (thread_id == 0 && is_executing (inferior_ptid))
> +	    thread_running = 1;
> +	  else if (thread_id > 0)
> +	    {
> +	      struct thread_info *tp = find_thread_id (thread_id);
> +	      if (tp)
> +		thread_running = is_running (tp->ptid);
> +	    }
> +	  if (!thread_running)
> +	    if (*name == '*' || varobj_floating_p (*cr))
> +	      varobj_update_one (*cr, print_values, 0 /* implicit */);

You should reverse the logic, and do the update if the thread is_stopped
instead of !is_running.  That is because there is now exited state
to care for as well, and is_running also returns false on those.  Essentially,
the is_STATE functions should not be tested with negation, if you're looking
for a particular state.

-- 
Pedro Alves


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