[Ltrace-devel] [PATCH] Add support for using elfutils as unwinder.

Mark Wielaard mjw at redhat.com
Tue Jan 7 20:29:02 UTC 2014


Hi Petr,

On Tue, 2014-01-07 at 18:12 +0100, Petr Machata wrote:
> this looks mostly fine, except for a couple mostly coding-style nits.

Hopefully I got the style right in this update.

> I haven't tested yet though.

Not surprising given elfutils-0.158 has been released only yesterday.
But if you like you can easily test it by installing it in a prefix and
using ./configure --with-elfutils=/usr/local/install/elfutils
The patch sets up the configure and build files so that make && make
check should just work with that.

> > +	... not fancy for now. */
> 
> I'm not against the fancy FWIW, though ltrace doesn't currently
> recognize existence of Dwarf.  Any reason not to include the above code?
> Any reason not to drop it altogether then?

I didn't enable it initially since I thought it would be easier to get
the patch accepted if the output was identical to what you would get
with libunwind and ltrace -w. But if you like fancy it can also be
enabled by default as done in the revised patch. Now the output looks
like:

libxcb.so.1->malloc(32, 1, 32, 0)                = 0x7fee11b791c0
 > libxcb.so.1(_xcb_in_read+0x28b) [3fe080bc4b]
	/usr/src/debug/libxcb-1.9.1/src/xcb_in.c:179
 > libxcb.so.1(_xcb_conn_wait+0x256) [3fe080a126]
	/usr/src/debug/libxcb-1.9.1/src/xcb_conn.c:450
 > libxcb.so.1(wait_for_reply+0xbe) [3fe080b44e]
	/usr/src/debug/libxcb-1.9.1/src/xcb_in.c:399
 > libxcb.so.1(xcb_wait_for_reply+0x61) [3fe080b561]
	/usr/src/debug/libxcb-1.9.1/src/xcb_in.c:429
 > libX11.so.6(_XReply+0x126) [3fe0443016]
	/usr/src/debug/libX11-1.6.1/src/xcb_io.c:602
 > libXss.so.1(XScreenSaverQueryInfo+0x84) [7fee69bf1274]

> > +		if (dwfl_getthread_frames(proc->leader->dwfl, proc->pid,
> > +					  frame_callback, &frames) < 0)
> 
> Here you rely on the fact that DWARF_CB_ABORT is > 0, which is not
> obvious (though likely always true).  But dwfl_getthread_frames doesn't
> care about particular value returned from the callback as long as it's
> non-zero, so why not change the DWARF_CB_ABORT above to 1?

Done and added a comment to frame_callback explaining the function
return values -1, 0, 1.

Updated and rebased patch attached.

Thanks,

Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-support-for-using-elfutils-as-unwinder.patch
Type: text/x-patch
Size: 14684 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/ltrace-devel/attachments/20140107/2a7d7284/attachment.bin>


More information about the Ltrace-devel mailing list