* target.h: Add enum target_waitkind, enum target_signal, and

struct target_waitstatus.  Change status argument to target_wait to
	be struct target_waitstatus * instead of int *.
	* target.h, infrun.c, all targets: Change type of signal arguments
	to resume(), proceed(), and target_resume() from int to enum
	target_signal.
	* All targets (*_wait, *_resume): Change accordingly.
	* infcmd.c (program_info, signal_command), throughout infrun.c,
	* fork-child.c, solib.c, hppa-tdep.c, osfsolib.c: Use this stuff.
	* convex-xdep.c, convex-tdep.c: Add FIXME's (getting the Convex
	signal code stuff right with the new signals would be non-trivial).
	* inferior.h (stop_signal): Make it enum target_signal not int.
	* target.c, target.h (target_signal_to_string, target_signal_to_name,
	target_signal_from_name): New functions.
	* inftarg.c, target.h (target_signal_to_host, target_signal_from_host,
	store_waitstatus): New functions.
	* procfs.c (procfs_notice_signals): Use them.
	* i960-tdep.c (i960_fault_to_signal): New function, to replace
	print_fault.
	* config/i960/tm-i960.h: Don't define PRINT_RANDOM_SIGNAL.
This commit is contained in:
Jim Kingdon 1994-01-04 21:53:53 +00:00
parent e14316e7fe
commit 67ac975911
32 changed files with 1166 additions and 7959 deletions

File diff suppressed because it is too large Load Diff

View File

@ -611,6 +611,8 @@ thread_info ()
ioctl (inferior_fd, PIXRDCREGS, &ps);
}
/* FIXME: stop_signal is from target.h but stop_sigcode is a
convex-specific thing. */
printf_filtered ("Current thread %d stopped with signal %d.%d (%s).\n",
inferior_thread, stop_signal, stop_sigcode,
subsig_name (stop_signal, stop_sigcode));

View File

@ -731,6 +731,7 @@ wait (w)
select_thread (signal_stack->thread);
FIXME: need to convert from host sig.
stop_signal = signal_stack->signo;
stop_sigcode = signal_stack->subsig;

View File

@ -276,7 +276,7 @@ startup_inferior (ntraps)
{
stop_soon_quietly = 1; /* Make wait_for_inferior be quiet */
wait_for_inferior ();
if (stop_signal != SIGTRAP)
if (stop_signal != TARGET_SIGNAL_TRAP)
{
/* Let shell child handle its own signals in its own way */
/* FIXME, what if child has exit()ed? Must exit loop somehow */
@ -302,7 +302,7 @@ startup_inferior (ntraps)
}
if (0 == --pending_execs)
break;
resume (0, 0); /* Just make it go on */
resume (0, TARGET_SIGNAL_0); /* Just make it go on */
}
}
stop_soon_quietly = 0;

View File

@ -864,7 +864,7 @@ restore_pc_queue (fsr)
CORE_ADDR pc = read_pc ();
CORE_ADDR new_pc = read_memory_integer (fsr->regs[PCOQ_HEAD_REGNUM], 4);
int pid;
WAITTYPE w;
struct target_waitstatus w;
int insn_count;
/* Advance past break instruction in the call dummy. */
@ -894,14 +894,15 @@ restore_pc_queue (fsr)
any other choice? Is there *any* way to do this stuff with
ptrace() or some equivalent?). */
resume (1, 0);
target_wait(inferior_pid, &w);
target_wait (inferior_pid, &w);
if (!WIFSTOPPED (w))
if (w.kind == TARGET_WAITKIND_SIGNALLED)
{
stop_signal = WTERMSIG (w);
stop_signal = w.value.sig;
terminal_ours_for_output ();
printf_unfiltered ("\nProgram terminated with signal %d, %s\n",
stop_signal, safe_strsignal (stop_signal));
printf_unfiltered ("\nProgram terminated with signal %s, %s.\n",
target_signal_to_name (stop_signal),
target_signal_to_string (stop_signal));
gdb_flush (gdb_stdout);
return 0;
}

View File

@ -258,7 +258,7 @@ void
child_resume (pid, step, signal)
int pid;
int step;
int signal;
enum target_signal signal;
{
errno = 0;

View File

@ -208,7 +208,7 @@ void
child_resume (pid, step, signal)
int pid;
int step;
int signal;
enum target_signal signal;
{
errno = 0;

View File

@ -578,60 +578,40 @@ pop_frame ()
set_current_frame (create_new_frame (read_register (FP_REGNUM), read_pc ()));
}
/* Print out text describing a "signal number" with which the i80960 halted.
See the file "fault.c" in the nindy monitor source code for a list
of stop codes. */
/* Given a 960 stop code (fault or trace), return the signal which
corresponds. */
void
print_fault( siggnal )
int siggnal; /* Signal number, as returned by target_wait() */
enum target_signal
i960_fault_to_signal (fault)
int fault;
{
static char unknown[] = "Unknown fault or trace";
static char *sigmsgs[] = {
/* FAULTS */
"parallel fault", /* 0x00 */
unknown, /* 0x01 */
"operation fault", /* 0x02 */
"arithmetic fault", /* 0x03 */
"floating point fault", /* 0x04 */
"constraint fault", /* 0x05 */
"virtual memory fault", /* 0x06 */
"protection fault", /* 0x07 */
"machine fault", /* 0x08 */
"structural fault", /* 0x09 */
"type fault", /* 0x0a */
"reserved (0xb) fault", /* 0x0b */
"process fault", /* 0x0c */
"descriptor fault", /* 0x0d */
"event fault", /* 0x0e */
"reserved (0xf) fault", /* 0x0f */
/* TRACES */
"single-step trace", /* 0x10 */
"branch trace", /* 0x11 */
"call trace", /* 0x12 */
"return trace", /* 0x13 */
"pre-return trace", /* 0x14 */
"supervisor call trace",/* 0x15 */
"breakpoint trace", /* 0x16 */
};
# define NUMMSGS ((int)( sizeof(sigmsgs) / sizeof(sigmsgs[0]) ))
if (siggnal < NSIG) {
printf_unfiltered ("\nProgram received signal %d, %s\n",
siggnal, safe_strsignal (siggnal));
} else {
/* The various target_wait()s bias the 80960 "signal number"
by adding NSIG to it, so it won't get confused with any
of the Unix signals elsewhere in GDB. We need to
"unbias" it before using it. */
siggnal -= NSIG;
printf_unfiltered("Program stopped for reason #%d: %s.\n", siggnal,
(siggnal < NUMMSGS && siggnal >= 0)?
sigmsgs[siggnal] : unknown );
}
switch (fault)
{
case 0: return TARGET_SIGNAL_BUS; /* parallel fault */
case 1: return TARGET_SIGNAL_UNKNOWN;
case 2: return TARGET_SIGNAL_BUS; /* operation fault */
case 3: return TARGET_SIGNAL_FPE; /* arithmetic fault */
case 4: return TARGET_SIGNAL_FPE; /* floating point fault */
case 5: return TARGET_SIGNAL_BUS; /* constraint fault */
case 6: return TARGET_SIGNAL_SEGV; /* virtual memory fault */
case 7: return TARGET_SIGNAL_SEGV; /* protection fault */
case 8: return TARGET_SIGNAL_BUS; /* machine fault */
case 9: return TARGET_SIGNAL_BUS; /* structural fault */
case 0xa: return TARGET_SIGNAL_BUS; /* type fault */
case 0xb: return TARGET_SIGNAL_UNKNOWN; /* reserved fault */
case 0xc: return TARGET_SIGNAL_BUS; /* process fault */
case 0xd: return TARGET_SIGNAL_SEGV; /* descriptor fault */
case 0xe: return TARGET_SIGNAL_BUS; /* event fault */
case 0xf: return TARGET_SIGNAL_UNKNOWN; /* reserved fault */
case 0x10: return TARGET_SIGNAL_TRAP; /* single-step trace */
case 0x11: return TARGET_SIGNAL_TRAP; /* branch trace */
case 0x12: return TARGET_SIGNAL_TRAP; /* call trace */
case 0x13: return TARGET_SIGNAL_TRAP; /* return trace */
case 0x14: return TARGET_SIGNAL_TRAP; /* pre-return trace */
case 0x15: return TARGET_SIGNAL_TRAP; /* supervisor call trace */
case 0x16: return TARGET_SIGNAL_TRAP; /* breakpoint trace */
default: return TARGET_SIGNAL_UNKNOWN;
}
}
/* Initialization stub */

View File

@ -128,7 +128,7 @@ int inferior_pid;
/* Last signal that the inferior received (why it stopped). */
int stop_signal;
enum target_signal stop_signal;
/* Address at which inferior stopped. */
@ -468,7 +468,7 @@ jump_command (arg, from_tty)
local_hex_string((unsigned long) addr));
clear_proceed_status ();
proceed (addr, 0, 0);
proceed (addr, TARGET_SIGNAL_0, 0);
}
/* Continue program giving it specified signal. */
@ -478,7 +478,7 @@ signal_command (signum_exp, from_tty)
char *signum_exp;
int from_tty;
{
register int signum;
enum target_signal oursig;
dont_repeat (); /* Too dangerous. */
ERROR_NO_INFERIOR;
@ -489,25 +489,35 @@ signal_command (signum_exp, from_tty)
/* It would be even slicker to make signal names be valid expressions,
(the type could be "enum $signal" or some such), then the user could
assign them to convenience variables. */
signum = strtosigno (signum_exp);
oursig = target_signal_from_name (signum_exp);
if (signum == 0)
/* Not found as a name, try it as an expression. */
signum = parse_and_eval_address (signum_exp);
if (oursig == TARGET_SIGNAL_UNKNOWN)
{
/* Not found as a name, try it as an expression. */
/* The numeric signal refers to our own internal signal numbering
from target.h, not to host/target signal number. This is a
feature; users really should be using symbolic names anyway,
and the common ones like SIGHUP, SIGINT, SIGALRM, etc. will
work right anyway. */
int signum = parse_and_eval_address (signum_exp);
if (signum <= 0
|| signum >= (int)TARGET_SIGNAL_LAST
|| signum == (int)TARGET_SIGNAL_UNKNOWN)
error ("Invalid signal number %d.", signum);
oursig = signum;
}
if (from_tty)
{
char *signame = strsigno (signum);
printf_filtered ("Continuing with signal ");
if (signame == NULL || signum == 0)
printf_filtered ("%d.\n", signum);
if (oursig == TARGET_SIGNAL_0)
printf_filtered ("Continuing with no signal.\n");
else
/* Do we need to print the number as well as the name? */
printf_filtered ("%s (%d).\n", signame, signum);
printf_filtered ("Continuing with signal %s.\n",
target_signal_to_name (oursig));
}
clear_proceed_status ();
proceed (stop_pc, signum, 0);
proceed (stop_pc, oursig, 0);
}
/* Call breakpoint_auto_delete on the current contents of the bpstat
@ -592,7 +602,7 @@ run_stack_dummy (addr, buffer)
#endif /* CALL_DUMMY_BREAKPOINT_OFFSET. */
proceed_to_finish = 1; /* We want stop_registers, please... */
proceed (addr, 0, 0);
proceed (addr, TARGET_SIGNAL_0, 0);
discard_cleanups (old_cleanups);
@ -788,21 +798,12 @@ program_info (args, from_tty)
num = bpstat_num (&bs);
}
}
else if (stop_signal)
else if (stop_signal != TARGET_SIGNAL_0)
{
#ifdef PRINT_RANDOM_SIGNAL
PRINT_RANDOM_SIGNAL (stop_signal);
#else
char *signame = strsigno (stop_signal);
printf_filtered ("It stopped with signal ");
if (signame == NULL)
printf_filtered ("%d", stop_signal);
else
/* Do we need to print the number as well as the name? */
printf_filtered ("%s (%d)", signame, stop_signal);
printf_filtered (", %s.\n", safe_strsignal (stop_signal));
#endif
}
printf_filtered ("It stopped with signal %s, %s.\n",
target_signal_to_name (stop_signal),
target_signal_to_string (stop_signal));
}
if (!from_tty)
printf_filtered ("Type \"info stack\" or \"info registers\" for more information.\n");
@ -1070,14 +1071,24 @@ do_registers_info (regnum, fpregs)
fputs_filtered (reg_names[i], gdb_stdout);
print_spaces_filtered (15 - strlen (reg_names[i]), gdb_stdout);
/* Get the data in raw format, then convert also to virtual format. */
/* Get the data in raw format. */
if (read_relative_register_raw_bytes (i, raw_buffer))
{
printf_filtered ("Invalid register contents\n");
continue;
}
REGISTER_CONVERT_TO_VIRTUAL (i, raw_buffer, virtual_buffer);
/* Convert raw data to virtual format if necessary. */
#ifdef REGISTER_CONVERTIBLE
if (REGISTER_CONVERTIBLE (i))
{
REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i),
raw_buffer, virtual_buffer);
}
else
#endif
memcpy (virtual_buffer, raw_buffer,
REGISTER_VIRTUAL_SIZE (i));
/* If virtual format is floating, print it that way, and in raw hex. */
if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT

View File

@ -48,8 +48,7 @@ signals_info PARAMS ((char *, int));
static void
handle_command PARAMS ((char *, int));
static void
sig_print_info PARAMS ((int));
static void sig_print_info PARAMS ((enum target_signal));
static void
sig_print_header PARAMS ((void));
@ -202,7 +201,7 @@ resume_cleanups (arg)
void
resume (step, sig)
int step;
int sig;
enum target_signal sig;
{
struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
QUIT;
@ -270,7 +269,7 @@ clear_proceed_status ()
void
proceed (addr, siggnal, step)
CORE_ADDR addr;
int siggnal;
enum target_signal siggnal;
int step;
{
int oneproc = 0;
@ -322,7 +321,7 @@ The same program may be running in another process.");
stop_signal = siggnal;
/* If this signal should not be seen by program,
give it zero. Used for debugging signals. */
else if (stop_signal < NSIG && !signal_program[stop_signal])
else if (!signal_program[stop_signal])
stop_signal= 0;
/* Resume inferior. */
@ -372,7 +371,9 @@ init_wait_for_inferior ()
trap_expected_after_continue = 0;
breakpoints_inserted = 0;
breakpoint_init_inferior ();
stop_signal = 0; /* Don't confuse first call to proceed(). */
/* Don't confuse first call to proceed(). */
stop_signal = TARGET_SIGNAL_0;
}
static void
@ -394,11 +395,12 @@ void
wait_for_inferior ()
{
struct cleanup *old_cleanups;
WAITTYPE w;
struct target_waitstatus w;
int another_trap;
int random_signal;
CORE_ADDR stop_sp = 0;
CORE_ADDR stop_func_start;
CORE_ADDR stop_func_end;
char *stop_func_name;
CORE_ADDR prologue_pc = 0, tmp;
struct symtab_and_line sal;
@ -439,12 +441,12 @@ wait_for_inferior ()
#endif
/* See if the process still exists; clean up if it doesn't. */
if (WIFEXITED (w))
if (w.kind == TARGET_WAITKIND_EXITED)
{
target_terminal_ours (); /* Must do this before mourn anyway */
if (WEXITSTATUS (w))
if (w.value.integer)
printf_filtered ("\nProgram exited with code 0%o.\n",
(unsigned int)WEXITSTATUS (w));
(unsigned int)w.value.integer);
else
if (!batch_mode())
printf_filtered ("\nProgram exited normally.\n");
@ -456,27 +458,18 @@ wait_for_inferior ()
stop_print_frame = 0;
break;
}
else if (!WIFSTOPPED (w))
else if (w.kind == TARGET_WAITKIND_SIGNALLED)
{
char *signame;
stop_print_frame = 0;
stop_signal = WTERMSIG (w);
stop_signal = w.value.sig;
target_terminal_ours (); /* Must do this before mourn anyway */
target_kill (); /* kill mourns as well */
#ifdef PRINT_RANDOM_SIGNAL
printf_filtered ("\nProgram terminated: ");
PRINT_RANDOM_SIGNAL (stop_signal);
#else
printf_filtered ("\nProgram terminated with signal ");
signame = strsigno (stop_signal);
if (signame == NULL)
printf_filtered ("%d", stop_signal);
else
/* Do we need to print the number in addition to the name? */
printf_filtered ("%s (%d)", signame, stop_signal);
printf_filtered (", %s\n", safe_strsignal (stop_signal));
#endif
printf_filtered ("\nProgram terminated with signal %s, %s.\n",
target_signal_to_name (stop_signal),
target_signal_to_string (stop_signal));
printf_filtered ("The program no longer exists.\n");
gdb_flush (gdb_stdout);
#ifdef NO_SINGLE_STEP
@ -485,7 +478,7 @@ wait_for_inferior ()
break;
}
stop_signal = WSTOPSIG (w);
stop_signal = w.value.sig;
if (pid != inferior_pid)
{
@ -500,7 +493,7 @@ wait_for_inferior ()
else
stop_pc = read_pc ();
if (stop_signal == SIGTRAP
if (stop_signal == TARGET_SIGNAL_TRAP
&& breakpoint_here_p (stop_pc - DECR_PC_AFTER_BREAK))
{
if (!breakpoint_thread_match (stop_pc - DECR_PC_AFTER_BREAK, pid))
@ -522,13 +515,13 @@ wait_for_inferior ()
write_pc (stop_pc - DECR_PC_AFTER_BREAK);
remove_breakpoints ();
target_resume (pid, 1, 0); /* Single step */
target_resume (pid, 1, TARGET_SIGNAL_0); /* Single step */
/* FIXME: What if a signal arrives instead of the single-step
happening? */
target_wait (pid, &w);
insert_breakpoints ();
}
target_resume (-1, 0, 0);
target_resume (-1, 0, TARGET_SIGNAL_0);
continue;
}
else
@ -545,30 +538,24 @@ wait_for_inferior ()
fprintf_unfiltered (gdb_stderr, "[New %s]\n", target_pid_to_str (pid));
add_thread (pid);
target_resume (-1, 0, 0);
target_resume (-1, 0, TARGET_SIGNAL_0);
continue;
}
else
{
if (stop_signal >= NSIG || signal_print[stop_signal])
if (signal_print[stop_signal])
{
char *signame;
printed = 1;
target_terminal_ours_for_output ();
printf_filtered ("\nProgram received signal ");
signame = strsigno (stop_signal);
if (signame == NULL)
printf_filtered ("%d", stop_signal);
else
printf_filtered ("%s (%d)", signame, stop_signal);
printf_filtered (", %s\n", safe_strsignal (stop_signal));
printf_filtered ("\nProgram received signal %s, %s.\n",
target_signal_to_name (stop_signal),
target_signal_to_string (stop_signal));
gdb_flush (gdb_stdout);
}
if (stop_signal == SIGTRAP
|| stop_signal >= NSIG
if (stop_signal == TARGET_SIGNAL_TRAP
|| signal_stop[stop_signal])
{
switch_thread:
@ -599,7 +586,7 @@ switch_thread:
/* Clear the signal if it should not be passed. */
if (signal_program[stop_signal] == 0)
stop_signal = 0;
stop_signal = TARGET_SIGNAL_0;
target_resume (pid, 0, stop_signal);
continue;
@ -630,7 +617,7 @@ switch_thread:
/* Don't care about return value; stop_func_start and stop_func_name
will both be 0 if it doesn't work. */
find_pc_partial_function (stop_pc, &stop_func_name, &stop_func_start,
NULL);
&stop_func_end);
stop_func_start += FUNCTION_START_OFFSET;
another_trap = 0;
bpstat_clear (&stop_bpstat);
@ -656,16 +643,14 @@ switch_thread:
Here we detect when a SIGILL or SIGEMT is really a breakpoint
and change it to SIGTRAP. */
if (stop_signal == SIGTRAP
if (stop_signal == TARGET_SIGNAL_TRAP
|| (breakpoints_inserted &&
(stop_signal == SIGILL
#ifdef SIGEMT
|| stop_signal == SIGEMT
#endif
(stop_signal == TARGET_SIGNAL_ILL
|| stop_signal == TARGET_SIGNAL_EMT
))
|| stop_soon_quietly)
{
if (stop_signal == SIGTRAP && stop_after_trap)
if (stop_signal == TARGET_SIGNAL_TRAP && stop_after_trap)
{
stop_print_frame = 0;
break;
@ -680,7 +665,7 @@ switch_thread:
and end up in sigtramp, then step_resume_breakpoint
will be set and we should check whether we've hit the
step breakpoint. */
if (stop_signal == SIGTRAP && trap_expected
if (stop_signal == TARGET_SIGNAL_TRAP && trap_expected
&& step_resume_breakpoint == NULL)
bpstat_clear (&stop_bpstat);
else
@ -706,7 +691,7 @@ switch_thread:
stop_print_frame = 1;
}
if (stop_signal == SIGTRAP)
if (stop_signal == TARGET_SIGNAL_TRAP)
random_signal
= !(bpstat_explains_signal (stop_bpstat)
|| trap_expected
@ -726,7 +711,7 @@ switch_thread:
#endif /* No CALL_DUMMY_BREAKPOINT_OFFSET. */
);
if (!random_signal)
stop_signal = SIGTRAP;
stop_signal = TARGET_SIGNAL_TRAP;
}
}
else
@ -742,28 +727,17 @@ switch_thread:
stopped_by_random_signal = 1;
if (stop_signal >= NSIG
|| signal_print[stop_signal])
if (signal_print[stop_signal])
{
char *signame;
printed = 1;
target_terminal_ours_for_output ();
#ifdef PRINT_RANDOM_SIGNAL
PRINT_RANDOM_SIGNAL (stop_signal);
#else
printf_filtered ("\nProgram received signal ");
signame = strsigno (stop_signal);
if (signame == NULL)
printf_filtered ("%d", stop_signal);
else
/* Do we need to print the number as well as the name? */
printf_filtered ("%s (%d)", signame, stop_signal);
printf_filtered (", %s\n", safe_strsignal (stop_signal));
#endif /* PRINT_RANDOM_SIGNAL */
printf_filtered ("\nProgram received signal %s, %s.\n",
target_signal_to_name (stop_signal),
target_signal_to_string (stop_signal));
gdb_flush (gdb_stdout);
}
if (stop_signal >= NSIG
|| signal_stop[stop_signal])
if (signal_stop[stop_signal])
break;
/* If not going to stop, give terminal back
if we took it away. */
@ -772,7 +746,7 @@ switch_thread:
/* Clear the signal if it should not be passed. */
if (signal_program[stop_signal] == 0)
stop_signal = 0;
stop_signal = TARGET_SIGNAL_0;
/* I'm not sure whether this needs to be check_sigtramp2 or
whether it could/should be keep_going. */
@ -1102,13 +1076,13 @@ step_into_function:
the end of the prologue, even if that involves jumps
(as it seems to on the vax under 4.2). */
/* If the prologue ends in the middle of a source line,
continue to the end of that source line.
Otherwise, just go to end of prologue. */
continue to the end of that source line (if it is still
within the function). Otherwise, just go to end of prologue. */
#ifdef PROLOGUE_FIRSTLINE_OVERLAP
/* no, don't either. It skips any code that's
legitimately on the first line. */
#else
if (sal.end && sal.pc != stop_func_start)
if (sal.end && sal.pc != stop_func_start && sal.end < stop_func_end)
stop_func_start = sal.end;
#endif
@ -1179,6 +1153,17 @@ step_into_function:
(We might not be in the original line, but if we entered a
new line in mid-statement, we continue stepping. This makes
things like for(;;) statements work better.) */
if (stop_func_end && sal.end >= stop_func_end)
{
/* If this is the last line of the function, don't keep stepping
(it would probably step us out of the function).
This is particularly necessary for a one-line function,
in which after skipping the prologue we better stop even though
we will be in mid-line. */
stop_step = 1;
break;
}
step_range_start = sal.pc;
step_range_end = sal.end;
goto keep_going;
@ -1231,7 +1216,7 @@ step_into_function:
/* If we did not do break;, it means we should keep
running the inferior and not return to debugger. */
if (trap_expected && stop_signal != SIGTRAP)
if (trap_expected && stop_signal != TARGET_SIGNAL_TRAP)
{
/* We took a signal (which we are supposed to pass through to
the inferior, else we'd have done a break above) and we
@ -1271,8 +1256,8 @@ step_into_function:
trap_expected = another_trap;
if (stop_signal == SIGTRAP)
stop_signal = 0;
if (stop_signal == TARGET_SIGNAL_TRAP)
stop_signal = TARGET_SIGNAL_0;
#ifdef SHIFT_INST_REGS
/* I'm not sure when this following segment applies. I do know, now,
@ -1282,7 +1267,7 @@ step_into_function:
(this is only used on the 88k). */
if (!bpstat_explains_signal (stop_bpstat)
&& (stop_signal != SIGCLD)
&& (stop_signal != TARGET_SIGNAL_CHLD)
&& !stopped_by_random_signal)
SHIFT_INST_REGS();
#endif /* SHIFT_INST_REGS */
@ -1419,41 +1404,40 @@ hook_stop_stub (cmd)
int signal_stop_state (signo)
int signo;
{
return ((signo >= 0 && signo < NSIG) ? signal_stop[signo] : 0);
return signal_stop[signo];
}
int signal_print_state (signo)
int signo;
{
return ((signo >= 0 && signo < NSIG) ? signal_print[signo] : 0);
return signal_print[signo];
}
int signal_pass_state (signo)
int signo;
{
return ((signo >= 0 && signo < NSIG) ? signal_program[signo] : 0);
return signal_program[signo];
}
static void
sig_print_header ()
{
printf_filtered ("Signal\t\tStop\tPrint\tPass to program\tDescription\n");
printf_filtered ("\
Signal Stop\tPrint\tPass to program\tDescription\n");
}
static void
sig_print_info (number)
int number;
sig_print_info (oursig)
enum target_signal oursig;
{
char *name;
if ((name = strsigno (number)) == NULL)
printf_filtered ("%d\t\t", number);
else
printf_filtered ("%s (%d)\t", name, number);
printf_filtered ("%s\t", signal_stop[number] ? "Yes" : "No");
printf_filtered ("%s\t", signal_print[number] ? "Yes" : "No");
printf_filtered ("%s\t\t", signal_program[number] ? "Yes" : "No");
printf_filtered ("%s\n", safe_strsignal (number));
char *name = target_signal_to_name (oursig);
printf_filtered ("%s", name);
printf_filtered ("%*.*s ", 13 - strlen (name), 13 - strlen (name),
" ");
printf_filtered ("%s\t", signal_stop[oursig] ? "Yes" : "No");
printf_filtered ("%s\t", signal_print[oursig] ? "Yes" : "No");
printf_filtered ("%s\t\t", signal_program[oursig] ? "Yes" : "No");
printf_filtered ("%s\n", target_signal_to_string (oursig));
}
/* Specify how various signals in the inferior should be handled. */
@ -1466,6 +1450,7 @@ handle_command (args, from_tty)
char **argv;
int digits, wordlen;
int sigfirst, signum, siglast;
enum target_signal oursig;
int allsigs;
int nsigs;
unsigned char *sigs;
@ -1478,7 +1463,7 @@ handle_command (args, from_tty)
/* Allocate and zero an array of flags for which signals to handle. */
nsigs = signo_max () + 1;
nsigs = (int)TARGET_SIGNAL_LAST;
sigs = (unsigned char *) alloca (nsigs);
memset (sigs, 0, nsigs);
@ -1491,7 +1476,7 @@ handle_command (args, from_tty)
}
old_chain = make_cleanup (freeargv, (char *) argv);
/* Walk through the args, looking for signal numbers, signal names, and
/* Walk through the args, looking for signal oursigs, signal names, and
actions. Signal numbers and signal names may be interspersed with
actions, with the actions being performed for all signals cumulatively
specified. Signal ranges can be specified as <LOW>-<HIGH>. */
@ -1547,6 +1532,12 @@ handle_command (args, from_tty)
}
else if (digits > 0)
{
/* It is numeric. The numeric signal refers to our own internal
signal numbering from target.h, not to host/target signal number.
This is a feature; users really should be using symbolic names
anyway, and the common ones like SIGHUP, SIGINT, SIGALRM, etc.
will work right anyway. */
sigfirst = siglast = atoi (*argv);
if ((*argv)[digits] == '-')
{
@ -1568,9 +1559,10 @@ handle_command (args, from_tty)
error ("Signal %d not in range 0-%d", siglast, nsigs - 1);
}
}
else if ((signum = strtosigno (*argv)) != 0)
else if ((oursig = target_signal_from_name (*argv))
!= TARGET_SIGNAL_UNKNOWN)
{
sigfirst = siglast = signum;
sigfirst = siglast = (int)oursig;
}
else
{
@ -1583,13 +1575,16 @@ handle_command (args, from_tty)
for (signum = sigfirst; signum >= 0 && signum <= siglast; signum++)
{
switch (signum)
switch ((enum target_signal)signum)
{
case SIGTRAP:
case SIGINT:
case TARGET_SIGNAL_TRAP:
case TARGET_SIGNAL_INT:
if (!allsigs && !sigs[signum])
{
if (query ("%s is used by the debugger.\nAre you sure you want to change it? ", strsigno (signum)))
if (query ("%s is used by the debugger.\n\
Are you sure you want to change it? ",
target_signal_to_name
((enum target_signal)signum)))
{
sigs[signum] = 1;
}
@ -1627,38 +1622,50 @@ handle_command (args, from_tty)
do_cleanups (old_chain);
}
/* Print current contents of the tables set by the handle command. */
/* Print current contents of the tables set by the handle command.
It is possible we should just be printing signals actually used
by the current target (but for things to work right when switching
targets, all signals should be in the signal tables). */
static void
signals_info (signum_exp, from_tty)
char *signum_exp;
int from_tty;
{
register int i;
enum target_signal oursig;
sig_print_header ();
if (signum_exp)
{
/* First see if this is a symbol name. */
i = strtosigno (signum_exp);
if (i == 0)
oursig = target_signal_from_name (signum_exp);
if (oursig == TARGET_SIGNAL_UNKNOWN)
{
/* Nope, maybe it's an address which evaluates to a signal
number. */
i = parse_and_eval_address (signum_exp);
if (i >= NSIG || i < 0)
/* The numeric signal refers to our own internal
signal numbering from target.h, not to host/target signal number.
This is a feature; users really should be using symbolic names
anyway, and the common ones like SIGHUP, SIGINT, SIGALRM, etc.
will work right anyway. */
int i = parse_and_eval_address (signum_exp);
if (i >= (int)TARGET_SIGNAL_LAST
|| i < 0
|| i == TARGET_SIGNAL_UNKNOWN)
error ("Signal number out of bounds.");
oursig = (enum target_signal)i;
}
sig_print_info (i);
sig_print_info (oursig);
return;
}
printf_filtered ("\n");
for (i = 0; i < NSIG; i++)
for (oursig = 0; oursig < TARGET_SIGNAL_LAST; ++oursig)
{
QUIT;
sig_print_info (i);
if (oursig != TARGET_SIGNAL_UNKNOWN)
sig_print_info (oursig);
}
printf_filtered ("\nUse the \"handle\" command to change these tables.\n");
@ -1827,13 +1834,13 @@ Pass and Stop may be combined.");
This allows you to set a list of commands to be run each time execution\n\
of the program stops.", &cmdlist);
numsigs = signo_max () + 1;
signal_stop = (unsigned char *)
xmalloc (sizeof (signal_stop[0]) * numsigs);
signal_print = (unsigned char *)
xmalloc (sizeof (signal_print[0]) * numsigs);
numsigs = (int)TARGET_SIGNAL_LAST;
signal_stop = (unsigned char *)
xmalloc (sizeof (signal_stop[0]) * numsigs);
signal_print = (unsigned char *)
xmalloc (sizeof (signal_print[0]) * numsigs);
signal_program = (unsigned char *)
xmalloc (sizeof (signal_program[0]) * numsigs);
xmalloc (sizeof (signal_program[0]) * numsigs);
for (i = 0; i < numsigs; i++)
{
signal_stop[i] = 1;
@ -1843,36 +1850,20 @@ of the program stops.", &cmdlist);
/* Signals caused by debugger's own actions
should not be given to the program afterwards. */
signal_program[SIGTRAP] = 0;
signal_program[SIGINT] = 0;
signal_program[TARGET_SIGNAL_TRAP] = 0;
signal_program[TARGET_SIGNAL_INT] = 0;
/* Signals that are not errors should not normally enter the debugger. */
#ifdef SIGALRM
signal_stop[SIGALRM] = 0;
signal_print[SIGALRM] = 0;
#endif /* SIGALRM */
#ifdef SIGVTALRM
signal_stop[SIGVTALRM] = 0;
signal_print[SIGVTALRM] = 0;
#endif /* SIGVTALRM */
#ifdef SIGPROF
signal_stop[SIGPROF] = 0;
signal_print[SIGPROF] = 0;
#endif /* SIGPROF */
#ifdef SIGCHLD
signal_stop[SIGCHLD] = 0;
signal_print[SIGCHLD] = 0;
#endif /* SIGCHLD */
#ifdef SIGCLD
signal_stop[SIGCLD] = 0;
signal_print[SIGCLD] = 0;
#endif /* SIGCLD */
#ifdef SIGIO
signal_stop[SIGIO] = 0;
signal_print[SIGIO] = 0;
#endif /* SIGIO */
#ifdef SIGURG
signal_stop[SIGURG] = 0;
signal_print[SIGURG] = 0;
#endif /* SIGURG */
signal_stop[TARGET_SIGNAL_ALRM] = 0;
signal_print[TARGET_SIGNAL_ALRM] = 0;
signal_stop[TARGET_SIGNAL_VTALRM] = 0;
signal_print[TARGET_SIGNAL_VTALRM] = 0;
signal_stop[TARGET_SIGNAL_PROF] = 0;
signal_print[TARGET_SIGNAL_PROF] = 0;
signal_stop[TARGET_SIGNAL_CHLD] = 0;
signal_print[TARGET_SIGNAL_CHLD] = 0;
signal_stop[TARGET_SIGNAL_IO] = 0;
signal_print[TARGET_SIGNAL_IO] = 0;
signal_stop[TARGET_SIGNAL_URG] = 0;
signal_print[TARGET_SIGNAL_URG] = 0;
}

View File

@ -32,7 +32,7 @@ child_prepare_to_store PARAMS ((void));
#ifndef CHILD_WAIT
static int
child_wait PARAMS ((int, int *));
child_wait PARAMS ((int, struct target_waitstatus *));
#endif /* CHILD_WAIT */
static void
@ -67,23 +67,345 @@ extern char **environ;
/* Forward declaration */
extern struct target_ops child_ops;
/* Convert host signal to our signals. */
enum target_signal
target_signal_from_host (hostsig)
int hostsig;
{
/* A switch statement would make sense but would require special kludges
to deal with the cases where more than one signal has the same number. */
if (hostsig == 0) return TARGET_SIGNAL_0;
#if defined (SIGHUP)
if (hostsig == SIGHUP) return TARGET_SIGNAL_HUP;
#endif
#if defined (SIGINT)
if (hostsig == SIGINT) return TARGET_SIGNAL_INT;
#endif
#if defined (SIGQUIT)
if (hostsig == SIGQUIT) return TARGET_SIGNAL_QUIT;
#endif
#if defined (SIGILL)
if (hostsig == SIGILL) return TARGET_SIGNAL_ILL;
#endif
#if defined (SIGTRAP)
if (hostsig == SIGTRAP) return TARGET_SIGNAL_TRAP;
#endif
#if defined (SIGABRT)
if (hostsig == SIGABRT) return TARGET_SIGNAL_ABRT;
#endif
#if defined (SIGEMT)
if (hostsig == SIGEMT) return TARGET_SIGNAL_EMT;
#endif
#if defined (SIGFPE)
if (hostsig == SIGFPE) return TARGET_SIGNAL_FPE;
#endif
#if defined (SIGKILL)
if (hostsig == SIGKILL) return TARGET_SIGNAL_KILL;
#endif
#if defined (SIGBUS)
if (hostsig == SIGBUS) return TARGET_SIGNAL_BUS;
#endif
#if defined (SIGSEGV)
if (hostsig == SIGSEGV) return TARGET_SIGNAL_SEGV;
#endif
#if defined (SIGSYS)
if (hostsig == SIGSYS) return TARGET_SIGNAL_SYS;
#endif
#if defined (SIGPIPE)
if (hostsig == SIGPIPE) return TARGET_SIGNAL_PIPE;
#endif
#if defined (SIGALRM)
if (hostsig == SIGALRM) return TARGET_SIGNAL_ALRM;
#endif
#if defined (SIGTERM)
if (hostsig == SIGTERM) return TARGET_SIGNAL_TERM;
#endif
#if defined (SIGUSR1)
if (hostsig == SIGUSR1) return TARGET_SIGNAL_USR1;
#endif
#if defined (SIGUSR2)
if (hostsig == SIGUSR2) return TARGET_SIGNAL_USR2;
#endif
#if defined (SIGCLD)
if (hostsig == SIGCLD) return TARGET_SIGNAL_CHLD;
#endif
#if defined (SIGCHLD)
if (hostsig == SIGCHLD) return TARGET_SIGNAL_CHLD;
#endif
#if defined (SIGPWR)
if (hostsig == SIGPWR) return TARGET_SIGNAL_PWR;
#endif
#if defined (SIGWINCH)
if (hostsig == SIGWINCH) return TARGET_SIGNAL_WINCH;
#endif
#if defined (SIGURG)
if (hostsig == SIGURG) return TARGET_SIGNAL_URG;
#endif
#if defined (SIGIO)
if (hostsig == SIGIO) return TARGET_SIGNAL_IO;
#endif
#if defined (SIGPOLL)
if (hostsig == SIGPOLL) return TARGET_SIGNAL_POLL;
#endif
#if defined (SIGSTOP)
if (hostsig == SIGSTOP) return TARGET_SIGNAL_STOP;
#endif
#if defined (SIGTSTP)
if (hostsig == SIGTSTP) return TARGET_SIGNAL_TSTP;
#endif
#if defined (SIGCONT)
if (hostsig == SIGCONT) return TARGET_SIGNAL_CONT;
#endif
#if defined (SIGTTIN)
if (hostsig == SIGTTIN) return TARGET_SIGNAL_TTIN;
#endif
#if defined (SIGTTOU)
if (hostsig == SIGTTOU) return TARGET_SIGNAL_TTOU;
#endif
#if defined (SIGVTALRM)
if (hostsig == SIGVTALRM) return TARGET_SIGNAL_VTALRM;
#endif
#if defined (SIGPROF)
if (hostsig == SIGPROF) return TARGET_SIGNAL_PROF;
#endif
#if defined (SIGXCPU)
if (hostsig == SIGXCPU) return TARGET_SIGNAL_XCPU;
#endif
#if defined (SIGXFSZ)
if (hostsig == SIGXFSZ) return TARGET_SIGNAL_XFSZ;
#endif
#if defined (SIGWIND)
if (hostsig == SIGWIND) return TARGET_SIGNAL_WIND;
#endif
#if defined (SIGPHONE)
if (hostsig == SIGPHONE) return TARGET_SIGNAL_PHONE;
#endif
#if defined (SIGLOST)
if (hostsig == SIGLOST) return TARGET_SIGNAL_LOST;
#endif
#if defined (SIGWAITING)
if (hostsig == SIGWAITING) return TARGET_SIGNAL_WAITING;
#endif
#if defined (SIGLWP)
if (hostsig == SIGLWP) return TARGET_SIGNAL_LWP;
#endif
#if defined (SIGDANGER)
if (hostsig == SIGDANGER) return TARGET_SIGNAL_DANGER;
#endif
#if defined (SIGGRANT)
if (hostsig == SIGGRANT) return TARGET_SIGNAL_GRANT;
#endif
#if defined (SIGRETRACT)
if (hostsig == SIGRETRACT) return TARGET_SIGNAL_RETRACT;
#endif
#if defined (SIGMSG)
if (hostsig == SIGMSG) return TARGET_SIGNAL_MSG;
#endif
#if defined (SIGSOUND)
if (hostsig == SIGSOUND) return TARGET_SIGNAL_SOUND;
#endif
#if defined (SIGSAK)
if (hostsig == SIGSAK) return TARGET_SIGNAL_SAK;
#endif
return TARGET_SIGNAL_UNKNOWN;
}
int
target_signal_to_host (oursig)
enum target_signal oursig;
{
switch (oursig)
{
case TARGET_SIGNAL_0: return 0;
#if defined (SIGHUP)
case TARGET_SIGNAL_HUP: return SIGHUP;
#endif
#if defined (SIGINT)
case TARGET_SIGNAL_INT: return SIGINT;
#endif
#if defined (SIGQUIT)
case TARGET_SIGNAL_QUIT: return SIGQUIT;
#endif
#if defined (SIGILL)
case TARGET_SIGNAL_ILL: return SIGILL;
#endif
#if defined (SIGTRAP)
case TARGET_SIGNAL_TRAP: return SIGTRAP;
#endif
#if defined (SIGABRT)
case TARGET_SIGNAL_ABRT: return SIGABRT;
#endif
#if defined (SIGEMT)
case TARGET_SIGNAL_EMT: return SIGEMT;
#endif
#if defined (SIGFPE)
case TARGET_SIGNAL_FPE: return SIGFPE;
#endif
#if defined (SIGKILL)
case TARGET_SIGNAL_KILL: return SIGKILL;
#endif
#if defined (SIGBUS)
case TARGET_SIGNAL_BUS: return SIGBUS;
#endif
#if defined (SIGSEGV)
case TARGET_SIGNAL_SEGV: return SIGSEGV;
#endif
#if defined (SIGSYS)
case TARGET_SIGNAL_SYS: return SIGSYS;
#endif
#if defined (SIGPIPE)
case TARGET_SIGNAL_PIPE: return SIGPIPE;
#endif
#if defined (SIGALRM)
case TARGET_SIGNAL_ALRM: return SIGALRM;
#endif
#if defined (SIGTERM)
case TARGET_SIGNAL_TERM: return SIGTERM;
#endif
#if defined (SIGUSR1)
case TARGET_SIGNAL_USR1: return SIGUSR1;
#endif
#if defined (SIGUSR2)
case TARGET_SIGNAL_USR2: return SIGUSR2;
#endif
#if defined (SIGCHLD) || defined (SIGCLD)
case TARGET_SIGNAL_CHLD:
#if defined (SIGCHLD)
return SIGCHLD;
#else
return SIGCLD;
#endif
#endif /* SIGCLD or SIGCHLD */
#if defined (SIGPWR)
case TARGET_SIGNAL_PWR: return SIGPWR;
#endif
#if defined (SIGWINCH)
case TARGET_SIGNAL_WINCH: return SIGWINCH;
#endif
#if defined (SIGURG)
case TARGET_SIGNAL_URG: return SIGURG;
#endif
#if defined (SIGIO)
case TARGET_SIGNAL_IO: return SIGIO;
#endif
#if defined (SIGPOLL)
case TARGET_SIGNAL_POLL: return SIGPOLL;
#endif
#if defined (SIGSTOP)
case TARGET_SIGNAL_STOP: return SIGSTOP;
#endif
#if defined (SIGTSTP)
case TARGET_SIGNAL_TSTP: return SIGTSTP;
#endif
#if defined (SIGCONT)
case TARGET_SIGNAL_CONT: return SIGCONT;
#endif
#if defined (SIGTTIN)
case TARGET_SIGNAL_TTIN: return SIGTTIN;
#endif
#if defined (SIGTTOU)
case TARGET_SIGNAL_TTOU: return SIGTTOU;
#endif
#if defined (SIGVTALRM)
case TARGET_SIGNAL_VTALRM: return SIGVTALRM;
#endif
#if defined (SIGPROF)
case TARGET_SIGNAL_PROF: return SIGPROF;
#endif
#if defined (SIGXCPU)
case TARGET_SIGNAL_XCPU: return SIGXCPU;
#endif
#if defined (SIGXFSZ)
case TARGET_SIGNAL_XFSZ: return SIGXFSZ;
#endif
#if defined (SIGWIND)
case TARGET_SIGNAL_WIND: return SIGWIND;
#endif
#if defined (SIGPHONE)
case TARGET_SIGNAL_PHONE: return SIGPHONE;
#endif
#if defined (SIGLOST)
case TARGET_SIGNAL_LOST: return SIGLOST;
#endif
#if defined (SIGWAITING)
case TARGET_SIGNAL_WAITING: return SIGWAITING;
#endif
#if defined (SIGLWP)
case TARGET_SIGNAL_LWP: return SIGLWP;
#endif
#if defined (SIGDANGER)
case TARGET_SIGNAL_DANGER: return SIGDANGER;
#endif
#if defined (SIGGRANT)
case TARGET_SIGNAL_GRANT: return SIGGRANT;
#endif
#if defined (SIGRETRACT)
case TARGET_SIGNAL_RETRACT: return SIGRETRACT;
#endif
#if defined (SIGMSG)
case TARGET_SIGNAL_MSG: return SIGMSG;
#endif
#if defined (SIGSOUND)
case TARGET_SIGNAL_SOUND: return SIGSOUND;
#endif
#if defined (SIGSAK)
case TARGET_SIGNAL_SAK: return SIGSAK;
#endif
default:
/* The user might be trying to do "signal SIGSAK" where this system
doesn't have SIGSAK. */
warning ("Signal %s does not exist on this system.\n",
target_signal_to_name (oursig));
return 0;
}
}
/* Helper function for child_wait and the Lynx derivatives of child_wait.
HOSTSTATUS is the waitstatus from wait() or the equivalent; store our
translation of that in OURSTATUS. */
void
store_waitstatus (ourstatus, hoststatus)
struct target_waitstatus *ourstatus;
int hoststatus;
{
if (WIFEXITED (hoststatus))
{
ourstatus->kind = TARGET_WAITKIND_EXITED;
ourstatus->value.integer = WEXITSTATUS (hoststatus);
}
else if (!WIFSTOPPED (hoststatus))
{
ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
ourstatus->value.sig = target_signal_from_host (WTERMSIG (hoststatus));
}
else
{
ourstatus->kind = TARGET_WAITKIND_STOPPED;
ourstatus->value.sig = target_signal_from_host (WSTOPSIG (hoststatus));
}
}
#ifndef CHILD_WAIT
/* Wait for child to do something. Return pid of child, or -1 in case
of error; store status through argument pointer STATUS. */
of error; store status through argument pointer OURSTATUS. */
static int
child_wait (pid, status)
child_wait (pid, ourstatus)
int pid;
int *status;
struct target_waitstatus *ourstatus;
{
int save_errno;
int status;
do {
if (attach_flag)
set_sigint_trap(); /* Causes SIGINT to be passed on to the
attached process. */
pid = wait (status);
pid = wait (&status);
save_errno = errno;
if (attach_flag)
@ -93,12 +415,15 @@ child_wait (pid, status)
{
if (save_errno == EINTR)
continue;
fprintf (stderr, "Child process unexpectedly missing: %s.\n",
fprintf_unfiltered (gdb_stderr, "Child process unexpectedly missing: %s.\n",
safe_strerror (save_errno));
*status = 42; /* Claim it exited with signal 42 */
/* Claim it exited with unknown signal. */
ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
return -1;
}
} while (pid != inferior_pid); /* Some other child died or stopped */
store_waitstatus (ourstatus, status);
return pid;
}
#endif /* CHILD_WAIT */
@ -130,12 +455,12 @@ child_attach (args, from_tty)
exec_file = (char *) get_exec_file (0);
if (exec_file)
printf ("Attaching to program `%s', %s\n", exec_file,
printf_unfiltered ("Attaching to program `%s', %s\n", exec_file,
target_pid_to_str (pid));
else
printf ("Attaching to %s\n", target_pid_to_str (pid));
printf_unfiltered ("Attaching to %s\n", target_pid_to_str (pid));
fflush (stdout);
gdb_flush (gdb_stdout);
}
attach (pid);
@ -168,9 +493,9 @@ child_detach (args, from_tty)
char *exec_file = get_exec_file (0);
if (exec_file == 0)
exec_file = "";
printf ("Detaching from program: %s %s\n", exec_file,
printf_unfiltered ("Detaching from program: %s %s\n", exec_file,
target_pid_to_str (inferior_pid));
fflush (stdout);
gdb_flush (gdb_stdout);
}
if (args)
siggnal = atoi (args);
@ -204,7 +529,7 @@ static void
child_files_info (ignore)
struct target_ops *ignore;
{
printf ("\tUsing the running image of %s %s.\n",
printf_unfiltered ("\tUsing the running image of %s %s.\n",
attach_flag? "attached": "child", target_pid_to_str (inferior_pid));
}
@ -235,6 +560,13 @@ ptrace_him (pid)
int pid;
{
push_target (&child_ops);
#ifdef START_INFERIOR_TRAPS_EXPECTED
startup_inferior (START_INFERIOR_TRAPS_EXPECTED);
#else
/* One trap to exec the shell, one to exec the program being debugged. */
startup_inferior (2);
#endif
}
/* Start an inferior Unix child process and sets inferior_pid to its pid.
@ -251,7 +583,7 @@ child_create_inferior (exec_file, allargs, env)
fork_inferior (exec_file, allargs, env, ptrace_me, ptrace_him);
/* We are at the first instruction we care about. */
/* Pedal to the metal... */
proceed ((CORE_ADDR) -1, 0, 0);
proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0);
}
static void

View File

@ -213,12 +213,12 @@ store_inferior_registers (regno)
}
/* Wait for child to do something. Return pid of child, or -1 in case
of error; store status through argument pointer STATUS. */
of error; store status through argument pointer OURSTATUS. */
int
child_wait (pid, status)
int pid;
int *status;
struct target_waitstatus *ourstatus;
{
int save_errno;
int thread;
@ -242,7 +242,9 @@ child_wait (pid, status)
continue;
fprintf_unfiltered (gdb_stderr, "Child process unexpectedly missing: %s.\n",
safe_strerror (save_errno));
*status = 42; /* Claim it exited with signal 42 */
/* Claim it exited with unknown signal. */
ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
return -1;
}
@ -263,6 +265,8 @@ child_wait (pid, status)
pid = BUILDPID (pid, thread);
store_waitstatus (ourstatus, status);
return pid;
}
}

View File

@ -1209,14 +1209,14 @@ int mach_really_waiting;
There is no other way to exit this loop.
Returns the inferior_pid for rest of gdb.
Side effects: Set unix exit value to *w.
*/
Side effects: Set *OURSTATUS. */
int
mach_really_wait (w)
WAITTYPE *w;
struct target_waitstatus *ourstatus;
{
int pid;
kern_return_t ret;
int w;
struct msg {
mach_msg_header_t header;
@ -1258,7 +1258,7 @@ mach_really_wait (w)
{
/* Collect Unix exit status for gdb */
wait3(w, WNOHANG, 0);
wait3(&w, WNOHANG, 0);
/* This mess is here to check that the rest of
* gdb knows that the inferior died. It also
@ -1267,25 +1267,26 @@ mach_really_wait (w)
* has happened to it's children when mach-magic
* is applied on them.
*/
if ((!WIFEXITED(*w) && WIFSTOPPED(*w)) ||
(WIFEXITED(*w) && WEXITSTATUS(*w) > 0377))
if ((!WIFEXITED(w) && WIFSTOPPED(w)) ||
(WIFEXITED(w) && WEXITSTATUS(w) > 0377))
{
WSETEXIT(*w, 0);
WSETEXIT(w, 0);
warning ("Using exit value 0 for terminated task");
}
else if (!WIFEXITED(*w))
else if (!WIFEXITED(w))
{
int sig = WTERMSIG(*w);
int sig = WTERMSIG(w);
/* Signals cause problems. Warn the user. */
if (sig != SIGKILL) /* Bad luck if garbage matches this */
warning ("The terminating signal stuff may be nonsense");
else if (sig > NSIG)
{
WSETEXIT(*w, 0);
WSETEXIT(w, 0);
warning ("Using exit value 0 for terminated task");
}
}
store_waitstatus (ourstatus, w);
return inferior_pid;
}
}
@ -1316,10 +1317,11 @@ mach_really_wait (w)
if (stopped_in_exception)
{
/* Get unix state. May be changed in mach3_exception_actions() */
wait3(w, WNOHANG, 0);
wait3(&w, WNOHANG, 0);
mach3_exception_actions (w, FALSE, "Task");
mach3_exception_actions (&w, FALSE, "Task");
store_waitstatus (ourstatus, w);
return inferior_pid;
}
}
@ -3908,7 +3910,7 @@ void
m3_resume (pid, step, signal)
int pid;
int step;
int signal;
enum target_signal signal;
{
kern_return_t ret;
@ -3938,7 +3940,7 @@ m3_resume (pid, step, signal)
vm_read_cache_valid = FALSE;
if (signal && inferior_pid > 0) /* Do not signal, if attached by MID */
kill (inferior_pid, signal);
kill (inferior_pid, target_signal_to_host (signal));
if (step)
{

View File

@ -736,13 +736,13 @@ solib_create_inferior_hook()
clear_proceed_status ();
stop_soon_quietly = 1;
stop_signal = 0;
stop_signal = TARGET_SIGNAL_0;
do
{
target_resume (-1, 0, stop_signal);
wait_for_inferior ();
}
while (stop_signal != SIGTRAP);
while (stop_signal != TARGET_SIGNAL_TRAP);
/* solib_add will call reinit_frame_cache via symbol_file_add.
But we are stopped in the runtime loader and we do not have symbols

View File

@ -1564,9 +1564,9 @@ procfs_notice_signals (pid)
for (signo = 0; signo < NSIG; signo++)
{
if (signal_stop_state (signo) == 0 &&
signal_print_state (signo) == 0 &&
signal_pass_state (signo) == 1)
if (signal_stop_state (target_signal_from_host (signo)) == 0 &&
signal_print_state (target_signal_from_host (signo)) == 0 &&
signal_pass_state (target_signal_from_host (signo)) == 1)
{
prdelset (&pi->prrun.pr_trace, signo);
}
@ -2217,7 +2217,7 @@ NOTES
static int
procfs_wait (pid, statloc)
int pid;
int *statloc;
struct target_waitstatus *ourstatus;
{
short what;
short why;
@ -2402,15 +2402,14 @@ wait_again:
pi->prstatus.pr_flags);
}
if (statloc)
{
*statloc = statval;
}
store_waitstatus (ourstatus, statval);
if (rtnval == -1) /* No more children to wait for */
{
fprintf_unfiltered (gdb_stderr, "Child process unexpectedly missing.\n");
*statloc = 42; /* Claim it exited with signal 42 */
/* Claim it exited with unknown signal. */
ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
return rtnval;
}
@ -2493,7 +2492,7 @@ static void
procfs_resume (pid, step, signo)
int pid;
int step;
int signo;
enum target_signal signo;
{
int signal_to_pass;
struct procinfo *pi, *procinfo;
@ -2523,7 +2522,7 @@ procfs_resume (pid, step, signo)
#endif
#endif
if (signo == SIGSTOP && pi->nopass_next_sigstop)
if (signo == TARGET_SIGNAL_STOP && pi->nopass_next_sigstop)
/* When attaching to a child process, if we forced it to stop with
a PIOCSTOP, then we will have set the nopass_next_sigstop flag.
Upon resuming the first time after such a stop, we explicitly
@ -2535,7 +2534,7 @@ procfs_resume (pid, step, signo)
deal with the inferior a little smarter, and possibly even allow
an inferior to continue running at the same time as gdb. (FIXME?) */
signal_to_pass = 0;
else if (signo == SIGTSTP
else if (signo == TARGET_SIGNAL_TSTP
&& pi->prstatus.pr_cursig == SIGTSTP
&& pi->prstatus.pr_action.sa_handler == SIG_DFL)
@ -2555,7 +2554,7 @@ procfs_resume (pid, step, signo)
because the handler needs to get executed. */
signal_to_pass = 0;
else
signal_to_pass = signo;
signal_to_pass = target_signal_to_host (signo);
if (signal_to_pass)
{
@ -3475,7 +3474,7 @@ procfs_create_inferior (exec_file, allargs, env)
procfs_set_sproc_trap (current_procinfo);
#endif
proceed ((CORE_ADDR) -1, 0, 0);
proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0);
}
/* Clean up after the inferior dies. */

View File

@ -650,7 +650,8 @@ adapt_detach (args,from_tty)
void
adapt_resume (pid, step, sig)
int pid, step, sig;
int pid, step;
enum target_signal sig;
{
if (step)
{
@ -680,7 +681,7 @@ adapt_resume (pid, step, sig)
int
adapt_wait (status)
WAITTYPE *status;
struct target_waitstatus *status;
{
/* Strings to look for. '?' means match any single character.
Note that with the algorithm we use, the initial character
@ -705,11 +706,13 @@ adapt_wait (status)
int old_timeout = timeout;
int old_immediate_quit = immediate_quit;
WSETEXIT ((*status), 0);
status->kind = TARGET_WAITKIND_EXITED;
status->value.integer = 0;
if (need_artificial_trap != 0)
{
WSETSTOP ((*status), SIGTRAP);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TRAP;
need_artificial_trap--;
return 0;
}
@ -750,9 +753,15 @@ adapt_wait (status)
}
expect_prompt ();
if (*bp== '\0')
WSETSTOP ((*status), SIGTRAP);
{
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TRAP;
}
else
WSETEXIT ((*status), 0);
{
status->kind = TARGET_WAITKIND_EXITED;
status->value.integer = 0;
}
timeout = old_timeout;
immediate_quit = old_immediate_quit;
return 0;

View File

@ -242,7 +242,8 @@ bug_open (args, from_tty)
void
bug_resume (pid, step, sig)
int pid, step, sig;
int pid, step;
enum target_signal sig;
{
dcache_flush (gr_get_dcache());
@ -275,12 +276,13 @@ static char *wait_strings[] = {
int
bug_wait (pid, status)
int pid;
WAITTYPE *status;
struct target_waitstatus *status;
{
int old_timeout = sr_get_timeout();
int old_immediate_quit = immediate_quit;
WSETEXIT ((*status), 0);
status->kind = TARGET_WAITKIND_EXITED;
status->value.integer = 0;
/* read off leftovers from resume so that the rest can be passed
back out as stdout. */
@ -297,13 +299,15 @@ bug_wait (pid, status)
switch (gr_multi_scan(wait_strings, need_artificial_trap == 0))
{
case 0: /* breakpoint case */
WSETSTOP ((*status), SIGTRAP);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TRAP;
/* user output from the target can be discarded here. (?) */
gr_expect_prompt();
break;
case 1: /* bus error */
WSETSTOP ((*status), SIGBUS);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_BUS;
/* user output from the target can be discarded here. (?) */
gr_expect_prompt();
break;
@ -313,14 +317,16 @@ bug_wait (pid, status)
if (need_artificial_trap != 0)
{
/* stepping */
WSETSTOP ((*status), SIGTRAP);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TRAP;
need_artificial_trap--;
break;
}
else
{
/* exit case */
WSETEXIT ((*status), 0);
status->kind = TARGET_WAITKIND_EXITED;
status->value.integer = 0;
break;
}

View File

@ -476,7 +476,8 @@ eb_detach (from_tty)
void
eb_resume (pid, step, sig)
int pid, step, sig;
int pid, step;
enum target_signal sig;
{
if (step)
{
@ -517,7 +518,7 @@ eb_resume (pid, step, sig)
int
eb_wait (status)
WAITTYPE *status;
struct target_waitstatus *status;
{
/* Strings to look for. '?' means match any single character.
Note that with the algorithm we use, the initial character
@ -542,11 +543,13 @@ eb_wait (status)
int old_timeout = timeout;
WSETEXIT ((*status), 0);
status->kind = TARGET_WAITKIND_EXITED;
status->value.integer = 0;
if (need_artificial_trap != 0)
{
WSETSTOP ((*status), SIGTRAP);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TRAP;
need_artificial_trap--;
return 0;
}
@ -595,9 +598,15 @@ eb_wait (status)
}
expect_prompt ();
if (*bp== '\0')
WSETSTOP ((*status), SIGTRAP);
{
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TRAP;
}
else
WSETEXIT ((*status), 0);
{
status->kind = TARGET_WAITKIND_EXITED;
status->value.integer = 0;
}
timeout = old_timeout;
return 0;

View File

@ -161,8 +161,7 @@ es1800_prepare_to_store PARAMS ((void));
static int
es1800_wait PARAMS ((WAITTYPE *));
static void
es1800_resume PARAMS ((int, int, int));
static void es1800_resume PARAMS ((int, int, enum target_signal));
static void
es1800_detach PARAMS ((char *, int));
@ -654,7 +653,7 @@ static void
es1800_resume (pid, step, siggnal)
int pid;
int step;
int siggnal;
enum target_signal siggnal;
{
char buf[PBUFSIZ];
@ -679,12 +678,14 @@ es1800_resume (pid, step, siggnal)
static int
es1800_wait (status)
WAITTYPE *status;
struct target_waitstatus *status;
{
unsigned char buf[PBUFSIZ];
int old_timeout = timeout;
WSETEXIT ((*status), 0);
status->kind = TARGET_WAITKIND_EXITED;
status->value.integer = 0;
timeout = 0; /* Don't time out -- user program is running. */
if (!setjmp (interrupt))
{
@ -694,7 +695,8 @@ es1800_wait (status)
getmessage (buf, sizeof(buf));
if (strncmp ( buf, "\r\n* BREAK *", 11) == 0)
{
WSETSTOP ((*status), SIGTRAP);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TRAP;
send_command ("STP"); /* Restore stack and PC and such */
if (m68020)
{
@ -704,7 +706,8 @@ es1800_wait (status)
}
if (strncmp (buf, "STP\r\n ", 6) == 0)
{
WSETSTOP ((*status), SIGTRAP);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TRAP;
break;
}
if (buf[strlen (buf) - 2] == 'R')
@ -714,7 +717,8 @@ es1800_wait (status)
else
{
printf ("Unexpected stop: \n%s\n", buf);
WSETSTOP ((*status), SIGQUIT);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_QUIT;
break;
}
}
@ -728,7 +732,8 @@ es1800_wait (status)
old_sigint = signal (SIGINT, es1800_request_quit);
send_command ("STP");
printf (" emulator stopped\n");
WSETSTOP ((*status), SIGINT);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_INT;
}
else
{

View File

@ -639,7 +639,8 @@ hms_detach (args, from_tty)
void
hms_resume (pid, step, sig)
int pid, step, sig;
int pid, step;
enum target_signal sig;
{
dcache_flush ();
@ -666,7 +667,7 @@ hms_resume (pid, step, sig)
int
hms_wait (pid, status)
int pid;
WAITTYPE *status;
struct target_waitstatus *status;
{
/* Strings to look for. '?' means match any single character.
Note that with the algorithm we use, the initial character
@ -694,11 +695,13 @@ hms_wait (pid, status)
int old_immediate_quit = immediate_quit;
int swallowed_cr = 0;
WSETEXIT ((*status), 0);
status->kind = TARGET_WAITKIND_EXITED;
status->value.integer = 0;
if (need_artificial_trap != 0)
{
WSETSTOP ((*status), SIGTRAP);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TRAP;
need_artificial_trap--;
return 0;
}
@ -758,12 +761,14 @@ hms_wait (pid, status)
}
if (*bp == '\0')
{
WSETSTOP ((*status), SIGTRAP);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TRAP;
expect_prompt ();
}
else
{
WSETEXIT ((*status), 0);
status->kind = TARGET_WAITKIND_EXITED;
status->value.integer = 0;
}
timeout = old_timeout;

View File

@ -72,8 +72,8 @@ mips_close PARAMS ((int quitting));
static void
mips_detach PARAMS ((char *args, int from_tty));
static void
mips_resume PARAMS ((int pid, int step, int siggnal));
static void mips_resume PARAMS ((int pid, int step,
enum target_signal siggnal));
static int
mips_wait PARAMS ((int pid, WAITTYPE *status));
@ -1011,11 +1011,13 @@ mips_detach (args, from_tty)
static void
mips_resume (pid, step, siggnal)
int pid, step, siggnal;
int pid, step;
enum target_signal siggnal;
{
if (siggnal)
mips_error ("Can't send signals to a remote system. Try `handle %d ignore'.",
siggnal);
if (siggnal != TARGET_SIGNAL_0)
warning
("Can't send signals to a remote system. Try `handle %s ignore'.",
target_signal_to_name (siggnal));
mips_request (step ? 's' : 'c',
(unsigned int) 1,
@ -1029,7 +1031,7 @@ mips_resume (pid, step, siggnal)
static int
mips_wait (pid, status)
int pid;
WAITTYPE *status;
struct target_waitstatus *status;
{
int rstatus;
int err;
@ -1039,7 +1041,8 @@ mips_wait (pid, status)
indicating that it is stopped. */
if (! mips_need_reply)
{
WSETSTOP (*status, SIGTRAP);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TRAP;
return 0;
}
@ -1048,16 +1051,32 @@ mips_wait (pid, status)
if (err)
mips_error ("Remote failure: %s", safe_strerror (errno));
/* FIXME: The target board uses numeric signal values which are
those used on MIPS systems. If the host uses different signal
values, we need to translate here. I believe all Unix systems
use the same values for the signals the board can return, which
are: SIGINT, SIGSEGV, SIGBUS, SIGILL, SIGFPE, SIGTRAP. */
/* FIXME: The target board uses a standard Unix wait status int. If
the host system does not, we must translate here. */
*status = rstatus;
/* Translate a MIPS waitstatus. We use constants here rather than WTERMSIG
and so on, because the constants we want here are determined by the
MIPS protocol and have nothing to do with what host we are running on. */
if ((rstatus & 0x377) == 0)
{
status->kind = TARGET_WAITKIND_EXITED;
status->value.integer = (((rstatus) >> 8) & 0377);
}
else if ((rstatus & 0x377) == 0x177)
{
status->kind = TARGET_WAIT_KIND_STOPPED;
/* Don't want to use target_signal_from_host because we are converting
from MIPS signal numbers, not host ones. Our internal numbers
match the MIPS numbers for the signals the board can return, which
are: SIGINT, SIGSEGV, SIGBUS, SIGILL, SIGFPE, SIGTRAP. */
status->value.sig = (enum target_signal) (((rstatus) >> 8) & 0377);
}
else
{
status->kind = TARGET_WAITKIND_SIGNALLED;
/* Don't want to use target_signal_from_host because we are converting
from MIPS signal numbers, not host ones. Our internal numbers
match the MIPS numbers for the signals the board can return, which
are: SIGINT, SIGSEGV, SIGBUS, SIGILL, SIGFPE, SIGTRAP. */
status->value.sig = (enum target_signal) (rstatus & 0x177);
}
return 0;
}

View File

@ -476,10 +476,11 @@ mm_detach (args,from_tty)
static void
mm_resume (pid, step, sig)
int pid, step, sig;
int pid, step;
enum target_signal sig;
{
if (sig)
error ("Can't send signals to a remote MiniMon system.");
if (sig != TARGET_SIGNAL_0)
warning ("Can't send signals to a remote MiniMon system.");
if (step) {
out_msg_buf->step_msg.code= STEP;
@ -499,14 +500,14 @@ mm_resume (pid, step, sig)
static int
mm_wait (status)
WAITTYPE *status;
struct target_waitstatus *status;
{
int i, result;
int old_timeout = timeout;
int old_immediate_quit = immediate_quit;
WSETEXIT ((*status), 0);
status->kind = TARGET_WAITKIND_EXITED;
status->value.integer = 0;
/* wait for message to arrive. It should be:
- A HIF service request.
@ -559,59 +560,78 @@ halted:
if (in_msg_buf->halt_msg.trap_number== 0)
{ printf("Am290*0 received vector number %d (break point)\n",
in_msg_buf->halt_msg.trap_number);
WSETSTOP ((*status), SIGTRAP);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TRAP;
}
else if (in_msg_buf->halt_msg.trap_number== 1)
{ printf("Am290*0 received vector number %d\n",
in_msg_buf->halt_msg.trap_number);
WSETSTOP ((*status), SIGBUS);
}
{
printf("Am290*0 received vector number %d\n",
in_msg_buf->halt_msg.trap_number);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_BUS;
}
else if (in_msg_buf->halt_msg.trap_number== 3
|| in_msg_buf->halt_msg.trap_number== 4)
{ printf("Am290*0 received vector number %d\n",
in_msg_buf->halt_msg.trap_number);
WSETSTOP ((*status), SIGFPE);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_FPE;
}
else if (in_msg_buf->halt_msg.trap_number== 5)
{ printf("Am290*0 received vector number %d\n",
in_msg_buf->halt_msg.trap_number);
WSETSTOP ((*status), SIGILL);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_ILL;
}
else if (in_msg_buf->halt_msg.trap_number >= 6
&& in_msg_buf->halt_msg.trap_number <= 11)
{ printf("Am290*0 received vector number %d\n",
in_msg_buf->halt_msg.trap_number);
WSETSTOP ((*status), SIGSEGV);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_SEGV;
}
else if (in_msg_buf->halt_msg.trap_number== 12
|| in_msg_buf->halt_msg.trap_number== 13)
{ printf("Am290*0 received vector number %d\n",
in_msg_buf->halt_msg.trap_number);
WSETSTOP ((*status), SIGILL);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_ILL;
}
else if (in_msg_buf->halt_msg.trap_number== 14)
{ printf("Am290*0 received vector number %d\n",
in_msg_buf->halt_msg.trap_number);
WSETSTOP ((*status), SIGALRM);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_ALRM;
}
else if (in_msg_buf->halt_msg.trap_number== 15)
WSETSTOP ((*status), SIGTRAP);
{
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TRAP;
}
else if (in_msg_buf->halt_msg.trap_number >= 16
&& in_msg_buf->halt_msg.trap_number <= 21)
{ printf("Am290*0 received vector number %d\n",
in_msg_buf->halt_msg.trap_number);
WSETSTOP ((*status), SIGINT);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_INT;
}
else if (in_msg_buf->halt_msg.trap_number== 22)
{ printf("Am290*0 received vector number %d\n",
in_msg_buf->halt_msg.trap_number);
WSETSTOP ((*status), SIGILL);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_ILL;
} /* BREAK message was sent */
else if (in_msg_buf->halt_msg.trap_number== 75)
WSETSTOP ((*status), SIGTRAP);
{
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TRAP;
}
else
exit:
WSETEXIT ((*status), 0);
{
status->kind = TARGET_WAITKIND_EXITED;
status->value.integer = 0;
}
timeout = old_timeout; /* Restore original timeout value */
immediate_quit = old_immediate_quit;

View File

@ -435,7 +435,8 @@ monitor_detach (from_tty)
*/
static void
monitor_resume (pid, step, sig)
int pid, step, sig;
int pid, step;
enum target_signal sig;
{
#ifdef LOG_FILE
fprintf (log_file, "\nIn Resume (step=%d, sig=%d)\n", step, sig);
@ -463,20 +464,22 @@ monitor_resume (pid, step, sig)
static int
monitor_wait (pid, status)
int pid;
WAITTYPE *status;
struct target_waitstatus *status;
{
int old_timeout = timeout;
#ifdef LOG_FILE
fputs ("\nIn wait ()", log_file);
#endif
WSETEXIT ((*status), 0);
status->kind = TARGET_WAITKIND_EXITED;
status->value.integer = 0;
timeout = 0; /* Don't time out -- user program is running. */
expect_prompt(0); /* Wait for prompt, outputting extraneous text */
WSETSTOP ((*status), SIGTRAP);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TRAP;
timeout = old_timeout;

View File

@ -256,10 +256,11 @@ non_dle( buf, n )
void
nindy_resume (pid, step, siggnal)
int pid, step, siggnal;
int pid, step;
enum target_signal siggnal;
{
if (siggnal != 0 && siggnal != stop_signal)
error ("Can't send signals to remote NINDY targets.");
if (siggnal != TARGET_SIGNAL_0 && siggnal != stop_signal)
warning ("Can't send signals to remote NINDY targets.");
dcache_flush(nindy_dcache);
if ( regs_changed ){
@ -301,7 +302,7 @@ You may need to reset the 80960 and/or reload your program.\n");
static int
nindy_wait( pid, status )
int pid;
WAITTYPE *status;
struct target_waitstatus *status;
{
fd_set fds;
char buf[500]; /* FIXME, what is "500" here? */
@ -312,7 +313,8 @@ nindy_wait( pid, status )
struct cleanup *old_cleanups;
long ip_value, fp_value, sp_value; /* Reg values from stop */
WSETEXIT( (*status), 0 );
status->kind = TARGET_WAITKIND_EXITED;
status->value.integer = 0;
/* OPERATE IN PASSTHROUGH MODE UNTIL NINDY SENDS A DLE CHARACTER */
@ -391,30 +393,13 @@ nindy_wait( pid, status )
if (stop_exit)
{
/* User program exited */
WSETEXIT ((*status), stop_code);
status->kind = TARGET_WAITKIND_EXITED;
status->value.integer = stop_code;
}
else
{
/* Fault or trace */
switch (stop_code)
{
case STOP_GDB_BPT:
case TRACE_STEP:
/* Breakpoint or single stepping. */
stop_code = SIGTRAP;
break;
default:
/* The target is not running Unix, and its faults/traces do
not map nicely into Unix signals. Make sure they do not
get confused with Unix signals by numbering them with
values higher than the highest legal Unix signal. code
in i960_print_fault(), called via PRINT_RANDOM_SIGNAL,
will interpret the value. */
stop_code += NSIG;
break;
}
WSETSTOP ((*status), stop_code);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = i960_fault_to_signal (stop_code);
}
return inferior_pid;
}

View File

@ -276,12 +276,13 @@ gdbsim_detach (args,from_tty)
static void
gdbsim_resume (pid, step, siggnal)
int pid, step, siggnal;
int pid, step;
enum target_signal siggnal;
{
if (sr_get_debug ())
printf_filtered ("gdbsim_resume: step %d, signal %d\n", step, siggnal);
sim_resume (step, siggnal);
sim_resume (step, target_signal_to_host (siggnal));
}
/* Wait for inferior process to do something. Return pid of child,
@ -291,20 +292,35 @@ gdbsim_resume (pid, step, siggnal)
static int
gdbsim_wait (pid, status)
int pid;
WAITTYPE *status;
struct target_waitstatus *status;
{
int sigrc;
enum sim_stop reason;
if (sr_get_debug ())
printf_filtered ("gdbsim_wait: ");
printf_filtered ("gdbsim_wait\n");
sim_stop_reason (&reason, &sigrc);
if (reason == sim_exited)
WSETEXIT (*status, sigrc);
else
WSETSTOP (*status, sigrc);
if (sr_get_debug ())
printf_filtered ("status %d\n", *status);
switch (reason)
{
case sim_exited:
status->kind = TARGET_WAITKIND_EXITED;
status->value.integer = sigrc;
break;
case sim_stopped:
status->kind = TARGET_WAITKIND_STOPPED;
/* The signal in sigrc is a host signal. That probably
should be fixed. */
status->value.sig = target_signal_from_host (sigrc);
break;
case sim_signalled:
status->kind = TARGET_WAITKIND_SIGNALLED;
/* The signal in sigrc is a host signal. That probably
should be fixed. */
status->value.sig = target_signal_from_host (sigrc);
break;
}
return inferior_pid;
}

View File

@ -355,7 +355,8 @@ st2000_detach (from_tty)
static void
st2000_resume (pid, step, sig)
int pid, step, sig;
int pid, step;
enum target_signal sig;
{
if (step)
{
@ -376,17 +377,19 @@ st2000_resume (pid, step, sig)
static int
st2000_wait (status)
WAITTYPE *status;
struct target_waitstatus *status;
{
int old_timeout = timeout;
WSETEXIT ((*status), 0);
status->kind = TARGET_WAITKIND_EXITED;
status->value.integer = 0;
timeout = 0; /* Don't time out -- user program is running. */
expect_prompt(0); /* Wait for prompt, outputting extraneous text */
WSETSTOP ((*status), SIGTRAP);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TRAP;
timeout = old_timeout;

View File

@ -361,7 +361,8 @@ udi_detach (args,from_tty)
static void
udi_resume (pid, step, sig)
int pid, step, sig;
int pid, step;
enum target_signal sig;
{
UDIError tip_error;
UDIUInt32 Steps = 1;
@ -389,7 +390,7 @@ udi_resume (pid, step, sig)
static int
udi_wait (pid, status)
int pid;
WAITTYPE *status;
struct target_waitstatus *status;
{
UDIInt32 MaxTime;
UDIPId PId;
@ -399,7 +400,8 @@ udi_wait (pid, status)
int old_immediate_quit = immediate_quit;
int i;
WSETEXIT ((*status), 0);
status->kind = TARGET_WAITKIND_EXITED;
status->value.integer = 0;
/* wait for message to arrive. It should be:
If the target stops executing, udi_wait() should return.
@ -467,17 +469,22 @@ udi_wait (pid, status)
{
case 0: /* Illegal opcode */
printf_unfiltered(" (break point)\n");
WSETSTOP ((*status), SIGTRAP);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TRAP;
break;
case 1: /* Unaligned Access */
WSETSTOP ((*status), SIGBUS);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_BUS;
break;
case 3:
case 4:
WSETSTOP ((*status), SIGFPE);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_FPE;
break;
case 5: /* Protection Violation */
WSETSTOP ((*status), SIGILL);
status->kind = TARGET_WAITKIND_STOPPED;
/* Why not SEGV? What is a Protection Violation? */
status->value.sig = TARGET_SIGNAL_ILL;
break;
case 6:
case 7:
@ -485,17 +492,21 @@ udi_wait (pid, status)
case 9: /* User Data Mapping Miss */
case 10: /* Supervisor Instruction Mapping Miss */
case 11: /* Supervisor Data Mapping Miss */
WSETSTOP ((*status), SIGSEGV);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_SEGV;
break;
case 12:
case 13:
WSETSTOP ((*status), SIGILL);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_ILL;
break;
case 14: /* Timer */
WSETSTOP ((*status), SIGALRM);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_ALRM;
break;
case 15: /* Trace */
WSETSTOP ((*status), SIGTRAP);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TRAP;
break;
case 16: /* INTR0 */
case 17: /* INTR1 */
@ -503,40 +514,52 @@ udi_wait (pid, status)
case 19: /* INTR3/Internal */
case 20: /* TRAP0 */
case 21: /* TRAP1 */
WSETSTOP ((*status), SIGINT);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_INT;
break;
case 22: /* Floating-Point Exception */
WSETSTOP ((*status), SIGILL);
status->kind = TARGET_WAITKIND_STOPPED;
/* Why not FPE? */
status->value.sig = TARGET_SIGNAL_ILL;
break;
case 77: /* assert 77 */
WSETSTOP ((*status), SIGTRAP);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TRAP;
break;
default:
WSETEXIT ((*status), 0);
status->kind = TARGET_WAITKIND_EXITED;
status->value.integer = 0;
}
break;
case UDINotExecuting:
WSETSTOP ((*status), SIGTERM);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TERM;
break;
case UDIStopped:
WSETSTOP ((*status), SIGTSTP);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TSTP;
break;
case UDIWarned:
WSETSTOP ((*status), SIGURG);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_URG;
break;
case UDIStepped:
case UDIBreak:
WSETSTOP ((*status), SIGTRAP);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TRAP;
break;
case UDIWaiting:
WSETSTOP ((*status), SIGSTOP);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_STOP;
break;
case UDIHalted:
WSETSTOP ((*status), SIGKILL);
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_KILL;
break;
case UDIExited:
default:
WSETEXIT ((*status), 0);
status->kind = TARGET_WAITKIND_EXITED;
status->value.integer = 0;
}
timeout = old_timeout; /* Restore original timeout value */

View File

@ -577,7 +577,7 @@ static void
vx_resume (pid, step, siggnal)
int pid;
int step;
int siggnal;
enum target_signal siggnal;
{
int status;
Rptrace ptrace_in;
@ -860,10 +860,9 @@ sleep_ms (ms)
static int
vx_wait (pid_to_wait_for, status)
int pid_to_wait_for;
int *status;
struct target_waitstatus *status;
{
register int pid;
WAITTYPE w;
RDB_EVENT rdbEvent;
int quit_failed;
@ -912,51 +911,48 @@ vx_wait (pid_to_wait_for, status)
local_hex_string((unsigned long) pid));
} while (pid == 0);
/* FIXME, eventually do more then SIGTRAP on everything... */
/* The mostly likely kind. */
status->kind = TARGET_WAITKIND_STOPPED;
switch (rdbEvent.eventType)
{
case EVENT_EXIT:
WSETEXIT (w, 0);
status->kind = TARGET_WAITKIND_EXITED;
/* FIXME is it possible to distinguish between a
XXX normal vs abnormal exit in VxWorks? */
normal vs abnormal exit in VxWorks? */
status->value.integer = 0;
break;
case EVENT_START: /* Task was just started. */
WSETSTOP (w, SIGTRAP);
case EVENT_START:
/* Task was just started. */
status->value.sig = TARGET_SIGNAL_TRAP;
break;
case EVENT_STOP:
WSETSTOP (w, SIGTRAP);
status->value.sig = TARGET_SIGNAL_TRAP;
/* XXX was it stopped by a signal? act accordingly */
break;
case EVENT_BREAK: /* Breakpoint was hit. */
WSETSTOP (w, SIGTRAP);
status->value.sig = TARGET_SIGNAL_TRAP;
break;
case EVENT_SUSPEND: /* Task was suspended, probably by ^C. */
WSETSTOP (w, SIGINT);
status->value.sig = TARGET_SIGNAL_INT;
break;
case EVENT_BUS_ERR: /* Task made evil nasty reference. */
WSETSTOP (w, SIGBUS);
status->value.sig = TARGET_SIGNAL_BUS;
break;
case EVENT_ZERO_DIV: /* Division by zero */
WSETSTOP (w, SIGFPE); /* Like Unix, call it a float exception. */
status->value.sig = TARGET_SIGNAL_FPE;
break;
case EVENT_SIGNAL:
/* The target is not running Unix, and its
faults/traces do not map nicely into Unix signals.
Make sure they do not get confused with Unix signals
by numbering them with values higher than the highest
legal Unix signal. code in the arch-dependent PRINT_RANDOM_SIGNAL
routine will interpret the value for wait_for_inferior. */
WSETSTOP (w, rdbEvent.sigType + NSIG);
status->value.sig = i960_fault_to_signal (rdbEvent.sigType);
break;
} /* switch */
*status = *(int *)&w; /* Grumble union wait crap Grumble */
return pid;
}

View File

@ -209,6 +209,7 @@ sim_detach (args, from_tty)
/* Wait until the remote machine stops, then return,
storing status in STATUS just as `wait' would. */
#if 0
/* See remote-sim.c for how this is done now. */
int
sim_wait (pid, status)
int pid;
@ -316,9 +317,9 @@ static void
rem_resume (pid, a, b)
int pid;
int a;
int b;
enum target_signal siggnal;
{
sim_resume (a, b);
sim_resume (a, target_signal_to_host (siggnal));
}

View File

@ -310,10 +310,13 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
/* Wait for child to do something. Return pid of child, or -1 in case
of error; store status through argument pointer STATUS. */
/* FIXME: Not sparc-specific. Should be using lynx-nat.c instead; the
child_wait's are identical. */
int
child_wait (pid, status)
int pid;
int *status;
struct target_waitstatus *ourstatus;
{
int save_errno;
int thread;
@ -335,9 +338,11 @@ child_wait (pid, status)
{
if (save_errno == EINTR)
continue;
fprintf (stderr, "Child process unexpectedly missing: %s.\n",
fprintf_unfiltered (gdb_stderr, "Child process unexpectedly missing: %s.\n",
safe_strerror (save_errno));
*status = 42; /* Claim it exited with signal 42 */
/* Claim it exited with unknown signal. */
ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
return -1;
}
@ -358,6 +363,8 @@ child_wait (pid, status)
pid = BUILDPID (pid, thread);
store_waitstatus (ourstatus, status);
return pid;
}
}

View File

@ -124,7 +124,7 @@ target_command (arg, from_tty)
int from_tty;
{
fputs_filtered ("Argument required (target name). Try `help target'\n",
stdout);
gdb_stdout);
}
/* Add a possible target architecture to the list. */
@ -135,7 +135,7 @@ add_target (t)
{
if (t->to_magic != OPS_MAGIC)
{
fprintf(stderr, "Magic number of %s target struct wrong\n",
fprintf_unfiltered(gdb_stderr, "Magic number of %s target struct wrong\n",
t->to_shortname);
abort();
}
@ -214,7 +214,7 @@ default_terminal_info (args, from_tty)
char *args;
int from_tty;
{
printf("No saved terminal information.\n");
printf_unfiltered("No saved terminal information.\n");
}
#if 0
@ -257,7 +257,7 @@ kill_or_be_killed (from_tty)
{
if (target_has_execution)
{
printf ("You are already running a program:\n");
printf_unfiltered ("You are already running a program:\n");
target_files_info ();
if (query ("Kill it? ")) {
target_kill ();
@ -302,7 +302,7 @@ cleanup_target (t)
the struct definition, but not all the places that initialize one. */
if (t->to_magic != OPS_MAGIC)
{
fprintf(stderr, "Magic number of %s target struct wrong\n",
fprintf_unfiltered(gdb_stderr, "Magic number of %s target struct wrong\n",
t->to_shortname);
abort();
}
@ -621,7 +621,7 @@ target_info (args, from_tty)
int has_all_mem = 0;
if (symfile_objfile != NULL)
printf ("Symbols from \"%s\".\n", symfile_objfile->name);
printf_unfiltered ("Symbols from \"%s\".\n", symfile_objfile->name);
#ifdef FILES_INFO_HOOK
if (FILES_INFO_HOOK ())
@ -635,8 +635,8 @@ target_info (args, from_tty)
if ((int)(t->to_stratum) <= (int)dummy_stratum)
continue;
if (has_all_mem)
printf("\tWhile running this, gdb does not access memory from...\n");
printf("%s:\n", t->to_longname);
printf_unfiltered("\tWhile running this, gdb does not access memory from...\n");
printf_unfiltered("%s:\n", t->to_longname);
(t->to_files_info)(t);
has_all_mem = t->to_has_all_memory;
}
@ -672,11 +672,6 @@ target_detach (args, from_tty)
DO_DEFERRED_STORES;
#endif
(current_target->to_detach) (args, from_tty);
/* It is correct to do this because the top process can never be as high
as process_stratum now. This is needed at least in the case where
we detach a corefile, and thus need to flush the frame cache. */
generic_mourn_inferior ();
}
/* Look through the list of possible targets for a target that can
@ -763,7 +758,101 @@ find_core_target ()
return(count == 1 ? runable : NULL);
}
/* This table must match in order and size the signals in enum target_signal
in target.h. */
static struct {
char *name;
char *string;
} signals [] =
{
{"0", "Signal 0"},
{"SIGHUP", "Hangup"},
{"SIGINT", "Interrupt"},
{"SIGQUIT", "Quit"},
{"SIGILL", "Illegal instruction"},
{"SIGTRAP", "Trace/breakpoint trap"},
{"SIGABRT", "Aborted"},
{"SIGEMT", "Emulation trap"},
{"SIGFPE", "Arithmetic exception"},
{"SIGKILL", "Killed"},
{"SIGBUS", "Bus error"},
{"SIGSEGV", "Segmentation fault"},
{"SIGSYS", "Bad system call"},
{"SIGPIPE", "Broken pipe"},
{"SIGALRM", "Alarm clock"},
{"SIGTERM", "Terminated"},
{"SIGURG", "Urgent I/O condition"},
{"SIGSTOP", "Stopped (signal)"},
{"SIGTSTP", "Stopped (user)"},
{"SIGCONT", "Continued"},
{"SIGCHLD", "Child status changed"},
{"SIGTTIN", "Stopped (tty input)"},
{"SIGTTOU", "Stopped (tty output)"},
{"SIGIO", "I/O possible"},
{"SIGXCPU", "CPU time limit exceeded"},
{"SIGXFSZ", "File size limit exceeded"},
{"SIGVTALRM", "Virtual timer expired"},
{"SIGPROF", "Profiling timer expired"},
{"SIGWINCH", "Window size changed"},
{"SIGLOST", "Resource lost"},
{"SIGUSR1", "User defined signal 1"},
{"SIGUSR2", "User defined signal 2"},
{"SIGPWR", "Power fail/restart"},
{"SIGPOLL", "Pollable event occurred"},
{"SIGWIND", "SIGWIND"},
{"SIGPHONE", "SIGPHONE"},
{"SIGWAITING", "Process's LWPs are blocked"},
{"SIGLWP", "Signal LWP"},
{"SIGDANGER", "Swap space dangerously low"},
{"SIGGRANT", "Monitor mode granted"},
{"SIGRETRACT", "Need to relinguish monitor mode"},
{"SIGMSG", "Monitor mode data available"},
{"SIGSOUND", "Sound completed"},
{"SIGSAK", "Secure attention"},
{NULL, "Unknown signal"},
/* Last entry, used to check whether the table is the right size. */
{NULL, "TARGET_SIGNAL_MAGIC"}
};
/* Return the string for a signal. */
char *
target_signal_to_string (sig)
enum target_signal sig;
{
return signals[sig].string;
}
/* Return the name for a signal. */
char *
target_signal_to_name (sig)
enum target_signal sig;
{
if (sig == TARGET_SIGNAL_UNKNOWN)
/* I think the code which prints this will always print it along with
the string, so no need to be verbose. */
return "?";
return signals[sig].name;
}
/* Given a name, return its signal. */
enum target_signal
target_signal_from_name (name)
char *name;
{
enum target_signal sig;
/* It's possible we also should allow "SIGCLD" as well as "SIGCHLD"
for TARGET_SIGNAL_SIGCHLD. SIGIOT, on the other hand, is more
questionable; seems like by now people should call it SIGABRT
instead. */
for (sig = TARGET_SIGNAL_HUP; signals[sig].name != NULL; ++sig)
if (STREQ (name, signals[sig].name))
return sig;
return TARGET_SIGNAL_UNKNOWN;
}
/* Convert a normal process ID to a string. Returns the string in a static
buffer. */
@ -777,7 +866,7 @@ normal_pid_to_str (pid)
return buf;
}
static char targ_desc[] =
"Names of targets and files being debugged.\n\
Shows the entire stack of targets currently in use (including the exec-file,\n\
@ -791,4 +880,7 @@ _initialize_targets ()
add_info ("target", target_info, targ_desc);
add_info ("files", target_info, targ_desc);
if (!STREQ (signals[TARGET_SIGNAL_LAST].string, "TARGET_SIGNAL_MAGIC"))
abort ();
}

View File

@ -49,6 +49,118 @@ enum strata {
process_stratum /* Executing processes */
};
/* Stuff for target_wait. */
/* Generally, what has the program done? */
enum target_waitkind {
/* The program has exited. The exit status is in value.integer. */
TARGET_WAITKIND_EXITED,
/* The program has stopped with a signal. Which signal is in value.sig. */
TARGET_WAITKIND_STOPPED,
/* The program has terminated with a signal. Which signal is in
value.sig. */
TARGET_WAITKIND_SIGNALLED
};
/* The numbering of these signals is chosen to match traditional unix
signals (insofar as various unices use the same numbers, anyway).
It is also the numbering of the GDB remote protocol. Other remote
protocols, if they use a different numbering, should make sure to
translate appropriately. */
/* This is based strongly on Unix/POSIX signals for several reasons:
(1) This set of signals represents a widely-accepted attempt to
represent events of this sort in a portable fashion, (2) we want a
signal to make it from wait to child_wait to the user intact, (3) many
remote protocols use a similar encoding. However, it is
recognized that this set of signals has limitations (such as not
distinguishing between various kinds of SIGSEGV, or not
distinguishing hitting a breakpoint from finishing a single step).
So in the future we may get around this either by adding additional
signals for breakpoint, single-step, etc., or by adding signal
codes; the latter seems more in the spirit of what BSD, System V,
etc. are doing to address these issues. */
/* For an explanation of what each signal means, see
target_signal_to_string. */
enum target_signal {
/* Used some places (e.g. stop_signal) to record the concept that
there is no signal. */
TARGET_SIGNAL_0 = 0,
TARGET_SIGNAL_HUP = 1,
TARGET_SIGNAL_INT = 2,
TARGET_SIGNAL_QUIT = 3,
TARGET_SIGNAL_ILL = 4,
TARGET_SIGNAL_TRAP = 5,
TARGET_SIGNAL_ABRT = 6,
TARGET_SIGNAL_EMT = 7,
TARGET_SIGNAL_FPE = 8,
TARGET_SIGNAL_KILL = 9,
TARGET_SIGNAL_BUS = 10,
TARGET_SIGNAL_SEGV = 11,
TARGET_SIGNAL_SYS = 12,
TARGET_SIGNAL_PIPE = 13,
TARGET_SIGNAL_ALRM = 14,
TARGET_SIGNAL_TERM = 15,
TARGET_SIGNAL_URG = 16,
TARGET_SIGNAL_STOP = 17,
TARGET_SIGNAL_TSTP = 18,
TARGET_SIGNAL_CONT = 19,
TARGET_SIGNAL_CHLD = 20,
TARGET_SIGNAL_TTIN = 21,
TARGET_SIGNAL_TTOU = 22,
TARGET_SIGNAL_IO = 23,
TARGET_SIGNAL_XCPU = 24,
TARGET_SIGNAL_XFSZ = 25,
TARGET_SIGNAL_VTALRM = 26,
TARGET_SIGNAL_PROF = 27,
TARGET_SIGNAL_WINCH = 28,
TARGET_SIGNAL_LOST = 29,
TARGET_SIGNAL_USR1 = 30,
TARGET_SIGNAL_USR2 = 31,
TARGET_SIGNAL_PWR = 32,
/* Similar to SIGIO. Perhaps they should have the same number. */
TARGET_SIGNAL_POLL = 33,
TARGET_SIGNAL_WIND = 34,
TARGET_SIGNAL_PHONE = 35,
TARGET_SIGNAL_WAITING = 36,
TARGET_SIGNAL_LWP = 37,
TARGET_SIGNAL_DANGER = 38,
TARGET_SIGNAL_GRANT = 39,
TARGET_SIGNAL_RETRACT = 40,
TARGET_SIGNAL_MSG = 41,
TARGET_SIGNAL_SOUND = 42,
TARGET_SIGNAL_SAK = 43,
/* Some signal we don't know about. */
TARGET_SIGNAL_UNKNOWN,
/* Last and unused enum value, for sizing arrays, etc. */
TARGET_SIGNAL_LAST
};
struct target_waitstatus {
enum target_waitkind kind;
/* Exit status or signal number. */
union {
int integer;
enum target_signal sig;
} value;
};
/* Return the string for a signal. */
extern char *target_signal_to_string PARAMS ((enum target_signal));
/* Return the name (SIGHUP, etc.) for a signal. */
extern char *target_signal_to_name PARAMS ((enum target_signal));
/* Given a name (SIGHUP, etc.), return its signal. */
enum target_signal target_signal_from_name PARAMS ((char *));
struct target_ops
{
char *to_shortname; /* Name this target type */
@ -60,8 +172,8 @@ struct target_ops
void (*to_close) PARAMS ((int));
void (*to_attach) PARAMS ((char *, int));
void (*to_detach) PARAMS ((char *, int));
void (*to_resume) PARAMS ((int, int, int));
int (*to_wait) PARAMS ((int *));
void (*to_resume) PARAMS ((int, int, enum target_signal));
int (*to_wait) PARAMS ((int, struct target_waitstatus *));
void (*to_fetch_registers) PARAMS ((int));
void (*to_store_registers) PARAMS ((int));
void (*to_prepare_to_store) PARAMS ((void));
@ -102,7 +214,7 @@ struct target_ops
void (*to_create_inferior) PARAMS ((char *, char *, char **));
void (*to_mourn_inferior) PARAMS ((void));
int (*to_can_run) PARAMS ((void));
void (*to_notice_signals) PARAMS ((void));
void (*to_notice_signals) PARAMS ((int pid));
enum strata to_stratum;
struct target_ops
*to_next;
@ -180,11 +292,12 @@ target_detach PARAMS ((char *, int));
#define target_resume(pid, step, siggnal) \
(*current_target->to_resume) (pid, step, siggnal)
/* Wait for inferior process to do something. Return pid of child,
or -1 in case of error; store status through argument pointer STATUS. */
/* Wait for process pid to do something. Pid = -1 to wait for any pid to do
something. Return pid of child, or -1 in case of error; store status
through argument pointer STATUS. */
#define target_wait(status) \
(*current_target->to_wait) (status)
#define target_wait(pid, status) \
(*current_target->to_wait) (pid, status)
/* Fetch register REGNO, or all regs if regno == -1. No result. */
@ -340,8 +453,8 @@ print_section_info PARAMS ((struct target_ops *, bfd *));
/* post process changes to signal handling in the inferior. */
#define target_notice_signals() \
(*current_target->to_notice_signals) ()
#define target_notice_signals(pid) \
(*current_target->to_notice_signals) (pid)
/* Pointer to next target in the chain, e.g. a core file and an exec file. */
@ -461,4 +574,22 @@ find_default_create_inferior PARAMS ((char *, char *, char **));
struct target_ops *
find_core_target PARAMS ((void));
/* Stuff that should be shared among the various remote targets. */
/* Debugging level. 0 is off, and non-zero values mean to print some debug
information (higher values, more information). */
extern int remote_debug;
/* Speed in bits per second. */
extern int baud_rate;
/* Functions for helping to write a native target. */
/* This is for native targets which use a unix/POSIX-style waitstatus. */
extern void store_waitstatus PARAMS ((struct target_waitstatus *, int));
/* Convert between host signal numbers and enum target_signal's. */
extern enum target_signal target_signal_from_host PARAMS ((int));
extern int target_signal_to_host PARAMS ((enum target_signal));
#endif /* !defined (TARGET_H) */