From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30058 invoked by alias); 17 Mar 2016 11:28:37 -0000 Mailing-List: contact gdb-testers-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-testers-owner@sourceware.org Received: (qmail 30044 invoked by uid 89); 17 Mar 2016 11:28:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2224 X-HELO: kwanyin.sergiodj.net Received: from kwanyin.sergiodj.net (HELO kwanyin.sergiodj.net) (176.31.208.32) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 17 Mar 2016 11:28:26 +0000 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [binutils-gdb/gdb-7.11-branch] btrace: fix PR gdb/19829 From: sergiodj+buildbot@sergiodj.net To: gdb-testers@sourceware.org Message-Id: <2ef34d11f61d79dcb152713aa059051d8cd3295d@gdb-build> Date: Thu, 17 Mar 2016 11:28:00 -0000 X-SW-Source: 2016-q1/txt/msg09258.txt.bz2 *** TEST RESULTS FOR COMMIT 2ef34d11f61d79dcb152713aa059051d8cd3295d *** Author: Markus Metzger Branch: gdb-7.11-branch Commit: 2ef34d11f61d79dcb152713aa059051d8cd3295d btrace: fix PR gdb/19829 This is a backport of 33b4777ca1b7 btrace, frame: fix crash in get_frame_type a038fa3e14a4 stack: check frame_unwind_caller_id 2f3ef606b912 frame: add skip_tailcall_frames In skip_artificial_frames we repeatedly call get_prev_frame_always until we get a non-inline and non-tailcall frame assuming that there must be such a frame eventually. For record targets, however, we may have a frame chain that consists only of artificial frames. This leads to a crash in get_frame_type when dereferencing a NULL frame pointer. Change skip_artificial_frames and skip_tailcall_frames to return NULL in such a case and modify each caller to cope with a NULL return. In frame_unwind_caller_pc and frame_unwind_caller_arch, we simply assert that the returned value is not NULL. Their caller was supposed to check frame_unwind_caller_id before calling those functions. In other cases, we thrown an error. In infcmd further move the skip_tailcall_frames call to the forward-stepping case since we don't need a frame for reverse execution and we don't want to fail because of that. Reverse-finish does make sense for a tailcall frame. gdb/ * frame.h (skip_tailcall_frames): New. * infcmd.c (finish_command): Call skip_tailcall_frames. * frame.c (skip_artificial_frames): Return NULL if only artificial frames are found. Update comment. (frame_pop): Call skip_tailcall_frames. (frame_unwind_caller_id): Handle NULL return. (frame_unwind_caller_pc, frame_unwind_caller_arch): Assert that skip_artificial_frames does not return NULL. (frame_pop): Add an error if only tailcall frames are found. * infcmd.c (finish_command): Move skip_tailcall_frames call into forward- execution case. Add an error if only tailcall frames are found. * stack.c (frame_info): Check frame_unwind_caller_id. testsuite/ * gdb.btrace/tailcall-only.exp: New. * gdb.btrace/tailcall-only.c: New. * gdb.btrace/x86_64-tailcall-only.S: New. * gdb.btrace/i686-tailcall-only.S: New.