Daniel
Daniel

Reputation: 99

Check which breakpoint is reached first. trace32 toolbox lauterbach for test automation

Basically I have two breakpoints, let's say A and B. I wrote a .cmm script for automation test and I want to know how can you see i breakpoint A is reached before breakpoint B. Based on this presumption to have a condition to pass or fail the test. The code below just shows if the breakpoints are reached and they are.

GO A
  TOOLBOX WaitValidateBreakpoint A
  ENTRY &StoppedAtBreakpoint

  IF &StoppedAtBreakpoint==FALSE()
  (
  TOOLBOX TestStepFail "Breakpoint A is not reached"
  RETURN
  )
  ELSE
  (
  TOOLBOX TestStepPass "Breakpoint A is reached"
  RETURN
  )

GO B
  TOOLBOX WaitValidateBreakpoint B
  ENTRY &StoppedAtBreakpoint

  IF &StoppedAtBreakpoint==FALSE()
  (
  TOOLBOX TestStepFail "Breakpoint B is not reached"
  RETURN
  )
  ELSE
  (
  TOOLBOX TestStepPass "Breakpoint B is reached"
  RETURN
  )

Upvotes: 1

Views: 770

Answers (1)

xasc
xasc

Reputation: 181

Due to the problem description I am assuming that the existing automation script is able to detect whether breakpoint A or B is hit. This is reflected by two PRACTICE macros containing the addresses of the two breakpoints:

LOCAL &address_bp_a &address_bp_b

Two additional PRACTICE macros track which breakpoint is triggered first:

LOCAL &bp_a_first &bp_b_first

&bp_a_first=FALSE()
&bp_b_first=FALSE()

The scripts starts the program execution and monitors which breakpoint is triggered first. This happens in a loop in case other breakpoints are hit:

WHILE !(&bp_a_first||&bp_b_first)
(
  Go
  WAIT !STATE.RUN()

  IF Register(PC)==&address_bp_a
  (
     &bp_a_first=TRUE()
  )
  ELSE IF Register(PC)==&address_bp_b
  (
     &bp_b_first=TRUE()
  )
)

IF &bp_a_first
(
   PRINT "Breakpoint A was hit first"
)
ELSE IF &bp_b_first
(
   PRINT "Breakpoint B was hit first"
)

Upvotes: 2

Related Questions