Jan Kiszka wrote:
> Hi all,
> 
> here is an improved version of the kgdb-over-ipipe patch. This version
> specifically addresses the concerns Gilles brought up recently:
> 
> o No more dependencies on Xenomai, thus also no need to have the nucleus
>   compiled into the kernel. There is now a registrable handler,
>   ipipe_safe_current, which is invoked by the kgdb code to obtain
>   "current". When the xeno nucleus arms its services, it overloads this
>   handler to always provide a valid current (either the real one or
>   init_task for kernel-only threads).
> 
> o Replaced smp_processor_id with ipipe_processor_id in critical kgdb
>   code. I haven't tested this replacement, so no guarantees here. But so
>   far it looks consistent - at least for me.
> 
> To use the kernel debugger with Xenomai, you need the latest kgdb
> patches [1] and have to follow the attached patch series.
> 

Oops, one patch was missing: the one to add the handler registration to
Xenomai. See attachment.

Jan
Index: ksrc/nucleus/pod.c
===================================================================
--- ksrc/nucleus/pod.c	(Revision 1095)
+++ ksrc/nucleus/pod.c	(Arbeitskopie)
@@ -43,6 +43,9 @@
 #include <nucleus/registry.h>
 #include <nucleus/module.h>
 #include <nucleus/ltt.h>
+#ifdef CONFIG_KGDB
+#include <linux/kgdb.h>
+#endif /* CONFIG_KGDB */
 
 /* NOTE: We need to initialize the globals: remember that this code
    also runs over user-space VMs... */
@@ -234,6 +237,13 @@ static void xnpod_flush_heap(xnheap_t * 
     xnarch_sysfree(extaddr, extsize);
 }
 
+#ifdef CONFIG_KGDB
+static struct task_struct *xnpod_safe_current(void)
+{
+    return xnpod_userspace_p() ? current : &init_task;
+}
+#endif /* CONFIG_KGDB */
+
 /*! 
  * \fn int xnpod_init(xnpod_t *pod,int minpri,int maxpri,xnflags_t flags)
  * \brief Initialize a new pod.
@@ -373,6 +383,9 @@ int xnpod_init(xnpod_t *pod, int minpri,
        the remaining operations. */
 
     nkpod = pod;
+#ifdef CONFIG_KGDB
+    ipipe_safe_current = xnpod_safe_current;
+#endif /* CONFIG_KGDB */
 
     /* No direct handler here since the host timer processing is
        postponed to xnintr_irq_handler(), as part of the interrupt
@@ -477,6 +490,9 @@ int xnpod_init(xnpod_t *pod, int minpri,
 
         if (err) {
           fail:
+#ifdef CONFIG_KGDB
+            ipipe_safe_current = ipipe_default_current;
+#endif /* CONFIG_KGDB */
             nkpod = NULL;
             return err;
         }
@@ -607,6 +623,9 @@ void xnpod_shutdown(int xtype)
 
     xnheap_destroy(&kheap, &xnpod_flush_heap, NULL);
 
+#ifdef CONFIG_KGDB
+    ipipe_safe_current = ipipe_default_current;
+#endif /* CONFIG_KGDB */
     nkpod = NULL;
 
   unlock_and_exit:

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to