comp.lang.ada
 help / color / mirror / Atom feed
* Secondary Stack oddities w/ SGI Ada 95
@ 1999-05-03  0:00 Viqar Abbasi
  0 siblings, 0 replies; 6+ messages in thread
From: Viqar Abbasi @ 1999-05-03  0:00 UTC (permalink / raw)
  To: Gnat Chat

Hi all,

I have reduced my GNAT problem down to a very
basic "Hello World" program which crashes.  My
working environment is SGI Irix 6.5 w/ SGI Ada 95
1.2.  The application is a big flight simulator,
mostly containing C & Fortran.  We're phasing
Ada in, and its been mostly successful... However,
I've been tackling this crazy bug for a few weeks
now with no success... Here's how it works...

The following works fine:

procedure Report(Message : String) is
  Text_IO.Put_Line(Message);
end Report;

being called from...
procedure My_Test is
begin
  MOTS_IO.Report("Hello World!");
end My_Test;

The following crashes:

procedure Report(Message : String) is
  Text_IO.Put_Line("Hello " & Message);
end My_Test;

being called from...
procedure My_Test is 
begin
  MOTS_IO.Report("World!")
end My_Test;

The dbx dump is below.  My call is the only statement in the
package "Report_Test", in the procedure "My_Test".  To make things
slightly more complex, the package spec as the following...

Pragma Export(C, My_Test, "report_test__my_test_");

"My_Test" is being called from C, (as shown in the dbx output).

The key thing I'm seeing in the dbx output is this "Secondary
Stack" function "SS_Mark" generating a trap.

Any explanations?  

(BTW, can someone explain me GDB?  I hear about it in the 
GNAT discussion group, but haven't seen it anywhere in my
distribution... Maybe it could help me debug, if it supports
multiple languages well...).

Thanks very much!

Puzzled Viqar.

> more dbx.out 
dbx version 7.2.1.1m (patch 3293) Jul 27 1998 15:23:33
Core from signal SIGQUIT: Quit
>  0 _kill(0x27b45, 0x3, 0x7ffee7c0, 0x0) ["kill.s":15, 0xfa4018c]
   1 abort_logger_(signal = 0x7fff2448, pc = 0x7fff24a0, link =
0x7fff2408, stack = (nil))
["/usr2/caelib/simex_plus/work/work6769/cel_routines.c":1233, 0x5bb870]
   2 DISPERR(sig = 11, code = 4, sc = 0x7fff2498)
["/mots2/cae/ship/istemp/cpulock/disp/disperr.c":44, 0x422598]
   3 SegVioHandler(sig = 11, code = 4, sc = 0x7fff2498)
["/usr2/cts/ctssrv_400/server.c":3523, 0x537bf8]
   4 _sigtramp(0xb, 0x3, 0x7fff2498, 0x0) ["sigtramp.s":71, 0xfae8034]
   5 system__secondary_stack__ss_mark() ["s-secsta.adb":205, 0x5f620530]
   6 mots_io__report(0x0, 0x60000, 0x10012190, 0x1001219c)
["/old/root/usr/people/viqar/mots/sacs/apr16/tmp/mots_io156395/mots_io.adb":0,
0x4d3e2c]
   7 report_test__my_test_(0x0, 0x60000, 0x10012190, 0x1001219c)
["/old/root/usr/people/viqar/mots/sacs/apr16/tmp/report_test147059/report_test.adb":0,
0x503da0]
   8 critsched()
["/mots2/cae/ship/istemp/cpulock/disp/rt_critsched.c":177, 0x41f688]
   9 CRITDSP() ["/mots2/cae/ship/istemp/cpulock/disp/rt_critdisp.c":207,
0x421f08]
   10 _sigtramp(0xe, 0x60000, 0x7fff2b88, 0x1001219c) ["sigtramp.s":71,
0xfae8034]
   11 __pause(0x0, 0x100394c0, 0x100394d0, 0x1) ["pause.s":20,
0xfac4808]
More (n if no)?   12 _pause(0x0, 0x100394c0, 0x100394d0, 0x1)
["pauseSCI.c":29, 0xfac487c]
   13 main(argc = 2, argv = 0x7fff2fa4)
["/mots2/cae/ship/istemp/cpulock/disp/rt_syncdisp.c":134, 0x41c714]
   14 __istart() ["crt1tinit.s":13, 0x41c430]




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Secondary Stack oddities w/ SGI Ada 95
@ 1999-05-03  0:00 Viqar Abbasi
  1999-05-03  0:00 ` dennison
  0 siblings, 1 reply; 6+ messages in thread
From: Viqar Abbasi @ 1999-05-03  0:00 UTC (permalink / raw)
  To: Gnat Chat

Hi all,

I have reduced my GNAT problem down to a very
basic "Hello World" program which crashes.  My
working environment is SGI Irix 6.5 w/ SGI Ada 95
1.2.  The application is a big flight simulator,
mostly containing C & Fortran.  We're phasing
Ada in, and its been mostly successful... However,
I've been tackling this crazy bug for a few weeks
now with no success... Here's how it works...

The following works fine:

procedure Report(Message : String) is
  Text_IO.Put_Line(Message);
end Report;

being called from...
procedure My_Test is
begin
  MOTS_IO.Report("Hello World!");
end My_Test;

The following crashes:

procedure Report(Message : String) is
  Text_IO.Put_Line("Hello " & Message);
end My_Test;

being called from...
procedure My_Test is 
begin
  MOTS_IO.Report("World!")
end My_Test;

The dbx dump is below.  My call is the only statement in the
package "Report_Test", in the procedure "My_Test".  To make things
slightly more complex, the package spec as the following...

Pragma Export(C, My_Test, "report_test__my_test_");

"My_Test" is being called from C, (as shown in the dbx output).

The key thing I'm seeing in the dbx output is this "Secondary
Stack" function "SS_Mark" generating a trap.

Any explanations?  

Thanks very much!

Puzzled Viqar.

> more dbx.out 
dbx version 7.2.1.1m (patch 3293) Jul 27 1998 15:23:33
Core from signal SIGQUIT: Quit
>  0 _kill(0x27b45, 0x3, 0x7ffee7c0, 0x0) ["kill.s":15, 0xfa4018c]
   1 abort_logger_(signal = 0x7fff2448, pc = 0x7fff24a0, link =
0x7fff2408, stack = (nil))
["/usr2/caelib/simex_plus/work/work6769/cel_routines.c":1233, 0x5bb870]
   2 DISPERR(sig = 11, code = 4, sc = 0x7fff2498)
["/mots2/cae/ship/istemp/cpulock/disp/disperr.c":44, 0x422598]
   3 SegVioHandler(sig = 11, code = 4, sc = 0x7fff2498)
["/usr2/cts/ctssrv_400/server.c":3523, 0x537bf8]
   4 _sigtramp(0xb, 0x3, 0x7fff2498, 0x0) ["sigtramp.s":71, 0xfae8034]
   5 system__secondary_stack__ss_mark() ["s-secsta.adb":205, 0x5f620530]
   6 mots_io__report(0x0, 0x60000, 0x10012190, 0x1001219c)
["/old/root/usr/people/viqar/mots/sacs/apr16/tmp/mots_io156395/mots_io.adb":0,
0x4d3e2c]
   7 report_test__my_test_(0x0, 0x60000, 0x10012190, 0x1001219c)
["/old/root/usr/people/viqar/mots/sacs/apr16/tmp/report_test147059/report_test.adb":0,
0x503da0]
   8 critsched()
["/mots2/cae/ship/istemp/cpulock/disp/rt_critsched.c":177, 0x41f688]
   9 CRITDSP() ["/mots2/cae/ship/istemp/cpulock/disp/rt_critdisp.c":207,
0x421f08]
   10 _sigtramp(0xe, 0x60000, 0x7fff2b88, 0x1001219c) ["sigtramp.s":71,
0xfae8034]
   11 __pause(0x0, 0x100394c0, 0x100394d0, 0x1) ["pause.s":20,
0xfac4808]
More (n if no)?   12 _pause(0x0, 0x100394c0, 0x100394d0, 0x1)
["pauseSCI.c":29, 0xfac487c]
   13 main(argc = 2, argv = 0x7fff2fa4)
["/mots2/cae/ship/istemp/cpulock/disp/rt_syncdisp.c":134, 0x41c714]
   14 __istart() ["crt1tinit.s":13, 0x41c430]




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Secondary Stack oddities w/ SGI Ada 95
  1999-05-03  0:00 Viqar Abbasi
@ 1999-05-03  0:00 ` dennison
  1999-05-05  0:00   ` Viqar Abbasi
  0 siblings, 1 reply; 6+ messages in thread
From: dennison @ 1999-05-03  0:00 UTC (permalink / raw)


In article <372DC142.1801CEA3@cae.ca>,
  Viqar Abbasi <viqar@cae.ca> wrote:

> The following crashes:
>
> procedure Report(Message : String) is
>   Text_IO.Put_Line("Hello " & Message);
> end My_Test;
>
> being called from...
> procedure My_Test is
> begin
>   MOTS_IO.Report("World!")
> end My_Test;
>
> The dbx dump is below.  My call is the only statement in the
> package "Report_Test", in the procedure "My_Test".  To make things
...
> "My_Test" is being called from C, (as shown in the dbx output).

I'm curious...do you get the same crash if those two routines are called from
an Ada subprogram in an Ada program, or does C have to somehow be involved
for the crash to happen?

--
T.E.D.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Secondary Stack oddities w/ SGI Ada 95
       [not found] <018101be9589$6a4b4ad0$153095cd@visnt021.vis.crc.com>
@ 1999-05-03  0:00 ` Viqar Abbasi
  0 siblings, 0 replies; 6+ messages in thread
From: Viqar Abbasi @ 1999-05-03  0:00 UTC (permalink / raw)
  To: David C. Hoos

David C. Hoos wrote:
> 
> >
> You've given a lot of information, but not what is probably the
> critical stuff -- e.g.:

Sorry about that... especially since I am suspecting the
elaborations.  The main program is in C, which leads to...

> 
>    2. If the main programs C, how are you arranging to do the
>        Ada elaboration?

gnatbind -n report_test.ali mots_io.ali (... others as applicable)
-o ada_elabs.c

Then, during a first-pass initializatio, "adainit",
and upon termination, "adafinal".  There is alot of code
between the "adainit" and the first Ada call though.  
Could that be the problem.

> 
>    3.  Did you link following the instructions in the Gnat User's
>         Guide regarding non-Ada programs?

I believe so...
gcc -32 -o xxx.exe all_my_.o (including ada_elabs.o) 
all_my_.a -lwhatIneed -lgnat -lgcc

One weird thing I noticed in my elaboration file was that
"system__secondary_stack___elabb" is called, but not
the corresponding "___elabs".  I tried setting it up 
manually, but the symbol could not be resolved.  

I've also tried the same application & code on Ada 1.3, 
Irix 6.5.3 and had the same results.  It's quite strange...
  
Thanks for the help so far!
Viqar




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Secondary Stack oddities w/ SGI Ada 95
  1999-05-03  0:00 ` dennison
@ 1999-05-05  0:00   ` Viqar Abbasi
  1999-05-06  0:00     ` dennison
  0 siblings, 1 reply; 6+ messages in thread
From: Viqar Abbasi @ 1999-05-05  0:00 UTC (permalink / raw)


dennison@telepath.com wrote:

> I'm curious...do you get the same crash if those two routines are called from
> an Ada subprogram in an Ada program, or does C have to somehow be involved
> for the crash to happen?

C does have to be involved... The all-Ada program is okay.  Perhaps I 
should mention, I am overriding the "&" operator, as follows...
function "&"(Left: String, Right: Float) return String;
etc etc etc, to get something resembling "printf".  (That comes from
an idea from the FAQ.)  

Thanks for the help,

Viqar, still hacking away...




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Secondary Stack oddities w/ SGI Ada 95
  1999-05-05  0:00   ` Viqar Abbasi
@ 1999-05-06  0:00     ` dennison
  0 siblings, 0 replies; 6+ messages in thread
From: dennison @ 1999-05-06  0:00 UTC (permalink / raw)


In article <37310E55.9E3ACAD5@cae.ca>,
  Viqar Abbasi <viqar@cae.ca> wrote:
> dennison@telepath.com wrote:
>
> > I'm curious...do you get the same crash if those two routines are called
from
> > an Ada subprogram in an Ada program, or does C have to somehow be involved
> > for the crash to happen?
>
> C does have to be involved... The all-Ada program is okay.  Perhaps I

OK. My next question was then to be "How are you ensuring that your Ada code
gets elaborated before use?", but I see that question has already been asked
and answered in the gnat-chat list.

I suggest further dicussion should be kept there, as it is the more approriate
place.

--
T.E.D.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1999-05-06  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-05-03  0:00 Secondary Stack oddities w/ SGI Ada 95 Viqar Abbasi
     [not found] <018101be9589$6a4b4ad0$153095cd@visnt021.vis.crc.com>
1999-05-03  0:00 ` Viqar Abbasi
  -- strict thread matches above, loose matches on Subject: below --
1999-05-03  0:00 Viqar Abbasi
1999-05-03  0:00 ` dennison
1999-05-05  0:00   ` Viqar Abbasi
1999-05-06  0:00     ` dennison

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox