gdbserver: update the comment of 'current_process'

Message ID 20230425120948.2604327-1-tankut.baris.aktemur@intel.com
State New
Headers
Series gdbserver: update the comment of 'current_process' |

Commit Message

Tankut Baris Aktemur April 25, 2023, 12:09 p.m. UTC
  Since commit

  commit 7f8acedeebe295fc8cc1d11ed971cbfc1942618c
  Author: Pedro Alves <pedro@palves.net>
  Date:   Tue Apr 5 13:57:11 2022 +0100

    gdbserver: track current process as well as current thread

current process is tracked separately and may be non-null
while the current thread is null.  Update the comment of the
current_process function accordingly.
---
 gdbserver/inferiors.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Andrew Burgess April 25, 2023, 1:58 p.m. UTC | #1
Tankut Baris Aktemur via Gdb-patches <gdb-patches@sourceware.org>
writes:

> Since commit
>
>   commit 7f8acedeebe295fc8cc1d11ed971cbfc1942618c
>   Author: Pedro Alves <pedro@palves.net>
>   Date:   Tue Apr 5 13:57:11 2022 +0100
>
>     gdbserver: track current process as well as current thread
>
> current process is tracked separately and may be non-null
> while the current thread is null.  Update the comment of the
> current_process function accordingly.
> ---
>  gdbserver/inferiors.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/gdbserver/inferiors.h b/gdbserver/inferiors.h
> index a0ba9906097..9a41e66cb39 100644
> --- a/gdbserver/inferiors.h
> +++ b/gdbserver/inferiors.h
> @@ -92,9 +92,9 @@ pid_of (const process_info *proc)
>    return proc->pid;
>  }
>  
> -/* Return a pointer to the process that corresponds to the current
> -   thread (current_thread).  It is an error to call this if there is
> -   no current thread selected.  */
> +/* Return a pointer to the current process.  Note that the current
> +   process may be non-null while the current thread (current_thread)
> +   is null.  */

I'm wondering if the bit about "It is an error to call this if there is
no current thread selected." should be retained, or at least changed to
"It is an error to call this if there is no current process selected." -
and that the assert (removed in 7f8acedeebe295 should be added back.

I've asked Pedro about this:

  https://sourceware.org/pipermail/gdb-patches/2023-April/199097.html

Thanks,
Andrew

>  
>  struct process_info *current_process (void);
>  struct process_info *get_thread_process (const struct thread_info *);
> -- 
> 2.25.1
>
> Intel Deutschland GmbH
> Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
> Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
> Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
> Chairperson of the Supervisory Board: Nicole Lau
> Registered Office: Munich
> Commercial Register: Amtsgericht Muenchen HRB 186928
  
Terekhov, Mikhail via Gdb-patches April 26, 2023, 10:11 a.m. UTC | #2
On Tuesday, April 25, 2023 3:59 PM, Andrew Burgess wrote:
> Tankut Baris Aktemur via Gdb-patches <gdb-patches@sourceware.org>
> writes:
> 
> > Since commit
> >
> >   commit 7f8acedeebe295fc8cc1d11ed971cbfc1942618c
> >   Author: Pedro Alves <pedro@palves.net>
> >   Date:   Tue Apr 5 13:57:11 2022 +0100
> >
> >     gdbserver: track current process as well as current thread
> >
> > current process is tracked separately and may be non-null
> > while the current thread is null.  Update the comment of the
> > current_process function accordingly.
> > ---
> >  gdbserver/inferiors.h | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/gdbserver/inferiors.h b/gdbserver/inferiors.h
> > index a0ba9906097..9a41e66cb39 100644
> > --- a/gdbserver/inferiors.h
> > +++ b/gdbserver/inferiors.h
> > @@ -92,9 +92,9 @@ pid_of (const process_info *proc)
> >    return proc->pid;
> >  }
> >
> > -/* Return a pointer to the process that corresponds to the current
> > -   thread (current_thread).  It is an error to call this if there is
> > -   no current thread selected.  */
> > +/* Return a pointer to the current process.  Note that the current
> > +   process may be non-null while the current thread (current_thread)
> > +   is null.  */
> 
> I'm wondering if the bit about "It is an error to call this if there is
> no current thread selected." should be retained, or at least changed to
> "It is an error to call this if there is no current process selected." -
> and that the assert (removed in 7f8acedeebe295 should be added back.
> 
> I've asked Pedro about this:
> 
>   https://sourceware.org/pipermail/gdb-patches/2023-April/199097.html
> 
> Thanks,
> Andrew
 
Thanks for the feedback, Andrew.  I replied to the other thread to
continue the discussion there.

Regards
-Baris


Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
  

Patch

diff --git a/gdbserver/inferiors.h b/gdbserver/inferiors.h
index a0ba9906097..9a41e66cb39 100644
--- a/gdbserver/inferiors.h
+++ b/gdbserver/inferiors.h
@@ -92,9 +92,9 @@  pid_of (const process_info *proc)
   return proc->pid;
 }
 
-/* Return a pointer to the process that corresponds to the current
-   thread (current_thread).  It is an error to call this if there is
-   no current thread selected.  */
+/* Return a pointer to the current process.  Note that the current
+   process may be non-null while the current thread (current_thread)
+   is null.  */
 
 struct process_info *current_process (void);
 struct process_info *get_thread_process (const struct thread_info *);