Dev-Cpp icon indicating copy to clipboard operation
Dev-Cpp copied to clipboard

For loop display in debugger

Open danielrcollins1 opened this issue 3 years ago • 1 comments

For pedagogical purposes in our computing courses, some of us like to introduce the "for" loop to new students by separating out the components on separate lines, and then inspecting in the debugger the exact control flow.

Unfortunately, at this time Dev-C++ incorrectly visualizes, after the body is executed, going back to the initializer segment (1st part), instead of the update segment (3rd part), which is what really happens. After that flow is correctly shown going to the test (2nd part), and then into the body. This can be seen in the attached screenshot (note the count has already iterated a few times).

It would be really lovely if the Dev-C++ debugger correctly showed return of control from the body of a "for" loop back to the update segment in a case like this.

ForLoopSeparated

danielrcollins1 avatar Apr 19 '21 15:04 danielrcollins1

In C++Builder using Clang, the debug behaviour is : [ top, comparison, top, action, increment ] .

In C++Builder Classic Compiler it is: [ top ] -> [ comparison, action, increment ]

In Dev-C++ and Code::Blocks, both using gcc, I get : [ top, comparison, action ]

I think this might be coming from gcc / gdb. Do you have experience with other compilers?

pmcgee69 avatar Apr 29 '21 07:04 pmcgee69