From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19044 invoked by alias); 12 Jan 2012 15:52:23 -0000 Received: (qmail 19030 invoked by uid 22791); 12 Jan 2012 15:52:18 -0000 X-SWARE-Spam-Status: No, hits=-6.2 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; Thu, 12 Jan 2012 15:52:01 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0CFq1H8012944 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 12 Jan 2012 10:52:01 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q0CFq0ZD023578 for ; Thu, 12 Jan 2012 10:52:00 -0500 Message-ID: <4F0F01A0.804@redhat.com> Date: Thu, 12 Jan 2012 16:25:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: GDB Patches Subject: [i386] Don't forget to mark the outermost frame as having a "valid" base Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 2012-01/txt/msg00405.txt.bz2 Someone on IRC sent me a i386 GNU/Linux core file with which GDB consistently claims: "Backtrace stopped: Not enough registers or memory available to unwind further" Thread 8 (Thread 0xb3945b70 (LWP 2899)): #0 0xb7872424 in __kernel_vsyscall () #1 0xb762b20a in __pthread_cond_wait (cond=0x825216c, mutex=0x8252154) at pthread_cond_wait.c:153 #2 0xb76988b0 in xine_event_wait (queue=0x8252150) at events.c:56 #3 0xb769898d in listener_loop (queue_gen=0x8252150) at events.c:219 #4 0xb7626c39 in start_thread (arg=0xb3945b70) at pthread_create.c:304 #5 0xb759398e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130 Backtrace stopped: Not enough registers or memory available to unwind further ... Thread 1 (Thread 0xb73906c0 (LWP 2891)): #0 0x00000000 in ?? () Backtrace stopped: Not enough registers or memory available to unwind further (gdb) I can't load the core fully correctly on my machine (don't have copies of all relevant libraries), but "Thread 1" was enough to spot the problem. I missed marking the frame as having a known base when %ebp is 0 (marking the outermost), and so we return UNWIND_UNAVAILABLE from i386_frame_unwind_stop_reason instead of UNWIND_OUTERMOST. This fixes it. This is quite obvious and safe, so I applied it to the 7.4 branch as well as mainline. Interesting that nobody complained about this before. gdb/ 2012-01-12 Pedro Alves * i386-tdep.c (i386_frame_cache_1): Also mark the frame base as available when %ebp is found to be zero (outermost). --- gdb/i386-tdep.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index a612ca6..549297e 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -1680,7 +1680,10 @@ i386_frame_cache_1 (struct frame_info *this_frame, get_frame_register (this_frame, I386_EBP_REGNUM, buf); cache->base = extract_unsigned_integer (buf, 4, byte_order); if (cache->base == 0) - return; + { + cache->base_p = 1; + return; + } /* For normal frames, %eip is stored at 4(%ebp). */ cache->saved_regs[I386_EIP_REGNUM] = 4;