Bug#27471: internal Debugger and SIGPIPE

oliver.kowalke at t-online.de oliver.kowalke at t-online.de
Wed Jun 20 05:13:11 UTC 2001


Package: kdevelop
Version: Kdevelop 1.4 (using KDE 2.1.1 )
Severity: normal
Installed from:    Compiled From Sources
Compiler:          gcc-2.95.2
OS:                Linux
OS/Compiler notes: Not Specified

Hi,

If I debugg my code with the internal debugger of KDevelop. The current cursor disapears after second write to a closed socket. In this case SIGPIPE is thrown. I set the signals mask of this process to ignore SIGPIPE ( ::sigaction() ) so I should retrieve EPIPE as errno after second write to the closed socket.
The code is OK. I put some 'std::cout << "blah blah" << std::endl;' in the error detection. After compiling and executing(no debugging) it I can follow the execution path.
If I debugg this code I can't follow the execution path.

with best regards,
Oliver

code:

ssize_t
stream_sock::writen( const void * vptr, size_t n)
{
	size_t		nleft;
	ssize_t		nwritten;
	const char	*ptr;

	ptr = static_cast< const char * >( vptr);
	nleft = n;

	struct sigaction new_sa;
	struct sigaction old_sa;
	
	new_sa.sa_handler = SIG_IGN;
	::sigemptyset( & new_sa.sa_mask);
	new_sa.sa_flags = 0;
	::sigaction( SIGPIPE, & new_sa, & old_sa);		

	while ( nleft > 0)
	{
		if ( ( nwritten = ::write( m_handle, ptr, nleft) ) <= 0)
		{
			if ( errno == EINTR)
				nwritten = 0;		/* and call write() again */
			else if ( errno == EPIPE)
			{
				::sigaction( SIGPIPE, & old_sa, 0);
				return EOF;			/* write to socket with no readers (peer has the socket closed) */
			}
			else
			{
				::sigaction( SIGPIPE, & old_sa, 0);
				throw net_io_ex( ::strerror( errno), "writen()", __FILE__);			/* error */
			}
		}

		nleft -= nwritten;
		ptr   += nwritten;
	}
	/* set to its previous action */
	::sigaction( SIGPIPE, & old_sa, 0);

	return n;
}

(Submitted via bugs.kde.org)


-
to unsubscribe from this list send an email to kdevelop-devel-request at kdevelop.org with the following body:
unsubscribe »your-email-address«



More information about the KDevelop-devel mailing list