* linux-low.c (linux_kill_one_lwp): Assume the lwp is stopped.
[binutils-gdb.git] / gdb / infrun.c
index 83cfe3c124be228d6df9f59858fa61ef469dbd43..93f50eb94cb5059d711a78571536b2cbcd1deeff 100644 (file)
@@ -179,16 +179,6 @@ show_debug_infrun (struct ui_file *file, int from_tty,
 #endif
 
 
-/* Convert the #defines into values.  This is temporary until wfi control
-   flow is completely sorted out.  */
-
-#ifndef CANNOT_STEP_HW_WATCHPOINTS
-#define CANNOT_STEP_HW_WATCHPOINTS 0
-#else
-#undef  CANNOT_STEP_HW_WATCHPOINTS
-#define CANNOT_STEP_HW_WATCHPOINTS 1
-#endif
-
 /* Tables of how to react to signals; the user sets them.  */
 
 static unsigned char *signal_stop;
@@ -1484,18 +1474,6 @@ resume (int step, enum target_signal sig)
                        "trap_expected=%d\n",
                        step, sig, tp->trap_expected);
 
-  /* Some targets (e.g. Solaris x86) have a kernel bug when stepping
-     over an instruction that causes a page fault without triggering
-     a hardware watchpoint. The kernel properly notices that it shouldn't
-     stop, because the hardware watchpoint is not triggered, but it forgets
-     the step request and continues the program normally.
-     Work around the problem by removing hardware watchpoints if a step is
-     requested, GDB will check for a hardware watchpoint trigger after the
-     step anyway.  */
-  if (CANNOT_STEP_HW_WATCHPOINTS && step)
-    remove_hw_watchpoints ();
-
-
   /* Normally, by the time we reach `resume', the breakpoints are either
      removed or inserted, as appropriate.  The exception is if we're sitting
      at a permanent breakpoint; we need to step over it, but permanent
@@ -2390,6 +2368,14 @@ prepare_for_detach (void)
         state.  */
       old_chain_2 = make_cleanup (finish_thread_state_cleanup, &minus_one_ptid);
 
+      /* In non-stop mode, each thread is handled individually.
+        Switch early, so the global state is set correctly for this
+        thread.  */
+      if (non_stop
+         && ecs->ws.kind != TARGET_WAITKIND_EXITED
+         && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED)
+       context_switch (ecs->ptid);
+
       /* Now figure out what to do with the result of the result.  */
       handle_inferior_event (ecs);
 
@@ -2904,7 +2890,7 @@ handle_inferior_event (struct execution_control_state *ecs)
   target_last_waitstatus = ecs->ws;
 
   /* Always clear state belonging to the previous time we stopped.  */
-  stop_stack_dummy = 0;
+  stop_stack_dummy = STOP_NONE;
 
   /* If it's a new process, add it to the thread database */
 
@@ -3970,7 +3956,7 @@ process_event_stop_test:
 
     if (what.call_dummy)
       {
-       stop_stack_dummy = 1;
+       stop_stack_dummy = what.call_dummy;
       }
 
     switch (what.main_action)
@@ -5460,7 +5446,7 @@ Further execution is probably impossible.\n"));
       stop_registers = regcache_dup (get_current_regcache ());
     }
 
-  if (stop_stack_dummy)
+  if (stop_stack_dummy == STOP_STACK_DUMMY)
     {
       /* Pop the empty frame that contains the stack dummy.
         This also restores inferior state prior to the call
@@ -6038,7 +6024,7 @@ struct inferior_status
 {
   bpstat stop_bpstat;
   int stop_step;
-  int stop_stack_dummy;
+  enum stop_stack_kind stop_stack_dummy;
   int stopped_by_random_signal;
   int stepping_over_breakpoint;
   CORE_ADDR step_range_start;
@@ -6325,8 +6311,7 @@ ptid_match (ptid_t ptid, ptid_t filter)
   /* Since both parameters have the same type, prevent easy mistakes
      from happening.  */
   gdb_assert (!ptid_equal (ptid, minus_one_ptid)
-             && !ptid_equal (ptid, null_ptid)
-             && !ptid_is_pid (ptid));
+             && !ptid_equal (ptid, null_ptid));
 
   if (ptid_equal (filter, minus_one_ptid))
     return 1;