[PATCH] gdb bug 12417

Yao Qi yao@codesourcery.com
Wed Sep 19 13:22:00 GMT 2012


On 09/19/2012 06:59 PM, Mohsan Saleem wrote:
> --- /root/Desktop/gdb/thread.c	2012-09-03 00:53:02.620254912 -0700
> +++ ./gdb/thread.c	2012-09-03 00:58:04.399469614 -0700
> @@ -243,12 +243,14 @@
>   struct thread_info *
>   add_thread_with_info (ptid_t ptid, struct private_thread_info *private)
>   {
> +  char *name;
>     struct thread_info *result = add_thread_silent (ptid);
>
> +  name = result->name ? result->name : target_thread_name (result);

This pattern is used five times in your patch, and why don't we move it 
to a function? like,

const char *
thread_info_name (struct thread_info *ti)
{
   return ti->name ? ti->name : target_thread_name (ti);
}

and call this function when needed.

-- 
Yao



More information about the Gdb-patches mailing list