From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29622 invoked by alias); 29 Nov 2013 14:39:07 -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 29564 invoked by uid 89); 29 Nov 2013 14:39:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_50,RDNS_NONE,URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: mga09.intel.com Received: from Unknown (HELO mga09.intel.com) (134.134.136.24) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 29 Nov 2013 14:38:30 +0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 29 Nov 2013 06:34:43 -0800 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 29 Nov 2013 06:38:21 -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 rATEcKav012327; Fri, 29 Nov 2013 14:38:20 GMT Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id rATEcKqe012772; Fri, 29 Nov 2013 15:38:20 +0100 Received: (from mmetzger@localhost) by ulvlx001.iul.intel.com with œ id rATEcK2W012768; Fri, 29 Nov 2013 15:38:20 +0100 From: Markus Metzger To: jan.kratochvil@redhat.com Cc: gdb-patches@sourceware.org Subject: [patch v7 05/24] frame: artificial frame id's Date: Fri, 29 Nov 2013 14:39:00 -0000 Message-Id: <1385735899-12481-6-git-send-email-markus.t.metzger@intel.com> In-Reply-To: <1385735899-12481-1-git-send-email-markus.t.metzger@intel.com> References: <1385735899-12481-1-git-send-email-markus.t.metzger@intel.com> X-IsSubscribed: yes X-SW-Source: 2013-11/txt/msg00922.txt.bz2 2013-11-29 Markus Metzger * frame.h (frame_id_build_artificial): New. * frame.c (frame_id_build_artificial): New. (frame_id_p): An artificial frame is valid. (frame_id_eq): A frame is equal to itself. --- gdb/frame.c | 28 +++++++++++++++++++++------- gdb/frame.h | 6 ++++++ 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/gdb/frame.c b/gdb/frame.c index bd31d87..931a33c 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -504,6 +504,19 @@ frame_id_build_wild (CORE_ADDR stack_addr) return id; } +struct frame_id +frame_id_build_artificial (CORE_ADDR code_addr, + CORE_ADDR special_addr) +{ + struct frame_id id = null_frame_id; + + id.code_addr = code_addr; + id.code_addr_p = 1; + id.special_addr = special_addr; + id.special_addr_p = 1; + return id; +} + int frame_id_p (struct frame_id l) { @@ -514,6 +527,9 @@ frame_id_p (struct frame_id l) /* outer_frame_id is also valid. */ if (!p && memcmp (&l, &outer_frame_id, sizeof (l)) == 0) p = 1; + /* An artificial frame is also valid. */ + if (!p && l.code_addr_p && l.special_addr_p) + p = 1; if (frame_debug) { fprintf_unfiltered (gdb_stdlog, "{ frame_id_p (l="); @@ -537,13 +553,11 @@ frame_id_eq (struct frame_id l, struct frame_id r) { int eq; - if (!l.stack_addr_p && l.special_addr_p - && !r.stack_addr_p && r.special_addr_p) - /* The outermost frame marker is equal to itself. This is the - dodgy thing about outer_frame_id, since between execution steps - we might step into another function - from which we can't - unwind either. More thought required to get rid of - outer_frame_id. */ + if (memcmp (&l, &r, sizeof (l)) == 0) + /* Every frame is equal to itself. + This is the dodgy thing about outer_frame_id, since between execution + steps we might step into another function - from which we can't unwind + either. More thought required to get rid of outer_frame_id. */ eq = 1; else if (!l.stack_addr_p || !r.stack_addr_p) /* Like a NaN, if either ID is invalid, the result is false. diff --git a/gdb/frame.h b/gdb/frame.h index 3302645..29c3d16 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -174,6 +174,12 @@ extern struct frame_id frame_id_build_special (CORE_ADDR stack_addr, as the special identifier address are set to indicate wild cards. */ extern struct frame_id frame_id_build_wild (CORE_ADDR stack_addr); +/* Construct an artificial frame ID. The first parameter is the frame's + constant code address (typically the entry point), and the second the + frame's special identifier address. */ +extern struct frame_id frame_id_build_artificial (CORE_ADDR code_addr, + CORE_ADDR special_addr); + /* Returns non-zero when L is a valid frame (a valid frame has a non-zero .base). The outermost frame is valid even without an ID. */ -- 1.8.3.1