debugging: add calls to 'personality'
[src/app-framework-binder.git] / src / afb-debug.c
index 228f710..db403a6 100644 (file)
@@ -30,6 +30,9 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
+#if !defined(NO_CALL_PERSONALITY)
+#include <sys/personality.h>
+#endif
 
 #include "verbose.h"
 
@@ -82,15 +85,7 @@ void afb_debug(const char *key)
        struct sigaction sa, psa;
        sigset_t ss, oss;
 
-       if (has_key(key, secure_getenv(key_env_break))) {
-               NOTICE("DEBUG BREAK before %s", key);
-               memset(&sa, 0, sizeof sa);
-               sa.sa_handler = handler;
-               sigaction(SIGINT, &sa, &psa);
-               raise(SIGINT);
-               sigaction(SIGINT, &psa, NULL);
-               NOTICE("DEBUG BREAK after %s", key);
-       } else if (has_key(key, secure_getenv(key_env_wait))) {
+       if (has_key(key, secure_getenv(key_env_wait))) {
                NOTICE("DEBUG WAIT before %s", key);
                sigfillset(&ss);
                sigdelset(&ss, SIGINT);
@@ -106,6 +101,18 @@ void afb_debug(const char *key)
                indicate(NULL);
                sigprocmask(SIG_SETMASK, &oss, NULL);
                NOTICE("DEBUG WAIT after %s", key);
+#if !defined(NO_CALL_PERSONALITY)
+               personality((unsigned long)-1L);
+#endif
+       }
+       if (has_key(key, secure_getenv(key_env_break))) {
+               NOTICE("DEBUG BREAK before %s", key);
+               memset(&sa, 0, sizeof sa);
+               sa.sa_handler = handler;
+               sigaction(SIGINT, &sa, &psa);
+               raise(SIGINT);
+               sigaction(SIGINT, &psa, NULL);
+               NOTICE("DEBUG BREAK after %s", key);
        }
 }