True-time Simulator & Real-time Debugger

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

True-time Simulator & Real-time Debugger

ソリューションへジャンプ
1,670件の閲覧回数
leesp
Contributor I

I am using this with P&E multilink, and MC9S08JM32 controller.

How can I watch a variable in real time?

eg. I have a function xyz() in source file abc.c, and I want to watch how a variable volatile Bool myVar changes in real time.

I used the debugger Component -> Open -> Data but only the global variables are viewable. I do not know how to view the local variables within each function.

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
748件の閲覧回数
BlackNight
NXP Employee
NXP Employee

Hello,

the debugger can read from the memory while the target is running (using BDM background cycles). This works only for memory (with an address), but not for CPU core registers.

So with global memory you are ok.

But local variables are on the stack, and the address of it is not always the same. Even more: the scope of the function might not be 'alive', so the debugger cannot read that variable, so this won't work for local variables.

 

What you can do is: make the variable a 'static local':

void foo(void) {

  static int myStaticLocal;

...

}

and that way it will be in global memory, so you can watch it (but: it won't bee reentrant).

 

If you think your variable is always at a certain address on the stack (what usually is not the case), then you simply could watch that address on the stack too (e.g. in the memory view).

 

Hope this helps,

Erich

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
749件の閲覧回数
BlackNight
NXP Employee
NXP Employee

Hello,

the debugger can read from the memory while the target is running (using BDM background cycles). This works only for memory (with an address), but not for CPU core registers.

So with global memory you are ok.

But local variables are on the stack, and the address of it is not always the same. Even more: the scope of the function might not be 'alive', so the debugger cannot read that variable, so this won't work for local variables.

 

What you can do is: make the variable a 'static local':

void foo(void) {

  static int myStaticLocal;

...

}

and that way it will be in global memory, so you can watch it (but: it won't bee reentrant).

 

If you think your variable is always at a certain address on the stack (what usually is not the case), then you simply could watch that address on the stack too (e.g. in the memory view).

 

Hope this helps,

Erich

0 件の賞賛
返信