|
From: | hai huang |
Subject: | Re: [Libunwind-devel] Problem with using libunwind in a ptrace setting where tracer uses pthread |
Date: | Wed, 26 Jul 2017 13:26:10 -0400 |
HaiI'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!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.Subsequently, each tracer thread makes unw_step(&c) calls to walk the stack frames of its corresponding tracee thread.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);
-
[Prev in Thread] | Current Thread | [Next in Thread] |