This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Debugger not stopping on my breakpoints in my code

I have some code that looks like this

// Get the photo transistor ADC input value

// will stop here

adcSampleAllChannels(); // Sample all ADC Channels

// *** but will not stop here

photoVal = dwAdcSingleSampleArray[SALU_ADC_CHAN_PHOTO];

photoAvg = (photoAvg*10 + photoVal)/11;

if (photoVal > photoAvg + 50){

photoSpike = true;

photoSpikeTime = i;

// +++

// but will stop here

Task_sleep(intervalX * 1000 / Clock_tickPeriod);

The problem is that it seems like the compiler is completely ignoring my code!!!

Any attempt to stop on any line of code between *** and +++ is ignored.

Help?

  • Hi Bruce,

    Can you check with "Step-into" function, whether the code actually enters "***" to "+++" section at all? There is a possibility that the code gets stuck here itself :adcSampleAllChannels();

    Regards,
    Gautam
  • Bruce Matichuk said:
    The problem is that it seems like the compiler is completely ignoring my code!!!

    If photoSpike and photoSpikeTime are local variables, which aren't referenced in the rest of the function, the compiler optimizer may remove the code between *** and +++ (since the compiler optimizer is permitted to remove code which which has no side effects). In which case try adding a volatile qualifier to photoSpike and photoSpikeTime to prevent the compiler optimizer from removing them.