From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11olkn2102.outbound.protection.outlook.com [40.92.19.102]) by sourceware.org (Postfix) with ESMTPS id D36373857C4A for ; Thu, 14 Apr 2022 15:06:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D36373857C4A ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nVqvxLHYyFea+BRKBIK2suRoSg19OFioJ3CEVsX1b0A83LwsEJ9OPcLRuRirPr5Qcl/6EDNBjo+OHMDLa/SWMu08SigwkfqqDjEIsFpdmI0FLq2lYz4Uk/fxjFdEghPhnNdPkxmBO0QsAwyJ/Cq0FGAnmLPxyCQlG2pj4j1mZKNZJZpb77VSab/tHUSi5D1cDXEm9B/XyK8lWrysjLS5UBHV1vgUxKnhTJKK6jCKILN4xN0B917BFa2nBHohgDoJsWSr0QWI6qPpA2usFCbzrsnvZ1UmExqqD8tQkMqoifs+TBWIPARVoLwdGvuMh0s4aB6qVdPmGF4+kNju4CvxHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VyrYVDChnNj9cfx0gpZuj9Enmn7piEiKoHbQmQMJhlk=; b=PtYr2LsDf+NOjuOhZqORQ7Xj3M5kuiBiLHKPvE9fLpJYD/Nm0lXYcNenqd2+jmcFb7ddpbChnEA8060CzW4w5EmWvTaZtD2ykOh8N9lQ8ISSh0PWU0jv0ykcByQwTGbkLSRFG7mOuyIu+muWk7a+XlDfyj9aXaX1H5+VhgGw3adD/BdgjYH98OirYSRIwz9EqhxcGq5w3IOvQOpsLlW3xTr3l5Gcj9m84itrlz+9b6Rbiz/ZL2janjAolC6AcqtVVb7qzZvqxLBez58N/Or/oqBVwfELTIcNmuIyarrz+1oBOa1c+S25HgkCGDCn1b75W3h2dh4g6/JnqdegExotkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from DS7PR07MB7686.namprd07.prod.outlook.com (2603:10b6:5:2d0::19) by BYAPR07MB6119.namprd07.prod.outlook.com (2603:10b6:a03:127::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29; Thu, 14 Apr 2022 15:06:22 +0000 Received: from DS7PR07MB7686.namprd07.prod.outlook.com ([fe80::ca1:43d8:3a4:2b2b]) by DS7PR07MB7686.namprd07.prod.outlook.com ([fe80::ca1:43d8:3a4:2b2b%6]) with mapi id 15.20.5164.018; Thu, 14 Apr 2022 15:06:22 +0000 From: Claude Robitaille To: Simon Marchi , "gdb@sourceware.org" , Claude Robitaille Subject: Re: GDB is preventing my catch blocks in my C++ program Thread-Topic: GDB is preventing my catch blocks in my C++ program Thread-Index: AQHYTswYdvj6CFKxQku2gtNSnuNgw6ztCs6AgAABkXuAAARfT4ACZzSS Date: Thu, 14 Apr 2022 15:06:22 +0000 Message-ID: References: <7775f85e-e0f5-2942-bde9-cb3c2effee90@polymtl.ca> In-Reply-To: Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: suggested_attachment_session_id: cd832f8f-471f-f4fa-4b67-e17cd60baddf x-tmn: [d/cvpwAfE/ZXRP05WwBr4JJkE9kqWtyQLrNMbFSM1BmeV/3oT/LqHeU33TOqkErL] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7f827d62-0c4f-483a-58f1-08da1e285645 x-ms-exchange-slblob-mailprops: mBRmoEB1kyLaHSEGqkL6BkGl2c9baOeGwW3spPYQpdKQmsD6l6qn2APEMnL/IILrxtFpt7dX1NGHc10LxAuLSYDeiGxZZskPFS2UA+6luSfR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bJcPTk1JWrcOi3SuCenoKNEojIM9bY8NX+frt9kfNjse50QVPA9xDiYGTvS0XXWpssTJ+dmkDM6qBrSNslN6u63CrIZvj+4zKgDvJqqiDsiRNERs7RHVkqgUJ3i8O4bQu5e7imJBI3uUihgTDiVCbKjgWWUlpxxn/Gqj4hyo2sjwVUT91MlSnaxBFtfK8bo7+Huv/31GwSA7JBuXJj9Rno+PFZa8reY9eGQruLqYrQ2XcEMDXGMAZqu6MlhPrv3w4IBTIwfA== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?A33jdofbme26xtmQE8hPAtOC3D6P3VCIeZh+H/S/XFxHv5Ek4xWnJRypJs6w?= =?us-ascii?Q?W/SGWUi0kgaIxU1o7GcGFg4pW2QzcOn0D4kF0pmNuouNhfMlUFku+v7t5bPZ?= =?us-ascii?Q?nSNdHtV2Zg7yxf+F13sRsWg2ukBDFMwKw/PrfSKcVSEfSYyHbzfGotwwJ5fE?= =?us-ascii?Q?7b+OPAzkhEMenLF1UC/6AV2YtFk+Pvoy00hSvD517OqhqG+H+7/BV7VA2+RR?= =?us-ascii?Q?HpETBBIO+qWcHvel7K2VWOaN4GNdHwOkdT/KmJcDfIBYHaWtoGTuxM7X7ayg?= =?us-ascii?Q?NCRmJS5OqZxOfOmox8wJK5DYNvl3ZkgkD/bfIvmKK/7g2Gds1heo4mUm6/x1?= =?us-ascii?Q?KcVhAsbMat5O/qXCPjOb6uZjZySuRs0yPA3FmonOdoJ7Sgy+2z/30Wj0MZJX?= =?us-ascii?Q?hQfaXs/BT2sxf6xd6aYpIy/Irhnxmi4aY9vnCqHF9Wx22tEsmMDT0Q3fxqFw?= =?us-ascii?Q?XYmEPCCm1jamg6QcCuyhjLtaBb9uBwTQjaRAZV4oQfkWEAU6G88F15VYsNuA?= =?us-ascii?Q?oqF/2UYLS+Yl5J9K8MZooXaPkiC2JRxqoarLSudINiH962cvsDhPxehbgpz0?= =?us-ascii?Q?6E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7scHHS8Pz?= =?us-ascii?Q?WdXOGzX5TYoSfNs=3D?= MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-5fbaf.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DS7PR07MB7686.namprd07.prod.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 7f827d62-0c4f-483a-58f1-08da1e285645 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Apr 2022 15:06:22.0632 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB6119 X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Apr 2022 15:06:29 -0000 I created a sample program to reproduce the issues. #include #include int main() { std::cout<<"Before the try block" << std::endl; try { throw std::runtime_error("Test exception"); } catch (...) { std::cout << "Catched the exception" << std::endl; } std::cout<<"After the try block" << std::endl; return 0; } I compiled it using this x86_64-w64-mingw32-g++ -static hello.cpp -static-libstdc++ -static-libgcc -= o hello When running outside gdb, I get this output Before the try block Catched the exception After the try block But under gdbserver, I get Listening on port 2345 Remote debugging from host 192.168.70.8, port 44782 Before the try block terminate called after throwing an instance of 'std::runtime_error' Child exited with status 3 ________________________________ From: Gdb on behalf of Claude= Robitaille via Gdb Sent: April 12, 2022 9:39 PM To: Simon Marchi ; gdb@sourceware.org Subject: Re: GDB is preventing my catch blocks in my C++ program To include the list... ________________________________ From: Claude Robitaille Sent: April 12, 2022 9:28 PM To: Simon Marchi Subject: Re: GDB is preventing my catch blocks in my C++ program Thanks Simon for the quick reply. I can single step the program up to the point where an exception is thrown.= And I did set a breakpoint inside the catch statement but no success (earl= ier breakpoint in the code are working as expected). Here is what appears on the console (yes, it is Windows) Listening on port 2345 Remote debugging from host 192.168.70.8, port 34542 Error while doing a GetTokenInformation - Unknown errorLOGGER NOT INITIALIZ= ED: ***********************************************************= ********************************** terminate called after throwing an instance of 'sf::context::tGlobal::envVa= riableMissing' Child exited with status 3 The string that starts with Error blah blah is my own std::cout earlier in = the program. Same with the line with the ****** and the LOGGER xxxx is from the g3log library in my program. The exception instance is definitely what my program is throwing. I guess Child exited is from gdb. ________________________________ From: Simon Marchi Sent: April 12, 2022 9:17 PM To: Claude Robitaille ; gdb@sourceware.org <= gdb@sourceware.org> Subject: Re: GDB is preventing my catch blocks in my C++ program On 2022-04-12 20:27, Claude Robitaille via Gdb wrote: > Hi all, > > I am having an issue with exception in C++. When I run my program outside= gdb (gsbserver actually) all is good and my exceptions are properly catche= d. > > However, when running un gdbserver I get: > "terminate called after throwing an instance of XXXX" > > The actuall catch statmeent is catch (...) so it is a catch all. > > I obvisouly suspect that, somehow, gdbserver is preventing the normal try= /catch/throw machinery to work as it should. The "terminate called..." stri= ng is most likely coming form the language library. > > Background > I am crosscompiling with mingw-w64 on Ubuntu. The compiler is 9.3 while b= oth gdb and gdbserver are 9.1 I run gdb under eclipse > > I run under WIndows 10 > > I spend the whole afternoon on Google but all I found are cases where the= programmer did not properly coded the catch (or something similar), which,= indeed, is not my problem since all is good when running outside of gdb. > > Not sure how to tackle this one!! Just to try to get the obvious out of the way first... are you sure it's not GDBserver itself crashing? GDBserver is a C++ program, so it's possible that an exception is thrown and not caught in it. Can you paste the logs of a session that shows your problem? GDBserver and your program are running on Windows IIUC? Simon