The
Instruction at Address A is Executed and Value on Data Bus Match
trigger type is used to trigger on a program instruction execution at trigger A address when the opcode of that instruction matches a specific byte value. This trigger type is useful in detecting the self-modifying instructions or code in RAM so that you can trace what exactly executes when the instructions are modified.
For example, if in a source code, a random pointer is changing the instruction executed at an address to a specific value (opcode), you can set a trigger at this instruction. Also, you need to specify that particular opcode value while configuring the debug launcher. Now, when the application executes and reaches the instruction where trigger is set, the specified opcode value matches with the opcode of the instruction and the trigger is fired.
To set the
Instruction at Address A is Executed and Value on Data Bus Match
trigger type:
- In the CodeWarrior Projects view, select the Sources folder of your project.
- Double-click the source file, for example, main.c to display its contents in the editor area. Replace the source code in the main.c file with the source code shown in Listing: Source code 2.
- Save and build the project.
- Open the Debug Configurations dialog box, and select your project in the tree structure.
- Click the Trace and Profile tab, and check the Enable Trace and Profile checkbox.
- Select the Collect Program Trace option in the Trace Mode Options group.
- Select the Continuously option.
- Ensure that the Instruction Execute option is selected in the Trigger Selection group.
- Select the Collect Trace From Trigger option in the Trace Start/Stop Conditions group.
- Check the Keep Last Buffer Before Trigger checkbox if not checked.
- Select the Instruction at Address A is Executed and Value on Data Bus Match option from the Trigger Type drop-down list.
- Click Apply to save the settings.
- Click Debug to debug the application and collect the trace data.
- After the application is debugged, set trigger A at entry(); in the main() function as shown in figure below.
- In the Disassembly view, copy first two hexadecimal digits at call to entry() from main() as shown below.
Figure 1. Copying Hexadecimal Letters in Disassembly View 
- Open the Debug Configurations dialog box, and click the Trace and Profile tab.
- In the Value to Compare on Data Bus text box, keep 0x and paste the two hexadecimal digits.
Figure 2. Value to Compare on Data Bus Text Box 
- Click Apply and close the Debug Configurations dialog box.
- Click the Terminate button in the Debug perspective to terminate the application.
- Debug the application again.
- Click Resume to resume the application and after a while click Suspend to suspend the application.
- Open the Trace Data viewer following the steps explained in Viewing Data to view the collected data.
The figure below shows the trace data collected after setting the
Instruction at Address A is Executed and Value on Data Bus Match
trigger type. When the opcode specified in the
Value to Compare on Data Bus
text box matches with the opcode of the instruction where trigger A is set, trigger is fired, and the collection of the trace data starts from there.
Figure 3. Trace Data - Instruction at Address A is Executed and Value on Data Bus Match 