1

I am an intern who was offered the task of porting a test application from Solaris to Red Hat. The application is written in Ada. It works just fine on the Unix side. I compiled it on the linux side, but now it is giving me a seg fault. I ran the debugger to see where the fault was and got this:

Warning: In non-Ada task, selecting an Ada task. => runtime tasking structures have not yet been initialized. <non-Ada task> with thread id 0b7fe46c0 process received signal "Segmentation fault" [11] task #1 stopped in _dl_allocate_tls at 0870b71b: mov edx, [edi] ;edx := [edi]

This seg fault happens before any calls are made or anything is initialized. I have been told that 'tasks' in ada get started before the rest of the program, and the problem could be with a task that is running.

But here is the kicker. This program just generates some code for another program to use. The OTHER program, when compiled under linux gives me the same kind of seg fault with the same kind of error message. This leads me to believe there might be some little tweak I can use to fix all of this, but I just don't have enough knowledge about Unix, Linux, and Ada to figure this one out all by myself.

4

3 回答 3

1

这完全是在黑暗中拍摄,但如果任务试图在堆栈上分配过多的本地内存,您可能会在启动时像这样爆炸。您的主程序可以安全地使用系统堆栈,但任务必须在启动时从动态内存中分配其堆栈,因此通常您的运行时具有任务的默认堆栈大小。如果你的任务试图分配一个大数组,它很容易超过这个限制。我以前也遇到过。

有多种方法可以解决此问题。一种方法是将所有任务本地数据移动到包全局区域中。另一种是动态分配它。

如果您能弄清楚多少内存足够了,那么您还有更多选择。您可以将任务设为任务类型,然后使用

for My_Task_Type_Name'Storage_Size use Some_Huge_Number;

陈述。您也可以使用“pragma Storage_Size(My_Task_Type_Name)”,但我认为“for”语句是首选。

最后,使用 Gnat,您还可以使用-d标志将默认任务堆栈大小更改为 gnatbind。

于 2009-07-07T14:19:37.863 回答
0

在我的脑海中,如果代码在 Sparc 机器上使用,而你现在在 x86 机器上运行,你可能会遇到字节序问题。

这没有多大帮助,但这是多平台时的常见问题。

于 2009-06-29T17:32:29.337 回答
0

预感:链接步骤不正确。也许链接了错误的运行时启动库?

(在提出问题几个月后,找出真正问题所在的可能性有多大?)

于 2009-12-29T05:42:03.443 回答