Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: DXL Debugging
Topic Summary:
Created On: 28-Feb-2008 21:48
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 28-Feb-2008 21:48
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

I seem to recall some clumsy tools available for DXL dubugging. Anyone have any luck with debugging DXL scripts?

- Louie
Report this to a Moderator Report this to a Moderator
 29-Feb-2008 12:14
User is offline View Users Profile Print this message


Scott Boisvert

Posts: 348
Joined: 14-Apr-2006

There is a checkDXL function in the DOORS....

checkDXL
Declaration
string checkDXL[File](string code)
Operation
Provides a DXL mechanism for checking DXL code.

The checkDXL function analyzes a DXL program and returns the string that would have been produced in the DXL Interaction window had it been run on its own.

The checkDXLFile function analyzes a file and returns the error message that would have been produced in the DXL Interaction window had the file been run.

Example
string errors =
checkDXL("int j = 3 \n print k + j")
if (!null errors)
print "Errors found in dxl string:\n" errors
"\n"
would produce the following in the DXL Interaction window's output pane.

Errors found in dxl string:
-E- DXL: <Line:2> incorrect arguments for (+)
-E- DXL: <Line:2> incorrect arguments for function (print)
-E- DXL: <Line:2> undeclared variable (k)

-------------------------
Scott Boisvert
Engineering Tools Administrator
L-3 Communications - Avionics Systems
scott.boisvert@l-3com.com
Report this to a Moderator Report this to a Moderator
 29-Feb-2008 16:39
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Searched through my archives, found a technique script, and enhanced it. Its attached.

Technique 0 'startDXLTracing_' logs each line executed and presents the value of each variable used in that line (before the variable is used). This seems real useful.

Technique 1 'startDXLProfiling_' I could not make work at all. Perhaps its a wierd sub-set of Technique 2.

Technique 2 'profile_' seems to dump what sorts of things the code did, such as 18 stack pushes. Doesn't seem to useful.

Technique 3 'setDebugging_' when used with print statements offers no more info than Technique 0.

Technique 4 'setDebugging_' when used with appending to a file, generates Exception violations for me; I hate it when that happens.

So. So far using 'startDXLTracing_(NameFile)' and 'stopDXLTracing_' seems the most useful.

Maybe someone can play with the script and get more useful info than I got.

-Louie
Report this to a Moderator Report this to a Moderator
 4-Mar-2008 21:48
User is offline View Users Profile Print this message


Pete Kowalski

Posts: 301
Joined: 7-Feb-2003

@ Louie:

You will go down history in being a God of DXL.

Personally, as I develop a DXL program, I will embed boolean print statements to debug the program.

-------------------------
pete.kowalski(at)motorola.com
Report this to a Moderator Report this to a Moderator
 4-Mar-2008 22:27
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

I've never actually tried to use any of that!!!

I've got two kinds of debugging; [1] print statements that I comment out when I think the function works [2] print statements that are conditional on some sort of Debug boolean flag, which is a waste of time since once I turn off debugging I never turn it back on.

What I should do is something like this. Write a simple DebugMyDxl program that maintains a couple environment variables; one is the name of the script to debug and the other is some sort of debug level. Each script when it starts reads these variables, and if debugging is on for that script it produces print outs depending on the debug level. Levels are crude and cumulative 0-Folder level info 1-Module level info 2-Object or Attr level info 3-Other level 4-lots of prints. This way, I can turn debugging on and off for a script without having to edit it at all.

- Louie

You've heard that 'magic' is just technology you don't understand. Well, 'Gods' are just 'DxAliens' you don't understand.
Report this to a Moderator Report this to a Moderator
 5-Mar-2008 10:15
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

I mostly use print statements when developing code. Same as Louie, these get removed when the code works and I rarely ever need them again.

We make extensive use of the DOORS API, so I also have a debug log file.
I have a menu option to allow me to turn it on/off and to select the level, errors, messages, info. I can also view the log file while doors is running. It captures debug info on a per-user, not per session basis, so I can monitor calls being made to doors from any client run by the same user.

I have a calls to debug(string, level) in the code that stay there forever.

This isn't much use for debugging DXL code itself, but it is useful for recording what calls were made to doors and the value of parameters etc.

Every year or so I try to think about a better way to debug dxl, but I alway end up using print statements...

My younger colleagues that use Visual Studio and C# wonder how I cope. Bless 'em, they've never seen a green screen or heard of awk.
Am I showing my age?

-------------------------
Tony Goodman
http://www.smartdxl.com
Report this to a Moderator Report this to a Moderator
 5-Mar-2008 10:34
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

A couple of small tips for beginners:

Always write a simple function to print the contents of any data structures you have. This can be very useful.

You can wrap the print function and use a global variable to turn printing on/off.

cont bool PRINTING_ON = true

void debugPrint(string s)
{
if (PRINTING_ON) print(s)
}

Alway have autodeclare turned off.

Always declare and initialise all variables up-front at the beginning of your function.

Use global variables as little as possible.

-------------------------
Tony Goodman
http://www.smartdxl.com
Report this to a Moderator Report this to a Moderator
 5-Mar-2008 20:04
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

The construct: "if (PRINTING_ON) print s" has the significant advantage that 's' is not calculated and doesn't take up string table space, when printing is off. Sending 's' to a function which does the check results in calculation of 's' for the life of the script, even when it works and you don't do the debug printing.
Report this to a Moderator Report this to a Moderator
 6-Mar-2008 13:16
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

Louie is, as usual, correct.

Another disadvantage I found was that if I had function tracing turned on, the overhead of all these function calls swapped the output.

Shame we can't do something like this:

#define PRINT(s) if (PRINTING_ON) print(s)

-------------------------
Tony Goodman
http://www.smartdxl.com
Report this to a Moderator Report this to a Moderator
 2-Apr-2008 08:55
User is offline View Users Profile Print this message


Martin Erdelen

Posts: 15
Joined: 14-Aug-2006

Originally posted by: Tony Goodman
My younger colleagues that use Visual Studio and C# wonder how I cope. Bless 'em, they've never seen a green screen or heard of awk.
Am I showing my age?


At least we don't have to insert punched cards any more (and then drop the shoebox with the whole stack)

Would there be any point in trying to push Telelogic towards making a Eclipse/DXL environment?

Cheers,
Martin
Report this to a Moderator Report this to a Moderator
 11-Apr-2008 13:06
User is offline View Users Profile Print this message


Marcel van der Laan

Posts: 15
Joined: 21-Sep-2007

Originally posted by: Martin Erdelen
Would there be any point in trying to push Telelogic towards making a Eclipse/DXL environment?


Would there be a point? Yes, definitely.
Would we stand a chance? ...

Some kind of debugging mechanism would at least be very welcome. I hate getting those client crashes due to a memory problem in a trigger function

But in the mean-time, 'print' it is....

Marcel
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.