Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Tom Tromey <tromey@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Minor Ada task cleanups
Date: Sun, 17 Feb 2019 14:57:00 -0000	[thread overview]
Message-ID: <20190217145708.GC8537@adacore.com> (raw)
In-Reply-To: <20190215212253.25409-1-tromey@adacore.com>

Hi Tom,

On Fri, Feb 15, 2019 at 02:22:53PM -0700, Tom Tromey wrote:
> While working on the Ada task code, I noticed a few things that could
> be cleaned up:
> 
> * task_list_valid_p was not set in all cases in ada_build_task_list.
>   This causes many needless re-fetches of the task list.
> 
> * task_list_valid_p can be bool, and various functions can also return
>   bool.
> 
> * Nothing checks the return value of read_known_tasks, so it can be
>   changed to return void.
> 
> * The call to ada_build_task_list in
>   ravenscar_thread_target::update_thread_list is redundant, because
>   this is the first thing done by iterate_over_live_ada_tasks.
> 
> Tested using the internal AdaCore test suite against a ravenscar
> target.

Thanks for doing this. Nice cleanup :).

One question independent of this patch first: I am wondering - how
do you deal with submissions that you want to "git am" but have
a ChangeLog patch in it that cause a merge failure? I've needed to
apply your patch a few times, and the only option I knew was to
remove the hungs for the ChangeLog files.

> gdb/ChangeLog
> 2019-02-15  Tom Tromey  <tromey@adacore.com>
> 
> 	* ravenscar-thread.c
> 	(ravenscar_thread_target::update_thread_list): Don't call
> 	ada_build_task_list.
> 	* ada-lang.h (ada_build_task_list): Don't declare.
> 	* ada-tasks.c (struct ada_tasks_inferior_data)
> 	<task_list_valid_p>: Now bool.
> 	(read_known_tasks, ada_task_list_changed)
> 	(ada_tasks_invalidate_inferior_data): Update.
> 	(read_known_tasks_array): Return bool.
> 	(read_known_tasks_list): Likewise.
> 	(read_known_tasks): Return void.
> 	(ada_build_task_list): Now static.

Since this code is used on all platforms and native platforms
in particular have a lot more testcases that exercise this code,
it would be nice to exercise it both with the build-bot and
AdaCore's testsuite.

One minor nit below.

Other than that, the patch looks good to me; if the patch with
the change I suggested passes testing, it's OK to push.

Thank you!


> +static void
> +read_known_tasks ()
>  {
>    struct ada_tasks_inferior_data *data =
>      get_ada_tasks_inferior_data (current_inferior ());
> @@ -965,29 +966,30 @@ read_known_tasks (void)
>    ada_tasks_inferior_data_sniffer (data);
>    gdb_assert (data->known_tasks_kind != ADA_TASKS_UNKNOWN);
>  
> +  /* Step 3: Set task_list_valid_p, to avoid re-reading the Known_Tasks
> +     array unless needed.  */
>    switch (data->known_tasks_kind)
>      {
> -      case ADA_TASKS_NOT_FOUND: /* Tasking not in use in inferior.  */
> -        return 0;
> -      case ADA_TASKS_ARRAY:
> -        return read_known_tasks_array (data);
> -      case ADA_TASKS_LIST:
> -        return read_known_tasks_list (data);
> +    case ADA_TASKS_NOT_FOUND: /* Tasking not in use in inferior.  */
> +      break;
> +    case ADA_TASKS_ARRAY:
> +      data->task_list_valid_p = read_known_tasks_array (data);
> +      break;
> +    case ADA_TASKS_LIST:
> +      data->task_list_valid_p = read_known_tasks_list (data);
> +      break;
> +    case ADA_TASKS_UNKNOWN:
> +      data->task_list_valid_p = true;
> +      break;

The last case is unnecessary, as we have just asserted above
that data->known_tasks_kind != ADA_TASKS_UNKNOWN.

-- 
Joel


  reply	other threads:[~2019-02-17 14:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-15 21:23 Tom Tromey
2019-02-17 14:57 ` Joel Brobecker [this message]
2019-02-19 13:13   ` Tom Tromey
2019-02-19 19:25   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190217145708.GC8537@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox