aboutsummaryrefslogtreecommitdiff
path: root/gdb/thread.c
diff options
context:
space:
mode:
authorVladimir Prus <vladimir@codesourcery.com>2010-01-12 21:40:25 +0000
committerVladimir Prus <vladimir@codesourcery.com>2010-01-12 21:40:25 +0000
commitdc146f7c09d1369f5621e4aac23d410d40d3a6f0 (patch)
tree801e78e7bbd124f1c503f26bf1173741e224cb33 /gdb/thread.c
parent837504c42dbf7cb67ee328fb0bdf594b70c90209 (diff)
downloadfsf-binutils-gdb-dc146f7c09d1369f5621e4aac23d410d40d3a6f0.zip
fsf-binutils-gdb-dc146f7c09d1369f5621e4aac23d410d40d3a6f0.tar.gz
fsf-binutils-gdb-dc146f7c09d1369f5621e4aac23d410d40d3a6f0.tar.bz2
Implement core awareness.
* bcache.c (compare_ints): Remove (print_percentage): Use compare_positive_ints. * defs.h (compare_positive_ints): Declare. * linux-nat.h (struct lin_lwp): New field core. (linux_nat_core_of_thread_1): Declare. * linux-nat.c (add_lwp): Init the 'core' field. (linux_nat_wait_1): Record the core. (linux_nat_core_of_thread_1, linux_nat_core_of_thread): New. (linux_nat_add_target): Register the above. * linux-thread-db.c (update_thread_core): New. (thread_db_find_new_threads): Update core information for every thread. * remote.c (struct private_thread_info): New. (free_private_thread_info, demand_private_info): New. (PACKET_qXfer_threads, use_osdata_threads): New. (struct thread_item, threads_parsing_context (start_thread, end_thread, thread_attributes) (thread_children, threads_children, threads_elements): New. (remote_threads_info): Try qXfer:threads before anything else. (remote_protocol_packets): Register qXfer:threads. (remote_open_1): Init use_osdata_threads. (struct stop_reply): New field 'core'. (remote_parse_stop_reply): Parse core number. (process_stop_reply): Record core number. (remote_xfer_partial): Handle qXfer:threads. (remote_core_of_thread): New. (init_remote_ops): Register remote_core_of_thread. (_initialize_remote): Register qXfer:read. * target.c (target_core_of_thread): New * target.h (enum target_object): New value TARGET_OBJECT_THREADS. (struct target_ops): New field to_core_of_threads. (target_core_of_thread): Declare. * gdbthread.h (struct thread_info): New field private_dtor. * thread.c (print_thread_info): Report the core. * ui-out.c (MAX_UI_OUT_LEVELS): Increase. * utils.c (compare_positive_ints): New. * features/threads.dtd: New. * mi/mi-interp.c (mi_on_normal_stop): Report the core. * mi/mi-main.c (struct collect_cores_data, collect_cores) (do_nothing, free_vector_of_osdata_items) (splay_tree_int_comparator, free_splay_tree): New. (print_one_inferior_data): Implemented printing of selected inferiors. Collect and print cores. (output_cores): New. (mi_cmd_list_thread_groups): Support --recurse. Permit specifying thread groups together with --available.
Diffstat (limited to 'gdb/thread.c')
-rw-r--r--gdb/thread.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/gdb/thread.c b/gdb/thread.c
index 80c3786..16a207c 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -114,10 +114,13 @@ free_thread (struct thread_info *tp)
{
clear_thread_inferior_resources (tp);
- /* FIXME: do I ever need to call the back-end to give it a
- chance at this private data before deleting the thread? */
if (tp->private)
- xfree (tp->private);
+ {
+ if (tp->private_dtor)
+ tp->private_dtor (tp->private);
+ else
+ xfree (tp->private);
+ }
xfree (tp);
}
@@ -468,8 +471,7 @@ do_captured_list_thread_ids (struct ui_out *uiout, void *arg)
struct cleanup *cleanup_chain;
int current_thread = -1;
- prune_threads ();
- target_find_new_threads ();
+ update_thread_list ();
cleanup_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "thread-ids");
@@ -748,8 +750,7 @@ print_thread_info (struct ui_out *uiout, int requested_thread, int pid)
char *extra_info;
int current_thread = -1;
- prune_threads ();
- target_find_new_threads ();
+ update_thread_list ();
current_ptid = inferior_ptid;
/* We'll be switching threads temporarily. */
@@ -759,6 +760,7 @@ print_thread_info (struct ui_out *uiout, int requested_thread, int pid)
for (tp = thread_list; tp; tp = tp->next)
{
struct cleanup *chain2;
+ int core;
if (requested_thread != -1 && tp->num != requested_thread)
continue;
@@ -817,6 +819,10 @@ print_thread_info (struct ui_out *uiout, int requested_thread, int pid)
ui_out_field_string (uiout, "state", state);
}
+ core = target_core_of_thread (tp->ptid);
+ if (ui_out_is_mi_like_p (uiout) && core != -1)
+ ui_out_field_int (uiout, "core", core);
+
do_cleanups (chain2);
}
@@ -1058,8 +1064,7 @@ thread_apply_all_command (char *cmd, int from_tty)
if (cmd == NULL || *cmd == '\000')
error (_("Please specify a command following the thread ID list"));
- prune_threads ();
- target_find_new_threads ();
+ update_thread_list ();
old_chain = make_cleanup_restore_current_thread ();
@@ -1245,6 +1250,13 @@ gdb_thread_select (struct ui_out *uiout, char *tidstr, char **error_message)
return GDB_RC_OK;
}
+void
+update_thread_list (void)
+{
+ prune_threads ();
+ target_find_new_threads ();
+}
+
/* Commands with a prefix of `thread'. */
struct cmd_list_element *thread_cmd_list = NULL;