1

我目前正在为使用劳特巴赫脚本执行的测试编写某种“骨架”。

在这个框架中,我想要一个部分,其中所有测试特定定义都应该完成,例如设置中断的函数,要更改的变量等。这部分应该靠近脚本文件的顶部,以便其他用户执行不必通过完整的脚本文件,在这里和那里更改值。

将要使用的一些变量在要测试的 C 代码中定义为函数局部。因此,只有在输入该函数的范围后,这些才可用于 Lauterbach 脚本 - 这深深地位于框架脚本代码中。

有没有办法在输入范围之前为这些变量定义宏?

让我们给出一些示例结构:

LOCAL &funcToTest      // the function we want to test
LOCAL &varToBeSet      // a variable within the function we want to alter
LOCAL &valueToBeSet    // the value we want to set &varToBeSet to 
... // some more definitions here
&funcToTest=someFunc
&varToBeSet=status    
&valueToBeSet=1      
... // some test code following here that sets up log files, screen areas
... // start the program to be tested etc.
IF (Register(PC)==ADDRESS.OFFSET(&funcToTest))
(
  // OK - we've hit the breakpoint inside the function to test
  ... // Run to some point where we can set the local variable
  Var.Set &varToBeSet=&valueToBeSet
  ... // Go on with the program and see what happens - this will be logged
)

问题是劳特巴赫抱怨- 这是正确的&varToBeSet=statusSymbol not found in this context因为它是一个局部变量。

通过 View->Symbols->SymbolsTreeView(或通过给出命令Symbol.List.Tree)查看符号,我可以找到符号(在这种特殊情况下,在节点 some_module.some_function.status 下找到)。单击它会在 TRACE32 状态行中提供信息,其中\\some_app\some_module\some_func\status包含type (auto STATUS)scope locallocation stack

但是,将我的脚本更改为 read&varToBeSet=\\some_app\some_module\some_func\status而不是&varToBeSet=status,并没有多大帮助。在这种情况下,劳特巴赫抱怨no access to that symbol.

有没有办法,我可以将宏的评估延迟到实际使用它的某个点,而不是在定义它时对其进行评估?

4

1 回答 1

1

使用引号:

&varToBeSet="\\some_app\some_module\some_func\status"
于 2018-04-27T14:17:53.027 回答