I found my problem. It's actually not related to libunwind, but how my
program is using ptrace and waiting for signals. Thanks!

-
Hai

On Wed, Jul 26, 2017 at 10:53 AM, hai huang <[email protected]> wrote:

> Hi folks,
>
> I've been using libunwind in an x86_64 Linux environment to do stack
> walking on ptraced processes with great success. However, that's only when
> the tracee is single threaded. When the tracee is multi-threaded, I rewrote
> my tracer program to be multi-threaded using pthread, so that I have a
> tracer thread for each tracee thread. Each tracer thread has its own
> libunwind "context", i.e., each thread creates its own libunwind variables
> as follow:
>
> as = unw_create_addr_space(&_UPT_accessors, 0);
> ui = _UPT_create(child);
> unw_init_remote(&c, as, ui);
>
> Subsequently, each tracer thread makes unw_step(&c) calls to walk the
> stack frames of its corresponding tracee thread.
>
> Once I starts the tracer program, I immediately (within a second) see a
> failure of the call `unw_init_remote(&c, as, ui)`, which returned `-3`.
> This corresponds to the UNW_EBADREG error.
>
> I'm suspecting I needed some synchronization between my tracer threads as
> some libunwind states are not multi-threading safe, but I haven't found
> what exactly I need to protect. Any hints/suspicions would be greatly
> appreciated! Thanks!
>
> -
> Hai
>
_______________________________________________
Libunwind-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/libunwind-devel

Reply via email to