[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Libunwind-devel] [PATCH 6/6] Fixes for interation end conditions of
From: |
Konstantin Belousov |
Subject: |
Re: [Libunwind-devel] [PATCH 6/6] Fixes for interation end conditions of non-dwarf walker on x86_64. |
Date: |
Thu, 17 May 2012 15:18:19 +0300 |
User-agent: |
Mutt/1.4.2.3i |
On Wed, May 16, 2012 at 08:28:35AM -0700, Arun Sharma wrote:
> On Tue, May 15, 2012 at 3:53 AM, Konstantin Belousov
> <address@hidden> wrote:
>
> >> I applied only the first part of this patch.
> > It seems that 1a6ea3da607d35c03733b9db26b64b71cdbfcfa7 was applied as a
> > whole.
>
> I forgot to specify the -a flag to git commit --amend.
>
> Reverted the second half now (although with an incorrect commit
> message and savannah doesn't let me amend). dwarf_get() is different
> from dwarf_step().
>
> >
> > I do not understand your note about dwarf_get() returning 0. Isn't
> > dwarf_get()
> > API is defined to return 0 on success and (non-zero) UNW_ error on failure ?
>
> Old code was passing through the return value of dwarf_get() (ret=0 =>
> success) and the caller was interpreting it as (ret=0 => stop
> unwinding).
Yes. And this is exactly the case with syscall stub unwinding on FreeBSD.
Currently, libc-generated stubs do not provide dwarf unwind info, so
dwarf_step() returns -UNW_ENOINFO and special step code is activated.
FreeBSD Gos-freebsd.c unw_handle_signal_frame() does record non-null
location for %rip in the cursor->dwarf.loc[RIP], see Gos-freebsd.c:140.
Then, the success of dwarf_get() causes unwinding stop on the first frame
for a thread that is inside syscall.
I.e., with change reverted, I get:
sirion% ./pstack $$ ~/build/bsd/pstack/build-x86_64
2210: /usr/local/bin/zsh (osrel 900505)
Thread 100138:
0x8014d167c _sigsuspend+0xc
while with it still applied
sirion% ./pstack $$ ~/build/bsd/pstack/build-x86_64
2210: /usr/local/bin/zsh (osrel 900505)
Thread 100138:
0x8014d167c _sigsuspend+0xc
0x463478 signal_suspend+0x48
0x43b669 scanjobs+0x3d9
0x43b768 waitjobs+0x28
0x4243f3 execstring+0x3ca3
0x424e09 execlist+0x489
0x42519b execode+0x9b
0x436222 loop+0xc2
0x43747d zsh_main+0x65d
0x40e0ee _start+0x8e
(pstack is pstack(1) that utilizes libunwind).
>
> test-ptrace doesn't fail everywhere as a result of your patch. It
> failed for me on Ubuntu 12.04, but passed on Centos5.
Quite strange, I do not have access to any Linux machine to debug.
>
> This requires a bit more debug. Is this change solving a real world
> problem for you?
>
> -Arun
pgpx8tspsmjSx.pgp
Description: PGP signature