From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 629 invoked by alias); 2 Jul 2010 19:42:46 -0000 Received: (qmail 616 invoked by uid 22791); 2 Jul 2010 19:42:45 -0000 X-SWARE-Spam-Status: No, hits=-6.0 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, 02 Jul 2010 19:42:40 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o62Jgckx011170 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 2 Jul 2010 15:42:38 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o62JgcqR026773; Fri, 2 Jul 2010 15:42:38 -0400 Received: from opsy.redhat.com (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 o62JgbCD004858; Fri, 2 Jul 2010 15:42:37 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 0A537378196; Fri, 2 Jul 2010 13:42:37 -0600 (MDT) From: Tom Tromey To: gdb-patches@sourceware.org Subject: RFC: libunwind-frame.c -vs- optimized-out Date: Fri, 02 Jul 2010 19:42:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2010-07/txt/msg00052.txt.bz2 PR 11780 concerns another case where the optimized-out change I made breaks unwinding. In this case the failures are on IA-64. ia64_libunwind_frame_prev_register calls libunwind_frame_prev_register and then uses the contents of the result, for example: /* Let libunwind do most of the work. */ val = libunwind_frame_prev_register (this_frame, this_cache, reg); [...] prN_val = extract_bit_field (value_contents_all (val), regnum - VP0_REGNUM, 1); [...] However, libunwind_frame_prev_register calls set_value_optimized_out on this value. I don't really understand why it is doing this. It looks like the code there is computing something, and strangely it seems though that the error cases return a not-optimized-out value. E.g., here, unw_get_reg_p returns a negative value on failure: ret = unw_get_reg_p (&cache->cursor, uw_regnum, &intval); if (ret < 0) return frame_unwind_got_constant (this_frame, regnum, 0); val = frame_unwind_got_constant (this_frame, regnum, intval); } set_value_optimized_out (val, 1); So, this seems like the logic is possibly backward. The appended patch fixes the IA-64 regressions. However, I am reluctant to commit it without understanding what is going on here. Tom 2010-07-02 Tom Tromey PR exp/11780: * libunwind-frame.c (libunwind_frame_prev_register): Don't set value as optimized-out. Index: libunwind-frame.c =================================================================== RCS file: /cvs/src/src/gdb/libunwind-frame.c,v retrieving revision 1.26 diff -u -r1.26 libunwind-frame.c --- libunwind-frame.c 14 May 2010 23:41:04 -0000 1.26 +++ libunwind-frame.c 2 Jul 2010 19:34:58 -0000 @@ -348,7 +348,6 @@ return frame_unwind_got_constant (this_frame, regnum, 0); val = frame_unwind_got_constant (this_frame, regnum, intval); } - set_value_optimized_out (val, 1); break; } }