From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 72747 invoked by alias); 30 Oct 2019 23:55:56 -0000 Mailing-List: contact elfutils-devel-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: elfutils-devel-owner@sourceware.org Received: (qmail 72736 invoked by uid 89); 30 Oct 2019 23:55:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: mail-pg1-f194.google.com Received: from mail-pg1-f194.google.com (HELO mail-pg1-f194.google.com) (209.85.215.194) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 30 Oct 2019 23:55:54 +0000 Received: by mail-pg1-f194.google.com with SMTP id u23so2664061pgo.0 for ; Wed, 30 Oct 2019 16:55:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=jZXeE/KZWUqnfijU+5/apw9l3JBVJbOalZDJ7wGoCRY=; b=FGUjZaHLDez/F4u6ZN9mqYSa+1Qx4Nnyf1uhILTdhEkzeAjFnWm8j4S+JVbpRDaDo+ af0XuCi5fg3c5yKY0uAfaWXcoip3O1jrKbviqvZkI58g1Zm2sMHzvRRnY9z8F253ARw3 YLZCw5gjKjxVMyL9Po6/OgGUwGOtIzwW68Hwn/Sued12DO4frVVXvAhW6uYNsEZC721r 6TeMBPiyAagGXm03jZ88PRee1oPF0+iL5jQWfghtoRRxBT2wOqsnoSUi62+Ip/JAT/me D+A9zpIvVSN/LcTa+bpM7F7WZ9NpFWImV+JFPEGDS46W42/5hUA99XK89Pf9YlMVeJAH qGGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=jZXeE/KZWUqnfijU+5/apw9l3JBVJbOalZDJ7wGoCRY=; b=sVaip6A0rCfmfxWxNje/BjDV9hnCk0tRpDcwzBp1e2JJqK2trdZK6IkSpqDjxecBAO DspEglgCXCtLGj8FSBQgJ1QiRoL1ES+kZh5nQcNszuaVoKSskvYgxsAvtkzJ52JQH5KY oOId3D+zChQVGHbUz0DdZEXwDYFZGvci8DxbuaE8L4AlTy8/rsxbbwPwD8b+r9WZ/i6Y MgGjPMEmBbWZY4jdq/PJbshaBYp2fvn9MXciO0yPAgGqcCWOOnmp6F478yZ9W3l+MrDJ vCqXLXFmZLpKkcOAbRRgfz70jeuQwlFX7BsBEUVoT7UfbxZVvuYhbRRJ1QOo2jUvCBWl bsxQ== X-Gm-Message-State: APjAAAWb0J5oz1Pyfd/tfQirUC0YRHfEEePXujbMSDxnGgkY97k93SJz f5MQTrxRlVyvFQ/KEIhacVLOkFPb7KI= X-Google-Smtp-Source: APXvYqwgMJGwjZGhs/Il3TQ2HsnCycJteSZxwyt1MM5MWBS+p29wyQnFvmWdJQVRmgztRHMt/cnH9Q== X-Received: by 2002:a62:e319:: with SMTP id g25mr2372216pfh.146.1572479753015; Wed, 30 Oct 2019 16:55:53 -0700 (PDT) Received: from vader ([2620:10d:c090:180::3912]) by smtp.gmail.com with ESMTPSA id e8sm1011267pga.17.2019.10.30.16.55.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2019 16:55:52 -0700 (PDT) Date: Wed, 30 Oct 2019 23:55:00 -0000 From: Omar Sandoval To: Mark Wielaard Cc: elfutils-devel@sourceware.org Subject: Re: [PATCH 4/5] libdwfl: cache Dwfl_Module and Dwarf_Frame for Dwfl_Frame Message-ID: <20191030235551.GJ326591@vader> References: <7be679675894550820b63e7c08a5495d06ac49a8.camel@klomp.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7be679675894550820b63e7c08a5495d06ac49a8.camel@klomp.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-IsSubscribed: yes X-SW-Source: 2019-q4/txt/msg00088.txt.bz2 On Wed, Oct 30, 2019 at 02:04:42PM +0100, Mark Wielaard wrote: > Hi Omar, > > On Mon, 2019-10-07 at 02:05 -0700, Omar Sandoval wrote: > > The next change will need to have the Dwarf_Frame readily available, so > > rather than finding it again every time, let's cache it for reuse. The > > CFI frame can also be useful to clients of libdwfl, so add > > dwfl_frame_dwarf_frame to get it. Similarly, the Dwfl_Module is also > > frequently needed in conjunction with the frame, so cache it and add > > dwfl_frame_module. > > I can see how this is useful. But it seems the Dwarf_Frame is only > cached when __libdwfl_frame_unwind is called. Which I believe isn't > done for the initial frame. Also it isn't clear how to propagate any > errors when NULL is returned. Maybe dwfl_frame_dwarf_frame () should > check first to see if frame is NULL and then call lookup the CFI and > call dwarf_cfi_addrframe if not? Yes, that makes sense. Rather than doing the lookups in __libdwfl_frame_unwind and handle_cfi, I can move the lookups to dwfl_frame_module and dwfl_frame_dwarf_frame, have those functions cache it internally, and make __libdwfl_frame_unwind and handle_cfi call those functions. Thanks, Omar