命中断点时劳特巴赫执行脚本

Lauterbach execute script when breakpoint is hit

我正在使用 Lauterbach 调试 PowerPC 嵌入式 C 软件。我想从 .cmm(PRACTICE) 脚本执行以下算法。如果可能,请告诉我:

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

我不想对整个函数进行存根。代码必须保持不变。

设置断点

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

要继续执行目标程序,请在调用的 PRACTICE 脚本末尾添加命令 Go

如果您不能将命令 Go 添加到被调用的 PRACTICE 脚本的末尾,您将需要这样的胶合脚本:

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

Break.Set 命令也知道一个选项 /RESUME,但这不适合您的情况,因为它不会等到被调用的 PRACTICE 脚本完成。

正如你所说的!

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

你可以试试这个;

;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. 

这将确保断点命中正确的函数或可运行。