From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27356 invoked by alias); 8 Jul 2011 16:03:09 -0000 Received: (qmail 27343 invoked by uid 22791); 8 Jul 2011 16:03:08 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 08 Jul 2011 16:02:43 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p68G2gHt031585 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 8 Jul 2011 12:02:42 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p68G2gZM029483; Fri, 8 Jul 2011 12:02:42 -0400 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p68G2fIQ019806; Fri, 8 Jul 2011 12:02:41 -0400 From: Tom Tromey To: gdb-patches@sourceware.org Subject: FYI: put a QUIT in DWARF expression evaluator Date: Fri, 08 Jul 2011 19:54:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain 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 X-SW-Source: 2011-07/txt/msg00258.txt.bz2 I'm checking this in on the trunk. Today I wondered what would happen if I modified pr10770.c to fail, causing an infinite loop while evaluating a DWARF expression. The answer is that gdb hangs and I had to kill it from the shell. This patch adds a QUIT to the DWARF evaluator to let the user interrupt gdb in this event. I ran the gdb.dwarf2 tests against this on x86-64 F15. I also tested the new functionality by hand. FWIW, as far as I know, no such DWARF has ever been found in the wild. Tom 2011-07-08 Tom Tromey * dwarf2expr.c (execute_stack_op): Add QUIT. Index: dwarf2expr.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2expr.c,v retrieving revision 1.66 diff -u -r1.66 dwarf2expr.c --- dwarf2expr.c 22 Jun 2011 13:38:21 -0000 1.66 +++ dwarf2expr.c 8 Jul 2011 15:47:04 -0000 @@ -521,6 +521,10 @@ LONGEST offset; struct value *result_val = NULL; + /* The DWARF expression might have a bug causing an infinite + loop. In that case, quitting is the only way out. */ + QUIT; + switch (op) { case DW_OP_lit0: