Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Tue Nov 21, 2017 3:58 pm

All times are UTC - 7 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Exception + Backtrace
PostPosted: Tue Jul 28, 2009 8:44 am 
Offline
User avatar

Joined: Fri Feb 01, 2008 4:50 pm
Posts: 101
Is there any way to get a backtrace when an exception occurs? I would like to log all exceptions but without a backtrace it would be difficult to track any errors down.

Thanks!

Ryan


Top
 Profile  
 
PostPosted: Tue Jul 28, 2009 9:03 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
If you can induce the exception in Qlarity Foundry, I would suggest you download and try 2.60 (http://www.qsicorp.com/engfiles). In 2.60, QF Simulation View breaks on unhandled exception allowing you to see a stack trace + have a functioning watch window that reflects the program state at the time of exception.

Starting in QF 2.51 Test build 3 (i.e. very shortly after 2.50 was released) we added a compile option to include a stack back trace in the green Exception Display object. This will work both in Simulation View and on an actual terminal. This can be accessed via Tools->Settings->Compile->"Extra Exception Tracking". While the option appeared in the QF 2.51 test builds, you might be better off using 2.60 for this option as well since when that option is enabled, exception behavior is slightly different than some of the 2.50 objects expected. By the time 2.60 was released we had updated the objects to properly cope with that.

If you are trying to get the stack backtrace for your logs, you will want to use the Extra Exception Tracking option, and when you handle MSG_ERROR, you need to call GetException until it returns false to get all of the exceptions.

Conceptually when Extra Exception Tracking is enabled, the compiler modifies each Qlarity function as if it were written as follows

Code:
func <Name of Function> (<parms>)
    check error
        <Your Code>
    on error
        throw(<Name of template or instance>.<Name of Function>, "Exception stack trace")
    enderr
endfunc

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
PostPosted: Tue Jul 28, 2009 9:14 am 
Offline
User avatar

Joined: Fri Feb 01, 2008 4:50 pm
Posts: 101
I generally use debugger if I can, but it can be difficult to know what happened or what caused the error if it is not in my possession. I think the extra tracking option will work - how can I enable this in the CLI compiler?

Thanks Jeremy.


Top
 Profile  
 
PostPosted: Tue Jul 28, 2009 9:20 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
If your cli has that option it will be -d. Again, you need a post 2.50 compiler for that to work.

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
PostPosted: Tue Jul 28, 2009 9:57 am 
Offline
User avatar

Joined: Fri Feb 01, 2008 4:50 pm
Posts: 101
Great,thanks Jeremy!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group