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: [RFA] Give thread names in thread events, give Ada task names in more output.


On Wed, 2019-06-05 at 10:02 +0100, Pedro Alves wrote:
> On 5/18/19 7:23 PM, Philippe Waroquiers wrote:
> > With this patch, we e.g. get:
> >   [New Thread 0x7ffff701b700 (LWP 13891) "sleepers"]
> >   [Switching to thread 2 (Thread 0x7ffff781c700 (LWP 13890) "sleepers")]
> > instead of:
> >   [New Thread 0x7ffff701b700 (LWP 13918)]
> >   [Switching to thread 2 (Thread 0x7ffff781c700 (LWP 13917))]
> > 
> > For Ada tasks, we e.g. get:
> >   [Switching to task 2 task_list(1)]
> >   [Current task is 2 task_list(1)]
> > instead of
> >   [Switching to task 2]
> >   [Current task is 2]
> 
> BTW, if you're looking at improving this, take a look what I was
> proposing here:
> 
>   https://sourceware.org/ml/gdb-patches/2019-04/msg00448.html
> 
>  (gdb) r
>  Starting program: build/gdb/testsuite/outputs/gdb.threads/schedlock/schedlock 
>  [Thread debugging using libthread_db enabled]
>  Using host libthread_db library "/lib64/libthread_db.so.1".
>  [Thread 1.2 (0x7ffff74b8700 (LWP 13984) "sleepers") appeared]
>  [Thread 1.2 (0x7ffff74b8700 (LWP 13984) "sleepers") exited]
>  [Inferior 1 (process 13980) exited normally]
>  (gdb)
> 
> Specifically, I think it'd be quite useful to show the thread's
> gdb number.  I'd say that is more useful than the thread name, even,
> because you can use "info threads" to find the name from the unique
> gdb id, but converse isn't so easy.
> 
> > @@ -986,10 +986,9 @@ should_print_thread (const char *requested_threads, int default_inf_num,
> >    return 1;
> >  }
> >  
> > -/* Return the string to display in "info threads"'s "Target Id"
> > -   column, for TP.  */
> > +/* See gdbthread.h.  */
> >  
> > -static std::string
> > +std::string
> >  thread_target_id_str (thread_info *tp)
> >  {
> 
> The commit's description talks about thread names, but
> note that thread_target_id_str prints more than the name -- it also
> prints the thread's extra info.

Pedro and Tom,
Thanks for the feedback and suggestions.
I will see how to go on with this.
Maybe the best is to do this in 3 different patches:
   * a patch adding the Ada task name where relevant
   * a patch adding in the thread events the thread name
     and the other things suggested by Pedro
   * a third patch that replaces (where relevant) target_pid_to_str
     by something like target_pid_to_thr_id_str

Philippe

   


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