PR gdb/9346
* infcmd.c (signal_command): Do not specify a resume PC. testsuite/ PR gdb/9346 * gdb.base/interrupt.c (sigint_handler): New. (main): Install a SIGINT handler if SIGNALS is defined. Exit on error. * gdb.base/interrupt.exp: Define SIGNALS unless gdb,nosignals. Test "signal SIGINT".
This commit is contained in:
parent
6f3b91a621
commit
a12cc160ab
5 changed files with 68 additions and 8 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2008-01-20 Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
|
PR gdb/9346
|
||||||
|
* infcmd.c (signal_command): Do not specify a resume PC.
|
||||||
|
|
||||||
2009-01-19 Doug Evans <dje@google.com>
|
2009-01-19 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
* dummy-frame.c (dummy_frame): Replace regcache member with
|
* dummy-frame.c (dummy_frame): Replace regcache member with
|
||||||
|
|
|
@ -1145,11 +1145,7 @@ signal_command (char *signum_exp, int from_tty)
|
||||||
}
|
}
|
||||||
|
|
||||||
clear_proceed_status ();
|
clear_proceed_status ();
|
||||||
/* "signal 0" should not get stuck if we are stopped at a breakpoint.
|
proceed ((CORE_ADDR) -1, oursig, 0);
|
||||||
FIXME: Neither should "signal foo" but when I tried passing
|
|
||||||
(CORE_ADDR)-1 unconditionally I got a testsuite failure which I haven't
|
|
||||||
tried to track down yet. */
|
|
||||||
proceed (oursig == TARGET_SIGNAL_0 ? (CORE_ADDR) -1 : stop_pc, oursig, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Proceed until we reach a different source line with pc greater than
|
/* Proceed until we reach a different source line with pc greater than
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
2009-01-20 Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
|
PR gdb/9346
|
||||||
|
* gdb.base/interrupt.c (sigint_handler): New.
|
||||||
|
(main): Install a SIGINT handler if SIGNALS is defined. Exit
|
||||||
|
on error.
|
||||||
|
* gdb.base/interrupt.exp: Define SIGNALS unless gdb,nosignals.
|
||||||
|
Test "signal SIGINT".
|
||||||
|
|
||||||
2009-01-19 Doug Evans <dje@google.com>
|
2009-01-19 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
* gdb.base/break.exp: Update expected gdb output.
|
* gdb.base/break.exp: Update expected gdb output.
|
||||||
|
|
|
@ -2,6 +2,16 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifdef SIGNALS
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
static void
|
||||||
|
sigint_handler (int signo)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
main ()
|
main ()
|
||||||
{
|
{
|
||||||
|
@ -10,6 +20,9 @@ main ()
|
||||||
#ifdef usestubs
|
#ifdef usestubs
|
||||||
set_debug_traps();
|
set_debug_traps();
|
||||||
breakpoint();
|
breakpoint();
|
||||||
|
#endif
|
||||||
|
#ifdef SIGNALS
|
||||||
|
signal (SIGINT, sigint_handler);
|
||||||
#endif
|
#endif
|
||||||
printf ("talk to me baby\n");
|
printf ("talk to me baby\n");
|
||||||
while (1)
|
while (1)
|
||||||
|
@ -20,7 +33,10 @@ main ()
|
||||||
#ifdef EINTR
|
#ifdef EINTR
|
||||||
if (errno != EINTR)
|
if (errno != EINTR)
|
||||||
#endif
|
#endif
|
||||||
perror ("");
|
{
|
||||||
|
perror ("");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (nbytes == 0)
|
else if (nbytes == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,7 +34,13 @@ set bug_id 0
|
||||||
set testfile interrupt
|
set testfile interrupt
|
||||||
set srcfile ${testfile}.c
|
set srcfile ${testfile}.c
|
||||||
set binfile ${objdir}/${subdir}/${testfile}
|
set binfile ${objdir}/${subdir}/${testfile}
|
||||||
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
|
||||||
|
set options { debug }
|
||||||
|
if { ! [target_info exists gdb,nosignals] } {
|
||||||
|
lappend options "additional_flags=-DSIGNALS"
|
||||||
|
}
|
||||||
|
|
||||||
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $options] != "" } {
|
||||||
untested interrupt.exp
|
untested interrupt.exp
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
@ -165,7 +171,35 @@ if ![file exists $binfile] then {
|
||||||
eof { fail "echo data (eof)" }
|
eof { fail "echo data (eof)" }
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_xfail "i*86-pc-linux*-gnu*"
|
if { ! [target_info exists gdb,nosignals] } {
|
||||||
|
# Wait until the program is in the read system call again.
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
# Stop the program for another test.
|
||||||
|
set msg "Send Control-C, second time"
|
||||||
|
send_gdb "\003"
|
||||||
|
gdb_test_multiple "" "$msg" {
|
||||||
|
-re "Program received signal SIGINT.*$gdb_prompt $" {
|
||||||
|
pass "$msg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# The "signal" command should deliver the correct signal and
|
||||||
|
# return to the loop.
|
||||||
|
set msg "signal SIGINT"
|
||||||
|
gdb_test_multiple "signal SIGINT" "$msg" {
|
||||||
|
-re "^signal SIGINT\r\nContinuing with signal SIGINT.\r\n(\r\n|)$" { pass "$msg" }
|
||||||
|
}
|
||||||
|
|
||||||
|
# We should be back in the loop.
|
||||||
|
send_gdb "more data\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "^(\r\n|)more data\r\n(|more data\r\n)$" { pass "echo more data" }
|
||||||
|
timeout { fail "echo more data (timeout)" }
|
||||||
|
eof { fail "echo more data (eof)" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
send_gdb "\004"
|
send_gdb "\004"
|
||||||
gdb_expect {
|
gdb_expect {
|
||||||
-re "end of file.*Program exited normally.*$gdb_prompt $" {
|
-re "end of file.*Program exited normally.*$gdb_prompt $" {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue