Macros while Debugging

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Macros while Debugging

761 次查看
preetuabraham
Contributor III

Hi

 

I am using CW10.6 for PE USB Multilink Universal debugger and while deugging I am getting the error as below .If this is because of some settings

 

header.h contains "#define VALUE (5)"

Then main.c includes the header file, then contains the code "foo = VALUE;"

But if I'm debugging, I am not able to read the value in Expression window it shows "Target Request failed: Failed".

 

Whether any settings for Macros ?

标签 (1)
0 项奖励
5 回复数

569 次查看
preetuabraham
Contributor III

Hi Erick,

Thanks for the updateI have one more clarifications regarding ,say for eg:

 

In one of the function,this is one of the execuatble

PTADD = AllLinesAsInputs ;

/* Data Direction, Port A, Bits 0 - 7 Inputs */

#define AllLinesAsInputs        0x00 and  #define   PTADD _PTADD.PortData are defined in .h files ,

 

so while debugging I placed a breakpoint in the function where the above executable line is present and then tried to read the values in Expression window while debugging

,it shows that the variable PTADD  "Target Request failed: Failed" in expression window,so my clarification is whether the variable PTADD gets the value 0x00 ,even though it does not show during debugging

0 项奖励

569 次查看
BlackNight
NXP Employee
NXP Employee

The compiler will 'see':

_PTADD.PortData = 0x00;

(have a read at https://mcuoneclipse.com/2015/11/23/preprocessor-listing-for-gnu-gcc-with-gnu-arm-eclipse-plugins/  to 'see' what the compiler is using).

So you do not have a variable/symbol PTADD: it is _PTADD.

It even might be that _PTADD is yet another macro.

I hope this helps,

Erich

0 项奖励

569 次查看
preetuabraham
Contributor III

I am able to read other variables but not Macros.Other variables when read in Expression window it shows the value in any of the format

0 项奖励

569 次查看
BlackNight
NXP Employee
NXP Employee

Makros are handled by the preprocessor of the compiler (see C preprocessor - Wikipedia, the free encyclopedia ) and are not visible any more to the compiler (the preprocessor does a kind of textual replacement). That's why you don't see them as debug symbols during debugging. This is normal for C/C++ compilers.

I hope this helps,

Erich

0 项奖励

569 次查看
preetuabraham
Contributor III

Hi Erick,

Thanks for the updateI have one more clarifications regarding ,say for eg:

In one of the function,this is one of the execuatble

PTADD = AllLinesAsInputs ;

/* Data Direction, Port A, Bits 0 - 7 Inputs */

#define AllLinesAsInputs 0x00 and #define PTADD _PTADD.PortData are defined in .h files ,

so while debugging I placed a breakpoint in the function where the above executable line is present and then tried to read the values in Expression window while debugging

,it shows that the variable PTADD "Target Request failed: Failed" in expression window,so my clarification is whether the variable PTADD gets the value 0x00 ,even though it does not show during debugging

0 项奖励