Module: xenomai-3
Branch: stable-3.0.x
Commit: b4c28e9bb62bb8f4f2617e2bea8a816c322a9615
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b4c28e9bb62bb8f4f2617e2bea8a816c322a9615

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon Apr 25 15:09:17 2016 +0200

boilerplate/init: track automatic bootstrap mode in --dump-config

Automatic bootstrapping (or misusage of manual bootstrap mode) is a
frequent source of issues among C++ applications with non-trivial
static constructors. Have --dump-config display the bootstrap mode for
the executable to make investigation easier.

---

 include/xenomai/init.h           |    2 ++
 lib/boilerplate/init/bootstrap.c |    2 ++
 lib/boilerplate/setup.c          |    3 +++
 3 files changed, 7 insertions(+)

diff --git a/include/xenomai/init.h b/include/xenomai/init.h
index 1ec1d43..9adc90d 100644
--- a/include/xenomai/init.h
+++ b/include/xenomai/init.h
@@ -37,6 +37,8 @@ void application_version(void);
 
 extern const char *xenomai_version_string;
 
+extern const int xenomai_auto_bootstrap;
+  
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/boilerplate/init/bootstrap.c b/lib/boilerplate/init/bootstrap.c
index cee6843..119b405 100644
--- a/lib/boilerplate/init/bootstrap.c
+++ b/lib/boilerplate/init/bootstrap.c
@@ -26,6 +26,8 @@ static int early_argc;
 
 static char *const *early_argv;
 
+const int xenomai_auto_bootstrap = 1;
+
 int __real_main(int argc, char *const argv[]);
 
 int __wrap_main(int argc, char *const argv[])
diff --git a/lib/boilerplate/setup.c b/lib/boilerplate/setup.c
index 7a9334d..dbeb5e1 100644
--- a/lib/boilerplate/setup.c
+++ b/lib/boilerplate/setup.c
@@ -46,6 +46,8 @@ pid_t __node_id = 0;
 
 int __config_done = 0;
 
+const int __weak xenomai_auto_bootstrap = 0;
+
 static int init_done;
 
 static DEFINE_PRIVATE_LIST(setup_list);
@@ -143,6 +145,7 @@ static inline void dump_configuration(void)
                puts(config_strings[n]);
 
        printf("PTHREAD_STACK_DEFAULT=%d\n", PTHREAD_STACK_DEFAULT);
+       printf("AUTOMATIC_BOOTSTRAP=%d\n", xenomai_auto_bootstrap);
 }
 
 static int collect_cpu_affinity(const char *cpu_list)


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to