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.

CCSTUDIO: Unable to setup breakpoints where I want.

Part Number: CCSTUDIO
Other Parts Discussed in Thread: MSP430F5438A

Hello!

I'm programming a MSP430F5438A. At one point, I would like to set a break point.

But CCS refuses to set it where I want. It looks like this.

uint8 some_variable = 0; // 

if(mSelect) { // (try to) Set breakpoint here

    some_variable = something; // The breakpoint is set here or even further in the code.

}

else {

    some_variable = something_else;

}

NB: the file hase been saved, and recompiled. I mean: If I add a line during debugging, and continue

to debug, it will of cours shift all the code by one line. But I change the code, recompile&run, try to set

a breakpont -> it doesn't work.

Any idea of what may happen?

  • Hello,

    Any idea of what may happen?

    I suspect optimization was enabled for the program. In such cases, it can impact debug visibility - including the location or source line breakpoints.

    See the below article for more details:

    https://dev.ti.com/tirex/explore/node?node=A__AEm7LJjS34iFPa5fpT7ttQ__ccs_devtools__FUz-xrs__LATEST

    Thanks

    ki

  • Hello!

    Thanks, it works. But... why? When I disable optimization, the program goes in both if and else cases (in fact, it's a list of objects,

    and the "some variable" decides if the object will be highlighted on the screen. For instance, if mSelect would never be accessed

    and always 1, I would understand that it's optimized out, but here both cases show up, therefore it has to check the if, and enter

    either case depending on the variable. And I suppose the functionality should not change whether it's debug mode or not...

    Thanks for any hint!

    Pascal

  • Thanks, it works. But... why?

    Did you read the article I referenced earlier? It explains why an increase in optimization will negatively impact your debug experience. For example, the optimizer will reorder instructions for better performance but this reordering will impact source line correlation so it will no longer be possible to set some source line breakpoints. For heavily optimized code, it will not be possible to do source line level stepping.