Takashi Yano <takashi.y...@nifty.ne.jp> writes: > On Sat, 15 Aug 2020 20:38:01 -0300 > David McFarland via Cygwin <cygwin@cygwin.com> wrote: >> >> I was just debugging a c++ app (b2 build system from boost), and noticed >> that it would appear to exit unexpectedly without an error. This turned >> out to be when an unhandled C++ exception was thrown. >> >> On a fresh install of cygwin with gcc-g++, this program will throw an >> exception from the std::string constructor: >> >> c++ -x c++ - <<END >> #include <string> >> int main() { std::string str(nullptr); return 0; } >> END >> >> When it's executed from the shell it returns zero, but execution stops >> at the exception. >> >> $ ./a; echo $? >> 0 >> >> When executed under gdb, the exception is caught, and the process exits >> non-zero when continued: >> >> (gdb) r >> Starting program: /home/corngood/a >> [New Thread 4300.0x1390] >> [New Thread 4300.0x1d24] >> [New Thread 4300.0x1d48] >> [New Thread 4300.0x80c] >> gdb: unknown target exception 0x20474343 at 0x7ff8d2cfa799 >> Thread 1 "a" received signal ?, Unknown signal. >> 0x00007ff8d2cfa799 in RaiseException () from >> /cygdrive/c/WINDOWS/System32/KERNELBASE.dll >> (gdb) c >> Continuing. >> [Thread 4300.0x1d24 exited with code 541541187] >> [Thread 4300.0x1870 exited with code 541541187] >> [Thread 4300.0x1d48 exited with code 541541187] >> [Thread 4300.0x1390 exited with code 541541187] >> [Inferior 1 (process 4300) exited with code 04021641503] >> (gdb) >> >> When executed under strace, it exits with an error as expected: >> >> $ strace -o /dev/null a; echo $? >> 67 >> >> That's as far as I've investigated so far. > > Is this the same issue with > https://cygwin.com/pipermail/cygwin/2019-October/242795.html ? > > As far as I tested, this does not occur in 32-bit cygwin.
Yeah, it seems to be. Thanks for tracking that down. I tried using ProcessMonitor, and when I run the test program from a shell (where it appears to return 0) I get: a.exe 7096 Process Exit SUCCESS Exit Status: 541541187, User Time: 0.0000000 seconds, Kernel Time: 0.0000000 seconds, Private Bytes: 4,661,248, Peak Private Bytes: 4,661,248, Working Set: 4,255,744, Peak Working Set: 4,259,840 So the win32 process does appear to be exiting non-zero. Did you find out anything else when you investigated it? My next step was going to be digging into why it behaves differently under strace. -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple