The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 How to pause the program in debug mode
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

EigenGoofy

64 Posts

Posted - 06/16/2011 :  5:43:24 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.5


For example. on the codebuilder window, I open an ogs file named "mycube.ogs", which has the following code:

@global = 1;

function double dCubeRoot(double dVal)
{
double xVal;
if(dVal<0) xVal = -exp(ln(-dVal)/3);
else xVal = exp(ln(dVal)/3);
return xVal;
}


Then click "Enable Breakpoints", and toggle a breakpoint on the line "if(dVal<0) xVal = -exp(ln(-dVal)/3);", then on the Code Builder's LabTalk Console I type "mycube", and then type "dcuberoot(-8)".

The result: Nothing happened! It did not pause the program at the breakpoint, nor did the console return "-2" as final calculation result. It was just nothing returned.

Question:

How can I pause the problem in debug mode at the breakpoint?

The info provided by the following address can not really help me:
http://www.originlab.com/www/helponline/Origin/en/Programming/Programming.htm#Programming_1.htm

Thank you!

cpyang

USA
1406 Posts

Posted - 06/16/2011 :  7:48:53 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
There is no break point support for LabTalk function yet.

You can add code like


xVal =;//dump value to script window
return xVal;



CP
Go to Top of Page

EigenGoofy

64 Posts

Posted - 06/17/2011 :  4:42:34 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by cpyang

There is no break point support for LabTalk function yet.

You can add code like


xVal =;//dump value to script window
return xVal;



CP




Thank you, cpyang! According to what you said, I have done as following:

@global = 1;

function double dCubeRoot(double dVal)
{
double xVal;
if(dVal<0) xVal = -exp(ln(-dVal)/3);
else xVal = exp(ln(dVal)/3);
xVal =;
return xVal;
}


It returns
"dcuberoot(-8)
xVal=-2"

It is so disappointed that we are unable to debug Labtalk code by using breakpoints!




So question:

How can I debug Labtalk code? What is the alternative to do so please?
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 06/17/2011 :  8:30:09 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
LabTalk function is new and when more people are using it, we will put in the effort to hook up break point support. Currenly, you can use break point with ogs file section scripts.

Before that, you have to use the good old technique of dumping values in your function. And you can also use the type command to dump more info. You can also use the #! technique to keep the debugging code and wake them up only via @B=1, see

http://wiki.originlab.com/~originla/wiki/index.php?title=Script:Debugging_Tools#.23.21script_.28special_syntax.29


so your function could be written as


function double dCubeRoot(double dVal)
{
  double xVal;
  if(dVal<0) xVal = -exp(ln(-dVal)/3);
  else xVal = exp(ln(dVal)/3);

  #! type "DB Dump: dCubeRoot($(dVal)) = $(xVal,*12)";
 
  return xVal;
}



Having the #! marking will make it easy for you to remove them once you know the function is working well.

CP
Go to Top of Page

EigenGoofy

64 Posts

Posted - 06/20/2011 :  10:04:27 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by cpyang

LabTalk function is new and when more people are using it, we will put in the effort to hook up break point support. Currenly, you can use break point with ogs file section scripts.

Before that, you have to use the good old technique of dumping values in your function. And you can also use the type command to dump more info. You can also use the #! technique to keep the debugging code and wake them up only via @B=1, see

http://wiki.originlab.com/~originla/wiki/index.php?title=Script:Debugging_Tools#.23.21script_.28special_syntax.29


so your function could be written as


function double dCubeRoot(double dVal)
{
  double xVal;
  if(dVal<0) xVal = -exp(ln(-dVal)/3);
  else xVal = exp(ln(dVal)/3);

  #! type "DB Dump: dCubeRoot($(dVal)) = $(xVal,*12)";
 
  return xVal;
}



Having the #! marking will make it easy for you to remove them once you know the function is working well.

CP




Yes, I have tried your technique, at the same time I was imagining that without resorting breakpoints how an experienced programmer might be smart enough to use such technique with efficiency, and even treat it as a shortcut. Maybe yes, they can do it. However, as a greenhorn, Breakpoints support is wanted!

Thank you, cpyang!
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000