[Ltrace-devel] -l reintroduced

Petr Machata pmachata at redhat.com
Thu Sep 27 23:00:19 UTC 2012


Hi list,

during the development of libs branch (support for tracing inter-library
calls), I broke support for -l.  This is now back.  -l takes as an
argument a library pattern, the same that -e and -x take after a @.  It
only takes a library pattern though, not the full expression, so -l X
means library X, not symbol X.  -l means: trace any PLT entry that is
implemented by a library matched by this pattern.  E.g.:

$ ./ltrace -l libselinux\* -F <(echo 'int lgetfilecon(string, +string*);') -- ls -Z e*.o
ls->lgetfilecon("execute_program.o", "unconfined_u:object_r:user_home_"...) = 37
ls->lgetfilecon("expr.o", "unconfined_u:object_r:user_home_"...)            = 37
-rw-rw-r--. petr petr unconfined_u:object_r:user_home_t:s0 execute_program.o
-rw-rw-r--. petr petr unconfined_u:object_r:user_home_t:s0 expr.o
+++ exited (status 0) +++

With this code come two ways of postponing breakpoint enablement.  The
one I need for this to work is latent symbol.  The one I hope will be
useful for MIPS is delayed symbol.  They both work the same way: when a
breakpoint is requested for symbol, this breakpoint is only realized if
symbol is neither latent, nor delayed.  If any of these flags are
cleared, breakpoint enablement is retried.

These two flags differ in who owns them.  Latent is owned and cleared by
ltrace core, and used for tracking -l.  Delayed is owned by a backend,
and cleared when backend calls proc_activate_delayed_symbol.  I hope
this can be used in lieu of the current hack with a special PLT type.
I didn't really test whether delayed flag works, but it's so similar to
latent flag, that hopefully I didn't make any bugs.

The code is on the branch pmachata/dash-l.  Comments welcome, I intend
to merge this sometime next week.

Thanks,
PM



More information about the Ltrace-devel mailing list