AppendixJ - Debugging HLA Programs Debugging HLA Programs...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Debugging HLA Programs Beta Draft - Do not distribute © 2001, By Randall Hyde Page 1533 Deb ugging HLA Programs Appendix J J .1 The @TRACE Pseudo-Variable HLA v1.x has a fe w serious defects in its design. One major issue is deb ugging support. HLA v1.x emits MASM code that it runs through MASM in order to produce e x ecutable object fi les. Unfortunately , while this scheme mak es the de v elopment, testing, and deb ugging of HLA easier , it ef fecti v ely eliminates the possibility of using e xisting source le v el deb ugging tools to locate defects in an HLA program 1 . Starting with v1.24, HLA be g an supporting a ne w feature to help you deb ug your programs: the “@trace” pseudo-v ariable. This appendix will e xplain the purpose of this compile-time v ariable and ho w you can use it to locate defects in your programs. By def ault, the compile-time v ariable @ tr ace contains f alse. Y ou can change its v alue with an y v ariation of the follo wing statement: ?@trace := <<boolean constant expression>>; Generally , “<<boolean constant expression>>” is either true or false , but you could use any compile-time constant expression to set @ trace’s value. Once you set @ tr ace to true, HLA be gins generating e xtra code in your program In f act, before almost e v ery e x ecutable statement HLA injects the follo wing code: _traceLine_( filename, linenumber ); The filename parameter is a string specifying the name of the current source file, the linenumber parameter is an uns32 value that is the current line number of the file. The _traceLine_ procedure uses this information to display an appropriate trace value while the program is running. HLA will automatically emit the above procedure call in between almost all instructions appearing in your program 2 . Assuming that the _tr aceLine_ procedure simply prints the fi lename and line number , when you run your application it will create a log of each statement it e x ecutes. Y ou can control the emission of the _tr aceLine_ procedure calls in your program by alternately setting @ tr ace to true or false throughout your code. This lets you selecti v ely choose which portions of your code will pro vide trace information during program e x ecution. This feature is v ery important because if you’ re displaying the trace information to the console, your program runs thousands, if not millions, of times slo wer during the trace operation. It w ouldn’ t do to ha v e to trace through a really long loop in order to trace through follo wing code that you’ re concerned about. By setting @ tr ace to false prior to the long loop and setting it to true immedately after the loop, you can e x ecute the loop at full speed and then be gin tracing the code you w ant to check once the loop completes e x ecution. HLA does not supply the
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/08/2011 for the course CS 101 taught by Professor Jitenderkumarchhabra during the Summer '11 term at National Institute of Technology, Calicut.

Page1 / 6

AppendixJ - Debugging HLA Programs Debugging HLA Programs...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online