public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: "liuxu (AJ)" <liuxu156@huawei.com>
Cc: "elfutils-devel@sourceware.org" <elfutils-devel@sourceware.org>,
	"Wangqiangdong(Frank, IAS)" <wangqiangdong@huawei.com>,
	"zhangjianwei (D)" <zhangjianwei8@huawei.com>,
	dingzhuang <dingzhuang1@huawei.com>
Subject: Re: A scenario where Perf cannot unwind the user stack by dwarf with libdw.so
Date: Thu, 16 Feb 2023 23:48:17 +0100	[thread overview]
Message-ID: <20230216224817.GG6028@gnu.wildebeest.org> (raw)
In-Reply-To: <88c25e0709834e1a816630c944377640@huawei.com>

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

  reply	other threads:[~2023-02-16 22:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-13  1:44 liuxu (AJ)
2023-02-16 22:48 ` Mark Wielaard [this message]
2023-02-23 10:25   ` Mark Wielaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230216224817.GG6028@gnu.wildebeest.org \
    --to=mark@klomp.org \
    --cc=dingzhuang1@huawei.com \
    --cc=elfutils-devel@sourceware.org \
    --cc=liuxu156@huawei.com \
    --cc=wangqiangdong@huawei.com \
    --cc=zhangjianwei8@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).