chi_n_me
chi_n_me

Reputation: 45

Lauterbach execute script when breakpoint is hit

I am using Lauterbach to debug a PowerPC embedded C software. I want to execute the below ALGO from a .cmm(PRACTICE) script. Pleas let me know if it is possible:

Set Breakpoint
When Breakpoint is hit, execute a .cmm file. This .cmm file will rewrite the values of an array.
Continue execution of program

I don't want to stub the whole function. The code has to be untouched.

Upvotes: 3

Views: 3297

Answers (2)

np2807
np2807

Reputation: 1160

As you have mentioned !

I don't want to stub the whole function. The code has to be untouched.

You can try this;

;set a breakpoint on function
BREAK.SET <function_name/addr>\<LINE NUMBER>

;store address of current program counter(PC)
&pc=r(pc)

&call=address.offset(<function_name/addr>\<LINE NUMBER>) ;This will give the address of a function where breakpoint is set.

;Compare the address if it hit on correct function 
IF (&pc==&call)
    Do call_meonceHIT.cmm ;your desired .cmm script.
Break.Delete /ALL ; to delete all the set breakpoint. 

This will make sure that breakpoint is hitting correct function or runnable.

Upvotes: 1

Holger
Holger

Reputation: 4173

Set the breakpoint with

   Break.Set <addr> /Program /CMD "DO myScript.cmm"

To continue the execution of the target program, add the command Go to the end of the called PRACTICE script.

If you can't add the command Go to the end of the called PRACTICE script, you'll need a veneer-script like this:

// Content of myScript.cmm
DO myAlgorithm.cmm
Go
ENDDO

The Break.Set command knows also an option /RESUME, but this is not suitable for your case, since it won't wait until the called PRACTICE script has finished.

Upvotes: 5

Related Questions