1

There is unix-socket server written on PHP (but I don't think it has something to with it). Client side is written on c++ and based on boost::asio library. When I launch program normally - everything works fine, except one (not related to socket communication) bug that I obviously want to debug. But when I start step-by-step debugging it I immediately receive 'Broken Pipe' error on the steps which perform write operations on sockets. If breakpoint is set up after socket write operation - everything work fine until the next attempt to step over the write func.

Spent whole day trying to solve this problem, but unsuccessfully...

Had anyone met the same trouble?

  • using GDB bundled with xCode 3.2.5 (64-bit) under OS X 10.6.7
Ibadinov
  • 21
  • 4
  • The default behavior for `SIGPIPE` is to terminate the process, I suspect you are encountering a timing window that is perturbed by gdb. – Sam Miller Jun 01 '11 at 20:40
  • Maybe so... But process receives `SIGABRT`instead of `SIGPIPE`. Also, I'm not sure if `boost::asio` is catching `SIGPIPE` to return an error corresponding to `EPIPE` – Ibadinov Jun 01 '11 at 22:01
  • @ibadinov asio does not install signal handlers, your application should if the default behavior is not appropriate. – Sam Miller Jun 01 '11 at 22:12
  • therefore `SIGABRT` is even more confusing – Ibadinov Jun 01 '11 at 22:17
  • @Ibadinov I suggest you edit your question with more information. It's not obvious to me where `SIGABRT` is coming from, perhaps an uncaught exception. – Sam Miller Jun 01 '11 at 22:29
  • Yes, you are right - `SIGABRT` was actually from uncaught... But still the question is what may cause the pipe to break during debug and work smoothly in normal conditions. – Ibadinov Jun 01 '11 at 22:47

1 Answers1

0

GDB uses signals aggressively. If you want to install signal handlers, check out the following example:

https://github.com/sean-/Boost.Examples/blob/master/asio/timer/timer.cc#L106

Sean
  • 9,888
  • 4
  • 40
  • 43