public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug threads/12417] New: print thread name in more places
@ 2011-01-19 17:23 tromey at redhat dot com
  2012-09-17 16:02 ` [Bug threads/12417] " mohsansaleem_ms at yahoo dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: tromey at redhat dot com @ 2011-01-19 17:23 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12417

           Summary: print thread name in more places
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: threads
        AssignedTo: unassigned@sourceware.org
        ReportedBy: tromey@redhat.com


There are various places in gdb that print information
about a thread.  Right now only "info threads" shows
the thread's name.  It would be nice if all messages were
updated to show the thread name.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug threads/12417] print thread name in more places
  2011-01-19 17:23 [Bug threads/12417] New: print thread name in more places tromey at redhat dot com
@ 2012-09-17 16:02 ` mohsansaleem_ms at yahoo dot com
  2012-09-20  8:13 ` mohsansaleem_ms at yahoo dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mohsansaleem_ms at yahoo dot com @ 2012-09-17 16:02 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12417

--- Comment #1 from Mohsan Saleem <mohsansaleem_ms at yahoo dot com> 2012-09-17 16:02:31 UTC ---
Created attachment 6636
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6636
this patch contained the change that will print threads name with their
information.

please do inform me if it is working or not . . .

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug threads/12417] print thread name in more places
  2011-01-19 17:23 [Bug threads/12417] New: print thread name in more places tromey at redhat dot com
  2012-09-17 16:02 ` [Bug threads/12417] " mohsansaleem_ms at yahoo dot com
@ 2012-09-20  8:13 ` mohsansaleem_ms at yahoo dot com
  2012-09-25 15:24 ` mohsansaleem_ms at yahoo dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mohsansaleem_ms at yahoo dot com @ 2012-09-20  8:13 UTC (permalink / raw)
  To: gdb-prs


http://sourceware.org/bugzilla/show_bug.cgi?id=12417

Mohsan Saleem <mohsansaleem_ms at yahoo dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mohsansaleem_ms at yahoo
                   |                            |dot com
         AssignedTo|unassigned at sourceware    |mohsansaleem_ms at yahoo
                   |dot org                     |dot com

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug threads/12417] print thread name in more places
  2011-01-19 17:23 [Bug threads/12417] New: print thread name in more places tromey at redhat dot com
  2012-09-17 16:02 ` [Bug threads/12417] " mohsansaleem_ms at yahoo dot com
  2012-09-20  8:13 ` mohsansaleem_ms at yahoo dot com
@ 2012-09-25 15:24 ` mohsansaleem_ms at yahoo dot com
  2013-08-28 14:19 ` msaleem at codesourcery dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mohsansaleem_ms at yahoo dot com @ 2012-09-25 15:24 UTC (permalink / raw)
  To: gdb-prs


http://sourceware.org/bugzilla/show_bug.cgi?id=12417

--- Comment #2 from Mohsan Saleem <mohsansaleem_ms at yahoo dot com> 2012-09-25 15:24:39 UTC ---
Comment on attachment 6636
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6636
this patch contained the change that will print threads name with their
information.

diff -ruN ./gdb_old/ChangeLog ./gdb_new/ChangeLog
--- ./gdb_old/ChangeLog    2012-09-24 13:17:34.000000000 +0500
+++ ./gdb_new/ChangeLog    2012-09-25 12:45:57.634707360 +0500
@@ -1,3 +1,13 @@
+2012-09-25  Mohsan Saleem  <mohsansaleem_ms@yahoo.com>
+
+    PR threads/12417
+    * thread.c (thread_name): New function.
+    (add_thread_with_info): Update to print thread name.
+    (thread_apply_all_command): Likewise.
+    (thread_apply_command): Likewise.
+    (thread_find_command): Likewise.
+    (do_captured_thread_select): Likewise.
+
 2012-09-21  Steve Ellcey  <sellcey@mips.com>

     * configure.ac: Add mips*-mti-elf* target.
diff -ruN ./gdb_old/gdb/testsuite/gdb.threads/thread-find.exp
./gdb_new/gdb/testsuite/gdb.threads/thread-find.exp
--- ./gdb_old/gdb/testsuite/gdb.threads/thread-find.exp    2012-09-24
13:17:38.000000000 +0500
+++ ./gdb_new/gdb/testsuite/gdb.threads/thread-find.exp    2012-09-25
19:57:28.917335588 +0500
@@ -186,17 +186,17 @@

 if { [info exists thread6] } then {
     gdb_test "thread find $thread6" \
-    "Thread 6 has .*$thread6.*" "find thread id 6"
+    "Thread 6 \"threadname_6\" has .*$thread6.*" "find thread id 6"
     gdb_test "thread find $thread5" \
-    "Thread 5 has .*$thread5.*" "find thread id 5"
+    "Thread 5 \"threadname_5\" has .*$thread5.*" "find thread id 5"
     gdb_test "thread find $thread4" \
-    "Thread 4 has .*$thread4.*" "find thread id 4"
+    "Thread 4 \"threadname_4\" has .*$thread4.*" "find thread id 4"
     gdb_test "thread find $thread3" \
-    "Thread 3 has .*$thread3.*" "find thread id 3"
+    "Thread 3 \"threadname_3\" has .*$thread3.*" "find thread id 3"
     gdb_test "thread find $thread2" \
-    "Thread 2 has .*$thread2.*" "find thread id 2"
+    "Thread 2 \"threadname_2\" has .*$thread2.*" "find thread id 2"
     gdb_test "thread find $thread1" \
-    "Thread 1 has .*$thread1.*" "find thread id 1"
+    "Thread 1 \"threadname_1\" has .*$thread1.*" "find thread id 1"
 }

 #
@@ -224,17 +224,17 @@

 if { [info exists lwp6] } then {
     gdb_test "thread find $lwp6" \
-    "Thread 6 has .*$lwp6.*" "find lwp id 6"
+    "Thread 6 \"threadname_6\" has .*$lwp6.*" "find lwp id 6"
     gdb_test "thread find $lwp5" \
-    "Thread 5 has .*$lwp5.*" "find lwp id 5"
+    "Thread 5 \"threadname_5\" has .*$lwp5.*" "find lwp id 5"
     gdb_test "thread find $lwp4" \
-    "Thread 4 has .*$lwp4.*" "find lwp id 4"
+    "Thread 4 \"threadname_4\" has .*$lwp4.*" "find lwp id 4"
     gdb_test "thread find $lwp3" \
-    "Thread 3 has .*$lwp3.*" "find lwp id 3"
+    "Thread 3 \"threadname_3\" has .*$lwp3.*" "find lwp id 3"
     gdb_test "thread find $lwp2" \
-    "Thread 2 has .*$lwp2.*" "find lwp id 2"
+    "Thread 2 \"threadname_2\" has .*$lwp2.*" "find lwp id 2"
     gdb_test "thread find $lwp1" \
-    "Thread 1 has .*$lwp1.*" "find lwp id 1"
+    "Thread 1 \"threadname_1\" has .*$lwp1.*" "find lwp id 1"
 }

 # Test no match.
diff -ruN ./gdb_old/gdb/thread.c ./gdb_new/gdb/thread.c
--- ./gdb_old/gdb/thread.c    2012-09-24 13:17:37.000000000 +0500
+++ ./gdb_new/gdb/thread.c    2012-09-25 19:52:58.801349899 +0500
@@ -64,6 +64,7 @@
 static void thread_apply_command (char *, int);
 static void restore_current_thread (ptid_t);
 static void prune_threads (void);
+static const char *thread_name (struct thread_info *);

 struct thread_info*
 inferior_thread (void)
@@ -73,6 +74,14 @@
   return tp;
 }

+const char *
+thread_name (struct thread_info *ti)
+{
+  const char *name;
+  name = ti->name != NULL ? ti->name : target_thread_name (ti);
+  return name != NULL ? name : "";
+}
+
 void
 delete_step_resume_breakpoint (struct thread_info *tp)
 {
@@ -236,7 +245,7 @@
   result->private = private;

   if (print_thread_events)
-    printf_unfiltered (_("[New %s]\n"), target_pid_to_str (ptid));
+    printf_unfiltered (_("[New %s \"%s\"\n"), target_pid_to_str (ptid),
thread_name (result));

   annotate_new_thread ();
   return result;
@@ -1198,8 +1207,8 @@
       {
     switch_to_thread (tp->ptid);

-    printf_filtered (_("\nThread %d (%s):\n"),
-             tp->num, target_pid_to_str (inferior_ptid));
+    printf_filtered (_("\nThread %d \"%s\" (%s):\n"), tp->num,
+             thread_name (tp), target_pid_to_str (inferior_ptid));
     execute_command (cmd, from_tty);
     strcpy (cmd, saved_cmd);    /* Restore exact command used
                        previously.  */
@@ -1250,7 +1259,7 @@
     {
       switch_to_thread (tp->ptid);

-      printf_filtered (_("\nThread %d (%s):\n"), tp->num,
+      printf_filtered (_("\nThread %d \"%s\" (%s):\n"), tp->num, thread_name
(tp),
                target_pid_to_str (inferior_ptid));
       execute_command (cmd, from_tty);

@@ -1347,16 +1356,16 @@
       tmp = target_pid_to_str (tp->ptid);
       if (tmp != NULL && re_exec (tmp))
     {
-      printf_filtered (_("Thread %d has target id '%s'\n"),
-               tp->num, tmp);
+      printf_filtered (_("Thread %d \"%s\" has target id '%s'\n"),
+               tp->num, thread_name (tp), tmp);
       match++;
     }

       tmp = target_extra_thread_info (tp);
       if (tmp != NULL && re_exec (tmp))
     {
-      printf_filtered (_("Thread %d has extra info '%s'\n"),
-               tp->num, tmp);
+      printf_filtered (_("Thread %d \"%s\" has extra info '%s'\n"),
+               tp->num, thread_name (tp), tmp);
       match++;
     }
     }
@@ -1397,7 +1406,9 @@

   ui_out_text (uiout, "[Switching to thread ");
   ui_out_field_int (uiout, "new-thread-id", pid_to_thread_id (inferior_ptid));
-  ui_out_text (uiout, " (");
+  ui_out_text (uiout, " \"");
+  ui_out_text (uiout, thread_name (tp));
+  ui_out_text (uiout, "\" (");
   ui_out_text (uiout, target_pid_to_str (inferior_ptid));
   ui_out_text (uiout, ")]");

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug threads/12417] print thread name in more places
  2011-01-19 17:23 [Bug threads/12417] New: print thread name in more places tromey at redhat dot com
                   ` (2 preceding siblings ...)
  2012-09-25 15:24 ` mohsansaleem_ms at yahoo dot com
@ 2013-08-28 14:19 ` msaleem at codesourcery dot com
  2013-09-17  4:22 ` mohsansaleem_ms at yahoo dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: msaleem at codesourcery dot com @ 2013-08-28 14:19 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=12417

Mohsan Saleem <msaleem at codesourcery dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msaleem at codesourcery dot com
           Assignee|mohsansaleem_ms at yahoo dot com   |msaleem at codesourcery dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug threads/12417] print thread name in more places
  2011-01-19 17:23 [Bug threads/12417] New: print thread name in more places tromey at redhat dot com
                   ` (3 preceding siblings ...)
  2013-08-28 14:19 ` msaleem at codesourcery dot com
@ 2013-09-17  4:22 ` mohsansaleem_ms at yahoo dot com
  2014-02-12 19:04 ` tromey at redhat dot com
  2014-02-12 19:10 ` tromey at redhat dot com
  6 siblings, 0 replies; 8+ messages in thread
From: mohsansaleem_ms at yahoo dot com @ 2013-09-17  4:22 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=12417

Mohsan Saleem <mohsansaleem_ms at yahoo dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|msaleem at codesourcery dot com    |mohsansaleem_ms at yahoo dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug threads/12417] print thread name in more places
  2011-01-19 17:23 [Bug threads/12417] New: print thread name in more places tromey at redhat dot com
                   ` (4 preceding siblings ...)
  2013-09-17  4:22 ` mohsansaleem_ms at yahoo dot com
@ 2014-02-12 19:04 ` tromey at redhat dot com
  2014-02-12 19:10 ` tromey at redhat dot com
  6 siblings, 0 replies; 8+ messages in thread
From: tromey at redhat dot com @ 2014-02-12 19:04 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=12417

--- Comment #3 from Tom Tromey <tromey at redhat dot com> ---
What is the status of this patch?
If it is still relevant, could you submit it to the patch
list following the usual procedure?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug threads/12417] print thread name in more places
  2011-01-19 17:23 [Bug threads/12417] New: print thread name in more places tromey at redhat dot com
                   ` (5 preceding siblings ...)
  2014-02-12 19:04 ` tromey at redhat dot com
@ 2014-02-12 19:10 ` tromey at redhat dot com
  6 siblings, 0 replies; 8+ messages in thread
From: tromey at redhat dot com @ 2014-02-12 19:10 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=12417

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gziemski at mac dot com

--- Comment #4 from Tom Tromey <tromey at redhat dot com> ---
*** Bug 16568 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-02-12 19:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-19 17:23 [Bug threads/12417] New: print thread name in more places tromey at redhat dot com
2012-09-17 16:02 ` [Bug threads/12417] " mohsansaleem_ms at yahoo dot com
2012-09-20  8:13 ` mohsansaleem_ms at yahoo dot com
2012-09-25 15:24 ` mohsansaleem_ms at yahoo dot com
2013-08-28 14:19 ` msaleem at codesourcery dot com
2013-09-17  4:22 ` mohsansaleem_ms at yahoo dot com
2014-02-12 19:04 ` tromey at redhat dot com
2014-02-12 19:10 ` tromey at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).