# These GDB commands should make watching tcsetattr failures much easier. # You can use them with UML in skas mode just by doing "gdb linux". No # arguments are needed to demonstrate the problem. # # Pass signals through that UML uses. handle SIGSEGV pass nostop noprint handle SIGUSR1 pass nostop noprint # Find out where tcsetattr is and try to guess where the breakpoint should # go. We want the breakpoint just before tcsetattr returns. You can always # set it manually if this doesn't work. x tcsetattr set $tcsetattr_start = $_ set $tcsetattr_ret = $tcsetattr_start+17 # Set our breakpoint to run after a failed call to tcsetattr. This should # trigger just before tcsetattr returns with a non-zero return value. break *$tcsetattr_ret condition 1 $eax != 0 commands 1 silent printf " *** tcsetattr failed, returned = %d, errno = %d *** \n", $eax, errno c end # Break on panic so we don't lose our xterm when the kernel panics, which it # should do as long as you run it without any arguments. break panic # Ok, time to run our test. You don't have to use an xterm, but it will # keep the error messages from printing out on your console. r con=xterm