All of lore.kernel.org
 help / color / mirror / Atom feed
* Question about gdb and timeout
@ 2020-10-08 12:47 Paolo Minazzi
  2020-10-08 16:31 ` Per Oberg
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Minazzi @ 2020-10-08 12:47 UTC (permalink / raw)
  To: xenomai

Hi to all,
I have an ARM board (iMX6SX).
- kernel 4.9.88
- xenomai 3.0.9
- ipipe-core-4.9.51-arm-4

I have run a simple xenomai alchemy test :
- a task that wait an event (timeout 10 secs)
- a task  that signal the event (every 100 msecs)
All works correctly.

When I use the example with gdb:
b 56 (at usleep(10000) in the main)
r
c
c
...
If I stay stopped in gdb for more that 10 seconds (that is the timeout 
of the rt_event_wait), I get -110 (= -ETIMEDOUT).
This because I think the timer counts also when tasks are stopped in gdb.
Is there a way to avoid this behavior ? When I'm stopped in gdb, the 
real-time"world" should be stopped.
Thanks for your support,
Best regards,
Paolo

#include <stdlib.h>
#include <stdio.h>
#include <alchemy/task.h>
#include <alchemy/event.h>

RT_TASK rt_task_wait,
         rt_task_signal;
volatile unsigned int cnt;

#define  EVENT_WAIT_MASK 1

RT_EVENT ev;

#define MSEC(x) (RTIME)((x) * 1000ULL * 1000ULL)
#define SEC(x)  (RTIME)(MSEC(x) * 1000ULL)

void xeno_task_wait(void *dummy)
{
     unsigned int mask_ret;
     rt_event_create(&ev, "ev", 0, 0);
     RTIME timeout = SEC(10);
     while(1)
     {
         cnt++;
         int res;
         res = rt_event_wait(&ev, EVENT_WAIT_MASK, &mask_ret, EV_ANY, 
timeout);
         if (res)
         {
             printf(">>> res = %d\n", res);
             exit(0);
         }
         rt_event_clear(&ev, EVENT_WAIT_MASK, &mask_ret);
     }
}

void xeno_task_signal(void *dummy)
{
     while(1)
     {
         rt_task_sleep( MSEC(100) );
         rt_event_signal(&ev, EVENT_WAIT_MASK);
     }
}


int main(int argc, char *const *argv)
{
     rt_task_create(&rt_task_wait,   "wait",   0, 98, 0);
     rt_task_start (&rt_task_wait, &xeno_task_wait,   NULL);

     rt_task_create(&rt_task_signal, "signal", 0, 99, 0);
     rt_task_start (&rt_task_signal, &xeno_task_signal, NULL);

     while(1)
     {
         usleep(10000);         // <<<============ BREAKPOINT
         printf("%d\n", cnt);
     }
}



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-13  6:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-08 12:47 Question about gdb and timeout Paolo Minazzi
2020-10-08 16:31 ` Per Oberg
2020-10-12 10:36   ` Jan Kiszka
2020-10-13  6:44     ` Paolo Minazzi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.