Re: [PATCH] libdwfl: Add dwfl_getthread and dwfl_getthread_frames.

2013-12-21 Thread Mark Wielaard
On Sat, 2013-12-21 at 22:33 +0100, Jan Kratochvil wrote: > On Fri, 20 Dec 2013 15:23:54 +0100, Mark Wielaard wrote: > > While playing with the new unwinder interfaces I noticed that I was > > writing the same extra wrapper callbacks every time. > > Glad you agree the callbacks without lambda funct

[PATCH] libdwfl: linux-pid-attach.c don't detach threads already attached.

2013-12-21 Thread Mark Wielaard
While working on using the pid unwinder in ltrace I noticed it didn't really play well with a process that might already be ptrace attached to the thread under inspection. This patch solves that by detecting the thread already is ptrace attached and making sure we don't detach it ourselves in that

Re: [PATCH] libdwfl: Add dwfl_getthread and dwfl_getthread_frames.

2013-12-21 Thread Jan Kratochvil
On Fri, 20 Dec 2013 15:23:54 +0100, Mark Wielaard wrote: > While playing with the new unwinder interfaces I noticed that I was > writing the same extra wrapper callbacks every time. Glad you agree the callbacks without lambda functions are a pain. :-) [...] > --- a/libdwfl/libdwfl.h > +++ b/libd

[PATCH] libdwfl: Make sure to set the CFI return register only once (for ppc64).

2013-12-21 Thread Mark Wielaard
On PPC64 there are two DWARF registers numbers that can represent the same register. If that register is the CIE return register then we only want to set it once. The second setting will confuse the unwinder. Signed-off-by: Mark Wielaard --- libdwfl/ChangeLog | 5 + libdwfl/frame_unwin

Re: [COMMITTED] tests: backtrace.c only check we caught the last instruction on x86_64.

2013-12-21 Thread Jan Kratochvil
On Sat, 21 Dec 2013 19:44:28 +0100, Mark Wielaard wrote: > On some architectures gcc might introduce some "padding instructions" > at the end of the function (like on ppc64). So only assert we are at the > last instruction of backtracegen if on x86_64 native. In theory the assert > could even fail

Re: [PATCH] libdwfl: Correct nested asprintf result check in report_kernel_archive.

2013-12-21 Thread Mark Wielaard
On Sat, Dec 21, 2013 at 12:46:19PM -0500, Frank Ch. Eigler wrote: > > Yeah, I think you are right, I overdid it because I was a little embarrassed > > I had to count the brackets 6 times before seeing the bug even after it was > > pointed out to me. Pushed the simplified version: > > Aw heck, at t

[COMMITTED] tests: backtrace.c only check we caught the last instruction on x86_64.

2013-12-21 Thread Mark Wielaard
On some architectures gcc might introduce some "padding instructions" at the end of the function (like on ppc64). So only assert we are at the last instruction of backtracegen if on x86_64 native. In theory the assert could even fail on that architectures, but in practice it doesn't and it is a nic

Re: [PATCH] libdwfl: Correct nested asprintf result check in report_kernel_archive.

2013-12-21 Thread Frank Ch. Eigler
Hi - > Yeah, I think you are right, I overdid it because I was a little embarrassed > I had to count the brackets 6 times before seeing the bug even after it was > pointed out to me. Pushed the simplified version: Aw heck, at that point, why not ... int res = asprintf (&archive,

Re: [PATCH] libdwfl: Correct nested asprintf result check in report_kernel_archive.

2013-12-21 Thread Mark Wielaard
On Fri, Dec 20, 2013 at 03:09:28PM -0800, Roland McGrath wrote: > Personally I'd like it better as a ?: in the initializer rather than an if > (no repetition of "res ="). But I agree that putting the unlikely (... < 0) > separate from the ... makes it easier to follow. Yeah, I think you are right