delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/08/15/19:38:51

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9D1BD3857020
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1597534685;
bh=omH1j/MUzaxRszYjeP2ZS2yK6h/wIbN2Nz3/0OAD/Dk=;
h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:From;
b=ZFJ5i26YieWm3jrcD3aYMdM39aMC2OQnoDXo69evCO0Jq0YFDSPsouDICk9vtQzrW
YrcxKzsO1P/ZbL/nYZNBKTQ5GAhNnZTgXWtUhh67hFKIzlNZZMSGw0a7bK1bQ9hqKd
4BXaLtBnx2ro86DKP/nKnD8ZLKCkVjDK+bjdYFTo=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 621CD3857C4A
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:from:to:subject:date:message-id:mime-version;
bh=SsgULJBgNfWMABP4hyUbSBdK1mpLOp2in6uboOdE+7A=;
b=XWx+Tobki5P6Fm3RiSNA3LW6O90b7VXnOtGFiK/diyzvqEkphA89KbGsetjPWa+Srb
XbmnDnnZfe8bkEG5QNrJEhDpcPgOPzzzySB3IkkSENtw6UAtlJWj7rrxcGeMCVu1J4Fn
7vZmRIZZufL9CoMDvXyA2dlGQKkVnvd38RxO3itB6UgmXI2g2PIWEJQS0rMcJ9Bm0f//
FhTKpKs6Xpa+OOmD5ZeDFgjqboH2h4QQ8fdHXZdGmfwlh1qHvYaJRIb68i6FI2NRDEm6
3Pm9k9zGKG3sTQ8fi/tsqf2ARmsBby4kcZUfpomqt0zYxcdTk4XEp3L2mynsf48WYPXj
0RSA==
X-Gm-Message-State: AOAM530TEvgVM9j+t0NmP7DCB4bE34Nsgben+FH/wMlxKOfWDhmbQlhp
wnSF2Rs//MEPdunh7Hk7WVMa2fEOpN0=
X-Google-Smtp-Source: ABdhPJyRg4Xsfmve7a7lrwixA1cdVIUgXh67zzGiSloUnn23TkLT/3F/zmTj4jOVLn+i5X2jaxIyjA==
X-Received: by 2002:ac8:60c5:: with SMTP id i5mr8062461qtm.268.1597534682686;
Sat, 15 Aug 2020 16:38:02 -0700 (PDT)
To: cygwin AT cygwin DOT com
Subject: unhandled C++ exceptions not propagating
Date: Sat, 15 Aug 2020 20:38:01 -0300
Message-ID: <vritk0xzfpk6.fsf@gmail.com>
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-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>
Sender: "Cygwin" <cygwin-bounces AT cygwin DOT com>

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.
--
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