diff options
author | Petr Machata <pmachata@redhat.com> | 2012-09-28 00:08:00 +0200 |
---|---|---|
committer | Petr Machata <pmachata@redhat.com> | 2012-10-01 14:18:54 +0200 |
commit | a1f768374c98ac0ed616482916bfedbe98753eba (patch) | |
tree | f70454056daabc990796cb30b5910f2f1153adff /proc.c | |
parent | 10bd7a99d384f34c9c510828b722f29a8dc02393 (diff) | |
download | ltrace-a1f768374c98ac0ed616482916bfedbe98753eba.tar.gz |
When a new library is mapped, activate latent PLT entries in other libraries
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -719,6 +719,23 @@ proc_activate_delayed_symbol(struct Process *proc, return breakpoint_for_symbol(libsym, proc); } +static enum callback_status +activate_latent_in(struct Process *proc, struct library *lib, void *data) +{ + struct library_exported_name *exported; + for (exported = data; exported != NULL; exported = exported->next) { + struct library_symbol *libsym = NULL; + while ((libsym = library_each_symbol(lib, libsym, + library_symbol_named_cb, + (void *)exported->name)) + != NULL) + if (libsym->latent + && proc_activate_latent_symbol(proc, libsym) < 0) + return CBS_FAIL; + } + return CBS_CONT; +} + void proc_add_library(struct Process *proc, struct library *lib) { @@ -735,6 +752,16 @@ proc_add_library(struct Process *proc, struct library *lib) proc)) != NULL) fprintf(stderr, "Couldn't insert breakpoint for %s to %d: %s.", libsym->name, proc->pid, strerror(errno)); + + /* Look through export list of the new library and compare it + * with latent symbols of all libraries (including this + * library itself). */ + struct library *lib2 = NULL; + while ((lib2 = proc_each_library(proc, lib2, activate_latent_in, + lib->exported_names)) != NULL) + fprintf(stderr, + "Couldn't activate latent symbols for %s in %d: %s.", + libsym->name, proc->pid, strerror(errno)); } int |