Single Stepping source code stops on wrong line

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

Single Stepping source code stops on wrong line

2,424件の閲覧回数
Frank_Z
Contributor I

Running through my source code, I set a breakpoint, but when single stepping after the break the cursor is off three lines of code and stops on blank lines, comments.

ラベル(1)
0 件の賞賛
返信
7 返答(返信)

2,385件の閲覧回数
Frank_Z
Contributor I

Apparently my auto-build setting in tripleDemod_Debug_Segger doesn't build the project. I have to do that manually, then debugging works fine.

0 件の賞賛
返信

2,382件の閲覧回数
ErichStyger
Specialist I

I'm usually not using that feature, but I checked it on my side: it works as expected.

What I'm using otherwise is the global setting here:

ErichStyger_0-1655187551866.png

 

Are you sure you used the correct launch configuration?

0 件の賞賛
返信

2,400件の閲覧回数
bobpaddock
Senior Contributor III

The compiler optimization level can cause that.

Setting optimization to -O0 to turn it off should fix that problem.

However then you are not truly debugging your production code, nor is it a good idea to run with optimization disabled.  That can break some compile-time generated code, it can also cover up problems with missing volatiles or code-motion.

 

 

0 件の賞賛
返信

2,396件の閲覧回数
Frank_Z
Contributor I

Not sure that's a solution or temporary bandaid.

0 件の賞賛
返信

2,393件の閲覧回数
ErichStyger
Specialist I

Could you share a screenshot of what you are seeing?

 

Indeed, if you are using aggressive optimizations, then the compiler might move around code and remove things, so there is no clear indication between source code and generated code. But it should not point to empty lines, or at least I have never seen this. That the current source line jumps around, that is expected if high optimizations are enabled.

0 件の賞賛
返信

2,408件の閲覧回数
Frank_Z
Contributor I
I modify the file either in Kinetis or my editor, save and press debug with auto build.
I have to "Build Project" to get compiled.
0 件の賞賛
返信

2,417件の閲覧回数
ErichStyger
Specialist I

Are you sure you have not modified your source files after having them compiled?

Erich

0 件の賞賛
返信