* serial.h (SERIAL_SET_TTY_STATE): Comment return value.
[deliverable/binutils-gdb.git] / gdb / infrun.c
index 8df0248d11fb90f67ca96ced406abbd917ad9f5f..9549bceaf38d3954ec70e1a61c2a79439de0cc1b 100644 (file)
@@ -1,5 +1,5 @@
 /* Target-struct-independent code to start (run) and stop an inferior process.
-   Copyright 1986, 1987, 1988, 1989, 1991, 1992, 1993
+   Copyright 1986, 1987, 1988, 1989, 1991, 1992, 1993, 1994
    Free Software Foundation, Inc.
 
 This file is part of GDB.
@@ -74,13 +74,6 @@ hook_stop_stub PARAMS ((char *));
 #define        SKIP_TRAMPOLINE_CODE(pc)        0
 #endif
 
-/* On Irix 5, some function calls automatically skip the first few
-   instructions, so we need a more complicated test to see if we are
-   the start of a function.  */
-#ifndef AT_FUNCTION_START
-#define AT_FUNCTION_START(pc,func_name,func_addr)      0
-#endif
-
 /* For SVR4 shared libraries, each call goes through a small piece of
    trampoline code in the ".init" section.  IN_SOLIB_TRAMPOLINE evaluates
    to nonzero if we are current stopped in one of these. */
@@ -317,12 +310,12 @@ The same program may be running in another process.");
       breakpoints_inserted = 1;
     }
 
-  if (siggnal >= 0)
+  if (siggnal != TARGET_SIGNAL_DEFAULT)
     stop_signal = siggnal;
   /* If this signal should not be seen by program,
      give it zero.  Used for debugging signals.  */
   else if (!signal_program[stop_signal])
-    stop_signal0;
+    stop_signal = TARGET_SIGNAL_0;
 
   /* Resume inferior.  */
   resume (oneproc || step || bpstat_should_step (), stop_signal);
@@ -432,17 +425,23 @@ wait_for_inferior ()
 
       pid = target_wait (-1, &w);
 
-#ifdef SIGTRAP_STOP_AFTER_LOAD
-
-      /* Somebody called load(2), and it gave us a "trap signal after load".
-         Ignore it gracefully. */
+      switch (w.kind)
+       {
+       case TARGET_WAITKIND_LOADED:
+         /* Ignore it gracefully.  */
+         if (breakpoints_inserted)
+           {
+             mark_breakpoints_out ();
+             insert_breakpoints ();
+           }
+         resume (0, TARGET_SIGNAL_0);
+         continue;
 
-      SIGTRAP_STOP_AFTER_LOAD (w);
-#endif
+       case TARGET_WAITKIND_SPURIOUS:
+         resume (0, TARGET_SIGNAL_0);
+         continue;
 
-      /* See if the process still exists; clean up if it doesn't.  */
-      if (w.kind == TARGET_WAITKIND_EXITED)
-       {
+       case TARGET_WAITKIND_EXITED:
          target_terminal_ours ();      /* Must do this before mourn anyway */
          if (w.value.integer)
            printf_filtered ("\nProgram exited with code 0%o.\n", 
@@ -456,12 +455,9 @@ wait_for_inferior ()
          one_stepped = 0;
 #endif
          stop_print_frame = 0;
-         break;
-       }
-      else if (w.kind == TARGET_WAITKIND_SIGNALLED)
-       {
-         char *signame;
+         goto stop_stepping;
 
+       case TARGET_WAITKIND_SIGNALLED:
          stop_print_frame = 0;
          stop_signal = w.value.sig;
          target_terminal_ours ();      /* Must do this before mourn anyway */
@@ -475,6 +471,11 @@ wait_for_inferior ()
 #ifdef NO_SINGLE_STEP
          one_stepped = 0;
 #endif
+         goto stop_stepping;
+
+       case TARGET_WAITKIND_STOPPED:
+         /* This is the only case in which we keep going; the above cases
+            end in a continue or goto.  */
          break;
        }
 
@@ -981,15 +982,6 @@ switch_thread:
 
              /* If we do a call, we will be at the start of a function...  */
              || stop_pc == stop_func_start
-#if 0
-             /* Should be taken care of by the stop_pc < prologue_pc check
-                below.  Also, on irix5 where this checks for stop_pc
-                equal to stop_func_start plus 12, it would seem to be
-                wrong for a function with a 4 byte prologue, and an 8 byte
-                call; a "return" could end up at stop_func_start+12.  */
-
-             || AT_FUNCTION_START (stop_pc, stop_func_name, stop_func_start)
-#endif
 
              /* ...except on the Alpha with -O (and also Irix 5 and
                 perhaps others), in which we might call the address
@@ -1389,6 +1381,10 @@ Further execution is probably impossible.\n");
          POP_FRAME ends with a setting of the current frame, so we
         can use that next. */
       POP_FRAME;
+      /* Set stop_pc to what it was before we called the function.  Can't rely
+        on restore_inferior_status because that only gets called if we don't
+        stop in the called function.  */
+      stop_pc = read_pc();
       select_frame (get_current_frame (), 0);
     }
 }
@@ -1559,15 +1555,18 @@ handle_command (args, from_tty)
              error ("Signal %d not in range 0-%d", siglast, nsigs - 1);
            }
        }
-      else if ((oursig = target_signal_from_name (*argv))
-              != TARGET_SIGNAL_UNKNOWN)
-       {
-         sigfirst = siglast = (int)oursig;
-       }
       else
        {
-         /* Not a number and not a recognized flag word => complain.  */
-         error ("Unrecognized or ambiguous flag word: \"%s\".", *argv);
+         oursig = target_signal_from_name (*argv);
+         if (oursig != TARGET_SIGNAL_UNKNOWN)
+           {
+             sigfirst = siglast = (int)oursig;
+           }
+         else
+           {
+             /* Not a number and not a recognized flag word => complain.  */
+             error ("Unrecognized or ambiguous flag word: \"%s\".", *argv);
+           }
        }
 
       /* If any signal numbers or symbol names were found, set flags for
@@ -1651,7 +1650,8 @@ signals_info (signum_exp, from_tty)
          int i = parse_and_eval_address (signum_exp);
          if (i >= (int)TARGET_SIGNAL_LAST
              || i < 0
-             || i == TARGET_SIGNAL_UNKNOWN)
+             || i == (int)TARGET_SIGNAL_UNKNOWN
+             || i == (int)TARGET_SIGNAL_DEFAULT)
            error ("Signal number out of bounds.");
          oursig = (enum target_signal)i;
        }
@@ -1660,11 +1660,16 @@ signals_info (signum_exp, from_tty)
     }
 
   printf_filtered ("\n");
-  for (oursig = 0; oursig < TARGET_SIGNAL_LAST; ++oursig)
+  /* These ugly casts brought to you by the native VAX compiler.  */
+  for (oursig = 0;
+       (int)oursig < (int)TARGET_SIGNAL_LAST;
+       oursig = (enum target_signal)((int)oursig + 1))
     {
       QUIT;
 
-      if (oursig != TARGET_SIGNAL_UNKNOWN)
+      if (oursig != TARGET_SIGNAL_UNKNOWN
+         && oursig != TARGET_SIGNAL_DEFAULT
+         && oursig != TARGET_SIGNAL_0)
        sig_print_info (oursig);
     }
 
@@ -1864,6 +1869,8 @@ of the program stops.", &cmdlist);
   signal_print[TARGET_SIGNAL_CHLD] = 0;
   signal_stop[TARGET_SIGNAL_IO] = 0;
   signal_print[TARGET_SIGNAL_IO] = 0;
+  signal_stop[TARGET_SIGNAL_POLL] = 0;
+  signal_print[TARGET_SIGNAL_POLL] = 0;
   signal_stop[TARGET_SIGNAL_URG] = 0;
   signal_print[TARGET_SIGNAL_URG] = 0;
 }
This page took 0.025326 seconds and 4 git commands to generate.