This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Parts of code are ignored by compiler, can't put breakpoint on these parts

Hello,

I have a problem in my program, At execution in debug mode the code I wrote is just ignored.

The code is a system filtering message and checking validity of data received, I use switch case and imbricated switch case to filter the message and if else condition to validate the data.

It seems that else case and default case are sometime ignored but not always!

Break condition are also ignored in certain case.

The compilation process don't say anything about the code wrote.

the problem occur in imbricated switch case.

Have you an idea of what can be the problem?

Here my code:

case APP_SERVICE_CAN__MAINTENANCE_DATE:
switch(pdata[SDOSUBINDEX])
{

case LAST_MAINTENANCE_DATE:
if( isCANFormatDate(sdo_data.Word32bit))
{
eeprom_write_Last_Maintenance_date(sdo_data.Word32bit);
}
else {status = USERSDO_ABORT;}//can't put breakpoint here --> this part is ignored
break;

case NEXT_MAINTENANCE_DATE:
if( isCANFormatDate(sdo_data.Word32bit))
{
eeprom_write_Next_maintenance_date(sdo_data.Word32bit);
}else{
status = USERSDO_ABORT;//can't put breakpoint here
}
break;
default:
status = USERSDO_ABORT;// can't put break point here
break;
}
break;// can't put breakpoint here

I know the compiler optimize the code and ignore the dead part but all of these cases are reachable (I think), I heard about use of #pragma to change locally the compiler behavior but I don't know if it's the real problem here.

I also read about the way compiler interpret the switch case, it can be a series of if elsif or a jump list depending of various criteria. this variable judgement of compiler is maybe the problem.

So I hesitate to rewrite the code in a different way, have you known issue like that?

thank for answers,
Guillaume

0