debugging: add calls to 'personality'
authorJosé Bollo <jose.bollo@iot.bzh>
Mon, 31 Jul 2017 09:29:03 +0000 (11:29 +0200)
committerJosé Bollo <jose.bollo@iot.bzh>
Wed, 2 Aug 2017 11:52:49 +0000 (13:52 +0200)
Insertion of calls to personality for the only
pupose to be able to set breakpoint at some
strategic places.

The chosen places are:
 - After the debug wait point. The intend is to
   allow simulation of breakpoint after attaching
   to the waiting process.
 - Before starting the bindings but after loading
   it. The intend is to allow loading of symbols and
   setting of breakpoints in the debugged binding
   without attaching to afb-daemon that comes without
   debug symbols.

Change-Id: Ie3bfce0956c9844586c7a5f8bd820acb7f58772c
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
src/afb-debug.c
src/main.c

index e7a5c64..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"
 
@@ -98,6 +101,9 @@ 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);
index a989a70..77392f8 100644 (file)
 #include <sys/stat.h>
 #include <sys/wait.h>
 
+#if !defined(NO_CALL_PERSONALITY)
+#include <sys/personality.h>
+#endif
+
 #include <json-c/json.h>
 
 #include <systemd/sd-daemon.h>
@@ -598,6 +602,9 @@ static void start(int signum)
 
        /* start the services */
        afb_debug("start-start");
+#if !defined(NO_CALL_PERSONALITY)
+       personality((unsigned long)-1L);
+#endif
        if (afb_apiset_start_all_services(main_apiset, 1) < 0)
                goto error;