Hi,

I forgot to describe our problem: Gdb hung at rt_task_start() when trying to step through it. But debugging worked fine if I set a breakpoint in the task

Looks similar, but I observed the problem already with first rt_task_create()
(which, however, causes a call to rt_task_start() for the manager thread(?)).

body, way after any rt_task_start(). Btw, do you call rt_task_start() from a RT task body?

Yes. To be exact, I call rt_task_create and rt_task_start from my main task,
which is RT after calling rt_task_shadow.

I've attached a small example that allows to examine the behaviour. The 
following
happens in my setup, i.e. when I start "try" on the Blackfin target with
gdbserver and connect with gdb from the host:

1. gdb set to break at "main" runs to the line with mlockall(...)
2. I can step line by line using "next" to the one with rt_task_create

Regardless now whether I type "next" or set a breakpoint in one of the following
lines up to the rt_task_join line and "cont", gdb just prints the following
lines and seems to freeze. Ctrl-C doesn't do anything. Finally after 8 seconds
the subtask finishes and gdb reports "Program exited normally".


24 if (r == 0) r = rt_task_create(&subtask, "subtask", 0, PRIO, 
T_FPU|T_JOINABLE);
(gdb)  next
[New Thread 304]
Reading in symbols for 
../../../../xenomai-2.5.5.2/src/skins/native/task.c...done.
<freeze>


Kolja


P.S. It's gdbserver 6.5 and gdb 6.6; unmodified Blackfin tools 2010R1-RC4.




#include <stdio.h>
#include <sys/mman.h>
#include <native/task.h>

#define PRIO 49

void subtask_entry(void *cookie)
{
  sleep(8);
}

int main ()
{
  int r;
  int i;
  RT_TASK maintask;
  RT_TASK subtask;

  mlockall(MCL_CURRENT|MCL_FUTURE);

  r = rt_task_shadow(&maintask, "maintask", PRIO, 0);
  if (r != 0) printf("Couldn't rt_task_shadow: ");

  if (r == 0) r = rt_task_create(&subtask, "subtask", 0, PRIO, T_FPU|T_JOINABLE);
  if (r != 0) printf("Couldn't rt_task_create: ");

  if (r == 0) r = rt_task_start(&subtask, subtask_entry, NULL);
  if (r != 0) printf("Couldn't rt_task_start: ");

  if (r == 0) for (i=0; i<5; i++) { printf("sleep %d\n", i); sleep(1); }

  if (r == 0) r = rt_task_join(&subtask);
  if (r != 0) printf("Couldn't rt_task_join: ");

  printf("r=%d\n", r);
  return r;
}
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to