From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 65765 invoked by alias); 21 Apr 2016 23:50:44 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 65751 invoked by uid 89); 21 Apr 2016 23:50:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1430, tripped X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 21 Apr 2016 23:50:42 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4BBC78AE72 for ; Thu, 21 Apr 2016 23:50:41 +0000 (UTC) Received: from cascais.lan (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3LNoelt001710 for ; Thu, 21 Apr 2016 19:50:40 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 0/3] Fix C++ exceptions across readline result in std::terminate() -> SIGABRT Date: Thu, 21 Apr 2016 23:50:00 -0000 Message-Id: <1461282640-30425-1-git-send-email-palves@redhat.com> X-SW-Source: 2016-04/txt/msg00504.txt.bz2 We saw that if we map GDB'S TRY/CATCH macros to C++ try/catch, GDB breaks on systems where readline isn't built with exceptions support. Yao tripped on this on ARM/Fedora 19, and I saw the same thing on AIX. The problem is that readline calls into GDB through the callback interface, and if GDB's callback throws a C++ exception/error, the system unwinder won't manage to unwind past the readline frame, and ends up calling std::terminate(), which aborts the process: (gdb) whatever-command-that-causes-an-error terminate called after throwing an instance of 'gdb_exception_RETURN_MASK_ERROR' Aborted $ This series: - stops GDB from throwing C++ exceptions across readline. - then flips back TRY/CATCH to C++ try/catch (which is necessary for automatically calling local variable destructors when throw_exception is called). Tested on x86_64 Fedora, and confirmed that it fixes the issue on AIX. Pedro Alves (3): Rename rl_callback_read_char_wrapper -> gdb_rl_callback_read_char Propagate GDB/C++ exceptions across readline using sj/lj-based TRY/CATCH Switch gdb's TRY/CATCH to C++ try/catch gdb/common/common-exceptions.h | 69 ++++++++++++++----------- gdb/common/common-exceptions.c | 38 +++++++++++--- gdb/event-top.c | 112 +++++++++++++++++++++++++++++++++++------ 3 files changed, 169 insertions(+), 50 deletions(-) -- 2.5.5