All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Michael Heuer <michael.heuer@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] find segmentation fault in real-time-task
Date: Fri, 09 Mar 2012 18:51:43 +0100	[thread overview]
Message-ID: <4F5A432F.6000909@domain.hid> (raw)
In-Reply-To: <4F5A3E40.4060803@domain.hid>

On 03/09/2012 06:30 PM, Michael Heuer wrote:
> Hi guys, I'm posting the first time and i hope you can help me.
> 
> At the moment i have a segmentation fault in the real-time part of my 
> program (task created with rt_task_create, Xenomai 2.5.6).
> 
> Is there a way to register an signal to print the call-stack?
> 
> If its in the non real-time part the signal is raised and i get my 
> information but in the real-time part i just get an Segmentation fault 
> in the shell...

Using xenomai does not make any difference with regard to that question:
you can, just as without xenomai, register a handler for the SIGSEGV
signal.

But if the segmentation fault is due to a stack overflow (which, I
suspect, is your problem), you will get another segmentation fault in
the segmentation fault signal handler, so, you have to use sigaltstack
to avoid that, but then using the "backtrace" function to walk the call
stack will no longer work, so, you need to use the SA_SIGINFO flag, and
walk the stack yourself extracting the stack pointer register value from
the "context" argument of the signal handler. This is a little complicated.

Another much simpler solution is to use gdb.

-- 
					    Gilles.


      reply	other threads:[~2012-03-09 17:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-09 17:30 [Xenomai-help] find segmentation fault in real-time-task Michael Heuer
2012-03-09 17:51 ` Gilles Chanteperdrix [this message]

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=4F5A432F.6000909@domain.hid \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=michael.heuer@domain.hid \
    --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.