aboutsummaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authorPetr Machata <pmachata@redhat.com>2012-09-28 00:08:00 +0200
committerPetr Machata <pmachata@redhat.com>2012-10-01 14:18:54 +0200
commita1f768374c98ac0ed616482916bfedbe98753eba (patch)
treef70454056daabc990796cb30b5910f2f1153adff /proc.c
parent10bd7a99d384f34c9c510828b722f29a8dc02393 (diff)
downloadltrace-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.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/proc.c b/proc.c
index eb3e552..222e6b4 100644
--- a/proc.c
+++ b/proc.c
@@ -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