diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9cbb652ce48..17f0b26ddf4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,25 @@ +Thu Jan 6 07:17:53 1994 Jim Kingdon (kingdon@deneb.cygnus.com) + + * target.h: Add TARGET_WAITKIND_LOADED and TARGET_WAITKIND_SPURIOUS. + * target.c (store_waitstatus): Add CHILD_SPECIAL_WAITSTATUS hook. + * infrun.c (wait_for_inferior): Replace SIGTRAP_STOP_AFTER_LOAD with + code which looks for those two waitkinds. Use switch statement. + * config/rs6000/tm-rs6000.h: Replace SIGTRAP_STOP_AFTER_LOAD with + CHILD_SPECIAL_WAITSTATUS. + + * procfs.c (procfs_wait): Fix argument name to match 4 Jan changes. + * Move target_signal_from_host, target_signal_to_host, and + store_waitstatus from inftarg.c to target.c. procfs needs them. + * target.c: Include "wait.h" and . + * target.h, infrun.c (proceed), proceed callers: Pass new code + TARGET_SIGNAL_DEFAULT instead of -1. This avoids problems with + enums being treated as unsigned and is cleaner. + * infrun.c (signals_info): Don't print TARGET_SIGNAL_DEFAULT or + TARGET_SIGNAL_0. + * infcmd.c (signal_command), infrun.c (signals_info): + Don't allow user to specify numeric equivalent of + TARGET_SIGNAL_DEFAULT. + Tue Jan 4 15:34:36 1994 Stu Grossman (grossman@cygnus.com) * config/alpha/alpha-netware.mt: New target support for Alpha diff --git a/gdb/infrun.c b/gdb/infrun.c index 8df0248d11f..3fc8cf17674 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -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. @@ -317,12 +317,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_signal= 0; + stop_signal = TARGET_SIGNAL_0; /* Resume inferior. */ resume (oneproc || step || bpstat_should_step (), stop_signal); @@ -432,17 +432,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. */ - - SIGTRAP_STOP_AFTER_LOAD (w); -#endif - - /* See if the process still exists; clean up if it doesn't. */ - if (w.kind == TARGET_WAITKIND_EXITED) + switch (w.kind) { + case TARGET_WAITKIND_LOADED: + /* Ignore it gracefully. */ + if (breakpoints_inserted) + { + mark_breakpoints_out (); + insert_breakpoints (); + } + resume (0, TARGET_SIGNAL_0); + continue; + + case TARGET_WAITKIND_SPURIOUS: + resume (0, TARGET_SIGNAL_0); + continue; + + 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 +462,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 +478,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; } @@ -1559,15 +1567,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 +1662,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; } @@ -1664,7 +1676,9 @@ signals_info (signum_exp, from_tty) { QUIT; - if (oursig != TARGET_SIGNAL_UNKNOWN) + if (oursig != TARGET_SIGNAL_UNKNOWN + && oursig != TARGET_SIGNAL_DEFAULT + && oursig != TARGET_SIGNAL_0) sig_print_info (oursig); } diff --git a/gdb/target.h b/gdb/target.h index 6b5d9bba5b9..92a59ab8998 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1,5 +1,5 @@ /* Interface between GDB and target environments, including files and processes - Copyright 1990, 1991, 1992 Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by John Gilmore. This file is part of GDB. @@ -61,7 +61,16 @@ enum target_waitkind { /* The program has terminated with a signal. Which signal is in value.sig. */ - TARGET_WAITKIND_SIGNALLED + TARGET_WAITKIND_SIGNALLED, + + /* The program is letting us know that it dynamically loaded something + (e.g. it called load(2) on AIX). */ + TARGET_WAITKIND_LOADED, + + /* Nothing happened, but we stopped anyway. This perhaps should be handled + within target_wait, but I'm not sure target_wait should be resuming the + inferior. */ + TARGET_WAITKIND_SPURIOUS }; /* The numbering of these signals is chosen to match traditional unix @@ -138,6 +147,10 @@ enum target_signal { /* Some signal we don't know about. */ TARGET_SIGNAL_UNKNOWN, + /* Use whatever signal we use when one is not specifically specified + (for passing to proceed and so on). */ + TARGET_SIGNAL_DEFAULT, + /* Last and unused enum value, for sizing arrays, etc. */ TARGET_SIGNAL_LAST }; @@ -286,8 +299,9 @@ extern void target_detach PARAMS ((char *, int)); /* Resume execution of the target process PID. STEP says whether to - single-step or to run free; SIGGNAL is the signal value (e.g. SIGINT) to be - given to the target, or zero for no signal. */ + single-step or to run free; SIGGNAL is the signal to be given to + the target, or TARGET_SIGNAL_0 for no signal. The caller may not + pass TARGET_SIGNAL_DEFAULT. */ #define target_resume(pid, step, siggnal) \ (*current_target->to_resume) (pid, step, siggnal)