* dwarf2read.c (follow_die_ref): Add comment.
[deliverable/binutils-gdb.git] / gdb / infcall.c
index 3a111491cf0bf575a76ec5daef38f887e59dea39..0dfd4ed7e90c86df3ee483c27234aa418aaff44b 100644 (file)
@@ -243,6 +243,7 @@ find_function_addr (struct value *function, struct type **retval_type)
        {
          /* Handle function descriptors lacking debug info.  */
          int found_descriptor = 0;
+         funaddr = 0;  /* pacify "gcc -Werror" */
          if (VALUE_LVAL (function) == lval_memory)
            {
              CORE_ADDR nfunaddr;
@@ -330,10 +331,12 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
 {
   volatile struct gdb_exception e;
   int saved_async = 0;
-  int saved_suppress_resume_observer = suppress_resume_observer;
+  int saved_in_infcall = call_thread->in_infcall;
   ptid_t call_thread_ptid = call_thread->ptid;
   char *saved_target_shortname = xstrdup (target_shortname);
 
+  call_thread->in_infcall = 1;
+
   clear_proceed_status ();
 
   disable_watchpoints_before_interactive_call_start ();
@@ -342,17 +345,12 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
   if (target_can_async_p ())
     saved_async = target_async_mask (0);
 
-  suppress_resume_observer = 1;
-
   TRY_CATCH (e, RETURN_MASK_ALL)
     proceed (real_pc, TARGET_SIGNAL_0, 0);
 
-  /* At this point the current thread may have changed.
-     CALL_THREAD is no longer usable as its thread may have exited.
-     Set it to NULL to prevent its further use.  */
-  call_thread = NULL;
-
-  suppress_resume_observer = saved_suppress_resume_observer;
+  /* At this point the current thread may have changed.  Refresh
+     CALL_THREAD as it could be invalid if its thread has exited.  */
+  call_thread = find_thread_ptid (call_thread_ptid);
 
   /* Don't restore the async mask if the target has changed,
      saved_async is for the original target.  */
@@ -369,11 +367,13 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
      of error out of resume()), then we wouldn't need this.  */
   if (e.reason < 0)
     {
-      struct thread_info *tp = find_thread_pid (call_thread_ptid);
-      if (tp != NULL)
-       breakpoint_auto_delete (tp->stop_bpstat);
+      if (call_thread != NULL)
+       breakpoint_auto_delete (call_thread->stop_bpstat);
     }
 
+  if (call_thread != NULL)
+    call_thread->in_infcall = saved_in_infcall;
+
   xfree (saved_target_shortname);
 
   return e;
This page took 0.024804 seconds and 4 git commands to generate.