slang-users mailing list

[2005 Date Index] [2005 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

[slang-users] A stack overflow problem using slang 1.4.5 (PROBLEM SOLVED!)


Please disregard the last message. The problem was that they have added
a line with a scanf() without popping the return value off the stack.
(Didn't see that coming)

 

Thank you everyone.

 

Jorge Gonzalez
Control Systems Developer
Automation Technology Products
ATS Automation Tooling Systems Inc.
Tel: (519) 653-6500 (x2721)
www.atsautomation.com <http://www.atsautomation.com> 

________________________________

From: Slang-users-bounces@xxxxxxxxxxx
[mailto:Slang-users-bounces@xxxxxxxxxxx] On Behalf Of Gonzalez, Jorge
Sent: Thursday, November 24, 2005 2:27 PM
To: Slang-users@xxxxxxxxxxx
Cc: Galea, Peter
Subject: [slang-users] A stack overflow problem using slang 1.4.5

 

Hi guys,

 

Sorry to bother you, but I have a problem which requires a little expert
advise.

 

We are using slang-1.4.5 on QNX4 on one of our machines at a customer
site; and about twice a day the machine stops because of a slang error
that shows up like this: 

 

S-Lang Error: Stack Overflow: Error while executing ConvertLot2    Cell
4 - ATS Scripting Driver

S-Lang Error: Stack Overflow: qd::exec unable to execute <ConvertLot2>
Cell 4 - ATS Scripting Driver

S-Lang Error: Stack Overflow      Cell 4 - ATS Scripting Driver

S-Lang Error: Stack Overflow: Error while executing ConvertLot1    Cell
4 - ATS Scripting Driver

 

Which clearly indicates that we are leaking stack memory somewhere. The
thing is that this happens so sporadicaly that we cannot figure out what
is causing it.

 

For this application we have created some intrinsic functions to pass
data to/from slang and the rest of the controller engine; these are of
the form get_DINT(), set_DINT(), etc. Those functions have been
thoroghly tested and I don't think are the source of the problem. Here
is the function we are calling where this error is happening:

 

define ConvertLot2()

{

                        % These datawords contain the ASCII characters
of the serial number in reverse byte order

                        variable DW1=get_DINT("LotNumber2[0]");

                        variable DW2=get_DINT("LotNumber2[1]");

                        variable DW3=get_DINT("LotNumber2[2]");

                        variable DW4=get_DINT("LotNumber2[3]");

                        variable DW5=get_DINT("LotNumber2[4]");

                        variable DW6=get_DINT("LotNumber2[5]");

                        variable DW7=get_DINT("LotNumber2[6]");

                        variable DW8=get_DINT("LotNumber2[7]");

                        variable DW9=get_DINT("LotNumber2[8]");

                        variable DW10=get_DINT("LotNumber2[9]");

 

                        variable lotString="0";

 

 
lotString=pack("KKKKKKKKKK",DW1,DW2,DW3,DW4,DW5,DW6,DW7,DW8,DW9,DW10);

            

                        % Transfer the string data to placeholder
variable in the MACS user dataspace.

                        set_STRING("LotNumberString[1]",lotString);

}

 

So my question here is: Is there any record of the pack() function
leaking stack memory for version 1.4.5 or earlier?

 

I looked in the changes.txt files for this and later versions and it
doesn't seem to be any reference of the pack() function leaking stack
memory; and I am not saying that this is happennig, but I just need to
rule out the possibility.

 

BTW: I used the _stkdepth() slang function at the end of this
ConvertLot2() function to check to see whether the stack was getting
polluted but so far is looking fine.(??)

 

Any advise or suggestions on how to debug this are most welcome.

 

Thanks,

 

Jorge Gonzalez
Control Systems Developer
Automation Technology Products
ATS Automation Tooling Systems Inc.
Tel: (519) 653-6500 (x2721)
www.atsautomation.com <http://www.atsautomation.com> 

 

________________________________

This e-mail message, including any attachments, is only for the use of
the intended recipient (s). The information contained may be
confidential, in which case its disclosure or reproduction is strictly
prohibited. If you are not the intended recipient, please return it
immediately to its sender at the above address and delete it.


------------------------------------------------------------------
This e-mail message, including any attachments, is only for the use of the intended recipient (s). The information contained may be confidential, in which case its disclosure or reproduction is strictly prohibited. If you are not the intended recipient, please return it immediately to its sender at the above address and delete it.

_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html

[2005 date index] [2005 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]