gas: blackfin: handle multibyte symbols
[deliverable/binutils-gdb.git] / gdb / thread.c
index 16a207c5119baf70d5b7f2baccff0ddcbd1ce1aa..0b291bae972575811272f0ad9275d123f847c8ac 100644 (file)
@@ -187,11 +187,11 @@ add_thread_silent (ptid_t ptid)
 
       if (ptid_equal (inferior_ptid, ptid))
        {
-         tp = new_thread (ptid);
+         tp = new_thread (null_ptid);
 
          /* Make switch_to_thread not read from the thread.  */
          tp->state_ = THREAD_EXITED;
-         switch_to_thread (minus_one_ptid);
+         switch_to_thread (null_ptid);
 
          /* Now we can delete it.  */
          delete_thread (ptid);
@@ -397,6 +397,7 @@ ptid_t
 thread_id_to_pid (int num)
 {
   struct thread_info *thread = find_thread_id (num);
+
   if (thread)
     return thread->ptid;
   else
@@ -560,6 +561,7 @@ set_running (ptid_t ptid, int running)
   if (all || ptid_is_pid (ptid))
     {
       int any_started = 0;
+
       for (tp = thread_list; tp; tp = tp->next)
        if (all || ptid_get_pid (tp->ptid) == ptid_get_pid (ptid))
          {
@@ -575,6 +577,7 @@ set_running (ptid_t ptid, int running)
   else
     {
       int started = 0;
+
       tp = find_thread_ptid (ptid);
       gdb_assert (tp);
       gdb_assert (tp->state_ != THREAD_EXITED);
@@ -814,6 +817,7 @@ print_thread_info (struct ui_out *uiout, int requested_thread, int pid)
       if (ui_out_is_mi_like_p (uiout))
        {
          char *state = "stopped";
+
          if (tp->state_ == THREAD_RUNNING)
            state = "running";
          ui_out_field_string (uiout, "state", state);
@@ -1005,6 +1009,7 @@ restore_current_thread_cleanup_dtor (void *arg)
 {
   struct current_thread_cleanup *old = arg;
   struct thread_info *tp;
+
   tp = find_thread_ptid (old->inferior_ptid);
   if (tp)
     tp->refcount--;
@@ -1257,6 +1262,18 @@ update_thread_list (void)
   target_find_new_threads ();
 }
 
+/* Return a new value for the selected thread's id.  Return a value of 0 if
+   no thread is selected, or no threads exist.  */
+
+static struct value *
+thread_id_make_value (struct gdbarch *gdbarch, struct internalvar *var)
+{
+  struct thread_info *tp = find_thread_ptid (inferior_ptid);
+
+  return value_from_longest (builtin_type (gdbarch)->builtin_int,
+                            (tp ? tp->num : 0));
+}
+
 /* Commands with a prefix of `thread'.  */
 struct cmd_list_element *thread_cmd_list = NULL;
 
@@ -1290,4 +1307,6 @@ Show printing of thread events (such as thread start and exit)."), NULL,
          NULL,
          show_print_thread_events,
          &setprintlist, &showprintlist);
+
+  create_internalvar_type_lazy ("_thread", thread_id_make_value);
 }
This page took 0.024125 seconds and 4 git commands to generate.