Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2504804rdb; Mon, 20 Nov 2023 12:44:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IErgd3DeeWEcdItYExqhGW5tyadmDkyn4Z9UaJmXRtD6Nvoj2Mn5XkWcvxUD8smLoqix8No X-Received: by 2002:a05:6830:90b:b0:6d7:d49c:51a2 with SMTP id v11-20020a056830090b00b006d7d49c51a2mr5530212ott.10.1700513052167; Mon, 20 Nov 2023 12:44:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700513052; cv=none; d=google.com; s=arc-20160816; b=xpZeOZZdYzOruXp8YMpgqiTw7JSE2jhMxNyZIdduk3hhXf6D1E5bTo7mzY13rKHI3d NywIEF4mWuVkndR3RV4VG6CPmxzH6kCi6bvw+qxFXG83KH3RH9fvjn3W0rEVHAFfIeVJ p49Vt7jtDWxrThZXUWgGpkkFapGRSguRPEsg+FlIvDc9qS6wHrt/mY2nu9d4OEKVzjmX WeNt2ciikG6IFxh+ShxBuMH70tQ6EMi26gEYrfwQ8NWooGPCRcy6b3IXEy2530095v9T pRl5+j0IvukgSr3toglOtLc3qHYiL4ajQ3abvOdUmWlTSosCzGLF8AaJdaBZtHWPAFP6 3X8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=UODylUR6nsVBl8FPyXrlvn5wrS146jGcD/TsdRW5+Hw=; fh=8Dpaa4Au0bUQox1YQWf+8KPntNaV+MSrxgPl6/U8ulw=; b=MyDaYO1iC0+gD8dqQupwgFowaSRIOmne3oynLISPg7IShljybxXE67r99FjrwTXEBR CpIZyZYE0ElySwRv5jO2YmJuBGfOwLbWly4Temjk6zgKoY6ShdoA0FsxEzsPTyd58+Jy cRKe3uvgd/p97ZZ/QcwDmUSDbnyE+FJ2Qx7L+nSbTEZA0W4vLztWR+5SVFnPIB2Mpi71 JoS/GwmpIBjCeZ62Hk5Gdk18hlcBjn5153lym0dZJkMWNJsIohautd74gbMk4mc99otX WcQ8Y4YKwdYWLZjXnU87F2hfQrLNQgO9HFlpNkoK8vXrfTNTBWrksrrK5v205+F4BrRp jb2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id cl18-20020a056a02099200b005c1e762bc50si9258756pgb.742.2023.11.20.12.44.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 12:44:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D10378061B71; Mon, 20 Nov 2023 12:43:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230170AbjKTUnR convert rfc822-to-8bit (ORCPT + 99 others); Mon, 20 Nov 2023 15:43:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229627AbjKTUnP (ORCPT ); Mon, 20 Nov 2023 15:43:15 -0500 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 169D2E3; Mon, 20 Nov 2023 12:43:12 -0800 (PST) Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-2839b418f7fso2076048a91.2; Mon, 20 Nov 2023 12:43:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700512991; x=1701117791; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5uEWKcf0Qu+JBFnsj4DeP5h18wjA4sNIxAJuwdb8sxU=; b=hKwgQgnBzTZLF4RlW/aeaGNubHJTv+IgO+8jkMihNlQbqXgOc3Oh+LkyqDspkbCF48 HirD1OmCLY4bfxnMXmoGdsJxdEINbsTr0byj+I2AzmZ58JLHjA+HZeNKTBVVa4atRFyd 2kfi/BmS5xjYe+VmQ/RtI5sUF5Ng9ghKJA6SFqeCz37t8EJ6rwpNNICrobxa0qBsUmKq 26k8yrUb04UHl/xcxwCVHrJ53H5V8Q8Z8NAH3i6LsmhPsGLwcmI6hI5iAed8QEe5B5G+ qiYqhTzh6opezbQbHDX0vRrpsLrG72xnfix4D4iuZXDqXrPU3HWoW9uViQh4GfuoRi/7 O9rg== X-Gm-Message-State: AOJu0YyQ9GApiYr1CPYdwsB31aUifcx80iXOPrwgHvmGJwhX2gJ4Np0n fLpqrtR6v2kYTsFM2CgDijkD4tvkjaEhcrYiwcc= X-Received: by 2002:a17:90a:f018:b0:27f:fc2f:4831 with SMTP id bt24-20020a17090af01800b0027ffc2f4831mr7539084pjb.13.1700512991415; Mon, 20 Nov 2023 12:43:11 -0800 (PST) MIME-Version: 1.0 References: <20231110000012.3538610-1-namhyung@kernel.org> <20231110000012.3538610-13-namhyung@kernel.org> In-Reply-To: From: Namhyung Kim Date: Mon, 20 Nov 2023 12:43:00 -0800 Message-ID: Subject: Re: [PATCH 12/52] perf annotate-data: Add find_data_type() To: Arnaldo Carvalho de Melo Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Peter Zijlstra , Ian Rogers , Adrian Hunter , Ingo Molnar , LKML , linux-perf-users , Linus Torvalds , Stephane Eranian , Masami Hiramatsu , Andi Kleen , Linux Trace Devel , linux-toolchains@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 20 Nov 2023 12:43:20 -0800 (PST) Hi Arnaldo, On Sat, Nov 11, 2023 at 10:55 AM Arnaldo Carvalho de Melo wrote: > > On Thu, Nov 9, 2023, 9:00 PM Namhyung Kim wrote: >> >> >> +static bool find_cu_die(struct debuginfo *di, u64 pc, Dwarf_Die *cu_die) >> +{ >> + Dwarf_Off off, next_off; >> + size_t header_size; >> + >> + if (dwarf_addrdie(di->dbg, pc, cu_die) != NULL) >> + return cu_die; > > Isn't the return type a bool? > > Shouldn't be 'return true;'? > > Ends up like that as cu_die isn't NULL, but looks confusing. Ok, will change. > >> + >> + /* >> + * There are some kernels don't have full aranges and contain only a few >> + * aranges entries. Fallback to iterate all CU entries in .debug_info >> + * in case it's missing. >> + */ >> + off = 0; >> + while (dwarf_nextcu(di->dbg, off, &next_off, &header_size, >> + NULL, NULL, NULL) == 0) { >> + if (dwarf_offdie(di->dbg, off + header_size, cu_die) && >> + dwarf_haspc(cu_die, pc)) >> + return true; >> + >> + off = next_off; >> + } >> + return false; >> +} >> + >> >> +struct annotated_data_type *find_data_type(struct map_symbol *ms, u64 ip, >> + int reg, int offset) >> +{ >> + struct annotated_data_type *result = NULL; >> + struct dso *dso = ms->map->dso; >> + struct debuginfo *di; >> + Dwarf_Die type_die; >> + struct strbuf sb; >> + u64 pc; >> + >> + di = debuginfo__new(dso->long_name); >> + if (di == NULL) { >> + pr_debug("cannot get the debug info\n"); > > > Shouldn't inform the dso->long_name and function name to ease debugging? Sounds good, I'll update it in the v3. Thanks, Namhyung