delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/08/16/10:18:50

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D8B4F3857C72
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1597587479;
bh=MdcSbh4kRjdY74Km31x7Uvpr9X9Q4xkWHiefE/P1UyY=;
h=To:Subject:References:Date:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=jG3AG/tRJ8QjPrNiI8PX8NICIMKvOKdNwwVX58vVnknlJZYWJWfhiASW3MoQ22k1p
CNdqlcHY6NG6Y9/+MMvfYWgSbigQ/p4tn+L1hcpmxfchdpW1gFFjlDTpTfG7txPBS+
ptpsuLYcE8mT80NbtwZGVWn0Zjcx7tpFNh1CHbwE=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 79FA43857C4A
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
:message-id:user-agent:mime-version;
bh=Tp1K9jky12TGnrrhZKtWj+uO9UQjtft6/u7v0DSJr68=;
b=kWq8FL4504K9IgT++WOtJzGQgqxQQBISNDtAQQjm64otADlT5+HHK75fHPDPxiy80P
+URod+KM3o9c7kgAfp7VjEMJQlNYDvoYRKGd1Tx5gaSOpcaLIs8M3vQ4maiD06Xg2LD9
RtAH+jRmQtVkumeqdcAvbqXjcGIo/9nqn86CbDBLesFSzqQLCm6cAcv+DSHeCZNLTnFV
Lt0hW73bqC04o4MKZxNW9iEMYDMiV+VCUcflV7fYhqofYlWj35ze/9I0Rrp9gRJO132i
QkOMTtMwRH/D4BtDntEXPpjb93oeBhwW6nWh4HWb8furMI1PinbhlnKFpkAgh6oU73hO
by9g==
X-Gm-Message-State: AOAM5324WWj7wW1iKbe40Pf8VVE/GT3kpVtLS1Zoa8L7ne4Ai7YTnEiy
oXryPw0aFHRCmJWQeZQO5/7Cg4/1wXA=
X-Google-Smtp-Source: ABdhPJxAkrc4QJlzX10mIHLdkRxTKsztYKJIqE+0BxwqhXgetOnu84WhOrYeFQJ8Sqo8rNrJVioU3w==
X-Received: by 2002:ac8:4451:: with SMTP id m17mr9810449qtn.299.1597587475838;
Sun, 16 Aug 2020 07:17:55 -0700 (PDT)
To: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
Subject: Re: unhandled C++ exceptions not propagating
References: <vritk0xzfpk6 DOT fsf AT gmail DOT com>
<20200816125306 DOT 60dc246baf63d7f9fba60611 AT nifty DOT ne DOT jp>
Date: Sun, 16 Aug 2020 11:17:53 -0300
In-Reply-To: <20200816125306.60dc246baf63d7f9fba60611@nifty.ne.jp> (Takashi
Yano's message of "Sun, 16 Aug 2020 12:53:06 +0900")
Message-ID: <vriteeo6fze6.fsf@gmail.com>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (cygwin)
MIME-Version: 1.0
X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,
SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: David McFarland via Cygwin <cygwin AT cygwin DOT com>
Reply-To: David McFarland <corngood AT gmail DOT com>
Cc: cygwin AT cygwin DOT com
Errors-To: cygwin-bounces AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces AT cygwin DOT com>

Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp> writes:

> On Sat, 15 Aug 2020 20:38:01 -0300
> David McFarland via Cygwin <cygwin AT cygwin DOT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019