From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3356 invoked by alias); 9 May 2014 10:07:02 -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 3346 invoked by uid 89); 9 May 2014 10:07:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 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 ESMTP; Fri, 09 May 2014 10:07:00 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s49A6wsw022225 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 9 May 2014 06:06:58 -0400 Received: from blade.nx (ovpn-116-96.ams2.redhat.com [10.36.116.96]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s49A6vqB011865 for ; Fri, 9 May 2014 06:06:58 -0400 Received: by blade.nx (Postfix, from userid 1000) id 3279326234A; Fri, 9 May 2014 11:06:57 +0100 (BST) Date: Fri, 09 May 2014 10:07:00 -0000 From: Gary Benson To: gdb-patches@sourceware.org Subject: [PATCH 0/2] Demangler crash handler Message-ID: <20140509100656.GA4760@blade.nx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-IsSubscribed: yes X-SW-Source: 2014-05/txt/msg00108.txt.bz2 Hi all, A number of bugs have been filed recently because of segmentation faults in the demangler. While such crashes are a problem for all demangler consumers, they are particularly nasty for GDB because they prevent the user from debugging their program at all. This patch series arranges for GDB to catch segmentation faults in the demangler and recover from them gracefully. A warning is printed the first time a fault occurs. Example sessions with and without these patches are included below. None of the wrapped code uses cleanups, so each caught failure will leak a small amount of memory. This is undesirable but I think the benefits here outweigh this drawback. Ok to commit? Thanks, Gary -- http://gbenson.net/ The current situation: GNU gdb (GDB) 7.7.50.20140507-cvs Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-unknown-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... (gdb) file test Reading symbols from test...Segmentation fault (core dumped) With these patches: GNU gdb (GDB) 7.7.50.20140508-cvs Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-unknown-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... (gdb) file test Reading symbols from test... warning: internal error: demangler failed with signal 11 Unable to demangle '_QueueNotification_QueueController__$4PPPPPPPM_A_INotice___Z' This is a bug, please report it to the GDB maintainers. done. (gdb) b puts Breakpoint 1 at 0x400488 (gdb) r Starting program: /home/gary/work/archer/demangle-crashcatcher/src/test warning: Skipping deprecated .gdb_index section in /usr/lib/debug/lib64/ld-2.12.so.debug. Do "set use-deprecated-index-sections on" before the file is read to use the section anyway. Breakpoint 1, _IO_puts (str=0x4006d8 "hello") at ioputs.c:35 35 { (gdb) bt #0 _IO_puts (str=0x4006d8 "hello") at ioputs.c:35 #1 0x00000000004005b2 in hello () at test.cc:6 #2 0x00000000004005bd in _QueueNotification_QueueController__$4PPPPPPPM_A_INotice___Z () at test.cc:12 #3 0x00000000004005d3 in main (argc=1, argv=0x7fffffffe618) at test.cc:18