User Tools

Site Tools


jas:breakpoints

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
jas:breakpoints [2010/01/04 18:32] – created jwarriorjas:breakpoints [Unknown date] (current) – external edit (Unknown date) 127.0.0.1
Line 1: Line 1:
 +===== Break Points =====
  
 +Break points can be set in Smalltalk methods to force sim execution to stop so that you can see what is going on. 
 +Here are some useful ways to set break points:
 +<code>
 +JwServices currentTime > 23.67
 +</code>
 +This break point will stop execution in the method when the sim time is greater than 23.67. 
 +<code>
 +bseId = #'BLUE_AIRPLANE'
 +</code>
 +This break point will stop execution in the method when the bseId = the symbol #BLUE_AIRPLANE. Symbols with underscores must be entered using single quotes. All subclasses of BattleSpaceEntity respond to the message bseId.
 +
 +You can set a break point on any condition or variable, including method temporary variables, that is 'visible' (exists) in the method.
 +<code smalltalk>
 +someMethod
 +
 +| flightTime |
 +
 +flightTime := 0.
 +bseId = #'BLUE_AIRPLANE' 
 +    ifTrue: [flightTime := 3]
 +^flightTime
 +</code>
 +You could set a break point on the temporary variable flightTime like this:
 +<code>
 +flightTime = 3
 +</code>
 +or 
 +<code>flightTime > 2</code>
 + on the line ^flightTime to stop execution.
 +
 +To see what instance variables a method understands, browse the class that owns the method, and then select 'Browse References -> To an instance variable' from the right click menu. 
 +      
 +{{:jas:jasbreakpoints.jpg|}}