From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19345 invoked by alias); 19 Nov 2013 19:07:55 -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 19335 invoked by uid 89); 19 Nov 2013 19:07:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,RDNS_NONE,SPF_HELO_PASS,SPF_PASS autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 19 Nov 2013 19:07:54 +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 rAJJ7jTa018474 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 19 Nov 2013 14:07:46 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rAJJ7iUV009273; Tue, 19 Nov 2013 14:07:45 -0500 Message-ID: <528BB700.4000802@redhat.com> Date: Tue, 19 Nov 2013 20:24:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Tom Tromey CC: gdb-patches@sourceware.org Subject: Re: [PATCH 1/2] avoid infinite loop with bad debuginfo References: <1384375873-32160-1-git-send-email-tromey@redhat.com> <1384375873-32160-2-git-send-email-tromey@redhat.com> <52850730.1060109@redhat.com> <87d2lxpo1l.fsf@fleche.redhat.com> <528B7F15.7040605@redhat.com> <87vbzomm78.fsf@fleche.redhat.com> <528B8FF6.7000406@redhat.com> <87siusl10r.fsf@fleche.redhat.com> In-Reply-To: <87siusl10r.fsf@fleche.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-11/txt/msg00559.txt.bz2 On 11/19/2013 06:06 PM, Tom Tromey wrote: > It seems to me that the loop in question could perhaps be reached from > some path outside the unwinder. Yes, that's actually what my example was about. I was assuming the recursion fixed already. > If so, bad DWARF would be able to cause > an internal error -- clearly incorrect. I don't think so, because get_prev_frame_1 would not link in the dup frame. The loop in question would never see it. Hmm, I think one of us is missing something. while (VALUE_LVAL (new_val) == lval_register && value_lazy (new_val)) { frame = frame_find_by_id (VALUE_FRAME_ID (new_val)); ... new_val = get_frame_register_value (frame, regnum); } get_frame_register_value unwinds the value in question from the next frame. struct value * get_frame_register_value (struct frame_info *frame, int regnum) { return frame_unwind_register_value (frame->next, regnum); ^^^^^^^^^^^ } IOW, if we get a lazy lval_register, it should have the frame ID of the _next_ frame, never of FRAME. At this point, the whole relevant chunk of the stack has already been unwound -- note the loop always "unlazies" lval_registers in the "next/innermost" direction, not in the "prev/unwind further/outermost" direction. So the bad loop can only ever happen (outside the unwinder code) if we ever let outselves get in the dup frame_id situation: > #4 0x0000007fb7f0956c in clone () from /lib64/libc.so.6 > #5 0x0000007fb7f0956c in clone () from /lib64/libc.so.6 > Backtrace stopped: previous frame identical to this frame (corrupt stack?) At least, I'm not seeing any other way. -- Pedro Alves