aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2021-01-05 15:36:10 +0000
committerRoss Burton <ross.burton@arm.com>2021-01-08 13:14:39 +0000
commit78c0350c4c7988282e4ec2b5d6c2cfbf7e2daada (patch)
tree7256d570e2665b73b670545a79eeff63cf99854f
parentf2b37a6a9ac584bdc8326d1a699e1ee100b578db (diff)
downloadpseudo-78c0350c4c7988282e4ec2b5d6c2cfbf7e2daada.tar.gz
pseudo-78c0350c4c7988282e4ec2b5d6c2cfbf7e2daada.tar.bz2
pseudo-78c0350c4c7988282e4ec2b5d6c2cfbf7e2daada.zip
XXX wrapper debug
Signed-off-by: Ross Burton <ross.burton@arm.com>
-rw-r--r--pseudo_wrappers.c3
-rw-r--r--templates/wrapfuncs.c12
2 files changed, 12 insertions, 3 deletions
diff --git a/pseudo_wrappers.c b/pseudo_wrappers.c
index 99aabff..cd661b3 100644
--- a/pseudo_wrappers.c
+++ b/pseudo_wrappers.c
@@ -125,6 +125,7 @@ pseudo_reinit_libpseudo(void) {
static void
pseudo_init_one_wrapper(pseudo_function *func) {
int (*f)(void) = (int (*)(void)) NULL;
+ Dl_info info;
if (*func->real != NULL) {
/* already initialized */
@@ -146,6 +147,8 @@ pseudo_init_one_wrapper(pseudo_function *func) {
* errors if a function is missing, and that printing output
* for these seems unhelpful. so we no longer do that.
*/
+ dladdr(f, &info);
+ pseudo_debug(PDBGF_WRAPPER, "dlsym(%s, %s) from %s\n", func->name, func->version, info.dli_fname);
}
void
diff --git a/templates/wrapfuncs.c b/templates/wrapfuncs.c
index 93bb671..a9e5367 100644
--- a/templates/wrapfuncs.c
+++ b/templates/wrapfuncs.c
@@ -26,6 +26,12 @@ ${name}(${decl_args}) {
${maybe_async_skip}
+ pseudo_debug(PDBGF_WRAPPER, "entry point $name wrapper=%p real=%p\n", &wrap_$name, real_$name);
+ if (&wrap_$name == real_$name) {
+ pseudo_debug(PDBGF_WRAPPER, "wrap_$name is the same as real_$name\n");
+ abort();
+ }
+
if (!pseudo_check_wrappers() || !real_$name) {
/* rc was initialized to the "failure" value */
pseudo_enosys("${name}");
@@ -36,13 +42,13 @@ ${maybe_async_skip}
${variadic_start}
if (pseudo_disabled) {
+ pseudo_debug(PDBGF_SYSCALL, "pseudo disabled, ${name} calling real syscall %p.\n", *real_$name);
${rc_assign} (*real_${name})(${call_args});
${variadic_end}
PROFILE_DONE;
${rc_return}
}
- pseudo_debug(PDBGF_WRAPPER, "wrapper called: ${name}\n");
pseudo_sigblock(&saved);
pseudo_debug(PDBGF_WRAPPER | PDBGF_VERBOSE, "${name} - signals blocked, obtaining lock\n");
if (pseudo_getlock()) {
@@ -56,13 +62,13 @@ ${maybe_async_skip}
int save_errno;
if (antimagic > 0) {
/* call the real syscall */
- pseudo_debug(PDBGF_SYSCALL, "${name} calling real syscall.\n");
+ pseudo_debug(PDBGF_SYSCALL, "${name} calling real syscall %p.\n", *real_$name);
${rc_assign} (*real_${name})(${call_args});
} else {
${fix_paths}
if (${ignore_paths}) {
/* call the real syscall */
- pseudo_debug(PDBGF_SYSCALL, "${name} ignored path, calling real syscall.\n");
+ pseudo_debug(PDBGF_SYSCALL, "${name} ignored path, calling real syscall %p.\n", *real_$name);
${rc_assign} (*real_${name})(${call_args});
} else {
/* exec*() use this to restore the sig mask */