All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Mathew Benson <mathew.benson@gmail.com>
Cc: "xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai] Debugger and secondary mode question
Date: Wed, 4 Mar 2015 18:42:52 +0100	[thread overview]
Message-ID: <20150304174252.GF30672@hermes.click-hack.org> (raw)
In-Reply-To: <CA+C+_XTfx6fAC3UvATJULBqogpvAOozwNkop=6Vj+jPYondj9Q@mail.gmail.com>

On Wed, Mar 04, 2015 at 11:33:46AM -0600, Mathew Benson wrote:
> I fixed all my toolchain problems and am finally back to debugging my
> code.  Thanks for the help earlier.
> 
> It looks like gdbserver causes suspended threads to drop back down to
> secondary mode, 

Yes, that is expected/

> causing my rt_... calls to return ENOSYS.

What rt_ calls ? If you are talking about rtdm calls, returning
ENOSYS should cause xenomai to switch again to primary mode, so is
not an issue. Are you sure you do not mean EINTR ? Because yes, some
calls can return EINTR when interrupted by a signal (which is what
happens when running gdb), and if this is not handled by the call
itself (for instance pthread_mutex_lock does not expose EINTR, it is
handled in the user-space function itself), then your application
should handle it.

>  Is there
> anything I can do to prevent this?  I expect its unavoidable.

There is no way to run gdb without signals.

> 
> If I can't stop it, does anybody have any recommendations of how to make
> code resilient to this? 

Test EINTR,and try again when it happens.

> I'm mostly just using mutexes and semaphores in my
> main loop.  Can I mix real time and non-realtime functions with the same
> handle?  In other words, what happens to a rt semaphore when the thread
> transitions back to secondary mode?  Does the handle refer to a non rt
> version now, or is it just inaccessible?

Xenomai will switch back to primary mode as soon as needed. An rt
semaphore or mutex is rt-only, it has no secondary mode counterpart.

-- 
					    Gilles.


  reply	other threads:[~2015-03-04 17:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-04 17:33 [Xenomai] Debugger and secondary mode question Mathew Benson
2015-03-04 17:42 ` Gilles Chanteperdrix [this message]
2015-03-04 21:45   ` Mathew Benson
2015-03-04 21:48     ` Gilles Chanteperdrix
2015-03-04 21:56     ` Gilles Chanteperdrix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150304174252.GF30672@hermes.click-hack.org \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=mathew.benson@gmail.com \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.