gnupic: gpsim - subtle breakpoint syntax change
Subject:
gpsim - subtle breakpoint syntax change
From:
"Scott Dattalo" ####@####.####
Date:
20 Jan 2006 04:15:57 +0000
Message-Id: <61883.71.139.112.31.1137730407.squirrel@71.139.112.31>
About a year ago or so breakpoint expressions were added to gpsim. I just
went through and generalized this feature, but I had to make a subtle
change to the breakpoint syntax: If an expression is attached to a
breakpoint, then a comma is required to delimit it from the rest of the
command.
In general, the syntax is
break TYPE [expr1] [,expr2] [,expr3]
Where TYPE specifies the type of the breakpoint, e.g. e for execution, r
and w for register reads and writes, c for cycle, etc. The optional
expressions that follow allow you to specify the exact break condition.
Typically, the first expression is either just a symbol or a number. For
example, if you want to set a write break on a register, you can write:
break w PORTA. The second expression is an additional qualifier that is
only evaluated when the first condition is met. It must evaluate to true
for the break to occur. The third expression can only be a string (yes,
string are expressions too!). This is useful to label breaks with
something meaningful.
Here's the new help for the break command:
gpsim> help break
The 'break' command can be used to examine or set breakpoints.
gpsim supports execution style breaks, register access breaks,
complex expression breaks, attribute breaks, and other special breaks.
Program Memory breaks:
break e|r|w ADDRESS [expr] [,"message"]
Halts when the address is executed, read, or written. The ADDRESS can be
a symbol or a number. If the optional expr is specified, then it must
evaluate to true before the simulation will halt. The optional message
allows a description to be associated with the break.Register Memory
breaks:
break r|w REGISTER [expr] [,"message"]
Halts when 'REGISTER' is read or written and the optional expression
evaluates to true.
break r|w boolean_expression
older style to be deprecated...Cycle counter breaks: break c VALUE
[,"message"]
Halts when the cycle counter reaches 'VALUE'.
Attribute breaks:
break attribute
Arms the breakpoint condition for those attributes that support breaks.
For example, the stopwatch (help stopwatch) attribute can cause a break.
Miscellaneous breaks:
break so # halts on stack overflow.
break su # halts on stack underflow.
break wdt # halts on Watch Dog Timer timeout.
Expressions:
The conditional expressions mentioned above are syntactically similar to
C's
expressions.
Examples:
break # display all of the break points
break e 0x20 # set an execution break point at address 0x20
break w reg1 == 0 # break if a zero is written to register reg1
break w reg2 & 0x30 == 0xf0 # break if '3' is written to the
# upper nibble or reg2
break w reg3 (reg4 > 45) # break if reg4>45 while writing to reg3
break c 1000000 # break on the one million'th cycle
----
The new code is in CVS - allow a few hours for the public repository to
sync up.
If you have any questions or suggestions please feel free to ask.
Scott