From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id DE900385B508 for ; Thu, 16 Feb 2023 22:48:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DE900385B508 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: by gnu.wildebeest.org (Postfix, from userid 1000) id 19FAD30067D7; Thu, 16 Feb 2023 23:48:17 +0100 (CET) Date: Thu, 16 Feb 2023 23:48:17 +0100 From: Mark Wielaard To: "liuxu (AJ)" Cc: "elfutils-devel@sourceware.org" , "Wangqiangdong(Frank, IAS)" , "zhangjianwei (D)" , dingzhuang Subject: Re: A scenario where Perf cannot unwind the user stack by dwarf with libdw.so Message-ID: <20230216224817.GG6028@gnu.wildebeest.org> References: <88c25e0709834e1a816630c944377640@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <88c25e0709834e1a816630c944377640@huawei.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-3031.3 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi, On Mon, Feb 13, 2023 at 01:44:39AM +0000, liuxu (AJ) via Elfutils-devel wrote: > I am failing to unwind the user stack with libdw on Ubuntu 18.04 > arm64 environment, the toolchain used is clang 12.0.1. form the > unwinding process, I found that the pc value passing to handle_cfi > is 0x760, which is 0x10000 offset from the corresponding cfi address > 0x10760. > > Futher analysis show that the bias calculated in > __libdwfl_elf_address_range for ET_DYN type pick the first PT_LOAD > segment, not the segment corresponds to code segment. So the bias > result is wrong in current situation. I have some problem replicating this because I don't have the same toolchain and don't know enough about perf to know how to replicate. So if I understand correctly you are using clang and lld to link against a musl based libc/ld.so on aarch64? Does this generate PIE executables? Have you tried a different setup? I expect the issue is the PT_LOAD segments generated by lld are different from ld (bfd). But it would be good to know if this is the difference that makes things fail. Are you able to show the issue using eu-stack instead of perf? If not, could you show how to see the issue with perf? > The actual parameters of handle_cfi when I report: > Breakpoint 1, handle_cfi (state=state@entry=0xaaaaaadc45b0, pc=1888, cfi=0xaaaaaadc4900, bias=757661696) at frame_unwind.c:540 > warning: Source file is more recent than executable. Could you show the backtrace at this point? (Note that gdb believes you have changed the sources, but haven't rebuild libdw.so) Thanks, Mark