From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26788 invoked by alias); 11 Feb 2016 16:15:28 -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 25218 invoked by uid 89); 11 Feb 2016 16:15:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=H*r:sk:mmetzge X-HELO: mga02.intel.com Received: from mga02.intel.com (HELO mga02.intel.com) (134.134.136.20) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 11 Feb 2016 16:15:08 +0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 11 Feb 2016 08:14:46 -0800 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 11 Feb 2016 08:14:45 -0800 Received: from ulvlx001.iul.intel.com (ulvlx001.iul.intel.com [172.28.207.17]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id u1BGEipA025803; Thu, 11 Feb 2016 16:14:44 GMT Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id u1BGEis4012938; Thu, 11 Feb 2016 17:14:44 +0100 Received: (from mmetzger@localhost) by ulvlx001.iul.intel.com with œ id u1BGEihb012934; Thu, 11 Feb 2016 17:14:44 +0100 From: Markus Metzger To: palves@redhat.com Cc: gdb-patches@sourceware.org Subject: [PATCH v3 2/3] stack: check frame_unwind_caller_id Date: Thu, 11 Feb 2016 16:15:00 -0000 Message-Id: <1455207283-12660-2-git-send-email-markus.t.metzger@intel.com> In-Reply-To: <1455207283-12660-1-git-send-email-markus.t.metzger@intel.com> References: <1455207283-12660-1-git-send-email-markus.t.metzger@intel.com> X-IsSubscribed: yes X-SW-Source: 2016-02/txt/msg00363.txt.bz2 Callers of frame_unwind_caller_* functions are supposed to check frame_unwind_caller_id. Add such a check to frame_info and treat an invalid caller ID as if the caller PC were not available. 2016-02-11 Markus Metzger gdb/ * stack.c (frame_info): Check frame_unwind_caller_id. --- gdb/stack.c | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/gdb/stack.c b/gdb/stack.c index 89879f3..6e3acc7 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1509,27 +1509,32 @@ frame_info (char *addr_exp, int from_tty) wrap_here (" "); printf_filtered ("saved %s = ", pc_regname); - TRY - { - caller_pc = frame_unwind_caller_pc (fi); - caller_pc_p = 1; - } - CATCH (ex, RETURN_MASK_ERROR) + if (!frame_id_p (frame_unwind_caller_id (fi))) + val_print_unavailable (gdb_stdout); + else { - switch (ex.error) + TRY { - case NOT_AVAILABLE_ERROR: - val_print_unavailable (gdb_stdout); - break; - case OPTIMIZED_OUT_ERROR: - val_print_not_saved (gdb_stdout); - break; - default: - fprintf_filtered (gdb_stdout, _(""), ex.message); - break; + caller_pc = frame_unwind_caller_pc (fi); + caller_pc_p = 1; } + CATCH (ex, RETURN_MASK_ERROR) + { + switch (ex.error) + { + case NOT_AVAILABLE_ERROR: + val_print_unavailable (gdb_stdout); + break; + case OPTIMIZED_OUT_ERROR: + val_print_not_saved (gdb_stdout); + break; + default: + fprintf_filtered (gdb_stdout, _(""), ex.message); + break; + } + } + END_CATCH } - END_CATCH if (caller_pc_p) fputs_filtered (paddress (gdbarch, caller_pc), gdb_stdout); -- 1.8.3.1