* [Xenomai-help] find segmentation fault in real-time-task
@ 2012-03-09 17:30 Michael Heuer
2012-03-09 17:51 ` Gilles Chanteperdrix
0 siblings, 1 reply; 2+ messages in thread
From: Michael Heuer @ 2012-03-09 17:30 UTC (permalink / raw)
To: xenomai
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...
Or how can i determine at which position the error occurs?
Thanks in advance Michael
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Xenomai-help] find segmentation fault in real-time-task
2012-03-09 17:30 [Xenomai-help] find segmentation fault in real-time-task Michael Heuer
@ 2012-03-09 17:51 ` Gilles Chanteperdrix
0 siblings, 0 replies; 2+ messages in thread
From: Gilles Chanteperdrix @ 2012-03-09 17:51 UTC (permalink / raw)
To: Michael Heuer; +Cc: xenomai
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-03-09 17:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-09 17:30 [Xenomai-help] find segmentation fault in real-time-task Michael Heuer
2012-03-09 17:51 ` Gilles Chanteperdrix
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.