From b8bf385f0849ef02b6e95d562f3abf056f32d45a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 21 Sep 2009 00:03:29 +0200 Subject: warn if applications have been built without -rdynamic --- matrace.c | 6 ++++++ mutrace.c | 13 ++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/matrace.c b/matrace.c index e2183a2..741b305 100644 --- a/matrace.c +++ b/matrace.c @@ -167,6 +167,12 @@ static void setup(void) { if (LIKELY(initialized)) return; + if (!dlsym(NULL, "main")) + fprintf(stderr, + "mutrace: Application appears to be compiled without -rdynamic. It might be a\n" + "mutrace: good idea to recompile with -rdynamic enabled since this produces more\n" + "mutrace: useful stack traces.\n\n"); + if (__malloc_hook) { fprintf(stderr, "matrace: Detected non-glibc memory allocator. Your program uses some\n" diff --git a/mutrace.c b/mutrace.c index 288867c..70a8ff9 100644 --- a/mutrace.c +++ b/mutrace.c @@ -42,13 +42,6 @@ #error "This stuff only works on Linux!" #endif -/* FIXMES: - * - * - we probably should cover rwlocks, too - * - verify rdynamic - * - */ - #ifndef SCHED_RESET_ON_FORK /* "Your libc lacks the definition of SCHED_RESET_ON_FORK. We'll now * define it ourselves, however make sure your kernel is new @@ -267,6 +260,12 @@ static void setup(void) { if (LIKELY(initialized)) return; + if (!dlsym(NULL, "main")) + fprintf(stderr, + "mutrace: Application appears to be compiled without -rdynamic. It might be a\n" + "mutrace: good idea to recompile with -rdynamic enabled since this produces more\n" + "mutrace: useful stack traces.\n\n"); + if (__malloc_hook) { fprintf(stderr, "mutrace: Detected non-glibc memory allocator. Your program uses some\n" -- cgit