aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2011-01-19 17:21:39 +0000
committerTom Tromey <tromey@redhat.com>2011-01-19 17:21:39 +0000
commit4694da01479181361c847bb9185c458e1ec51c46 (patch)
tree01db52325361b0cb5b25bb982a0e11829331aeb1 /gdb/target.c
parent6ac88ef38d4da039b342dff4c457044f924bfc8a (diff)
downloadgdb-4694da01479181361c847bb9185c458e1ec51c46.zip
gdb-4694da01479181361c847bb9185c458e1ec51c46.tar.gz
gdb-4694da01479181361c847bb9185c458e1ec51c46.tar.bz2
gdb
PR mi/8618: * thread.c (free_thread): Free 'name'. (print_thread_info): Emit thread name. Change CLI output. (thread_name_command): New function. (do_captured_thread_select): Emit newline. (_initialize_thread): Register 'thread name' command. * target.h (struct target_ops) <to_thread_name>: New field. (target_thread_name): New macro. * target.c (update_current_target): Handle to_thread_name. * python/py-infthread.c (thpy_get_name): New function. (thpy_set_name): Likewise. (thread_object_getset): Add "name". * linux-nat.c (linux_nat_thread_name): New function. (linux_nat_add_target): Set to_thread_name. * gdbthread.h (struct thread_info) <name>: New field. gdb/doc * gdb.texinfo (Threads): Document thread name output and `thread name' command. (Threads In Python): Document Thread.name attribute. (GDB/MI Thread Commands): Document thread attributes. gdb/testsuite * gdb.python/py-infthread.exp: Add thread tests.
Diffstat (limited to 'gdb/target.c')
-rw-r--r--gdb/target.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/target.c b/gdb/target.c
index 32da4dd..710af02 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -634,6 +634,7 @@ update_current_target (void)
/* Do not inherit to_find_new_threads. */
/* Do not inherit to_pid_to_str. */
INHERIT (to_extra_thread_info, t);
+ INHERIT (to_thread_name, t);
INHERIT (to_stop, t);
/* Do not inherit to_xfer_partial. */
INHERIT (to_rcmd, t);
@@ -804,6 +805,9 @@ update_current_target (void)
de_fault (to_extra_thread_info,
(char *(*) (struct thread_info *))
return_zero);
+ de_fault (to_thread_name,
+ (char *(*) (struct thread_info *))
+ return_zero);
de_fault (to_stop,
(void (*) (ptid_t))
target_ignore);
@@ -2407,6 +2411,20 @@ target_pid_to_str (ptid_t ptid)
return normal_pid_to_str (ptid);
}
+char *
+target_thread_name (struct thread_info *info)
+{
+ struct target_ops *t;
+
+ for (t = current_target.beneath; t != NULL; t = t->beneath)
+ {
+ if (t->to_thread_name != NULL)
+ return (*t->to_thread_name) (info);
+ }
+
+ return NULL;
+}
+
void
target_resume (ptid_t ptid, int step, enum target_signal signal)
{