From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2a5f6199c3cc0e8b,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.35.68 with SMTP id f4mr1282015pbj.5.1320175504254; Tue, 01 Nov 2011 12:25:04 -0700 (PDT) Path: p6ni57326pbn.0!nntp.google.com!news1.google.com!postnews.google.com!o19g2000vbk.googlegroups.com!not-for-mail From: awdorrin Newsgroups: comp.lang.ada Subject: Calling Ada from C (linux/gnat 4.3.2) Date: Tue, 1 Nov 2011 11:46:07 -0700 (PDT) Organization: http://groups.google.com Message-ID: <8ba649f0-7ca1-4f05-a158-74b074e401ee@o19g2000vbk.googlegroups.com> NNTP-Posting-Host: 192.91.171.42 Mime-Version: 1.0 X-Trace: posting.google.com 1320175501 19460 127.0.0.1 (1 Nov 2011 19:25:01 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 1 Nov 2011 19:25:01 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: o19g2000vbk.googlegroups.com; posting-host=192.91.171.42; posting-account=YkFdLgoAAADpWnfCBA6ZXMWTz2zHNd0j User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HUALESRCNK X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1,gzip(gfe) Xref: news1.google.com comp.lang.ada:18778 Content-Type: text/plain; charset=ISO-8859-1 Date: 2011-11-01T11:46:07-07:00 List-Id: I am trying to port a program originally written on VxWork to Linux. The main program is written in C and spawns new threads and in the new threads calls are made to Ada procedures. In the original program, written with GreenHills AdaMulti, it appears that there was a call being made that I am assuming was initializing the Ada Runtime's task stack/control block (rts_init_task()) - however this is just a guess. In the version of the program I am migrating, I was seeing things that made me believe that the Ada thread's did not have their stacks setup properly, so I added the -fstack-check flag to the build. Now, the C program creates the new thread, which calls the ada procedure - and the moment the thread has an opportunity to run - the application exits with 'raised STORAGE_ERROR : stack overflow detected' I cannot get gdb to provide me a backtrace, since the program exits. If I try to break on the ada procedure name, I get a break, but trying to 'step' or 'next' keeps me in the main thread until a 'sleep' call lets the other thread run - at which point it raises the exception. I am assuming that the ada runtime is initializing and the STORAGE_ERROR is raised before it gets to execute any of the code in my Ada procedure. I have been trying to search to find what the proper way would be to call an Ada procedure from a C pthread, but have had zero luck. I also have been unable to determine what the equivalent of the 'rts_init_task' would be with Gnat. Any have any ideas?