Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp387511lqp; Thu, 4 Apr 2024 17:10:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUvNICqpNheiRmHeFie/ZIPqZ5LnhSM7F0zwWGcj1jj6w5S8LnZee5782OYW+7SlOaNT/GuzOG0a1UhwtcVvJbqxtmgJs0SKGlVPTwTSQ== X-Google-Smtp-Source: AGHT+IG36C1ujoPwooiVzN037eGbcvtLU84Ai5j/brmDqXNlNSlsaUgQ0Fszx6Q4XZNuR0cxPkWq X-Received: by 2002:a50:cd16:0:b0:566:2f24:b063 with SMTP id z22-20020a50cd16000000b005662f24b063mr2833847edi.23.1712275806484; Thu, 04 Apr 2024 17:10:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712275806; cv=pass; d=google.com; s=arc-20160816; b=UT6U/OnwtxWqGjevMTsfDcBCQnuBVMj9bkz5Ui7jWiyMhTOm9fI4ElpV7hLHmnqPdD doLeBIapRyy4L58g6tVqJB8RWfw8bXJ+/FImYk+L66fiHWy13x6vaUt2BtZnZnk+cN8k la0F+3/Di2F9WKFuGeSmf7kE7ss3ngAnP93OJSMo4u63yvMP9eOS7TVmN3HWPqFROT/O dFX/AqkGyU5mdy6j1njiIZBnVh9ytr60v12BvK1mfXQQenngTfJ5dEuSzxR94MBwXGse 8tHw8f12/3dfjwOtRT5Y1VNQGCGvBwB2el23f98ynayQy3MAk+yLiNH8NCQyWwvKcQGa rh8A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=DrEadAnWsc+S5I9mQlpyw9ef/mT3Xvv+Fy/i8/caB1o=; fh=l9Ffbid4DsPv2HMr8+PgN13jtmRif5+1PG8Go/BdRcg=; b=tfVWiXMF6PTlgEXtjO7Yy4mgDFMhsdR2xcBYY+jt0oyVpAOWOn1b/w2oCKuumCO0Wi bo6eJWRJB7y/0xDSu4gdbIQJJ1jKSSCrjAeIpRx5FMgzW1lFUilRwVx9pBbJb2pRIw24 vsIAQbZLneZqEi6i24J1Gd1ssx6EngIqvXRhwsACFLpmzF0beJy5EgFk378tG//vZTbe LtIxiPfRl5rXoRG6/++2/qDwukY9/aorCuNncueP5RMrcztjhG/12qy49uM4xic9SD5c Ci1i2dLN4kFT+YsO63SJxbE4fwnz0HWyW28yn9qc3QSy7ZIj3xajmaA66MFrmh3yzE58 KB3A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=L4MH14xC; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-132284-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132284-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ig13-20020a056402458d00b0056c2e234624si161186edb.395.2024.04.04.17.10.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 17:10:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-132284-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=L4MH14xC; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-132284-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132284-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3A8331F21C08 for ; Fri, 5 Apr 2024 00:10:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9953C139B; Fri, 5 Apr 2024 00:09:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="L4MH14xC" Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7244D36F; Fri, 5 Apr 2024 00:09:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712275797; cv=none; b=BaOBvfSlMOhHrrV6EDu08DdZ5a4ABAV/+Ig2EJCEbWUe41vzSIMDnhztIs7JO7ncQpqEVg6iPKThs6z1e9d8r8LKnl9iegRuxBae4adNjJfzGKhO5pBd25BegdLp+/FnoZuSQ9+0Le89mGDpSodm+mvpiYHXbV3jcI96vHN82ko= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712275797; c=relaxed/simple; bh=VslqtpWV8HZ2n6jsi2flLRXK1lNliMOrPOyCoQd/QcM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ezHg0+rsoXU9z6lu02IcG5JmFdJACvqv8oQXX9ypDmKXuaT3kMaZiSt7flIwemnG1s+TSUelBoU7KkQVOTyZe7+zCMeH0/eG+7EtqiVvnDS6Ul42wh0SHuPT3TQhw9uY2IpkSJuxwoQyByV7KAEIUEJwx1QBNzJbN08x4mTX1Ss= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=L4MH14xC; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-6ead4093f85so1403967b3a.3; Thu, 04 Apr 2024 17:09:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712275796; x=1712880596; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=DrEadAnWsc+S5I9mQlpyw9ef/mT3Xvv+Fy/i8/caB1o=; b=L4MH14xCKZd8t54HVCwUYaSR90xY+EXmRKLUuE3XF7iJAFt+V0v8L8+7G5mNUn+hXX U4Wqd1NDMIUCnc64iKAyobfbl2ZiuGgwHF6zMITqHYgp4XiWqHQwWQ8bnfHg8FhfVXBX lB8lpGyBXIOzgRomLmAs5uvk+W/SwTDIybZe3b3KU50ZLXD6wIiXKyBt52OJSMpQ2Bfd 0YzsS/kwwcvWTstIWG8fF6Fum8mHktFC0QC6uC31HT8yMG414r0XRNvvS88RFp31jahC odUHBFJmQxyxpK6fcmsbSE6Tx2lJgnc1+5SE6/kdursJRNZr9649cCp6pbP/MZFjv3kK eOWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712275796; x=1712880596; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DrEadAnWsc+S5I9mQlpyw9ef/mT3Xvv+Fy/i8/caB1o=; b=PjFvI3FhI+CgenWHzLCE4UHhxgNPqDiFfrCPhyzOffGRCrRZTDCJs6fnVbSkIj1KW8 qR9hegPEHZNLjc0jvo7iRDaSvqgxUDeTdooVfoOz2VZEW4kpySrOZJ/Hrl9+b8uWgJIS HcvUIlwTYtBUhBin+KBr+V7LHPA26i6Bt3lqCfTSyAFDUQFevZpv9/OuXdIRN7STu4it cVlGgYcmw2L7Lf/eRwmvoQPIE0Ki7sjwJsnpGbxzgO8YoQRGMEetck0azFOrqbaFW7LC /jjqFGXHEiPfXozF0YmhiAI3bOn/p7h1jauWn5kZmJLdE8z5DIxJW1IPEUz+M9N0LhfI srKg== X-Forwarded-Encrypted: i=1; AJvYcCV9dvo/xuX2uHoGcG0Mn2rWp9kufKVF+Yi7J1DhMIFIIVSRiT3C9jLKc2p9MSyhgYhHpgz9w40iXGPIP8wgTNZ0kZMeoS14kkOqVQxhLNb+RI1VF0ktT1STFRF+tagHsjBIsWbC6enO0oCTuEZ2Kg== X-Gm-Message-State: AOJu0Yz+k5e3EkOLc72FXoIjOC85Db4a7iC7EdaXMg0qjhQnwnV4Kf4k lvn21xIdqkmfoB+2obnF7HgN6hLulzeIL9N/1c/F7oaFYUqLLk06 X-Received: by 2002:a05:6a20:d80d:b0:1a3:c549:62ef with SMTP id iv13-20020a056a20d80d00b001a3c54962efmr69231pzb.1.1712275795657; Thu, 04 Apr 2024 17:09:55 -0700 (PDT) Received: from [192.168.54.105] (static.220.238.itcsa.net. [190.15.220.238]) by smtp.gmail.com with ESMTPSA id 3-20020a631843000000b005e485fbd455sm253708pgy.45.2024.04.04.17.09.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Apr 2024 17:09:55 -0700 (PDT) Message-ID: <3485d1b1-7824-4e62-82b4-ed52360122dd@gmail.com> Date: Thu, 4 Apr 2024 21:09:51 -0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] perf srcline: Implement addr2line using libdw To: Namhyung Kim , Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240401160805.51277-1-yakoyoku@gmail.com> Content-Language: en-US From: Martin Rodriguez Reboredo In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/1/24 8:31 PM, Namhyung Kim wrote: > [...] > > Thanks for doing this! Yep, we could unset the env temporarily. > > As a general comment, perf has some helper functions for libdw > in util/dwarf-aux.[ch]. Please take a look and use/update them. Whoops! I haven't seen that file, thanks for mentioning it. > [...] > > Probably we can use cu_find_lineinfo(). I could use that, I'll see. > [...] > >>> +static struct a2l_data *addr2line_init(const char *path) > > debuginfo__new()? `libdw_a2l_new` can be another option too. > [...] > >>> +static int get_inline_function(struct dso *dso, struct inline_node *node, >>> + struct symbol *sym) >>> +{ >>> + struct a2l_data *a2l = dso->a2l; >>> + Dwarf_Addr addr = a2l->addr + a2l->bias; >>> + Dwarf_Addr bias = 0; >>> + Dwarf_Die *cudie = dwfl_module_addrdie(a2l->mod, addr, &bias); >>> + >>> + Dwarf_Die *scopes = NULL; >>> + int nscopes = dwarf_getscopes(cudie, addr - bias, &scopes); > > It's not clear to me how this dwarf_getscopes() and later > dwarf_getscopes_die() work together. Can you please add some > comment? Also we have die_get_scopes() and I think it's simpler. I think the first is to get the scopes at an address and the second is for the scopes with the addr offset at that DIE. Off the top of my head. > [...] > > Why not get the function name from the abstract origin? I'm not getting it, where's that abstract origin? > [...]