Module: xenomai-forge
Branch: next
Commit: d63d19aae431614e8a95e226faa4aa54f30f666b
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=d63d19aae431614e8a95e226faa4aa54f30f666b

Author: Philippe Gerum <r...@xenomai.org>
Date:   Wed Oct 23 12:30:13 2013 +0200

copperplate/threadobj: auto-backtrace on thread prologue error

---

 lib/alchemy/task.c          |    4 +++-
 lib/copperplate/threadobj.c |    9 +++++++--
 lib/psos/task.c             |    4 +++-
 lib/vxworks/taskLib.c       |    4 +++-
 4 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/lib/alchemy/task.c b/lib/alchemy/task.c
index d160736..422f056 100644
--- a/lib/alchemy/task.c
+++ b/lib/alchemy/task.c
@@ -151,8 +151,10 @@ static int task_prologue(struct alchemy_task *tcb)
        int ret;
 
        ret = __bt(threadobj_prologue(&tcb->thobj, tcb->name));
-       if (ret)
+       if (ret) {
+               backtrace_check();
                return ret;
+       }
 
        CANCEL_DEFER(svc);
 
diff --git a/lib/copperplate/threadobj.c b/lib/copperplate/threadobj.c
index 2cdfa03..a31479c 100644
--- a/lib/copperplate/threadobj.c
+++ b/lib/copperplate/threadobj.c
@@ -450,7 +450,9 @@ static inline int threadobj_setup_corespec(struct threadobj 
*thobj)
 
        prctl(PR_SET_NAME, (unsigned long)thobj->name, 0, 0, 0);
        ret = notifier_init(&thobj->core.notifier, notifier_callback, 1);
-       assert(ret == 0);
+       if (ret)
+               return __bt(ret);
+
        thobj->core.period = 0;
 
        /*
@@ -1037,8 +1039,11 @@ int threadobj_prologue(struct threadobj *thobj, const 
char *name)
        thobj->errno_pointer = &errno;
        backtrace_init_context(&thobj->btd, name);
        ret = threadobj_setup_corespec(thobj);
-       if (ret)
+       if (ret) {
+               warning("prologue failed for thread %s, %s",
+                       name ?: "<anonymous>", symerror(ret));
                return __bt(ret);
+       }
 
        threadobj_set_current(thobj);
 
diff --git a/lib/psos/task.c b/lib/psos/task.c
index c23a3d5..6715a9f 100644
--- a/lib/psos/task.c
+++ b/lib/psos/task.c
@@ -177,8 +177,10 @@ static void *task_trampoline(void *arg)
        int ret;
 
        ret = __bt(threadobj_prologue(&task->thobj, task->name));
-       if (ret)
+       if (ret) {
+               backtrace_check();
                goto done;
+       }
 
        CANCEL_DEFER(svc);
 
diff --git a/lib/vxworks/taskLib.c b/lib/vxworks/taskLib.c
index 4cc2cd2..f590fd4 100644
--- a/lib/vxworks/taskLib.c
+++ b/lib/vxworks/taskLib.c
@@ -221,8 +221,10 @@ static void *task_trampoline(void *arg)
        int ret;
 
        ret = __bt(threadobj_prologue(&task->thobj, task->name));
-       if (ret)
+       if (ret) {
+               backtrace_check();
                goto done;
+       }
 
        CANCEL_DEFER(svc);
 


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

Reply via email to