summaryrefslogtreecommitdiff
path: root/libexec/ld.so/loader.c
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2013-06-01 09:57:59 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2013-06-01 09:57:59 +0000
commit68aee1affc9e9f623b3824770f05f34d7c2fe60a (patch)
treeff6bb4ec4eab9b40d691aebff013e69dbf58683a /libexec/ld.so/loader.c
parentef21a2cb5b0d81e925c90a50449ba06a311298e0 (diff)
Introduce ltrace(1). This tool works with ld.so to inject utrace record for
each plt call, allowing to trace a binary linked against shared library at the public function call level. To do so, ltrace(1) sets up some environment variables to enable plt tracing in ld.so, and invokes ktrace(2) for utrace events. ld.so will force lazy binding and will send an utrace record in the plt resolver, without updating the plt. Minimal filtering capabilities are provided, inspired by Solaris' truss -u, to limit tracing to libraries and/or symbol names. Non-traced libraries and symbols will have the regular resolver processing, with the expected plt update. "Get it in" deraadt
Diffstat (limited to 'libexec/ld.so/loader.c')
-rw-r--r--libexec/ld.so/loader.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c
index fdda79de64c..22302d9f711 100644
--- a/libexec/ld.so/loader.c
+++ b/libexec/ld.so/loader.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: loader.c,v 1.132 2013/04/05 12:58:03 kurt Exp $ */
+/* $OpenBSD: loader.c,v 1.133 2013/06/01 09:57:55 miod Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -51,8 +51,6 @@
/*
* Local decls.
*/
-static char *_dl_getenv(const char *, char **);
-static void _dl_unsetenv(const char *, char **);
unsigned long _dl_boot(const char **, char **, const long, long *);
void _dl_debug_state(void);
void _dl_setup_env(char **);
@@ -257,6 +255,8 @@ _dl_setup_env(char **envp)
}
}
_dl_so_envp = envp;
+
+ _dl_trace_setup(envp);
}
int
@@ -914,7 +914,7 @@ _dl_call_init_recurse(elf_object_t *object, int initfirst)
object->status |= STAT_INIT_DONE;
}
-static char *
+char *
_dl_getenv(const char *var, char **env)
{
const char *ep;
@@ -932,7 +932,7 @@ _dl_getenv(const char *var, char **env)
return(NULL);
}
-static void
+void
_dl_unsetenv(const char *var, char **env)
{
char *ep;