Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@ericsson.com>
To: Thomas Schwinge <thomas@codesourcery.com>,
	Pedro Alves	<palves@redhat.com>, <gdb-patches@sourceware.org>
Cc: Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>, <bug-hurd@gnu.org>
Subject: Re: [PATCH v3 4/7] Per-inferior/Inferior-qualified thread IDs
Date: Wed, 07 Dec 2016 21:29:00 -0000	[thread overview]
Message-ID: <644b656a-7718-81be-f728-c867050f3879@ericsson.com> (raw)
In-Reply-To: <87d1h3jvjh.fsf@euler.schwinge.homeip.net>

On 16-12-07 04:09 PM, Thomas Schwinge wrote:
> commit 14f6890677849172a4b13779acd9089c9baa3a81
> Author: Thomas Schwinge <thomas@codesourcery.com>
> Date:   Tue May 24 19:36:57 2016 +0200
> 
>     Hurd: Adjust to "Per-inferior/Inferior-qualified thread IDs" changes
>     
>         [...]/gdb/gnu-nat.c: In function 'set_sig_thread_cmd':
>         [...]/gdb/gnu-nat.c:2973:7: warning: implicit declaration of function 'thread_id_to_pid' [-Wimplicit-function-declaration]
>                ptid_t ptid = thread_id_to_pid (atoi (args));
>                ^
>         [...]/gdb/gnu-nat.c:2973:7: error: invalid initializer
>     
>     That's commit 5d5658a1d3c3eb2a09c03f2f0662a1c01963c869, which renamed
>     `thread_id_to_pid` to `global_thread_id_to_ptid`.
>     
>             gdb/
>             * gnu-nat.c (set_sig_thread_cmd): Call global_thread_id_to_ptid
>             instead of thread_id_to_pid.
> ---
>  gdb/ChangeLog | 5 +++++
>  gdb/gnu-nat.c | 2 +-
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git gdb/ChangeLog gdb/ChangeLog
> index c251150..61d1205 100644
> --- gdb/ChangeLog
> +++ gdb/ChangeLog
> @@ -1,3 +1,8 @@
> +2016-12-07  Thomas Schwinge  <thomas@codesourcery.com>
> +
> +	* gnu-nat.c (set_sig_thread_cmd): Call global_thread_id_to_ptid
> +	instead of thread_id_to_pid.
> +
>  2016-12-06  Simon Marchi  <simon.marchi@ericsson.com>
>  
>  	* inferior.c (inferior_command): Remove duplicate
> diff --git gdb/gnu-nat.c gdb/gnu-nat.c
> index 927ee5c..92b9292 100644
> --- gdb/gnu-nat.c
> +++ gdb/gnu-nat.c
> @@ -2964,7 +2964,7 @@ set_sig_thread_cmd (char *args, int from_tty)
>      inf->signal_thread = 0;
>    else
>      {
> -      ptid_t ptid = thread_id_to_pid (atoi (args));
> +      ptid_t ptid = global_thread_id_to_ptid (atoi (args));

Hi Thomas,

I think your patch is better than the status quo, since it fixes the build.
However, global_thread_id_to_ptid expects global thread numbers, which are
nowadays only used in MI, never presented to the user in the CLI.  Since this
is a CLI command, it should accept the inferior-qualified format instead.

Something similar to this should do the trick (I can't test it though):

diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 927ee5c6f1..6b4385d9c3 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2964,13 +2964,13 @@ set_sig_thread_cmd (char *args, int from_tty)
     inf->signal_thread = 0;
   else
     {
-      ptid_t ptid = thread_id_to_pid (atoi (args));
+      struct thread_info *tp = parse_thread_id (args, NULL)

-      if (ptid_equal (ptid, minus_one_ptid))
+      if (tp == nullptr)
        error (_("Thread ID %s not known.  "
                 "Use the \"info threads\" command to\n"
               "see the IDs of currently known threads."), args);
-      inf->signal_thread = inf_tid_to_thread (inf, ptid_get_lwp (ptid));
+      inf->signal_thread = inf_tid_to_thread (inf, ptid_get_lwp (tp->ptid));
     }
 }

If there's a more efficient/concise way to go from a thread_info* to a proc*, we
should probably use it, but I couldn't find one.

Simon


  reply	other threads:[~2016-12-07 21:29 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-06 13:03 [PATCH v3 0/7] " Pedro Alves
2016-01-06 13:03 ` [PATCH v3 3/7] Centralize thread ID printing Pedro Alves
2016-01-06 18:57   ` Simon Marchi
2016-01-06 13:03 ` [PATCH v3 1/7] Add a new $_inferior convenience variable Pedro Alves
2016-01-06 18:56   ` Simon Marchi
2016-01-06 13:03 ` [PATCH v3 5/7] InferiorThread.global_num Pedro Alves
2016-01-06 19:03   ` Simon Marchi
2016-01-06 13:03 ` [PATCH v3 2/7] Add Python InferiorThread.inferior attribute Pedro Alves
2016-01-06 18:57   ` Simon Marchi
2016-01-06 13:04 ` [PATCH v3 4/7] Per-inferior/Inferior-qualified thread IDs Pedro Alves
2016-01-06 18:51   ` Simon Marchi
2016-01-07 19:45     ` Pedro Alves
2016-01-07 22:28       ` Simon Marchi
2016-01-07 23:37         ` Pedro Alves
2016-12-07 21:10           ` Thomas Schwinge
2016-12-07 21:29             ` Simon Marchi [this message]
2016-12-08  8:53               ` Thomas Schwinge
2016-01-07 22:02   ` Simon Marchi
2016-01-07 22:24     ` Pedro Alves
2016-01-06 13:11 ` [PATCH v3 6/7] Implement "info threads -gid" Pedro Alves
2016-01-06 19:12   ` Simon Marchi
2016-01-06 13:11 ` [PATCH v3 7/7] Add $_gthread convenience variable Pedro Alves
2016-01-06 19:14   ` Simon Marchi
2016-01-08 13:54 ` [PATCH v3 0/7] Per-inferior/Inferior-qualified thread IDs Yao Qi
2016-01-13 11:25   ` Pedro Alves

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=644b656a-7718-81be-f728-c867050f3879@ericsson.com \
    --to=simon.marchi@ericsson.com \
    --cc=bug-hurd@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=pierre.muller@ics-cnrs.unistra.fr \
    --cc=thomas@codesourcery.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